lyuis 7 месяцев назад
Родитель
Сommit
71be5b0419
5 измененных файлов с 152 добавлено и 14 удалено
  1. 36 1
      common/queue.js
  2. 2 2
      pages.json
  3. 16 3
      pages/my/index.vue
  4. 2 2
      pages/my/jobApplicant/guidePage.vue
  5. 96 6
      pages/my/switchRoles.vue

+ 36 - 1
common/queue.js

@@ -351,5 +351,40 @@ module.exports = {
 	  const hour24 = hour.toString().padStart(2, '0');
 	  const hour24 = hour.toString().padStart(2, '0');
 	  
 	  
 	  return `${hour24}:${minute}`;
 	  return `${hour24}:${minute}`;
-	}
+	},
+	changeTabbar:function(res){
+		setTimeout(() => {
+			if(res==1){
+			uni.setTabBarItem({
+			  index: 0,
+			  text: '首页',
+			 iconPath: "/static/tabbar/Home.png",
+			 selectedIconPath: "/static/tabbar/Iconly_Bold_Home.png",
+			})
+			uni.setTabBarItem({
+			  index: 1,
+			  text: '急聘',
+			  "pagePath": "/pages/index/game/gameList",
+			  "iconPath": "/static/tabbar/jipin.png",
+			  "selectedIconPath": "/static/tabbar/ACjipin.png",
+			})
+			}else{
+				uni.setTabBarItem({
+				  index: 0,
+				  text: '牛人',
+				 iconPath: "/static/tabbar/Home.png",
+				 selectedIconPath: "/static/tabbar/Iconly_Bold_Home.png",
+				})
+				uni.setTabBarItem({
+				  index: 1,
+				  "pagePath": "/pages/talentSearch/index",
+				   	"iconPath": "/static/tabbar/Hrsearch.png",
+				   	"selectedIconPath": "/static/tabbar/ACsearch.png",
+				   	"text": "搜索"
+				})
+			}
+		    // 可以在这里添加 tabbar 更新后的后续操作
+		    console.log('tabbar 更新完成');
+		  },100);
+	},
 };
 };

+ 2 - 2
pages.json

@@ -1369,8 +1369,8 @@
 		"list": [
 		"list": [
 			{
 			{
 				"pagePath": "pages/index/index",
 				"pagePath": "pages/index/index",
-				"iconPath": "static/tabbar/niu.png",
-				"selectedIconPath": "/static/tabbar/niu2.png",
+				"iconPath": "static/tabbar/Home.png",
+				"selectedIconPath": "/static/tabbar/Iconly_Bold_Home.png",
 				"text": "首页"
 				"text": "首页"
 			},
 			},
 			{
 			{

+ 16 - 3
pages/my/index.vue

@@ -13,7 +13,7 @@
 					<view class="info-box-btn flex justify-end align-center" style="padding-right: 32rpx;"
 					<view class="info-box-btn flex justify-end align-center" style="padding-right: 32rpx;"
 						v-if="token && XCXIsSelect != '否'">
 						v-if="token && XCXIsSelect != '否'">
 						<image src="@/static/images/jobApplicant/qiehuan.svg" mode="scaleToFill"
 						<image src="@/static/images/jobApplicant/qiehuan.svg" mode="scaleToFill"
-							style="margin-top: 40rpx;margin-right:30rpx" @click="bindQe()" />
+							style="margin-top: 40rpx;margin-right:30rpx" @click="goNav('switchRoles')" />
 						<u-icon @click="goNav('/pages/my/userinfo')" color="#ffffff" top="16rpx" size="34rpx" name="setting"></u-icon>
 						<u-icon @click="goNav('/pages/my/userinfo')" color="#ffffff" top="16rpx" size="34rpx" name="setting"></u-icon>
 						<!-- <image
 						<!-- <image
               src="../../static/images/my/icon/selectUser.png"
               src="../../static/images/my/icon/selectUser.png"
@@ -325,7 +325,7 @@
 						<view class="info-box">
 						<view class="info-box">
 							<view v-if="XCXIsSelect != '否'" class="info-box-btn flex justify-end align-center">
 							<view v-if="XCXIsSelect != '否'" class="info-box-btn flex justify-end align-center">
 								<image src="@/static/images/jobApplicant/qiehuan.svg" mode="scaleToFill"
 								<image src="@/static/images/jobApplicant/qiehuan.svg" mode="scaleToFill"
-									style="margin-top: 40rpx" @click="bindQe(userType)" />
+									style="margin-top: 40rpx" @click="goNav('switchRoles')" />
 							</view>
 							</view>
 							<view class="info-box-header flex align-center">
 							<view class="info-box-header flex align-center">
 								<view class="info-box-header-l">
 								<view class="info-box-header-l">
@@ -800,6 +800,20 @@
 		onLoad(e) {
 		onLoad(e) {
 			console.log(this.token);
 			console.log(this.token);
 			this.XCXIsSelect = this.$queue.getData("XCXIsSelect");
 			this.XCXIsSelect = this.$queue.getData("XCXIsSelect");
+			var that=this
+			uni.$on('changeRole',function(res){
+				console.log(res.userType)
+				if(res.userType==1){
+				that.getUserInfo();
+				that.getUserData();
+				}else{
+					 that.getCompany();
+				}
+				that.$queue.changeTabbar(res.userType)
+			})
+		},
+		onUnload(){
+			uni.$off('changeRole')
 		},
 		},
 		onShow() {
 		onShow() {
 			this.token = uni.getStorageSync("token");
 			this.token = uni.getStorageSync("token");
@@ -1450,7 +1464,6 @@
 			},
 			},
 			// 切换身份
 			// 切换身份
 			bindQe() {
 			bindQe() {
-
 				let that = this;
 				let that = this;
 				if (uni.getStorageSync("userId")) {
 				if (uni.getStorageSync("userId")) {
 				let index=3-this.userType
 				let index=3-this.userType

+ 2 - 2
pages/my/jobApplicant/guidePage.vue

@@ -114,7 +114,7 @@
 				uni.showLoading({
 				uni.showLoading({
 					title: "提交中..."
 					title: "提交中..."
 				});
 				});
-				this.$Request.postJson("/app/user/updateUserResumes", {
+				this.$Request.postJson("/app/user/updateUserEntity", {
 						userType: userType
 						userType: userType
 					})
 					})
 					.then((res) => {
 					.then((res) => {
@@ -136,7 +136,7 @@
 						});
 						});
 						return false
 						return false
 					});
 					});
-			}
+			},
 
 
 		},
 		},
 	};
 	};

+ 96 - 6
pages/my/switchRoles.vue

@@ -4,8 +4,8 @@
     <view class="roles-content">
     <view class="roles-content">
       <view class="content">
       <view class="content">
         <image src="/static/images/my/zhaopingzhe.svg" mode="scaleToFill" />
         <image src="/static/images/my/zhaopingzhe.svg" mode="scaleToFill" />
-        <view class="roles-desc">你当前的身份是“招聘者”</view>
-        <view class="roles-btn" @click="goBusinessLicense">切换为“求职者”身份</view>
+        <view class="roles-desc">你当前的身份是“{{userType==1?'求职者':'招聘者'}}”</view>
+        <view class="roles-btn" @click="bindQe">切换为“{{userType==2?'求职者':'招聘者'}}”身份</view>
       </view>
       </view>
     </view>
     </view>
   </view>
   </view>
@@ -14,15 +14,105 @@
 import navBar from "@/components/nav-bar/index.vue";
 import navBar from "@/components/nav-bar/index.vue";
 export default {
 export default {
   data() {
   data() {
-    return {};
+    return {
+		userType:1
+	}
   },
   },
   components: {
   components: {
     navBar,
     navBar,
   },
   },
+  onLoad(){
+	this.getUserInfo()
+  },
   methods: {
   methods: {
-    goBusinessLicense(){
-        uni.navigateTo({ url: '/pages/my/businessLicense' })
-    }
+	/**
+	 * 获取个人信息
+	 */
+	getUserInfo() {
+		this.$Request.get("/app/user/selectUserById").then((res) => {
+			if (res.code == 0) {
+				
+				if (res.data.userType == 1 || res.data.userType == null) {
+					this.userType = 1;
+					uni.setStorageSync("userType", 1);
+				} else {
+					this.userType = 2;
+					uni.setStorageSync("userType", 2);
+				}
+			}
+		});
+	},
+	// 切换身份
+	bindQe() {
+		let that = this;
+		if (uni.getStorageSync("userId")) {
+		let index=3-this.userType
+	
+			if (index == 1) {
+				//企业换个人
+				uni.showModal({
+					title: "提示",
+					content: "确认切换到求职者身份吗?",
+					confirmColor: "#016BF6",
+					complete(ret) {
+						if (ret.confirm) {
+							let data = {
+							  userType: 1,
+							};
+							that.$Request.postT("/app/user/updateUserEntity", data).then((res) => {
+							  if (res.code == 0) {
+								  uni.$emit('changeRole',{userType:index})
+								  uni.navigateBack()
+							  }
+							});
+	
+	
+						}
+					},
+				});
+	
+			} else if (index == 2) {
+				//个人换企业
+				uni.showModal({
+					title: "提示",
+					content: "确认切换到招聘者身份吗?",
+					confirmColor: "#016BF6",
+					complete(ret) {
+						if (ret.confirm) {
+							 uni.$emit('changeRole',{userType:index})
+							 uni.navigateBack()
+						}
+					},
+				});
+			}
+		} else {
+			this.noLogin();
+		}
+	},
+	//未登录
+	noLogin() {
+		// uni.showModal({
+		// 	title: '提示',
+		// 	content: '您还未登录,请先登录',
+		// 	confirmColor:'#016BF6',
+		// 	success: function(res) {
+		// 		if (res.confirm) {
+		// 			console.log('用户点击确定');
+		// 			// uni.reLaunch({
+		// 			// 	url:'/pages/public/login'
+		// 			// })
+		// 			uni.navigateTo({
+		// 				url: '/pages/public/login'
+		// 			})
+		// 		} else if (res.cancel) {
+		// 			console.log('用户点击取消');
+		// 		}
+		// 	}
+		// })
+		uni.navigateTo({
+			url: "/pages/public/login",
+		});
+	},
   },
   },
 };
 };
 </script>
 </script>