index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <div class="page">
  3. <div class="page-content">
  4. <div class="title">设备认证信息</div>
  5. <template v-if="!isAuth">
  6. <div class="tip">抱歉,您暂未认证设备</div>
  7. <div class="btn" @click="toAuth">去认证</div>
  8. </template>
  9. <div class="device-list" v-else>
  10. <div
  11. class="device"
  12. @click="toDetail(product)"
  13. v-for="product in list"
  14. :key="product.productId"
  15. >
  16. <div class="cover">
  17. <img :src="product.image" :alt="product.productName" />
  18. </div>
  19. <div class="content">
  20. <div class="name">{{ product.productName }}</div>
  21. <div class="sncode">SN码:{{ product.snCode | formatSnCode }}</div>
  22. </div>
  23. </div>
  24. </div>
  25. <div class="to-auth-btn" v-if="isAuth && !isPc" @click="toAuth">
  26. 去认证
  27. </div>
  28. </div>
  29. </div>
  30. </template>
  31. <script>
  32. import { mapGetters } from 'vuex'
  33. export default {
  34. layout: 'app-hyt',
  35. data() {
  36. return {
  37. list: [],
  38. clubInfo: {},
  39. }
  40. },
  41. filters: {
  42. formatSnCode(code) {
  43. if (!code) return ''
  44. return code.replace(/^(\w{2})\w+(\w{4})$/, '$1******$2')
  45. },
  46. },
  47. computed: {
  48. ...mapGetters(['routePrefix', 'userInfo', 'authUserId', 'isPc']),
  49. isAuth() {
  50. return this.clubInfo.auditStatus === 1 && this.list.length > 0
  51. },
  52. },
  53. created() {
  54. this.fetchProductList()
  55. this.fetchAuthDetail()
  56. },
  57. methods: {
  58. // 产看详情
  59. toDetail(row) {
  60. const path = `${this.routePrefix}/center/device/detail?productId=${row.productId}&relationId=${row.relationId}`
  61. this.$router.push(path)
  62. },
  63. // 获取机构信息
  64. async fetchAuthDetail() {
  65. try {
  66. if (this.userInfo && !this.userInfo.authId) return
  67. const res = await this.$http.api.fetchClubAuthInfoData({
  68. authId: this.userInfo.authId,
  69. })
  70. this.clubInfo = res.data
  71. } catch (error) {
  72. console.log(error)
  73. }
  74. },
  75. // 获取已认证设备列表
  76. async fetchProductList() {
  77. try {
  78. const authId = this.userInfo.authId
  79. if (!authId) return
  80. const res = await this.$http.api.fetchClubAuthProductList({
  81. authId,
  82. authUserId: this.authUserId,
  83. })
  84. if (res.data) {
  85. this.list = res.data
  86. }
  87. } catch (error) {
  88. console.log(error)
  89. }
  90. },
  91. // 去认证
  92. toAuth() {
  93. this.$router.push(`${this.routePrefix}/form/club-register`)
  94. },
  95. },
  96. }
  97. </script>
  98. <style lang="scss" scoped>
  99. @media screen and (min-width: 768px) {
  100. .page {
  101. background: #fff;
  102. min-height: calc(100vh - 80px);
  103. }
  104. .page-content {
  105. width: 1000px;
  106. margin: 0 auto;
  107. .title {
  108. font-size: 24px;
  109. text-align: center;
  110. font-weight: bold;
  111. padding: 60px 0;
  112. }
  113. .tip {
  114. font-size: 16px;
  115. color: #b2b2b2;
  116. margin-top: 200px;
  117. margin-bottom: 24px;
  118. text-align: center;
  119. }
  120. .btn {
  121. width: 98px;
  122. height: 36px;
  123. background: #bc1724;
  124. border-radius: 4px;
  125. text-align: center;
  126. line-height: 36px;
  127. color: #fff;
  128. font-size: 16px;
  129. margin: 0 auto;
  130. cursor: pointer;
  131. }
  132. .device-list {
  133. display: flex;
  134. justify-content: space-between;
  135. align-items: center;
  136. flex-wrap: wrap;
  137. .device {
  138. width: 490px;
  139. height: 136px;
  140. background: #f3f5f6;
  141. border-radius: 8px;
  142. display: flex;
  143. align-items: center;
  144. box-sizing: border-box;
  145. padding: 16px;
  146. margin-bottom: 20px;
  147. cursor: pointer;
  148. .cover {
  149. img {
  150. display: block;
  151. width: 106px;
  152. height: 106px;
  153. }
  154. }
  155. .content {
  156. width: 320px;
  157. margin-left: 16px;
  158. .name {
  159. font-size: 18px;
  160. color: #282828;
  161. font-weight: bold;
  162. margin-bottom: 24px;
  163. @include ellipsis(1);
  164. }
  165. .sncode {
  166. font-size: 16px;
  167. color: #666666;
  168. }
  169. }
  170. }
  171. }
  172. }
  173. }
  174. @media screen and (max-width: 768px) {
  175. .page-content {
  176. .title {
  177. font-size: 4.2vw;
  178. text-align: center;
  179. font-weight: bold;
  180. padding: 8vw 0;
  181. }
  182. .to-auth-btn {
  183. width: 85.2vw;
  184. height: 12vw;
  185. background: #bc1724;
  186. border-radius: 0.2vw;
  187. text-align: center;
  188. line-height: 12vw;
  189. color: #ffffff;
  190. font-size: 3.6vw;
  191. position: fixed;
  192. bottom: 24vw;
  193. left: 50%;
  194. transform: translateX(-50%);
  195. }
  196. .tip {
  197. font-size: 3vw;
  198. color: #b2b2b2;
  199. margin-top: 60vw;
  200. margin-bottom: 4.8vw;
  201. text-align: center;
  202. }
  203. .btn {
  204. width: 36vw;
  205. height: 8.8vw;
  206. background: #bc1724;
  207. border-radius: 0.4vw;
  208. text-align: center;
  209. line-height: 8.8vw;
  210. color: #fff;
  211. font-size: 3.4vw;
  212. margin: 0 auto;
  213. }
  214. .device-list {
  215. padding: 0 3.2vw;
  216. padding-bottom: 26vw;
  217. .device {
  218. height: 26vw;
  219. background: #f3f5f6;
  220. border-radius: 0.8vw;
  221. display: flex;
  222. align-items: center;
  223. box-sizing: border-box;
  224. padding: 3.2vw;
  225. margin-bottom: 3.2vw;
  226. cursor: pointer;
  227. .cover {
  228. img {
  229. display: block;
  230. width: 19.6vw;
  231. height: 19.6vw;
  232. }
  233. }
  234. .content {
  235. width: 59vw;
  236. margin-left: 3.2vw;
  237. .name {
  238. font-size: 3.6vw;
  239. color: #282828;
  240. font-weight: bold;
  241. margin-bottom: 3.2vw;
  242. @include ellipsis(1);
  243. }
  244. .sncode {
  245. font-size: 3.6vw;
  246. color: #666666;
  247. }
  248. }
  249. }
  250. }
  251. }
  252. }
  253. </style>