mine.vue 16 KB

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