Bladeren bron

修改版本号为118

wzh 2 jaren geleden
bovenliggende
commit
67d2dace7c
2 gewijzigde bestanden met toevoegingen van 89 en 50 verwijderingen
  1. 3 3
      api/login.js
  2. 86 47
      pages/login.vue

+ 3 - 3
api/login.js

@@ -8,7 +8,7 @@ export function login(username, password) {
     // uuid
   }
   return request({
-    'url': '/mailLogin',
+    'url': '/mailLogin?appfrom=techtron',
     headers: {
       isToken: false
     },
@@ -35,7 +35,7 @@ export function register(username, password) {
 	password
   }
   return request({
-    'url': '/mailRegister',
+    'url': '/mailRegister?appfrom=techtron',
     headers: {
       isToken: false
     },
@@ -55,7 +55,7 @@ export function getInfo() {
 // 获取用户详细信息
 export function checkVersion(obj) {
   return request({
-    'url': '/device/checkVersion?versionCode='+obj.versionCode+"&platom="+obj.platom,
+    'url': '/device/checkVersion?appfrom=techtron&versionCode='+obj.versionCode+"&platom="+obj.platom,
     data:obj,
     'method': 'post'
   })

+ 86 - 47
pages/login.vue

@@ -5,19 +5,19 @@
    <view style="color: aliceblue;position: fixed;right: 10px;z-index: 999999;top:50px" @click="changeLocale">
      {{ $t('login.language') }}:{{localeConfig[locale]}}<uni-icons type="gear" size="15"></uni-icons>
    </view>
-   <view style="height: 30vh;">
-	   <image style="height: 3vh;width: 15vh;margin-top: 20vh;margin-left: 15vh;" src="../static/images/new/starts/login/backImg2.png"></image>
-   </view>
-	<view style="height: 40vh;">
-		<!-- <image style="width: 750px;height: 807px;" :src="imgUrl+'/login/backImg2.png'" mode="widthFix"/> -->
-		<!-- <view class="logo-content align-center justify-center flex">
-		  <text class="title" style="font-size: 25px;margin-left:-71px">{{$t('login.title') }}</text>
-		</view> -->
-		<view class="logo-content justify-center flex">
-		  <text class="welcome" style="height: 20vh;">Welcome</text>
-		</view>
-		
-	</view>
+    <view style="height: 80vh;;">
+      <!-- <image style="width: 750px;height: 807px;" :src="imgUrl+'/login/backImg2.png'" mode="widthFix"/> -->
+      <!-- <view class="logo-content align-center justify-center flex">
+      <text class="title" style="font-size: 25px;margin-left:-71px">{{$t('login.title') }}</text>
+    </view> -->
+
+      <view class="" style="    padding-top: 23vh;display: flex;flex-direction: column;flex-wrap: nowrap;align-items: center;">
+        <image style="height: 3vh;width: 15vh;"
+               src="../static/images/new/starts/login/backImg2.png"></image>
+        <text class="welcome" style="margin-top: 20px; height: 20vh;font-size: 16px; color: #a3a3a3;">Welcome</text>
+      </view>
+
+    </view>
 	<!-- 登录表单 -->
     <view class="login-form-content" style="z-index: 99;position: relative;"  v-show="isLogin">
       <view class="input-item flex align-center"  v-if="locale == 'en'">
@@ -162,7 +162,8 @@
         progress: 0,
         isLogin: true, // 是否为登录模式
         showCode: false,
-        platom:""
+        platom:"",
+        onlineVersionData:null,
       }
     },
 	 // mounted() {
@@ -178,7 +179,8 @@
       uni.getSystemInfo({
         success:function(res){
           self.platom = res.platform;
-		  self.checkVersion();
+		  // self.checkVersion();
+      self.getAppInfo();
         }
       });
      this.setLocale()
@@ -248,10 +250,16 @@
       },
       downloadFile(){
         let self = this;
+        let versionData = this.onlineVersionData;
 
+        if(versionData == null){
+          return;
+        }
+        let is_wgt = versionData.is_wgt;
         const platform = this.platom.toLowerCase();
+        if(is_wgt == 0){
         if (platform == 'android') {
-          let downUrl = self.downloadUrl;
+            let downUrl = versionData.app_url;
             plus.runtime.openURL(downUrl);
         }else{
           const appleId = '86726R3L5K'; // 这里替换成你的 apple id
@@ -259,41 +267,72 @@
                 action: self.iosUrl
               },
               function(e) {
-                console.log('Open system default browser failed: ' + e.message);
+
               }
           );
         }
+        }else{
+          self.isShowProgress = true;
+          const downloadTask = uni.downloadFile({
+            url: self.downloadUrl,
+            success: res => {
+              if (res.statusCode === 200) {
+                this.isShowProgress = false;
+                console.log('下载成功');
+              }
+              let that = this;
+              plus.runtime.install(res
+                      .tempFilePath, {
+                    force: false
+                  },
+                  function() {
+                    plus.runtime
+                        .restart();
+                  });
+            }
+          })
+          console.log(downloadTask)
+          downloadTask.onProgressUpdate((res) => {
+            if(res.progress > 0) {
+              this.isShowProgress = true;
+            }
+            this.progress = res.progress;
+            console.log('下载进度:' + res.progress);
+            console.log('已下载长度:' + res.totalBytesWritten);
+            console.log('文件总长度:' + res.totalBytesExpectedToWrite);
+          })
+        }
+      },
+      getAppInfo() {
+      let self = this;
+    plus.runtime.getProperty( plus.runtime.appid, function ( wgtinfo ) {
+        self.version = wgtinfo.version;
+      let appVersion = self.version.split(".").join("");
+        let appVersionCode = parseInt(appVersion);
+      checkVersion({"versionCode": appVersion,"platom":self.platom}).then(res=>{
+        let cz_app_version =res.data;
+        if(cz_app_version != null){
+          let onlineVersion = cz_app_version.version;
+          console.log(onlineVersion)
+          let isForce = cz_app_version.isForce;
+          let url = cz_app_version.down_url;
+          self.downloadUrl = url;
+          self.onlineVersionData = cz_app_version;
+          self.iosUrl = cz_app_version.ios_url;
+          if(onlineVersion>appVersionCode){
+            let versionType = cz_app_version.type_;
+            if(versionType.toLowerCase() === self.platom.toLowerCase()){
+              self.newVerson = onlineVersion;
+              self.showStatus = true;
+            }else if(versionType.toLowerCase() === 'all'){
+              self.newVerson = onlineVersion;
+              self.showStatus = true;
+            }
 
-
-        // self.isShowProgress = true;
-        // const downloadTask = uni.downloadFile({
-        //   url: self.downloadUrl,
-        //   success: res => {
-        //     if (res.statusCode === 200) {
-        //       this.isShowProgress = false;
-        //       console.log('下载成功');
-        //     }
-        //     let that = this;
-        //     plus.runtime.install(res
-        //             .tempFilePath, {
-        //           force: false
-        //         },
-        //         function() {
-        //           plus.runtime
-        //               .restart();
-        //         });
-        //   }
-        // })
-        // console.log(downloadTask)
-        // downloadTask.onProgressUpdate((res) => {
-        //   if(res.progress > 0) {
-        //     this.isShowProgress = true;
-        //   }
-        //   this.progress = res.progress;
-        //   console.log('下载进度:' + res.progress);
-        //   console.log('已下载长度:' + res.totalBytesWritten);
-        //   console.log('文件总长度:' + res.totalBytesExpectedToWrite);
-        // })
+          }
+        }
+      });
+    } );
       },
       checkVersion(){
         let appBaseInfo = uni.getAppBaseInfo();