diff --git a/app.js b/app.js
index 38afdf2..4697090 100644
--- a/app.js
+++ b/app.js
@@ -6,7 +6,13 @@ import {
App({
globalData: {},
onLaunch: function () {
+ let that = this
Follow.init()
wx.cloud.init()
+ wx.getSystemInfo({
+ success(res) {
+ that.globalData.systemInfo = res
+ },
+ })
}
})
\ No newline at end of file
diff --git a/app.json b/app.json
index 9f8eb0e..7ec2ce7 100644
--- a/app.json
+++ b/app.json
@@ -5,6 +5,7 @@
"pages/idel-index/idel-index",
"pages/idel-detail/idel-detail",
"pages/idel-create/idel-create",
+ "pages/idel-comment/idel-comment",
"pages/idel-my/idel-my",
"pages/auth/auth",
"pages/iclass/iclass",
diff --git a/app.wxss b/app.wxss
index aaddffa..97aa22e 100644
--- a/app.wxss
+++ b/app.wxss
@@ -12,4 +12,12 @@ page {
align-items: center;
justify-content: center;
border-radius: 100rpx;
+}
+
+.float-button{
+ width: 180rpx;
+ height: 180rpx;
+ position: fixed;
+ z-index: 10;
+ right: 10rpx;
}
\ No newline at end of file
diff --git a/img/SearchInput/Cancel.svg b/img/SearchInput/Cancel.svg
new file mode 100644
index 0000000..f0fe330
--- /dev/null
+++ b/img/SearchInput/Cancel.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/img/idel/add.svg b/img/idel/add.svg
deleted file mode 100644
index 82ef8fb..0000000
--- a/img/idel/add.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/img/idel/fabu.svg b/img/idel/fabu.svg
new file mode 100644
index 0000000..ec76932
--- /dev/null
+++ b/img/idel/fabu.svg
@@ -0,0 +1,30 @@
+
diff --git a/img/idel/thing.svg b/img/idel/thing.svg
deleted file mode 100644
index 4b4be15..0000000
--- a/img/idel/thing.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/img/idel/wode.svg b/img/idel/wode.svg
new file mode 100644
index 0000000..ab580a7
--- /dev/null
+++ b/img/idel/wode.svg
@@ -0,0 +1,32 @@
+
diff --git a/pages/components/Comment/Comment.js b/pages/components/Comment/Comment.js
new file mode 100644
index 0000000..fcd9688
--- /dev/null
+++ b/pages/components/Comment/Comment.js
@@ -0,0 +1,31 @@
+// components/component-tag-name.js
+import {
+ Requests
+} from "../../../utils/Requests"
+Component({
+ /**
+ * 组件的属性列表
+ */
+ properties: {
+ comment: Object
+ },
+
+ /**
+ * 组件的初始数据
+ */
+ data: {
+ },
+
+ /**
+ * 组件的方法列表
+ */
+ methods: {
+ tapComment: function () {
+ wx.navigateTo({
+ url:Requests.makeUrl("/pages/idel-comment/idel-comment",{
+ _id:this.data.comment._id
+ })
+ })
+ },
+ }
+})
\ No newline at end of file
diff --git a/pages/components/Comment/Comment.json b/pages/components/Comment/Comment.json
new file mode 100644
index 0000000..e8cfaaf
--- /dev/null
+++ b/pages/components/Comment/Comment.json
@@ -0,0 +1,4 @@
+{
+ "component": true,
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/pages/components/Comment/Comment.wxml b/pages/components/Comment/Comment.wxml
new file mode 100644
index 0000000..acc8170
--- /dev/null
+++ b/pages/components/Comment/Comment.wxml
@@ -0,0 +1,9 @@
+
+
+
+ {{comment.from.nickName}}
+ 回复@{{comment.to.nickName}}
+
+ {{comment.content}}
+ {{comment.create_time}}
+
\ No newline at end of file
diff --git a/pages/components/Comment/Comment.wxss b/pages/components/Comment/Comment.wxss
new file mode 100644
index 0000000..c3f08c1
--- /dev/null
+++ b/pages/components/Comment/Comment.wxss
@@ -0,0 +1,48 @@
+.main-view {
+ width: 750rpx;
+ display: flex;
+ flex-direction: column;
+ padding-top: 15rpx;
+ padding-bottom: 15rpx;
+}
+
+.hover{
+ background-color: #b8b8b89f;
+}
+
+.line {
+ display: flex;
+ flex-direction: row;
+ align-items: center;
+ margin-left: 20rpx;
+}
+
+.avatar {
+ height: 60rpx;
+ width: 60rpx;
+ border-radius: 50%;
+ overflow: hidden;
+ border: 1px solid;
+ border-color: #346cd1;
+}
+
+.nickName {
+ margin-left: 20rpx;
+ font-size: 30rpx;
+ font-weight: bold;
+}
+
+.replay{
+ color: #707070;
+}
+
+.content{
+ margin-left: 100rpx;
+ width: 620rpx;
+}
+
+.time{
+ margin-left: 100rpx;
+ color: #707070;
+ font-size: 18rpx;
+}
\ No newline at end of file
diff --git a/pages/components/GoodCard/GoodCard.js b/pages/components/GoodCard/GoodCard.js
index 555c423..857e530 100644
--- a/pages/components/GoodCard/GoodCard.js
+++ b/pages/components/GoodCard/GoodCard.js
@@ -17,21 +17,39 @@ Component({
data: {
},
+ lifetimes:{
+ attached: function () {
+ let that = this
+ Requests.getWithCache({
+ url: "/user/" + this.data.good.owner,
+ success(data) {
+ that.setData({
+ owner: data
+ })
+ }
+ })
+ this.setData({
+ time: this.data.good.time.split(".")[0]
+ })
+ },
+ },
- attached: function () {
- let that = this
- Requests.getWithCache({
- url: "/user/" + this.data.good.owner,
- success(data) {
- that.setData({
- owner: data
- })
- }
- })
- this.setData({
- time: this.data.good.time.split(".")[0]
- })
+ // 数据监听器
+ // 为了在good发生变化的时候同时改变owner
+ observers:{
+ "good":function(){
+ let that = this
+ Requests.getWithCache({
+ url: "/user/" + this.data.good.owner,
+ success(data) {
+ that.setData({
+ owner: data
+ })
+ }
+ })
+ }
},
+
/**
* 组件的方法列表
*/
diff --git a/pages/components/GoodCard/GoodCard.wxml b/pages/components/GoodCard/GoodCard.wxml
index b03d1bf..6e849e6 100644
--- a/pages/components/GoodCard/GoodCard.wxml
+++ b/pages/components/GoodCard/GoodCard.wxml
@@ -1,14 +1,14 @@
-
+
{{good.title}}
¥
{{good.price}}
-
+
diff --git a/pages/components/SearchInput/SearchInput.js b/pages/components/SearchInput/SearchInput.js
index cc40891..4b6d132 100644
--- a/pages/components/SearchInput/SearchInput.js
+++ b/pages/components/SearchInput/SearchInput.js
@@ -20,7 +20,7 @@ Component({
* 组件的初始数据
*/
data: {
-
+ inputValue:""
},
/**
@@ -34,6 +34,13 @@ Component({
},
tapSearch: function () {
this.data.search(this.data.inputValue)
+ },
+ tapCancel:function(){
+ console.log(111)
+ this.setData({
+ inputValue: ""
+ })
+ this.data.search("")
}
}
})
\ No newline at end of file
diff --git a/pages/components/SearchInput/SearchInput.wxml b/pages/components/SearchInput/SearchInput.wxml
index 5d3b2d6..7593318 100644
--- a/pages/components/SearchInput/SearchInput.wxml
+++ b/pages/components/SearchInput/SearchInput.wxml
@@ -1,9 +1,10 @@
-
-
-
-
-
- 搜索
-
+
+
+
+
+
+
+ 搜索
+
\ No newline at end of file
diff --git a/pages/components/SearchInput/SearchInput.wxss b/pages/components/SearchInput/SearchInput.wxss
index 079027e..7f19067 100644
--- a/pages/components/SearchInput/SearchInput.wxss
+++ b/pages/components/SearchInput/SearchInput.wxss
@@ -26,7 +26,7 @@
}
.input {
- width: 90%;
+ width: 420rpx;
}
.text {
@@ -39,4 +39,11 @@
flex-direction: column;
justify-content: center;
align-items: center;
+}
+
+.cancel{
+ margin-left: 10rpx;
+ margin-right: 10rpx;
+ width: 30rpx;
+ height: 30rpx;
}
\ No newline at end of file
diff --git a/pages/idel-comment/idel-comment.js b/pages/idel-comment/idel-comment.js
new file mode 100644
index 0000000..1a1f60a
--- /dev/null
+++ b/pages/idel-comment/idel-comment.js
@@ -0,0 +1,86 @@
+import {
+ Requests
+} from "../../utils/Requests"
+
+// pages/idel-comment/idel-comment.js
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ content: "",
+ placeholder: "请输入评论"
+ },
+
+ input: function (e) {
+ this.setData({
+ content: e.detail.value
+ })
+ },
+
+
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad: function (options) {
+ let that = this
+ if (options._id != undefined) {
+ Requests.get({
+ url: "/idel-comment",
+ data: {
+ _id: options._id
+ },
+ success(data) {
+ that.setData({
+ comment: data,
+ placeholder: "回复@" + data.from.nickName
+ })
+ }
+ })
+ } else if (options.good_id != undefined) {
+ that.setData({
+ good_id: options.good_id
+ })
+ }
+ },
+
+ submit: function () {
+ let that = this
+ if (that.data.good_id == undefined) {
+ Requests.post({
+ url: "/idel-comment/" + that.data.comment.good_id,
+ data: {
+ reply_id: that.data.comment._id,
+ to_openid: that.data.comment.from_openid,
+ content: that.data.content
+ },
+ success(data) {
+ wx.showToast({
+ title: '成功',
+ })
+ setTimeout(function () {
+ wx.navigateBack()
+ }, 1000)
+ }
+ })
+ } else {
+ Requests.post({
+ url: "/idel-comment/" + that.data.good_id,
+ data: {
+ reply_id: 0,
+ to_openid: 0,
+ content: that.data.content
+ },
+ success(data) {
+ wx.showToast({
+ title: '成功',
+ })
+ setTimeout(function () {
+ wx.navigateBack()
+ }, 1000)
+ }
+ })
+ }
+ },
+})
\ No newline at end of file
diff --git a/pages/idel-comment/idel-comment.json b/pages/idel-comment/idel-comment.json
new file mode 100644
index 0000000..8835af0
--- /dev/null
+++ b/pages/idel-comment/idel-comment.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/pages/idel-comment/idel-comment.wxml b/pages/idel-comment/idel-comment.wxml
new file mode 100644
index 0000000..28db8b1
--- /dev/null
+++ b/pages/idel-comment/idel-comment.wxml
@@ -0,0 +1,7 @@
+
+
+ {{content.length}}/50
+
+
+ 确定
+
\ No newline at end of file
diff --git a/pages/idel-comment/idel-comment.wxss b/pages/idel-comment/idel-comment.wxss
new file mode 100644
index 0000000..98c309f
--- /dev/null
+++ b/pages/idel-comment/idel-comment.wxss
@@ -0,0 +1,35 @@
+/* pages/idel-comment/idel-comment.wxss */
+.input-view{
+ width: 100%;
+ height: 250rpx;
+ display: flex;
+ flex-direction:column;
+ align-items: center;
+ padding-top: 30rpx;
+ background-color: #fff;
+}
+
+.input{
+ width: 90%;
+ height: 85%;
+}
+
+.input-count{
+ align-self: flex-end;
+ margin-right: 5%;
+}
+
+.button-view{
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ width: 100%;
+ margin-top: 40rpx;
+}
+
+.button{
+ background-color: #276DED;
+ width: 30%;
+ height: 70rpx;
+ color: white;
+}
\ No newline at end of file
diff --git a/pages/idel-create/idel-create.wxml b/pages/idel-create/idel-create.wxml
index 60d5f40..17fd041 100644
--- a/pages/idel-create/idel-create.wxml
+++ b/pages/idel-create/idel-create.wxml
@@ -10,7 +10,7 @@
-
+
{{mode=="create"?"发布":"更新"}}
diff --git a/pages/idel-detail/idel-detail.js b/pages/idel-detail/idel-detail.js
index cbd30b1..9dc1771 100644
--- a/pages/idel-detail/idel-detail.js
+++ b/pages/idel-detail/idel-detail.js
@@ -2,6 +2,9 @@
import {
Requests
} from "../../utils/Requests"
+
+const app=getApp()
+
Page({
/**
@@ -15,14 +18,19 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
+ this.setData({
+ _id: options._id,
+ contentHeight:app.globalData.systemInfo.windowHeight
+ })
let that = this
+ //请求商品信息
Requests.get({
url: "/idle",
data: {
- _id: options._id
+ _id: that.data._id
},
success(data) {
- data[0].time=data[0].time.split(".")[0]
+ data[0].time = data[0].time.split(".")[0]
that.setData({
good: data[0]
})
@@ -38,25 +46,41 @@ Page({
})
},
- tapImg:function(e){
+ onShow: function () {
+ let that = this
+ // 请求评论数据
+ Requests.get({
+ url: "/idel-comment/" + that.data._id,
+ success(data) {
+ for (var i = 0; i < data.length; i++) {
+ data[i].create_time = data[i].create_time.split(".")[0]
+ }
+ that.setData({
+ comments: data
+ })
+ }
+ })
+ },
+
+ tapImg: function (e) {
wx.previewImage({
urls: this.data.good.photos,
- current:e.currentTarget.dataset.url
+ current: e.currentTarget.dataset.url
})
},
- contact:function(){
- let that=this
+ contact: function () {
+ let that = this
wx.showModal({
- title:"联系方式",
- content:this.data.good.contact,
- confirmText:"复制",
- confirmColor:"#276DED",
- success(res){
- if(res.confirm){
+ title: "联系方式",
+ content: this.data.good.contact,
+ confirmText: "复制",
+ confirmColor: "#276DED",
+ success(res) {
+ if (res.confirm) {
wx.setClipboardData({
- data:that.data.good.contact,
- success(res){
+ data: that.data.good.contact,
+ success(res) {
wx.showToast({
title: '已复制联系方式',
})
@@ -67,52 +91,11 @@ Page({
})
},
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
-
- },
-
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
-
- },
-
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
-
- },
-
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
-
- },
-
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
-
+ toComment:function(){
+ wx.navigateTo({
+ url: Requests.makeUrl("/pages/idel-comment/idel-comment",{
+ good_id:this.data._id
+ }),
+ })
}
})
\ No newline at end of file
diff --git a/pages/idel-detail/idel-detail.json b/pages/idel-detail/idel-detail.json
index 8835af0..d7e83d3 100644
--- a/pages/idel-detail/idel-detail.json
+++ b/pages/idel-detail/idel-detail.json
@@ -1,3 +1,5 @@
{
- "usingComponents": {}
+ "usingComponents": {
+ "comment":"../components/Comment/Comment"
+ }
}
\ No newline at end of file
diff --git a/pages/idel-detail/idel-detail.wxml b/pages/idel-detail/idel-detail.wxml
index b998a9e..b01b994 100644
--- a/pages/idel-detail/idel-detail.wxml
+++ b/pages/idel-detail/idel-detail.wxml
@@ -1,23 +1,30 @@
-
-
-
-
- {{owner.nickName}}
- 发布于{{good.time}}
+
+
+
+
+
+ {{owner.nickName}}
+ 发布于{{good.time}}
+
-
-
-
- {{good.title}}
- {{good.describe}}
-
-
+
+
+ {{good.title}}
+ {{good.describe}}
+
+
+
+
+
+
+
-
+
¥{{good.price}}
+
联系卖家
\ No newline at end of file
diff --git a/pages/idel-detail/idel-detail.wxss b/pages/idel-detail/idel-detail.wxss
index b10931a..bbe8965 100644
--- a/pages/idel-detail/idel-detail.wxss
+++ b/pages/idel-detail/idel-detail.wxss
@@ -65,4 +65,14 @@
height: 60rpx;
background-color: #276DED;
color: #fff;
+}
+
+.divider2{
+ width: 750rpx;
+ background-color: #818181;
+ height: 1px;
+}
+
+.comment{
+ color:#276DED ;
}
\ No newline at end of file
diff --git a/pages/idel-index/idel-index.js b/pages/idel-index/idel-index.js
index 14b2ff8..58b739d 100644
--- a/pages/idel-index/idel-index.js
+++ b/pages/idel-index/idel-index.js
@@ -34,12 +34,6 @@ Page({
this.setData({
search: this.search
})
- },
-
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
wx.startPullDownRefresh({})
},
diff --git a/pages/idel-index/idel-index.wxml b/pages/idel-index/idel-index.wxml
index f47378a..f2be213 100644
--- a/pages/idel-index/idel-index.wxml
+++ b/pages/idel-index/idel-index.wxml
@@ -4,9 +4,9 @@
-
-
+
+
-
-
+
+
\ No newline at end of file
diff --git a/project.config.json b/project.config.json
index 9b193d8..9b77212 100644
--- a/project.config.json
+++ b/project.config.json
@@ -13,7 +13,7 @@
"checkInvalidKey": true
},
"compileType": "miniprogram",
- "libVersion": "2.10.0",
+ "libVersion": "2.10.1",
"appid": "wx12bef97a98001f0b",
"projectname": "myNCUT",
"debugOptions": {
diff --git a/utils/Requests.js b/utils/Requests.js
index 310c930..d51889f 100644
--- a/utils/Requests.js
+++ b/utils/Requests.js
@@ -1,7 +1,12 @@
export class Requests {
// static baseUrl = "http://127.0.0.1:8080/v1"
// static baseUrl = "https://myncutdev.ncut.edu.cn/v1"
- static baseUrl = "https://myncut.ncut.edu.cn/v1"
+ // static baseUrl = "https://myncut.ncut.edu.cn/v1"
+ // static baseUrl = "http://10.211.55.3:8080/v1"
+ static baseUrl = "http://192.168.0.101/v1"
+
+ // 请求日志
+ static console = true
static token
@@ -67,12 +72,18 @@ export class Requests {
}) {
let that = this
header["Token"] = this.token
+ if (this.console)
+ console.log("开始请求:", method, this.baseUrl + url)
wx.request({
method: method,
url: this.baseUrl + url,
header: header,
data: data,
success(res) {
+ if (that.console) {
+ console.log("响应:", method, that.baseUrl + url)
+ console.log(res.data)
+ }
if (res.data.code == 200) {
if (success != null)
success(res.data.data)