许成详 6 anos atrás
pai
commit
275135e68f

+ 16
- 0
config/api.js Ver arquivo

17
     update: {
17
     update: {
18
       method: 'PUT',
18
       method: 'PUT',
19
       url: `${BaseAPIURl}wx/user`
19
       url: `${BaseAPIURl}wx/user`
20
+    },
21
+    signUpList: { // 报名过的活动
22
+      method: 'GET',
23
+      url: `${BaseAPIURl}wx/activity/byuser/:openid`
20
     }
24
     }
21
   },
25
   },
22
   dict: {
26
   dict: {
59
     detail: { // 活动详情
63
     detail: { // 活动详情
60
       method: 'GET',
64
       method: 'GET',
61
       url: `${BaseAPIURl}wx/activity/:id`
65
       url: `${BaseAPIURl}wx/activity/:id`
66
+    },
67
+    signUp: { // 活动报名
68
+      method: 'POST',
69
+      url: `${BaseAPIURl}wx/signUpActivity/:openid`
62
     }
70
     }
63
   },
71
   },
64
   appointment: {
72
   appointment: {
89
     list: { // 评论列表
97
     list: { // 评论列表
90
       methods: 'GET',
98
       methods: 'GET',
91
       url: `${BaseAPIURl}/wx/comment/list`
99
       url: `${BaseAPIURl}/wx/comment/list`
100
+    },
101
+    add: { // 添加评论
102
+      method: 'POST',
103
+      url: `${BaseAPIURl}/comment/add`
92
     }
104
     }
105
+  },
106
+  uploadImage: { // 图片上传
107
+    method: 'POST',
108
+    url: `${BaseAPIURl}uploadImage`
93
   }
109
   }
94
 }
110
 }
95
 
111
 

+ 79
- 14
pages/ActivityDetail/comment.js Ver arquivo

1
 //index.js
1
 //index.js
2
 //获取应用实例
2
 //获取应用实例
3
+import fetch from '../../utils/http'
4
+
3
 const app = getApp()
5
 const app = getApp()
6
+const $api = require('../../config/api.js').$api
4
 
7
 
5
 Page({
8
 Page({
6
   onShow() {
9
   onShow() {
8
       title: '添加评论'
11
       title: '添加评论'
9
     })
12
     })
10
   },
13
   },
14
+  onLoad(e) {
15
+    this.setData({
16
+      Id: e.id,
17
+      FormData: {
18
+        ...this.data.FormData,
19
+        mainId: e.id,
20
+        customerId: app.globalData.UserInfo.customerId
21
+      }
22
+    })
23
+  },
11
   data: {
24
   data: {
25
+    Id: '',
12
     UserInfo: app.globalData.UserInfo,
26
     UserInfo: app.globalData.UserInfo,
13
     SubmitOff: true,
27
     SubmitOff: true,
14
     FormData: {
28
     FormData: {
15
-      Comment: '',
16
-      ImgList: []
29
+      customerId: '',
30
+      commentType: 'activity',
31
+      mainId: '',
32
+      parentId: '',
33
+      commentContent: '',
34
+      imgArray: []
17
     }
35
     }
18
   },
36
   },
19
   AddImage() { // 添加图片
37
   AddImage() { // 添加图片
20
     let _self = this
38
     let _self = this
21
     wx.chooseImage({
39
     wx.chooseImage({
22
-      count: 4 - _self.data.FormData.ImgList.length,
40
+      count: 4 - _self.data.FormData.imgArray.length,
23
       sizeType: ['original', 'compressed'],
41
       sizeType: ['original', 'compressed'],
24
       sourceType: ['album', 'camera'],
42
       sourceType: ['album', 'camera'],
25
       success(res) {
43
       success(res) {
26
-        let aArr = _self.data.FormData.ImgList.slice(0)
27
-        res.tempFilePaths.map((item) => {
28
-          aArr.push(item)
29
-        })
30
-        _self.setData({
31
-          FormData: {
32
-            ..._self.data.FormData,
33
-            ImgList: aArr
34
-          }
44
+        const tempFilePaths = res.tempFilePaths || []
45
+        let aArr = _self.data.FormData.imgArray.slice(0)
46
+        let num = 0
47
+        tempFilePaths.map((item, index) => {
48
+          wx.uploadFile({
49
+            url: $api.uploadImage.url,
50
+            filePath: item,
51
+            name: 'uploadFiles',
52
+            success(resr) {
53
+              num += 1
54
+              aArr.push(JSON.parse(resr.data).data[0])
55
+              if (num === tempFilePaths.length) {
56
+                _self.setData({
57
+                  FormData: {
58
+                    ..._self.data.FormData,
59
+                    imgArray: aArr
60
+                  }
61
+                })
62
+              }
63
+            }
64
+          })
35
         })
65
         })
36
       }
66
       }
37
     })
67
     })
45
     })
75
     })
46
   },
76
   },
47
   DeleteItem(e) { // 删除img
77
   DeleteItem(e) { // 删除img
48
-    let aArr = this.data.FormData.ImgList.slice(0)
78
+    let aArr = this.data.FormData.imgArray.slice(0)
49
     aArr.splice(e.target.dataset.index, 1)
79
     aArr.splice(e.target.dataset.index, 1)
50
     this.setData({
80
     this.setData({
51
       FormData: {
81
       FormData: {
52
         ...this.data.FormData,
82
         ...this.data.FormData,
53
-        ImgList: aArr
83
+        imgArray: aArr
54
       }
84
       }
55
     })
85
     })
56
   },
86
   },
57
   SubmitForm() { // 发布
87
   SubmitForm() { // 发布
88
+    if (this.data.FormData.commentContent === '') {
89
+      // Toast('评论内容不能为空!')
90
+      wx.showToast({
91
+        title: '评论内容不能为空!',
92
+        icon: 'none',
93
+      })
94
+      return false
95
+    }
58
     if (this.data.SubmitOff) {
96
     if (this.data.SubmitOff) {
59
       this.setData({
97
       this.setData({
60
         SubmitOff: false
98
         SubmitOff: false
61
       })
99
       })
100
+      fetch({
101
+        url: $api.comment.add.url,
102
+        method: $api.comment.add.method,
103
+        data: {
104
+          ...this.data.FormData
105
+        }
106
+      }).then((res) => {
107
+        if (res.code === 200) {
108
+          wx.showToast({
109
+            title: '添加评论成功!',
110
+            icon: 'success',
111
+          })
112
+          setTimeout(() => {
113
+            wx.navigateBack({
114
+              delta: 1
115
+            })
116
+          }, 500)
117
+        } else {
118
+          wx.showToast({
119
+            title: res.message,
120
+            icon: 'none',
121
+          })
122
+          this.setData({
123
+            SubmitOff: true
124
+          })
125
+        }
126
+      })
62
     }
127
     }
63
   }
128
   }
64
 })
129
 })

+ 3
- 1
pages/ActivityDetail/comment.json Ver arquivo

1
 {
1
 {
2
-  "usingComponents": {}
2
+  "usingComponents": {
3
+    "van-toast": "/dist/toast/index"
4
+  }
3
 }
5
 }

+ 3
- 3
pages/ActivityDetail/comment.wxml Ver arquivo

1
 <!--index.wxml-->
1
 <!--index.wxml-->
2
 <view class="MainPage">
2
 <view class="MainPage">
3
   <view class="textarea">
3
   <view class="textarea">
4
-    <textarea placeholder="请输入评论" bindinput="FormInput" data-name="Comment"></textarea>
4
+    <textarea placeholder="请输入评论" bindinput="FormInput" data-name="commentContent"></textarea>
5
   </view>
5
   </view>
6
   <view class="photos">
6
   <view class="photos">
7
     <view class="flex-h">
7
     <view class="flex-h">
8
       <view class="flex-item">
8
       <view class="flex-item">
9
-        <view class="item" wx:for="{{FormData.ImgList}}" wx:for-index="idx" wx:for-item="item" wx:key="key">
9
+        <view class="item" wx:for="{{FormData.imgArray}}" wx:for-index="idx" wx:for-item="item" wx:key="key">
10
           <image mode="aspectFit" src="{{item}}" class="centerLabel contain"></image>
10
           <image mode="aspectFit" src="{{item}}" class="centerLabel contain"></image>
11
           <text data-index="{{idx}}" bindtap="DeleteItem"></text>
11
           <text data-index="{{idx}}" bindtap="DeleteItem"></text>
12
         </view>
12
         </view>
13
-        <view class="addBtn" wx:if="{{FormData.ImgList.length < 4}}" bindtap="AddImage">
13
+        <view class="addBtn" wx:if="{{FormData.imgArray.length < 4}}" bindtap="AddImage">
14
           <view class="centerLabel">
14
           <view class="centerLabel">
15
             <image mode="widthFix" src="/assets/images/icon35.png"></image>
15
             <image mode="widthFix" src="/assets/images/icon35.png"></image>
16
             <text>相机/相册</text>
16
             <text>相机/相册</text>

+ 74
- 15
pages/ActivityDetail/index.js Ver arquivo

6
 const $api = require('../../config/api.js').$api
6
 const $api = require('../../config/api.js').$api
7
 
7
 
8
 Page({
8
 Page({
9
-  onShow() {},
9
+  onShow() {
10
+    if (this.data.Type === 1) {
11
+      this.GetProjectDetail()
12
+    } else {
13
+      this.GetActivityDetail()
14
+      this.GetCommentList()
15
+      this.GetSignUpList()
16
+    }
17
+  },
10
   onLoad(e) {
18
   onLoad(e) {
11
     this.setData({
19
     this.setData({
12
       Id: e.id,
20
       Id: e.id,
28
     Type: null,
36
     Type: null,
29
     ShowPopup: false,
37
     ShowPopup: false,
30
     FormData: {
38
     FormData: {
31
-      Name: '',
32
-      PhoneNum: '',
33
-      IdCard: ''
39
+      customerName: '',
40
+      phone: '',
41
+      idNum: '',
42
+      activityId: ''
34
     },
43
     },
35
     SubmitOff: true,
44
     SubmitOff: true,
36
     ActivityDetail: {
45
     ActivityDetail: {
42
     CommentList: []
51
     CommentList: []
43
   },
52
   },
44
   onReady() {
53
   onReady() {
45
-    if (this.data.Type === 1) {
46
-      this.GetProjectDetail()
47
-    } else {
48
-      this.GetActivityDetail()
49
-      this.GetCommentList()
50
-    }
54
+
55
+  },
56
+  GetSignUpList() {
57
+    fetch({
58
+      url: $api.user.signUpList.url.replace(':openid', app.globalData.UserInfo.openid) + '?pageNum=1&pageSize=10000',
59
+      method: $api.user.signUpList.method
60
+    }).then((res) => {
61
+      console.log(res)
62
+    })
51
   },
63
   },
52
   AddComment() { // 添加评论
64
   AddComment() { // 添加评论
53
     wx.navigateTo({
65
     wx.navigateTo({
63
     this.setData({
75
     this.setData({
64
       ShowPopup: false,
76
       ShowPopup: false,
65
       FormData: {
77
       FormData: {
66
-        Name: '',
67
-        PhoneNum: '',
68
-        IdCard: ''
78
+        customerName: '',
79
+        phone: '',
80
+        idNum: '',
81
+        activityId: this.data.FormData.activityId
69
       }
82
       }
70
     })
83
     })
71
   },
84
   },
78
     })
91
     })
79
   },
92
   },
80
   Submit() { // 提交报名信息
93
   Submit() { // 提交报名信息
94
+    if (this.data.FormData.customerName === '') {
95
+      wx.showToast({
96
+        title: '姓名不能为空!',
97
+        icon: 'none'
98
+      })
99
+      return false
100
+    }
101
+    if (this.data.FormData.phone === '') {
102
+      wx.showToast({
103
+        title: '手机号不能为空!',
104
+        icon: 'none'
105
+      })
106
+      return false
107
+    }
108
+    if (this.data.FormData.idNum === '') {
109
+      wx.showToast({
110
+        title: '身份证号不能为空!',
111
+        icon: 'none'
112
+      })
113
+      return false
114
+    }
81
     if (this.data.SubmitOff) {
115
     if (this.data.SubmitOff) {
82
       this.setData({
116
       this.setData({
83
         SubmitOff: false
117
         SubmitOff: false
84
       })
118
       })
85
-
119
+      fetch({
120
+        url: $api.activity.signUp.url.replace(':openid', app.globalData.UserInfo.openid),
121
+        method: $api.activity.signUp.method,
122
+        data: {
123
+          ...this.data.FormData
124
+        }
125
+      }).then((res) => {
126
+        // console.log(res)
127
+        if (res.code === 200) {
128
+          wx.showToast({
129
+            title: '报名成功!',
130
+            icon: 'success'
131
+          })
132
+          this.setData({
133
+            ShowPopup: false
134
+          })
135
+        } else {
136
+          wx.showToast({
137
+            title: res.message,
138
+            icon: 'none'
139
+          })
140
+          this.setData({
141
+            SubmitOff: true
142
+          })
143
+        }
144
+      })
86
     }
145
     }
87
   },
146
   },
88
   GetCommentList() { // 获取评论列表
147
   GetCommentList() { // 获取评论列表
91
       method: $api.comment.list.method
150
       method: $api.comment.list.method
92
     }).then((res) => {
151
     }).then((res) => {
93
       if (res.code === 200) {
152
       if (res.code === 200) {
94
-        console.log(res.data.records)
153
+        // console.log(res.data.records)
95
         let CommentList = []
154
         let CommentList = []
96
         res.data.records.map((item, index) => {
155
         res.data.records.map((item, index) => {
97
           CommentList.push({
156
           CommentList.push({

+ 3
- 3
pages/ActivityDetail/index.wxml Ver arquivo

105
           <text>填写报名信息</text>
105
           <text>填写报名信息</text>
106
           <view class="line flex-h">
106
           <view class="line flex-h">
107
             <image mode="widthFix" src="/assets/images/icon32.png" style="width: 28rpx;"></image>
107
             <image mode="widthFix" src="/assets/images/icon32.png" style="width: 28rpx;"></image>
108
-            <input class="flex-item" type="text" placeholder="姓名" bindinput="FormInput" data-name="Name"></input>
108
+            <input class="flex-item" type="text" placeholder="姓名" bindinput="FormInput" data-name="customerName"></input>
109
           </view>
109
           </view>
110
           <view class="line flex-h">
110
           <view class="line flex-h">
111
             <image mode="widthFix" src="/assets/images/icon34.png" style="width: 22rpx;"></image>
111
             <image mode="widthFix" src="/assets/images/icon34.png" style="width: 22rpx;"></image>
112
-            <input type="number" class="flex-item" placeholder="手机号码" bindinput="FormInput" data-name="PhoneNum"></input>
112
+            <input type="number" class="flex-item" placeholder="手机号码" bindinput="FormInput" data-name="phone"></input>
113
           </view>
113
           </view>
114
           <view class="line flex-h">
114
           <view class="line flex-h">
115
             <image mode="widthFix" src="/assets/images/icon33.png" style="width: 30rpx;"></image>
115
             <image mode="widthFix" src="/assets/images/icon33.png" style="width: 30rpx;"></image>
116
-            <input type="idcard" class="flex-item" placeholder="身份证号" bindinput="FormInput" data-name="IdCard"></input>
116
+            <input type="idcard" class="flex-item" placeholder="身份证号" bindinput="FormInput" data-name="idNum"></input>
117
           </view>
117
           </view>
118
           <view class="btn">
118
           <view class="btn">
119
             <text bindtap="Submit">提交报名信息</text>
119
             <text bindtap="Submit">提交报名信息</text>

+ 1
- 1
pages/components/Concessions/index.js Ver arquivo

92
       })
92
       })
93
     },
93
     },
94
     CutNav(e) { // 切换nav
94
     CutNav(e) { // 切换nav
95
-      if (e.target.dataset.index !== undefined) {
95
+      if (e.target.dataset.index !== undefined && e.target.dataset.index !== this.data.NavActiveIndex) {
96
         this.setData({
96
         this.setData({
97
           NavActiveIndex: e.target.dataset.index
97
           NavActiveIndex: e.target.dataset.index
98
         })
98
         })

+ 7
- 2
pages/components/Estate/index.wxml Ver arquivo

1
 <!--index.wxml-->
1
 <!--index.wxml-->
2
 <view class="SubContainer">
2
 <view class="SubContainer">
3
   <view class="map">
3
   <view class="map">
4
-    <image mode="widthFix" src="/assets/images/img4.jpg" class="centerLabel cover bg"></image>
4
+    <movable-area style="height: 100%; width: 100%; background: #eee;position:absolute;left:0;top:0;">
5
+      <movable-view scale="{{true}}" scale-min="1" scale-max="2.5" x="{{x}}" y="{{y}}" direction="all">
6
+        <image mode="aspectFit" src="/assets/images/img4.jpg" class="centerLabel contian bg"></image>
7
+      </movable-view>
8
+    </movable-area>
9
+    <!-- <image mode="widthFix" src="/assets/images/img4.jpg" class="centerLabel cover bg"></image>
5
     <image mode="widthFix" src="/assets/images/icon15.png" class="AddIcon"></image>
10
     <image mode="widthFix" src="/assets/images/icon15.png" class="AddIcon"></image>
6
-    <image mode="widthFix" src="/assets/images/icon14.png" class="SubtractIcon"></image>
11
+    <image mode="widthFix" src="/assets/images/icon14.png" class="SubtractIcon"></image> -->
7
   </view>
12
   </view>
8
   <view class="EstateList">
13
   <view class="EstateList">
9
     <text>附近楼盘</text>
14
     <text>附近楼盘</text>

+ 12
- 0
pages/components/Estate/index.wxss Ver arquivo

145
   font-size: 17rpx;
145
   font-size: 17rpx;
146
   line-height: 30rpx;
146
   line-height: 30rpx;
147
 }
147
 }
148
+
149
+movable-view {
150
+  position: relative;
151
+  overflow: hidden;
152
+  min-height: 100%; 
153
+  min-width: 100%;
154
+}
155
+
156
+movable-view image {
157
+  width: 100%;
158
+  height: 100%;
159
+}