wkw há 6 meses atrás
pai
commit
740ade6694
3 ficheiros alterados com 20 adições e 16 exclusões
  1. 2 1
      src/components/header/header.vue
  2. 1 9
      src/views/home.vue
  3. 17 6
      src/views/index/indexCompany.vue

+ 2 - 1
src/components/header/header.vue

@@ -1554,7 +1554,8 @@
 			outLogin() {
 				localStorage.removeItem('token');
 				localStorage.removeItem('userId');
-				localStorage.removeItem('userType')
+				localStorage.removeItem('userType');
+				localStorage.removeItem('companyId');
 				// 调用重置状态的函数  
 				this.$store.dispatch('SET_DATA');
 				this.$router.push({

+ 1 - 9
src/views/home.vue

@@ -43,14 +43,7 @@
 
 		},
 		methods: {
-			getCompany(){
-				this.$Request.get("/app/company/selectCompanyByUserId").then(res => {
-					if(res.code == 0){
-						this.$store.commit('SET_COMPANY_ID', res.data.companyId)
-						localStorage.setItem('companyId', res.data.companyId);
-					}
-				})
-			},
+			
 			//获取用户信息
 			getUserInfo() {
 				this.$Request.get('/app/user/selectUserById').then(res => {
@@ -88,7 +81,6 @@
 						} else {
 							this.$store.commit('SET_USER_TYPE', 2);
 							localStorage.setItem('userType', 2)
-							this.getCompany();
 							if (res.data.isUserVip == 1) { //判断企业用户是否是vip
 								this.$store.commit('SET_IS_COMPANY_VIP', true);
 							} else {

+ 17 - 6
src/views/index/indexCompany.vue

@@ -424,6 +424,12 @@
 		},
 		mounted() {
 			this.companyId = this.$store.state.companyId ? this.$store.state.companyId : localStorage.getItem('companyId');
+			if(!this.companyId){
+				this.getCompany();
+			}else{
+				//tbas
+				this.getTabsList();
+			}
 			let inviterCode = this.$route.query.inviterCode
 			if (inviterCode) {
 				localStorage.setItem('inviterCode', inviterCode)
@@ -435,18 +441,23 @@
 			this.getAppDown()
 			//岗位分类
 			this.getJobTypeList();
-			//tbas
-			this.getTabsList();
 			//banner
 			this.getBannerList();
-			//所有城市的列表
-			// this.getAllCityList();
 			this.getschoolList();
 			this.getjyList();
 			this.getMoneyList();
 
 		},
 		methods: {
+			getCompany() {
+				this.$Request.get("/app/company/selectCompanyByUserId").then(res => {
+					if (res.code == 0) {
+						this.$store.commit('SET_COMPANY_ID', res.data.companyId)
+						localStorage.setItem('companyId', res.data.companyId);
+						this.getTabsList();
+					}
+				})
+			},
 			// 点击“+”打开行业标签弹窗
 			openIndustryDialog() {
 				// 打开弹窗
@@ -536,7 +547,7 @@
 			},
 			getIndustryList() {
 				let data = {
-					ruleClassifyId: this.tabs[this.tabsCurr].ruleClassifyId
+					ruleClassifyId: this.tabs[this.tabsCurr]?.ruleClassifyId
 				};
 				this.$Request.get('/app/userFirst/getPostSkill', { params: data }).then(res => {
 					if (res.code === 0) {
@@ -789,7 +800,7 @@
 			//获取发布的岗位
 			getTabsList() {
 				let data = {
-					companyId: this.companyId
+					companyId: (this.$store.state.companyId ? this.$store.state.companyId : localStorage.getItem('companyId'))  || this.companyId
 				}
 				this.$Request.get('/app/postPush/getCompanyClassify', {
 					params: data