123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- import {
- ApiModel
- } from './utils/Api';
- import {
- Language
- } from './utils/language';
- App({
- onLaunch(options) {
- console.log("options.query", options.query)
- //小程序跳转进入
- if (options.query.userMsg) {
- let userMsg = JSON.parse(options.query.userMsg)
- wx.removeStorageSync('userMsg');
- wx.setStorageSync('userMsg', userMsg);
- console.log("userMsg", wx.getStorageSync('userMsg'))
- wx.removeStorageSync('auth');
- wx.removeStorageSync('userauth');
- wx.setStorageSync('auth', JSON.parse(options.query.auth));
- wx.removeStorageSync('userrole');
- wx.removeStorageSync('templetList');
- wx.removeStorageSync('siteP');
- wx.setStorageSync('userrole', userMsg.usertype == 1 ? '业务员' : '经销商');
- wx.setStorageSync('siteP', JSON.parse(options.query.site));
- wx.setStorageSync('templetList', JSON.parse(options.query.templetList));
- wx.removeStorageSync('languagecode');
- wx.setStorageSync('languagecode', options.query.languagecode);
- //获取用户权限
- this.globalData.http.basic({
- "classname": "sysmanage.develop.userauth.userauth",
- "method": "query_userauth",
- content: {
- nocache: true
- }
- }).then(res => {
- console.log("跳转进入查询权限", res)
- if (res.code != '1') return wx.showToast({
- title: '权限查询失败,请稍后再试',
- icon: "none"
- })
- wx.setStorageSync('userauth', res.data);
- });
- _Http.basic({
- "classname": "sysmanage.develop.optiontype.optiontype",
- "method": "optiontypeselect",
- "content": {
- "typename": "statuscolors"
- }
- }).then(res => {
- if (res.code != '1') return;
- res.data.forEach(v => {
- this.globalData.sColors[v.value] = v.remarks
- })
- });
- }
- if (!wx.getStorageSync('languagecode')) wx.setStorageSync('languagecode', 'ZH');
- this.globalData.Language.getLanguages(wx.getStorageSync('languagecode'));
- },
- initSocket() {
- let that = this;
- this.globalData.SocketTask = wx.connectSocket({
- url: (this.globalData.http.baseUrl + '/yos/webSocket/').replace("https", "wss").replace("http", "ws") + wx.getStorageSync('userMsg').token,
- complete: (res) => {
- console.log(res)
- }
- })
- this.globalData.SocketTask.onOpen(function (res) {
- that.globalData.socketEstablish = true;
- })
- this.globalData.SocketTask.onMessage(function (res) {
- that.globalData.socket.callback(res)
- })
- this.globalData.SocketTask.onError(function (res) {
- that.globalData.socketEstablish = false;
- })
- this.globalData.SocketTask.onClose(function (res) {
- that.globalData.socketEstablish = false;
- })
- },
- globalData: {
- sColors: {
- "ACTIVE": "#67C23A",
- "上架": "#67C23A",
- "下架": "#F56C6C",
- "交期待确认": "#F56C6C",
- "交期确认": "#3874f6",
- "代开始": "#3874f6",
- "借出": "#e6a23c",
- "停用": "#999999",
- "关闭": "#999999",
- "历史售后": "#999999",
- "发布": "#67C23A",
- "发放": "#67C23A",
- "合作中": "#67C23A",
- "否": "#999999",
- "启用": "#67C23A",
- "售中": "#e6a23c",
- "售出": "#67C23A",
- "售前": "#3874f6",
- "售后": "#67C23A",
- "在库": "#3874f6",
- "在职": "#67C23A",
- "复核": "#F56C6C",
- "多次成交": "#67C23A",
- "审核": "#e6a23c",
- "已下达": "#67C23A",
- "已使用": "#67C23A",
- "已入账(人工)": "#3874f6",
- "已入账(系统)": "#67C23A",
- "已入账(非贷款)": "#e6a23c",
- "已入账(人工)": "#3874f6",
- "已入账(系统)": "#67C23A",
- "已入账(非贷款)": "#e6a23c",
- "已分配": "#333333",
- "已备货": "#3874f6",
- "已失败": "#F56C6C",
- "已完成": "#e6a23c",
- "已审核": "#67C23A",
- "已开票": "#67C23A",
- "已成交": "#67C23A",
- "已截止": "#999999",
- "已截至": "#999999",
- "已报备": "#67C23A",
- "已提交": "#67C23A",
- "已无效": "#999999",
- "已核销": "#67C23A",
- "已确认(非货款)": "#e6a23c",
- "已终止": "#999999",
- "已结案": "#999999",
- "已读": "#999999",
- "已转化": "#e6a23c",
- "已过期": "#999999",
- "开启": "#67C23A",
- "待分配": "#3874f6",
- "待处理": "#F56C6C",
- "待审核": "#3874f6",
- "待执行": "#3874f6",
- "待指派": "#3874f6",
- "待接单": "#999999",
- "待评审": "#3874f6",
- "待跟进": "#3874f6",
- "意向": "#3874f6",
- "报备中": "#e6a23c",
- "报废": "#999999",
- "提交": "#67C23A",
- "收货": "#67C23A",
- "新建": "#3874f6",
- "无需评审": "#67C23A",
- "是": "#F56C6C",
- "暂停": "#F56C6C",
- "暂缓": "#e6a23c",
- "未使用": "#999999",
- "未入账": "#F56C6C",
- "未备货": "#F56C6C",
- "未开票": "#F56C6C",
- "未成交": "#3874f6",
- "未报备": "#3874f6",
- "未核销": "#F56C6C",
- "正式": "#67C23A",
- "潜在": "#3874f6",
- "禁用": "#999999",
- "离职": "#999999",
- "结束": "#999999",
- "置顶": "#F56C6C",
- "评审中": "#e6a23c",
- "评审拒绝": "#F56C6C",
- "评审通过-已有成品": "rgba(103,194,58,0.5)",
- "评审通过-暂无成品": "#67C23A",
- "跟进中": "#67C23A",
- "进行中": "#67C23A",
- "部分备货": "#67C23A",
- "部分开票": "#e6a23c",
- "部分核销": "#e6a23c",
- "预提交": "#e6a23c"
- },
- http: new ApiModel, //挂载接口文件
- Language: new Language(), //语言包
- queryPer: require("./utils/queryPermissions"), //权限查询
- handleSelect: null, //处理选择结果 函数
- socketEstablish: false, //是否已经建立socket
- SocketTask: '', // Socket方法
- socketCallback: null, // Socket回调
- }
- })
|