當(dāng)前位置:首頁(yè) > IT技術(shù) > 微信平臺(tái) > 正文

微信小程序根據(jù)返回值判斷狀態(tài)
2021-07-28 14:13:46

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": "技術(shù)部",
        "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({
                    //第一個(gè)data為固定用法,第二個(gè)data是json中的data
                    //list: res.data.rows
                    list: (res.data.rows || []).map(a => {
                        a.visitCause = a.visitCause === 0 ? '面試' : a.visitCause === 1 ? '開(kāi)會(huì)' : a.visitCause === 2 ? '拜訪顧客' : a.visitCause ===
                            3 ? '項(xiàng)目實(shí)施' : '其他'
                        return a
                    })
                })
            }
        })
    },

wxml

<span>來(lái)訪理由:{{item.visitCause}}</span>

顯示

微信小程序根據(jù)返回值判斷狀態(tài)_json

本文摘自 :https://blog.51cto.com/u

開(kāi)通會(huì)員,享受整站包年服務(wù)立即開(kāi)通 >