From fc17d4b6114ac373b28570837865998f5189e3a6 Mon Sep 17 00:00:00 2001 From: ZZJ <zzjdsg2300@163.com> Date: 星期五, 22 四月 2022 16:10:18 +0800 Subject: [PATCH] 图片url --- src/views/product/components/productCard.vue | 8 ++------ src/views/trialCenter/components/SdkItem.vue | 2 +- src/views/hashrate/AlgManage/index.vue | 7 ++++++- src/views/index/components/banner.vue | 13 ++++++++++++- src/views/productDetail/components/PayCard.vue | 8 ++++---- src/views/index/components/rightColumn.vue | 2 +- src/views/index/components/rightRrid.vue | 2 +- src/components/subComponents/ImageShow.vue | 10 +++++++--- 8 files changed, 34 insertions(+), 18 deletions(-) diff --git a/src/components/subComponents/ImageShow.vue b/src/components/subComponents/ImageShow.vue index c22e128..5aac2f0 100644 --- a/src/components/subComponents/ImageShow.vue +++ b/src/components/subComponents/ImageShow.vue @@ -1,5 +1,5 @@ <template> - <img :src="url" alt="" /> + <img class="a111" :src="url" alt="" /> </template> <script> @@ -9,8 +9,12 @@ }, computed: { url() { - if (this.src.indexOf("http://apps.smartai.com/httpImage/") === -1) { - return "httpImage" + this.src; + if ( + this.src && + this.src.indexOf("http://apps.smartai.com/httpImage/") === -1 && + this.src.indexOf("/images") !== 0 + ) { + return "/httpImage/" + this.src; } else { return this.src; } diff --git a/src/views/hashrate/AlgManage/index.vue b/src/views/hashrate/AlgManage/index.vue index 9082156..71f24a5 100644 --- a/src/views/hashrate/AlgManage/index.vue +++ b/src/views/hashrate/AlgManage/index.vue @@ -168,7 +168,12 @@ console.log(item); } - item.logoUrl = "/httpImage/" + item.logoUrl; + if ( + item.logoUrl.indexOf("http://apps.smartai.com/httpImage/") === -1 + ) { + item.logoUrl = "/httpImage/" + item.logoUrl; + } + if (item.priceBase === 0) { this.freeAlg.push(item); } else { diff --git a/src/views/index/components/banner.vue b/src/views/index/components/banner.vue index 6641f50..f615cf7 100644 --- a/src/views/index/components/banner.vue +++ b/src/views/index/components/banner.vue @@ -12,7 +12,7 @@ class="banner_content" :style="{ // backgroundImage: 'url(' + baseImg + ')', - backgroundImage: 'url(' + (item.pic ? item.pic : baseImg) + ')', + backgroundImage: 'url(' + getUrl(item.pic) + ')', backgroundSize: '100% 100%', backgroundRepeat: 'no-repeat', }" @@ -40,6 +40,17 @@ toggleBanner(i) { this.$refs["banner"].setActiveItem(i); }, + getUrl(url) { + if (!url) { + return this.baseImg; + } else if ( + url.indexOf("http://apps.smartai.com/httpImage/") === -1 && + url.indexOf("/images") !== 0 + ) { + return "/httpImage/" + url; + } + return url; + }, }, }; </script> diff --git a/src/views/index/components/rightColumn.vue b/src/views/index/components/rightColumn.vue index 7318ed1..a60fbfb 100644 --- a/src/views/index/components/rightColumn.vue +++ b/src/views/index/components/rightColumn.vue @@ -2,7 +2,7 @@ <div class="rightColumn"> <div class="columnItem" v-for="(item, index) in product" :key="index"> <div class="title"> - <img :src="'/httpImage/' + item.logoUrl" alt="" /> + <ImageShow :src="item.logoUrl"></ImageShow> {{ item.modelName }} </div> <div class="des limitRow2"> diff --git a/src/views/index/components/rightRrid.vue b/src/views/index/components/rightRrid.vue index aa1b5a2..c1eb39c 100644 --- a/src/views/index/components/rightRrid.vue +++ b/src/views/index/components/rightRrid.vue @@ -2,7 +2,7 @@ <div class="rightRrid"> <div class="gridItem" v-for="(item, index) in product" :key="index"> <div class="title"> - <img :src="'/httpImage/' + item.logoUrl" alt="" /> + <ImageShow :src="item.logoUrl"></ImageShow> {{ item.modelName }} </div> <div class="des limitRow2"> diff --git a/src/views/product/components/productCard.vue b/src/views/product/components/productCard.vue index 9f2a1aa..8df9f91 100644 --- a/src/views/product/components/productCard.vue +++ b/src/views/product/components/productCard.vue @@ -1,15 +1,11 @@ <template> <div class="productCard"> <div class="image"> - <img - v-if="data.pics[0]" - :src="'/httpImage/' + data.pics[0].url" - class="cursor-pointer" - /> + <ImageShow v-if="data.pics[0]" :src="data.pics[0].url"></ImageShow> </div> <div class="info"> - <img :src="'/httpImage/' + data.logoUrl" alt /> + <ImageShow v-if="data.pics[0]" :src="data.logoUrl"></ImageShow> <div class="right"> <div class="name">{{ data.productName }}</div> <div class="tagList"> diff --git a/src/views/productDetail/components/PayCard.vue b/src/views/productDetail/components/PayCard.vue index 182540f..11c0f36 100644 --- a/src/views/productDetail/components/PayCard.vue +++ b/src/views/productDetail/components/PayCard.vue @@ -1,16 +1,16 @@ <template> <div class="PayCard"> <div class="imageArea" v-if="data.pics.length"> - <img class="activeImg" :src="'/httpImage/' + activeImg.url" /> + <ImageShow class="activeImg" :src="activeImg.url" /> <div class="imgList"> - <img + <ImageShow v-for="(item, index) in data.pics" class="preImg" - :src="'/httpImage/' + item.url" + :src="item.url" :key="index" alt="" :class="{ active: activeImg.index == index }" - @click="selectImg(index, item.url)" + @click.native="selectImg(index, item.url)" /> </div> </div> diff --git a/src/views/trialCenter/components/SdkItem.vue b/src/views/trialCenter/components/SdkItem.vue index ebba2ba..54bb1f2 100644 --- a/src/views/trialCenter/components/SdkItem.vue +++ b/src/views/trialCenter/components/SdkItem.vue @@ -1,7 +1,7 @@ <template> <div class="SdkItem"> <div class="icon"> - <img :src="'/httpImage/' + sdk.logoUrl" alt="" /> + <ImageShow :src="sdk.logoUrl" alt="" /> </div> <div class="title">{{ sdk.productName }}</div> <div class="des limitRow2"> -- Gitblit v1.8.0