123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- <template>
- <view class="guide-page">
- <view class="guide-item">
- <view class="guide-img">
- <image src="@/static/images/jobApplicant/woyaozhaogongzuo.svg" mode="aspectFix" />
- </view>
- <view class="guide-btn" @click="gotoVers(1)">我要找工作</view>
- </view>
- <view class="guide-item">
- <view class="guide-img">
- <image src="@/static/images/jobApplicant/woyaozhaoren.svg" mode="aspectFix" />
- </view>
- <view class="guide-btn" @click="gotoVers(2)">我要招人</view>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- userType: "", //用户类型 1:求职者 2:招聘者
- CompanyList: "", //企业数据
- };
- },
- onShow() {
- this.userType = uni.getStorageSync("userType");
- console.log(uni.getStorageSync("token"));
- // #ifdef MP-WEIXIN
- uni.hideHomeButton();
- // #endif
- },
- methods: {
- /**
- * 获取用户企业实名数据
- */
- getCompany() {
- this.$Request.get("/app/company/selectCompanyByUserId").then((res) => {
- if (res.code == 0 && res.data) {
- this.CompanyList = res.data;
- if (this.CompanyList.status == 1) {
- uni.showModal({
- title: "提示",
- content: "您提交的企业认证正在审核,是否查看修改?",
- confirmColor: "#016BF6",
- success: function (res) {
- if (res.confirm) {
- console.log("用户点击确定");
- uni.navigateTo({
- url: "/my/renzheng/index",
- });
- } else if (res.cancel) {
- console.log("用户点击取消");
- }
- },
- });
- } else if (this.CompanyList.status == 2) {
- //已进行企业认证并且已通过则修改用户类型为2并跳转至企业端首页
- if (this.userType == 1) {
- //若用户类型为1则修改身份为2跳转至首页
- this.$Request
- .postT("/app/user/updateUserEntity", {
- userType: 2,
- })
- .then((res) => {
- if (res.code == 0) {
- // return
- uni.setStorageSync("companyId", this.CompanyList.companyId);
- uni.setStorageSync("userType", 2);
- // uni.reLaunch({
- // url:'/pages/index/index'
- // })
- uni.switchTab({
- url: "/pages/index/index",
- });
- } else {
- uni.showToast({
- title: "切换失败,请重试!",
- icon: "none",
- });
- }
- });
- } else {
- //否则直接跳转至首页即可
- uni.setStorageSync("companyId", this.CompanyList.companyId);
- uni.setStorageSync("userType", 2);
- // uni.reLaunch({
- // url:'/pages/index/index'
- // })
- uni.switchTab({
- url: "/pages/index/index",
- });
- }
- } else if (this.CompanyList.status == 3) {
- uni.showModal({
- title: "提示",
- content: "您提交的企业认证已被拒绝,是否查看修改?",
- confirmColor: "#016BF6",
- success: function (res) {
- if (res.confirm) {
- console.log("用户点击确定");
- uni.navigateTo({
- url: "/my/renzheng/index",
- });
- } else if (res.cancel) {
- console.log("用户点击取消");
- }
- },
- });
- }
- } else {
- uni.showModal({
- title: "提示",
- content: "您还未企业认证,请先进行认证",
- confirmColor: "#016BF6",
- success: function (res) {
- if (res.confirm) {
- console.log("用户点击确定");
- uni.navigateTo({
- url: "/my/renzheng/index",
- });
- } else if (res.cancel) {
- console.log("用户点击取消");
- }
- },
- });
- }
- });
- },
- //选择登录身份
- gotoVers(type) {
- //用户端直接修改用户类型为1然后跳转至用户端首页
- if (type == 1) {
- //用户端
- //判断登录用户的userType
- if (this.userType == 1) {
- //若为1则直接跳转至首页
- uni.setStorageSync("userType", 1);
- // 原有的代码,现在需要做判断是否是第一次登录
- // 这里判断一下看是否是第一次登录如果是就跳到引导页,如果不是就正常跳
- let firstLogin = uni.getStorageSync("firstLogin") || false;
- if (!firstLogin) {
- uni.navigateTo({
- url: "/pages/my/jobApplicant/guidePage",
- });
- } else {
- uni.switchTab({
- url: "/pages/index/index",
- });
- }
- } else {
- //若为2,则修改用户的userType=2再跳转至首页
- let data = {
- userType: 1,
- };
- this.$Request.postT("/app/user/updateUserEntity", data).then((res) => {
- if (res.code == 0) {
- uni.setStorageSync("userType", 1);
- // 这里判断一下看是否是第一次登录如果是就跳到引导页,如果不是就正常跳
- let firstLogin = uni.getStorageSync("firstLogin") || false;
- if (!firstLogin) {
- uni.navigateTo({
- url: "/pages/my/jobApplicant/guidePage",
- });
- } else {
- uni.switchTab({
- url: "/pages/index/index",
- });
- }
- } else {
- uni.showToast({
- title: "切换失败,请重试!",
- });
- }
- });
- }
- } else {
- //企业端
- /**
- * 企业端则判断该用户是否进行企业认证,
- * 若认证成功则修改用户状态为2跳转至企业端首页,
- * 若没有进行企业认证或审核中或审核失败则提示是否进行企业认证,选择是则跳转至认证的页面(用户类型还是为1)
- */
- this.getCompany();
- // if (this.userType == 1) { //原本用户类型为1
- // this.getCompany()
- // } else { //用户类型本来就为2
- // uni.setStorageSync('userType', 2)
- // uni.reLaunch({
- // url: '/pages/index/index'
- // })
- // // uni.switchTab({
- // // url:'/pages/index/index'
- // // })
- // }
- }
- },
- },
- };
- </script>
- <style lang="scss">
- .guide-page {
- background: linear-gradient(90deg, rgba(13, 39, 247, 1), rgba(19, 193, 234, 1) 100%);
- position: absolute;
- left: 0;
- right: 0;
- top: 0;
- bottom: 0;
- padding: 120rpx 76rpx;
- display: flex;
- flex-direction: column;
- box-sizing: border-box;
- gap: 36rpx;
- .guide-item {
- width: 100%;
- height: 100%;
- border-radius: 28rpx;
- background: rgba(255, 255, 255, 0.851);
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- padding: 0 56rpx;
- box-sizing: border-box;
- gap: 72rpx;
- .guide-img {
- width: 364rpx;
- height: 364rpx;
- overflow: hidden;
- image {
- width: 100%;
- height: 100%;
- }
- }
- .guide-btn {
- border-radius: 100rpx;
- background: rgba(255, 255, 255, 1);
- color: #016bf6;
- font-family: DM Sans;
- font-size: 32rpx;
- font-weight: 400;
- line-height: 48rpx;
- letter-spacing: 0%;
- text-align: center;
- width: 100%;
- padding: 16rpx;
- box-sizing: border-box;
- }
- }
- }
- </style>
|