From 509171ab4b3b4f2115512bdfb09a583024fb5c53 Mon Sep 17 00:00:00 2001 From: heyujie <516346543@qq.com> Date: 星期二, 14 九月 2021 18:39:20 +0800 Subject: [PATCH] all --- src/pages/vindicate/views/sysInfo.vue | 104 +++++++++++++++++++++++++++++----------------------- 1 files changed, 58 insertions(+), 46 deletions(-) diff --git a/src/pages/vindicate/views/sysInfo.vue b/src/pages/vindicate/views/sysInfo.vue index e8ff060..5c8a9fc 100644 --- a/src/pages/vindicate/views/sysInfo.vue +++ b/src/pages/vindicate/views/sysInfo.vue @@ -9,16 +9,24 @@ </div> <div class="bar"> <div class="name">鐗堟湰锛�</div> - <div class="desc">{{ verText }}</div> + <div class="desc"> + {{ + serializedNumber == "" ? "SmartAIOS璇曠敤鐗�" : "SmartAIOS姝e紡鐗�" + }} + </div> </div> <div class="bar"> <div class="name">婵�娲伙細</div> <div class="right-zone"> - <el-button type="primary" size="small" @click="confirmAgain" + <el-button + type="primary" + size="small" + @click="confirmAgain" + v-if="serializedNumber != ''" >瀵煎嚭浜у搧瀵嗛挜</el-button > <div class="desc" style="color: rgba(71, 153, 247, 1)"> - {{ sn == "" ? "鏈縺娲�" : "宸叉縺娲�" }} + {{ serializedNumber == "" ? "鏈縺娲�" : "宸叉縺娲�" }} </div> </div> </div> @@ -28,7 +36,9 @@ </div> <div class="bar"> <div class="name">浜у搧瀵嗛挜锛�</div> - <div class="desc" style="font-size: 12px">{{ authorization }}</div> + <div class="desc" style="font-size: 12px"> + {{ authorization || "--" }} + </div> </div> <div class="bar"> <div class="name">鍒版湡鏃堕棿锛�</div> @@ -43,7 +53,6 @@ <span class="icon iconfont" style="color: orangered"></span> 浜у搧瀵嗛挜瀵煎嚭鍚庯紝绯荤粺澶ч儴鍒嗗姛鑳藉皢鏃犳硶浣跨敤锛岃纭鏄惁缁х画锛� </div> - <div class="info"> 濡傞渶缁х画锛岃杈撳叆绠$悊鍛樺瘑鐮侊紝骞跺鍏ヤ綘鎯宠婵�娲荤殑璁惧璇锋眰鐮侊紝鐒跺悗鐐瑰嚮鈥滅‘璁も�濄�� <span style="color: #8f949a; font-size: 14px" @@ -56,7 +65,7 @@ size="small" placeholder="璇疯緭鍏ョ鐞嗗憳瀵嗙爜" v-model="password" - style="padding-left: 50px; width: 360px" + style="padding-left: 50px; width: 460px" ></el-input> </div> <div class="validate"> @@ -64,23 +73,21 @@ <el-input type="textarea" autosize - style="width: 360px" - placeholder="灏嗕骇鍝佸瘑閽ョ矘璐村湪姝ゅ" + style="width: 460px" + 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" @click="txtbtn" type="primary" + >瀵煎叆鏂囦欢</el-button > - </el-upload> --> - <el-button size="small" @click="txtbtn" type="primary">瀵煎叆鏂囦欢</el-button> - <input type="file" @change="loadTextFromFile" id="txt" style="display:none"/> + <input + type="file" + @change="loadTextFromFile" + id="txt" + style="display: none" + /> </div> <span slot="footer" class="dialog-footer"> @@ -95,52 +102,45 @@ import { getSN, cancelAuthorization } from "@/api/system"; export default { mounted() { - getSN().then((res) => { - if (res.code == 200) { - this.authorization = res.data.authorization; - this.expireTime = res.data.expireTime; - this.sn = res.data.sn; - this.q = res.data.q; - } - }); + this.refreshSn(); }, data() { return { authorization: "", expireTime: "", - sn: "", + serializedNumber: "", secrectKey: "", q: "", - verText: "SmartAIOS姝e紡鐗�", + // verText: "SmartAIOS姝e紡鐗�", activeState: "宸叉縺娲�", password: "", dialogVisible: false, }; }, methods: { + refreshSn() { + getSN().then((res) => { + if (res.code == 200) { + this.authorization = res.data.authorization; + this.expireTime = res.data.expireTime; + this.serializedNumber = res.data.sn; + this.q = res.data.q; + debugger + } + }); + }, confirmAgain() { - // this.$confirm("鎮ㄦ槸鍚︾‘璁ょ珛鍗冲浠芥墍鏈夊簲鐢ㄧ殑閰嶇疆鏁版嵁锛�", "绔嬪嵆澶囦唤", { - // confirmButtonText: "纭畾", - // cancelButtonText: "鍙栨秷", - // }).then(() => { - // this.$message({ - // type: "success", - // message: "澶囦唤鎴愬姛", - // }); - // }); this.dialogVisible = true; }, - txtbtn() { + txtbtn() { document.getElementById("txt").click(); }, loadTextFromFile(e) { const file = e.target.files[0]; var reader = new FileReader(); //new涓�涓狥ileReader瀹炰緥 - let that = this + let that = this; reader.onload = function () { - debugger - that.secrectKey = this.result.trim() - console.log(this.result); + that.secrectKey = this.result.trim(); }; reader.readAsText(file); }, @@ -156,17 +156,29 @@ passwd: this.password, down: 1, }).then((res) => { - debugger; + if (res.type=="application/json") { + var reader = new FileReader(); + reader.readAsText(res,"utf-8"); + let that = this + reader.onload = function () { + var receive_data = JSON.parse(this.result); //杩欎釜灏辨槸瑙f瀽鍑烘潵鐨勬暟鎹� + that.$notify.error(receive_data.msg); + }; + return; + } let url = window.URL.createObjectURL( - new Blob([res], { - type: "text/plain", - }) + new Blob([res], { type: "text/plain" }) ); let a = document.createElement("a"); a.href = url; a.download = "key.txt"; a.click(); window.URL.revokeObjectURL(url); + debugger + this.refreshSn(); + window.parent.postMessage({ msg: "checkSN" }, "*"); + this.$notify.success("瀵煎嚭鎴愬姛"); + this.dialogVisible = false; }); }, }, -- Gitblit v1.8.0