analyze.js 907 B

1234567891011121314151617181920212223242526272829303132
  1. function showModel(data, content) {
  2. wx.setStorageSync('qrCodeMsg', data);
  3. wx.showModal({
  4. title: '提示',
  5. content: content,
  6. showCancel: false,
  7. success: (res => {
  8. if (res.confirm) wx.reLaunch({
  9. url: '/pages/login/index',
  10. })
  11. })
  12. });
  13. }
  14. //解析二维码链接
  15. function setDataUrl(url, login) {
  16. let q = url;
  17. console.log("q", q);
  18. const data = {
  19. type: q.slice(q.indexOf("type=") + 5, q.indexOf('&')),
  20. id: q.slice(q.lastIndexOf('=') + 1),
  21. name: q.slice(q.lastIndexOf('fbrand=') + 7, q.lastIndexOf('&'))
  22. }
  23. if (!wx.getStorageSync('userData').token) {
  24. return showModel(data, '当前未登录,请登录后进入!')
  25. } else if (login) {
  26. return showModel(data, '登录状态已过期,请重新登陆!')
  27. };
  28. return data;
  29. }
  30. module.exports = {
  31. setDataUrl
  32. }