json
{ "msg": "查询成功", "total": 25, "code": 1, "rows": [{ "id": 29, "subscribeTime": "2021-06-17 18:00:00", "name": "12", "sex": 1, "idNumber": "45", "phone": "34", "interviewee": "67", "visitOrgan": "", "visitOrganId": 1, "visitCause": 1, "visitCompany": "56", "applyTime": "2021-06-18 16:49:00", "state": 0, "deviceId": null, "type": 1, "pageBean": null },{ "id": 12, "subscribeTime": "2021-06-17 18:00:00", "name": "ww11", "sex": 1, "idNumber": "340823199308151525", "phone": "13661725175", "interviewee": "李俊飞2", "visitOrgan": "技术部", "visitOrganId": 1, "visitCause": 1, "visitCompany": "毛特", "applyTime": "2021-06-17 17:02:00", "state": 0, "deviceId": null, "type": 1, "pageBean": null }, { "id": 11, "subscribeTime": "2021-01-11 19:00:00", "name": "", "sex": 1, "idNumber": "", "phone": "", "interviewee": "", "visitOrgan": "", "visitOrganId": 1, "visitCause": 1, "visitCompany": "", "applyTime": "2021-06-17 16:33:00", "state": 0, "deviceId": null, "type": 1, "pageBean": null }] }
js
onLoad: function(options) { wx.request({ url: "http://192.xxx.4.1xx:8093/cs-applet/subscribe/list", data: { "pageBean.page": 1, "pageBean.rows": 25, "pageBean.pagination": true, "subscribeTime": 6 }, method: 'GET', header: { 'content-type': 'application/json' }, success: res => { this.setData({ //第一个data为固定用法,第二个data是json中的data //list: res.data.rows list: (res.data.rows || []).map(a => { a.visitCause = a.visitCause === 0 ? '面试' : a.visitCause === 1 ? '开会' : a.visitCause === 2 ? '拜访顾客' : a.visitCause === 3 ? '项目实施' : '其他' return a }) }) } }) },
wxml
<span>来访理由:{{item.visitCause}}</span>
显示
本文摘自 :https://blog.51cto.com/u