<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>
|
|
<div class="warn-tag" v-if="showFreeVersion">
|
<span v-if="!snExpire" class="text"
|
>试用版尚未激活,仅支持使用部分功能,如需使用全部功能,请尽快激活。</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
|
>
|
</div>
|
</div>
|
|
<el-dialog
|
title="激活SmartAI"
|
:visible.sync="activeDialog"
|
width="640px"
|
custom-class="my-activate"
|
:show-close="false"
|
:close-on-click-modal="false"
|
:close-on-press-escape="false"
|
>
|
<el-dialog
|
width="30%"
|
title="账户激活"
|
custom-class="my-account"
|
:visible.sync="innerVisible"
|
append-to-body
|
class="inner-login-dialog"
|
>
|
<div class="info">
|
<span style="font-size: 14px; line-height: 21px; color: #5f5f5f">
|
请输入你在SmartAI商城账户的手机号并完成验证码校验,实现系统激活!
|
</span>
|
</div>
|
<div class="login-content">
|
<el-form
|
:model="phone"
|
: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" 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"
|
placeholder="请输入验证码"
|
>
|
<i slot="prefix" class="el-icon-message"></i>
|
<el-button
|
class="code-btn"
|
slot="suffix"
|
style="margin-left: 15px"
|
:disabled="codeDisabled"
|
@click="getCode"
|
>{{ codeMsg }}</el-button
|
>
|
</el-input>
|
</el-form-item>
|
</el-form>
|
</div>
|
<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
|
>
|
</div>
|
</span>
|
</el-dialog>
|
<div class="ver">
|
<span class="ver-text">版本:</span>{{ versionName }}
|
</div>
|
<div class="ver">
|
<span class="ver-text">状态:</span>尚未激活
|
</div>
|
<el-divider></el-divider>
|
<div class="info" v-if="versionName == 'SmartAI正式版'">
|
<span style="font-weight: bold; font-size: 18px">· </span>
|
<span style="font-size: 14px; line-height: 21px; color: #5f5f5f">
|
如果您已连接到Internet并且已购买产品密钥,可以尝试验证SmartAI商城账户激活系统。
|
</span>
|
<div style="padding: 15px 0">
|
<el-button type="primary" @click="innerVisible = true">
|
账户激活
|
</el-button>
|
</div>
|
</div>
|
<div class="info" v-if="versionName == 'SmartAI正式版'">
|
<span style="font-weight: bold; font-size: 18px">· </span>
|
<span style="font-size: 14px; line-height: 21px; color: #5f5f5f">
|
如果您未连接Internet或激活失败,可尝试离线激活,请用手机扫码购买产品或验证SmartAI商城账户激活系统。
|
</span>
|
</div>
|
<div class="info" v-if="versionName !== 'SmartAI正式版'">
|
<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
|
>
|
购买。
|
</span>
|
</div>
|
<img class="qr-code-img" src="/version/offline/qrcode" />
|
<div class="ask">
|
<span style="font-weight: bold; font-size: 18px">· </span>
|
<span style="font-size: 14px; line-height: 21px; color: #5f5f5f">
|
如果您有SmartAI提供的产品密钥,请在此处输入,激活SmartAI。
|
</span>
|
</div>
|
<div class="validate">
|
<form id="myForm">
|
<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-button size="small" type="primary">导入密钥</el-button>
|
</el-upload>
|
</div>
|
<!-- <el-divider></el-divider> -->
|
|
<span slot="footer" class="dialog-footer">
|
<div class="btns">
|
<el-button
|
v-if="!snExpire && versionName != 'SmartAI正式版'"
|
class="cancel"
|
@click="activeDialog = false"
|
>继续试用</el-button
|
>
|
<el-button
|
class="cancel"
|
v-if="snExpire && versionName != 'SmartAI正式版'"
|
@click="$emit('quit')"
|
>退出登陆
|
</el-button>
|
<el-button class="ok" type="primary" @click="activateVersion"
|
>激活</el-button
|
>
|
</div>
|
</span>
|
</el-dialog>
|
|
<el-dialog
|
title="我的订单"
|
:visible.sync="innerDialog"
|
width="750px"
|
:show-close="true"
|
: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>订单生成日期:{{ item.createTime }}</div>
|
<div>产品名称:{{ prod.productName }}</div>
|
<div>产品类型:{{ prod.productTypeName }}</div>
|
<div>系统版本:{{ prod.edition }}</div>
|
<div>通道数量:{{ prod.ChCount }}</div>
|
<div>授权数量:{{ prod.authCount }}</div>
|
<div>起止服务时间 :{{ startAndEnd(item.createTime, prod.serveYear) }}</div>
|
</div>
|
</div>
|
</div>
|
</div>
|
<div class="no-order-list" v-else>
|
{{loadingOrders?"订单加载中,请稍后...":"抱歉,未查询到订单信息!"}}
|
</div>
|
<span slot="footer" class="dialog-footer">
|
<div class="btns">
|
<el-button class="cancel" @click="$emit('quit')">退出登录</el-button>
|
<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 {
|
getActiveQrCode,
|
getSN,
|
activateVersion,
|
uploadKey,
|
getSmsCode,
|
loginShopInSmart,
|
getShopOrderList,
|
activeByOrder,
|
} from "@/api/system";
|
export default {
|
name: "Desktop",
|
components: {
|
DFrame,
|
Safari,
|
},
|
data() {
|
return {
|
showFreeVersion: false,
|
activeDialog: false,
|
countdown: 60,
|
innerDialog: false,
|
versionName: "",
|
codeMsg: "获取验证码",
|
secrectKey: "",
|
curOrder: {},
|
curProd: {},
|
codeDisabled: false,
|
innerVisible: false,
|
snExpire: false,
|
timer: null,
|
token: "",
|
loadingOrders:true,
|
orderList: [],
|
phone: {
|
phoneNum: "",
|
verifyCode: "",
|
},
|
phoneCodeRule: {
|
phoneNum: [{ validator: isPhone, trigger: "blur" }],
|
verifyCode: [
|
{ required: true, message: "请输入验证码", trigger: "blur" },
|
],
|
},
|
};
|
},
|
created() {
|
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,
|
}).then((res) => {
|
if (res.code == 200) {
|
this.$notify.success("激活成功");
|
this.innerDialog = false;
|
this.versionName = this.getVersionName(res.data.edition);
|
} else {
|
this.$notify.error("激活失败");
|
}
|
});
|
},
|
validateSn() {
|
getSN().then((res) => {
|
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--;
|
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正式版";
|
default:
|
return "SmartAI定制版";
|
break;
|
}
|
},
|
loginShop() {
|
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;
|
this.loadingOrders = false
|
} 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.activeDialog = 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 lang="scss" >
|
.desktop {
|
width: 100%;
|
height: 100%;
|
.el-dialog__header {
|
padding: 14px 20px 13px;
|
text-align: center;
|
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.08);
|
.el-dialog__title {
|
font-weight: 600;
|
font-size: 18px;
|
color: #5f5f5f;
|
line-height: 25px;
|
}
|
}
|
.el-dialog__body {
|
text-align: left;
|
padding: 30px;
|
padding-top: 20px;
|
}
|
.el-divider--horizontal {
|
margin: 20px 0;
|
}
|
.validate {
|
display: flex;
|
align-items: baseline;
|
margin-top: 15px;
|
.upload-demo {
|
.el-button--small {
|
font-size: 14px;
|
border-radius: 3px;
|
border-radius: 16px;
|
background-color: var(--colorCard) !important;
|
border-color: var(--colorCard) !important;
|
min-width: 120px;
|
}
|
}
|
}
|
#myForm {
|
display: flex;
|
align-items: center;
|
margin-right: 10px;
|
.el-textarea__inner {
|
min-height: 32px;
|
height: 32px;
|
border: 1px solid #d4d6d9;
|
box-sizing: border-box;
|
border-radius: 16px;
|
}
|
|
.single-input {
|
margin: 0 8px;
|
width: 60px;
|
}
|
}
|
.ver {
|
margin-bottom: 10px;
|
font-size: 16px;
|
color: #5f5f5f;
|
font-weight: bold;
|
.ver-text {
|
color: #666666;
|
font-weight: 400;
|
}
|
}
|
.info {
|
margin-bottom: 10px;
|
.el-button--primary {
|
font-size: 14px;
|
color: #fff;
|
background-color: var(--colorCard);
|
border-color: #4e94ff !important;
|
background: #4e94ff !important;
|
border-radius: 16px;
|
width: 200px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
height: 32px;
|
line-height: 32px;
|
}
|
}
|
.ask {
|
margin-top: 20px;
|
font-size: 15px;
|
}
|
}
|
|
.el-dialog.my-account {
|
border-radius: 24px;
|
.btns {
|
display: flex;
|
justify-content: right;
|
.cancel {
|
width: 76px;
|
height: 40px;
|
cursor: pointer;
|
border-radius: 20px;
|
line-height: 40px;
|
font-size: 14px;
|
color: var(--colorCard);
|
border-color: var(--colorCard) !important;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
.ok {
|
width: 76px;
|
height: 40px;
|
cursor: pointer;
|
border-radius: 20px;
|
background-color: var(--colorCard) !important;
|
border-color: var(--colorCard) !important;
|
color: #fff;
|
line-height: 40px;
|
font-size: 14px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
}
|
.login-content {
|
box-sizing: border-box;
|
.el-input__prefix {
|
left: 20px;
|
transition: all 0.3s;
|
font-size: 20px;
|
}
|
.el-input__suffix-inner {
|
.code-btn {
|
padding: 6px 20px;
|
border: none;
|
border-left: 1px solid #d4d6d9;
|
color: var(--colorCard);
|
}
|
.code-btn:hover {
|
background: none;
|
}
|
}
|
.el-input__inner {
|
background-color: #ffffff;
|
border: 1px solid #d4d6d9;
|
box-sizing: border-box;
|
color: #606266;
|
display: inline-block;
|
font-size: 14px;
|
height: 40px;
|
line-height: 40px;
|
outline: none;
|
padding: 0 50px;
|
transition: border-color 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
|
width: 100%;
|
border-radius: 20px;
|
}
|
}
|
.el-dialog__footer {
|
padding: 30px;
|
text-align: left;
|
box-sizing: border-box;
|
box-shadow: 0px -1px 0px rgb(0 0 0 / 8%);
|
}
|
.el-dialog__header {
|
padding: 14px 20px 13px;
|
text-align: center;
|
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.08);
|
.el-dialog__title {
|
font-weight: 600;
|
font-size: 18px;
|
color: #5f5f5f;
|
line-height: 25px;
|
}
|
}
|
.el-dialog__body {
|
padding: 30px 30px 10px 30px;
|
}
|
.info {
|
text-align: left;
|
}
|
}
|
.el-dialog.my-activate {
|
border-radius: 24px;
|
.el-dialog__footer {
|
padding: 30px;
|
text-align: left;
|
box-sizing: border-box;
|
box-shadow: 0px -1px 0px rgb(0 0 0 / 8%);
|
.btns {
|
display: flex;
|
.cancel {
|
width: 140px;
|
height: 40px;
|
cursor: pointer;
|
border-radius: 20px;
|
line-height: 40px;
|
font-size: 14px;
|
color: var(--colorCard);
|
border-color: var(--colorCard) !important;
|
margin-right: 12px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
.ok {
|
width: 140px;
|
height: 40px;
|
cursor: pointer;
|
border-radius: 20px;
|
background-color: var(--colorCard) !important;
|
border-color: var(--colorCard) !important;
|
color: #fff;
|
line-height: 40px;
|
font-size: 14px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
}
|
}
|
}
|
.el-dialog.my-order {
|
border-radius: 24px;
|
.el-dialog__body {
|
padding: 22px 20px;
|
}
|
.btns {
|
display: flex;
|
justify-content: right;
|
.cancel {
|
width: 140px;
|
|
height: 40px;
|
cursor: pointer;
|
border-radius: 20px;
|
line-height: 40px;
|
font-size: 14px;
|
color: var(--colorCard);
|
border-color: var(--colorCard) !important;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
.ok {
|
width: 140px;
|
height: 40px;
|
cursor: pointer;
|
border-radius: 20px;
|
background-color: var(--colorCard) !important;
|
border-color: var(--colorCard) !important;
|
color: #fff;
|
line-height: 40px;
|
font-size: 14px;
|
display: flex;
|
align-items: center;
|
justify-content: center;
|
}
|
}
|
.tip {
|
width: auto;
|
display: -webkit-box;
|
display: -ms-flexbox;
|
display: flex;
|
padding: 0 10px;
|
border-radius: 5px;
|
color: #5f5f5f;
|
line-height: 20px;
|
font-weight: bold;
|
-ms-flex-align: center;
|
align-items: center;
|
justify-content: center;
|
i {
|
margin-right: 5px;
|
font-size: 24px;
|
color: var(--colorCard);
|
}
|
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;
|
text-align: left;
|
box-sizing: border-box; font-size: 13px;
|
|
padding: 8px 20px; line-height: 20px;
|
}
|
}
|
}
|
}
|
.warn-tag {
|
width: 630px;
|
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% - 315px);
|
line-height: 45px;
|
border-radius: 5px;
|
.go-to {
|
color: var(--colorCard);
|
cursor: pointer;
|
text-decoration: underline;
|
font-weight: 600;
|
font-size: 14px;
|
}
|
.text {
|
font-size: 14px;
|
}
|
.icon {
|
font-size: 14px;
|
cursor: pointer;
|
margin-left: 25px;
|
}
|
}
|
</style>
|