mine.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. <template>
  2. <view>
  3. <u-navbar back-text="我的" back-icon-size="0" :customBack="customBack" back-icon-color="#ffffff"
  4. :background="{backgroundColor: '#2795FD',}" :back-text-style="{color: '#ffffff'}"></u-navbar>
  5. <view class="top">
  6. <view class="photo">
  7. <u-avatar :src="src"></u-avatar>
  8. </view>
  9. <!-- <view class="login">
  10. 请登录
  11. </view> -->
  12. <!-- 已登录 -->
  13. <view class="logined">
  14. <view class="name" >
  15. <template v-if="userInfo&&userInfo.id">
  16. 你好,{{userInfo.realName?userInfo.realName:'用户'+userInfo.id.slice(0,3)}}
  17. </template>
  18. <template v-else>
  19. 未登录
  20. </template>
  21. <view class="img-box" v-if="userInfo.status==1">
  22. <img src="@/assets/img/riFill-shield-user-fill@1x.png" alt="">
  23. </view>
  24. </view>
  25. <view class="tel">
  26. <template v-if="userInfo&&userInfo.id">
  27. {{userInfo.phone}}
  28. </template>
  29. </view>
  30. </view>
  31. </view>
  32. <!-- 求职信息 -->
  33. <view class="card card1">
  34. <view class="title">
  35. 求职信息
  36. <img class="showImg" v-if="ck1()" src="@/assets/img/riFill-checkbox-circle-fill@1x.png" >
  37. <img class="showImg" v-else src="@/assets/img/riFill-error-warning-fill@1x.png"></img>
  38. </view>
  39. <u-grid :col="3" :border="false">
  40. <u-grid-item @click="gotoUrl1('pages/packages/mine/myJobInformation/myJobInformation')">
  41. <view class="icon">
  42. <img src="@/assets/img/riLine-folder-user-line@1x.png" alt="">
  43. </view>
  44. <view class="grid-text">求职信息</view>
  45. </u-grid-item>
  46. <u-grid-item @click="gotoUrl1('pages/packages/mine/myJobInformation/myRegistration?c=0')">
  47. <view class="icon">
  48. <img src="@/assets/img/riLine-todo-line@1x.png" alt="">
  49. </view>
  50. <view class="grid-text">我的报名</view>
  51. </u-grid-item>
  52. <u-grid-item @click="gotoUrl1('pages/packages/mine/myJobInformation/myRegistration?c=1')">
  53. <u-badge :count="num1" size="mini" :offset="[28,34]"></u-badge>
  54. <view class="icon">
  55. <img src="@/assets/img/riLine-mail-star-line@1x.png" alt="">
  56. </view>
  57. <view class="grid-text">收到邀请</view>
  58. </u-grid-item>
  59. </u-grid>
  60. </view>
  61. <!-- 用工服务 -->
  62. <view class="card ">
  63. <view class="title">
  64. 用工服务
  65. <img class="showImg" v-if="ck2()" src="@/assets/img/riFill-checkbox-circle-fill@1x.png" >
  66. <img class="showImg" v-else src="@/assets/img/riFill-error-warning-fill@1x.png"></img>
  67. </view>
  68. <u-grid :col="4" :border="false">
  69. <u-grid-item @click="gotoUrl2('pages/packages/mine/employmentService/laborManagement/laborManagement')">
  70. <view class="icon">
  71. <img src="@/assets/img/riLine-folder-2-line@1x.png" alt="">
  72. </view>
  73. <view class="grid-text">用工管理</view>
  74. </u-grid-item>
  75. <u-grid-item @click="gotoUrl2('pages/packages/mine/employmentService/receiveRegistration?c=0')">
  76. <u-badge :count="num2" size="mini" :offset="[28,34]"></u-badge>
  77. <view class="icon">
  78. <img src="@/assets/img/riLine-inbox-archive-line@1x.png" alt="">
  79. </view>
  80. <view class="grid-text">收到报名</view>
  81. </u-grid-item>
  82. <u-grid-item @click="gotoUrl2('pages/packages/mine/employmentService/receiveRegistration?c=1')">
  83. <view class="icon">
  84. <img src="@/assets/img/riLine-time-line@1x.png" alt="">
  85. </view>
  86. <view class="grid-text">邀请记录</view>
  87. </u-grid-item>
  88. <u-grid-item @click="gotoUrl2('pages/packages/mine/employmentService/shareEmployment')">
  89. <view class="icon">
  90. <img src="@/assets/img/riLine-service-line@1x.png" alt="">
  91. </view>
  92. <view class="grid-text">共享用工</view>
  93. </u-grid-item>
  94. </u-grid>
  95. </view>
  96. <!-- 其他服务 -->
  97. <view class="card ">
  98. <view class="title">
  99. 其他服务
  100. </view>
  101. <u-grid :col="3" :border="false">
  102. <u-grid-item @click="toAuthentication">
  103. <img v-if="ck1()||ck2()" src="@/assets/img/riFill-checkbox-circle-fill@1x.png" class="checked">
  104. <img v-else src="@/assets/img/riFill-error-warning-fill@1x.png" class="badge-icon"></img>
  105. <view class="icon">
  106. <img src="@/assets/img/riLine-shield-user-line@1x.png" alt="">
  107. </view>
  108. <view class="grid-text">实名认证</view>
  109. </u-grid-item>
  110. <u-grid-item @click="showPhoneMethod">
  111. <view class="icon">
  112. <img src="@/assets/img/riLine-customer-service-line@1x.png" alt="">
  113. </view>
  114. <view class="grid-text">联系客服</view>
  115. </u-grid-item>
  116. <!-- <u-grid-item>
  117. <view class="icon">
  118. <img src="@/assets/img/riLine-logout-box-r-line@1x.png" alt="">
  119. </view>
  120. <view class="grid-text">退出登录</view>
  121. </u-grid-item> -->
  122. </u-grid>
  123. </view>
  124. <!-- 登录弹窗 -->
  125. <u-popup v-model="show" mode="center" border-radius="24" :closeable="true" @close="close" >
  126. <view class="u-mode-center-main">
  127. <view class="title">
  128. 登录荆开零工驿站
  129. </view>
  130. <view >
  131. <button class="login-btn" @click="decryptPhoneNumberH5"
  132. open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber" >
  133. <u-icon name="weixin-fill" size="46"></u-icon> <text>微信用户一键登录</text>
  134. </button>
  135. </view>
  136. <view class="radio" v-if="false">
  137. <!-- <radio></radio>
  138. <view class="agreement">
  139. 阅读并同意<text style="color: #2795FD">《用户隐私协议》</text>
  140. </view> -->
  141. <u-radio-group v-model="value">
  142. <u-radio active-color="red">阅读并同意<text style="color: #2795FD">《用户隐私协议》</text></u-radio>
  143. </u-radio-group>
  144. </view>
  145. </view>
  146. </u-popup>
  147. <u-modal v-model="showPhone" @confirm="confirmPhone" :confirm-text="confirmText" confirm-color="#606266" :show-cancel-button="true" ref="uModal"
  148. :asyncClose="true" title="客服电话" :content="content" :content-style="{fontSize: '24px',color: '#101010'}"></u-modal>
  149. <tabbar :current="4"></tabbar>
  150. </view>
  151. </template>
  152. <script>
  153. import * as API from '@/apis/pagejs/tab.js'
  154. import * as API_weixin from '@/apis/weixin.js'
  155. import tabbar from "@/components/Tabbar.vue"
  156. export default {
  157. components: {
  158. tabbar
  159. },
  160. data() {
  161. return {
  162. src: '',
  163. show:false,
  164. value: 'false',
  165. userInfo:{},
  166. showPhone:false,
  167. confirmText: '拨打电话',
  168. content:"",
  169. num1:0,
  170. num2:0
  171. }
  172. },
  173. onLoad() {
  174. this.userInfo=this.carhelp.getPersonInfo()
  175. this.findByOpenId();
  176. },
  177. methods: {
  178. ck1(){
  179. var user = this.carhelp.getPersonInfo();
  180. if (user.status != 1) {
  181. return false
  182. }
  183. return true
  184. },
  185. ck2(){
  186. var enterpriseInfo=this.carhelp.getPersonInfoPlus().enterpriseInfo;
  187. if (!enterpriseInfo||enterpriseInfo.status!=1) {
  188. return false
  189. }
  190. return true
  191. },
  192. gotoUrl1(url){
  193. if(this.ck1()){
  194. }else{
  195. uni.showToast({icon: 'none',
  196. title:"当前操作需要实名认证"
  197. })
  198. return
  199. }
  200. uni.navigateTo({
  201. url: "/" + url
  202. })
  203. },
  204. gotoUrl2(url){
  205. if(this.ck2()){
  206. }else{
  207. uni.showToast({icon: 'none',
  208. title:"当前操作需要进行企业认证"
  209. })
  210. return
  211. }
  212. uni.navigateTo({
  213. url: "/" + url
  214. })
  215. },
  216. gotoMyJobInformation(){
  217. //zkx 需要认证
  218. uni.navigateTo({
  219. url:"/pages/packages/mine/myJobInformation/myJobInformation"
  220. })
  221. },
  222. confirmPhone(){
  223. this.showPhone = false;
  224. uni.makePhoneCall({
  225. phoneNumber:this.content //仅为示例
  226. });
  227. },
  228. showPhoneMethod(){
  229. if(this.content==""){
  230. uni.showLoading({
  231. title: "加载中",
  232. mask: true,
  233. })
  234. API_weixin.findValueByName({
  235. name:'客服电话'
  236. }).then((res) => {
  237. this.content=res.data
  238. uni.hideLoading();
  239. this.showPhone=true;
  240. }).catch(error => {
  241. this.showPhone=false;
  242. uni.hideLoading();
  243. })
  244. }else{
  245. this.showPhone=true;
  246. }
  247. },
  248. getNum1(){
  249. API.myRegistration({
  250. pageIndex: 1,
  251. pageSize: 0,
  252. type: 1
  253. }).then((res) => {
  254. this.num1=res.data.recordsTotal
  255. }).catch(error => {
  256. //.log(error)
  257. })
  258. },
  259. getNum2(){
  260. API.myReceivedRegistration({
  261. pageIndex: 1,
  262. pageSize: 0,
  263. status: 1
  264. }).then((res) => {
  265. this.num2=res.data.recordsTotal
  266. }).catch(error => {
  267. //.log(error)
  268. })
  269. },
  270. findByOpenId(){
  271. uni.showLoading({
  272. title: "加载中",
  273. mask: true,
  274. })
  275. API_weixin.findByOpenId({
  276. openId:this.carhelp.getOpenId(),
  277. noerror:true
  278. }).then((res) => {
  279. this.carhelp.setPersonInfo(res.data.regUser );
  280. this.carhelp.setToken(res.data.token);
  281. this.carhelp.setPersonInfoPlus(res.data);
  282. this.userInfo=res.data.regUser;
  283. this.src=this.userInfo.photo
  284. uni.hideLoading();
  285. this.show=false;
  286. if(this.ck1()){
  287. this.getNum1()
  288. }
  289. if(this.ck2()){
  290. this.getNum2()
  291. }
  292. }).catch(error => {
  293. //.log("11111")
  294. this.userInfo={};
  295. uni.hideLoading();
  296. this.show=true;
  297. // uni.showToast({icon: 'none',
  298. // title: error
  299. // })
  300. //this.getPhone()
  301. })
  302. },
  303. close(){
  304. // #ifdef MP-WEIXIN
  305. // #endif
  306. if(this.userInfo.id){
  307. }else{
  308. uni.reLaunch({
  309. url:"/"
  310. })
  311. }
  312. },
  313. decryptPhoneNumberH5(){
  314. // #ifdef H5
  315. this.show=false
  316. var _this=this
  317. uni.showModal({
  318. title: '输入手机号测试',
  319. editable: true,
  320. //content: '这是一个模态弹窗',
  321. success: function(res) {
  322. if (res.confirm) {
  323. API.createUser({
  324. phone:res.content,
  325. openId:_this.carhelp.getOpenId()
  326. }).then((res2) => {
  327. _this.findByOpenId()
  328. }).catch(error2 => {
  329. uni.showToast({icon: 'none',
  330. title: error2
  331. })
  332. })
  333. } else if (res.cancel) {
  334. //.log('用户点击取消');
  335. }
  336. }
  337. });
  338. // #endif
  339. },
  340. decryptPhoneNumber(e){
  341. //.log(e.detail.code)
  342. uni.showLoading({
  343. title: "加载中",
  344. mask: true,
  345. })
  346. API_weixin.findUserPhoneNumber(e.detail.code).then((res) => {
  347. if(res.data){
  348. //.log(res)
  349. API.createUser({
  350. phone:res.data,
  351. openId:this.carhelp.getOpenId()
  352. }).then((res2) => {
  353. this.findByOpenId()
  354. }).catch(error2 => {
  355. uni.showToast({icon: 'none',
  356. title: error2
  357. })
  358. })
  359. }else{
  360. uni.showToast({
  361. icon: 'none',
  362. title: "获取手机号失败,请检查"
  363. })
  364. }
  365. }).catch(error => {
  366. uni.showToast({icon: 'none',
  367. title: error
  368. })
  369. //this.getPhone()
  370. })
  371. },
  372. customBack(){
  373. },
  374. toAuthentication() {
  375. uni.navigateTo({
  376. url: '/pages/packages/mine/otherServices/authentication'
  377. })
  378. },
  379. toShareEmployment() {
  380. uni.navigateTo({
  381. url: '/pages/packages/mine/employmentService/shareEmployment'
  382. })
  383. }
  384. }
  385. }
  386. </script>
  387. <style>
  388. page {
  389. background: #F0F0F2;
  390. padding-bottom: 150px;
  391. }
  392. </style>
  393. <style lang="scss" scoped>
  394. .showImg{
  395. width: 38rpx ;
  396. height: 38rpx ;
  397. }
  398. .top{
  399. display: flex;
  400. align-items: center;
  401. padding: 40rpx 32rpx 88rpx;
  402. background:url(@/assets/img/mineCover.png),linear-gradient(180deg, rgba(39,149,253,1) 0%,rgba(118,182,255,1) 100%);
  403. background-repeat:no-repeat;
  404. background-position: right;
  405. .photo{
  406. /deep/.u-avatar{
  407. width: 120rpx !important;
  408. height: 120rpx !important;
  409. box-shadow: 0px 1px 3px 0px rgba(39, 149, 253, 100);
  410. border: 2px solid rgba(255, 255, 255, 1);
  411. }
  412. }
  413. .login{
  414. color: rgba(255, 255, 255, 1);
  415. font-size: 40rpx;
  416. text-align: left;
  417. font-family: 'PingFangSC-medium';
  418. margin-left: 24rpx;
  419. }
  420. .logined{
  421. color: rgba(255, 255, 255, 1);
  422. margin-left: 24rpx;
  423. .name{
  424. font-size: 40rpx;
  425. font-family: 'PingFangSC-medium';
  426. display: flex;
  427. align-items: center;
  428. .img-box{
  429. margin-left: 8rpx;
  430. overflow: hidden;
  431. img{
  432. width: 40rpx;
  433. height: 40rpx;
  434. vertical-align: middle;
  435. z-index: 999;
  436. position: relative;
  437. }
  438. }
  439. }
  440. .tel{
  441. margin-top: 8rpx;
  442. font-size: 32rpx;
  443. }
  444. }
  445. }
  446. .card1{
  447. margin-top: -32rpx !important;
  448. }
  449. .card{
  450. background-color: #fff;
  451. border-radius: 12px;
  452. margin: 32rpx ;
  453. padding: 32rpx;
  454. /deep/.u-grid-item{
  455. width: 25% !important;
  456. }
  457. .title{
  458. color: rgba(16, 16, 16, 1);
  459. font-size: 40rpx;
  460. margin-bottom: 20rpx;
  461. }
  462. .grid-text{
  463. color: rgba(51, 51, 51, 1);
  464. margin-top: 8rpx;
  465. }
  466. .icon{
  467. width: 56rpx;
  468. height: 56rpx;
  469. img{
  470. width: 100%;
  471. height: 100%;
  472. }
  473. }
  474. .badge-icon {
  475. position: absolute;
  476. top: 24rpx;
  477. right: 40rpx;
  478. width: 30rpx;
  479. height: 30rpx;
  480. }
  481. .checked{
  482. position: absolute;
  483. bottom: 72rpx;
  484. right: 40rpx;
  485. width: 30rpx;
  486. height: 30rpx;
  487. }
  488. }
  489. // 弹窗
  490. .u-mode-center-main{
  491. width: 560rpx !important;
  492. border-radius: 12px;
  493. padding: 80rpx 48rpx;
  494. .title{
  495. color: rgba(16, 16, 16, 1);
  496. font-size: 36rpx;
  497. font-family: 'PingFangSC-medium';
  498. }
  499. .login-btn{
  500. background-color: rgba(0, 188, 99, 1);
  501. color: #fff;
  502. padding: 8rpx 70rpx;
  503. margin-top: 56rpx;
  504. margin-bottom: 16rpx;
  505. border-radius: 8px;
  506. display: flex;
  507. font-size: 32rpx;
  508. text{
  509. margin-left: 8rpx;
  510. }
  511. }
  512. .radio {
  513. display: inline-block;
  514. width: 100%;
  515. display: flex;
  516. justify-content: center;
  517. font-size: 24rpx;
  518. color: #777777;
  519. margin-left: 20rpx;
  520. .uni-radio-input{
  521. width: 24rpx;
  522. height: 24rpx;
  523. }
  524. .uni-radio-input-checked:before{
  525. font-size: 24rpx;
  526. background-color: rgb(0, 122, 255);
  527. border-color: rgb(0, 122, 255);
  528. }
  529. }
  530. }
  531. </style>