Explorar el Código

Merge branch '跳转bug' into 国际化适配

# Conflicts:
#	app.js
#	utils/work/work.js
xiaohaizhao hace 1 año
padre
commit
45c290dc1d

+ 4 - 26
app.js

@@ -11,10 +11,13 @@ App({
       wx.removeStorageSync('userMsg')
       wx.removeStorageSync('auth')
       wx.removeStorageSync('userauth');
+      wx.removeStorageSync('templetList');
       wx.setStorageSync('userMsg', JSON.parse(options.query.userMsg));
       wx.setStorageSync('auth', JSON.parse(options.query.auth));
       wx.setStorageSync('siteP', JSON.parse(options.query.site));
-      wx.setStorageSync('languagecode', JSON.parse(options.query.languagecode));
+      wx.setStorageSync('templetList', JSON.parse(options.query.templetList));
+      console.log("options.query.templetList", options.query.templetList)
+      wx.setStorageSync('languagecode', options.query.languagecode);
       //获取用户权限 
       this.globalData.http.basic({
         "classname": "sysmanage.develop.userauth.userauth",
@@ -30,34 +33,9 @@ App({
         })
         wx.setStorageSync('userauth', res.data);
       });
-      try {
-        if (!wx.getStorageSync('templetList')) getTempletList()
-      } catch (error) {
-        getTempletList()
-      }
-      function getTempletList() {
-        this.globalData.http.basic({
-          "classname": "sysmanage.develop.querytemplet.querytemplet",
-          "method": "query",
-          "content": {}
-        }).then(res => {
-          console.log("获取列表查询条件", res)
-          if (res.msg != '成功') return;
-          let data = res.data.find(v => v.templetname == '站点全部');
-          if (data) {
-            res.data = res.data.filter(v => v.templetname != '站点全部')
-            res.data.unshift(data)
-          }
-          wx.setStorageSync('templetList', res.data)
-          getCurrentPages()[getCurrentPages().length - 1].getList && getCurrentPages()[getCurrentPages().length - 1].getList(true);
-        })
-      };
     }
-    wx.setStorageSync('appid', 'wx197f219a82a89d7b');
     if (!wx.getStorageSync('languagecode')) wx.setStorageSync('languagecode', 'ZH');
-    
     this.globalData.Language.getLanguages(wx.getStorageSync('languagecode'));
-
   },
   initSocket() {
     let that = this;

+ 0 - 4
app.json

@@ -24,7 +24,6 @@
         "pages/group/index",
         "pages/group/select",
         "pages/tags/index",
-        "pages/tabbar/workbench/index",
         "pages/mediaLibrary/index",
         "pages/tabbar/mine/webView",
         "pages/tabbar/mine/associatedPublicNumber",
@@ -223,9 +222,6 @@
             {
                 "pagePath": "pages/tabbar/home/index"
             },
-            {
-                "pagePath": "pages/tabbar/workbench/index"
-            },
             {
                 "pagePath": "pages/tabbar/message/index"
             },

+ 0 - 6
custom-tab-bar/index.js

@@ -17,12 +17,6 @@ Component({
         text: '信息',
         url: '/pages/tabbar/message/index',
         name: 'message'
-      }, {
-        icon: 'icon-gongzuotai-weixuanzhong',
-        acicon: 'icon-gongzuotai-xuanzhong',
-        text: '工作台',
-        url: '/pages/tabbar/workbench/index',
-        name: 'workbench'
       },
       {
         icon: 'icon-a-biaoqianlanwode',

+ 17 - 1
pages/login/modules/login.js

@@ -1,4 +1,9 @@
 function loginMsg(res) {
+	wx.removeStorageSync('auth')
+	wx.removeStorageSync('userauth');
+	wx.removeStorageSync('siteP');
+    wx.removeStorageSync('banner_list');
+	wx.removeStorageSync('templetList');
     wx.setStorageSync('account_list', res.account_list);
     if (res.account_list.length == 1) {
         wx.removeStorageSync('userMsg')
@@ -31,7 +36,11 @@ function init() {
         content: {
             nocache: true
         }
-    }].map(v => _Http.basic(v))).then(list => {
+    }, {
+		"classname": "sysmanage.develop.querytemplet.querytemplet",
+		"method": "query",
+		"content": {}
+	}].map(v => _Http.basic(v))).then(list => {
         console.log("登录初始化", list)
         if (list.some(res => res.msg != '成功')) return list.filter(res => {
             if (res.msg != '成功') wx.showToast({
@@ -48,6 +57,13 @@ function init() {
         wx.setStorageSync('siteP', list[1].data);
         wx.setStorageSync('banner_list', list[2].data)
         if (!getApp().globalData.socketEstablish) getApp().initSocket();
+        let data = list[3].data.find(v => v.templetname == '站点全部');
+		if (data) {
+			list[3].data = list[3].data.filter(v => v.templetname != '站点全部')
+			list[3].data.unshift(data)
+        }
+		wx.setStorageSync('templetList', list[3].data)
+        
         let pages = getCurrentPages();
         let prevPage = pages[pages.length - 2];
         if (prevPage && prevPage.__route__ == 'pages/tabbar/home/index') prevPage.refreshData();

+ 1 - 1
pages/tabbar/home/index.js

@@ -7,7 +7,7 @@ import {
 } from "../../../utils/work/work";
 Page({
     data: {
-        appid: wx.getStorageSync('appid'),
+        appid: 'wx197f219a82a89d7b',
         bannerList: [], //banner列表
         gridList: [],
         notice: "",

+ 1 - 1
pages/tabbar/home/index.wxml

@@ -25,7 +25,7 @@
         <view class="group" wx:if="{{item.list.length}}">
             <view class="label"><text class="work {{item.icon}}" />{{item.label}}</view>
             <view class="main">
-                <navigator version='develop' class="item" wx:for="{{item.list}}" wx:for-item="it" wx:for-index="i" target='{{item.appid!=appid?"miniProgram":"self"}}' app-id='{{item.appid}}' path="{{it.path+'?auth='+auth+'&userMsg='+userMsg+'&site='+site}}" url="{{it.path}}" open-type="{{it.openType||'navigate'}}" wx:key="name" data-it="{{it}}" data-item="{{item}}" bindtap="openRecord">
+                <navigator version='develop' class="item" wx:for="{{item.list}}" wx:for-item="it" wx:for-index="i" target='{{item.appid!=appid?"miniProgram":"self"}}' app-id='{{item.appid}}' path="{{it.path+'?auth='+auth+'&userMsg='+userMsg+'&site='+site+'&templetList='+templetList}}" url="{{it.path}}" open-type="{{it.openType||'navigate'}}" wx:key="name" data-it="{{it}}" data-item="{{item}}" bindtap="openRecord">
                     <view class="icon-box" style="background-color: {{it.bColor}};">
                         <text class="work {{it.icon}}" style="color: {{it.color}};" />
                     </view>

+ 1 - 1
pages/tabbar/message/details.js

@@ -1,7 +1,7 @@
 const _Http = getApp().globalData.http;
 Page({
     data: {
-        appid: wx.getStorageSync('appid'),
+        appid: 'wx197f219a82a89d7b',
         detailsData: {}
     },
     onLoad(options) {

+ 0 - 386
pages/tabbar/workbench/index.js

@@ -1,386 +0,0 @@
-Page({
-    data: {
-        appid: "wx197f219a82a89d7b",
-    },
-    onLoad(options) {
-        this.refreshData() //更新权限等信息
-        this.setData({ //最近使用记录
-            recorded: wx.getStorageSync('recorded') || []
-        });
-    },
-    /* 更新站点信息 */
-    refreshData() {
-        if (wx.getStorageSync('userauth').length != 0) {
-            let authList = {},
-                entrance = [{
-                    label: "通用",
-                    appid: "wx197f219a82a89d7b",
-                    icon: "work-tongyong",
-                    list: getapps()
-                }, {
-                    label: "营销工具",
-                    appid: "wx197f219a82a89d7b",
-                    icon: "work-yingxiaogongju",
-                    list: gettool()
-                }, {
-                    label: "CRM",
-                    appid: "wx197f219a82a89d7b",
-                    icon: "work-CRM",
-                    list: getcrm()
-                }, {
-                    label: "E-订单",
-                    appid: "wxc1b6ae925ac1d06a",
-                    icon: "work-E-dingdan",
-                    list: getedd()
-                }, {
-                    label: "E-服务",
-                    appid: "wxc1b6ae925ac1d06a",
-                    icon: "work-E-fuwu",
-                    list: geteservice()
-                }, ];
-            //通用
-            function getapps() {
-                const paths = [{
-                    name: "签到",
-                    path: "/packageA/clockIn/index",
-                    icon: "work-a-wodemendianxinxidizhi"
-                }, {
-                    name: "任务",
-                    path: "/packageA/work/index",
-                    icon: "work-a-woderenwuzhongxin"
-                }, {
-                    name: "通讯录",
-                    path: "/packageA/contacts/index",
-                    icon: "work-xiaochengxutongxunlu"
-                }];
-                let app = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['通用'], ['通用']),
-                    list = [];
-                app.forEach((v, i) => {
-                    v.apps.forEach(s => {
-                        authList[s.name] = {
-                            options: s.meta.auth.map(a => a.option),
-                            optionnames: s.meta.auth.map(a => a.optionname),
-                        }
-                        if (authList[s.name].options.some(s => s == "read")) {
-                            let i = paths.findIndex(k => k.name == s.meta.title);
-                            if (i != -1) {
-                                paths[i].index = i;
-                                list.push(paths[i])
-                            }
-                        }
-                    })
-                });
-
-                return dye(list)
-            }
-            //营销工具
-            function gettool() {
-                const paths = [{
-                    name: "通告",
-                    path: "/pages/annunciate/index",
-                    icon: "work-a-shouyejingangqutonggao"
-                }, {
-                    name: "营销物料",
-                    path: "/pages/mediaLibrary/index",
-                    icon: "work-a-shouyejingangquyingxiaowuliao",
-                    openType: "switchTab"
-                }, {
-                    name: "推广素材",
-                    path: "/pages/promotional/index",
-                    icon: "work-a-shouyejingangqutuiguangsucai"
-                }, {
-                    name: "商学院",
-                    path: "/pages/college/index",
-                    icon: "work-a-shangxueyuanxuexi"
-                }, {
-                    name: "提报",
-                    path: "/pages/submission/index",
-                    icon: "work-a-tibaoguanlitibao"
-                }];
-                let tool = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['营销工具'], paths.map(v => v.name)),
-                    list = [];
-                tool.forEach(v => {
-                    let auth = v.apps[0].meta.auth;
-                    if (!auth.some(r => r.option == 'read')) return;
-                    authList[v.apps[0].name] = {
-                        options: auth.map(a => a.option),
-                        optionnames: auth.map(a => a.optionname)
-                    };
-                    let item = paths.find(s => s.name == v.systemmodulename);
-                    item && list.push(item)
-                });
-
-                return dye(list)
-            };
-            //CRM
-            function getcrm() {
-                const paths = [{
-                    name: "市场活动",
-                    path: "/packageA/activity/index",
-                    icon: "work-shichanghuodong",
-                }, {
-                    name: "公海线索",
-                    path: "/packageA/publicClue/index",
-                    icon: "work-xiaochengxu_xiaoshoumubiao"
-                }, {
-                    name: "销售线索",
-                    path: "/packageA/saleClue/index",
-                    icon: "work-xiaoshouxiansuo"
-                }, {
-                    name: "公海客户",
-                    path: "/packageA/publicCustomer/index",
-                    icon: "work-gonghaikehu"
-                }, {
-                    name: "客户",
-                    path: "/packageA/setclient/index",
-                    icon: "work-kehu"
-                }, {
-                    name: "项目商机",
-                    path: "/packageA/project/index",
-                    icon: "work-xiangmushangji"
-                }, {
-                    name: "报价单",
-                    path: "/packageA/offers/index",
-                    icon: "work-xiangmubaojia"
-                }, {
-                    name: "竞争对手",
-                    path: "/packageA/opponent/index",
-                    icon: "work-jingzhengduishou"
-                }, {
-                    name: "合同",
-                    path: "/packageA/contract/index",
-                    icon: "work-hetong"
-                }, {
-                    name: "销售目标",
-                    path: "/packageA/target/index",
-                    icon: "work-xiaochengxu_xiaoshoumubiao"
-                }, {
-                    name: "销售预测",
-                    path: "/packageA/salesForecasting/index",
-                    icon: "work-xiaochengxu_xiaoshouyuce"
-                }];
-                let crm = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ['CRM'], ['销售预测', '销售线索', '销售目标', '合同管理', '客户管理', '项目管理']),
-                    list = [];
-                crm.forEach(v => {
-                    v.apps.forEach(s => {
-                        authList[s.name] = {
-                            options: s.meta.auth.map(a => a.option),
-                            optionnames: s.meta.auth.map(a => a.optionname),
-                        }
-                        if (authList[s.name].options.some(s => s == "read")) {
-                            let i = paths.findIndex(k => k.name == s.meta.title);
-                            if (i != -1) {
-                                paths[i].index = i;
-                                list.push(paths[i])
-                            }
-                        }
-                    })
-                });
-                return dye(list.sort((a, b) => a.index - b.index))
-            };
-            //E订单
-            function getedd() {
-                let paths = [{
-                    name: "商城",
-                    path: "/packageA/market/index",
-                    icon: "work-shangcheng"
-                }, {
-                    name: "销售订单",
-                    path: "/packageA/orderForm/index",
-                    icon: "work-dingdan"
-                }, {
-                    name: "收货",
-                    path: "/packageA/shipment/index",
-                    icon: "work-shouhuo"
-                }, {
-                    name: "业绩目标",
-                    path: "/packageA/target/index",
-                    icon: "work-yejimubiao"
-                }, {
-                    name: "账户",
-                    path: "/packageA/account/index",
-                    icon: "work-zhanghu"
-                }, {
-                    name: "促销活动",
-                    path: "/packageA/activity/index",
-                    icon: "work-cuxiaohuodong"
-                }, {
-                    name: "工具查询",
-                    path: "/packageA/tool/index",
-                    icon: "work-gongjuchaxun"
-                }, {
-                    name: "购物车",
-                    path: "/packageA/shopping/index",
-                    icon: "work-gouwuche"
-                }, {
-                    name: "开票",
-                    path: "/packageA/invoice/index",
-                    icon: "work-kaipiao"
-                }, {
-                    name: "打款凭证",
-                    path: "/packageA/remitVoucher/index",
-                    icon: "work-dakuanpingzheng"
-                }, {
-                    name: "工具借用",
-                    path: "/packageA/borrow/index",
-                    icon: "work-shujuchaxun"
-                }, {
-                    name: "工具归还",
-                    path: "/packageA/toolBill/index",
-                    icon: "work-shujuchaxun"
-                }, {
-                    name: "居间费结算",
-                    path: "/packageA/betweenFee/index",
-                    icon: "work-jujianfeijiesuan"
-                }];
-                /* , {
-                    name: "数据查询",
-                    path: "#",
-                    icon: "work-shujuchaxun"
-                } */
-                let edd = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ["E-订单"], ["商品档案", "销售管理", "财务管理", "售后管理", "发货与库存", "业绩查询"]),
-                    list = [];
-                edd.forEach(v => {
-                    v.apps.forEach(s => {
-                        authList[s.name] = {
-                            options: s.meta.auth.map(a => a.option),
-                            optionnames: s.meta.auth.map(a => a.optionname),
-                        }
-                        if (authList[s.name].options.some(s => s == "read")) {
-                            let i = paths.findIndex(k => k.name == s.meta.title);
-                            if (i != -1) {
-                                paths[i].index = i;
-                                list.push(paths[i])
-                            }
-                        }
-                    })
-                });
-                return dye(list.sort((a, b) => a.index - b.index))
-            };
-            //E服务
-            function geteservice() {
-                let paths = [{
-                    name: "工单",
-                    path: "/Eservice/workOrder/index",
-                    icon: "work-gongdan"
-                }, {
-                    name: "申请单",
-                    path: "/Eservice/agent/serviceBillList/index",
-                    icon: "work-shenqingdan"
-                }, {
-                    name: "申请单管理",
-                    path: "/Eservice/workerLeader/serviceBillList/index",
-                    icon: "work-shenqingdanguanli"
-                }, {
-                    name: "业务员服务申请单",
-                    path: "/Eservice/saler/serviceBillList/index",
-                    icon: "work-yewuyuanfuwushenqingdan"
-                }];
-                let eservice = getApp().globalData.queryPer.query(wx.getStorageSync('userauth'), ["E-服务"], ["工单管理"]),
-                    list = [];
-                eservice.forEach(v => {
-                    v.apps.forEach(s => {
-                        authList[s.name] = {
-                            options: s.meta.auth.map(a => a.option),
-                            optionnames: s.meta.auth.map(a => a.optionname),
-                        }
-                        if (authList[s.name].options.some(s => s == "read")) {
-                            let i = paths.findIndex(k => k.name == s.meta.title);
-                            if (i != -1) {
-                                paths[i].index = i;
-                                list.push(paths[i])
-                            }
-                        }
-                    })
-                });
-                return dye(list.sort((a, b) => a.index - b.index))
-            }
-            //染色
-            function dye(list) {
-                let colorList = [{
-                    color: "#3874F6",
-                    bColor: "#F0F3FF",
-                }, {
-                    color: "#5AB73F",
-                    bColor: "#F4FAEF",
-                }, {
-                    color: "#F29C37",
-                    bColor: "#FCF6EF",
-                }, {
-                    color: "#EB4B5C",
-                    bColor: "#FDF1ED",
-                }, {
-                    color: "#3874F6",
-                    bColor: "#F0F3FF",
-                }, {
-                    color: "#F29C37",
-                    bColor: "#FCF6EF",
-                }, {
-                    color: "#EB4B5C",
-                    bColor: "#FDF1ED",
-                }, {
-                    color: "#3874F6",
-                    bColor: "#F0F3FF",
-                }, {
-                    color: "#5AB73F",
-                    bColor: "#F4FAEF",
-                }, {
-                    color: "#F29C37",
-                    bColor: "#FCF6EF",
-                }, {
-                    color: "#5AB73F",
-                    bColor: "#F4FAEF",
-                }, {
-                    color: "#3874F6",
-                    bColor: "#F0F3FF",
-                }, {
-                    color: "#F29C37",
-                    bColor: "#FCF6EF",
-                }, {
-                    color: "#EB4B5C",
-                    bColor: "#FDF1ED",
-                }, {
-                    color: "#5AB73F",
-                    bColor: "#F4FAEF",
-                }];
-                return list.map((v, i) => {
-                    return {
-                        ...v,
-                        ...colorList[i > colorList.length - 1 ? i - colorList.length : i]
-                    }
-                })
-            };
-            wx.setStorageSync('auth', authList)
-            this.setData({
-                entrance,
-                auth: JSON.stringify(authList),
-                userMsg: JSON.stringify(wx.getStorageSync('userMsg')),
-                site: JSON.stringify(wx.getStorageSync('siteP'))
-            })
-        } else {
-            setTimeout(this.refreshData, 10);
-            return;
-        }
-    },
-    /* 使用记录 */
-    openRecord(e) {
-        let {
-            item,
-            it
-        } = e.currentTarget.dataset;
-        if (!it) return;
-        if (item.appid) it.appid = item.appid;
-        this.data.recorded.unshift(it);
-        let recorded = this.data.recorded.reduce((pre, cur) => {
-            if (!pre.some(v => v.name == cur.name)) pre.push(cur)
-            return pre
-        }, []);
-        this.setData({
-            recorded: recorded.slice(0, 5)
-        })
-        wx.setStorageSync('recorded', recorded.slice(0, 5))
-    },
-    onShow() {
-        this.getTabBar().init();
-    },
-})

+ 0 - 4
pages/tabbar/workbench/index.json

@@ -1,4 +0,0 @@
-{
-    "usingComponents": {},
-    "navigationBarTitleText": "工作台"
-}

+ 0 - 58
pages/tabbar/workbench/index.scss

@@ -1,58 +0,0 @@
-.grld {
-    width: 100vw;
-    background-color: #fff;
-    box-sizing: border-box;
-    padding-top: 30rpx;
-
-    .group {
-        margin-bottom: 30rpx;
-
-        .label {
-            height: 36rpx;
-            font-size: 30rpx;
-            font-family: AppleSystemUIFont-Bold, AppleSystemUIFont;
-            font-weight: bold;
-            color: #333333;
-            margin-bottom: 10rpx;
-
-            text {
-                margin: 0 20rpx 0 30rpx;
-            }
-        }
-
-        .main {
-            display: flex;
-            flex-wrap: wrap;
-
-            .item {
-                display: flex;
-                flex-direction: column;
-                align-items: center;
-                padding: 20rpx 0;
-                width: 20%;
-                border-radius: 16rpx;
-
-                .icon-box {
-                    width: 80rpx;
-                    border-radius: 16rpx;
-                    line-height: 80rpx;
-                    text-align: center;
-
-                    text {
-                        font-size: 40rpx;
-                    }
-                }
-
-                .name {
-                    width: 80%;
-                    line-height: 30rpx;
-                    font-size: 24rpx;
-                    font-family: AppleSystemUIFont-Regular, AppleSystemUIFont;
-                    color: #333333;
-                    margin-top: 16rpx;
-                    text-align: center;
-                }
-            }
-        }
-    }
-}

+ 0 - 29
pages/tabbar/workbench/index.wxml

@@ -1,29 +0,0 @@
-<view wx:if="{{recorded.length}}" class="grld">
-    <view class="group">
-        <view class="label"><text class="work work-zuijinshiyong" />最近使用</view>
-        <view class="main">
-            <navigator version='trial' class="item" target='{{it.appid!=appid?"miniProgram":"self"}}' app-id='{{it.appid}}' path="{{it.path+'?auth='+auth+'&userMsg='+userMsg+'&site='+site}}" wx:for="{{recorded}}" wx:for-item="it" wx:for-index="i" url="{{it.path}}" open-type="{{it.openType||'navigate'}}" wx:key="name" data-item="{{it}}">
-                <view class="icon-box" style="background-color: {{it.bColor}};">
-                    <text class="work {{it.icon}}" style="color: {{it.color}};" />
-                </view>
-                <view class="name line-1">{{it.name}}</view>
-            </navigator>
-        </view>
-    </view>
-</view>
-<view class="grld">
-    <block wx:for="{{entrance}}" wx:key="index">
-        <view class="group" wx:if="{{item.list.length}}">
-            <view class="label"><text class="work {{item.icon}}" />{{item.label}}</view>
-            <view class="main">
-                <navigator version='trial' class="item" wx:for="{{item.list}}" wx:for-item="it" wx:for-index="i" target='{{item.appid!=appid?"miniProgram":"self"}}' app-id='{{item.appid}}' path="{{it.path+'?auth='+auth+'&userMsg='+userMsg+'&site='+site}}" url="{{it.path}}" open-type="{{it.openType||'navigate'}}" wx:key="name" data-it="{{it}}" data-item="{{item}}" bindtap="openRecord">
-                    <view class="icon-box" style="background-color: {{it.bColor}};">
-                        <text class="work {{it.icon}}" style="color: {{it.color}};" />
-                    </view>
-                    <view class="name">{{it.name}}</view>
-                </navigator>
-            </view>
-        </view>
-    </block>
-</view>
-<view style="height: 140rpx;" />

+ 3 - 2
utils/work/work.js

@@ -41,13 +41,14 @@ async function initWorkbench(that) {
             return v
         })
     }
-
+    wx.removeStorageSync('auth')
     wx.setStorageSync('auth', apps.authList)
     that.setData({
         entrance,
         auth: JSON.stringify(apps.authList),
         userMsg: JSON.stringify(wx.getStorageSync('userMsg')),
-        site: JSON.stringify(wx.getStorageSync('siteP'))
+        site: JSON.stringify(wx.getStorageSync('siteP')),
+        templetList: JSON.stringify(wx.getStorageSync('templetList'))
     })
     /* 获取首页banner */
     let banner = wx.getStorageSync('banner_list').find(v => v.location == "index_top");