personalCenter.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. <template>
  2. <view class="container">
  3. <view class="user-box">
  4. <view class="icon-name-box">
  5. <view class="icon-box">
  6. <cover-image class="icon" :src="user.userIcon" @click="onIconOpen"></cover-image>
  7. </view>
  8. <view class="name-box">
  9. <view class="name" v-if="isLogin">
  10. <view class="text">
  11. {{user.name}}
  12. </view>
  13. <view class="iconfont icon-xiugai" @click="onIconOpen"></view>
  14. </view>
  15. <view class="function" v-else>
  16. <view class="function-item" @click="toLogin">
  17. 登录
  18. </view>/
  19. <view class="function-item" @click="toRegister">
  20. 注册
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="info-box">
  26. <view class="info-item-box">
  27. <view class="label">
  28. 任职机构:
  29. </view>
  30. <view class="text">
  31. {{isLogin ? user.corpName ?? '无' : ''}}
  32. </view>
  33. </view>
  34. <view class="info-item-box">
  35. <view class="label">
  36. 机构备案证号:
  37. </view>
  38. <view class="text">
  39. {{isLogin ? user.corpRegNo ?? '无' : ''}}
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="certificate-box">
  45. <view class="title-box">
  46. 我的证件
  47. </view>
  48. <view class="list-box">
  49. <view class="list-item-box" @click="onShowCreditCard">
  50. <CreditCard :isLogin="isLogin" :data="creditCard" @guide="onCreditCardGuideClick()"></CreditCard>
  51. </view>
  52. <view class="list-item-box" :class="[isLogin ? (zhongjie.zsbh ? 'zhongjie-back' : 'zhongjie-back-zhiyin') : 'zhongjie-back-login']" @click="onZhongJieRenZhengClick(zhongjie.zsbh)">
  53. </view>
  54. <view class="list-item-box" :class="[isLogin ? (anjie.zsbh ? 'anjie-back' : 'anjie-back-zhiyin') : 'anjie-back-login']" @click="onAnJieRenZhengClick(anjie.zsbh)">
  55. </view>
  56. </view>
  57. </view>
  58. <u-popup v-model="showCreditCard" mode="center">
  59. <view class="certificate-preview-box">
  60. <CreditCard :isLogin="isLogin" :size="`normal ${creditCard.isAgtNTAsst ? 'green' : creditCard.isAgtNT ? 'red' : 'blue'}`" :data="creditCard"></CreditCard>
  61. </view>
  62. </u-popup>
  63. <view class="menu-box">
  64. <view class="menu-item-box" @click="onHuiFeiJiaoJiao()">
  65. <view class="icon-box">
  66. <view class="iconfont icon-qianbi"></view>
  67. </view>
  68. <view class="content-box">
  69. 会费缴交
  70. </view>
  71. <view class="suffix-box">
  72. <view class="iconfont icon-chevron-right"></view>
  73. </view>
  74. </view>
  75. <view class="menu-item-box" @click="onHuiFeiJiaoJiao()">
  76. <view class="icon-box">
  77. <view class="iconfont icon-qianbi"></view>
  78. </view>
  79. <view class="content-box">
  80. 继续教育年检
  81. </view>
  82. <view class="suffix-box">
  83. <view class="iconfont icon-chevron-right"></view>
  84. </view>
  85. </view>
  86. <view class="menu-item-box" @click="onWoDeDingDan()">
  87. <view class="icon-box">
  88. <view class="iconfont icon-dingdan"></view>
  89. </view>
  90. <view class="content-box">
  91. 我的订单
  92. </view>
  93. <view class="suffix-box">
  94. <view class="iconfont icon-chevron-right"></view>
  95. </view>
  96. </view>
  97. <!-- <view class="menu-item-box">
  98. <view class="icon-box">
  99. <view class="iconfont icon-xiazai"></view>
  100. </view>
  101. <view class="content-box">
  102. 视频缓存
  103. </view>
  104. <view class="suffix-box">
  105. <view class="iconfont icon-chevron-right"></view>
  106. </view>
  107. </view> -->
  108. <view class="menu-item-box">
  109. <view class="icon-box">
  110. <view class="iconfont icon-shoucang"></view>
  111. </view>
  112. <view class="content-box" @click="onWoDeShouChang()">
  113. 我的收藏
  114. </view>
  115. <view class="suffix-box">
  116. <view class="iconfont icon-chevron-right"></view>
  117. </view>
  118. </view>
  119. <view class="menu-item-box" @click="onChangJianWenTi()">
  120. <view class="icon-box">
  121. <view class="iconfont icon-anquan"></view>
  122. </view>
  123. <view class="content-box">
  124. 常见问题
  125. </view>
  126. <view class="suffix-box">
  127. <view class="iconfont icon-chevron-right"></view>
  128. </view>
  129. </view>
  130. <view class="menu-item-box" @click="onLianXiWoMen()">
  131. <view class="icon-box">
  132. <view class="iconfont icon-yonghuzu"></view>
  133. </view>
  134. <view class="content-box">
  135. 联系我们
  136. </view>
  137. <view class="suffix-box">
  138. <view class="iconfont icon-chevron-right"></view>
  139. </view>
  140. </view>
  141. <view class="menu-item-box" @click="onLogout()">
  142. <view class="icon-box">
  143. <view class="iconfont icon-shezhi"></view>
  144. </view>
  145. <view class="content-box">
  146. 退出/切换账号
  147. </view>
  148. <view class="suffix-box">
  149. <view class="iconfont icon-chevron-right"></view>
  150. </view>
  151. </view>
  152. </view>
  153. <u-popup v-model="iconVisible" mode="center" border-radius="10">
  154. <view class="icon-list-box">
  155. <view class="title">
  156. 修改头像
  157. </view>
  158. <u-row gutter="20">
  159. <u-col span="3" v-for="icon in iconList" :key="icon.name" @click="currentIcon = icon">
  160. <view class="icon-item" :class="{'icon-active': icon.name === currentIcon.name}">
  161. <cover-image class="icon" :src="icon.url"></cover-image>
  162. </view>
  163. </u-col>
  164. </u-row>
  165. <view class="button-box">
  166. <view class="button-item">
  167. <u-button type="primary" @click="onIconSubmit">修改</u-button>
  168. </view>
  169. <view class="button-item">
  170. <u-button type="info" @click="onIconCancel">取消</u-button>
  171. </view>
  172. </view>
  173. </view>
  174. </u-popup>
  175. <!-- 与包裹页面所有内容的元素u-page同级,且在它的下方 -->
  176. <u-tabbar v-model="tabbarCurrentIndex" :list="tabbarList" icon-size="50" :active-color="tabbarActiveColor" :inactive-color="tabbarInactiveColor"></u-tabbar>
  177. </view>
  178. </template>
  179. <script setup>
  180. import CreditCard from '@/components/creditCard.vue'
  181. import { ref, computed } from 'vue'
  182. import { onLoad } from '@dcloudio/uni-app'
  183. import { getToken, removeToken } from '@/utils/auth.js'
  184. import { useAuthStore } from '@/store/authStore'
  185. import { getCreditCard, getZhongjie, getAnjie, getIconList, updateIcon } from '@/api/user.js'
  186. import { msgError, msgSuccess, showConfirm } from '@/utils/common'
  187. import { useTabbarStore } from '@/store/tabbarStore.js'
  188. const tabbarStore = useTabbarStore()
  189. // 底部导航栏数据
  190. const tabbarList = computed(() => {
  191. return tabbarStore.list
  192. })
  193. // 底部导航栏选中颜色
  194. const tabbarActiveColor = computed(() => {
  195. return tabbarStore.activeColor
  196. })
  197. // 底部导航栏未选中颜色
  198. const tabbarInactiveColor = computed(() => {
  199. return tabbarStore.inactiveColor
  200. })
  201. const tabbarCurrentIndex = 0
  202. const authStore = useAuthStore()
  203. // 用户信息
  204. const user = ref({
  205. userIcon: '1',
  206. name: '某某某',
  207. corpName: '广州市xx地产有限公司',
  208. corpRegNo: '123xxxx'
  209. })
  210. const iconVisible = ref(false)
  211. const iconList = ref([
  212. {
  213. name: '',
  214. src: ''
  215. }
  216. ])
  217. const currentIcon = ref({
  218. name: '',
  219. src: ''
  220. })
  221. function onIconOpen() {
  222. if (!isLogin) {
  223. return
  224. }
  225. currentIcon.value = iconList.value[0]
  226. iconVisible.value = true
  227. }
  228. function onIconSubmit() {
  229. updateIcon({userIcon: currentIcon.value.name}).then(res => {
  230. if (res && res.message === 'success') {
  231. msgSuccess('修改成功')
  232. authStore.setUserIcon(currentIcon.value.url)
  233. iconVisible.value = false
  234. } else {
  235. msgError('修改失败')
  236. }
  237. })
  238. }
  239. function onIconCancel() {
  240. iconVisible.value = false
  241. }
  242. // 是否预览信用信息卡
  243. const showCreditCard = ref(false)
  244. // 信用信息卡
  245. const creditCard = ref({
  246. creditNo: 'GZ2028000001',
  247. name: '彭于晏',
  248. date: '2018年6月22日',
  249. publisher: '广州市住房和城乡建设委员会',
  250. headUrl: 'https://ok.166.net/reunionpub/1_20210628_17a5105e667995566.jpeg',
  251. url: 'http://www.gzrea.org.cn:8543/icon/wxmp/zhengshu/qrCode.png',
  252. isAgtNT: false,
  253. isAgtNTAsst: false
  254. })
  255. function onShowCreditCard() {
  256. showCreditCard.value = false
  257. if (isLogin.value) {
  258. showCreditCard.value = true
  259. }
  260. }
  261. // 信息信用卡-点击指引
  262. function onCreditCardGuideClick() {
  263. // {
  264. // "id": 26314850,
  265. // "title": "广州市房地产中介服务人员 —— 信用信息卡办理指引",
  266. // "date": "2018-10-22"
  267. // },
  268. console.log('点击-信息信用卡指引');
  269. }
  270. // 中介认证点击
  271. function onZhongJieRenZhengClick(valid) {
  272. if (!isLogin.value) {
  273. return
  274. }
  275. if (valid) {
  276. // {
  277. // "id": 33842433,
  278. // "title": "广州市房地产中介从业人员信用信息卡办理指引",
  279. // "date": "2018-10-26"
  280. // },
  281. uni.navigateTo({
  282. url: '/pages/certificateDetail/certificateDetail?type=zhongjie&title=广州市房地产中介从业人员水平认证证书'
  283. })
  284. } else {
  285. console.log('跳转中介认证报名指引');
  286. }
  287. }
  288. // 按揭认证点击
  289. function onAnJieRenZhengClick(valid) {
  290. if (!isLogin.value) {
  291. return
  292. }
  293. if (valid) {
  294. uni.navigateTo({
  295. url: '/pages/certificateDetail/certificateDetail?type=anjie&title=广州市房地产按揭从业人员水平认证证书'
  296. })
  297. } else {
  298. console.log('跳转按揭认证报名指引');
  299. }
  300. }
  301. const zhongjie = ref({
  302. zsbh: null,
  303. fzbm: null,
  304. fzrq: null,
  305. xm: null,
  306. xb: null,
  307. sfzh: null,
  308. whcd: null
  309. })
  310. const anjie = ref({
  311. zsbh: null,
  312. fzbm: null,
  313. fzrq: null,
  314. xm: null,
  315. xb: null,
  316. sfzh: null,
  317. whcd: null
  318. })
  319. function showMsg() {
  320. showConfirm('登录状态已过期,您可以继续留在该页面,或者重新登录?').then(res => {
  321. if (res.confirm) {
  322. uni.reLaunch({
  323. url: '/pages/initial/initial'
  324. });
  325. }
  326. })
  327. }
  328. // 点击-会费缴交
  329. function onHuiFeiJiaoJiao() {
  330. if (!isLogin.value) {
  331. showMsg()
  332. return
  333. }
  334. uni.navigateTo({
  335. url: '/pages/huiFeiJiaoJiao/huiFeiJiaoJiao'
  336. })
  337. }
  338. // 点击-我的订单
  339. function onWoDeDingDan() {
  340. if (!isLogin.value) {
  341. showMsg()
  342. return
  343. }
  344. uni.navigateTo({
  345. url: '/pages/order/order'
  346. })
  347. }
  348. // 点击-我的收藏
  349. function onWoDeShouChang() {
  350. if (!isLogin.value) {
  351. showMsg()
  352. return
  353. }
  354. uni.navigateTo({
  355. url: '/pages/collect/collect'
  356. })
  357. }
  358. // 点击-常见问题
  359. function onChangJianWenTi() {
  360. console.log('点击-常见问题');
  361. }
  362. // 点击-联系我们
  363. function onLianXiWoMen() {
  364. console.log('点击-联系我们');
  365. }
  366. // 点击-退出登录
  367. function onLogout() {
  368. if (!isLogin.value) {
  369. return
  370. }
  371. removeToken()
  372. uni.redirectTo({
  373. url: '/pages/initial/initial'
  374. })
  375. }
  376. function toLogin() {
  377. uni.navigateTo({
  378. url: '/pages/initial/initial'
  379. })
  380. }
  381. function toRegister() {
  382. uni.navigateTo({
  383. url: '/pages/register/register'
  384. })
  385. }
  386. const isLogin = computed(() => {
  387. return getToken() ? true : false
  388. })
  389. onLoad(() => {
  390. user.value = authStore.userInfo
  391. getCreditCard().then(res => {
  392. if (res && res.message === 'success') {
  393. creditCard.value = res.data
  394. authStore.setCreditCard(res.data)
  395. getZhongjie().then(res => {
  396. if (res && res.message === 'success') {
  397. zhongjie.value = res.data ?? {zsbh: null}
  398. }
  399. })
  400. getAnjie().then(res => {
  401. if (res && res.message === 'success') {
  402. anjie.value = res.data ?? {zsbh: null}
  403. }
  404. })
  405. getIconList().then(res => {
  406. if (res && res.message === 'success') {
  407. iconList.value = res.data
  408. }
  409. })
  410. }
  411. })
  412. })
  413. </script>
  414. <style lang="scss" scoped>
  415. $certificate-width: 220rpx;
  416. $certificate-height: 300rpx;
  417. .container {
  418. height: 100vh;
  419. width: 100vw;
  420. padding: 0 20rpx;
  421. background: rgb(141, 204, 255);
  422. background: -moz-linear-gradient( 90deg, rgb(141, 204, 255) 10%, rgb(247, 247, 247) 30%);
  423. background: -webkit-linear-gradient(90deg, rgb(141, 204, 255) 10%, rgb(247, 247, 247) 30%);
  424. background: -o-linear-gradient( 90deg, rgb(141, 204, 255) 10%, rgb(247, 247, 247) 30%);
  425. background: -ms-linear-gradient( 90deg, rgb(141, 204, 255) 10%, rgb(247, 247, 247) 30%);
  426. background: linear-gradient( 180deg, rgb(141, 204, 255) 10%, rgb(247, 247, 247) 30%);
  427. .user-box {
  428. padding: 0 40rpx;
  429. .icon-name-box {
  430. display: flex;
  431. align-items: center;
  432. gap: 30rpx;
  433. margin-bottom: 15rpx;
  434. .icon-box {
  435. width: 90rpx;
  436. height: 90rpx;
  437. background-color: #fff;
  438. border-radius: 50%;
  439. overflow: hidden;
  440. -webkit-box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(168, 221, 239, 0.75);
  441. -moz-box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(168, 221, 239, 0.75);
  442. box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(168, 221, 239, 0.75);
  443. .icon {
  444. height: 100%;
  445. width: 100%;
  446. object-fit: cover;
  447. }
  448. }
  449. .name-box {
  450. font-size: $uni-title-font-size-1;
  451. letter-spacing: 5rpx;
  452. .name {
  453. display: flex;
  454. gap: 5rpx;
  455. .iconfont {
  456. font-size: $uni-font-size-3;
  457. }
  458. }
  459. .function {
  460. display: flex;
  461. gap: 5rpx;
  462. }
  463. }
  464. }
  465. .info-box {
  466. .info-item-box {
  467. display: flex;
  468. align-items: center;
  469. gap: 10rpx;
  470. margin-bottom: 10rpx;
  471. font-size: $uni-font-size-1;
  472. font-weight: bold;
  473. letter-spacing: 3rpx;
  474. }
  475. }
  476. }
  477. .certificate-box {
  478. padding: 0 20rpx;
  479. margin-top: 20rpx;
  480. .title-box {
  481. font-size: $uni-title-font-size-3;
  482. font-weight: bold;
  483. }
  484. .list-box {
  485. padding: 20rpx 50rpx;
  486. width: 100%;
  487. display: flex;
  488. gap: 130rpx;
  489. overflow-x: scroll;
  490. overflow-y: hidden;
  491. white-space:nowrap;
  492. .list-item-box {
  493. flex-shrink: 0;
  494. height: $certificate-height;
  495. width: $certificate-width;
  496. background-color: #fff;
  497. &:nth-child(1) {
  498. background-color: #fff;
  499. }
  500. }
  501. .zhongjie-back {
  502. z-index: 999;
  503. @include backgroundImg('http://www.gzrea.org.cn:8543/icon/wxmp/zhengshu/zhongjie-back.png')
  504. }
  505. .zhongjie-back-login {
  506. @include backgroundImg('http://www.gzrea.org.cn:8543/icon/wxmp/zhengshu/zhongjie-back-login.png')
  507. }
  508. .zhongjie-back-zhiyin {
  509. @include backgroundImg('http://www.gzrea.org.cn:8543/icon/wxmp/zhengshu/zhongjie-back-zhiyin.png')
  510. }
  511. .anjie-back {
  512. z-index: 999;
  513. @include backgroundImg('http://www.gzrea.org.cn:8543/icon/wxmp/zhengshu/anjie-back.png')
  514. }
  515. .anjie-back-login {
  516. @include backgroundImg('http://www.gzrea.org.cn:8543/icon/wxmp/zhengshu/anjie-back-login.png')
  517. }
  518. .anjie-back-zhiyin {
  519. @include backgroundImg('http://www.gzrea.org.cn:8543/icon/wxmp/zhengshu/anjie-back-zhiyin.png')
  520. }
  521. }
  522. }
  523. .certificate-preview-box {
  524. height: 65vh;
  525. width: 75vw;
  526. }
  527. .menu-box {
  528. padding: 20rpx 20rpx;
  529. margin: 10rpx 0;
  530. background-color: #fff;
  531. width: 100%;
  532. border-radius: $uni-card-border-radius;
  533. -webkit-box-shadow: 0px 0px 12rpx 0px rgba(50, 50, 50, 0.25);
  534. -moz-box-shadow: 0px 0px 12rpx 0px rgba(50, 50, 50, 0.25);
  535. box-shadow: 0px 0px 12rpx 0px rgba(50, 50, 50, 0.25);
  536. .menu-item-box {
  537. height: 100rpx;
  538. font-size: $uni-font-size-1;
  539. padding: 10rpx;
  540. display: flex;
  541. gap: 10rpx;
  542. align-items: center;
  543. border-radius: $uni-card-border-radius;
  544. &:active {
  545. background-color: $uni-bg-color-hover;
  546. }
  547. .icon-box {
  548. width: 5%;
  549. font-weight: bold;
  550. }
  551. .content-box {
  552. width: 75%;
  553. letter-spacing: 3rpx;
  554. }
  555. .suffix-box {
  556. width: 20%;
  557. text-align: right;
  558. }
  559. }
  560. }
  561. .icon-list-box {
  562. padding: 30rpx;
  563. width: 90vw;
  564. .title {
  565. font-size: $uni-title-font-size-2;
  566. font-weight: bold;
  567. margin-bottom: 30rpx;
  568. }
  569. .icon-item {
  570. width: 120rpx;
  571. height: 120rpx;
  572. border-radius: 50%;
  573. border: 1px solid #ccc;
  574. margin-bottom: 20rpx;
  575. .icon {
  576. height: 100%;
  577. width: 100%;
  578. object-fit: cover;
  579. }
  580. }
  581. .icon-active {
  582. border: 1px solid $uni-color-primary;
  583. }
  584. .button-box {
  585. margin-top: 30rpx;
  586. display: flex;
  587. align-items: center;
  588. gap: 30rpx;
  589. .button-item {
  590. &:first-child{
  591. margin-left: auto;
  592. }
  593. &:last-child {
  594. margin-right: auto;
  595. }
  596. }
  597. }
  598. }
  599. }
  600. </style>