mine.vue 17 KB

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