123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- <template>
- <div class="page">
- <div class="page-content">
- <div class="title">设备认证信息</div>
- <template v-if="!isAuth">
- <div class="tip">抱歉,您暂未认证设备</div>
- <div class="btn" @click="toAuth">去认证</div>
- </template>
- <div class="device-list" v-else>
- <div
- class="device"
- @click="toDetail(product)"
- v-for="product in list"
- :key="product.productId"
- >
- <div class="cover">
- <img :src="product.image" :alt="product.productName" />
- </div>
- <div class="content">
- <div class="name">{{ product.productName }}</div>
- <div class="sncode">SN码:{{ product.snCode | formatSnCode }}</div>
- </div>
- </div>
- </div>
- <div class="to-auth-btn" v-if="isAuth && !isPc" @click="toAuth">去认证</div>
- </div>
- </div>
- </template>
- <script>
- import { mapGetters } from 'vuex'
- export default {
- layout: 'app-normal',
- data() {
- return {
- list: [],
- clubInfo: {},
- }
- },
- filters: {
- formatSnCode(code) {
- if (!code) return ''
- return code.replace(/^(\w{2})\w+(\w{4})$/, '$1******$2')
- },
- },
- computed: {
- ...mapGetters(['routePrefix', 'userInfo', 'authUserId', 'isPc']),
- isAuth() {
- return this.clubInfo.auditStatus === 1 && this.list.length > 0
- },
- },
- created() {
- this.fetchProductList()
- this.fetchAuthDetail()
- },
- methods: {
- // 产看详情
- toDetail(row) {
- const path = `${this.routePrefix}/center/device/detail?productId=${row.productId}&relationId=${row.relationId}`
- this.$router.push(path)
- },
- // 获取机构信息
- async fetchAuthDetail() {
- try {
- if (this.userInfo && !this.userInfo.authId) return
- const res = await this.$http.api.fetchClubAuthInfoData({
- authId: this.userInfo.authId,
- })
- this.clubInfo = res.data
- } catch (error) {
- console.log(error)
- }
- },
- // 获取已认证设备列表
- async fetchProductList() {
- try {
- const authId = this.userInfo.authId
- if (!authId) return
- const res = await this.$http.api.fetchClubAuthProductList({
- authId,
- authUserId: this.authUserId,
- })
- if (res.data) {
- this.list = res.data
- }
- } catch (error) {
- console.log(error)
- }
- },
- // 去认证
- toAuth() {
- this.$router.push(`${this.routePrefix}/form/club-register`)
- },
- },
- }
- </script>
- <style lang="scss" scoped>
- @media screen and (min-width: 768px) {
- .page-content {
- width: 1000px;
- margin: 0 auto;
- .title {
- font-size: 24px;
- text-align: center;
- font-weight: bold;
- padding: 60px 0;
- }
- .tip {
- font-size: 16px;
- color: #b2b2b2;
- margin-top: 200px;
- margin-bottom: 24px;
- text-align: center;
- }
- .btn {
- width: 98px;
- height: 36px;
- background: #BC1724;
- border-radius: 4px;
- text-align: center;
- line-height: 36px;
- color: #fff;
- font-size: 16px;
- margin: 0 auto;
- cursor: pointer;
- }
- .device-list {
- display: flex;
- justify-content: space-between;
- align-items: center;
- flex-wrap: wrap;
- .device {
- width: 490px;
- height: 136px;
- background: #f3f5f6;
- border-radius: 8px;
- display: flex;
- align-items: center;
- box-sizing: border-box;
- padding: 16px;
- margin-bottom: 20px;
- cursor: pointer;
- .cover {
- img {
- display: block;
- width: 106px;
- height: 106px;
- }
- }
- .content {
- width: 320px;
- margin-left: 16px;
- .name {
- font-size: 18px;
- color: #282828;
- font-weight: bold;
- margin-bottom: 24px;
- @include ellipsis(1);
- }
- .sncode {
- font-size: 16px;
- color: #666666;
- }
- }
- }
- }
- }
- }
- @media screen and (max-width: 768px) {
- .page-content {
- .title {
- font-size: 4.2vw;
- text-align: center;
- font-weight: bold;
- padding: 8vw 0;
- }
- .to-auth-btn {
- width: 85.2vw;
- height: 12vw;
- background: #BC1724;
- border-radius: 0.2vw;
- text-align: center;
- line-height: 12vw;
- color: #ffffff;
- font-size: 3.6vw;
- position: fixed;
- bottom: 24vw;
- left: 50%;
- transform: translateX(-50%);
- }
- .tip {
- font-size: 3vw;
- color: #b2b2b2;
- margin-top: 60vw;
- margin-bottom: 4.8vw;
- text-align: center;
- }
- .btn {
- width: 36vw;
- height: 8.8vw;
- background: #BC1724;
- border-radius: 0.4vw;
- text-align: center;
- line-height: 8.8vw;
- color: #fff;
- font-size: 3.4vw;
- margin: 0 auto;
- }
- .device-list {
- padding: 0 3.2vw;
- padding-bottom: 26vw;
- .device {
- height: 26vw;
- background: #f3f5f6;
- border-radius: 0.8vw;
- display: flex;
- align-items: center;
- box-sizing: border-box;
- padding: 3.2vw;
- margin-bottom: 3.2vw;
- cursor: pointer;
- .cover {
- img {
- display: block;
- width: 19.6vw;
- height: 19.6vw;
- }
- }
- .content {
- width: 59vw;
- margin-left: 3.2vw;
- .name {
- font-size: 3.6vw;
- color: #282828;
- font-weight: bold;
- margin-bottom: 3.2vw;
- @include ellipsis(1);
- }
- .sncode {
- font-size: 3.6vw;
- color: #666666;
- }
- }
- }
- }
- }
- }
- </style>
|