Prechádzať zdrojové kódy

移除消息/websoket

xiaohaizhao 2 rokov pred
rodič
commit
c2ae58c47a

+ 1 - 47
app.js

@@ -3,56 +3,10 @@ import {
 } from './utils/Api';
 
 App({
-    onLaunch(options) {
-        //小程序跳转进入
-        if (options.query.userMsg) {
-            wx.setStorageSync('userMsg', JSON.parse(options.query.userMsg))
-            wx.setStorageSync('auth', JSON.parse(options.query.auth))
-            wx.setStorageSync('siteP', JSON.parse(options.query.site));
-            //获取用户权限 
-            this.globalData.http.basic({
-                "classname": "sysmanage.develop.userauth.userauth",
-                "method": "query_userauth",
-                content: {
-                    nocache: true
-                }
-            }).then(res => {
-                console.log("跳转进入查询权限", res)
-                if (res.msg != '成功') return wx.showToast({
-                    title: '权限查询失败,请稍后再试',
-                    icon: "none"
-                })
-                wx.setStorageSync('userauth', res.data);
-            });
-        }
-    },
-    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;
-        })
-    },
+    onLaunch(options) {},
     globalData: {
         http: new ApiModel, //挂载接口文件
         queryPer: require("./utils/queryPermissions"), //权限查询
         handleSelect: null, //处理选择结果  函数
-        socketEstablish: false, //是否已经建立socket
-        SocketTask: '', // Socket方法
-        socketCallback: null, // Socket回调
     }
 })

+ 0 - 5
app.json

@@ -5,9 +5,7 @@
     "pages/login/retrievePassword",
     "pages/tabbar/home/index",
     "pages/tabbar/mine/index",
-    "pages/tabbar/message/index",
     "pages/tabbar/mine/userMsg/index",
-    "pages/tabbar/message/details",
     "pages/tabbar/mine/changePassword/index",
     "pages/teams/index",
     "pages/teams/addUsers",
@@ -120,9 +118,6 @@
       {
         "pagePath": "pages/tabbar/home/index"
       },
-      {
-        "pagePath": "pages/tabbar/message/index"
-      },
       {
         "pagePath": "pages/tabbar/mine/index"
       }

+ 2 - 37
custom-tab-bar/index.js

@@ -8,14 +8,14 @@ Component({
 				const pages = getCurrentPages(),
 					prevPage = pages[pages.length - 1];
 				if (prevPage.route == 'pages/login/selectSite' || prevPage.route.includes('pages/tabbar/')) this.setData({
-					Permission: ['首页', '信息', '我的']
+					Permission: ['首页', '我的']
 				})
 			}
 		},
 	},
 	data: {
 		active: 'home',
-		Permission: ['首页', '信息', '我的'], //可看模块
+		Permission: ['首页', '我的'], //可看模块
 		tabbarList: [{
 				icon: 'icon-a-biaoqianlanshouyexuanzhong',
 				acicon: 'icon-a-biaoqianlanshouyexuanzhong',
@@ -23,13 +23,6 @@ Component({
 				url: '/pages/tabbar/home/index',
 				name: 'home'
 			},
-			{
-				icon: 'icon-a-biaoqianlanxiaoxi',
-				acicon: 'icon-a-biaoqianlanxiaoxixuanzhong',
-				text: '信息',
-				url: '/pages/tabbar/message/index',
-				name: 'message'
-			},
 			{
 				icon: 'icon-a-biaoqianlanwode',
 				acicon: 'icon-a-biaoqianlanwodexuanzhong',
@@ -56,34 +49,6 @@ Component({
 			this.setData({
 				active: obj.name
 			});
-			//socket
-			if (!getApp().globalData.socketEstablish) getApp().initSocket();
-			if (!getApp().globalData.socketCallback) getApp().globalData.socketCallback = this.unReadMessageCount.bind(this);
-			this.setUnReadMessageCount(getApp().globalData.fcount);
-		},
-		/* 设置未读数量 */
-		setUnReadMessageCount(fcount) {
-			let i = this.data.tabbarList.findIndex(v => v.text == '信息');
-			this.setData({
-				[`tabbarList[${i}].fcount`]: fcount
-			})
 		},
-		/* 更新信息数量 */
-		unReadMessageCount() {
-			_Http.basic({
-				"classname": "system.message.Message",
-				"method": "unReadMessageCount",
-				"content": {
-					nocache: true
-				}
-			}, false).then(res => {
-				console.log('信息数量', res)
-				if (res.msg != '成功') return;
-				let fcount = res.data.fcount > 99 ? '99+' : res.data.fcount;
-				if (res.data.fcount == 0) fcount = "";
-				getApp().globalData.fcount = fcount;
-				this.setUnReadMessageCount(fcount);
-			})
-		}
 	},
 })

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

@@ -35,7 +35,6 @@ function query_userauth() {
         count += 1;
         toHome();
     });
-    if (!getApp().globalData.socketEstablish) getApp().initSocket();
 }
 /* 查询站点数据 */
 function querySite_Parameter() {

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

@@ -14,7 +14,6 @@ Page({
             capsule: wx.getMenuButtonBoundingClientRect()
         })
         this.refreshData() //更新权限等信息
-        this.getTabBar().unReadMessageCount(); //更新信息数量
     },
     /* 更新站点信息 */
     refreshData() {

+ 0 - 1
pages/tabbar/message/index.js

@@ -84,7 +84,6 @@ Page({
     onShow() {
         this.getlist(true);
         this.getTabBar().init();
-        this.getTabBar().unReadMessageCount();//更新信息数量
     },
     onShareAppMessage() {}
 })