index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. <template>
  2. <div class="page">
  3. <div class="page-top flex flex-col justify-center items-center">
  4. <div class="club-logo">
  5. <img :src="clubInfo.logo" alt="" v-if="isAuth" />
  6. <img
  7. src="~/assets/theme-images/common/pc-icon-club-logo-default.png"
  8. v-else-if="isPc"
  9. />
  10. <img
  11. src="~/assets/theme-images/common/h5-icon-club-logo-default.png"
  12. v-else
  13. />
  14. </div>
  15. <div class="club-mobile">{{ userInfo.mobile }}</div>
  16. <div class="club-name" v-if="isAuth">机构:{{ clubInfo.authParty }}</div>
  17. </div>
  18. <div class="page-content">
  19. <div class="section-title">我的认证</div>
  20. <div class="section-content">
  21. <div class="item club" @click="onToClubDetail">
  22. <div class="auth-icon" :class="isAuth ? 'auth' : 'un-auth'">
  23. {{ isAuth ? '已认证' : '未认证' }}
  24. </div>
  25. <div class="tip">机构认证</div>
  26. <div class="btn">
  27. 点击查看<span class="icon el-icon-arrow-right"></span>
  28. </div>
  29. </div>
  30. <div class="item device" @click="onToDeviceList">
  31. <div class="auth-icon" :class="isAuthDevice ? 'auth' : 'un-auth'">
  32. {{ isAuthDevice ? '已认证' : '未认证' }}
  33. </div>
  34. <div class="tip">设备认证</div>
  35. <div class="btn">
  36. 点击查看<span class="icon el-icon-arrow-right"></span>
  37. </div>
  38. </div>
  39. </div>
  40. <div class="line"></div>
  41. <template v-if="isPc">
  42. <div class="section-title">账户设置</div>
  43. <div class="section-content">
  44. <div class="reset-pwd" @click="onResetPassword">修改密码</div>
  45. </div>
  46. </template>
  47. <template v-else>
  48. <div class="menu-list">
  49. <div class="item" @click="toAccountSubNav">
  50. <span>账户设置</span>
  51. <span class="el-icon-arrow-right"></span>
  52. </div>
  53. </div>
  54. </template>
  55. <div v-if="!isPc" class="logout" @click="logout">退出登录</div>
  56. </div>
  57. </div>
  58. </template>
  59. <script>
  60. import { mapGetters } from 'vuex'
  61. export default {
  62. layout: 'app-ross',
  63. data() {
  64. return {
  65. clubInfo: {},
  66. list: [],
  67. }
  68. },
  69. computed: {
  70. ...mapGetters(['routePrefix', 'isPc', 'userInfo', 'authUserId']),
  71. isAuth() {
  72. return this.clubInfo.auditStatus === 1
  73. },
  74. isAuthDevice() {
  75. return this.isAuth && this.list.length > 0
  76. },
  77. },
  78. created() {
  79. this.initUserInfo()
  80. },
  81. methods: {
  82. // 初始化用户信息
  83. async initUserInfo() {
  84. try {
  85. const res = await this.$http.api.checkTokenResult()
  86. this.$store.dispatch('user/login', res.data)
  87. this.$setStorage(this.routePrefix, 'userInfo', res.data)
  88. this.fetchAuthDetail()
  89. this.fetchProductList()
  90. } catch (error) {
  91. console.log(error)
  92. }
  93. },
  94. // 获取机构信息
  95. async fetchAuthDetail() {
  96. try {
  97. const authId = this.userInfo.authId
  98. if (!authId) return
  99. const res = await this.$http.api.fetchClubAuthInfoData({
  100. authId,
  101. })
  102. this.clubInfo = res.data
  103. } catch (error) {
  104. console.log(error)
  105. }
  106. },
  107. // 获取已认证设备列表
  108. async fetchProductList() {
  109. try {
  110. const authId = this.userInfo.authId
  111. if (!authId) return
  112. const res = await this.$http.api.fetchClubAuthProductList({
  113. authId,
  114. authUserId: this.authUserId,
  115. })
  116. if (res.data) {
  117. this.list = res.data
  118. }
  119. } catch (error) {
  120. console.log(error)
  121. }
  122. },
  123. // 去账户设置菜单列表
  124. toAccountSubNav() {
  125. this.$router.push(`${this.routePrefix}/center/subnav/account`)
  126. },
  127. // 机构详情
  128. onToClubDetail() {
  129. this.$router.push(`${this.routePrefix}/center/club-detail`)
  130. },
  131. // 设备认证
  132. onToDeviceList() {
  133. this.$router.push(`${this.routePrefix}/center/device`)
  134. },
  135. // 修改密码
  136. onResetPassword() {
  137. this.$router.push(`${this.routePrefix}/center/settings/password`)
  138. },
  139. // 退出登录
  140. logout() {
  141. this.$store.dispatch('user/logout')
  142. this.$removeStorage(this.routePrefix, 'userInfo')
  143. this.backHome()
  144. },
  145. // 回到首页
  146. backHome() {
  147. if (this.$route.path === this.routePrefix) return
  148. this.$router.replace(this.routePrefix)
  149. },
  150. },
  151. }
  152. </script>
  153. <style lang="scss" scoped>
  154. @media screen and (min-width: 768px) {
  155. .page {
  156. position: relative;
  157. min-height: calc(100vh - 80px - 80px);
  158. background-color: #fff;
  159. overflow: hidden;
  160. }
  161. .page-top {
  162. height: 360px;
  163. @include themify($themes) {
  164. background-image: themed('pc-banner-doc');
  165. }
  166. background-size: cover;
  167. background-position: center;
  168. .club-logo {
  169. width: 90px;
  170. height: 90px;
  171. img {
  172. display: block;
  173. width: 100%;
  174. height: 100%;
  175. border-radius: 50%;
  176. }
  177. }
  178. .club-mobile {
  179. margin: 8px 0;
  180. }
  181. .club-mobile,
  182. .club-name {
  183. font-size: 18px;
  184. color: #fff;
  185. }
  186. }
  187. .page-content {
  188. width: 704px;
  189. margin: 8px auto 60px;
  190. .section-title {
  191. font-size: 24px;
  192. color: #666666;
  193. padding: 16px 0;
  194. }
  195. .section-content {
  196. display: flex;
  197. justify-content: space-between;
  198. align-items: flex-start;
  199. .item {
  200. position: relative;
  201. width: 340px;
  202. height: 230px;
  203. background: #eee;
  204. box-sizing: border-box;
  205. padding-left: 24px;
  206. cursor: pointer;
  207. display: flex;
  208. flex-direction: column;
  209. align-items: flex-start;
  210. justify-content: center;
  211. background-size: 340px 230px;
  212. background-position: center center;
  213. background-repeat: no-repeat;
  214. &.club {
  215. @include themify($themes) {
  216. background-image: themed('pc-icon-center-item-auth-club');
  217. }
  218. .icon {
  219. color: #f3920d;
  220. }
  221. }
  222. &.device {
  223. @include themify($themes) {
  224. background-image: themed('pc-icon-center-item-device');
  225. }
  226. .icon {
  227. color: #0a6eb1;
  228. }
  229. }
  230. .auth-icon {
  231. position: absolute;
  232. right: 16px;
  233. top: 16px;
  234. width: 72px;
  235. height: 32px;
  236. line-height: 32px;
  237. text-align: center;
  238. font-size: 16px;
  239. color: #fff;
  240. border-radius: 4px;
  241. &.auth {
  242. background: #1890ff;
  243. }
  244. &.un-auth {
  245. background: #f94b4b;
  246. }
  247. }
  248. .tip {
  249. font-size: 24px;
  250. color: #fff;
  251. margin-bottom: 8px;
  252. }
  253. .btn {
  254. font-size: 16px;
  255. color: #fff;
  256. .icon {
  257. display: inline-block;
  258. width: 18px;
  259. height: 18px;
  260. border-radius: 50%;
  261. background: #fff;
  262. // background: #0A6EB1;
  263. font-size: 12px;
  264. text-align: center;
  265. line-height: 18px;
  266. margin-left: 9px;
  267. font-weight: bold;
  268. vertical-align: 1px;
  269. }
  270. }
  271. }
  272. .reset-pwd {
  273. width: 98px;
  274. height: 36px;
  275. background: #f3920d;
  276. opacity: 1;
  277. border-radius: 4px;
  278. font-size: 16px;
  279. font-weight: 400;
  280. line-height: 36px;
  281. color: #ffffff;
  282. text-align: center;
  283. cursor: pointer;
  284. }
  285. }
  286. .line {
  287. height: 1px;
  288. background: #c2c2c2;
  289. margin: 32px 0;
  290. }
  291. }
  292. }
  293. @media screen and (max-width: 768px) {
  294. .page-top {
  295. height: 36vw;
  296. @include themify($themes) {
  297. background-image: themed('pc-banner-doc');
  298. }
  299. background-size: cover;
  300. background-position: center;
  301. .club-logo {
  302. width: 12.8vw;
  303. height: 12.8vw;
  304. img {
  305. display: block;
  306. width: 100%;
  307. height: 100%;
  308. border-radius: 50%;
  309. }
  310. }
  311. .club-mobile {
  312. margin: 0.8vw 0;
  313. }
  314. .club-mobile,
  315. .club-name {
  316. font-size: 3.4vw;
  317. color: #fff;
  318. }
  319. }
  320. .page-content {
  321. padding-bottom: 26vw;
  322. .section-title {
  323. font-size: 4.2vw;
  324. color: #666666;
  325. padding: 6.4vw 0 3.2vw;
  326. padding-left: 4vw;
  327. }
  328. .logout {
  329. width: 85.2vw;
  330. height: 12vw;
  331. background: #f3920d;
  332. border-radius: 0.2vw;
  333. text-align: center;
  334. line-height: 12vw;
  335. color: #ffffff;
  336. font-size: 3.6vw;
  337. position: fixed;
  338. bottom: 24vw;
  339. left: 50%;
  340. transform: translateX(-50%);
  341. }
  342. .section-content {
  343. display: flex;
  344. justify-content: space-between;
  345. align-items: flex-start;
  346. padding: 0 4vw;
  347. .item {
  348. position: relative;
  349. width: 44.4vw;
  350. height: 30vw;
  351. background: #eee;
  352. box-sizing: border-box;
  353. padding-left: 3.6vw;
  354. cursor: pointer;
  355. display: flex;
  356. flex-direction: column;
  357. align-items: flex-start;
  358. justify-content: center;
  359. background-size: 44.4vw 30vw;
  360. background-position: center center;
  361. background-repeat: no-repeat;
  362. &.club {
  363. @include themify($themes) {
  364. background-image: themed('pc-icon-center-item-auth-club');
  365. }
  366. .icon {
  367. color: #f3920d;
  368. }
  369. }
  370. &.device {
  371. @include themify($themes) {
  372. background-image: themed('pc-icon-center-item-device');
  373. }
  374. .icon {
  375. color: #0a6eb1;
  376. }
  377. }
  378. .auth-icon {
  379. position: absolute;
  380. right: 1.6vw;
  381. top: 1.6vw;
  382. width: 12.8vw;
  383. height: 5.6vw;
  384. line-height: 5.6vw;
  385. text-align: center;
  386. font-size: 3vw;
  387. color: #fff;
  388. border-radius: 0.4vw;
  389. &.auth {
  390. background: #1890ff;
  391. }
  392. &.un-auth {
  393. background: #f94b4b;
  394. }
  395. }
  396. .tip {
  397. font-size: 4vw;
  398. color: #fff;
  399. margin-bottom: 1.2vw;
  400. }
  401. .btn {
  402. font-size: 3vw;
  403. color: #fff;
  404. .icon {
  405. display: inline-block;
  406. width: 3.4vw;
  407. height: 3.4vw;
  408. border-radius: 50%;
  409. background: #fff;
  410. font-size: 2.8vw;
  411. text-align: center;
  412. line-height: 3.4vw;
  413. margin-left: 0.8vw;
  414. font-weight: bold;
  415. vertical-align: 1px;
  416. }
  417. }
  418. }
  419. }
  420. .menu-list {
  421. padding: 0 4vw;
  422. padding-top: 2.4vw;
  423. .item {
  424. width: 100%;
  425. padding: 3vw 0;
  426. display: flex;
  427. justify-content: space-between;
  428. font-size: 3.4vw;
  429. border-bottom: 0.1vw solid #c2c2c2;
  430. .el-icon-arrow-right {
  431. font-size: 4vw;
  432. }
  433. }
  434. }
  435. .line {
  436. height: 1.6vw;
  437. background: #f7f7f7;
  438. margin-top: 6.4vw;
  439. }
  440. }
  441. }
  442. </style>