lrf402788946 5 lat temu
rodzic
commit
b2105cadf6
3 zmienionych plików z 16 dodań i 16 usunięć
  1. 0 12
      src/App.vue
  2. 11 0
      src/plugins/var.js
  3. 5 4
      src/views/index/request.vue

+ 0 - 12
src/App.vue

@@ -3,18 +3,6 @@
     <router-view />
   </div>
 </template>
-<script>
-export default {
-  created() {
-    let host = `${window.location.hostname}`; //`999991.smart.jilinjobswx.cn`
-    let arr = host.split('.');
-    if (arr.length > 0) {
-      let schId = arr[0];
-      sessionStorage.setItem('schId', schId);
-    }
-  },
-};
-</script>
 
 <style lang="less">
 body {

+ 11 - 0
src/plugins/var.js

@@ -1,9 +1,20 @@
 import Vue from 'vue';
 
+const getSiteId = () => {
+  let host = `${window.location.hostname}`; //`999991.smart.jilinjobswx.cn`
+  let schId;
+  let arr = host.split('.');
+  if (arr.length > 0) {
+    schId = arr[0];
+    sessionStorage.setItem('schId', schId);
+  }
+  return schId;
+};
 const Plugin = {
   install(vue, options) {
     // 4. 添加实例方法
     vue.prototype.$limit = 5;
+    vue.prototype.$site = getSiteId();
   },
 };
 

+ 5 - 4
src/views/index/request.vue

@@ -82,29 +82,30 @@ export default {
       }
     },
     async search() {
+      console.log(this.$site);
       // 1直接拿着参数发送请求
-      let result = await this.postTalksInfo({ type: 'list', data: { schid: 999991 } });
+      let result = await this.postTalksInfo({ type: 'list', data: { schid: this.$site } });
       if (`${result.errcode}` === '0') {
         //给this=>vue的实例下在中的list属性,赋予result。data的值
         this.$set(this, `listSchIn`, result.data);
       } else {
         this.$message.error(result.errmsg ? result.errmsg : 'error');
       }
-      result = await this.jobfairOperation({ type: 'list', data: { schid: 999991 } });
+      result = await this.jobfairOperation({ type: 'list', data: { schid: this.$site } });
       if (`${result.errcode}` === '0') {
         //给this=>vue的实例下在中的list属性,赋予result。data的值
         this.$set(this, `jobfairList`, result.data);
       } else {
         this.$message.error(result.errmsg ? result.errmsg : 'error');
       }
-      result = await this.postTalksInfo({ type: 'list', data: { corpid: '5d416dae7f60242ba26b45e5' } });
+      result = await this.postTalksInfo({ type: 'list', data: {} });
       if (`${result.errcode}` === '0') {
         //给this=>vue的实例下在中的list属性,赋予result。data的值
         this.$set(this, `listSchOut`, result.data);
       } else {
         this.$message.error(result.errmsg ? result.errmsg : 'error');
       }
-      result = await this.jobinfoOperation({ type: 'list', data: { limit: this.limit, corpid: '5d417176dc00bf2cc223e1a6' } });
+      result = await this.jobinfoOperation({ type: 'list', data: { limit: this.limit } });
       if (`${result.errcode}` === '0') {
         //给this=>vue的实例下在中的list属性,赋予result。data的值
         this.$set(this, 'PostInfos', result.data);