From d365829b14ca4256d39694b9cdcd43bad0ad8595 Mon Sep 17 00:00:00 2001 From: ZZJ <zzjdsg2300@163.com> Date: 星期五, 11 二月 2022 18:18:39 +0800 Subject: [PATCH] bug修复 --- src/pages/desktop/index/components/Desktop.vue | 544 +++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 434 insertions(+), 110 deletions(-) diff --git a/src/pages/desktop/index/components/Desktop.vue b/src/pages/desktop/index/components/Desktop.vue index ef4586e..a343368 100644 --- a/src/pages/desktop/index/components/Desktop.vue +++ b/src/pages/desktop/index/components/Desktop.vue @@ -11,94 +11,111 @@ ></safari> <div class="warn-tag" v-if="showFreeVersion"> - <span class="text" + <span v-if="!snExpire" class="text" >璇曠敤鐗堝皻鏈縺娲伙紝浠呮敮鎸侀儴鍒嗗姛鑳戒娇鐢紝濡傞渶浣跨敤鍏ㄩ儴鍔熻兘锛岃灏藉揩婵�娲荤郴缁熴��</span > - <span class="go-to" @click="gotoActive">鍓嶅線婵�娲�</span> - <span class="icon iconfont" @click="showFreeVersion = false" - ></span - > + <span v-else class="text">SmartAIOS 璇曠敤鏈熷凡鍒版湡锛岃鎮ㄥ敖蹇縺娲荤郴缁�</span> + <div> + <span class="go-to" @click="gotoActive">鍓嶅線婵�娲�</span> + <span class="icon iconfont" @click="showFreeVersion = false" + ></span + > + </div> </div> - <el-dialog title="婵�娲籗martAI" :visible.sync="dialogVisible" width="40%"> - <div class="ver"><span class="ver-text">鐗堟湰锛�</span>{{ version }}</div> + <el-dialog + title="婵�娲籗martAI" + :visible.sync="activeDialog" + width="750px" + :show-close="false" + :close-on-click-modal="false" + :close-on-press-escape="false" + > + <el-dialog + width="30%" + title="璐︽埛婵�娲�" + :visible.sync="innerVisible" + append-to-body + class="inner-login-dialog" + > + <div class="info"> + 璇疯緭鍏ヤ綘鍦⊿martAI鍟嗗煄璐︽埛鐨勬墜鏈哄彿骞跺畬鎴愰獙璇佺爜鏍¢獙锛屽疄鐜扮郴缁熸縺娲伙紒 + </div> + <div class="login-content"> + <el-form + :model="phone" + status-icon + :rules="phoneCodeRule" + :validate-on-rule-change="false" + ref="phoneLogin" + class="demo-ruleForm" + > + <el-form-item prop="phoneNum" style="margin-top: 20px"> + <el-input + v-model="phone.phoneNum" + style="width: 380px" + placeholder="璇疯緭鍏ユ墜鏈哄彿" + > + <i slot="prefix" class="el-icon-mobile-phone"></i> + </el-input> + </el-form-item> + <el-form-item prop="verifyCode"> + <el-input + @keyup.enter.native="phoneLogin" + v-model="phone.verifyCode" + autocomplete="off" + style="width: 254px" + placeholder="璇疯緭鍏ラ獙璇佺爜" + > + <i slot="prefix" class="el-icon-message"></i> + </el-input> + <el-button + class="code-btn" + style="margin-left: 15px" + :disabled="codeDisabled" + @click="getCode" + >{{ codeMsg }}</el-button + > + </el-form-item> + </el-form> + </div> + <span slot="footer" class="dialog-footer"> + <el-button @click="cancelLogin">鍙栨秷</el-button> + <el-button type="primary" @click="loginShop">纭畾</el-button> + </span> + </el-dialog> + <div class="ver"> + <span class="ver-text">鐗堟湰锛�</span>{{ versionName }} + </div> <div class="ver"> <span class="ver-text">鐘舵�侊細</span>{{ versionState }} </div> <el-divider></el-divider> - <div class="info"> + <div class="info" v-if="versionName == 'SmartAI姝e紡鐗�'"> + 濡傛灉鎮ㄥ凡杩炴帴鍒癐nternet骞朵笖宸茶喘涔颁骇鍝佸瘑閽ワ紝鍙互灏濊瘯楠岃瘉SmartAI鍟嗗煄璐︽埛婵�娲荤郴缁熴�� + <div class="margin-top:10px;"> + <el-button type="primary" @click="innerVisible = true"> + 璐︽埛婵�娲� + </el-button> + </div> + </div> + <div class="info" v-if="versionName == 'SmartAI姝e紡鐗�'"> + 濡傛灉鎮ㄦ湭杩炴帴Internet鎴栨縺娲诲け璐ワ紝鍙皾璇曠绾挎縺娲伙紝浣跨敤鎵嬫満鎵爜璐拱浜у搧鎴栭獙璇丼martAI鍟嗗煄璐︽埛婵�娲荤郴缁熴�� + </div> + <div class="info" v-if="versionName !== 'SmartAI姝e紡鐗�'"> 濡傛灉杩樻病鏈変骇鍝佸瘑閽ワ紝浣犲彲浠ヤ娇鐢ㄦ墜鏈烘壂鐮佹垨鍓嶅線姝ら摼鎺� - <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,14 +134,82 @@ :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 && versionName != 'SmartAI姝e紡鐗�'" + @click="activeDialog = false" + >缁х画璇曠敤</el-button + > + <el-button + v-if="snExpire && versionName != 'SmartAI姝e紡鐗�'" + @click="$emit('quit')" + >閫�鍑虹櫥褰�</el-button + > <el-button type="primary" @click="activateVersion">婵�娲�</el-button> + </span> + </el-dialog> + + <el-dialog + title="鎴戠殑璁㈠崟" + :visible.sync="innerDialog" + width="750px" + :show-close="false" + :close-on-click-modal="false" + :close-on-press-escape="false" + custom-class="my-order" + > + <div class="tip"> + <i class="el-icon-info"></i> + <span> 璇锋鏌ヨ鍗曚俊鎭紝纭鏃犺鍚庡啀婵�娲荤郴缁熴�� </span> + </div> + + <div class="order-list" v-if="orderList.length"> + <div + class="wrap" + style="margin: 0 5px" + v-for="(item, index) in orderList" + :key="index" + > + <div class="order-card" v-for="(prod, i) in item.products" :key="i"> + <div class="head"> + <el-checkbox v-model="checked" @change="choseProd(item, prod)"> + <span>璁㈠崟ID锛歿{ item.id }}</span> + </el-checkbox> + + <span>{{ item.orderMoney }} 鍏�</span> + </div> + <div class="desc"> + <div>绯荤粺鐗堟湰锛歿{ prod.edition }}</div> + <div>閫氶亾鏁伴噺锛歿{ prod.ChCount }}</div> + <div>鎽勫儚鏈烘暟閲忥細{{ prod.cameraCount }}</div> + <div>鏈嶅姟鏃堕暱锛歿{ prod.serveYear }} 骞�</div> + </div> + </div> + </div> + <!-- <div class="order-card" v-for="(item, index) in orderList" :key="index"> + <div class="head"> + <el-checkbox v-model="checked"> + <span>璁㈠崟ID锛歿{ item.id }}</span> + </el-checkbox> + + <span>锟{ item.orderMoney }} 鍏�</span> + </div> + <div class="desc"> + <div>绯荤粺鐗堟湰锛歿{ item.products[0]&&item.products[0].productVersion }}</div> + <div>閫氶亾鏁伴噺锛歿{ item.products[0]&&item.products[0].ChCount }}</div> + <div>鎽勫儚鏈烘暟閲忥細{{ item.products[0]&&item.products[0].cameraCount }}</div> + <div>鏈嶅姟鏃堕暱锛歿{ item.products[0]&&item.products[0].serveYear }} 骞�</div> + + </div> + </div> --> + </div> + <div class="no-order-list" v-else>鎶辨瓑锛屾病鏈夋煡璇㈠埌璁㈠崟銆�</div> + <span slot="footer" class="dialog-footer"> + <el-button @click="$emit('quit')">閫�鍑虹櫥褰�</el-button> + <el-button type="primary" @click="activeVerByOrd">婵�娲�</el-button> </span> </el-dialog> </div> @@ -133,11 +218,16 @@ <script> import DFrame from "./DFrame"; import Safari from "./Safari"; +import { isPhone } from "../../../../scripts/validate.ts"; import { getActiveQrCode, getSN, activateVersion, uploadKey, + getSmsCode, + loginShopInSmart, + getShopOrderList, + activeByOrder, } from "@/api/system"; export default { name: "Desktop", @@ -147,59 +237,203 @@ }, data() { return { - showFreeVersion: true, - dialogVisible: false, - version: "SmartAI璇曠敤鐗�", + showFreeVersion: false, + activeDialog: false, + countdown: 60, + innerDialog: false, + versionName: "", + codeMsg: "鑾峰彇楠岃瘉鐮�", versionState: "灏氭湭婵�娲�", secrectKey: "", - input2: "", - input4: "", - input3: "", - input5: "", + curOrder: {}, + curProd: {}, + codeDisabled: false, + innerVisible: false, + snExpire: false, + timer: null, + token: "", + orderList: [], + phone: { + phoneNum: "", + verifyCode: "", + }, + phoneCodeRule: { + phoneNum: [{ validator: isPhone, trigger: "blur" }], + verifyCode: [ + { required: true, message: "璇疯緭鍏ラ獙璇佺爜", trigger: "blur" }, + ], + }, }; }, - mounted() { - getSN().then((res) => { - this.showFreeVersion = res.data.sn == ""; - }); + created() { + this.validateSn(); }, methods: { - activateVersion() { - 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) + activeVerByOrd() { + activeByOrder({ + token: this.token, + activateCode: this.curProd.activateCode, + productId: this.curProd.productId, + orderId: this.curOrder.id, + }).then((res) => { + if (res.code == 200) { + this.$notify.success("婵�娲绘垚鍔�"); + this.innerDialog = false; + this.versionName = this.getVersionName(res.data.edition); + } else { + this.$notify.error("婵�娲诲け璐�"); } - }).catch((err) => { - this.$notify.error(err.msg) - }) + }); + }, + validateSn() { + getSN().then((res) => { + this.snExpire = res.data.expire; + this.showFreeVersion = res.data.sn == "" || res.data.expire; + this.versionName = this.getVersionName(res.data.edition); + }); + }, + getValidStr() { + if (this.countdown > 0 && this.countdown <= 60) { + this.countdown--; + if (this.countdown !== 0) { + this.codeMsg = "閲嶆柊鍙戦��(" + this.countdown + ")"; + } else { + clearInterval(this.timer); + this.codeMsg = "鑾峰彇楠岃瘉鐮�"; + this.countdown = 60; + this.timer = null; + this.codeDisabled = false; + } + } + }, + choseProd(order, prod) { + debugger; + this.curOrder = order; + this.curProd = prod; + }, + getVersionName(s) { + switch (s) { + case "alpha": + return "SmartAI鍐呮祴鐗�"; + case "beta": + return "SmartAI鍏祴鐗�"; + case "trial": + return "SmartAI璇曠敤鐗�"; + case "test": + return "SmartAI娴嬭瘯鐗�"; + case "official": + return "SmartAI姝e紡鐗�"; + default: + return "SmartAI瀹氬埗鐗�"; + break; + } + }, + loginShop() { + // this.innerDialog = true + // this.activeDialog=false + // getShopOrderList({ + // token: "", + // }).then((res) => { + // this.orderList=res.data.list + // }); + this.$refs["phoneLogin"].validate((valid) => { + if (valid) { + let param = { + phoneNum: this.phone.phoneNum, + verifyCode: this.phone.verifyCode, + }; + loginShopInSmart(param).then((res) => { + this.innerDialog = true; + this.activeDialog = false; + this.token = res.data.access_token; + getShopOrderList({ token: this.token }) + .then((res) => { + if (res.code == 200) { + this.orderList = res.data.list; + } else { + this.$notify.error("鑾峰彇璁㈠崟鍒楄〃澶辫触"); + } + }) + .catch(() => { + this.$notify.error("鑾峰彇璁㈠崟鍒楄〃澶辫触"); + }); + }); + } else { + this.nullRule = {}; + } + }); + }, + cancelLogin() { + this.innerVisible = false; + }, + getCode() { + var pattern = /^1[345789]\d{9}$/; + if (this.phone.phoneNum == "") { + this.$refs["phoneLogin"].fields[0].validateMessage = "璇疯緭鍏ユ墜鏈哄彿"; + this.$refs["phoneLogin"].fields[0].validateState = "error"; + return; + } + if (!pattern.test(this.phone.phoneNum)) { + this.$refs["phoneLogin"].fields[0].validateMessage = "鎵嬫満鍙风爜鏍煎紡鏈夎"; + this.$refs["phoneLogin"].fields[0].validateState = "error"; + return; + } + if (!this.timer) { + this.codeDisabled = true; + this.getValidStr(); + this.timer = setInterval(this.getValidStr, 1000); + getSmsCode({ phoneNum: this.phone.phoneNum }) + .then((res) => { + this.gotCode = true; + }) + .catch((err) => { + this.$refs["phoneLogin"].fields[0].validateMessage = err.data.msg; + this.$refs["phoneLogin"].fields[0].validateState = "error"; + }); + } + }, + activateVersion() { + if (this.secrectKey.trim() == "") { + this.$message.warning("璇峰厛濉啓浜у搧瀵嗛挜"); + return; + } + 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); } ); }, @@ -266,8 +500,97 @@ font-size: 15px; } } +.inner-login-dialog { + .info { + padding: 0 30px; + } + .el-dialog__body { + text-align: left; + } +} +.login-content { + box-sizing: border-box; + padding: 0 30px; + .el-input__inner { + -webkit-appearance: none; + background-color: #ffffff; + background-image: none; + border-radius: 4px; + border: 1px solid #dcdfe6; + box-sizing: border-box; + color: #606266; + display: inline-block; + font-size: 16px; + border-radius: 5px; + height: 40px; + line-height: 40px; + outline: none; + padding: 0 15px; + transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1); + width: 100%; + } +} +.el-dialog.my-order { + .tip { + width: auto; + height: 40px; + background: rgb(145, 213, 255, 0.2); + box-sizing: border-box; + border: 1px rgb(145, 213, 255) solid; + display: flex; + padding: 0 10px; + border-radius: 5px; + align-items: center; + i { + margin-right: 5px; + font-size: 16px; + color: rgb(24, 144, 255); + } + span { + font-size: 14px; + } + } + .no-order-list { + margin-top: 20px; + font-size: 16px; + color: red; + } + .order-list { + margin: 20px 0; + height: 550px; + overflow-y: auto; + .order-card { + height: 150px; + background: #fff; + margin-bottom: 15px; + + border-radius: 8px; + box-shadow: 0px 0px 4px rgb(0 0 0 / 25%); + .head { + height: 40px; + line-height: 40px; + text-align: left; + box-sizing: border-box; + padding: 0 20px; + border-bottom: 1px rgba(242, 242, 242, 1) solid; + font-size: 14px; + display: flex; + justify-content: space-between; + } + .desc { + display: flex; + flex-direction: column; + justify-content: space-evenly; + height: 110px; + text-align: left; + box-sizing: border-box; + padding: 0 20px; + } + } + } +} .warn-tag { - width: 35%; + width: 630px; text-align: left; box-sizing: border-box; padding: 0 25px; @@ -278,7 +601,7 @@ display: flex; justify-content: space-between; top: 55px; - left: calc(50% - 17.5%); + left: calc(50% - 315px); line-height: 45px; border-radius: 5px; .go-to { @@ -286,14 +609,15 @@ cursor: pointer; text-decoration: underline; font-weight: 600; - font-size: 13px; + font-size: 14px; } .text { - font-size: 13px; + font-size: 14px; } .icon { font-size: 14px; cursor: pointer; + margin-left: 25px; } } </style> \ No newline at end of file -- Gitblit v1.8.0