work.js 2.7 KB

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