Browse Source

消息跳转

xiaohaizhao 1 year ago
parent
commit
bbfa24419c

+ 2 - 1
app.js

@@ -30,7 +30,8 @@ App({
                 })
                 wx.setStorageSync('userauth', res.data);
             });
-        }
+        };
+        wx.setStorageSync('appid', 'wxc1b6ae925ac1d06a');
     },
     initSocket() {
         let that = this;

+ 487 - 455
pages/tabbar/home/index.js

@@ -1,460 +1,492 @@
 let _Http = getApp().globalData.http,
-    DataCarousel = null;
+	DataCarousel = null;
 Page({
-    data: {
-        appid: "wxc1b6ae925ac1d06a",
-        bannerList: [], //banner列表
-        gridList: [],
-        notice: "",
-        msgCount: 1,
-        msgList: [], //消息列表
-    },
-    onLoad(options) {
-        this.setData({ //获取胶囊位置信息
-            capsule: wx.getMenuButtonBoundingClientRect()
-        })
-        this.refreshData() //更新权限等信息
-        this.getTabBar().unReadMessageCount(); //更新信息数量
-    },
-    /* 更新站点信息 */
-    refreshData() {
-        this.setData({
-            user: wx.getStorageSync('userMsg')
-        })
-        if (wx.getStorageSync('userauth').length != 0) {
-            let authList = {},
-                entrance = [{
-                    label: "通用",
-                    icon: "work-tongyong",
-                    appid: "wx197f219a82a89d7b",
-                    list: getapps()
-                }, {
-                    label: "E-订单",
-                    appid: "wxc1b6ae925ac1d06a",
-                    icon: "work-E-dingdan",
-                    list: getedd()
-                }, {
-                    label: "E-服务",
-                    appid: "wxc1b6ae925ac1d06a",
-                    icon: "work-E-fuwu",
-                    list: geteservice()
-                }, {
-                    label: "营销工具",
-                    icon: "work-yingxiaogongju",
-                    appid: "wx197f219a82a89d7b",
-                    list: gettool()
-                }, {
-                    label: "CRM",
-                    appid: "wx197f219a82a89d7b",
-                    icon: "work-CRM",
-                    list: getcrm()
-                }];
-            //通用
-            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"
-                }, {
-                    name: "工作汇报",
-                    path: "/packageA/report/index",
-                    icon: "work-gongzuohuibao"
-                }];
-                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])
-                            }
-                        }
-                    })
-                });
+	data: {
+		appid: wx.getStorageSync('appid'),
+		bannerList: [], //banner列表
+		gridList: [],
+		notice: "",
+		msgCount: 1,
+		msgList: [], //消息列表
+	},
+	onLoad(options) {
+		this.setData({ //获取胶囊位置信息
+			capsule: wx.getMenuButtonBoundingClientRect()
+		})
+		this.refreshData() //更新权限等信息
+		this.getTabBar().unReadMessageCount(); //更新信息数量
+	},
+	/* 更新站点信息 */
+	refreshData() {
+		this.setData({
+			user: wx.getStorageSync('userMsg')
+		})
+		if (wx.getStorageSync('userauth').length != 0) {
+			let authList = {},
+				entrance = [{
+					label: "通用",
+					icon: "work-tongyong",
+					appid: "wx197f219a82a89d7b",
+					list: getapps()
+				}, {
+					label: "E-订单",
+					appid: "wxc1b6ae925ac1d06a",
+					icon: "work-E-dingdan",
+					list: getedd()
+				}, {
+					label: "E-服务",
+					appid: "wxc1b6ae925ac1d06a",
+					icon: "work-E-fuwu",
+					list: geteservice()
+				}, {
+					label: "营销工具",
+					icon: "work-yingxiaogongju",
+					appid: "wx197f219a82a89d7b",
+					list: gettool()
+				}, {
+					label: "CRM",
+					appid: "wx197f219a82a89d7b",
+					icon: "work-CRM",
+					list: getcrm()
+				}];
+			//通用
+			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"
+				}, {
+					name: "工作汇报",
+					path: "/packageA/report/index",
+					icon: "work-gongzuohuibao"
+				}];
+				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",
+					objectname: "sat_notice"
+				}, {
+					name: "营销物料",
+					path: "/pages/mediaLibrary/index",
+					icon: "work-a-shouyejingangquyingxiaowuliao",
+					objectname: "sys_attachment"
+				}, {
+					name: "推广素材",
+					path: "/pages/promotional/index",
+					icon: "work-a-shouyejingangqutuiguangsucai",
+					objectname: "sat_sharematerial"
+				}, {
+					name: "商学院",
+					path: "/pages/college/index",
+					icon: "work-a-shangxueyuanxuexi",
+					objectname: "sat_courseware"
+				}, {
+					name: "提报",
+					path: "/pages/submission/index",
+					icon: "work-a-tibaoguanlitibao",
+					objectname: "sat_submiteditmodel"
+				}];
+				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)
-            }
-            //营销工具
-            function gettool() {
-                const paths = [{
-                    name: "通告",
-                    path: "/pages/annunciate/index",
-                    icon: "work-a-shouyejingangqutonggao"
-                }, {
-                    name: "营销物料",
-                    path: "/pages/mediaLibrary/index",
-                    icon: "work-a-shouyejingangquyingxiaowuliao"
-                }, {
-                    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",
+					objectname: "sat_campaign"
+				}, {
+					name: "公海线索",
+					path: "/packageA/publicClue/index",
+					icon: "work-xiaochengxu_xiaoshoumubiao",
+					objectname: "sat_orderclue"
+				}, {
+					name: "销售线索",
+					path: "/packageA/saleClue/index",
+					icon: "work-xiaoshouxiansuo",
+					objectname: "sat_orderclue"
+				}, {
+					name: "公海客户",
+					path: "/packageA/publicCustomer/index",
+					icon: "work-gonghaikehu",
+					objectname: "sa_customers"
+				}, {
+					name: "我的客户",
+					path: "/packageA/setclient/index",
+					icon: "work-kehu",
+					objectname: "sa_customers"
+				}, {
+					name: "项目商机",
+					path: "/packageA/project/index",
+					icon: "work-xiangmushangji",
+					objectname: "sa_project"
+				}, {
+					name: "报价单",
+					path: "/packageA/offers/index",
+					icon: "work-xiangmubaojia",
+					objectname: "sa_quotedprice"
+				}, {
+					name: "竞争对手",
+					path: "/packageA/opponent/index",
+					icon: "work-jingzhengduishou",
+					objectname: "sa_competitor"
+				}, {
+					name: "合同",
+					path: "/packageA/contract/index",
+					icon: "work-hetong",
+					objectname: "sa_contract"
+				}, {
+					name: "销售目标",
+					path: "/packageA/target/index",
+					icon: "work-xiaochengxu_xiaoshoumubiao",
+					objectname: "sa_salestarget"
+				}, {
+					name: "销售预测",
+					path: "/packageA/salesForecasting/index",
+					icon: "work-xiaochengxu_xiaoshouyuce",
+					objectname: "sa_salesforecastbill"
+				}];
+				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",
+					objectname: "sa_itemgroup"
+				}, {
+					name: "销售订单",
+					path: "/packageA/orderForm/index",
+					icon: "work-dingdan",
+					objectname: "sa_order"
+				}, {
+					name: "收货",
+					path: "/packageA/shipment/index",
+					icon: "work-shouhuo",
+					objectname: "sa_logistics"
+				}, {
+					name: "业绩目标",
+					path: "/packageA/target/index",
+					icon: "work-yejimubiao"
+				}, {
+					name: "账户",
+					path: "/packageA/account/index",
+					icon: "work-zhanghu",
+					objectname: "sa_accountbalance"
+				}, {
+					name: "促销活动",
+					path: "/packageA/activity/index",
+					icon: "work-cuxiaohuodong",
+					objectname: "sa_promotion"
+				}, {
+					name: "工具查询",
+					path: "/packageA/tool/index",
+					icon: "work-gongjuchaxun"
+				}, {
+					name: "购物车",
+					path: "/packageA/shopping/index",
+					icon: "work-gouwuche"
+				}, {
+					name: "开票",
+					path: "/packageA/invoice/index",
+					icon: "work-kaipiao",
+					objectname: "sa_invoiceapplyid"
+				}, {
+					name: "打款凭证",
+					path: "/packageA/remitVoucher/index",
+					icon: "work-dakuanpingzheng"
+				}, {
+					name: "工具借用",
+					path: "/packageA/borrow/index",
+					icon: "work-shujuchaxun",
+					objectname: "sa_order"
+				}, {
+					name: "工具归还",
+					path: "/packageA/toolBill/index",
+					icon: "work-shujuchaxun",
+					objectname: "sa_order"
+				}, {
+					name: "退返申请",
+					path: "/packageA/returnOne/index",
+					icon: "work-shujuchaxun",
+					objectname: "sa_aftersalesmag"
+				}, {
+					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'))
+			})
+			/* 获取首页banner */
+			let banner = wx.getStorageSync('banner_list').find(v => v.location == "index_top");
+			if (banner) this.setData({
+				bannerList: banner.ads
+			})
+			//用于消息跳转对照权限以及路径
+			wx.setStorageSync('authComparison', entrance.map(v => {
+				v = v.list.map(s => {
+					s.appid = v.appid;
+					return s
+				})
+				return v
+			}).flat())
+		} else {
+			setTimeout(this.refreshData, 10);
+			return;
+		}
 
-                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/returnOne/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'))
-            })
-            /* 获取首页banner */
-            let banner = wx.getStorageSync('banner_list').find(v => v.location == "index_top");
-            if (banner) this.setData({
-                bannerList: banner.ads
-            })
-        } else {
-            setTimeout(this.refreshData, 10);
-            return;
-        }
-
-    },
-    /* 获取最新信息 */
-    queryMessage(i = 0) {
-        _Http.basic({
-            "classname": "system.message.Message",
-            "method": "queryMessage",
-            content: {
-                nocache: true,
-                pageNumber: 1,
-                pageSize: 5,
-                pageTotal: 1,
-                type: "",
-                where: {}
-            },
-        }, false).then(res => {
-            if (res.msg != '成功') return (i <= 5) ? this.queryMessage(i + 1) : wx.showToast({
-                title: res.msg,
-                icon: "none"
-            })
-            this.setData({
-                msgList: res.data,
-                notice: res.data[0]
-            })
-            if (this.data.msgList.length > 2) this.startDataCarousel();
-        })
-    },
-    /* 开启消息轮播 */
-    startDataCarousel() {
-        clearInterval(DataCarousel);
-        DataCarousel = setInterval(() => {
-            let count = this.data.msgCount < this.data.msgList.length ? this.data.msgCount : 0;
-            this.setData({
-                msgCount: count + 1,
-                notice: this.data.msgList[count]
-            })
-        }, 5000)
-    },
-    /* 去消息详情 */
-    toMsg(e) {
-        const {
-            item
-        } = e.currentTarget.dataset;
-        wx.navigateTo({
-            url: '/pages/tabbar/message/details?id=' + item.messageid,
-        })
-    },
-    /* banner */
-    bannerClick(e) {
-        const {
-            item
-        } = e.currentTarget.dataset,
-            hyperlink = item.hyperlink.split(":");
-        if (hyperlink[0] == 'path') wx.navigateTo({
-            url: hyperlink[1]
-        })
-    },
-    onShow() {
-        this.getTabBar().init();
-        if (this.data.msgList.length > 2) this.startDataCarousel();
-        this.queryMessage(0); //更新最新消息
-    },
-    onHide() {
-        clearInterval(DataCarousel);
-    },
-    onReady() {
-        // this.setListHeight();
-    },
-    /* 设置页面高度 */
-    setListHeight() {
-        this.selectComponent("#ListBox").setHeight(".grld-title", this);
-    },
-    onShareAppMessage() {}
+	},
+	/* 获取最新信息 */
+	queryMessage(i = 0) {
+		_Http.basic({
+			"classname": "system.message.Message",
+			"method": "queryMessage",
+			content: {
+				nocache: true,
+				pageNumber: 1,
+				pageSize: 5,
+				pageTotal: 1,
+				type: "",
+				where: {}
+			},
+		}, false).then(res => {
+			if (res.msg != '成功') return (i <= 5) ? this.queryMessage(i + 1) : wx.showToast({
+				title: res.msg,
+				icon: "none"
+			})
+			this.setData({
+				msgList: res.data,
+				notice: res.data[0]
+			})
+			if (this.data.msgList.length > 2) this.startDataCarousel();
+		})
+	},
+	/* 开启消息轮播 */
+	startDataCarousel() {
+		clearInterval(DataCarousel);
+		DataCarousel = setInterval(() => {
+			let count = this.data.msgCount < this.data.msgList.length ? this.data.msgCount : 0;
+			this.setData({
+				msgCount: count + 1,
+				notice: this.data.msgList[count]
+			})
+		}, 5000)
+	},
+	/* 去消息详情 */
+	toMsg(e) {
+		const {
+			item
+		} = e.currentTarget.dataset;
+		wx.navigateTo({
+			url: '/pages/tabbar/message/details?id=' + item.messageid,
+		})
+	},
+	/* banner */
+	bannerClick(e) {
+		const {
+			item
+		} = e.currentTarget.dataset,
+			hyperlink = item.hyperlink.split(":");
+		if (hyperlink[0] == 'path') wx.navigateTo({
+			url: hyperlink[1]
+		})
+	},
+	onShow() {
+		this.getTabBar().init();
+		if (this.data.msgList.length > 2) this.startDataCarousel();
+		this.queryMessage(0); //更新最新消息
+	},
+	onHide() {
+		clearInterval(DataCarousel);
+	},
+	onReady() {
+		// this.setListHeight();
+	},
+	/* 设置页面高度 */
+	setListHeight() {
+		this.selectComponent("#ListBox").setHeight(".grld-title", this);
+	},
+	onShareAppMessage() {}
 })

+ 117 - 83
pages/tabbar/message/details.js

@@ -1,87 +1,121 @@
 const _Http = getApp().globalData.http;
 Page({
-    data: {
-        detailsData: []
-    },
-    onLoad(options) {
-        _Http.basic({
-            "classname": "system.message.Message",
-            "method": "readMessage",
-            "content": {
-                "messageid": options.id
-            }
-        }).then(res => {
-            if (res.msg != '成功') return wx.showToast({
-                title: res.msg,
-                icon: "none"
-            })
-            this.setData({
-                detailsData: res.data
-            })
-        })
-    },
-    async toDetails() {
-        const {
-            objectname,
-            objectid
-        } = this.data.detailsData;
+	data: {
+		appid: wx.getStorageSync('appid'),
+		detailsData: {}
+	},
+	onLoad(options) {
+		const item = JSON.parse(options.item)
+		if (item.isread == 0) _Http.basic({
+			"classname": "system.message.Message",
+			"method": "readMessage",
+			"content": {
+				"messageid": item.messageid
+			}
+		}).then(res => {
+			console.log("已读消息", res)
 
-        /* const res = await _Http.basic({
-            "classname": "saletool.common.auth",
-            "method": "isAuth",
-            "content": {
-                objectid,
-                objectname
-            }
-        });
-        if (res.msg != '成功' || res.data[0].isAuth != 1) return wx.showToast({
-            title: '暂无权限进入应用',
-            icon: "none"
-        }); */
-
-        switch (objectname) {
-            case 'sat_courseware':
-                wx.navigateTo({
-                    url: `/pages/college/index`,
-                })
-                break;
-            case 'sat_sharematerial':
-                wx.navigateTo({
-                    url: `/pages/promotional/index`,
-                })
-                break;
-            case 'sat_notice':
-                wx.navigateTo({
-                    url: `/pages/annunciate/index`,
-                })
-                break;
-            case 'sat_submitedit':
-                wx.navigateTo({
-                    url: `/pages/submission/index`,
-                })
-                break;
-            case 'sat_orderclue':
-                wx.navigateTo({
-                    url: `/packageA/saleClue/index`,
-                })
-                break;
-            case 'sys_attachment':
-                let item = {
-                    attachmentid: objectid,
-                    document: '营销物料'
-                }
-                wx.navigateTo({
-                    url: '/pages/tabbar/smartStore/folder?item=' + JSON.stringify(item),
-                })
-                break;
-            default:
-                console.log(objectname)
-                wx.showToast({
-                    title: '当前应用暂不支持跳转',
-                    icon: "none"
-                })
-                break;
-        }
-    },
-    onShareAppMessage(res) { }
+			
+		})
+		//判断具体消息归属
+		switch (item.objectname) {
+			case "sa_customers":
+				//客户
+				item.name = '';
+				this.saCustomer(item.objectid);
+				break;
+			case "sat_orderclue":
+				item.name = '';
+				this.satOrderclue(item.objectid);
+				//线索
+				break;
+			case "sa_order":
+				item.name = '';
+				this.saOrder(item.objectid)
+				// sa_order
+				break;
+		}
+		//修改跳转页面
+		if (item.path) {
+			let arr = item.path.split("/");
+			arr[arr.length - 1] = 'detail';
+			item.path = arr.join("/");
+		}
+		this.setData({
+			detailsData: item,
+			auth: JSON.stringify(wx.getStorageSync('auth')),
+			userMsg: JSON.stringify(wx.getStorageSync('userMsg')),
+			site: JSON.stringify(wx.getStorageSync('siteP'))
+		})
+	},
+	saOrder(sa_orderid) {
+		_Http.basic({
+			"id": 20221108151302,
+			"content": {
+				nocache: true,
+				sa_orderid
+			}
+		}).then(res => {
+			console.log("订单", res)
+			if (res.msg != '成功') return wx.showToast({
+				title: res.data,
+				icon: "none"
+			});
+			let path = '';
+			switch (res.data.type) {
+				case '工具借用单':
+					path = '/packageA/borrow/detail'
+					break;
+				case '借用归还单':
+					path = '/packageA/toolBill/detail'
+					break;
+				default:
+					path = '/packageA/orderForm/detail'
+					break;
+			}
+			this.setData({
+				"detailsData.name": res.data.type,
+				"detailsData.path": path
+			})
+		});
+	},
+	satOrderclue(sat_orderclueid) {
+		_Http.basic({
+			"classname": "saletool.orderclue.web.orderclue",
+			"method": "selectDetail",
+			"version": 1,
+			"content": {
+				"nocache": true,
+				sat_orderclueid
+			},
+		}).then(res => {
+			console.log("线索详情", res)
+			if (res.msg != '成功') return wx.showToast({
+				title: res.data,
+				icon: "none"
+			});
+			this.setData({
+				"detailsData.name": res.data.isprivate ? '销售线索' : '公海线索',
+				"detailsData.path": res.data.isprivate ? '/packageA/saleClue/detail' : '/packageA/publicClue/detail',
+			})
+		});
+	},
+	saCustomer(sa_customersid) {
+		_Http.basic({
+			"id": 20221012164302,
+			"content": {
+				sa_customersid
+			},
+		}).then(res => {
+			console.log("客户详情", res)
+			if (res.msg != '成功') return wx.showToast({
+				title: res.data,
+				icon: "none"
+			});
+			this.setData({
+				"detailsData.name": res.data.ispublic ? '公海客户' : '我的客户',
+				"detailsData.path": res.data.ispublic ? '/packageA/publicCustomer/detail' : '/packageA/setclient/detail',
+			})
+		});
+	}
 })

+ 9 - 3
pages/tabbar/message/details.scss

@@ -27,9 +27,15 @@
         font-family: PingFang SC-Regular, PingFang SC;
         color: #666666;
 
-        >text {
-            display: inline-block;
-            width: 200rpx;
+
+    }
+
+    .nav {
+        margin-top: 20rpx;
+        font-size: 28rpx;
+        color: #666666;
+
+        .text {
             font-size: 28rpx;
             font-family: PingFang SC-Regular, PingFang SC;
             color: #3874F6;

+ 4 - 4
pages/tabbar/message/details.wxml

@@ -2,7 +2,7 @@
     <view class="title multi-line">{{detailsData.title}}</view>
     <view class="time">{{detailsData.readdate}}</view>
     <view class="content multi-line">{{detailsData.message}}</view>
-  <!--   <view class="content" wx:if="{{detailsData.type=='应用'}}" bindtap="toDetails">请前往 <text>{{type.query(detailsData.objectname)}} >
-        </text></view> -->
-</view>
-<wxs module="type" src='./modules/determineType.wxs' />
+    <navigator wx:if="{{detailsData.name}}" class="nav" target='{{detailsData.appid!=appid?"miniProgram":"self"}}' app-id='{{detailsData.appid}}' path="{{detailsData.path+'?auth='+auth+'&userMsg='+userMsg+'&site='+site+'&id='+detailsData.objectid}}" url="{{detailsData.path+'?id='+detailsData.objectid}}" open-type="{{detailsData.openType||'navigate'}}">
+        立即前往“<text class="work {{detailsData.icon}}" style="color: {{detailsData.color}};" /> {{detailsData.name}}”<text class="text">查看 ></text>
+    </navigator>
+</view>

+ 34 - 38
pages/tabbar/message/index.js

@@ -1,12 +1,7 @@
-const getHeight = require("../../../utils/GetRheRemainingHeight"),
-    _Http = getApp().globalData.http;
+const _Http = getApp().globalData.http;
 
 Page({
-    /**
-     * 页面的初始数据
-     */
     data: {
-        height: 0,
         list: [],
         content: {
             nocache: true,
@@ -14,15 +9,10 @@ Page({
             pageSize: 20,
             pageTotal: 1,
             type: "应用",
-            where:{}
+            where: {}
         },
         total: 0,
     },
-
-    /**
-     * 生命周期函数--监听页面加载
-     */
-    onLoad(options) {},
     //切换tab选项
     tabChange({
         detail
@@ -32,27 +22,9 @@ Page({
         })
         this.getlist(true);
     },
-    
-    /**
-     * 生命周期函数--监听页面初次渲染完成
-     */
     onReady() {
-        getHeight.getHeight("#tabs", this).then(res => {
-            this.setData({
-                height: res
-            })
-        })
-    },
-
-    toDetails(e) {
-        const {
-            item
-        } = e.currentTarget.dataset;
-        wx.navigateTo({
-            url: './details?id=' + item.messageid,
-				})
+        this.selectComponent("#ListBox").setHeight("#tabs", this);
     },
-
     getlist(init = false) {
         if (init.detail != undefined) init = init.detail;
         if (init) this.setData({
@@ -69,6 +41,27 @@ Page({
                 title: res.msg,
                 icon: "none"
             })
+            const authComparison = wx.getStorageSync('authComparison');
+            res.data = res.data.map(v => {
+                let data = authComparison.find(s => (s.objectname || "") == v.objectname);
+                if (data) {
+                    switch (data.objectname) {
+                        case "sa_customers":
+                            data.name = '客户'
+                            //客户
+                            break;
+                        case "sat_orderclue":
+                            data.name = '线索'
+                            //线索
+                            break;
+                        case "sa_order":
+                            data.name = '订单'
+                            break;
+                    }
+                    return Object.assign(v, data)
+                }
+                return v
+            })
             this.setData({
                 total: res.total,
                 list: (res.pageNumber == 1) ? res.data : this.data.list.concat(res.data),
@@ -77,14 +70,17 @@ Page({
             })
         })
     },
-
-    /**
-     * 生命周期函数--监听页面显示
-     */
+    toDetails(e) {
+        const {
+            item
+        } = e.currentTarget.dataset;
+        wx.navigateTo({
+            url: './details?item=' + JSON.stringify(item),
+        })
+    },
     onShow() {
         this.getlist(true);
         this.getTabBar().init();
-        this.getTabBar().unReadMessageCount();//更新信息数量
-    },
-    onShareAppMessage() {}
+        this.getTabBar().unReadMessageCount(); //更新信息数量
+    }
 })

+ 1 - 3
pages/tabbar/message/index.json

@@ -1,6 +1,4 @@
 {
-    "usingComponents": {
-        "My_tabs": "./modules/tabs"
-    },
+    "usingComponents": { },
     "navigationBarTitleText": "信息"
 }

+ 4 - 8
pages/tabbar/message/index.wxml

@@ -1,21 +1,17 @@
-<!-- <My_tabs id='tabs' bind:onChange='tabChange' /> -->
 <van-tabs id='tabs' active="{{ content.type }}" color='var(--assist)' tab-active-class='tab-active-class' bind:change="tabChange">
     <van-tab title="应用消息" name='应用' />
     <van-tab title="系统消息" name='系统' />
 </van-tabs>
-
-<Yl_ListBox id="ListBox" height="{{height}}" bind:getlist='getlist'>
+<Yl_ListBox id="ListBox" bind:getlist='getlist'>
     <view class="unread">总共{{total}}条</view>
     <navigator url="#" class='list' wx:for="{{list}}" data-item="{{item}}" bindtap="toDetails">
         <view class="title line-1">{{item.title}}</view>
         <view class="content line-1">{{item.message}}</view>
         <view class="time">
-            <van-tag class="tag" wx:if="{{item.objectname}}" plain type="primary">{{type.query(item.objectname)}}</van-tag>{{item.createdate}}
+            <van-tag wx:if="{{item.name}}" class="tag" plain type="primary">{{item.name}}</van-tag>{{item.createdate}}
         </view>
         <view wx:if="{{item.isread=='0'}}" class="unread-item" />
     </navigator>
-    <Yl_Empty wx:if="{{!list.length}}" />
+    <My_empty wx:if="{{!list.length}}" />
     <view style="height: 180rpx;" />
-</Yl_ListBox>
-
-<wxs module="type" src='./modules/determineType.wxs' />
+</Yl_ListBox>

+ 0 - 27
pages/tabbar/message/modules/determineType.wxs

@@ -1,27 +0,0 @@
-module.exports.query = function (name) {
-    var showName = '';
-    switch (name) {
-        case 'sat_courseware':
-            showName = '商学院';
-            break;
-        case 'sat_sharematerial':
-            showName = '推广素材';
-            break;
-        case 'sat_notice':
-            showName = '通告';
-            break;
-        case 'sat_submitedit':
-            showName = '提报';
-            break;
-        case 'sat_orderclue':
-            showName = '销售线索';
-            break;
-        case 'sys_attachment':
-            showName = '营销物料';
-            break;
-        default:
-            showName = '其他应用';
-            break;
-    }
-    return showName;
-}

+ 0 - 68
pages/tabbar/message/modules/tabs.js

@@ -1,68 +0,0 @@
-// pages/tabbar/message/modules/tabs.js
-Component({
-    /**
-     * 组件的属性列表
-     */
-    properties: {
-        list: {
-            type: Array,
-            value: [{
-                label: '系统消息',
-                nubmer: "9"
-            }, {
-                label: '应用消息',
-                nubmer: "15"
-            }]
-        },
-        onChange: {
-            type: Function
-        }
-    },
-
-    lifetimes: {
-        ready() {
-            this.setBorBotLeft()
-        }
-    },
-
-    /**
-     * 组件的初始数据
-     */
-    data: {
-        animationData: {}, //横线平移动画
-        acIndex: 0,
-    },
-
-    /**
-     * 组件的方法列表
-     */
-    methods: {
-        /* 改变选中 */
-        changeTab(e) {
-            if (this.data.acIndex == e.currentTarget.dataset.index) return;
-            this.setData({
-                acIndex: e.currentTarget.dataset.index
-            })
-            this.triggerEvent("onChange", e.currentTarget.dataset.item)
-            this.setBorBotLeft()
-        },
-        //更改横线位置
-        setBorBotLeft() {
-            let animation = wx.createAnimation({
-                duration: 1000,
-                timingFunction: 'ease',
-            })
-            let that = this;
-            let query = wx.createSelectorQuery().in(this)
-            query.select('.acTitle').boundingClientRect();
-            query.exec(function (res) {
-                animation.translate(res[0].left).step({
-                    duration: 300
-                })
-                that.setData({
-                    animationData: animation.export()
-                })
-            })
-        },
-    }
-})

+ 0 - 4
pages/tabbar/message/modules/tabs.json

@@ -1,4 +0,0 @@
-{
-    "component": true,
-    "usingComponents": {}
-}

+ 0 - 44
pages/tabbar/message/modules/tabs.scss

@@ -1,44 +0,0 @@
-.tabs {
-    position: relative;
-    display: flex;
-    width: 750rpx;
-    height: 90rpx;
-    background: #fff;
-
-    .item {
-        flex: 1;
-        display: flex;
-        align-items: center;
-        justify-content: center;
-
-        .title {
-            position: relative;
-            font-size: 28rpx;
-            font-family: PingFang SC-Bold, PingFang SC;
-            font-weight: bold;
-            color: #999999;
-            letter-spacing: 2rpx;
-
-            .badge {
-                position: absolute;
-                top: 50%;
-                right: -30rpx;
-            }
-        }
-
-        .acTitle {
-            color: var(--assist);
-        }
-
-
-    }
-
-    .my-bor-bot {
-        position: absolute;
-        width: 128rpx;
-        height: 4rpx;
-        background: #0486FE;
-        left: 0;
-        bottom: 0;
-    }
-}

+ 0 - 9
pages/tabbar/message/modules/tabs.wxml

@@ -1,9 +0,0 @@
-<view class="tabs">
-    <view class="item" wx:for="{{list}}" wx:key="{{item.label}}" data-index="{{index}}" data-item="{{item}}" bindtap="changeTab">
-        <view class="title {{index==acIndex?'acTitle':''}}">
-            {{item.label}}
-            <!-- <van-icon wx:if="{{item.nubmer}}" class="badge" info="{{item.nubmer}}" /> -->
-        </view>
-    </view>
-    <view animation="{{animationData}}" class="my-bor-bot" />
-</view>

+ 2 - 2
utils/Http.js

@@ -1,7 +1,7 @@
 class HTTP {
     constructor() {
-        // this.baseUrl = "http://61.164.207.46:8000";
-        this.baseUrl = "https://oms.idcgroup.com.cn:8079";
+        this.baseUrl = "http://61.164.207.46:8000";
+        // this.baseUrl = "https://oms.idcgroup.com.cn:8079";
     }
     request({
         url,