Browse Source

获取状态颜色底层封装

xiaohaizhao 3 months ago
parent
commit
473558e7fc
4 changed files with 134 additions and 19 deletions
  1. 16 1
      app.js
  2. 29 17
      pages/login/modules/login.js
  3. 87 0
      utils/defaultColors.js
  4. 2 1
      utils/language.js

+ 16 - 1
app.js

@@ -36,7 +36,22 @@ App({
                 })
                 wx.setStorageSync('userauth', res.data);
             });
-        };
+            this.globalData.http.sColors = require("./utils/defaultColors")
+            _Http.basic({
+                "classname": "sysmanage.develop.optiontype.optiontype",
+                "method": "optiontypeselect",
+                "content": {
+                    "typename": "statuscolors"
+                }
+            }).then(res => {
+                if (res.code != '1') return;
+                res.data.forEach(v => {
+                    _Http.sColors[v.value] = v.remarks
+                })
+            });
+        } else {
+            this.globalData.http.sColors = require("./utils/defaultColors")
+        }
         if (!wx.getStorageSync('languagecode')) wx.setStorageSync('languagecode', 'ZH');
         this.globalData.Language.getLanguages(wx.getStorageSync('languagecode'));
     },

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

@@ -1,22 +1,22 @@
 function loginMsg(res) {
-	wx.removeStorageSync('auth')
-	wx.removeStorageSync('userauth');
-	wx.removeStorageSync('siteP');
-	wx.removeStorageSync('banner_list');
-	wx.removeStorageSync('templetList');
-	wx.setStorageSync('isAgree', true)
-	wx.setStorageSync('account_list', res.account_list);
-	if (res.account_list.length == 1) {
+    wx.removeStorageSync('auth')
+    wx.removeStorageSync('userauth');
+    wx.removeStorageSync('siteP');
+    wx.removeStorageSync('banner_list');
+    wx.removeStorageSync('templetList');
+    wx.setStorageSync('isAgree', true)
+    wx.setStorageSync('account_list', res.account_list);
+    if (res.account_list.length == 1) {
         wx.removeStorageSync('userrole')
-		wx.setStorageSync('userrole', res.account_list[0].usertype == 1 ? '业务员' : '经销商');
-		wx.removeStorageSync('userMsg')
-		wx.setStorageSync('userMsg', res.account_list[0])
-		init();
-	} else {
-		wx.redirectTo({
-			url: './selectSite',
-		})
-	}
+        wx.setStorageSync('userrole', res.account_list[0].usertype == 1 ? '业务员' : '经销商');
+        wx.removeStorageSync('userMsg')
+        wx.setStorageSync('userMsg', res.account_list[0])
+        init();
+    } else {
+        wx.redirectTo({
+            url: './selectSite',
+        })
+    }
 }
 
 function init() {
@@ -76,6 +76,18 @@ function init() {
             url: '/pages/tabbar/home/index'
         })
     })
+    _Http.basic({
+        "classname": "sysmanage.develop.optiontype.optiontype",
+        "method": "optiontypeselect",
+        "content": {
+            "typename": "statuscolors"
+        }
+    }).then(res => {
+        if (res.code != '1') return;
+        res.data.forEach(v => {
+            _Http.sColors[v.value] = v.remarks
+        })
+    });
 }
 
 /* 站点数据查询 */

+ 87 - 0
utils/defaultColors.js

@@ -0,0 +1,87 @@
+module.exports = {
+    "是": "#F56C6C",
+    "报废": "#999999",
+    "售出": "#67C23A",
+    "借出": "#e6a23c",
+    "在库": "#3874f6",
+    "未入账": "#F56C6C",
+    "已入账(非贷款)": "#e6a23c",
+    "已入账(系统)": "#67C23A",
+    "已入账(人工)": "#3874f6",
+    "已入账(非贷款)": "#e6a23c",
+    "已入账(系统)": "#67C23A",
+    "已入账(人工)": "#3874f6",
+    "关闭": "#999999",
+    "否": "#999999",
+    "已使用": "#67C23A",
+    "未开票": "#F56C6C",
+    "部分开票": "#e6a23c",
+    "已开票": "#67C23A",
+    "未核销": "#F56C6C",
+    "部分核销": "#e6a23c",
+    "已核销": "#67C23A",
+    "交期确认": "#67C23A",
+    "交期待确认": "#F56C6C",
+    "意向": "#3874f6",
+    "售中": "#e6a23c",
+    "评审通过-已有成品": "rgba(103,194,58,0.5)",
+    "评审通过-暂无成品": "#67C23A",
+    "评审拒绝": "#F56C6C",
+    "评审中": "#e6a23c",
+    "待评审": "#3874f6",
+    "无需评审": "#67C23A",
+    "暂停": "#F56C6C",
+    "代开始": "#3874f6",
+    "待接单": "#999999",
+    "正式": "#67C23A",
+    "历史售后": "#999999",
+    "售后": "#67C23A",
+    "售前": "#3874f6",
+    "已完成": "#67C23A",
+    "待处理": "#F56C6C",
+    "待指派": "#3874f6",
+    "发放": "#67C23A",
+    "收货": "#67C23A",
+    "未使用": "#999999",
+    "已过期": "#999999",
+    "潜在": "#3874f6",
+    "已分配": "#333333",
+    "待分配": "#3874f6",
+    "已审核": "#67C23A",
+    "待审核": "#3874f6",
+    "结束": "#999999",
+    "已读": "#999999",
+    "置顶": "#F56C6C",
+    "发布": "#67C23A",
+    "新建": "#3874f6",
+    "合作中": "#67C23A",
+    "已无效": "#999999",
+    "已转化": "#e6a23c",
+    "跟进中": "#67C23A",
+    "待跟进": "#3874f6",
+    "离职": "#999999",
+    "在职": "#67C23A",
+    "停用": "#999999",
+    "启用": "#67C23A",
+    "进行中": "#67C23A",
+    "已报备": "#67C23A",
+    "下架": "#F56C6C",
+    "上架": "#67C23A",
+    "已下达": "#67C23A",
+    "已截至": "#999999",
+    "开启": "#67C23A",
+    "已提交": "#67C23A",
+    "复核": "#F56C6C",
+    "审核": "#e6a23c",
+    "提交": "#67C23A",
+    "待执行": "#3874f6",
+    "报备中": "#e6a23c",
+    "未报备": "#3874f6",
+    "已结案": "#999999",
+    "已失败": "#F56C6C",
+    "多次成交": "#67C23A",
+    "已成交": "#67C23A",
+    "未成交": "#3874f6",
+    "已终止": "#999999",
+    "暂缓": "#e6a23c"
+}

+ 2 - 1
utils/language.js

@@ -26,7 +26,8 @@ class Language {
 
 	async getLanguagePackage(that, setNavBarTitle) {
 		that.setData({
-			language: this.languagePackage || await this.getLanguages(wx.getStorageSync('languagecode'))
+			language: this.languagePackage || await this.getLanguages(wx.getStorageSync('languagecode')),
+			sColors: getApp().globalData.http.sColors
 		})
 		if (setNavBarTitle) this.setNavBarTitle(setNavBarTitle)
 	}