正在显示
14 个修改的文件
包含
850 行增加
和
485 行删除
images/del.png
0 → 100644
1.1 KB
images/imgDel.png
0 → 100644
1.4 KB
1 | // pages/my/approve/approve.js | 1 | // pages/my/approve/approve.js |
2 | +const app = getApp(); | ||
2 | Page({ | 3 | Page({ |
3 | 4 | ||
4 | - /** | ||
5 | - * 页面的初始数据 | ||
6 | - */ | ||
7 | - data: { | ||
8 | - proData:{ | ||
9 | - company_id:'', | ||
10 | - name:'', | ||
11 | - mobile:'', | ||
12 | - images:[] | ||
13 | - }, | ||
14 | - companyName:'' | ||
15 | - }, | ||
16 | - /** | ||
17 | - * 生命周期函数--监听页面加载 | ||
18 | - */ | ||
19 | - onLoad: function (options) { | ||
20 | - | ||
21 | - }, | ||
22 | - btn_approve() { | ||
23 | - wx.navigateTo({ | ||
24 | - url: '/pages/my/approveInfo/approveInfo', | ||
25 | - }) | ||
26 | - }, | ||
27 | - | ||
28 | - /** | ||
29 | - * 生命周期函数--监听页面初次渲染完成 | ||
30 | - */ | ||
31 | - onReady: function () { | ||
32 | - | ||
33 | - }, | ||
34 | - | ||
35 | - /** | ||
36 | - * 生命周期函数--监听页面显示 | ||
37 | - */ | ||
38 | - onShow: function () { | ||
39 | - | ||
40 | - }, | ||
41 | - | ||
42 | - /** | ||
43 | - * 生命周期函数--监听页面隐藏 | ||
44 | - */ | ||
45 | - onHide: function () { | ||
46 | - | ||
47 | - }, | ||
48 | - | ||
49 | - /** | ||
50 | - * 生命周期函数--监听页面卸载 | ||
51 | - */ | ||
52 | - onUnload: function () { | ||
53 | - | ||
54 | - }, | ||
55 | - | ||
56 | - /** | ||
57 | - * 页面相关事件处理函数--监听用户下拉动作 | ||
58 | - */ | ||
59 | - onPullDownRefresh: function () { | ||
60 | - | ||
61 | - }, | ||
62 | - | ||
63 | - /** | ||
64 | - * 页面上拉触底事件的处理函数 | ||
65 | - */ | ||
66 | - onReachBottom: function () { | ||
67 | - | ||
68 | - }, | ||
69 | - | ||
70 | - /** | ||
71 | - * 用户点击右上角分享 | ||
72 | - */ | ||
73 | - onShareAppMessage: function () { | ||
74 | - | ||
75 | - } | 5 | + /** |
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + proData: { | ||
10 | + company_id: '', | ||
11 | + name: '', | ||
12 | + mobile: '', | ||
13 | + images: [], | ||
14 | + }, | ||
15 | + companyName: '', | ||
16 | + seach: false, | ||
17 | + keyword: "", | ||
18 | + companyList: [] | ||
19 | + }, | ||
20 | + /** | ||
21 | + * 生命周期函数--监听页面加载 | ||
22 | + */ | ||
23 | + onLoad: function(options) { | ||
24 | + | ||
25 | + }, | ||
26 | + | ||
27 | + // btn_approve() { | ||
28 | + // wx.navigateTo({ | ||
29 | + // url: '/pages/my/approveInfo/approveInfo', | ||
30 | + // }) | ||
31 | + // }, | ||
32 | + | ||
33 | + // 点击查询公司名称 | ||
34 | + companyFun: function() { | ||
35 | + this.setData({ | ||
36 | + seach: true | ||
37 | + }) | ||
38 | + }, | ||
39 | + | ||
40 | + // 搜索公司名称 | ||
41 | + seachFun: function() { | ||
42 | + let url = '/api/Company/index', b = this; | ||
43 | + if(b.data.keyword == "") { | ||
44 | + wx.showToast({ | ||
45 | + title: '请输入要搜索的公司名称', | ||
46 | + icon: "none", | ||
47 | + duration: 1300 | ||
48 | + }) | ||
49 | + return false; | ||
50 | + }else { | ||
51 | + let params = { | ||
52 | + keyword: b.data.keyword | ||
53 | + } | ||
54 | + app.post(url, params).then((res) => { | ||
55 | + // console.log(res); | ||
56 | + b.setData({ | ||
57 | + companyList: res.data | ||
58 | + }) | ||
59 | + }) | ||
60 | + } | ||
61 | + }, | ||
62 | + | ||
63 | + // 公司名称同步到data | ||
64 | + keywordFun: function(e) { | ||
65 | + this.setData({ | ||
66 | + keyword: e.detail.value.replace(/\s+/g, ''), | ||
67 | + }) | ||
68 | + this.seachFun(); | ||
69 | + }, | ||
70 | + | ||
71 | + // 选择公司名称同步到页面 | ||
72 | + companySelect(e) { | ||
73 | + this.setData({ | ||
74 | + companyName: e.currentTarget.dataset.name, | ||
75 | + seach: false, | ||
76 | + "proData.company_id": e.currentTarget.dataset.id | ||
77 | + }) | ||
78 | + }, | ||
79 | + | ||
80 | + // 姓名同步到data | ||
81 | + work(e) { | ||
82 | + this.setData({ | ||
83 | + "proData.name": e.detail.value.replace(/\s+/g, ''), | ||
84 | + }) | ||
85 | + }, | ||
86 | + | ||
87 | + // 联系电话同步到data | ||
88 | + getPhone(e) { | ||
89 | + this.setData({ | ||
90 | + "proData.mobile": e.detail.value.replace(/\s+/g, ''), | ||
91 | + }) | ||
92 | + }, | ||
93 | + | ||
94 | + // 上传图片 | ||
95 | + selectCameraFun: function () { | ||
96 | + let that = this; | ||
97 | + wx.chooseImage({ | ||
98 | + sizeType: ['original', 'compressed'], | ||
99 | + sourceType: ['album', 'camera'], | ||
100 | + success(res) { | ||
101 | + // tempFilePath可以作为img标签的src属性显示图片 | ||
102 | + // console.log(res); | ||
103 | + let successUp = 0; //成功个数 | ||
104 | + let failUp = 0; //失败个数 | ||
105 | + let i = 0; //第几个 | ||
106 | + let tempFilePaths = res.tempFilePaths //总文件 | ||
107 | + let length = res.tempFilePaths.length //总共个数 | ||
108 | + wx.showNavigationBarLoading() | ||
109 | + wx.showLoading({ | ||
110 | + title: '上传中', | ||
111 | + }) | ||
112 | + | ||
113 | + that.uploadAllfile(tempFilePaths, successUp, failUp, i, length); | ||
114 | + }, | ||
115 | + fail: function (res) { | ||
116 | + console.log(res); | ||
117 | + }, | ||
118 | + | ||
119 | + }) | ||
120 | + }, | ||
121 | + | ||
122 | + // 上传图片至后台 | ||
123 | + uploadAllfile(filePaths, successUp, failUp, i, length) { | ||
124 | + let that = this; | ||
125 | + // console.log(filePaths) | ||
126 | + // console.log(successUp) | ||
127 | + // console.log(failUp) | ||
128 | + // console.log(i) | ||
129 | + // console.log(length) | ||
130 | + let url = 'http://lqz.w.brotop.cn/api/common/upload'; | ||
131 | + let headers = { | ||
132 | + "token": wx.getStorageSync("token"), | ||
133 | + 'content-type': 'multipart/form-data' | ||
134 | + } | ||
135 | + wx.uploadFile({ | ||
136 | + url: url, //仅为示例,非真实的接口地址 | ||
137 | + header: headers, | ||
138 | + filePath: filePaths[i], | ||
139 | + name: 'file', | ||
140 | + formData: { | ||
141 | + act: "Index_upload", | ||
142 | + file: '', | ||
143 | + filetype: 'image' | ||
144 | + }, | ||
145 | + success: function (res) { | ||
146 | + // console.log(res) | ||
147 | + wx.hideNavigationBarLoading() | ||
148 | + wx.hideLoading() | ||
149 | + if (res.statusCode == 200) { | ||
150 | + // console.log(res) | ||
151 | + let dat = JSON.parse(res.data); | ||
152 | + // console.log(dat); | ||
153 | + that.setData({ | ||
154 | + "proData.images": that.data.proData.images.concat(dat.data.url) | ||
155 | + }) | ||
156 | + // console.log(that.data.proData.images); | ||
157 | + | ||
158 | + } else { | ||
159 | + wx.showModal({ | ||
160 | + title: '提示', | ||
161 | + content: res.msg, | ||
162 | + showCancel: false | ||
163 | + }) | ||
164 | + } | ||
165 | + //do something 返回图片地址 | ||
166 | + }, | ||
167 | + fail: function (res) { | ||
168 | + wx.hideNavigationBarLoading() | ||
169 | + wx.hideLoading() | ||
170 | + | ||
171 | + // console.log(res); | ||
172 | + }, | ||
173 | + complete() { | ||
174 | + i++; | ||
175 | + let img = that.data.img | ||
176 | + if (i == length) { | ||
177 | + // console.log('总共' + successUp + '张上传成功,' + failUp + '张上传失败!'); | ||
178 | + } | ||
179 | + else { //递归调用uploadDIY函数 | ||
180 | + that.uploadAllfile(filePaths, successUp, failUp, i, length); | ||
181 | + } | ||
182 | + } | ||
183 | + | ||
184 | + }) | ||
185 | + | ||
186 | + }, | ||
187 | + | ||
188 | + // 删除图片重新上传 | ||
189 | + delFun: function (e) { | ||
190 | + let that = this; | ||
191 | + let imgUrlList = that.data.proData.images; | ||
192 | + imgUrlList.splice(e.currentTarget.dataset.i, 1); | ||
193 | + that.setData({ | ||
194 | + "proData.images": imgUrlList | ||
195 | + }) | ||
196 | + }, | ||
197 | + | ||
198 | + // 上传认证 | ||
199 | + subFun() { | ||
200 | + let b = this; | ||
201 | + let url = "/api/user/setCertificationInfo"; | ||
202 | + // console.log(b.data.proData.images.length) | ||
203 | + if(b.data.companyName == "" || b.data.proData.name == "" || b.data.proData.mobile == "" || b.data.proData.images.length == 0) { | ||
204 | + wx.showToast({ | ||
205 | + title: '请输入必填项', | ||
206 | + icon: "none", | ||
207 | + duration: 1300 | ||
208 | + }) | ||
209 | + return false; | ||
210 | + }else { | ||
211 | + b.setData({ | ||
212 | + "proData.header": true | ||
213 | + }) | ||
214 | + app.post(url, b.data.proData).then((res) => { | ||
215 | + // console.log(res); | ||
216 | + wx.redirectTo({ | ||
217 | + url: '../approveInfo/approveInfo', | ||
218 | + }) | ||
219 | + }) | ||
220 | + } | ||
221 | + }, | ||
222 | + | ||
223 | + /** | ||
224 | + * 生命周期函数--监听页面初次渲染完成 | ||
225 | + */ | ||
226 | + onReady: function() { | ||
227 | + | ||
228 | + }, | ||
229 | + | ||
230 | + /** | ||
231 | + * 生命周期函数--监听页面显示 | ||
232 | + */ | ||
233 | + onShow: function() { | ||
234 | + | ||
235 | + }, | ||
236 | + | ||
237 | + /** | ||
238 | + * 生命周期函数--监听页面隐藏 | ||
239 | + */ | ||
240 | + onHide: function() { | ||
241 | + | ||
242 | + }, | ||
243 | + | ||
244 | + /** | ||
245 | + * 生命周期函数--监听页面卸载 | ||
246 | + */ | ||
247 | + onUnload: function() { | ||
248 | + | ||
249 | + }, | ||
250 | + | ||
251 | + /** | ||
252 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
253 | + */ | ||
254 | + onPullDownRefresh: function() { | ||
255 | + | ||
256 | + }, | ||
257 | + | ||
258 | + /** | ||
259 | + * 页面上拉触底事件的处理函数 | ||
260 | + */ | ||
261 | + onReachBottom: function() { | ||
262 | + | ||
263 | + }, | ||
264 | + | ||
265 | + /** | ||
266 | + * 用户点击右上角分享 | ||
267 | + */ | ||
268 | + onShareAppMessage: function() { | ||
269 | + | ||
270 | + } | ||
76 | }) | 271 | }) |
1 | <!--pages/my/approve/approve.wxml--> | 1 | <!--pages/my/approve/approve.wxml--> |
2 | <view class="content_box"> | 2 | <view class="content_box"> |
3 | - <view class="item_list"> | ||
4 | - <view class="list_title">公司名称</view> | ||
5 | - <view class="list_content"> | ||
6 | - <view class='input_item'>{{'输入公司名称'}}</view> | 3 | + <view class="item_list" bindtap='companyFun'> |
4 | + <view class="list_title">公司名称</view> | ||
5 | + <view class="list_content"> | ||
6 | + <view class='input_item {{proData.company_id?"":"color_input"}}'>{{proData.company_id?companyName:'输入公司名称'}}</view> | ||
7 | + </view> | ||
7 | </view> | 8 | </view> |
8 | - </view> | ||
9 | - <view class="item_list"> | ||
10 | - <view class="list_title">姓名</view> | ||
11 | - <view class="list_content"> | ||
12 | - <input type="text" placeholder='请输入姓名' placeholder-class='pl_style' value="{{work}}" class="input_item" bindinput='work'></input> | 9 | + <view class="item_list"> |
10 | + <view class="list_title">姓名</view> | ||
11 | + <view class="list_content"> | ||
12 | + <input type="text" placeholder='请输入姓名' placeholder-class='pl_style' value="{{proData.name}}" class="input_item" bindinput='work'></input> | ||
13 | + </view> | ||
13 | </view> | 14 | </view> |
14 | - </view> | ||
15 | - <view class="item_list"> | ||
16 | - <view class="list_title">联系电话</view> | ||
17 | - <view class="list_content"> | ||
18 | - <input type="number" placeholder='输入联系电话' placeholder-class='pl_style' value="{{mobile}}" class="input_item" bindinput='getPhone'></input> | 15 | + <view class="item_list"> |
16 | + <view class="list_title">联系电话</view> | ||
17 | + <view class="list_content"> | ||
18 | + <input type="number" placeholder='输入联系电话' placeholder-class='pl_style' value="{{proData.mobile}}" class="input_item" bindinput='getPhone'></input> | ||
19 | + </view> | ||
19 | </view> | 20 | </view> |
20 | - </view> | ||
21 | - <view class="item_list" style=' align-items: flex-start;'> | ||
22 | - <view class="list_title">营业执照</view> | ||
23 | - <view class="list_content" > | ||
24 | - <view class='add_btn img_box' wx:for="{{proData.images}}" wx:key=''> | ||
25 | - <image src='item' mode='widthFix'></image> | ||
26 | - </view> | ||
27 | - <view class='add_btn'> | ||
28 | - <text>+</text> | ||
29 | - </view> | 21 | + <view class="item_list" style=' align-items: flex-start;'> |
22 | + <view class="list_title">营业执照</view> | ||
23 | + <view class="list_content img_wrap"> | ||
24 | + <view class='add_btn img_box' wx:for="{{proData.images}}" wx:key='index'> | ||
25 | + <image src='{{item}}'></image> | ||
26 | + <image class='del' data-i="{{index}}" bindtap="delFun" src='../../../images/imgDel.png'></image> | ||
27 | + </view> | ||
28 | + <view class='add_btn' bindtap='selectCameraFun'> | ||
29 | + <text>+</text> | ||
30 | + </view> | ||
31 | + </view> | ||
30 | </view> | 32 | </view> |
31 | - </view> | ||
32 | </view> | 33 | </view> |
33 | 34 | ||
34 | -<view class='bottom_btn' bindtap='btn_approve'>认证</view> | 35 | +<view class='bottom_btn' bindtap='subFun'>认证</view> |
35 | <!-- 公司搜索弹窗 --> | 36 | <!-- 公司搜索弹窗 --> |
36 | 37 | ||
37 | -<view class='search_view'> | ||
38 | - <view class='search-top'> | ||
39 | - <input placeholder='请输入公司名称' type='search' class='input_item'></input> | ||
40 | - <view class='cancle_action'>取消</view> | ||
41 | - </view> | 38 | +<view class='search_view' wx:if="{{seach}}"> |
39 | + <view class='search-top'> | ||
40 | + <view class='search_box'> | ||
41 | + <input placeholder='请输入公司名称' bindinput='keywordFun' type='search' class='input_item'></input> | ||
42 | + <image src='../../../images/del.png'></image> | ||
43 | + <view class='cancle_action' bindtap='seachFun'>搜索</view> | ||
44 | + </view> | ||
45 | + </view> | ||
42 | 46 | ||
43 | - <view class='adress_list_container'> | ||
44 | - | ||
45 | - </view> | 47 | + <view class='adress_list_container'> |
48 | + <view class='adress_list' wx:for="{{companyList}}" wx:key="index" data-id="{{item.id}}" data-name='{{item.name}}' bindtap='companySelect'> | ||
49 | + {{item.name}} | ||
50 | + </view> | ||
51 | + </view> | ||
46 | </view> | 52 | </view> |
@@ -31,7 +31,7 @@ | @@ -31,7 +31,7 @@ | ||
31 | .list_content { | 31 | .list_content { |
32 | font-size: 30rpx; | 32 | font-size: 30rpx; |
33 | color: #000; | 33 | color: #000; |
34 | - min-width: 75%; | 34 | + width: 75%; |
35 | } | 35 | } |
36 | 36 | ||
37 | .input_item { | 37 | .input_item { |
@@ -39,11 +39,22 @@ | @@ -39,11 +39,22 @@ | ||
39 | outline: none; | 39 | outline: none; |
40 | } | 40 | } |
41 | 41 | ||
42 | +.color_input { | ||
43 | + color: rgba(204, 204, 204, 1); | ||
44 | +} | ||
45 | + | ||
42 | .area_item { | 46 | .area_item { |
43 | width: 80%; | 47 | width: 80%; |
44 | height: 120rpx; | 48 | height: 120rpx; |
45 | } | 49 | } |
46 | 50 | ||
51 | +.img_wrap { | ||
52 | + display: flex; | ||
53 | + justify-content: flex-start; | ||
54 | + align-items: flex-start; | ||
55 | + flex-wrap: wrap; | ||
56 | +} | ||
57 | + | ||
47 | .bottom_btn { | 58 | .bottom_btn { |
48 | width: 352rpx; | 59 | width: 352rpx; |
49 | height: 80rpx; | 60 | height: 80rpx; |
@@ -68,6 +79,27 @@ | @@ -68,6 +79,27 @@ | ||
68 | line-height: 1; | 79 | line-height: 1; |
69 | position: relative; | 80 | position: relative; |
70 | color: rgb(236, 201, 201); | 81 | color: rgb(236, 201, 201); |
82 | + box-sizing: border-box; | ||
83 | +} | ||
84 | +.img_box { | ||
85 | + /* position: relative; */ | ||
86 | + border: none; | ||
87 | + margin:0 10px 20rpx 0; | ||
88 | +} | ||
89 | +.img_box:nth-child(3n) { | ||
90 | + margin-right: 0; | ||
91 | +} | ||
92 | +.img_box image { | ||
93 | + width: 100%; | ||
94 | + height: 100%; | ||
95 | + display: block; | ||
96 | +} | ||
97 | +.img_box .del { | ||
98 | + position: absolute; | ||
99 | + width: 40rpx; | ||
100 | + height: 40rpx; | ||
101 | + top: 10rpx; | ||
102 | + right: 10rpx; | ||
71 | } | 103 | } |
72 | .search_view{ | 104 | .search_view{ |
73 | position: fixed; | 105 | position: fixed; |
@@ -82,19 +114,30 @@ | @@ -82,19 +114,30 @@ | ||
82 | box-sizing: border-box; | 114 | box-sizing: border-box; |
83 | } | 115 | } |
84 | .search-top{ | 116 | .search-top{ |
85 | - height: 80rpx; | 117 | + height: 120rpx; |
86 | width: 100%; | 118 | width: 100%; |
87 | display: flex; | 119 | display: flex; |
88 | font-size: 26rpx; | 120 | font-size: 26rpx; |
89 | padding: 20rpx; | 121 | padding: 20rpx; |
90 | background-color: #fff; | 122 | background-color: #fff; |
123 | + box-sizing: border-box; | ||
124 | + border-radius: 5rpx; | ||
125 | +} | ||
126 | +.search_box { | ||
127 | + width: 100%; | ||
128 | + height: 100%; | ||
129 | + border-radius: 15rpx; | ||
130 | + display: flex; | ||
131 | + justify-content: flex-start; | ||
132 | + align-items: center; | ||
133 | + background: #e6e6e6; | ||
91 | } | 134 | } |
92 | .input_item{ | 135 | .input_item{ |
93 | - border: 1rpx solid #efefef; | 136 | + /* border: 1rpx solid #efefef; */ |
94 | flex: 1; | 137 | flex: 1; |
95 | height: 100%; | 138 | height: 100%; |
96 | border-radius: 10rpx; | 139 | border-radius: 10rpx; |
97 | - padding-left: 10rpx; | 140 | + padding-left: 20rpx; |
98 | } | 141 | } |
99 | .cancle_action{ | 142 | .cancle_action{ |
100 | width: 100rpx; | 143 | width: 100rpx; |
@@ -102,4 +145,96 @@ | @@ -102,4 +145,96 @@ | ||
102 | align-items: center; | 145 | align-items: center; |
103 | color: #64A2E8; | 146 | color: #64A2E8; |
104 | justify-content: center; | 147 | justify-content: center; |
105 | -} | ||
148 | +} | ||
149 | +.search-top image { | ||
150 | + width: 32rpx; | ||
151 | + height: 32rpx; | ||
152 | + display: block; | ||
153 | +} | ||
154 | + | ||
155 | +/* 公司名称搜索结果 */ | ||
156 | +.adress_list_container { | ||
157 | + margin-top: 20rpx; | ||
158 | + flex: 1; | ||
159 | + width: 100%; | ||
160 | + background: #fff; | ||
161 | +} | ||
162 | +.adress_list { | ||
163 | + width: 100%; | ||
164 | + box-sizing: border-box; | ||
165 | + padding: 20rpx; | ||
166 | + font-size: 28rpx; | ||
167 | + font-weight:400; | ||
168 | + color: rgba(51,51,51,1); | ||
169 | + /* display: flex; | ||
170 | + align-items: flex-start; | ||
171 | + justify-content: flex-start; */ | ||
172 | + border-bottom: 1px solid rgba(204, 204, 204, 0.3); | ||
173 | +} | ||
174 | +/* .adress_list_left { | ||
175 | + width: 32rpx; | ||
176 | + height: 32rpx; | ||
177 | + margin-right: 15rpx; | ||
178 | +} | ||
179 | +.adress_list_left image { | ||
180 | + display: block; | ||
181 | + width: 100%; | ||
182 | + height: 100%; | ||
183 | +} | ||
184 | +.adress_list_right { | ||
185 | + flex: 1; | ||
186 | + height: 100%; | ||
187 | +} | ||
188 | +.adress_list_right_top { | ||
189 | + font-size: 28rpx; | ||
190 | + font-weight:400; | ||
191 | + color: rgba(51,51,51,1) | ||
192 | +} | ||
193 | +.adress_list_right_bottom { | ||
194 | + display: flex; | ||
195 | + justify-content: space-between; | ||
196 | + align-items: center; | ||
197 | + font-size: 24rpx; | ||
198 | + color: rgba(204,204,204,1); | ||
199 | +} */ | ||
200 | + | ||
201 | + | ||
202 | + | ||
203 | + | ||
204 | + | ||
205 | + | ||
206 | + | ||
207 | + | ||
208 | + | ||
209 | + | ||
210 | + | ||
211 | + | ||
212 | + | ||
213 | + | ||
214 | + | ||
215 | + | ||
216 | + | ||
217 | + | ||
218 | + | ||
219 | + | ||
220 | + | ||
221 | + | ||
222 | + | ||
223 | + | ||
224 | + | ||
225 | + | ||
226 | + | ||
227 | + | ||
228 | + | ||
229 | + | ||
230 | + | ||
231 | + | ||
232 | + | ||
233 | + | ||
234 | + | ||
235 | + | ||
236 | + | ||
237 | + | ||
238 | + | ||
239 | + | ||
240 | + |
@@ -14,6 +14,8 @@ Page({ | @@ -14,6 +14,8 @@ Page({ | ||
14 | onLoad: function (options) { | 14 | onLoad: function (options) { |
15 | 15 | ||
16 | }, | 16 | }, |
17 | + | ||
18 | + // 发表帖子 | ||
17 | post_btn() { | 19 | post_btn() { |
18 | 20 | ||
19 | wx.navigateTo({ | 21 | wx.navigateTo({ |
@@ -21,6 +23,13 @@ Page({ | @@ -21,6 +23,13 @@ Page({ | ||
21 | }) | 23 | }) |
22 | }, | 24 | }, |
23 | 25 | ||
26 | + // 返回首页 | ||
27 | + goHome() { | ||
28 | + wx.navigateBack({ | ||
29 | + delta: 5 | ||
30 | + }) | ||
31 | + }, | ||
32 | + | ||
24 | 33 | ||
25 | /** | 34 | /** |
26 | * 生命周期函数--监听页面初次渲染完成 | 35 | * 生命周期函数--监听页面初次渲染完成 |
@@ -6,15 +6,30 @@ Page({ | @@ -6,15 +6,30 @@ Page({ | ||
6 | * 页面的初始数据 | 6 | * 页面的初始数据 |
7 | */ | 7 | */ |
8 | data: { | 8 | data: { |
9 | - | 9 | + followList: [], |
10 | + page: 1 | ||
10 | }, | 11 | }, |
11 | /** | 12 | /** |
12 | * 生命周期函数--监听页面加载 | 13 | * 生命周期函数--监听页面加载 |
13 | */ | 14 | */ |
14 | onLoad: function (options) { | 15 | onLoad: function (options) { |
15 | - | 16 | + this.getFollowList(); |
16 | }, | 17 | }, |
17 | 18 | ||
19 | + // 获取帖子列表 | ||
20 | + getFollowList() { | ||
21 | + let b = this, url = '/api/User/getMyFollowList', params = { | ||
22 | + header: true, | ||
23 | + page: b.data.page | ||
24 | + }; | ||
25 | + a.post(url, params).then((res) => { | ||
26 | + console.log(res); | ||
27 | + b.setData({ | ||
28 | + followList: res.data | ||
29 | + }) | ||
30 | + }) | ||
31 | + }, | ||
32 | + | ||
18 | /** | 33 | /** |
19 | * 生命周期函数--监听页面初次渲染完成 | 34 | * 生命周期函数--监听页面初次渲染完成 |
20 | */ | 35 | */ |
@@ -54,7 +69,11 @@ Page({ | @@ -54,7 +69,11 @@ Page({ | ||
54 | * 页面上拉触底事件的处理函数 | 69 | * 页面上拉触底事件的处理函数 |
55 | */ | 70 | */ |
56 | onReachBottom: function () { | 71 | onReachBottom: function () { |
57 | - | 72 | + let that = this; |
73 | + that.setData({ | ||
74 | + page: that.data.page + 1, | ||
75 | + }); | ||
76 | + that.getFollowList(); | ||
58 | }, | 77 | }, |
59 | 78 | ||
60 | /** | 79 | /** |
1 | <!--pages/my/myAttention/myAttention.wxml--> | 1 | <!--pages/my/myAttention/myAttention.wxml--> |
2 | <view class='box'> | 2 | <view class='box'> |
3 | - <view class='item_list' wx:for='{{[1,2]}}'> | ||
4 | - <image src='/images/weirenzheng@2x.png'></image> | ||
5 | - <view class='list_right'> | ||
6 | - <view> | ||
7 | - <view class='user_name'>马晓上</view> | ||
8 | - <view class='list_time'> | ||
9 | - <text>今天</text> | ||
10 | - <text>21:00</text> | 3 | + <view class='item_list' wx:for='{{followList}}' wx:key="index"> |
4 | + <image src='{{item.logo_image}}'></image> | ||
5 | + <view class='list_right'> | ||
6 | + <view> | ||
7 | + <view class='user_name'>{{item.name}}</view> | ||
8 | + <view class='list_time'> | ||
9 | + {{item.create_time_text}} | ||
10 | + <!-- <text>今天</text> | ||
11 | + <text>21:00</text> --> | ||
12 | + </view> | ||
13 | + </view> | ||
14 | + <view class='list_btn'>已关注</view> | ||
11 | </view> | 15 | </view> |
12 | - </view> | ||
13 | - <view class='list_btn'>已关注</view> | ||
14 | </view> | 16 | </view> |
15 | - </view> | ||
16 | </view> | 17 | </view> |
1 | +const a = getApp(); | ||
1 | Page({ | 2 | Page({ |
2 | 3 | ||
3 | - /** | ||
4 | - * 页面的初始数据 | ||
5 | - */ | ||
6 | - data: { | ||
7 | - | ||
8 | - }, | ||
9 | - | ||
10 | - /** | ||
11 | - * 生命周期函数--监听页面加载 | ||
12 | - */ | ||
13 | - onLoad: function (options) { | ||
14 | - | ||
15 | - }, | ||
16 | - | ||
17 | - /** | ||
18 | - * 生命周期函数--监听页面初次渲染完成 | ||
19 | - */ | ||
20 | - onReady: function () { | ||
21 | - | ||
22 | - }, | ||
23 | - | ||
24 | - /** | ||
25 | - * 生命周期函数--监听页面显示 | ||
26 | - */ | ||
27 | - onShow: function () { | ||
28 | - | ||
29 | - }, | ||
30 | - | ||
31 | - /** | ||
32 | - * 生命周期函数--监听页面隐藏 | ||
33 | - */ | ||
34 | - onHide: function () { | ||
35 | - | ||
36 | - }, | ||
37 | - | ||
38 | - /** | ||
39 | - * 生命周期函数--监听页面卸载 | ||
40 | - */ | ||
41 | - onUnload: function () { | ||
42 | - | ||
43 | - }, | ||
44 | - | ||
45 | - /** | ||
46 | - * 页面相关事件处理函数--监听用户下拉动作 | ||
47 | - */ | ||
48 | - onPullDownRefresh: function () { | ||
49 | - | ||
50 | - }, | ||
51 | - | ||
52 | - /** | ||
53 | - * 页面上拉触底事件的处理函数 | ||
54 | - */ | ||
55 | - onReachBottom: function () { | ||
56 | - | ||
57 | - }, | ||
58 | - | ||
59 | - /** | ||
60 | - * 用户点击右上角分享 | ||
61 | - */ | ||
62 | - onShareAppMessage: function () { | ||
63 | - | ||
64 | - } | 4 | + /** |
5 | + * 页面的初始数据 | ||
6 | + */ | ||
7 | + data: { | ||
8 | + commentsList: [], | ||
9 | + page: 1 | ||
10 | + }, | ||
11 | + | ||
12 | + /** | ||
13 | + * 生命周期函数--监听页面加载 | ||
14 | + */ | ||
15 | + onLoad: function(options) { | ||
16 | + this.getCommentsList(); | ||
17 | + }, | ||
18 | + | ||
19 | + // 获取点赞列表 | ||
20 | + getCommentsList() { | ||
21 | + let b = this, | ||
22 | + url = '/api/User/getMyCommentList', | ||
23 | + params = { | ||
24 | + header: true, | ||
25 | + page: b.data.page | ||
26 | + }; | ||
27 | + a.post(url, params).then((res) => { | ||
28 | + console.log(res); | ||
29 | + b.setData({ | ||
30 | + commentsList: res.data | ||
31 | + }) | ||
32 | + }) | ||
33 | + }, | ||
34 | + | ||
35 | + /** | ||
36 | + * 生命周期函数--监听页面初次渲染完成 | ||
37 | + */ | ||
38 | + onReady: function() { | ||
39 | + | ||
40 | + }, | ||
41 | + | ||
42 | + /** | ||
43 | + * 生命周期函数--监听页面显示 | ||
44 | + */ | ||
45 | + onShow: function() { | ||
46 | + | ||
47 | + }, | ||
48 | + | ||
49 | + /** | ||
50 | + * 生命周期函数--监听页面隐藏 | ||
51 | + */ | ||
52 | + onHide: function() { | ||
53 | + | ||
54 | + }, | ||
55 | + | ||
56 | + /** | ||
57 | + * 生命周期函数--监听页面卸载 | ||
58 | + */ | ||
59 | + onUnload: function() { | ||
60 | + | ||
61 | + }, | ||
62 | + | ||
63 | + /** | ||
64 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
65 | + */ | ||
66 | + onPullDownRefresh: function() { | ||
67 | + | ||
68 | + }, | ||
69 | + | ||
70 | + /** | ||
71 | + * 页面上拉触底事件的处理函数 | ||
72 | + */ | ||
73 | + onReachBottom: function() { | ||
74 | + let that = this; | ||
75 | + that.setData({ | ||
76 | + page: that.data.page + 1, | ||
77 | + }); | ||
78 | + that.getCommentsList(); | ||
79 | + }, | ||
80 | + | ||
81 | + /** | ||
82 | + * 用户点击右上角分享 | ||
83 | + */ | ||
84 | + onShareAppMessage: function() { | ||
85 | + | ||
86 | + } | ||
65 | }) | 87 | }) |
1 | - | ||
2 | <view class='container'> | 1 | <view class='container'> |
3 | - | ||
4 | - | ||
5 | - | ||
6 | - | ||
7 | - | ||
8 | - <!-- 企话吧 --> | ||
9 | - <view class='box_right'> | ||
10 | - <view class='mid'> | ||
11 | - | ||
12 | - <!-- 条目 --> | ||
13 | - <view class='mid_item'> | ||
14 | - <view class='mid_item_top'> | ||
15 | - <view class='mid_item_top_left'> | ||
16 | - <!-- 图片 --> | ||
17 | - <view class='mid_item_top_left_pic'> | ||
18 | - <image src='../../images/03_nav@2x.png'></image> | ||
19 | - </view> | ||
20 | - <!-- 文字 --> | ||
21 | - <view class='mid_item_top_left_text color_blue'> | ||
22 | - 牧羊人 | ||
23 | - </view> | ||
24 | - </view> | ||
25 | - <view class='mid_item_top_right '> | ||
26 | - 15分钟前 | ||
27 | - </view> | ||
28 | - </view> | ||
29 | - <!-- 文字内容 --> | ||
30 | - <view class='mid_item_text'> | ||
31 | - 新个人所得税法近日备受关注。关于个人所得税,想必大家都十分关心,让我们通过以下问题! | ||
32 | - </view> | ||
33 | - <!-- 文本内容 --> | ||
34 | - <view class='mid_item_content'> | ||
35 | - <!-- 条目 --> | ||
36 | - <view class='mid_item content'> | ||
37 | - <view class='mid_item_top'> | ||
38 | - <view class='mid_item_top_left'> | ||
39 | - <!-- 图片 --> | ||
40 | - <view class='mid_item_top_left_pic'> | ||
41 | - <image src='../../images/03_nav@2x.png'></image> | 2 | + |
3 | + | ||
4 | + | ||
5 | + | ||
6 | + | ||
7 | + <!-- 企话吧 --> | ||
8 | + <view class='box_right'> | ||
9 | + <view class='mid'> | ||
10 | + | ||
11 | + <!-- 条目 --> | ||
12 | + <view class='mid_item' wx:for="{{commentsList}}" wx:key="index"> | ||
13 | + <view class='mid_item_top'> | ||
14 | + <view class='mid_item_top_left'> | ||
15 | + <!-- 图片 --> | ||
16 | + <view class='mid_item_top_left_pic'> | ||
17 | + <image src='{{item.my_nickname}}'></image> | ||
18 | + </view> | ||
19 | + <!-- 文字 --> | ||
20 | + <view class='mid_item_top_left_text color_blue'> | ||
21 | + {{item.my_avatar}} | ||
22 | + </view> | ||
23 | + </view> | ||
24 | + <view class='mid_item_top_right '> | ||
25 | + {{item.create_time_text}} | ||
26 | + </view> | ||
42 | </view> | 27 | </view> |
43 | - <!-- 文字 --> | ||
44 | - <view class='mid_item_top_left_text'> | ||
45 | - 金沃斯英语在线教育 | ||
46 | - <view class='icon_tm'> | ||
47 | - <image src='../../images/guangfang@2x.png'></image> | ||
48 | - </view> | 28 | + <!-- 文字内容 --> |
29 | + <view class='mid_item_text'> | ||
30 | + 新个人所得税法近日备受关注。关于个人所得税,想必大家都十分关心,让我们通过以下问题! | ||
49 | </view> | 31 | </view> |
50 | - </view> | ||
51 | - <view class='mid_item_top_right'> | ||
52 | - 15分钟前 | ||
53 | - </view> | ||
54 | - </view> | ||
55 | - <!-- 文字内容 --> | ||
56 | - <view class='mid_item_text'> | ||
57 | - 新个人所得税法近日备受关注。关于个人所得税,想必大家都十分关心,让我们通过以下问题! | ||
58 | - </view> | ||
59 | - <!-- 图片内容 --> | ||
60 | - <view class='mid_pic_box'> | ||
61 | - <view class='mid_pic_item'> | ||
62 | - <image src='../../images/weirenzheng@3x.png'></image> | ||
63 | - </view> | ||
64 | - | ||
65 | - </view> | 32 | + <!-- 文本内容 --> |
33 | + <view class='mid_item_content'> | ||
34 | + <!-- 条目 --> | ||
35 | + <view class='mid_item content'> | ||
36 | + <view class='mid_item_top'> | ||
37 | + <view class='mid_item_top_left'> | ||
38 | + <!-- 图片 --> | ||
39 | + <view class='mid_item_top_left_pic'> | ||
40 | + <image src='{{item.avatar}}'></image> | ||
41 | + </view> | ||
42 | + <!-- 文字 --> | ||
43 | + <view class='mid_item_top_left_text'> | ||
44 | + {{item.nickname}} | ||
45 | + <view class='icon_tm'> | ||
46 | + <image src='../../images/guangfang@2x.png'></image> | ||
47 | + </view> | ||
48 | + </view> | ||
49 | + </view> | ||
50 | + <view class='mid_item_top_right'> | ||
51 | + {{item.create_time_text}} | ||
52 | + </view> | ||
53 | + </view> | ||
54 | + <!-- 文字内容 --> | ||
55 | + <view class='mid_item_text'> | ||
56 | + {{item.content}} | ||
57 | + </view> | ||
58 | + <!-- 图片内容 --> | ||
59 | + <view class='mid_pic_box'> | ||
60 | + <view class='mid_pic_item' wx:for="{{item.images}}" wx:key="index"> | ||
61 | + <image src='{{item}}'></image> | ||
62 | + </view> | ||
66 | 63 | ||
67 | - | 64 | + </view> |
68 | 65 | ||
69 | - | ||
70 | - </view> | ||
71 | - </view> | ||
72 | 66 | ||
73 | - <!-- 底部 --> | ||
74 | - <view class='mid_item_like'> | ||
75 | - <view class='mid_item_like_left'> | ||
76 | - 删除 | ||
77 | - </view> | ||
78 | 67 | ||
79 | - <view class='mid_item_like_right'> | ||
80 | - <!-- 点赞 --> | ||
81 | - <view class='mid_like '> | ||
82 | - <image src='../../images/zan@3x.png'></image> | ||
83 | - </view> | ||
84 | - <!-- 数量 --> | ||
85 | - <view class='mid_number '> | ||
86 | - 46 | ||
87 | - </view> | ||
88 | 68 | ||
89 | - <!-- 消息 --> | ||
90 | - <view class='mid_like'> | ||
91 | - <image src='../../images/pinglun_fill@3x.png'></image> | ||
92 | - </view> | ||
93 | - <!-- 数量 --> | ||
94 | - <view class='mid_number color_blue'> | ||
95 | - 46 | ||
96 | - </view> | ||
97 | - </view> | 69 | + </view> |
70 | + </view> | ||
98 | 71 | ||
99 | - </view> | 72 | + <!-- 底部 --> |
73 | + <view class='mid_item_like'> | ||
74 | + <view class='mid_item_like_left'> | ||
75 | + 删除 | ||
76 | + </view> | ||
100 | 77 | ||
101 | - </view> | 78 | + <view class='mid_item_like_right'> |
79 | + <!-- 点赞 --> | ||
80 | + <view class='mid_like ' > | ||
81 | + <image wx:if="{{item.is_like == 0}}" src='../../images/zan@3x.png'></image> | ||
82 | + </view> | ||
83 | + <!-- 数量 --> | ||
84 | + <view class='mid_number '> | ||
85 | + 46 | ||
86 | + </view> | ||
102 | 87 | ||
88 | + <!-- 消息 --> | ||
89 | + <view class='mid_like'> | ||
90 | + <image src='../../images/pinglun_fill@3x.png'></image> | ||
91 | + </view> | ||
92 | + <!-- 数量 --> | ||
93 | + <view class='mid_number color_blue'> | ||
94 | + 46 | ||
95 | + </view> | ||
96 | + </view> | ||
97 | + | ||
98 | + </view> | ||
99 | + | ||
100 | + </view> | ||
101 | + | ||
102 | + </view> | ||
103 | </view> | 103 | </view> |
104 | - </view> | ||
105 | </view> | 104 | </view> |
1 | +const a = getApp(); | ||
1 | Page({ | 2 | Page({ |
2 | 3 | ||
3 | - /** | ||
4 | - * 页面的初始数据 | ||
5 | - */ | ||
6 | - data: { | ||
7 | - | ||
8 | - }, | ||
9 | - | ||
10 | - /** | ||
11 | - * 生命周期函数--监听页面加载 | ||
12 | - */ | ||
13 | - onLoad: function (options) { | ||
14 | - | ||
15 | - }, | ||
16 | - | ||
17 | - /** | ||
18 | - * 生命周期函数--监听页面初次渲染完成 | ||
19 | - */ | ||
20 | - onReady: function () { | ||
21 | - | ||
22 | - }, | ||
23 | - | ||
24 | - /** | ||
25 | - * 生命周期函数--监听页面显示 | ||
26 | - */ | ||
27 | - onShow: function () { | ||
28 | - | ||
29 | - }, | ||
30 | - | ||
31 | - /** | ||
32 | - * 生命周期函数--监听页面隐藏 | ||
33 | - */ | ||
34 | - onHide: function () { | ||
35 | - | ||
36 | - }, | ||
37 | - | ||
38 | - /** | ||
39 | - * 生命周期函数--监听页面卸载 | ||
40 | - */ | ||
41 | - onUnload: function () { | ||
42 | - | ||
43 | - }, | ||
44 | - | ||
45 | - /** | ||
46 | - * 页面相关事件处理函数--监听用户下拉动作 | ||
47 | - */ | ||
48 | - onPullDownRefresh: function () { | ||
49 | - | ||
50 | - }, | ||
51 | - | ||
52 | - /** | ||
53 | - * 页面上拉触底事件的处理函数 | ||
54 | - */ | ||
55 | - onReachBottom: function () { | ||
56 | - | ||
57 | - }, | ||
58 | - | ||
59 | - /** | ||
60 | - * 用户点击右上角分享 | ||
61 | - */ | ||
62 | - onShareAppMessage: function () { | ||
63 | - | ||
64 | - } | 4 | + /** |
5 | + * 页面的初始数据 | ||
6 | + */ | ||
7 | + data: { | ||
8 | + noticeList: [], | ||
9 | + page: 1 | ||
10 | + }, | ||
11 | + | ||
12 | + /** | ||
13 | + * 生命周期函数--监听页面加载 | ||
14 | + */ | ||
15 | + onLoad: function(options) { | ||
16 | + this.getInformList(); | ||
17 | + }, | ||
18 | + | ||
19 | + // 获取点赞列表 | ||
20 | + getInformList() { | ||
21 | + let b = this, | ||
22 | + url = '/api/User/getNoticeList', | ||
23 | + params = { | ||
24 | + header: true, | ||
25 | + page: b.data.page | ||
26 | + }; | ||
27 | + a.post(url, params).then((res) => { | ||
28 | + console.log(res); | ||
29 | + b.setData({ | ||
30 | + noticeList: res.data | ||
31 | + }) | ||
32 | + }) | ||
33 | + }, | ||
34 | + | ||
35 | + /** | ||
36 | + * 生命周期函数--监听页面初次渲染完成 | ||
37 | + */ | ||
38 | + onReady: function() { | ||
39 | + | ||
40 | + }, | ||
41 | + | ||
42 | + /** | ||
43 | + * 生命周期函数--监听页面显示 | ||
44 | + */ | ||
45 | + onShow: function() { | ||
46 | + | ||
47 | + }, | ||
48 | + | ||
49 | + /** | ||
50 | + * 生命周期函数--监听页面隐藏 | ||
51 | + */ | ||
52 | + onHide: function() { | ||
53 | + | ||
54 | + }, | ||
55 | + | ||
56 | + /** | ||
57 | + * 生命周期函数--监听页面卸载 | ||
58 | + */ | ||
59 | + onUnload: function() { | ||
60 | + | ||
61 | + }, | ||
62 | + | ||
63 | + /** | ||
64 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
65 | + */ | ||
66 | + onPullDownRefresh: function() { | ||
67 | + | ||
68 | + }, | ||
69 | + | ||
70 | + /** | ||
71 | + * 页面上拉触底事件的处理函数 | ||
72 | + */ | ||
73 | + onReachBottom: function() { | ||
74 | + let that = this; | ||
75 | + that.setData({ | ||
76 | + page: that.data.page + 1, | ||
77 | + }); | ||
78 | + that.getInformList(); | ||
79 | + }, | ||
80 | + | ||
81 | + /** | ||
82 | + * 用户点击右上角分享 | ||
83 | + */ | ||
84 | + onShareAppMessage: function() { | ||
85 | + | ||
86 | + } | ||
65 | }) | 87 | }) |
@@ -110,7 +110,7 @@ | @@ -110,7 +110,7 @@ | ||
110 | <view class='mid'> | 110 | <view class='mid'> |
111 | 111 | ||
112 | <!-- 条目 --> | 112 | <!-- 条目 --> |
113 | - <view class='mid_item'> | 113 | + <view class='mid_item' wx:for="{{noticeList}}" wx:key="index"> |
114 | <view class='mid_item_top'> | 114 | <view class='mid_item_top'> |
115 | <view class='mid_item_top_left'> | 115 | <view class='mid_item_top_left'> |
116 | <!-- 图片 --> | 116 | <!-- 图片 --> |
@@ -120,10 +120,14 @@ | @@ -120,10 +120,14 @@ | ||
120 | <!-- 文字 --> | 120 | <!-- 文字 --> |
121 | <view class='mid_item_top_left_text color_blue'> | 121 | <view class='mid_item_top_left_text color_blue'> |
122 | 牧羊人 | 122 | 牧羊人 |
123 | - <view class='mid_icon'> | 123 | + <view class='mid_icon' wx:if="{{item.read_switch == 0}}"> |
124 | 未读 | 124 | 未读 |
125 | <!-- <image src='../../images/weidu@2x.png'></image> --> | 125 | <!-- <image src='../../images/weidu@2x.png'></image> --> |
126 | </view> | 126 | </view> |
127 | + <view class='mid_icon color_read' wx:if="{{item.read_switch == 1}}"> | ||
128 | + 已读 | ||
129 | + <!-- <image src='../../images/weidu@2x.png'></image> --> | ||
130 | + </view> | ||
127 | </view> | 131 | </view> |
128 | </view> | 132 | </view> |
129 | <view class='mid_item_top_right '> | 133 | <view class='mid_item_top_right '> |
@@ -132,11 +136,11 @@ | @@ -132,11 +136,11 @@ | ||
132 | </view> | 136 | </view> |
133 | <!-- 大标题 --> | 137 | <!-- 大标题 --> |
134 | <view class='mid_item_title'> | 138 | <view class='mid_item_title'> |
135 | - 交通优势突出停车难问题能否解决? | 139 | + {{item.title}} |
136 | </view> | 140 | </view> |
137 | <!-- 文字内容 --> | 141 | <!-- 文字内容 --> |
138 | <view class='mid_item_text'> | 142 | <view class='mid_item_text'> |
139 | - 新个人所得税法近日备受关注。关于个人所得税,想必大家都十分关心,让我们通过以下问题! | 143 | + {{item.content}} |
140 | </view> | 144 | </view> |
141 | 145 | ||
142 | 146 |
1 | + | ||
2 | +const a = getApp(); | ||
1 | Page({ | 3 | Page({ |
2 | 4 | ||
3 | - /** | ||
4 | - * 页面的初始数据 | ||
5 | - */ | ||
6 | - data: { | ||
7 | - | ||
8 | - }, | ||
9 | - | ||
10 | - /** | ||
11 | - * 生命周期函数--监听页面加载 | ||
12 | - */ | ||
13 | - onLoad: function (options) { | ||
14 | - | ||
15 | - }, | ||
16 | - | ||
17 | - /** | ||
18 | - * 生命周期函数--监听页面初次渲染完成 | ||
19 | - */ | ||
20 | - onReady: function () { | ||
21 | - | ||
22 | - }, | ||
23 | - | ||
24 | - /** | ||
25 | - * 生命周期函数--监听页面显示 | ||
26 | - */ | ||
27 | - onShow: function () { | ||
28 | - | ||
29 | - }, | ||
30 | - | ||
31 | - /** | ||
32 | - * 生命周期函数--监听页面隐藏 | ||
33 | - */ | ||
34 | - onHide: function () { | ||
35 | - | ||
36 | - }, | ||
37 | - | ||
38 | - /** | ||
39 | - * 生命周期函数--监听页面卸载 | ||
40 | - */ | ||
41 | - onUnload: function () { | ||
42 | - | ||
43 | - }, | ||
44 | - | ||
45 | - /** | ||
46 | - * 页面相关事件处理函数--监听用户下拉动作 | ||
47 | - */ | ||
48 | - onPullDownRefresh: function () { | ||
49 | - | ||
50 | - }, | ||
51 | - | ||
52 | - /** | ||
53 | - * 页面上拉触底事件的处理函数 | ||
54 | - */ | ||
55 | - onReachBottom: function () { | ||
56 | - | ||
57 | - }, | ||
58 | - | ||
59 | - /** | ||
60 | - * 用户点击右上角分享 | ||
61 | - */ | ||
62 | - onShareAppMessage: function () { | ||
63 | - | ||
64 | - } | 5 | + /** |
6 | + * 页面的初始数据 | ||
7 | + */ | ||
8 | + data: { | ||
9 | + likeList: [], | ||
10 | + page: 1 | ||
11 | + }, | ||
12 | + | ||
13 | + /** | ||
14 | + * 生命周期函数--监听页面加载 | ||
15 | + */ | ||
16 | + onLoad: function(options) { | ||
17 | + this.getLikeList(); | ||
18 | + }, | ||
19 | + | ||
20 | + // 获取点赞列表 | ||
21 | + getLikeList() { | ||
22 | + let b = this, url = '/api/User/getMyLikeList', params = { | ||
23 | + header: true, | ||
24 | + page: b.data.page | ||
25 | + }; | ||
26 | + a.post(url, params).then((res) => { | ||
27 | + console.log(res); | ||
28 | + b.setData({ | ||
29 | + likeList: res.data | ||
30 | + }) | ||
31 | + }) | ||
32 | + }, | ||
33 | + | ||
34 | + /** | ||
35 | + * 生命周期函数--监听页面初次渲染完成 | ||
36 | + */ | ||
37 | + onReady: function() { | ||
38 | + | ||
39 | + }, | ||
40 | + | ||
41 | + /** | ||
42 | + * 生命周期函数--监听页面显示 | ||
43 | + */ | ||
44 | + onShow: function() { | ||
45 | + | ||
46 | + }, | ||
47 | + | ||
48 | + /** | ||
49 | + * 生命周期函数--监听页面隐藏 | ||
50 | + */ | ||
51 | + onHide: function() { | ||
52 | + | ||
53 | + }, | ||
54 | + | ||
55 | + /** | ||
56 | + * 生命周期函数--监听页面卸载 | ||
57 | + */ | ||
58 | + onUnload: function() { | ||
59 | + | ||
60 | + }, | ||
61 | + | ||
62 | + /** | ||
63 | + * 页面相关事件处理函数--监听用户下拉动作 | ||
64 | + */ | ||
65 | + onPullDownRefresh: function() { | ||
66 | + | ||
67 | + }, | ||
68 | + | ||
69 | + /** | ||
70 | + * 页面上拉触底事件的处理函数 | ||
71 | + */ | ||
72 | + onReachBottom: function() { | ||
73 | + let that = this; | ||
74 | + that.setData({ | ||
75 | + page: that.data.page + 1, | ||
76 | + }); | ||
77 | + that.getLikeList(); | ||
78 | + }, | ||
79 | + | ||
80 | + /** | ||
81 | + * 用户点击右上角分享 | ||
82 | + */ | ||
83 | + onShareAppMessage: function() { | ||
84 | + | ||
85 | + } | ||
65 | }) | 86 | }) |
@@ -110,34 +110,33 @@ | @@ -110,34 +110,33 @@ | ||
110 | <view class='mid'> | 110 | <view class='mid'> |
111 | 111 | ||
112 | <!-- 条目 --> | 112 | <!-- 条目 --> |
113 | - <view class='mid_item'> | 113 | + <view class='mid_item' wx:for="{{likeList}}" wx:key="index"> |
114 | <view class='mid_item_top'> | 114 | <view class='mid_item_top'> |
115 | <view class='mid_item_top_left'> | 115 | <view class='mid_item_top_left'> |
116 | <!-- 图片 --> | 116 | <!-- 图片 --> |
117 | <view class='mid_item_top_left_pic'> | 117 | <view class='mid_item_top_left_pic'> |
118 | - <image src='../../images/03_nav@2x.png'></image> | 118 | + <image src='{{item.avatar}}'></image> |
119 | </view> | 119 | </view> |
120 | <!-- 文字 --> | 120 | <!-- 文字 --> |
121 | <view class='mid_item_top_left_text'> | 121 | <view class='mid_item_top_left_text'> |
122 | - 金沃斯英语在线教育 | 122 | + {{item.nickname}} |
123 | </view> | 123 | </view> |
124 | </view> | 124 | </view> |
125 | <view class='mid_item_top_right'> | 125 | <view class='mid_item_top_right'> |
126 | - 15分钟前 | 126 | + {{item.create_time_text}} |
127 | </view> | 127 | </view> |
128 | </view> | 128 | </view> |
129 | <!-- 文字内容 --> | 129 | <!-- 文字内容 --> |
130 | - <view class='mid_item_text'> | ||
131 | - 新个人所得税法近日备受关注。关于个人所得税,想必大家都十分关心,让我们通过以下问题! | 130 | + <view class='mid_item_text'>{{item.title}} |
132 | </view> | 131 | </view> |
133 | <!-- 图片内容 --> | 132 | <!-- 图片内容 --> |
134 | <view class='mid_pic_box'> | 133 | <view class='mid_pic_box'> |
135 | - <view class='mid_pic_box_p'> | ||
136 | - <image src='../../images/weirenzheng@3x.png'></image> | 134 | + <view class='mid_pic_box_p' wx:for="{{item.images}}" wx:key="index"> |
135 | + <image src='{{item}}'></image> | ||
137 | </view> | 136 | </view> |
138 | - <view class='mid_pic_box_p'> | 137 | + <!-- <view class='mid_pic_box_p'> |
139 | <image src='../../images/weirenzheng@3x.png'></image> | 138 | <image src='../../images/weirenzheng@3x.png'></image> |
140 | - </view> | 139 | + </view> --> |
141 | 140 | ||
142 | 141 | ||
143 | </view> | 142 | </view> |
@@ -172,74 +171,7 @@ | @@ -172,74 +171,7 @@ | ||
172 | 171 | ||
173 | </view> | 172 | </view> |
174 | 173 | ||
175 | - | ||
176 | - | ||
177 | - <!-- 条目 --> | ||
178 | - <view class='mid_item'> | ||
179 | - <view class='mid_item_top'> | ||
180 | - <view class='mid_item_top_left'> | ||
181 | - <!-- 图片 --> | ||
182 | - <view class='mid_item_top_left_pic'> | ||
183 | - <image src='../../images/03_nav@2x.png'></image> | ||
184 | - </view> | ||
185 | - <!-- 文字 --> | ||
186 | - <view class='mid_item_top_left_text'> | ||
187 | - 金沃斯英语在线教育 | ||
188 | - <view class='icon_tm'> | ||
189 | - <image src='../../images/guangfang@2x.png'></image> | ||
190 | - </view> | ||
191 | - </view> | ||
192 | - </view> | ||
193 | - <view class='mid_item_top_right'> | ||
194 | - 15分钟前 | ||
195 | - </view> | ||
196 | - </view> | ||
197 | - <!-- 文字内容 --> | ||
198 | - <view class='mid_item_text'> | ||
199 | - 新个人所得税法近日备受关注。关于个人所得税,想必大家都十分关心,让我们通过以下问题! | ||
200 | - </view> | ||
201 | - <!-- 图片内容 --> | ||
202 | - <view class='mid_pic_box'> | ||
203 | - <view class='mid_pic_item'> | ||
204 | - <image src='../../images/weirenzheng@3x.png'></image> | ||
205 | - </view> | ||
206 | - | ||
207 | - </view> | ||
208 | - | ||
209 | - <!-- 底部 --> | ||
210 | - <view class='mid_item_like'> | ||
211 | - <view class='mid_item_like_left'> | ||
212 | - <!-- 删除 --> | ||
213 | - </view> | ||
214 | - | ||
215 | - <view class='mid_item_like_right'> | ||
216 | - <!-- 点赞 --> | ||
217 | - <view class='mid_like color_blue'> | ||
218 | - <image src='../../images/thumb-up-button@3x.png'></image> | ||
219 | - </view> | ||
220 | - <!-- 数量 --> | ||
221 | - <view class='mid_number '> | ||
222 | - 46 | ||
223 | - </view> | ||
224 | - | ||
225 | - <!-- 点赞 --> | ||
226 | - <view class='mid_like'> | ||
227 | - <image src='../../images/pinglun_fill@3x.png'></image> | ||
228 | - </view> | ||
229 | - <!-- 数量 --> | ||
230 | - <view class='mid_number'> | ||
231 | - 46 | ||
232 | - </view> | ||
233 | - </view> | ||
234 | - | ||
235 | - </view> | ||
236 | - <!-- 回复框 --> | ||
237 | - <!-- <view class='mid_item_bottom'> | ||
238 | - <view><span class='color_blue'>宏中科技</span>:非常实用!!!</view> | ||
239 | - <view><span class='color_blue'>宏中科技</span>:非常实用!!!</view> | ||
240 | - <view><span class='color_blue'>查看更多>></span></view> | ||
241 | - </view> --> | ||
242 | - </view> | 174 | + |
243 | </view> | 175 | </view> |
244 | </view> | 176 | </view> |
245 | </view> | 177 | </view> |
-
请 注册 或 登录 后发表评论