From 6a5962fe9544005dba620b00fb36c25fe2da4e76 Mon Sep 17 00:00:00 2001
From: heyujie <516346543@qq.com>
Date: 星期二, 16 十一月 2021 15:24:46 +0800
Subject: [PATCH] 后端没修改的情况下添加默认背景图

---
 src/pages/desktop/index/components/Desktop.vue |  243 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 234 insertions(+), 9 deletions(-)

diff --git a/src/pages/desktop/index/components/Desktop.vue b/src/pages/desktop/index/components/Desktop.vue
index 673329c..7e4e343 100644
--- a/src/pages/desktop/index/components/Desktop.vue
+++ b/src/pages/desktop/index/components/Desktop.vue
@@ -1,25 +1,250 @@
 <template>
   <div class="desktop">
-    <d-frame v-for="item in this.$store.state.desktop.frames" :data="item" :key="item.id"></d-frame>
-    <safari :data="$store.state.desktop.safari" v-if="$store.state.desktop.safari.active"></safari>
+    <d-frame
+      v-for="item in this.$store.state.desktop.frames"
+      :data="item"
+      :key="item.id"
+    ></d-frame>
+    <safari
+      :data="$store.state.desktop.safari"
+      v-if="$store.state.desktop.safari.active"
+    ></safari>
+
+    <div class="warn-tag" v-if="showFreeVersion">
+      <span class="text"
+        >璇曠敤鐗堝皻鏈縺娲伙紝浠呮敮鎸侀儴鍒嗗姛鑳戒娇鐢紝濡傞渶浣跨敤鍏ㄩ儴鍔熻兘锛岃灏藉揩婵�娲荤郴缁熴��</span
+      >
+      <span class="go-to" @click="gotoActive">鍓嶅線婵�娲�</span>
+      <span class="icon iconfont" @click="showFreeVersion = false"
+        >&#xe61b;</span
+      >
+    </div>
+
+    <el-dialog
+      title="婵�娲籗martAI"
+      :visible.sync="dialogVisible"
+      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 }}
+      </div>
+      <el-divider></el-divider>
+      <div class="info">
+        濡傛灉杩樻病鏈変骇鍝佸瘑閽ワ紝浣犲彲浠ヤ娇鐢ㄦ墜鏈烘壂鐮佹垨鍓嶅線姝ら摼鎺�
+        <a href="http://os.smartai.com:7004" target="_blank"
+          >http://os.smartai.com:7004</a
+        >
+        璐拱銆�
+      </div>
+      <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
+            type="textarea"
+            autosize
+            style="width: 480px"
+            placeholder="灏嗕骇鍝佸瘑閽ョ矘璐村湪姝ゅ"
+            v-model="secrectKey"
+          >
+          </el-input>
+        </form>
+
+        <el-upload
+          class="upload-demo"
+          action
+          :http-request="uploadKey"
+          :limit="1"
+          :show-file-list="false"
+        >
+          <el-button size="small" type="primary">瀵煎叆浜у搧瀵嗛挜鏂囦欢</el-button>
+        </el-upload>
+      </div>
+
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">缁х画璇曠敤</el-button>
+        <el-button type="primary" @click="activateVersion">婵�娲�</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import DFrame from './DFrame';
-import Safari from './Safari';
-
+import DFrame from "./DFrame";
+import Safari from "./Safari";
+import {
+  getActiveQrCode,
+  getSN,
+  activateVersion,
+  uploadKey,
+} from "@/api/system";
 export default {
   name: "Desktop",
   components: {
-    DFrame, Safari
-  }
-}
+    DFrame,
+    Safari,
+  },
+  data() {
+    return {
+      showFreeVersion: false,
+      dialogVisible: false,
+      version: "SmartAI璇曠敤鐗�",
+      versionState: "灏氭湭婵�娲�",
+      secrectKey: "",
+    };
+  },
+  mounted() {
+    this.validateSn();
+  },
+  methods: {
+    validateSn() {
+      getSN().then((res) => {
+        this.showFreeVersion = res.data.sn == "";
+      });
+    },
+    activateVersion() {
+      if (this.secrectKey.trim() == "") {
+        this.$message.warning("璇峰厛濉啓浜у搧瀵嗛挜");
+        return;
+      }
+      activateVersion({ code: this.secrectKey.trim() })
+        .then((res) => {
+          if (res.code == 200) {
+            this.$notify.success("婵�娲绘垚鍔�");
+            this.validateSn();
+            this.goToSysInfo();
+            this.dialogVisible = false;
+          } else {
+            this.$notify.error(res.msg);
+          }
+        })
+        .catch((err) => {
+          this.$notify.error(err.msg);
+        });
+    },
+    goToSysInfo() {
+      window.parent.postMessage({ msg: `toVindicate?menu=绯荤粺淇℃伅` }, "*");
+    },
+    gotoActive() {
+      this.dialogVisible = true;
+    },
+    uploadKey(params) {
+      debugger
+      let param = new FormData();
+      param.append("code", params.file);
+      uploadKey(param).then(
+        (res) => {
+          if (res.code == 200) {
+            this.$message.success("瀵煎叆鎴愬姛");
+            this.secrectKey = res.data;
+          } else {
+            this.$message.error(res.msg);
+          }
+        },
+        (err) => {
+          this.$message.error(err.msg);
+        }
+      );
+    },
+    onInput(val) {
+      if (this[`input${val}`].length == 4 && val < 5) {
+        this.$refs[`input${val + 1}`].focus();
+      }
+      if (this[`input${val}`].length == 0 && val > 0) {
+        this.$refs[`input${val - 1}`].focus();
+      }
+    },
+  },
+};
 </script>
 
-<style scoped>
+<style lang="scss" >
 .desktop {
   width: 100%;
   height: 100%;
+  .el-dialog__header {
+    padding: 15px 20px 10px;
+    text-align: left;
+    font-weight: 600;
+  }
+  .el-dialog__body {
+    text-align: left;
+    padding: 30px 50px;
+    padding-top: 20px;
+  }
+  .el-divider--horizontal {
+    margin: 20px 0;
+  }
+  .validate {
+    display: flex;
+    align-items: baseline;
+    margin-top: 15px;
+  }
+  #myForm {
+    display: flex;
+    align-items: center;
+    margin-right: 10px;
+    .single-input {
+      margin: 0 8px;
+      width: 60px;
+    }
+  }
+  .ver {
+    margin-bottom: 10px;
+    font-size: 16px;
+    .ver-text {
+      font-weight: 600;
+    }
+  }
+  .info {
+    font-size: 15px;
+    margin-bottom: 10px;
+  }
+  .qr-code-img {
+    // width: 120px;
+    // height: 120px;
+  }
+  .ask {
+    margin-top: 20px;
+    font-size: 15px;
+  }
+}
+.warn-tag {
+  width: 640px;
+  text-align: left;
+  box-sizing: border-box;
+  padding: 0 25px;
+  height: 45px;
+  background-color: rgba(255, 238, 230, 1);
+  z-index: 99999;
+  position: absolute;
+  display: flex;
+  justify-content: space-between;
+  top: 55px;
+  left: calc(50% - 320px);
+  line-height: 45px;
+  border-radius: 5px;
+  .go-to {
+    color: rgba(71, 153, 247, 1);
+    cursor: pointer;
+    text-decoration: underline;
+    font-weight: 600;
+    font-size: 13px;
+  }
+  .text {
+    font-size: 13px;
+  }
+  .icon {
+    font-size: 14px;
+    cursor: pointer;
+  }
 }
 </style>
\ No newline at end of file

--
Gitblit v1.8.0