selectIdentity.vue 6.5 KB

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