zhaoxiaohai 2 years ago
parent
commit
283b6c09e1
4 changed files with 124 additions and 75 deletions
  1. 28 0
      app.js
  2. 92 66
      app.json
  3. 0 1
      components/Yl_Upload/index.scss
  4. 4 8
      utils/Http.js

+ 28 - 0
app.js

@@ -4,9 +4,37 @@ import {
 
 App({
 	onLaunch() {},
+	initSocket() {
+		let that = this;
+		this.globalData.SocketTask = wx.connectSocket({
+			url: 'wss://meida.cnyunl.com/yos/webSocket/' + 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: {
 		http: new ApiModel(), //接口文件
+		queryPer: require("./utils/queryPermissions"), //权限查询
 		handleSelect: null, //处理选择结果  函数
 		savePage: null, //保存页面实例
+		socketEstablish: false, //是否已经建立socket
+		SocketTask: '', // Socket方法
+		socket: { // Socket回调
+			that: null, //保存this
+			callback: function () {}
+		},
 	}
 })

+ 92 - 66
app.json

@@ -1,68 +1,94 @@
 {
-  "pages": [
-    "pages/home/index",
-    "pages/base/index"
-  ],
-  "subpackages": [
-    {
-      "root": "packageA",
-      "pages": [
-        "market/index",
-        "market/detail",
-        "shopping/index",
-        "orderForm/index",
-        "orderForm/detail",
-        "orderForm/add/add",
-        "orderForm/modules/setBrand/index"
-      ]
-    },
-    {
-      "root": "select",
-      "pages": [
-        "product/index",
-        "agent/index",
-        "address/index",
-        "finance/index",
-        "contract/index"
-      ]
-    }
-  ],
-  "preloadRule": {
-    "pages/home/index": {
-      "packages": [
-        "packageA",
-        "select"
-      ],
-      "network": "all"
-    }
-  },
-  "usingComponents": {
-    "Yl_Empty": "/components/Yl_Empty/index",
-    "Yl_Filtrate": "/components/Yl_Filtrate/index",
-    "Yl_FloatingButton": "/components/Yl_FloatingButton/index",
-    "Yl_FunTabs": "/components/Yl_FunTabs/index",
-    "Yl_HeadNav": "/components/Yl_HeadNav/index",
-    "Yl_ListBox": "/components/Yl_ListBox/index",
-    "Yl_Tabbar": "/components/Yl_Tabbar/index",
-    "Yl_Field": "/components/Yl_Field/index",
-    "van-button": "@vant/weapp/button/index",
-    "van-cell": "@vant/weapp/cell/index",
-    "van-action-sheet": "@vant/weapp/action-sheet/index",
-    "van-popup": "@vant/weapp/popup/index",
-    "van-checkbox": "@vant/weapp/checkbox/index",
-    "van-checkbox-group": "@vant/weapp/checkbox-group/index",
-    "van-image": "@vant/weapp/image/index",
-    "van-loading": "@vant/weapp/loading/index",
-    "van-icon": "@vant/weapp/icon/index",
-    "van-tab": "@vant/weapp/tab/index",
-    "van-tabs": "@vant/weapp/tabs/index",
-    "van-search": "@vant/weapp/search/index"
-  },
-  "window": {
-    "backgroundTextStyle": "light",
-    "navigationBarBackgroundColor": "#085CDF",
-    "navigationBarTitleText": "E-订单",
-    "navigationBarTextStyle": "white"
-  },
-  "sitemapLocation": "sitemap.json"
+	"pages": [
+		"pages/login/phone",
+		"pages/login/selectSite",
+		"pages/login/retrievePassword",
+		"pages/home/index",
+		"pages/base/index",
+		"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"
+	],
+	"subpackages": [
+		{
+			"root": "packageA",
+			"pages": [
+				"market/index",
+				"market/detail",
+				"shopping/index",
+				"orderForm/index",
+				"orderForm/detail",
+				"orderForm/add/add",
+				"orderForm/modules/setBrand/index"
+			]
+		},
+		{
+			"root": "select",
+			"pages": [
+				"product/index",
+				"agent/index",
+				"address/index",
+				"finance/index",
+				"contract/index"
+			]
+		}
+	],
+	"preloadRule": {
+		"pages/home/index": {
+			"packages": [
+				"packageA",
+				"select"
+			],
+			"network": "all"
+		}
+	},
+	"usingComponents": {
+		"Yl_Empty": "/components/Yl_Empty/index",
+		"Yl_Filtrate": "/components/Yl_Filtrate/index",
+		"Yl_FloatingButton": "/components/Yl_FloatingButton/index",
+		"Yl_FunTabs": "/components/Yl_FunTabs/index",
+		"Yl_HeadNav": "/components/Yl_HeadNav/index",
+		"Yl_ListBox": "/components/Yl_ListBox/index",
+		"Yl_Tabbar": "/components/Yl_Tabbar/index",
+		"Yl_Field": "/components/Yl_Field/index",
+		"van-button": "@vant/weapp/button/index",
+		"van-cell": "@vant/weapp/cell/index",
+		"van-action-sheet": "@vant/weapp/action-sheet/index",
+		"van-popup": "@vant/weapp/popup/index",
+		"van-checkbox": "@vant/weapp/checkbox/index",
+		"van-checkbox-group": "@vant/weapp/checkbox-group/index",
+		"van-image": "@vant/weapp/image/index",
+		"van-loading": "@vant/weapp/loading/index",
+		"van-icon": "@vant/weapp/icon/index",
+		"van-tab": "@vant/weapp/tab/index",
+		"van-tabs": "@vant/weapp/tabs/index",
+		"van-search": "@vant/weapp/search/index"
+	},
+	"tabBar": {
+		"custom": true,
+		"color": "#000000",
+		"selectedColor": "#000000",
+		"backgroundColor": "#000000",
+		"list": [
+			{
+				"pagePath": "pages/tabbar/home/index"
+			},
+			{
+				"pagePath": "pages/tabbar/message/index"
+			},
+			{
+				"pagePath": "pages/tabbar/mine/index"
+			}
+		]
+	},
+	"window": {
+		"backgroundTextStyle": "light",
+		"navigationBarBackgroundColor": "#085CDF",
+		"navigationBarTitleText": "E-订单",
+		"navigationBarTextStyle": "white"
+	},
+	"sitemapLocation": "sitemap.json"
 }

+ 0 - 1
components/Yl_Upload/index.scss

@@ -1 +0,0 @@
-/* components/My_upload/index.wxss */

+ 4 - 8
utils/Http.js

@@ -1,6 +1,5 @@
 // const baseUrl = "https://meida.cnyunl.com/yos/rest/index";
 const baseUrl = "http://61.164.207.46:8000/yos/rest/index";
-let count = null;
 class HTTP {
     request({
         url,
@@ -9,7 +8,7 @@ class HTTP {
         header = {
             'content-type': 'application/json'
         },
-        loading = true
+        loading = '加载中...'
     }) {
         return new Promise((resolve, reject) => {
             this._request(url, resolve, reject, data, method, header, loading);
@@ -17,7 +16,7 @@ class HTTP {
     }
     _request(url, resolve, reject, data, method, header, loading) {
         if (loading) wx.showLoading({
-            title: '加载中...',
+            title: loading,
             mask: true
         })
         wx.request({
@@ -28,23 +27,20 @@ class HTTP {
             timeout: 60000,
             success: (res) => {
                 resolve(res.data);
-                if (loading) wx.hideLoading();
             },
             fial: (err) => {
                 reject(err);
-                if (loading) wx.hideLoading()
             },
             complete: (res) => {
+                if (loading) wx.hideLoading()
                 if (res.errMsg != 'request:ok') {
-                    wx.hideLoading()
                     wx.showToast({
                         title: '网络异常,请重新进入',
                         icon: "none"
                     })
                 } else if (res.data.msg == '登陆状态已过期,请重新登陆!') {
-                    clearTimeout(count);
                     wx.redirectTo({
-                        url: '/pages/home/index',
+                        url: '/pages/login/phone',
                     });
                     wx.showToast({
                         title: res.data.msg,