personalCenter.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  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"></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">
  17. 登录
  18. </view>/
  19. <view class="function-item">
  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 red" :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.src"></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 } 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. currentIcon.value = iconList.value[0]
  223. iconVisible.value = true
  224. }
  225. function onIconSubmit() {
  226. updateIcon({userIcon: currentIcon.value.name}).then(res => {
  227. if (res && res.message === 'success') {
  228. msgSuccess('修改成功')
  229. authStore.setUserIcon(currentIcon.value.src)
  230. iconVisible.value = false
  231. } else {
  232. msgError('修改失败')
  233. }
  234. })
  235. }
  236. function onIconCancel() {
  237. iconVisible.value = false
  238. }
  239. // 是否预览信用信息卡
  240. const showCreditCard = ref(false)
  241. // 信用信息卡
  242. const creditCard = ref({
  243. creditNo: 'GZ2028000001',
  244. name: '彭于晏',
  245. date: '2018年6月22日',
  246. publisher: '广州市住房和城乡建设委员会',
  247. headUrl: 'https://ok.166.net/reunionpub/1_20210628_17a5105e667995566.jpeg',
  248. url: 'http://www.gzrea.org.cn:8543/icon/wxmp/zhengshu/qrCode.png'
  249. })
  250. function onShowCreditCard() {
  251. showCreditCard.value = false
  252. if (isLogin.value) {
  253. showCreditCard.value = true
  254. }
  255. }
  256. // 信息信用卡-点击指引
  257. function onCreditCardGuideClick() {
  258. // {
  259. // "id": 26314850,
  260. // "title": "广州市房地产中介服务人员 —— 信用信息卡办理指引",
  261. // "date": "2018-10-22"
  262. // },
  263. console.log('点击-信息信用卡指引');
  264. }
  265. // 中介认证点击
  266. function onZhongJieRenZhengClick(valid) {
  267. if (!isLogin.value) {
  268. return
  269. }
  270. if (valid) {
  271. // {
  272. // "id": 33842433,
  273. // "title": "广州市房地产中介从业人员信用信息卡办理指引",
  274. // "date": "2018-10-26"
  275. // },
  276. uni.navigateTo({
  277. url: '/pages/certificateDetail/certificateDetail?type=zhongjie&title=广州市房地产中介从业人员水平认证证书'
  278. })
  279. } else {
  280. console.log('跳转中介认证报名指引');
  281. }
  282. }
  283. // 按揭认证点击
  284. function onAnJieRenZhengClick(valid) {
  285. if (!isLogin.value) {
  286. return
  287. }
  288. if (valid) {
  289. uni.navigateTo({
  290. url: '/pages/certificateDetail/certificateDetail?type=anjie&title=广州市房地产按揭从业人员水平认证证书'
  291. })
  292. } else {
  293. console.log('跳转按揭认证报名指引');
  294. }
  295. }
  296. const zhongjie = ref({
  297. zsbh: null,
  298. fzbm: null,
  299. fzrq: null,
  300. xm: null,
  301. xb: null,
  302. sfzh: null,
  303. whcd: null
  304. })
  305. const anjie = ref({
  306. zsbh: null,
  307. fzbm: null,
  308. fzrq: null,
  309. xm: null,
  310. xb: null,
  311. sfzh: null,
  312. whcd: null
  313. })
  314. // 点击-会费缴交
  315. function onHuiFeiJiaoJiao() {
  316. uni.navigateTo({
  317. url: '/pages/huiFeiJiaoJiao/huiFeiJiaoJiao'
  318. })
  319. }
  320. // 点击-我的订单
  321. function onWoDeDingDan() {
  322. uni.navigateTo({
  323. url: '/pages/order/order'
  324. })
  325. }
  326. // 点击-我的收藏
  327. function onWoDeShouChang() {
  328. uni.navigateTo({
  329. url: '/pages/collect/collect'
  330. })
  331. }
  332. // 点击-常见问题
  333. function onChangJianWenTi() {
  334. console.log('点击-常见问题');
  335. }
  336. // 点击-联系我们
  337. function onLianXiWoMen() {
  338. console.log('点击-联系我们');
  339. }
  340. // 点击-退出登录
  341. function onLogout() {
  342. removeToken()
  343. uni.redirectTo({
  344. url: '/pages/login/login'
  345. })
  346. }
  347. const isLogin = computed(() => {
  348. return getToken() ? true : false
  349. })
  350. onLoad(() => {
  351. user.value = authStore.userInfo
  352. getCreditCard().then(res => {
  353. if (res && res.message === 'success') {
  354. creditCard.value = res.data
  355. authStore.setCreditCard(res.data)
  356. }
  357. })
  358. getZhongjie().then(res => {
  359. if (res && res.message === 'success') {
  360. zhongjie.value = res.data ?? {zsbh: null}
  361. }
  362. })
  363. getAnjie().then(res => {
  364. if (res && res.message === 'success') {
  365. anjie.value = res.data ?? {zsbh: null}
  366. }
  367. })
  368. getIconList().then(res => {
  369. if (res && res.message === 'success') {
  370. iconList.value = res.data
  371. }
  372. })
  373. })
  374. </script>
  375. <style lang="scss" scoped>
  376. $certificate-width: 220rpx;
  377. $certificate-height: 300rpx;
  378. .container {
  379. height: 100vh;
  380. width: 100vw;
  381. padding: 0 20rpx;
  382. background: rgb(141, 204, 255);
  383. background: -moz-linear-gradient( 90deg, rgb(141, 204, 255) 10%, rgb(247, 247, 247) 30%);
  384. background: -webkit-linear-gradient(90deg, rgb(141, 204, 255) 10%, rgb(247, 247, 247) 30%);
  385. background: -o-linear-gradient( 90deg, rgb(141, 204, 255) 10%, rgb(247, 247, 247) 30%);
  386. background: -ms-linear-gradient( 90deg, rgb(141, 204, 255) 10%, rgb(247, 247, 247) 30%);
  387. background: linear-gradient( 180deg, rgb(141, 204, 255) 10%, rgb(247, 247, 247) 30%);
  388. .user-box {
  389. padding: 0 40rpx;
  390. .icon-name-box {
  391. display: flex;
  392. align-items: center;
  393. gap: 30rpx;
  394. margin-bottom: 15rpx;
  395. .icon-box {
  396. width: 90rpx;
  397. height: 90rpx;
  398. background-color: #fff;
  399. border-radius: 50%;
  400. overflow: hidden;
  401. -webkit-box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(168, 221, 239, 0.75);
  402. -moz-box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(168, 221, 239, 0.75);
  403. box-shadow: 0rpx 0rpx 10rpx 0rpx rgba(168, 221, 239, 0.75);
  404. .icon {
  405. height: 100%;
  406. width: 100%;
  407. object-fit: cover;
  408. }
  409. }
  410. .name-box {
  411. font-size: $uni-title-font-size-1;
  412. letter-spacing: 5rpx;
  413. .name {
  414. display: flex;
  415. gap: 5rpx;
  416. .iconfont {
  417. font-size: $uni-font-size-3;
  418. }
  419. }
  420. .function {
  421. display: flex;
  422. gap: 5rpx;
  423. }
  424. }
  425. }
  426. .info-box {
  427. .info-item-box {
  428. display: flex;
  429. align-items: center;
  430. gap: 10rpx;
  431. margin-bottom: 10rpx;
  432. font-size: $uni-font-size-1;
  433. font-weight: bold;
  434. letter-spacing: 3rpx;
  435. }
  436. }
  437. }
  438. .certificate-box {
  439. padding: 0 20rpx;
  440. margin-top: 20rpx;
  441. .title-box {
  442. font-size: $uni-title-font-size-3;
  443. font-weight: bold;
  444. }
  445. .list-box {
  446. padding: 20rpx 50rpx;
  447. width: 100%;
  448. display: flex;
  449. gap: 130rpx;
  450. overflow-x: scroll;
  451. overflow-y: hidden;
  452. white-space:nowrap;
  453. .list-item-box {
  454. flex-shrink: 0;
  455. height: $certificate-height;
  456. width: $certificate-width;
  457. background-color: #fff;
  458. &:nth-child(1) {
  459. background-color: #fff;
  460. }
  461. }
  462. .zhongjie-back {
  463. z-index: 999;
  464. @include backgroundImg('http://www.gzrea.org.cn:8543/icon/wxmp/zhengshu/zhongjie-back.png')
  465. }
  466. .zhongjie-back-login {
  467. @include backgroundImg('http://www.gzrea.org.cn:8543/icon/wxmp/zhengshu/zhongjie-back-login.png')
  468. }
  469. .zhongjie-back-zhiyin {
  470. @include backgroundImg('http://www.gzrea.org.cn:8543/icon/wxmp/zhengshu/zhongjie-back-zhiyin.png')
  471. }
  472. .anjie-back {
  473. z-index: 999;
  474. @include backgroundImg('http://www.gzrea.org.cn:8543/icon/wxmp/zhengshu/anjie-back.png')
  475. }
  476. .anjie-back-login {
  477. @include backgroundImg('http://www.gzrea.org.cn:8543/icon/wxmp/zhengshu/anjie-back-login.png')
  478. }
  479. .anjie-back-zhiyin {
  480. @include backgroundImg('http://www.gzrea.org.cn:8543/icon/wxmp/zhengshu/anjie-back-zhiyin.png')
  481. }
  482. }
  483. }
  484. .certificate-preview-box {
  485. height: 65vh;
  486. width: 75vw;
  487. }
  488. .menu-box {
  489. padding: 20rpx 20rpx;
  490. margin: 10rpx 0;
  491. background-color: #fff;
  492. width: 100%;
  493. border-radius: $uni-card-border-radius;
  494. -webkit-box-shadow: 0px 0px 12rpx 0px rgba(50, 50, 50, 0.25);
  495. -moz-box-shadow: 0px 0px 12rpx 0px rgba(50, 50, 50, 0.25);
  496. box-shadow: 0px 0px 12rpx 0px rgba(50, 50, 50, 0.25);
  497. .menu-item-box {
  498. height: 100rpx;
  499. font-size: $uni-font-size-1;
  500. padding: 10rpx;
  501. display: flex;
  502. gap: 10rpx;
  503. align-items: center;
  504. border-radius: $uni-card-border-radius;
  505. &:active {
  506. background-color: $uni-bg-color-hover;
  507. }
  508. .icon-box {
  509. width: 5%;
  510. font-weight: bold;
  511. }
  512. .content-box {
  513. width: 75%;
  514. letter-spacing: 3rpx;
  515. }
  516. .suffix-box {
  517. width: 20%;
  518. text-align: right;
  519. }
  520. }
  521. }
  522. .icon-list-box {
  523. padding: 30rpx;
  524. width: 90vw;
  525. .title {
  526. font-size: $uni-title-font-size-2;
  527. font-weight: bold;
  528. margin-bottom: 30rpx;
  529. }
  530. .icon-item {
  531. width: 120rpx;
  532. height: 120rpx;
  533. border-radius: 50%;
  534. border: 1px solid #ccc;
  535. margin-bottom: 20rpx;
  536. .icon {
  537. height: 100%;
  538. width: 100%;
  539. object-fit: cover;
  540. }
  541. }
  542. .icon-active {
  543. border: 1px solid $uni-color-primary;
  544. }
  545. .button-box {
  546. margin-top: 30rpx;
  547. display: flex;
  548. align-items: center;
  549. gap: 30rpx;
  550. .button-item {
  551. &:first-child{
  552. margin-left: auto;
  553. }
  554. &:last-child {
  555. margin-right: auto;
  556. }
  557. }
  558. }
  559. }
  560. }
  561. </style>