From 8e40a69fcfe8bc799fee141fec953a2b0892dbd4 Mon Sep 17 00:00:00 2001 From: zhangzengfei <zhangzengfei@smartai.com> Date: 星期一, 09 十月 2023 15:54:26 +0800 Subject: [PATCH] 修改wifi扫描的交互 --- src/pages/desktop/index/components/Desktop.vue | 317 +++++++++++++++++++++++----------------------------- 1 files changed, 140 insertions(+), 177 deletions(-) diff --git a/src/pages/desktop/index/components/Desktop.vue b/src/pages/desktop/index/components/Desktop.vue index 11c59fb..9f83144 100644 --- a/src/pages/desktop/index/components/Desktop.vue +++ b/src/pages/desktop/index/components/Desktop.vue @@ -1,28 +1,18 @@ <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"> + <!-- 鏆傛椂闅愯棌璇曠敤鐗堟彁绀� --> + <!-- <div class="warn-tag" v-if="showFreeVersion"> --> + <div class="warn-tag" v-show="false"> <span v-if="!snExpire" class="text" - >璇曠敤鐗堝皻鏈縺娲伙紝浠呮敮鎸佷娇鐢ㄩ儴鍒嗗姛鑳斤紝濡傞渶浣跨敤鍏ㄩ儴鍔熻兘锛岃灏藉揩婵�娲汇��</span + >{{ versionName }}灏氭湭婵�娲伙紝浠呮敮鎸佷娇鐢ㄩ儴鍒嗗姛鑳斤紝濡傞渶浣跨敤鍏ㄩ儴鍔熻兘锛岃灏藉揩婵�娲汇��</span > <span v-else class="text">SmartAIOS 璇曠敤鏈熷凡鍒版湡锛岃鎮ㄥ敖蹇縺娲荤郴缁�</span> <div> <span class="go-to" @click="gotoActive">鍓嶅線婵�娲�</span> - <span - class="icon iconfont" - v-if="!snExpire" - @click="showFreeVersion = false" - ></span - > + <span class="icon iconfont" v-if="!snExpire" @click="showFreeVersion = false"></span> </div> </div> @@ -49,7 +39,6 @@ </span> </div> <div class="login-content"> - <!-- status-icon --> <el-form :model="phone" :rules="phoneCodeRule" @@ -85,20 +74,14 @@ <span slot="footer" class="dialog-footer"> <div class="btns"> <el-button class="cancel" @click="cancelLogin">鍙栨秷</el-button> - <el-button class="ok" type="primary" @click="loginShop" - >纭畾</el-button - > + <el-button class="ok" type="primary" @click="loginShop">纭畾</el-button> </div> </span> </el-dialog> - <div class="ver"> - <span class="ver-text">鐗堟湰锛�</span>{{ versionName }} - </div> - <div class="ver"> - <span class="ver-text">鐘舵�侊細</span>{{ versionState }} - </div> + <div class="ver"><span class="ver-text">鐗堟湰锛�</span>SmartAI{{ versionName }}</div> + <div class="ver"><span class="ver-text">鐘舵�侊細</span>灏氭湭婵�娲�</div> <el-divider></el-divider> - <div class="info" v-if="versionName == 'SmartAI姝e紡鐗�'"> + <div class="info" v-if="versionName == '姝e紡鐗�'"> <span style="font-weight: bold; font-size: 18px">路 </span> <span style="font-size: 14px; line-height: 21px; color: #5f5f5f"> 濡傛灉鎮ㄥ凡杩炴帴鍒癐nternet骞朵笖宸茶喘涔颁骇鍝佸瘑閽ワ紝鍙互灏濊瘯楠岃瘉SmartAI鍟嗗煄璐︽埛婵�娲荤郴缁熴�� @@ -109,19 +92,17 @@ </el-button> </div> </div> - <div class="info" v-if="versionName == 'SmartAI姝e紡鐗�'"> + <div class="info" v-if="versionName == '姝e紡鐗�'"> <span style="font-weight: bold; font-size: 18px">路 </span> <span style="font-size: 14px; line-height: 21px; color: #5f5f5f"> 濡傛灉鎮ㄦ湭杩炴帴Internet鎴栨縺娲诲け璐ワ紝鍙皾璇曠绾挎縺娲伙紝璇风敤鎵嬫満鎵爜璐拱浜у搧鎴栭獙璇丼martAI鍟嗗煄璐︽埛婵�娲荤郴缁熴�� </span> </div> - <div class="info" v-if="versionName !== 'SmartAI姝e紡鐗�'"> + <div class="info" v-if="versionName !== '姝e紡鐗�'"> <span style="font-weight: bold; font-size: 18px">路 </span> <span style="font-size: 14px; line-height: 21px; color: #5f5f5f"> 濡傛灉杩樻病鏈変骇鍝佸瘑閽ワ紝浣犲彲浠ヤ娇鐢ㄦ墜鏈烘壂鐮佹垨鍓嶅線姝ら摼鎺� - <a href="http://apps.smartai.com" target="_blank" - >http://apps.smartai.com</a - > + <a href="http://apps.smartai.com" target="_blank">http://apps.smartai.com</a> 璐拱銆� </span> </div> @@ -134,46 +115,25 @@ </div> <div class="validate"> <form id="myForm"> - <el-input - type="textarea" - autosize - style="width: 450px" - placeholder="璇疯緭鍏ユ垨瀵煎叆瀵嗛挜" - v-model="secrectKey" - > + <el-input type="textarea" autosize style="width: 450px" placeholder="璇疯緭鍏ユ垨瀵煎叆瀵嗛挜" v-model="secrectKey"> </el-input> </form> - <el-upload - class="upload-demo" - action - :http-request="uploadKey" - :limit="1" - :show-file-list="false" - > + <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> <!-- <el-divider></el-divider> --> <span slot="footer" class="dialog-footer"> - <!-- v-if="!snExpire && versionName != 'SmartAI姝e紡鐗�'" --> <div class="btns"> - <el-button - v-if="!snExpire && versionName != 'SmartAI姝e紡鐗�'" - class="cancel" - @click="activeDialog = false" + <el-button v-if="!snExpire && versionName != '姝e紡鐗�'" class="cancel" @click="activeDialog = false" >缁х画璇曠敤</el-button > - <el-button - class="cancel" - v-if="snExpire && versionName != 'SmartAI姝e紡鐗�'" - @click="$emit('quit')" - >閫�鍑虹櫥褰� + <el-button class="cancel" v-if="snExpire && versionName != '姝e紡鐗�'" @click="$emit('quit')" + >閫�鍑虹櫥闄� </el-button> - <el-button class="ok" type="primary" @click="activateVersion" - >婵�娲�</el-button - > + <el-button class="ok" type="primary" @click="activateVersion">婵�娲�</el-button> </div> </span> </el-dialog> @@ -193,12 +153,7 @@ </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="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)"> @@ -208,29 +163,34 @@ <span>{{ item.orderMoney }} 鍏�</span> </div> <div class="desc"> + <div>璁㈠崟鐢熸垚鏃ユ湡锛歿{ item.createTime }}</div> + <div>浜у搧鍚嶇О锛歿{ prod.productName }}</div> + <div>浜у搧绫诲瀷锛歿{ prod.productTypeName }}</div> <div>绯荤粺鐗堟湰锛歿{ prod.edition }}</div> <div>閫氶亾鏁伴噺锛歿{ prod.ChCount }}</div> - <div>鎽勫儚鏈烘暟閲忥細{{ prod.cameraCount }}</div> - <div>鏈嶅姟鏃堕暱锛歿{ prod.serveYear }} 骞�</div> + <div>鎺堟潈鏁伴噺锛歿{ prod.authCount }}</div> + <div>璧锋鏈嶅姟鏃堕棿 锛歿{ startAndEnd(item.createTime, prod.serveYear) }}</div> </div> </div> </div> </div> - <div class="no-order-list" v-else>鎶辨瓑锛屾病鏈夋煡璇㈠埌璁㈠崟銆�</div> + <div class="no-order-list" v-else> + {{ loadingOrders ? "璁㈠崟鍔犺浇涓紝璇风◢鍚�..." : "鎶辨瓑锛屾湭鏌ヨ鍒拌鍗曚俊鎭紒" }} + </div> <span slot="footer" class="dialog-footer"> - <div class="btns"> + <div class="btns"> <el-button class="cancel" @click="$emit('quit')">閫�鍑虹櫥褰�</el-button> - <el-button class="ok" type="primary" @click="activeVerByOrd">婵�娲�</el-button> - </div> + <el-button class="ok" type="primary" @click="activeVerByOrd">婵�娲�</el-button> + </div> </span> </el-dialog> </div> </template> <script> -import DFrame from "./DFrame"; -import Safari from "./Safari"; -import { isPhone } from "../../../../scripts/validate.ts"; +import DFrame from "./DFrame" +import Safari from "./Safari" +import { isPhone } from "../../../../scripts/validate.ts" import { getActiveQrCode, getSN, @@ -239,23 +199,22 @@ getSmsCode, loginShopInSmart, getShopOrderList, - activeByOrder, -} from "@/api/system"; + activeByOrder +} from "@/api/system" export default { name: "Desktop", components: { DFrame, - Safari, + Safari }, data() { return { showFreeVersion: false, activeDialog: false, countdown: 60, - innerDialog: true, + innerDialog: false, versionName: "", codeMsg: "鑾峰彇楠岃瘉鐮�", - versionState: "灏氭湭婵�娲�", secrectKey: "", curOrder: {}, curProd: {}, @@ -264,80 +223,84 @@ snExpire: false, timer: null, token: "", + loadingOrders: true, orderList: [], phone: { phoneNum: "", - verifyCode: "", + verifyCode: "" }, phoneCodeRule: { phoneNum: [{ validator: isPhone, trigger: "blur" }], - verifyCode: [ - { required: true, message: "璇疯緭鍏ラ獙璇佺爜", trigger: "blur" }, - ], - }, - }; + verifyCode: [{ required: true, message: "璇疯緭鍏ラ獙璇佺爜", trigger: "blur" }] + } + } }, created() { - this.validateSn(); + this.validateSn() }, methods: { + startAndEnd(createTime, serveYear) { + let year = createTime.split("-")[0] + let endTime = parseInt(year) + serveYear + createTime.slice(4) + return createTime + " - " + endTime + }, activeVerByOrd() { activeByOrder({ token: this.token, activateCode: this.curProd.activateCode, productId: this.curProd.productId, - orderId: this.curOrder.id, + orderId: this.curOrder.id }).then((res) => { if (res.code == 200) { - this.$notify.success("婵�娲绘垚鍔�"); - this.innerDialog = false; - this.versionName = this.getVersionName(res.data.edition); + this.$notify.success("婵�娲绘垚鍔�") + this.innerDialog = false + this.versionName = this.getVersionName(res.data.edition) } else { - this.$notify.error("婵�娲诲け璐�"); + this.$notify.error("婵�娲诲け璐�") } - }); + }) }, validateSn() { getSN().then((res) => { - this.snExpire = res.data.expire; - this.showFreeVersion = res.data.sn == "" || res.data.expire; - this.versionName = this.getVersionName(res.data.edition); - }); + this.snExpire = res.data.expire + this.activeDialog = 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--; + this.countdown-- if (this.countdown !== 0) { - this.codeMsg = "閲嶆柊鍙戦��(" + this.countdown + ")"; + this.codeMsg = "閲嶆柊鍙戦��(" + this.countdown + ")" } else { - clearInterval(this.timer); - this.codeMsg = "鑾峰彇楠岃瘉鐮�"; - this.countdown = 60; - this.timer = null; - this.codeDisabled = false; + clearInterval(this.timer) + this.codeMsg = "鑾峰彇楠岃瘉鐮�" + this.countdown = 60 + this.timer = null + this.codeDisabled = false } } }, choseProd(order, prod) { - debugger; - this.curOrder = order; - this.curProd = prod; + this.curOrder = order + this.curProd = prod }, getVersionName(s) { switch (s) { case "alpha": - return "SmartAI鍐呮祴鐗�"; + return "鍐呮祴鐗�" case "beta": - return "SmartAI鍏祴鐗�"; + return "鍏祴鐗�" case "trial": - return "SmartAI璇曠敤鐗�"; + return "璇曠敤鐗�" case "test": - return "SmartAI娴嬭瘯鐗�"; + return "娴嬭瘯鐗�" case "official": - return "SmartAI姝e紡鐗�"; + return "姝e紡鐗�" default: - return "SmartAI瀹氬埗鐗�"; - break; + return "瀹氬埗鐗�" + break } }, loginShop() { @@ -345,116 +308,116 @@ if (valid) { let param = { phoneNum: this.phone.phoneNum, - verifyCode: this.phone.verifyCode, - }; + verifyCode: this.phone.verifyCode + } loginShopInSmart(param).then((res) => { - this.innerDialog = true; - this.activeDialog = false; - this.token = res.data.access_token; + 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; + this.orderList = res.data.list + this.loadingOrders = false } else { - this.$notify.error("鑾峰彇璁㈠崟鍒楄〃澶辫触"); + this.$notify.error("鑾峰彇璁㈠崟鍒楄〃澶辫触") } }) .catch(() => { - this.$notify.error("鑾峰彇璁㈠崟鍒楄〃澶辫触"); - }); - }); + this.$notify.error("鑾峰彇璁㈠崟鍒楄〃澶辫触") + }) + }) } else { - this.nullRule = {}; + this.nullRule = {} } - }); + }) }, cancelLogin() { - this.innerVisible = false; + this.innerVisible = false }, getCode() { - var pattern = /^1[345789]\d{9}$/; + var pattern = /^1[345789]\d{9}$/ if (this.phone.phoneNum == "") { - this.$refs["phoneLogin"].fields[0].validateMessage = "璇疯緭鍏ユ墜鏈哄彿"; - this.$refs["phoneLogin"].fields[0].validateState = "error"; - return; + 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; + 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); + this.codeDisabled = true + this.getValidStr() + this.timer = setInterval(this.getValidStr, 1000) getSmsCode({ phoneNum: this.phone.phoneNum }) .then((res) => { - this.gotCode = true; + this.gotCode = true }) .catch((err) => { - this.$refs["phoneLogin"].fields[0].validateMessage = err.data.msg; - this.$refs["phoneLogin"].fields[0].validateState = "error"; - }); + 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; + 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; + this.$notify.success("婵�娲绘垚鍔�") + this.validateSn() + this.goToSysInfo() + this.activeDialog = false } else { - this.$notify.error(res.msg); + this.$notify.error(res.msg) } }) .catch((err) => { - this.$notify.error(err.msg); - }); + this.$notify.error(err.msg) + }) }, goToSysInfo() { - window.parent.postMessage({ msg: `toVindicate?menu=绯荤粺淇℃伅` }, "*"); + window.parent.postMessage({ msg: `toVindicate?menu=绯荤粺淇℃伅` }, "*") }, gotoActive() { - this.activeDialog = true; + this.activeDialog = true }, uploadKey(params) { - debugger; - let param = new FormData(); - param.append("code", params.file); + let param = new FormData() + param.append("code", params.file) uploadKey(param).then( (res) => { if (res.code == 200) { - this.$message.success("瀵煎叆鎴愬姛"); - this.secrectKey = res.data; + this.$message.success("瀵煎叆鎴愬姛") + this.secrectKey = res.data } else { - this.$message.error(res.msg); + this.$message.error(res.msg) } }, (err) => { - this.$message.error(err.msg); + this.$message.error(err.msg) } - ); + ) }, onInput(val) { if (this[`input${val}`].length == 4 && val < 5) { - this.$refs[`input${val + 1}`].focus(); + this.$refs[`input${val + 1}`].focus() } if (this[`input${val}`].length == 0 && val > 0) { - this.$refs[`input${val - 1}`].focus(); + this.$refs[`input${val - 1}`].focus() } - }, - }, -}; + } + } +} </script> -<style lang="scss" > +<style lang="scss"> .desktop { width: 100%; height: 100%; @@ -674,6 +637,7 @@ } } .el-dialog.my-order { + border-radius: 24px; .el-dialog__body { padding: 22px 20px; } @@ -681,7 +645,7 @@ display: flex; justify-content: right; .cancel { - width: 140px; + width: 140px; height: 40px; cursor: pointer; @@ -695,7 +659,7 @@ justify-content: center; } .ok { - width: 140px; + width: 140px; height: 40px; cursor: pointer; border-radius: 20px; @@ -710,14 +674,13 @@ } } .tip { - width: auto; - /* height: 40px; */ + width: auto; display: -webkit-box; display: -ms-flexbox; display: flex; padding: 0 10px; border-radius: 5px; - color: #5F5F5F; + color: #5f5f5f; line-height: 20px; font-weight: bold; -ms-flex-align: center; @@ -742,10 +705,8 @@ 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 { @@ -763,10 +724,12 @@ display: flex; flex-direction: column; justify-content: space-evenly; - height: 110px; text-align: left; box-sizing: border-box; - padding: 0 20px; + font-size: 13px; + + padding: 8px 20px; + line-height: 20px; } } } @@ -802,4 +765,4 @@ margin-left: 25px; } } -</style> \ No newline at end of file +</style> -- Gitblit v1.8.0