ZZJ
2022-01-26 1e09a7a01a6c1888e1a2a832eb007fb8c2b653a0
src/pages/desktop/index/components/Desktop.vue
@@ -11,8 +11,11 @@
    ></safari>
    <div class="warn-tag" v-if="showFreeVersion">
      <span class="text"
      <span v-if="!snExpire" class="text"
        >试用版尚未激活,仅支持部分功能使用,如需使用全部功能,请尽快激活系统。</span
      >
      <span v-else class="text"
        >SmartAIOS 试用期已到期,请您尽快激活系统</span
      >
      <span class="go-to" @click="gotoActive">前往激活</span>
      <span class="icon iconfont" @click="showFreeVersion = false"
@@ -22,7 +25,7 @@
    <el-dialog
      title="激活SmartAI"
      :visible.sync="dialogVisible"
      :visible.sync="activeDialog"
      width="750px"
      :show-close="false"
      :close-on-click-modal="false"
@@ -35,8 +38,8 @@
      <el-divider></el-divider>
      <div class="info">
        如果还没有产品密钥,你可以使用手机扫码或前往此链接
        <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>
@@ -46,7 +49,6 @@
      <div class="ask">
        如果你具有SmartAI提供的产品密钥,请在此处输入激活SmartAI。
      </div>
      <div class="validate">
        <form id="myForm">
          <el-input
@@ -71,7 +73,8 @@
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">继续试用</el-button>
        <el-button v-if="!snExpire" @click="activeDialog = false">继续试用</el-button>
        <el-button v-else @click="quit">退出登录</el-button>
        <el-button type="primary" @click="activateVersion">激活</el-button>
      </span>
    </el-dialog>
@@ -96,19 +99,24 @@
  data() {
    return {
      showFreeVersion: false,
      dialogVisible: false,
      activeDialog: false,
      version: "SmartAI试用版",
      versionState: "尚未激活",
      secrectKey: "",
      snExpire: false
    };
  },
  mounted() {
    this.validateSn();
  },
  methods: {
    quit(){
      this.$emit("quit")
    },
    validateSn() {
      getSN().then((res) => {
        this.showFreeVersion = res.data.sn == "";
        this.snExpire = res.data.expire;
        this.showFreeVersion = res.data.sn == "" || res.data.expire;
      });
    },
    activateVersion() {
@@ -118,11 +126,12 @@
      }
      activateVersion({ code: this.secrectKey.trim() })
        .then((res) => {
          debugger
          if (res.code == 200) {
            this.$notify.success("激活成功");
            this.validateSn();
            this.goToSysInfo();
            this.dialogVisible = false;
            this.activeDialog = false;
          } else {
            this.$notify.error(res.msg);
          }
@@ -135,18 +144,23 @@
      window.parent.postMessage({ msg: `toVindicate?menu=系统信息` }, "*");
    },
    gotoActive() {
      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);
        }
      );
    },