selectIdentity.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <view class="guide-page">
  3. <view class="guide-item">
  4. <view class="guide-img">
  5. <image src="@/static/images/jobApplicant/woyaozhaogongzuo.svg" mode="aspectFix" />
  6. </view>
  7. <view class="guide-btn" @click="gotoVers(1)">我要找工作</view>
  8. </view>
  9. <view class="guide-item">
  10. <view class="guide-img">
  11. <image src="@/static/images/jobApplicant/woyaozhaoren.svg" mode="aspectFix" />
  12. </view>
  13. <view class="guide-btn" @click="gotoVers(2)">我要招人</view>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. userType: "", //用户类型 1:求职者 2:招聘者
  22. CompanyList: "", //企业数据
  23. };
  24. },
  25. onShow() {
  26. this.userType = uni.getStorageSync("userType");
  27. console.log(uni.getStorageSync("token"));
  28. // #ifdef MP-WEIXIN
  29. uni.hideHomeButton();
  30. // #endif
  31. },
  32. methods: {
  33. /**
  34. * 获取用户企业实名数据
  35. */
  36. getCompany() {
  37. this.$Request.get("/app/company/selectCompanyByUserId").then((res) => {
  38. if (res.code == 0 && res.data) {
  39. this.CompanyList = res.data;
  40. if (this.CompanyList.status == 1) {
  41. uni.showModal({
  42. title: "提示",
  43. content: "您提交的企业认证正在审核,是否查看修改?",
  44. confirmColor: "#016BF6",
  45. success: function (res) {
  46. if (res.confirm) {
  47. console.log("用户点击确定");
  48. uni.navigateTo({
  49. url: "/my/renzheng/index",
  50. });
  51. } else if (res.cancel) {
  52. console.log("用户点击取消");
  53. }
  54. },
  55. });
  56. } else if (this.CompanyList.status == 2) {
  57. //已进行企业认证并且已通过则修改用户类型为2并跳转至企业端首页
  58. if (this.userType == 1) {
  59. //若用户类型为1则修改身份为2跳转至首页
  60. this.$Request
  61. .postT("/app/user/updateUserEntity", {
  62. userType: 2,
  63. })
  64. .then((res) => {
  65. if (res.code == 0) {
  66. // return
  67. uni.setStorageSync("companyId", this.CompanyList.companyId);
  68. uni.setStorageSync("userType", 2);
  69. // uni.reLaunch({
  70. // url:'/pages/index/index'
  71. // })
  72. uni.switchTab({
  73. url: "/pages/index/index",
  74. });
  75. } else {
  76. uni.showToast({
  77. title: "切换失败,请重试!",
  78. icon: "none",
  79. });
  80. }
  81. });
  82. } else {
  83. //否则直接跳转至首页即可
  84. uni.setStorageSync("companyId", this.CompanyList.companyId);
  85. uni.setStorageSync("userType", 2);
  86. // uni.reLaunch({
  87. // url:'/pages/index/index'
  88. // })
  89. uni.switchTab({
  90. url: "/pages/index/index",
  91. });
  92. }
  93. } else if (this.CompanyList.status == 3) {
  94. uni.showModal({
  95. title: "提示",
  96. content: "您提交的企业认证已被拒绝,是否查看修改?",
  97. confirmColor: "#016BF6",
  98. success: function (res) {
  99. if (res.confirm) {
  100. console.log("用户点击确定");
  101. uni.navigateTo({
  102. url: "/my/renzheng/index",
  103. });
  104. } else if (res.cancel) {
  105. console.log("用户点击取消");
  106. }
  107. },
  108. });
  109. }
  110. } else {
  111. uni.showModal({
  112. title: "提示",
  113. content: "您还未企业认证,请先进行认证",
  114. confirmColor: "#016BF6",
  115. success: function (res) {
  116. if (res.confirm) {
  117. console.log("用户点击确定");
  118. uni.navigateTo({
  119. url: "/my/renzheng/index",
  120. });
  121. } else if (res.cancel) {
  122. console.log("用户点击取消");
  123. }
  124. },
  125. });
  126. }
  127. });
  128. },
  129. //选择登录身份
  130. gotoVers(type) {
  131. //用户端直接修改用户类型为1然后跳转至用户端首页
  132. if (type == 1) {
  133. //用户端
  134. //判断登录用户的userType
  135. if (this.userType == 1) {
  136. //若为1则直接跳转至首页
  137. uni.setStorageSync("userType", 1);
  138. // 原有的代码,现在需要做判断是否是第一次登录
  139. // 这里判断一下看是否是第一次登录如果是就跳到引导页,如果不是就正常跳
  140. let firstLogin = uni.getStorageSync("firstLogin") || false;
  141. if (!firstLogin) {
  142. uni.navigateTo({
  143. url: "/pages/my/jobApplicant/guidePage",
  144. });
  145. } else {
  146. uni.switchTab({
  147. url: "/pages/index/index",
  148. });
  149. }
  150. } else {
  151. //若为2,则修改用户的userType=2再跳转至首页
  152. let data = {
  153. userType: 1,
  154. };
  155. this.$Request.postT("/app/user/updateUserEntity", data).then((res) => {
  156. if (res.code == 0) {
  157. uni.setStorageSync("userType", 1);
  158. // 这里判断一下看是否是第一次登录如果是就跳到引导页,如果不是就正常跳
  159. let firstLogin = uni.getStorageSync("firstLogin") || false;
  160. if (!firstLogin) {
  161. uni.navigateTo({
  162. url: "/pages/my/jobApplicant/guidePage",
  163. });
  164. } else {
  165. uni.switchTab({
  166. url: "/pages/index/index",
  167. });
  168. }
  169. } else {
  170. uni.showToast({
  171. title: "切换失败,请重试!",
  172. });
  173. }
  174. });
  175. }
  176. } else {
  177. //企业端
  178. /**
  179. * 企业端则判断该用户是否进行企业认证,
  180. * 若认证成功则修改用户状态为2跳转至企业端首页,
  181. * 若没有进行企业认证或审核中或审核失败则提示是否进行企业认证,选择是则跳转至认证的页面(用户类型还是为1)
  182. */
  183. this.getCompany();
  184. // if (this.userType == 1) { //原本用户类型为1
  185. // this.getCompany()
  186. // } else { //用户类型本来就为2
  187. // uni.setStorageSync('userType', 2)
  188. // uni.reLaunch({
  189. // url: '/pages/index/index'
  190. // })
  191. // // uni.switchTab({
  192. // // url:'/pages/index/index'
  193. // // })
  194. // }
  195. }
  196. },
  197. },
  198. };
  199. </script>
  200. <style lang="scss">
  201. .guide-page {
  202. background: linear-gradient(90deg, rgba(13, 39, 247, 1), rgba(19, 193, 234, 1) 100%);
  203. position: absolute;
  204. left: 0;
  205. right: 0;
  206. top: 0;
  207. bottom: 0;
  208. padding: 120rpx 76rpx;
  209. display: flex;
  210. flex-direction: column;
  211. box-sizing: border-box;
  212. gap: 36rpx;
  213. .guide-item {
  214. width: 100%;
  215. height: 100%;
  216. border-radius: 28rpx;
  217. background: rgba(255, 255, 255, 0.851);
  218. display: flex;
  219. flex-direction: column;
  220. justify-content: center;
  221. align-items: center;
  222. padding: 0 56rpx;
  223. box-sizing: border-box;
  224. gap: 72rpx;
  225. .guide-img {
  226. width: 364rpx;
  227. height: 364rpx;
  228. overflow: hidden;
  229. image {
  230. width: 100%;
  231. height: 100%;
  232. }
  233. }
  234. .guide-btn {
  235. border-radius: 100rpx;
  236. background: rgba(255, 255, 255, 1);
  237. color: #016bf6;
  238. font-family: DM Sans;
  239. font-size: 32rpx;
  240. font-weight: 400;
  241. line-height: 48rpx;
  242. letter-spacing: 0%;
  243. text-align: center;
  244. width: 100%;
  245. padding: 16rpx;
  246. box-sizing: border-box;
  247. }
  248. }
  249. }
  250. </style>