const _my = require("../../__antmove/api/index.js")(my); const wx = _my; // pages/mine/mine.js import international from "../../international/appointment_scence/index"; const { desensitizationPhone, desensitizationIdNumber } = require("../../utils/util"); const app = getApp(); Page({ /** * 页面的初始数据 */ data: { international: international, //国际化语言包 language: app.data.language, statusBarHeight: 0, titleBarHeight: 0, type: 2, //1常客2访客 userInfo: null, // 功能列表 component_list: [{ id: 1, name_ch: "邀请人员", name_en: "Invite people", icon: "../../static/mine/my_appointment.png", url: "" }, { id: 2, name_ch: "常客邀请/申请记录", name_en: "Visiting records", icon: "../../static/mine/appointment_records.png", url: "" }, { id: 6, name_ch: "访客申请记录", name_en: "Visiting records", icon: "../../static/mine/visitors.png", url: "" }, { id: 3, name_ch: "更改信息", name_en: "Change the information", icon: "../../static/mine/company_msg.png", url: "" }, { id: 4, name_ch: "企业信息", name_en: "Enterprise information", icon: "../../static/mine/change_msg.png", url: "" }], adminInfo: null }, // /pages/regular_visit_details/regular_visit_details 拜访详情 // /pages/regular_company_manage/regular_company_manage 企业信息 // /pages/company_register/company_register 企业信息录入 // 跳转 goto(e) { let id = e.currentTarget.dataset.id; if (this.data.userInfo) { let url = ""; if (id == 1) { wx.requestSubscribeMessage({ entityIds: ["486ef1e5652a4629b6e95245f7cb44a9"], success(res) { if(res.behavior === 'subscribe') { url = "/pages/regular_invite/regular_invite"; wx.navigateTo({ url }) return } } }); } else if (id == 2) { url = "/pages/regular_visit_records/regular_visit_records"; } else if (id == 3) { url = "/pages/changeUserInfo/index"; } else if (id == 4) { url = "/pages/regular_company_manage/regular_company_manage"; } else if (id == 6) { url = "/pages/visit_records/visit_records"; } if(url) { wx.navigateTo({ url }); } } else { wx.showToast({ icon: "none", title: this.data.language == "ch" ? "请先认证!" : "Please first certification!" }); } }, // 认证 Certification() { wx.navigateTo({ url: "/pages/changeUserInfo/index" }); }, //图片预览 preview(e) { let url = e.currentTarget.dataset.src; wx.previewImage({ current: url, // 当前显示图片的http链接 urls: [url] // 需要预览的图片http链接列表 }); }, getUserInfo() { if (app.data.userInfo) { let userInfo = JSON.parse(JSON.stringify(wx.getStorageSync("userInfo"))); userInfo.idNumber = desensitizationIdNumber(userInfo.idNumber); userInfo.phone = desensitizationPhone(userInfo.phone); this.setData({ userInfo, type: app.data.extraMessage ? 2 : 1, adminInfo: app.data.adminInfo }); } }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.setData({ statusBarHeight: app.globalData.statusBarHeight, titleBarHeight: app.globalData.titleBarHeight }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () {}, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.getUserInfo(); this.setData({ language: app.data.language }); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () {}, /** * 生命周期函数--监听页面卸载 */ onUnload: function () {}, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () {}, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () {}, /** * 用户点击右上角分享 */ onShareAppMessage: function () {}, antmoveAction: function () { //执行时动态赋值,请勿删除 } });