analyze.js 902 B

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