index.vue 11 KB

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