zhangzengfei
2022-07-31 85391dc1a2458202bdf0fb7a5394022aa17b9126
完善系统oem配置
4个文件已修改
1103 ■■■■■ 已修改文件
public/apps/loginData/login.json 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/ai/index/detail.vue 669 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/login/index/App.vue 198 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/pages/vindicate/views/sysInfo.vue 232 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
public/apps/loginData/login.json
@@ -1,5 +1,7 @@
{
    "title_firstLine": "Smart AI",
    "title_secondLine": "人工智能操作系统",
    "website": "www.smartai.com"
    "website": "www.smartai.com",
    "product_name": "Smart AIOS",
    "copyright": "Copyright © 北京贝思科技术有限公司"
}
src/pages/ai/index/detail.vue
@@ -8,33 +8,14 @@
        <div class="right-info">
          <div class="right-info-1">
            <span class="name">{{ productDetail.productName }}</span>
            <el-tag type="info" size="mini" color="#fff">{{
              isSDKDetail ? "算法" : "应用"
            }}</el-tag>
            <el-tag type="info" size="mini" color="#fff">{{ isSDKDetail ? "算法" : "应用" }}</el-tag>
          </div>
          <div class="right-info-2">
            <el-button
              size="mini"
              round
              class="update-btn"
              @click="upgradeSDKinWin"
              v-if="productDetail.isUpgrade"
            <el-button size="mini" round class="update-btn" @click="upgradeSDKinWin" v-if="productDetail.isUpgrade"
              >更新</el-button
            >
            <el-button
              size="mini"
              round
              v-if="!isSDKDetail && isActive"
              @click="openApp"
              >打开</el-button
            >
            <el-button
              size="mini"
              round
              v-if="isActive && !isDefaultApp"
              @click="unloadSDKinWin"
              >卸载</el-button
            >
            <el-button size="mini" round v-if="!isSDKDetail && isActive" @click="openApp">打开</el-button>
            <el-button size="mini" round v-if="isActive && !isDefaultApp" @click="unloadSDKinWin">卸载</el-button>
            <el-button
              size="mini"
              round
@@ -95,11 +76,7 @@
    <div class="detail-mid">
      <div class="mid-left">
        <div class="mid-title">{{ isSDKDetail ? "应用场景" : "功能特点" }}</div>
        <div
          v-for="(item, index) in productDetail.funcInfo"
          :key="index"
          class="desc-item"
        >
        <div v-for="(item, index) in productDetail.funcInfo" :key="index" class="desc-item">
          <div class="title">{{ item.title }}</div>
          <div class="desc">{{ item.desc }}</div>
        </div>
@@ -109,29 +86,11 @@
          trigger="click"
          :autoplay="false"
          indicator-position="none"
          :arrow="
            productDetail.pics !== undefined
              ? productDetail.pics.length > 1
                ? 'always'
                : 'never'
              : 'never'
          "
          :arrow="productDetail.pics !== undefined ? (productDetail.pics.length > 1 ? 'always' : 'never') : 'never'"
        >
          <el-carousel-item
            v-for="(item, index) in productDetail.pics"
            :key="index"
          >
            <img
              v-if="item.type != 'video'"
              :src="item.url"
              class="cursor-pointer"
              preview
            />
            <video
              v-if="item.type == 'video'"
              :src="'/httpImage/' + item.url"
              controls
            ></video>
          <el-carousel-item v-for="(item, index) in productDetail.pics" :key="index">
            <img v-if="item.type != 'video'" :src="item.url" class="cursor-pointer" preview />
            <video v-if="item.type == 'video'" :src="'/httpImage/' + item.url" controls></video>
          </el-carousel-item>
        </el-carousel>
      </div>
@@ -140,20 +99,11 @@
      <div class="rec-title">{{ isSDKDetail ? "推荐算法" : "推荐应用" }}</div>
      <div class="rec-items">
        <div
          class="rec-item"
          v-for="(item, index) in otherProducts"
          :key="index"
          @click="checkInWindow(item)"
        >
        <div class="rec-item" v-for="(item, index) in otherProducts" :key="index" @click="checkInWindow(item)">
          <div class="icon-img">
            <img
              v-if="item.iconBlob"
              :src="
                item.iconBlob.indexOf(',') > 0
                  ? item.iconBlob
                  : `data:image/png;base64,${item.iconBlob}`
              "
              :src="item.iconBlob.indexOf(',') > 0 ? item.iconBlob : `data:image/png;base64,${item.iconBlob}`"
              alt
            />
          </div>
@@ -164,24 +114,13 @@
            <div class="desc-2">版本 {{ item.productVersion || "2.0.0" }}</div>
          </div>
          <div class="right-btn">
            <el-button
              size="small"
              type="primary"
              round
              @click="checkInWindow(item)"
              >查看</el-button
            >
            <el-button size="small" type="primary" round @click="checkInWindow(item)">查看</el-button>
          </div>
        </div>
      </div>
    </div>
    <el-dialog
      :visible.sync="showActivateSuccess"
      title="激活成功!"
      width="30%"
      class="active-Dial"
    >
    <el-dialog :visible.sync="showActivateSuccess" title="激活成功!" width="30%" class="active-Dial">
      <div class="dialog-active">
        <ul class="desc">
          <li>
@@ -214,13 +153,7 @@
  </div>
</template>
<script>
import {
  findAllSdk,
  downloadSdk,
  installSdk,
  getInstallInfo,
  removeSdk,
} from "./api";
import { findAllSdk, downloadSdk, installSdk, getInstallInfo, removeSdk } from "./api"
import {
  getApps,
  installApp,
@@ -229,26 +162,23 @@
  getUnActivedSdk,
  actPageAlg,
  getUnActivedApp,
  actApp,
} from "@/api/app";
import { getUrlKey } from "@/api/utils";
  actApp
} from "@/api/app"
import { getUrlKey } from "@/api/utils"
export default {
  components: {},
  computed: {
    updateNum() {
      return this.hasNewVersionApp.length + this.hasNewVersionSdk.length;
      return this.hasNewVersionApp.length + this.hasNewVersionSdk.length
    },
    isAdmin() {
      if (
        sessionStorage.getItem("userInfo") &&
        sessionStorage.getItem("userInfo") !== ""
      ) {
        let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username;
        return loginName === "superadmin" || loginName === "basic";
      if (sessionStorage.getItem("userInfo") && sessionStorage.getItem("userInfo") !== "") {
        let loginName = JSON.parse(sessionStorage.getItem("userInfo")).username
        return loginName === "superadmin" || loginName === "basic"
      }
      return false;
    },
      return false
    }
  },
  data() {
    return {
@@ -282,7 +212,7 @@
        setting: "",
        expireTime: "",
        licence: "",
        devIds: "",
        devIds: ""
      },
      installedApps: [],
      storeApps: [],
@@ -302,169 +232,167 @@
      forwardDisable: true,
      showInputCode: false,
      needToUpgradeInWin: false,
      showInstallNotActive: false,
    };
      showInstallNotActive: false
    }
  },
  props: {
    detailType: {
      type: String,
      type: String
    },
    detailProductID: {
      type: String,
      type: String
    },
    detailPrice: {},
    isSdk: {},
    isSdk: {}
  },
  directives: {
    focus: {
      inserted: function (el) {
        el.querySelector("input").focus();
      },
    },
      inserted: function(el) {
        el.querySelector("input").focus()
      }
    }
  },
  mounted() {
    this.getDetail();
    // this.autoRefreshAppAndSdkState();
    this.getDetail()
    this.autoRefreshAppAndSdkState()
    // this.getUnActivedList();
    // this.getUnActivedAppList();
    this.showBackBtn();
    this.addBackListener();
    this.showBackBtn()
    this.addBackListener()
  },
  beforeDestroy() {
    this.autoRefresh = false;
    this.hiddenBackBtn();
    this.autoRefresh = false
    this.hiddenBackBtn()
  },
  methods: {
    getDetail(id) {
      getAppDetail({ id: id || this.detailProductID })
        .then((res) => {
          if (res.success) {
            this.productDetail = res.data.detail;
            this.otherProducts = res.data.randoms;
            this.productDetail = res.data.detail
            this.otherProducts = res.data.randoms
            this.isSDKDetail = this.productDetail.productTypeName == "SDK";
            this.isDefaultApp = this.productDetail.productBaseId.length < 10;
            this.isSDKDetail = this.productDetail.productTypeName == "SDK"
            this.isDefaultApp = this.productDetail.productBaseId.length < 10
          } else {
            this.$message.error(res.msg);
            this.$message.error(res.msg)
          }
        })
        .catch((err) => {
          this.$message.error(err.msg);
        });
      this.isActive = this.detailType == "active";
      this.showInstallNotActive = this.detailType == "activeNotInstall";
          this.$message.error(err.msg)
        })
      this.isActive = this.detailType == "active"
      this.showInstallNotActive = this.detailType == "activeNotInstall"
    },
    goback() {
      this.productDetail = {};
      this.$emit("goback");
      this.productDetail = {}
      this.$emit("goback")
    },
    isShow(authority) {
      return (
        this.isAdmin || this.buttonAuthority.indexOf("," + authority + ",") > -1
      );
      return this.isAdmin || this.buttonAuthority.indexOf("," + authority + ",") > -1
    },
    closeDial() {
      this.productDetailVisible = false;
      this.productDetail = {};
      this.otherProducts = [];
      this.productDetailVisible = false
      this.productDetail = {}
      this.otherProducts = []
    },
    resetStack() {
      this.forwardStack = [];
      this.backStack = [];
      this.backDisable = true;
      this.forwardDisable = true;
      this.forwardStack = []
      this.backStack = []
      this.backDisable = true
      this.forwardDisable = true
    },
    checkInWindow(item) {
      getAppDetail({ id: item.id }).then((res) => {
        this.productDetail = res.data.detail;
        this.productDetail.iconBlob = item.iconBlob;
        this.actId = this.productDetail.productBaseId;
        this.isSDKDetail = this.productDetail.productTypeName == "SDK";
        this.isDefaultApp = this.productDetail.productBaseId.length < 10;
        this.productDetail = res.data.detail
        this.productDetail.iconBlob = item.iconBlob
        this.actId = this.productDetail.productBaseId
        this.isSDKDetail = this.productDetail.productTypeName == "SDK"
        this.isDefaultApp = this.productDetail.productBaseId.length < 10
        this.otherProducts = res.data.randoms;
      });
        this.otherProducts = res.data.randoms
      })
    },
    checkIsDefOrNot(id) {
      if (id.length > 10) {
        this.isDefaultApp = false;
        this.isDefaultApp = false
      } else {
        this.isDefaultApp = true;
        this.isDefaultApp = true
      }
    },
    backwards() {
      if (this.backStack.length == 0) {
        this.backDisable = true;
        return;
        this.backDisable = true
        return
      }
      this.forwardStack.push([this.productDetail, this.otherProducts]);
      let item = this.backStack.pop();
      this.productDetail = item[0];
      this.checkIsDefOrNot(this.productDetail.productBaseId);
      this.otherProducts = item[1];
      this.forwardDisable = false;
      this.forwardStack.push([this.productDetail, this.otherProducts])
      let item = this.backStack.pop()
      this.productDetail = item[0]
      this.checkIsDefOrNot(this.productDetail.productBaseId)
      this.otherProducts = item[1]
      this.forwardDisable = false
      if (this.backStack.length == 0) {
        this.backDisable = true;
        this.backDisable = true
      }
    },
    forwards() {
      if (this.forwardStack.length == 0) {
        this.forwardDisable = true;
        return;
        this.forwardDisable = true
        return
      }
      this.backStack.push([this.productDetail, this.otherProducts]);
      this.backDisable = false;
      let item = this.forwardStack.pop();
      this.backStack.push([this.productDetail, this.otherProducts])
      this.backDisable = false
      let item = this.forwardStack.pop()
      this.productDetail = item[0];
      this.otherProducts = item[1];
      this.productDetail = item[0]
      this.otherProducts = item[1]
      if (this.forwardStack.length == 0) {
        this.forwardDisable = true;
        this.forwardDisable = true
      }
    },
    //离线安装
    offlineInstall() {
      this.installDialogVisible = false;
      this.isInstall = true;
      this.installDialogVisible = false
      this.isInstall = true
      //安装
      installSdk(this.installFile)
        .then((res) => {
          if (res.success) {
            this.isInstall = false;
            this.isInstall = false
            this.$message({
              type: "success",
              message: '安装成功,将跳转至"已激活"中查看',
            });
              message: '安装成功,将跳转至"已激活"中查看'
            })
            setTimeout(() => {
              this.getAllSdk();
              this.getAllSdk()
              window.parent.postMessage(
                {
                  msg: "AppUpdate",
                  msg: "AppUpdate"
                },
                "*"
              );
              this.activeName = "myAlgorithm";
            }, 3000);
              )
              this.activeName = "myAlgorithm"
            }, 3000)
          }
        })
        .catch((e) => {
          console.log(e);
          this.isInstall = false;
          console.log(e)
          this.isInstall = false
          this.$message({
            type: "error",
            message: e.msg,
          });
        });
            message: e.msg
          })
        })
    },
    downloadApp(app, action) {
      if (action == "upgrade") {
        app.upgradeLoading = true;
        app.upgradeLoading = true
      } else {
        app.installLoading = true;
        app.installLoading = true
      }
      let _this = this;
      let _this = this
      installApp({ path: app.id })
        .then((res) => {
@@ -472,21 +400,21 @@
            _this.$notify({
              title: "成功",
              message: "安装应用成功",
              type: "success",
            });
              type: "success"
            })
            setTimeout(() => {
              if (action == "upgrade") {
                app.upgradeLoading = false;
                app.upgradeLoading = false
              } else {
                app.installLoading = false;
                app.installLoading = false
              }
              window.parent.postMessage(
                {
                  msg: "AppUpdate",
                  msg: "AppUpdate"
                },
                "*"
              );
            }, 3000);
              )
            }, 3000)
          } else {
          }
        })
@@ -494,94 +422,91 @@
          _this.$notify({
            title: "安装失败",
            message: e.data,
            type: "warning",
          });
            type: "warning"
          })
          if (action == "upgrade") {
            app.upgradeLoading = false;
            app.upgradeLoading = false
          } else {
            app.installLoading = false;
            app.installLoading = false
          }
        });
        })
      // 开启自动刷新
      this.appUpgreading = true;
      this.appUpgreading = true
    },
    async getAllApps() {
      let iArry = [],
        sArry = [],
        nArry = [];
      let rsp = await getApps();
        nArry = []
      let rsp = await getApps()
      if (rsp && rsp.success) {
        // 遍历app的过程重置
        this.appUpgreading = false;
        this.appUpgreading = false
        rsp.data.forEach((item) => {
          let obj = Object.assign(
            { unloadLoading: false, upgradeLoading: false },
            item
          );
          let obj = Object.assign({ unloadLoading: false, upgradeLoading: false }, item)
          if (obj.progressMsg !== "" && obj.progressMsg !== "已安装") {
            obj.upgradeLoading = true;
            this.appUpgreading = true;
            obj.upgradeLoading = true
            this.appUpgreading = true
          }
          if (obj.upgradeDone) {
            this.$notify({
              type: "success",
              message: 1 ? "算法安装成功" : "算法升级成功",
            });
              message: 1 ? "算法安装成功" : "算法升级成功"
            })
          }
          item.installed ? iArry.push(obj) : sArry.push(obj);
          item.isUpgrade && nArry.push(obj);
        });
          item.installed ? iArry.push(obj) : sArry.push(obj)
          item.isUpgrade && nArry.push(obj)
        })
      }
      this.installedApps = iArry;
      this.storeApps = sArry;
      this.hasNewVersionApp = nArry;
      this.installedApps = iArry
      this.storeApps = sArry
      this.hasNewVersionApp = nArry
    },
    unLoad(app) {
      let _this = this;
      let _this = this
      this.$confirm("确定要卸载该应用吗?", "提示")
        .then(() => {
          _this.productDetailVisible = false;
          app.unloadLoading = true;
          _this.productDetailVisible = false
          app.unloadLoading = true
          removeApp({ appId: app.id })
            .then((res) => {
              if (res && res.success) {
                app.unloadLoading = false;
                this.$emit("flushApp");
                app.unloadLoading = false
                this.$emit("flushApp")
                window.parent.postMessage(
                  {
                    msg: "AppUpdate",
                    msg: "AppUpdate"
                  },
                  "*"
                );
                )
                _this.$notify({
                  title: "成功",
                  message: "卸载应用成功",
                  type: "success",
                });
                this.goback();
                  type: "success"
                })
                this.goback()
              }
            })
            .catch((e) => {
              app.unloadLoading = false;
            });
              app.unloadLoading = false
            })
        })
        .catch((e) => {});
        .catch((e) => {})
    },
    actSdkOrApp(item, type = "sdk") {
      this.checkDetail(item, "inactive");
      this.actType = type;
      this.actId = item.id;
      this.actStep = 0;
      this.activeCode = "";
      this.activedSdkOrApp = this.newActInfo();
      this.checkDetail(item, "inactive")
      this.actType = type
      this.actId = item.id
      this.actStep = 0
      this.activeCode = ""
      this.activedSdkOrApp = this.newActInfo()
    },
    cancelActivate() {
      this.showInputCode = false;
      this.activeCode = "";
      this.showInputCode = false
      this.activeCode = ""
    },
    newActInfo() {
      return {
@@ -590,324 +515,321 @@
        setting: "",
        expireTime: "",
        licence: "",
        devIds: "",
      };
        devIds: ""
      }
    },
    getUnActivedList() {
      getUnActivedSdk().then((res) => {
        if (res.code == 200) {
          this.unActivedSDKList = res.data;
          this.unActivedSDKList = res.data
        }
      });
      })
    },
    getUnActivedAppList() {
      getUnActivedApp().then((res) => {
        if (res.code == 200) {
          this.unActivedAppList = res.data;
          this.unActivedAppList = res.data
        }
      });
      })
    },
    actived() {
      let _this = this;
      let _this = this
      if (this.activeCode.trim() == "") {
        this.$notify({
          type: "error",
          message: "激活码不能为空",
        });
        return;
          message: "激活码不能为空"
        })
        return
      }
      if (this.isSdk) {
        //激活算法
        actPageAlg(this.detailProductID, this.activeCode)
          .then((res) => {
            if (res.data.isSuccess) {
              this.productDetailVisible = false;
              _this.activedSdkOrApp = res.data.successMsg;
              this.showActivateSuccess = true;
              _this.actStep++;
              _this.getUnActivedList();
              _this.getAllSdk();
              this.productDetailVisible = false
              _this.activedSdkOrApp = res.data.successMsg
              this.showActivateSuccess = true
              _this.actStep++
              _this.getUnActivedList()
              _this.getAllSdk()
            } else {
              _this.$notify({
                type: "error",
                message: res.data.failMsg.failMsg,
              });
                message: res.data.failMsg.failMsg
              })
            }
          })
          .catch((e) => {
            this.$notify({
              type: "error",
              message: e.msg,
            });
          });
              message: e.msg
            })
          })
      } else {
        //激活应用
        actApp(this.detailProductID, this.activeCode)
          .then((res) => {
            if (res.data.isSuccess) {
              this.productDetailVisible = false;
              _this.activedSdkOrApp = res.data.successMsg;
              this.showActivateSuccess = true;
              _this.actStep++;
              _this.getUnActivedAppList();
              _this.getAllApps();
              this.productDetailVisible = false
              _this.activedSdkOrApp = res.data.successMsg
              this.showActivateSuccess = true
              _this.actStep++
              _this.getUnActivedAppList()
              _this.getAllApps()
            } else {
              _this.$notify({
                type: "error",
                message: res.data.failMsg.failMsg,
              });
                message: res.data.failMsg.failMsg
              })
            }
          })
          .catch((e) => {
            this.$notify({
              type: "error",
              message: e.msg,
            });
          });
              message: e.msg
            })
          })
      }
    },
    checkMyAlgorith() {
      this.showActivateSuccess = false;
      this.goback();
      this.activeName = "已激活";
      this.showActivateSuccess = false
      this.goback()
      this.activeName = "已激活"
    },
    onFileUpload(file) {
      this.patchFile = { ...file };
      this.fileAdded = true;
      const h = this.$createElement;
      this.patchFile = { ...file }
      this.fileAdded = true
      const h = this.$createElement
      //上传完成获取安装信息
      let _this = this;
      let _this = this
      getInstallInfo(file)
        .then((res) => {
          _this.installFile = file;
          _this.installFile = file
          if (res.success) {
            _this.installDialogVisible = true;
            _this.installDialogVisible = true
            if (res.data.apps.length > 0) {
              _this.installAppPackage = {
                appId: res.data.apps[0].appId,
                version: res.data.apps[0].version,
                productName: res.data.productName,
                installContent: res.data.apps[0].installContent,
              };
                installContent: res.data.apps[0].installContent
              }
            }
            if (res.data.sdks.length > 0) {
              _this.installSdkPackage = {
                appId: res.data.sdks[0].sdkId,
                version: res.data.sdks[0].version,
                productName: res.data.productName,
                installContent: res.data.sdks[0].installContent,
              };
                installContent: res.data.sdks[0].installContent
              }
            }
          } else {
            this.$message({
              type: "error",
              message: res.msg,
            });
              message: res.msg
            })
          }
        })
        .catch((e) => {
          this.$message({
            type: "error",
            message: e.msg,
          });
        });
            message: e.msg
          })
        })
    },
    openApp() {
      window.parent.postMessage(
        { msg: "toOpenApp?" + this.productDetail.productBaseId },
        "*"
      );
      window.parent.postMessage({ msg: "toOpenApp?" + this.productDetail.productBaseId }, "*")
    },
    onFileAdded(f) {
      this.patchUpdateStatus = "";
      this.patchUpdateStatus = ""
    },
    async getAllSdk() {
      let installedList = [];
      let unInstalledList = [];
      let hasNewVersionList = [];
      let res = await findAllSdk();
      let installedList = []
      let unInstalledList = []
      let hasNewVersionList = []
      let res = await findAllSdk()
      if (res && res.success) {
        this.sdkUpgreading = false;
        this.sdkUpgreading = false
        res.data.forEach((item) => {
          let obj = Object.assign(
            { unloadLoading: false, upgradeLoading: false },
            item
          );
          let obj = Object.assign({ unloadLoading: false, upgradeLoading: false }, item)
          if (obj.progressMsg !== "" && obj.progressMsg !== "已安装") {
            obj.upgradeLoading = true;
            this.sdkUpgreading = true;
            obj.upgradeLoading = true
            this.sdkUpgreading = true
          }
          //算法软件 已安装其中包含待升级 未安装
          item.installed ? installedList.push(obj) : unInstalledList.push(obj);
          item.isUpgrade ? hasNewVersionList.push(obj) : null;
        });
          item.installed ? installedList.push(obj) : unInstalledList.push(obj)
          item.isUpgrade ? hasNewVersionList.push(obj) : null
        })
      }
      this.installedList = installedList;
      this.notInstalledList = unInstalledList;
      this.toUpdateArr = this.installedList.slice(0, 4);
      this.hasNewVersionSdk = hasNewVersionList;
      this.installedList = installedList
      this.notInstalledList = unInstalledList
      this.toUpdateArr = this.installedList.slice(0, 4)
      this.hasNewVersionSdk = hasNewVersionList
    },
    unloadSDKinWin() {
      let appToUnload;
      let sdkToUnload;
      let appToUnload
      let sdkToUnload
      if (this.productDetail.productTypeName == "应用") {
        appToUnload = this.installedApps.find((item) => {
          return item.id == this.productDetail.productBaseId;
        });
        this.unLoad(appToUnload);
          return item.id == this.productDetail.productBaseId
        })
        this.unLoad(appToUnload)
      } else {
        sdkToUnload = this.installedList.find((item) => {
          return item.id == this.productDetail.productBaseId;
        });
        this.unLoadSdk(sdkToUnload);
          return item.id == this.productDetail.productBaseId
        })
        this.unLoadSdk(sdkToUnload)
      }
    },
    //卸载算法
    unLoadSdk(sdk) {
      let _this = this;
      let _this = this
      this.$confirm("确定要卸载该算法吗?", "提示")
        .then(() => {
          _this.productDetailVisible = false;
          sdk.unloadLoading = true;
          _this.productDetailVisible = false
          sdk.unloadLoading = true
          removeSdk({ sdkId: sdk.id })
            .then((res) => {
              if (res && res.success) {
                sdk.unloadLoading = false;
                this.$notify.success("卸载完成");
                sdk.unloadLoading = false
                this.$notify.success("卸载完成")
                // _this.getAllSdk();
                this.$emit("flushSdk");
                window.parent.postMessage({ msg: "AppUpdate" }, "*");
                this.goback();
                this.$emit("flushSdk")
                window.parent.postMessage({ msg: "AppUpdate" }, "*")
                this.goback()
              }
            })
            .catch((e) => {
              sdk.unloadLoading = false;
            });
              console.log(e)
              sdk.unloadLoading = false
            })
        })
        .catch((e) => {});
        .catch((e) => {
          console.log("取消", e)
        })
    },
    upgradeSDKinWin() {
      this.isUpgrading = !this.isUpgrading;
      this.isUpgrading = !this.isUpgrading
      if (this.productDetail.productTypeName == "应用") {
        installApp({ path: this.productDetail.productBaseId })
          .then((res) => {
            if (res && res.success) {
              this.$notify.success("升级完成");
              this.needToUpgradeInWin = false;
              this.productDetail.isUpgrade = false;
              this.isUpgrading = !this.isUpgrading;
              this.$notify.success("升级完成")
              this.needToUpgradeInWin = false
              this.productDetail.isUpgrade = false
              this.isUpgrading = !this.isUpgrading
            }
          })
          .catch((e) => {
            this.$notify.error("升级失败");
            this.isUpgrading = !this.isUpgrading;
          });
            this.$notify.error("升级失败")
            this.isUpgrading = !this.isUpgrading
          })
        // 开启自动刷新
        this.appUpgreading = true;
        this.appUpgreading = true
      } else {
        downloadSdk({ path: this.productDetail.productBaseId })
          .then((res) => {
            this.needToUpgradeInWin = false;
            this.productDetail.isUpgrade = false;
            this.isUpgrading = !this.isUpgrading;
            this.$notify.success("升级完成");
            this.needToUpgradeInWin = false
            this.productDetail.isUpgrade = false
            this.isUpgrading = !this.isUpgrading
            this.$notify.success("升级完成")
          })
          .catch((err) => {
            this.$notify.error("升级失败");
            this.isUpgrading = !this.isUpgrading;
          });
        this.sdkUpgreading = true;
            this.$notify.error("升级失败")
            this.isUpgrading = !this.isUpgrading
          })
        this.sdkUpgreading = true
      }
    },
    downloadSdkInSide() {
      this.downloadItem = this.productDetail.productBaseId;
      this.isUpgrading = true;
      this.downloadItem = this.productDetail.productBaseId
      this.isUpgrading = true
      downloadSdk({ path: this.productDetail.productBaseId })
        .then((rsp) => {
          this.productDetailVisible = false;
          this.downloadItem = "";
          this.$notify.success("算法已安装");
          this.isUpgrading = false;
          this.productDetailVisible = false
          this.downloadItem = ""
          this.$notify.success("算法已安装")
          this.isUpgrading = false
        })
        .catch((err) => {
          this.$notify.warning(err.data);
          this.downloadItem = "";
          this.isUpgrading = false;
        });
          this.$notify.warning(err.data)
          this.downloadItem = ""
          this.isUpgrading = false
        })
      // 开启自动刷新
      this.sdkUpgreading = true;
      this.sdkUpgreading = true
    },
    donwload(item, typ) {
      item.upgradeLoading = true;
      this.downloadItem = item.id;
      item.upgradeLoading = true
      this.downloadItem = item.id
      downloadSdk({ path: item.id })
        .then((rsp) => {
          item.upgradeLoading = false;
          this.downloadItem = "";
          item.upgradeLoading = false
          this.downloadItem = ""
          window.parent.postMessage(
            {
              msg: "AppUpdate",
              msg: "AppUpdate"
            },
            "*"
          );
          )
        })
        .catch((err) => {
          this.$notify({
            type: "warning",
            message: err.data,
          });
          item.upgradeLoading = false;
          this.downloadItem = "";
        });
            message: err.data
          })
          item.upgradeLoading = false
          this.downloadItem = ""
        })
      // 开启自动刷新
      this.sdkUpgreading = true;
      this.sdkUpgreading = true
    },
    inputBlur(item) {
      this.$set(item, "isEdit", false);
      this.$set(item, "isEdit", false)
    },
    autoRefreshAppAndSdkState() {
      this.getAllApps();
      this.getAllSdk();
      this.getAllApps()
      this.getAllSdk()
      if (!this.autoRefresh) {
        return;
        return
      }
      setTimeout(() => {
        if (this.appUpgreading) {
          this.getAllApps();
          this.getAllApps()
        }
        if (this.sdkUpgreading) {
          this.getAllSdk();
          this.getAllSdk()
        }
      }, 1000);
      }, 1000)
    },
    showBackBtn() {
      window.parent.postMessage(
        {
          msg: "showBack",
          msg: "showBack"
        },
        "*"
      );
      )
    },
    hiddenBackBtn() {
      window.parent.postMessage(
        {
          msg: "hiddenBack",
          msg: "hiddenBack"
        },
        "*"
      );
      )
    },
    addBackListener() {
      window.addEventListener("message", (e) => {
        if (e.data.msg === "返回应用中心") {
          this.goback();
          this.goback()
        }
      });
    },
  },
};
      })
    }
  }
}
</script>
<style lang="scss">
.detail-page {
@@ -1193,4 +1115,3 @@
  }
}
</style>
src/pages/login/index/App.vue
@@ -59,13 +59,13 @@
  </div> -->
  <div class="login">
    <div class="title">
      <div class="en">{{ data.title_firstLine }}</div>
      <div class="ch">{{ data.title_secondLine }}</div>
      <div class="en">{{ oem.title_firstLine }}</div>
      <div class="ch">{{ oem.title_secondLine }}</div>
    </div>
    <div class="left_footer">
      <img class="logo" src="/apps/loginData/LOGO.png" alt="" />
      <div class="web">{{ data.website }}</div>
      <div class="web">{{ oem.website }}</div>
    </div>
    <div class="login-form" :style="{ background: backgroundColor }">
@@ -115,17 +115,14 @@
</template>
<script>
import { tologin, getLoginUserData, getServerName } from "./api.ts";
import ParticleNetwork from "./ParticleNetwork";
import Licence from "@/components/licence";
import LangSelect from "@/components/langSelect";
import { getMenuListData } from "@/api/utils";
import loginData from "../../../../public/apps/loginData/login.json";
import { tologin, getLoginUserData, getServerName } from "./api.ts"
import { getVasystemInfo } from "@/api/system"
import { getMenuListData } from "@/api/utils"
export default {
  name: "login-pgae",
  metaInfo: {
    title: "登录页",
    title: "登录页"
  },
  components: {
    //  ParticleNetwork,
@@ -139,26 +136,26 @@
          {
            required: true,
            message: this.$t("placeholder.enterUsername"),
            trigger: "change",
          },
            trigger: "change"
          }
        ],
        password: [
          {
            required: true,
            message: this.$t("placeholder.enterPassword"),
            trigger: "change",
          },
        ],
      };
    },
            trigger: "change"
          }
        ]
      }
    }
  },
  data: () => ({
    data: {},
    oem: {},
    serverTitle: "",
    user: {
      loginName: "",
      password: "",
      rememberMe: false,
      rememberMe: false
    },
    nullRule: {},
@@ -167,61 +164,51 @@
    currentHeight: 1057,
    currentWidth: 1920,
    backgroundColor: "",
    backgroundList: [
      "#2A2344",
      "#342344",
      "#000000",
      "#233044",
      "#0B252E",
      "#150051",
      "#110040",
    ],
    backgroundList: ["#2A2344", "#342344", "#000000", "#233044", "#0B252E", "#150051", "#110040"]
  }),
  created() {
    this.getServerName();
    this.getScreenHeight();
    this.data = loginData;
    this.backgroundColor =
      this.backgroundList[
        Math.floor(Math.random() * this.backgroundList.length)
      ];
    this.getServerName()
    this.getScreenHeight()
    this.backgroundColor = this.backgroundList[Math.floor(Math.random() * this.backgroundList.length)]
  },
  mounted() {
    // 自动登录接口
    this.loginRobot();
    this.loginRobot()
    // oem 信息
    getVasystemInfo().then((rsp) => {
      this.oem = rsp
    })
  },
  watch: {},
  beforeDestroy() {
    window.onresize = null;
    window.onresize = null
  },
  methods: {
    loginRobot() {
      // 解析路由参数,并缓存
      let user = this.getQueryVariable("username");
      let passwd = this.getQueryVariable("password");
      let user = this.getQueryVariable("username")
      let passwd = this.getQueryVariable("password")
      if (user.length && passwd.length) {
        sessionStorage.setItem(
          "autoLogin",
          JSON.stringify({ username: user, passwd: passwd })
        );
        sessionStorage.setItem("autoLogin", JSON.stringify({ username: user, passwd: passwd }))
        this.user.loginName = user;
        this.user.password = passwd;
        this.systemLogin();
        return;
        this.user.loginName = user
        this.user.password = passwd
        this.systemLogin()
        return
      }
      // 登陆超时后的重新登陆
      let sessionInfo = sessionStorage.getItem("autoLogin");
      let sessionInfo = sessionStorage.getItem("autoLogin")
      if (sessionInfo) {
        let authority = JSON.parse(sessionInfo);
        this.user.loginName = authority.username;
        this.user.password = authority.passwd;
        this.systemLogin();
        let authority = JSON.parse(sessionInfo)
        this.user.loginName = authority.username
        this.user.password = authority.passwd
        this.systemLogin()
      }
    },
    systemLogin() {
      this.nullRule = this.rules;
      this.nullRule = this.rules
      this.$nextTick(() => {
        this.$refs["ruleForm"].validate((valid) => {
          if (valid) {
@@ -229,15 +216,15 @@
              lock: true,
              text: "Loading",
              spinner: "el-icon-loading",
              background: "rgba(0, 0, 0, 0.7)",
            });
            this.testLogin();
              background: "rgba(0, 0, 0, 0.7)"
            })
            this.testLogin()
          } else {
            this.nullRule = {};
            this.nullRule = {}
          }
        });
        this.nullRule = {};
      });
        })
        this.nullRule = {}
      })
    },
    async testLogin() {
      // location.assign("/view/desktop/")
@@ -245,89 +232,84 @@
        .then((json) => {
          const loginedInfo = {
            access_token: json.token_type + " " + json.access_token,
            refresh_token: json.refresh_token,
          };
          sessionStorage.setItem("expires_in", json.expires_in);
          sessionStorage.setItem("loginedInfo", JSON.stringify(loginedInfo));
          this.loading.close();
          this.getLoginUserData();
            refresh_token: json.refresh_token
          }
          sessionStorage.setItem("expires_in", json.expires_in)
          sessionStorage.setItem("loginedInfo", JSON.stringify(loginedInfo))
          this.loading.close()
          this.getLoginUserData()
        })
        .catch((err) => {
          this.loading.close();
          this.loading.close()
          this.$notify({
            title: "提示",
            type: "error",
            message: err.msg,
          });
          this.$refs.pwd.focus();
        });
            message: err.msg
          })
          this.$refs.pwd.focus()
        })
    },
    async getLoginUserData() {
      let res = await getLoginUserData();
      let res = await getLoginUserData()
      if (res.success) {
        sessionStorage.setItem("userInfo", JSON.stringify(res.data));
        this.$notify.success("登录成功!");
        sessionStorage.setItem("userInfo", JSON.stringify(res.data))
        this.$notify.success("登录成功!")
        // 获取权限
        await this.getMenuList();
        location.assign("/view/desktop/");
        return res.data;
        await this.getMenuList()
        location.assign("/view/desktop/")
        return res.data
      } else {
        this.$notify.error("登录失败!");
        this.$notify.error("登录失败!")
      }
    },
    getScreenHeight() {
      this.currentHeight = document.documentElement.clientHeight;
      this.currentWidth = document.documentElement.clientWidth;
      this.currentHeight = document.documentElement.clientHeight
      this.currentWidth = document.documentElement.clientWidth
      window.onresize = () => {
        this.currentHeight = document.documentElement.clientHeight;
        this.currentWidth = document.documentElement.clientWidth;
        this.$forceUpdate();
      };
        this.currentHeight = document.documentElement.clientHeight
        this.currentWidth = document.documentElement.clientWidth
        this.$forceUpdate()
      }
    },
    async getServerName() {
      let res = await getServerName();
      let res = await getServerName()
      if (res && res.success) {
        this.serverTitle = res.data.serverName;
        window.document.title = res.data.serverName
          ? res.data.serverName
          : "SmartAI";
        sessionStorage.setItem("title", res.data.serverName);
        this.serverTitle = res.data.serverName
        window.document.title = res.data.serverName ? res.data.serverName : "SmartAI"
        sessionStorage.setItem("title", res.data.serverName)
      }
    },
    async getMenuList() {
      let results = await getMenuListData({});
      let results = await getMenuListData({})
      if (results && results.success) {
        /* 存储权限 */
        let buttonAuthoritys = results.data;
        let buttonAuthoritys = results.data
        if (results && results.length && this.$route.query.is_login) {
          this.$router.replace(results[0].url);
          this.$router.replace(results[0].url)
        }
        sessionStorage.setItem(
          "buttonAuthoritys",
          "," + buttonAuthoritys + ","
        );
        sessionStorage.setItem("menuInfo", JSON.stringify(results));
        sessionStorage.setItem("buttonAuthoritys", "," + buttonAuthoritys + ",")
        sessionStorage.setItem("menuInfo", JSON.stringify(results))
      } else {
        this.$toast({
          type: "error",
          message: "菜单获取失败",
        });
          message: "菜单获取失败"
        })
      }
    },
    getQueryVariable(variable) {
      var query = window.location.search.substring(1);
      var vars = query.split("&");
      var query = window.location.search.substring(1)
      var vars = query.split("&")
      for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        var pair = vars[i].split("=")
        if (pair[0] == variable) {
          return pair[1];
          return pair[1]
        }
      }
      return false;
    },
  },
};
      return false
    }
  }
}
</script>
<style lang="scss">
html,
src/pages/vindicate/views/sysInfo.vue
@@ -4,25 +4,19 @@
      <div class="sys-right">
        <div class="auto">
          <div class="title-bg">
            <div class="title">Smart AIOS</div>
            <div class="desc">Copyright © 贝思科技术有限公司</div>
            <div class="title">{{ productName }}</div>
            <div class="desc">{{ copyright }}</div>
          </div>
          <div class="bar" style="background-color: #f2f2f7">
            <div class="name">版本:</div>
            <div class="desc">
              {{
                serializedNumber == "" ? "SmartAIOS试用版" : "SmartAIOS正式版"
              }}
              {{ serializedNumber == "" ? `${productName}试用版` : `${productName}正式版` }}
            </div>
          </div>
          <div class="bar">
            <div class="name">激活:</div>
            <div class="right-zone">
              <el-button
                type="primary"
                size="small"
                @click="confirmAgain"
                v-if="serializedNumber != ''"
              <el-button type="primary" size="small" @click="confirmAgain" v-if="serializedNumber != ''"
                >导出产品密钥</el-button
              >
              <div class="desc activation">
@@ -32,7 +26,7 @@
          </div>
          <div class="bar">
            <div class="name" style="min-width: 65px">请求码:</div>
            <div class="desc code" style="font-size: 12px">{{ q }}</div>
            <div class="desc code" style="font-size: 12px">{{ queryCode }}</div>
          </div>
          <div class="bar">
            <div class="name">产品密钥:</div>
@@ -48,17 +42,9 @@
      </div>
    </div>
    <el-dialog
      title="再次确认"
      :visible.sync="dialogVisible"
      custom-class="my-confirm"
    >
    <el-dialog title="再次确认" :visible.sync="dialogVisible" custom-class="my-confirm">
      <div class="ver">
        <span
          class="iconfont"
          style="color: orangered; font-size: 40px; margin-bottom: 10px"
          >&#xe6e6;</span
        >
        <span class="iconfont" style="color: orangered; font-size: 40px; margin-bottom: 10px">&#xe6e6;</span>
        <span class="ver-text">
          产品密钥导出后,系统大部分功能将无法使用,请确认是否继续?
        </span>
@@ -71,7 +57,7 @@
        <ul>
          <li style="list-style: inside">如系统已激活,在激活页面导出即可;</li>
          <li style="list-style: inside">
            如设备未激活,在SmartAI激活页面扫码获取
            {{ `"如设备未激活,请在${product_name}激活页面扫码获取"` }}
          </li>
        </ul>
        <!-- <span style="color: #8f949a; font-size: 14px"
@@ -80,11 +66,7 @@
      </div>
      <!--  -->
      <div class="pw">
        <el-input
          size="small"
          placeholder="请输入管理员密码"
          v-model="password"
        ></el-input>
        <el-input size="small" placeholder="请输入管理员密码" v-model="password"></el-input>
      </div>
      <div class="validate">
        <form id="myForm">
@@ -97,15 +79,8 @@
          >
          </el-input>
        </form>
        <el-button size="small" @click="txtbtn" type="primary"
          >导入文件</el-button
        >
        <input
          type="file"
          @change="loadTextFromFile"
          id="txt"
          style="display: none"
        />
        <el-button size="small" @click="txtbtn" type="primary">导入文件</el-button>
        <input type="file" @change="loadTextFromFile" id="txt" style="display: none" />
      </div>
      <span slot="footer" class="dialog-footer">
@@ -119,10 +94,11 @@
</template>
<script>
import { getSN, cancelAuthorization } from "@/api/system";
import { getSN, cancelAuthorization, getVasystemInfo } from "@/api/system"
export default {
  mounted() {
    this.refreshSn();
    this.refreshSn()
  },
  data() {
    return {
@@ -130,76 +106,81 @@
      expireTime: "",
      serializedNumber: "",
      secrectKey: "",
      q: "",
      queryCode: "",
      activeState: "已激活",
      password: "",
      dialogVisible: false,
    };
      productName: "",
      copyright: ""
    }
  },
  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;
          this.authorization = res.data.authorization
          this.expireTime = res.data.expireTime
          this.serializedNumber = res.data.sn
          this.queryCode = res.data.q
        }
      });
      })
      getVasystemInfo().then((rsp) => {
        this.productName = rsp.product_name
        this.copyright = rsp.copyright
      })
    },
    confirmAgain() {
      this.dialogVisible = true;
      this.dialogVisible = true
    },
    txtbtn() {
      document.getElementById("txt").click();
      document.getElementById("txt").click()
    },
    loadTextFromFile(e) {
      const file = e.target.files[0];
      var reader = new FileReader(); //new一个FileReader实例
      let that = this;
      reader.onload = function () {
        that.secrectKey = this.result.trim();
      };
      reader.readAsText(file);
      const file = e.target.files[0]
      var reader = new FileReader() //new一个FileReader实例
      let that = this
      reader.onload = function() {
        that.secrectKey = this.result.trim()
      }
      reader.readAsText(file)
    },
    confirmCancel() {
      this.secrectKey = this.secrectKey.trim();
      this.password = this.password.trim();
      this.secrectKey = this.secrectKey.trim()
      this.password = this.password.trim()
      if (this.secrectKey == "" || this.password == "") {
        this.$message.warning("请先填写密码和请求码");
        return;
        this.$message.warning("请先填写密码和请求码")
        return
      }
      cancelAuthorization({
        q: this.secrectKey,
        passwd: this.password,
        down: 1,
        down: 1
      }).then((res) => {
        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); //这个就是解析出来的数据
            that.$notify.error(receive_data.msg);
          };
          return;
          var reader = new FileReader()
          reader.readAsText(res, "utf-8")
          let that = this
          reader.onload = function() {
            var receive_data = JSON.parse(this.result) //这个就是解析出来的数据
            that.$notify.error(receive_data.msg)
          }
          return
        }
        let url = window.URL.createObjectURL(
          new Blob([res], { type: "text/plain" })
        );
        let a = document.createElement("a");
        a.href = url;
        a.download = "key.txt";
        a.click();
        window.URL.revokeObjectURL(url);
        this.refreshSn();
        window.parent.postMessage({ msg: "checkSN" }, "*");
        this.$notify.success("导出成功");
        this.dialogVisible = false;
      });
    },
  },
};
        let url = window.URL.createObjectURL(new Blob([res], { type: "text/plain" }))
        let a = document.createElement("a")
        a.href = url
        a.download = "key.txt"
        a.click()
        window.URL.revokeObjectURL(url)
        this.refreshSn()
        window.parent.postMessage({ msg: "checkSN" }, "*")
        this.$notify.success("导出成功")
        this.dialogVisible = false
      })
    }
  }
}
</script>
<style lang="scss">
div {
@@ -213,8 +194,8 @@
  border-left: 4px solid #f2f2f7;
  .el-dialog {
    width: 640px;    border-radius: 24px;
    width: 640px;
    border-radius: 24px;
  }
  .el-dialog__header {
@@ -242,38 +223,38 @@
  }
  .el-dialog__footer {
    padding: 10px 20px 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;
    .btns {
      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;
      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;
      }
    }
  }
}
  .el-divider--horizontal {
    margin: 20px 0;
  }
@@ -282,14 +263,14 @@
    align-items: baseline;
    margin-top: 15px;
    .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;    padding: 8px 15px;
      }
      font-size: 14px;
      border-radius: 3px;
      border-radius: 16px;
      background-color: var(--colorCard) !important;
      border-color: var(--colorCard) !important;
      min-width: 120px;
      padding: 8px 15px;
    }
  }
  #myForm {
    display: flex;
@@ -356,11 +337,8 @@
    box-sizing: border-box;
    position: relative;
    padding: 10px 15px 0 10px;
    .el-form-item.is-required:not(.is-no-asterisk)
      > .el-form-item__label:before,
    .el-form-item.is-required:not(.is-no-asterisk)
      .el-form-item__label-wrap
      > .el-form-item__label:before {
    .el-form-item.is-required:not(.is-no-asterisk) > .el-form-item__label:before,
    .el-form-item.is-required:not(.is-no-asterisk) .el-form-item__label-wrap > .el-form-item__label:before {
      display: none;
    }
    .el-select {