index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  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. @include useTheme() {
  157. position: relative;
  158. min-height: calc(100vh - 80px - 80px);
  159. background-color: #fff;
  160. overflow: hidden;
  161. .page-top {
  162. height: 360px;
  163. background-image: fetch('pc-banner-doc');
  164. background-size: cover;
  165. background-position: center;
  166. .club-logo {
  167. width: 90px;
  168. height: 90px;
  169. img {
  170. display: block;
  171. width: 100%;
  172. height: 100%;
  173. border-radius: 50%;
  174. }
  175. }
  176. .club-mobile {
  177. margin: 8px 0;
  178. }
  179. .club-mobile,
  180. .club-name {
  181. font-size: 18px;
  182. color: #fff;
  183. }
  184. }
  185. .page-content {
  186. width: 704px;
  187. margin: 8px auto 60px;
  188. .section-title {
  189. font-size: 24px;
  190. color: #666666;
  191. padding: 16px 0;
  192. }
  193. .section-content {
  194. display: flex;
  195. justify-content: space-between;
  196. align-items: flex-start;
  197. .item {
  198. position: relative;
  199. width: 340px;
  200. height: 230px;
  201. background: #eee;
  202. box-sizing: border-box;
  203. padding-left: 24px;
  204. cursor: pointer;
  205. display: flex;
  206. flex-direction: column;
  207. align-items: flex-start;
  208. justify-content: center;
  209. background-size: 340px 230px;
  210. background-position: center center;
  211. background-repeat: no-repeat;
  212. &.club {
  213. background-image: fetch('pc-icon-center-item-auth-club');
  214. .icon {
  215. color: #f3920d;
  216. }
  217. }
  218. &.device {
  219. background-image: fetch('pc-icon-center-item-device');
  220. .icon {
  221. color: #0a6eb1;
  222. }
  223. }
  224. .auth-icon {
  225. position: absolute;
  226. right: 16px;
  227. top: 16px;
  228. width: 72px;
  229. height: 32px;
  230. line-height: 32px;
  231. text-align: center;
  232. font-size: 16px;
  233. color: #fff;
  234. border-radius: 4px;
  235. &.auth {
  236. background: #1890ff;
  237. }
  238. &.un-auth {
  239. background: #f94b4b;
  240. }
  241. }
  242. .tip {
  243. font-size: 24px;
  244. color: #fff;
  245. margin-bottom: 8px;
  246. }
  247. .btn {
  248. font-size: 16px;
  249. color: #fff;
  250. .icon {
  251. display: inline-block;
  252. width: 18px;
  253. height: 18px;
  254. border-radius: 50%;
  255. background: #fff;
  256. // background: #0A6EB1;
  257. font-size: 12px;
  258. text-align: center;
  259. line-height: 18px;
  260. margin-left: 9px;
  261. font-weight: bold;
  262. vertical-align: 1px;
  263. }
  264. }
  265. }
  266. .reset-pwd {
  267. width: 98px;
  268. height: 36px;
  269. background: #f3920d;
  270. opacity: 1;
  271. border-radius: 4px;
  272. font-size: 16px;
  273. font-weight: 400;
  274. line-height: 36px;
  275. color: #ffffff;
  276. text-align: center;
  277. cursor: pointer;
  278. }
  279. }
  280. .line {
  281. height: 1px;
  282. background: #c2c2c2;
  283. margin: 32px 0;
  284. }
  285. }
  286. }
  287. }
  288. }
  289. @media screen and (max-width: 768px) {
  290. .page {
  291. @include useTheme() {
  292. .page-top {
  293. height: 36vw;
  294. background-image: fetch('pc-banner-doc');
  295. background-size: cover;
  296. background-position: center;
  297. .club-logo {
  298. width: 12.8vw;
  299. height: 12.8vw;
  300. img {
  301. display: block;
  302. width: 100%;
  303. height: 100%;
  304. border-radius: 50%;
  305. }
  306. }
  307. .club-mobile {
  308. margin: 0.8vw 0;
  309. }
  310. .club-mobile,
  311. .club-name {
  312. font-size: 3.4vw;
  313. color: #fff;
  314. }
  315. }
  316. .page-content {
  317. padding-bottom: 26vw;
  318. .section-title {
  319. font-size: 4.2vw;
  320. color: #666666;
  321. padding: 6.4vw 0 3.2vw;
  322. padding-left: 4vw;
  323. }
  324. .logout {
  325. width: 85.2vw;
  326. height: 12vw;
  327. background: #f3920d;
  328. border-radius: 0.2vw;
  329. text-align: center;
  330. line-height: 12vw;
  331. color: #ffffff;
  332. font-size: 3.6vw;
  333. position: fixed;
  334. bottom: 24vw;
  335. left: 50%;
  336. transform: translateX(-50%);
  337. }
  338. .section-content {
  339. display: flex;
  340. justify-content: space-between;
  341. align-items: flex-start;
  342. padding: 0 4vw;
  343. .item {
  344. position: relative;
  345. width: 44.4vw;
  346. height: 30vw;
  347. background: #eee;
  348. box-sizing: border-box;
  349. padding-left: 3.6vw;
  350. cursor: pointer;
  351. display: flex;
  352. flex-direction: column;
  353. align-items: flex-start;
  354. justify-content: center;
  355. background-size: 44.4vw 30vw;
  356. background-position: center center;
  357. background-repeat: no-repeat;
  358. &.club {
  359. background-image: fetch('pc-icon-center-item-auth-club');
  360. .icon {
  361. color: #f3920d;
  362. }
  363. }
  364. &.device {
  365. background-image: fetch('pc-icon-center-item-device');
  366. .icon {
  367. color: #0a6eb1;
  368. }
  369. }
  370. .auth-icon {
  371. position: absolute;
  372. right: 1.6vw;
  373. top: 1.6vw;
  374. width: 12.8vw;
  375. height: 5.6vw;
  376. line-height: 5.6vw;
  377. text-align: center;
  378. font-size: 3vw;
  379. color: #fff;
  380. border-radius: 0.4vw;
  381. &.auth {
  382. background: #1890ff;
  383. }
  384. &.un-auth {
  385. background: #f94b4b;
  386. }
  387. }
  388. .tip {
  389. font-size: 4vw;
  390. color: #fff;
  391. margin-bottom: 1.2vw;
  392. }
  393. .btn {
  394. font-size: 3vw;
  395. color: #fff;
  396. .icon {
  397. display: inline-block;
  398. width: 3.4vw;
  399. height: 3.4vw;
  400. border-radius: 50%;
  401. background: #fff;
  402. font-size: 2.8vw;
  403. text-align: center;
  404. line-height: 3.4vw;
  405. margin-left: 0.8vw;
  406. font-weight: bold;
  407. vertical-align: 1px;
  408. }
  409. }
  410. }
  411. }
  412. .menu-list {
  413. padding: 0 4vw;
  414. padding-top: 2.4vw;
  415. .item {
  416. width: 100%;
  417. padding: 3vw 0;
  418. display: flex;
  419. justify-content: space-between;
  420. font-size: 3.4vw;
  421. border-bottom: 0.1vw solid #c2c2c2;
  422. .el-icon-arrow-right {
  423. font-size: 4vw;
  424. }
  425. }
  426. }
  427. .line {
  428. height: 1.6vw;
  429. background: #f7f7f7;
  430. margin-top: 6.4vw;
  431. }
  432. }
  433. }
  434. }
  435. }
  436. </style>