| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 | const _Http = getApp().globalData.http;Page({    data: {        contacts: [],        form1: [],        form2: [],        show: false,        actions: [{            name: "呼叫"        }, {            name: "复制"        }]    },    onLoad(options) {        this.handleData(JSON.parse(options.item))    },    handleData(item) {        const form1 = [{                label: "性别",                content: item.sex            }, {                label: "生日",                content: item.birthday            }, {                label: "家庭住址",                content: item.homeaddress            }, {                label: "邮箱",                content: item.email            }],            form2 = [{                label: "单位",                content: item.company            }, {                label: "部门",                content: item.depname            }, {                label: "职位",                content: item.position            }]        this.setData({            contacts: item,            form1,            form2        })    },    changeShow() {        this.setData({            show: !this.data.show        })    },    /* 处理选择 */    handleSelect(e) {        let phone = this.data.contacts.phonenumber;        if (e.detail.name == '复制') {            wx.setClipboardData({                data: phone            });        } else {            wx.makePhoneCall({                phoneNumber: phone,            })        };        this.changeShow()    },    /* 拷贝内容 */    copyContents(e) {        const {            data        } = e.currentTarget.dataset;        if (data) wx.setClipboardData({            data,        });    },    /* 去编辑 */    toEdit() {        let data = JSON.stringify(this.data.contacts);        wx.navigateTo({            url: '../contacts/edit?data=' + data,        })    },    /* 删除 */    deleteData() {        const that = this;        wx.showModal({            title: "提示",            content: `是否确认删除${this.data.contacts.name}`,            success({                confirm            }) {                if (confirm) _Http.basic({                    "id": "20220831164703",                    "version": 1,                    "content": {                        "sys_phonebookid": that.data.contacts.sys_phonebookid                    }                }).then(res => {                    if (res.msg != '成功') return wx.showToast({                        title: res.data,                        icon: "none"                    })                    getCurrentPages().forEach(v => {                        if (v.route === 'packageA/contacts/index') {                            v.getGroup();                        } else if (v.route === 'packageA/contacts/list') {                            let arr = v.data.phonebook.filter(v => v.sys_phonebookid != that.data.contacts.sys_phonebookid);                            v.setData({                                phonebook: arr                            })                        }                    });                    wx.showToast({                        title: '删除成功',                        icon: 'none'                    })                    setTimeout(() => {                        wx.navigateBack({                            delta: 0,                        })                    }, 500);                })            }        })    },    onShareAppMessage() {}})
 |