mine.vue 16 KB

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