|
|
@@ -4,8 +4,8 @@
|
|
|
<view class="roles-content">
|
|
|
<view class="content">
|
|
|
<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>
|
|
|
@@ -14,15 +14,105 @@
|
|
|
import navBar from "@/components/nav-bar/index.vue";
|
|
|
export default {
|
|
|
data() {
|
|
|
- return {};
|
|
|
+ return {
|
|
|
+ userType:1
|
|
|
+ }
|
|
|
},
|
|
|
components: {
|
|
|
navBar,
|
|
|
},
|
|
|
+ onLoad(){
|
|
|
+ this.getUserInfo()
|
|
|
+ },
|
|
|
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>
|