From 1e09a7a01a6c1888e1a2a832eb007fb8c2b653a0 Mon Sep 17 00:00:00 2001
From: ZZJ <zzjdsg2300@163.com>
Date: 星期三, 26 一月 2022 11:06:27 +0800
Subject: [PATCH] Merge branch 'bhomebus' of http://192.168.5.5:10010/r/web/vue-smart-ai into bhomebus

---
 src/pages/desktop/index/components/Desktop.vue |  157 +++++++++++++++++++--------------------------------
 1 files changed, 59 insertions(+), 98 deletions(-)

diff --git a/src/pages/desktop/index/components/Desktop.vue b/src/pages/desktop/index/components/Desktop.vue
index ef4586e..e9e9615 100644
--- a/src/pages/desktop/index/components/Desktop.vue
+++ b/src/pages/desktop/index/components/Desktop.vue
@@ -11,8 +11,11 @@
     ></safari>
 
     <div class="warn-tag" v-if="showFreeVersion">
-      <span class="text"
+      <span v-if="!snExpire" class="text"
         >璇曠敤鐗堝皻鏈縺娲伙紝浠呮敮鎸侀儴鍒嗗姛鑳戒娇鐢紝濡傞渶浣跨敤鍏ㄩ儴鍔熻兘锛岃灏藉揩婵�娲荤郴缁熴��</span
+      >
+      <span v-else class="text"
+        >SmartAIOS 璇曠敤鏈熷凡鍒版湡锛岃鎮ㄥ敖蹇縺娲荤郴缁�</span
       >
       <span class="go-to" @click="gotoActive">鍓嶅線婵�娲�</span>
       <span class="icon iconfont" @click="showFreeVersion = false"
@@ -20,7 +23,14 @@
       >
     </div>
 
-    <el-dialog title="婵�娲籗martAI" :visible.sync="dialogVisible" width="40%">
+    <el-dialog
+      title="婵�娲籗martAI"
+      :visible.sync="activeDialog"
+      width="750px"
+      :show-close="false"
+      :close-on-click-modal="false"
+      :close-on-press-escape="false"
+    >
       <div class="ver"><span class="ver-text">鐗堟湰锛�</span>{{ version }}</div>
       <div class="ver">
         <span class="ver-text">鐘舵�侊細</span>{{ versionState }}
@@ -28,77 +38,19 @@
       <el-divider></el-divider>
       <div class="info">
         濡傛灉杩樻病鏈変骇鍝佸瘑閽ワ紝浣犲彲浠ヤ娇鐢ㄦ墜鏈烘壂鐮佹垨鍓嶅線姝ら摼鎺�
-        <a href="http://os.smartai.com:7004" target="_blank"
-          >http://os.smartai.com:7004</a
+        <a href="http://apps.smartai.com" target="_blank"
+          >http://apps.smartai.com</a
         >
         璐拱銆�
       </div>
-
-      <!-- <img class="qr-code-img" src="/images/desktop/weather.png" /> -->
-      <!-- <img class="qr-code-img" src="http://192.168.8.10:7009/version/offline/qrcode" /> -->
-      <img
-        class="qr-code-img"
-        src="http://192.168.20.189:7009/version/offline/qrcode"
-      />
-
+      <img class="qr-code-img" src="/version/offline/qrcode" />
       <el-divider></el-divider>
 
       <div class="ask">
         濡傛灉浣犲叿鏈塖martAI鎻愪緵鐨勪骇鍝佸瘑閽ワ紝璇峰湪姝ゅ杈撳叆婵�娲籗martAI銆�
       </div>
-
       <div class="validate">
         <form id="myForm">
-          <!-- <el-input
-            class="single-input"
-            size="small"
-            ref="secrectKey"
-            :maxlength="4"
-            v-model="secrectKey"
-            placeholder=""
-            @input="onInput(1)"
-          ></el-input
-          >-
-          <el-input
-            class="single-input"
-            size="small"
-            ref="input2"
-            :maxlength="4"
-            v-model="input2"
-            placeholder=""
-            @input="onInput(2)"
-          ></el-input
-          >-
-          <el-input
-            class="single-input"
-            size="small"
-            ref="input3"
-            :maxlength="4"
-            v-model="input3"
-            placeholder=""
-            @input="onInput(3)"
-          ></el-input>
-          -
-          <el-input
-            class="single-input"
-            size="small"
-            ref="input4"
-            :maxlength="4"
-            v-model="input4"
-            placeholder=""
-            @input="onInput(4)"
-          ></el-input
-          >-
-          <el-input
-            class="single-input"
-            size="small"
-            ref="input5"
-            :maxlength="4"
-            v-model="input5"
-            placeholder=""
-            @input="onInput(5)"
-          ></el-input> -->
-
           <el-input
             type="textarea"
             autosize
@@ -117,13 +69,12 @@
           :show-file-list="false"
         >
           <el-button size="small" type="primary">瀵煎叆浜у搧瀵嗛挜鏂囦欢</el-button>
-
-          <!-- <div class="el-upload__tip" slot="tip"></div> -->
         </el-upload>
       </div>
 
       <span slot="footer" class="dialog-footer">
-        <el-button @click="dialogVisible = false">缁х画璇曠敤</el-button>
+        <el-button v-if="!snExpire" @click="activeDialog = false">缁х画璇曠敤</el-button>
+        <el-button v-else @click="quit">閫�鍑虹櫥褰�</el-button>
         <el-button type="primary" @click="activateVersion">婵�娲�</el-button>
       </span>
     </el-dialog>
@@ -147,59 +98,69 @@
   },
   data() {
     return {
-      showFreeVersion: true,
-      dialogVisible: false,
+      showFreeVersion: false,
+      activeDialog: false,
       version: "SmartAI璇曠敤鐗�",
       versionState: "灏氭湭婵�娲�",
       secrectKey: "",
-      input2: "",
-      input4: "",
-      input3: "",
-      input5: "",
+      snExpire: false
     };
   },
   mounted() {
-    getSN().then((res) => {
-      this.showFreeVersion = res.data.sn == "";
-    });
+    this.validateSn();
   },
   methods: {
+    quit(){
+      this.$emit("quit")
+    },
+    validateSn() {
+      getSN().then((res) => {
+        this.snExpire = res.data.expire;
+        this.showFreeVersion = res.data.sn == "" || res.data.expire;
+      });
+    },
     activateVersion() {
-      if (this.secrectKey.trim()=="") {
-        this.$message.warning("璇峰厛濉啓浜у搧瀵嗛挜")
-        return 
+      if (this.secrectKey.trim() == "") {
+        this.$message.warning("璇峰厛濉啓浜у搧瀵嗛挜");
+        return;
       }
-      activateVersion({code:this.secrectKey.trim()}).then((res) => {
-        debugger
-        if (res.code==200) {
-          this.$notify.success("婵�娲绘垚鍔�")
-          this.goToSysInfo()
-          this.dialogVisible = false;
-
-        }else{
-          this.$notify.error(res.msg)
-        }
-      }).catch((err) => {
-          this.$notify.error(err.msg)
-      })
+      activateVersion({ code: this.secrectKey.trim() })
+        .then((res) => {
+          debugger
+          if (res.code == 200) {
+            this.$notify.success("婵�娲绘垚鍔�");
+            this.validateSn();
+            this.goToSysInfo();
+            this.activeDialog = false;
+          } else {
+            this.$notify.error(res.msg);
+          }
+        })
+        .catch((err) => {
+          this.$notify.error(err.msg);
+        });
     },
     goToSysInfo() {
       window.parent.postMessage({ msg: `toVindicate?menu=绯荤粺淇℃伅` }, "*");
     },
     gotoActive() {
-      this.showFreeVersion = false;
-      this.dialogVisible = true;
+      this.activeDialog = true;
     },
     uploadKey(params) {
+      debugger;
       let param = new FormData();
       param.append("code", params.file);
       uploadKey(param).then(
         (res) => {
-          this.$message.success("瀵煎叆鎴愬姛");
-          this.secrectKey = res.data;
+          if (res.code == 200) {
+            this.$message.success("瀵煎叆鎴愬姛");
+            this.secrectKey = res.data;
+          } else {
+            this.$message.error(res.msg);
+          }
         },
         (err) => {
-          this.$message.error("瀵煎叆澶辫触");
+          this.$message.error(err.msg);
         }
       );
     },
@@ -267,7 +228,7 @@
   }
 }
 .warn-tag {
-  width: 35%;
+  width: 640px;
   text-align: left;
   box-sizing: border-box;
   padding: 0 25px;
@@ -278,7 +239,7 @@
   display: flex;
   justify-content: space-between;
   top: 55px;
-  left: calc(50% - 17.5%);
+  left: calc(50% - 320px);
   line-height: 45px;
   border-radius: 5px;
   .go-to {

--
Gitblit v1.8.0