import { ApiModel } from "../../utils/api"; const _Http = new ApiModel(); function showModel(data, content) { wx.setStorageSync('qrCodeMsg', data); wx.showModal({ title: '提示', content: content, showCancel: false, success: (res => { if (res.confirm) wx.navigateTo({ url: '/pages/login/index', }) }) }); } //解析二维码链接 function setDataUrl(url) { let q = url; console.log("q", q); const data = { type: q.slice(q.indexOf("type=") + 5, q.indexOf('&')), id: q.slice(q.lastIndexOf('=') + 1), name: q.slice(q.lastIndexOf('fbrand=') + 7, q.lastIndexOf('&')) } if (!wx.getStorageSync('userData').token) { return showModel(data, '当前未登录,请登录后进入') } else { _Http.basic({ "accesstoken": wx.getStorageSync('userData').token, "classname": "customer.usercenter.usermsg.usermsg", "method": "query_usermsg", "content": {} }).then(res => { if (res.msg != '成功') showModel(data, "登陆状态已过期,请重新登陆!"); return data; }) } } module.exports = { setDataUrl }