shish пре 4 година
родитељ
комит
8874d732c6
1 измењених фајлова са 54 додато и 0 уклоњено
  1. 54 0
      ghsApp/src/admin/home/login.vue

+ 54 - 0
ghsApp/src/admin/home/login.vue

@@ -50,9 +50,57 @@ export default {
 		return {
 			mobile:'',
 			password: '',
+			hasMobileNet:false
 		}
 	},
 	computed: {
+	},
+	onLoad(){
+		let that = this
+		uni.onNetworkStatusChange(function (res) {
+			console.log(res.networkType);
+			switch(res.networkType){
+				case '2g':
+					that.hasMobileNet = true
+					break;
+				case '3g':
+					that.hasMobileNet = true
+					break;
+				case '4g':
+					that.hasMobileNet = true
+					break;
+				case '5g':
+					that.hasMobileNet = true
+					break;
+				default:
+					that.hasMobileNet = false
+			}
+		})
+	
+		uni.getNetworkType({
+			success: function (res) {
+				switch(res.networkType){
+					case '2g':
+						that.hasMobileNet = true
+						break;
+					case '3g':
+						that.hasMobileNet = true
+						break;
+					case '4g':
+						that.hasMobileNet = true
+						break;
+					case '5g':
+						that.hasMobileNet = true
+						break;
+					default:
+						that.hasMobileNet = false
+				}
+			}
+		})
+
+	},
+	onUnload(){
+
 	},
 	methods: {
 		...mapActions(['setUserShopAll']),
@@ -102,6 +150,12 @@ export default {
 		},
 		mobileLogin(){
 			let that = this
+
+			if(this.hasMobileNet == false){
+				that.$msg('登录时,请关闭wifi,打开移动流量')
+				return
+			}
+
 			uni.showLoading({mask:true})
 			uni.preLogin({
 				provider: 'univerify',