work.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import apps from "./apps";
  2. function initWorkbench(that) {
  3. let entrance = [{
  4. label: "通用",
  5. icon: "work-tongyong",
  6. appid: "wx197f219a82a89d7b",
  7. list: apps.getapps()
  8. }, {
  9. label: "E-订单",
  10. appid: "wxc1b6ae925ac1d06a",
  11. icon: "work-E-dingdan",
  12. list: apps.getedd()
  13. }, {
  14. label: "E-服务",
  15. appid: "wxc1b6ae925ac1d06a",
  16. icon: "work-E-fuwu",
  17. list: apps.geteservice()
  18. }, {
  19. label: "营销工具",
  20. icon: "work-yingxiaogongju",
  21. appid: "wx197f219a82a89d7b",
  22. list: apps.gettool()
  23. }, {
  24. label: "CRM",
  25. appid: "wx197f219a82a89d7b",
  26. icon: "work-CRM",
  27. list: apps.getcrm()
  28. }];
  29. wx.removeStorageSync('auth')
  30. wx.setStorageSync('auth', apps.authList)
  31. that.setData({
  32. entrance,
  33. auth: JSON.stringify(apps.authList),
  34. userMsg: JSON.stringify(wx.getStorageSync('userMsg')),
  35. site: JSON.stringify(wx.getStorageSync('siteP')),
  36. templetList: JSON.stringify(wx.getStorageSync('templetList'))
  37. })
  38. /* 获取首页banner */
  39. let banner = wx.getStorageSync('banner_list').find(v => v.location == "index_top");
  40. if (banner) that.setData({
  41. bannerList: banner.ads
  42. })
  43. //用于消息跳转对照权限以及路径
  44. wx.setStorageSync('authComparison', entrance.map(v => {
  45. v = v.list.map(s => {
  46. s.appid = v.appid;
  47. return s
  48. })
  49. return v
  50. }).flat())
  51. }
  52. function isHistory() {
  53. let history = getApp().globalData.LaunchOptions;
  54. if (history && !getCurrentPages().some(v => v.__route__ == history.path) && history.path != 'pages/login/phone') {
  55. let url = `/${history.path}?`;
  56. for (const key in history.query) {
  57. url += `${key}=${history.query[key]}&`
  58. }
  59. wx.navigateTo({
  60. url,
  61. success(res) {
  62. wx.showToast({
  63. title: getApp().globalData.Language.getMapText('已恢复页面'),
  64. icon: "none"
  65. });
  66. getApp().globalData.LaunchOptions = null;
  67. }
  68. })
  69. } else {
  70. getApp().globalData.LaunchOptions = null;
  71. }
  72. }
  73. function isRemindChangePassword() {
  74. if (getApp().globalData.remindchangepassword) wx.showModal({
  75. title: getApp().globalData.Language.getMapText('提示'),
  76. content: getApp().globalData.Language.getMapText('当前密码为初始密码,请前往修改密码'),
  77. cancelText: getApp().globalData.Language.getMapText('下次再说'),
  78. confirmText: getApp().globalData.Language.getMapText('前往修改'),
  79. success: ({
  80. confirm
  81. }) => {
  82. getApp().globalData.remindchangepassword = null;
  83. if (confirm) wx.navigateTo({
  84. url: '/pages/tabbar/mine/changePassword/index',
  85. })
  86. },
  87. })
  88. }
  89. module.exports = {
  90. initWorkbench,
  91. isHistory,
  92. isRemindChangePassword
  93. }