zhangjie 2 роки тому
батько
коміт
9d2793c7f2
1 змінених файлів з 13 додано та 5 видалено
  1. 13 5
      pages/download/App.vue

+ 13 - 5
pages/download/App.vue

@@ -208,6 +208,15 @@ function getParam(paramName) {
   return validh.split("=")[1];
 }
 
+function getDomain() {
+  let domain;
+  if (process.env.VUE_APP_SELF_DEFINE_DOMAIN === "true") {
+    domain = window.localStorage.getItem("domain_in_url");
+  }
+  if (!domain) domain = window.location.hostname.split(".")[0];
+  return domain;
+}
+
 export default {
   name: "app",
   data() {
@@ -233,19 +242,18 @@ export default {
   },
   methods: {
     async getData() {
-      const code = getParam("code");
+      const code = getParam("code") || getDomain();
       if (!code) {
-        window.alert("学校code丢失!");
+        this.$message.error("学校code丢失!");
         return;
       }
       const res = await getSchoolInfo(code);
       this.info = res.data.data;
-      if (!this.info.version) {
-        this.$message.error("数据错误!");
+      if (!this.info.packagePath) {
+        this.$message.error("下载地址丢失!");
       }
     },
     handleSelect(key, keyPath) {
-      console.log(key, keyPath);
       const parentId = keyPath[0];
       const pmenu = this.menus.find((item) => item.id === parentId);
       if (!pmenu) return;