index.vue 5.9 KB

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