Browse Source

Merge branch 'master' of http://182.92.126.35:3000/msx/Vent-App

lxh 3 months ago
parent
commit
55d8ab3319
3 changed files with 64 additions and 15 deletions
  1. 3 1
      pages/history/history.vue
  2. 7 11
      pages/login/login.vue
  3. 54 3
      pages/webview/webview.vue

+ 3 - 1
pages/history/history.vue

@@ -354,19 +354,21 @@ export default {
     },
     //查询历史数据 getDeviceHistory
     checkHistory() {
+		debugger
       const params = {
         ttime_begin: this.StartTime,
         ttime_end: this.EndTime,
         gdeviceid: this.deviceID,
         skip: this.skip,
         pageNo: 1,
-        pageSize: 10000,
+        pageSize: 20,
         strtype: this.TabCur,
       };
       new Promise((resolve, reject) => {
         api
           .getDeviceHistory(params)
           .then((response) => {
+		debugger
             if (response.data.code == 200) {
               this.historyData = response.data.result.datalist.records;
               this.historyData.forEach((item) => {

+ 7 - 11
pages/login/login.vue

@@ -6,8 +6,8 @@
           <view class="zai-title text-shadow ">登 录</view>
         </view>
         <view class="text-center" :style="[{ animation: 'show ' + 0.4 + 's 1' }]">
-          <!--<u-link  class="zai-title2 text-shadow " href="http://localhost:8080?ticket=234" >切换单点登录</u-link>
-				<view class="zai-title2 text-shadow " @click="changeloginType">切换单点登录</view>-->
+          <!-- <u-link  class="zai-title2 text-shadow " href="http://localhost:8080?ticket=234" >切换单点登录</u-link> -->
+				<view class="zai-title2 text-shadow " @click="changeloginType">切换单点登录</view>
         </view>
         <view class="box padding-lr-xl login-paddingtop" :style="[{ animation: 'show ' + 0.6 + 's 1' }]">
           <block>
@@ -272,16 +272,12 @@ export default {
     changeloginType() {
       console.log("changeloginType====");
       var tourl = configService.apiUrl;
-      tourl = tourl.replace(9999, 8080);
-      tourl =
+      tourl = tourl.replace(9999, 8092);
+      var rastourl =
         "https://id.shendong.com.cn/default" +
-        "/login?service=" +
-        "http://localhost:8080";
-      console.log("===========" + tourl);
-      if (process.env.VUE_APP_PLATFORM != "h5") {
-        // plus.runtime.openURL('http://localhost:8080?ticket=12345')
-        this.openBrowser("http://localhost:8080?ticket=12345");
-      } else this.openBrowser("https://www.baidu.com");
+        "/login?service=" +tourl;
+      console.log("===========" + rastourl);
+      this.openBrowser(rastourl);
       // window.location.href='/pages/index/index?ticket=123'
       // this.$router.push({ path: '/pages/index/index?ticket=123',query:"2w354" })
     },

+ 54 - 3
pages/webview/webview.vue

@@ -1,20 +1,71 @@
 <!-- /pages/webview/webview.vue -->
 <template>
-  <web-view :src="src"></web-view>
+  <web-view :src="src" @message="onMessage"></web-view>
 </template>
  
 <script>
+import configService from "@/common/service/config.service.js";
+import api from "@/api/api";
 export default {
   data() {
     return {
       src: ''
     };
   },
+  methods:{
+	  onMessage(event) {
+	                  uni.showModal({
+	                      content: JSON.stringify(event.detail),
+	                      showCancel: false
+	                  });
+	              },
+	  // onMessage(e) {
+	  //     // 通过 e.detail.data 可以获取到网页发送过来的数据
+	  //     // 如果要监听URL变化,可以在这里处理
+	  //     console.log('网页发送的数据:', e.detail.data);
+	  //   }
+  },
+  watch:{
+	  src(value){
+		if(value.indexOf("ticket") !=-1) {	   
+		     this.$destroy();
+            var tourl = configService.apiUrl;
+			 try {
+			 	new Promise((resolve, reject) => {
+			 		api
+			 			.validateCasLogin({
+			 				ticket: value.substring(value.indexOf("ticket")+7,value.length),
+			 				service: tourl,
+			 			})
+			 			.then((response) => {
+			 				if (response.data.code == 200) {
+			 					uni.setStorageSync(ACCESS_TOKEN, response.data.result.token);
+			 				} else {
+			 					reject(response);
+			 				}
+							
+							uni.navigateTo({
+							  url: "/pages/home/home",
+							});
+			 			})
+			 			.catch((error) => {
+			 				console.log("catch===>response", response);
+			 				reject(error);
+			 			});
+			 	});
+			 
+			 } catch (e) {
+			 }
+		}
+	  }
+  },
   onLoad(option) {
     // 获取传递过来的url参数
 	let optionurl = option.url;
-				console.log("optionurl=========="+optionurl)
-    this.src = decodeURIComponent(option.url);
+	if(option.url.indexOf("ticket") !=-1){
+			console.log("option.url======"+option.url)
+    this.src = decodeURIComponent(optionurl);
+	}
   }
 };
 </script>