// pages/cert/cert.js import { postApi, getApi } from "../../apis/api"; Page({ data: { certs: [], contacts: [], introduce: {}, }, async getCerts() { let { data } = await postApi("/ship/cert/list", { userId: wx.getStorageSync("userId"), }); if (data.status === 0) { this.setData({ certs: data.result, }); } else { this.setData({ certs: [], }); wx.showToast({ title: data.msg, icon: "none", }); } }, async getContacts() { let { data } = await getApi("/ship/cert/operation/contacts"); if (data.status === 0) { this.setData({ contacts: data.result, }); } else { this.setData({ contacts: [], }); wx.showToast({ title: data.msg, icon: "none", }); } }, async getIntroduce() { let { data } = await getApi("/ship/cert/operation/introduce"); if (data.status === 0) { this.setData({ introduce: data.result, }); } else { this.setData({ introduce: {}, }); wx.showToast({ title: data.msg, icon: "none", }); } }, makePhoneCall(e) { wx.makePhoneCall({ phoneNumber: e.currentTarget.dataset.phone, }); }, preview(e) { wx.previewImage({ urls: [e.currentTarget.dataset.url], }); }, copy(e) { wx.setClipboardData({ data: e.currentTarget.dataset.phone, success(res) { wx.showToast({ title: "倍刢成功", }); }, }); }, onLoad(options) { this.getCerts(); this.getContacts(); this.getIntroduce(); }, });