소스 검색

更改图片显示

zs 10 달 전
부모
커밋
5e36f9aaa1
8개의 변경된 파일28개의 추가작업 그리고 9개의 파일을 삭제
  1. 2 2
      .env.development
  2. 1 1
      .env.production
  3. 4 1
      src/views/company/detail.vue
  4. 4 1
      src/views/company/index.vue
  5. 4 1
      src/views/home/index.vue
  6. 4 1
      src/views/innovation/detail.vue
  7. 4 1
      src/views/innovation/index.vue
  8. 5 1
      src/views/main/one.vue

+ 2 - 2
.env.development

@@ -9,9 +9,9 @@ VITE_APP_BASE_API = '/cxyy/api'
 
 VITE_APP_BASE_APIWS ='/websocket/api'
 
-VITE_APP_HOST = ""
-
 VITE_APP_HOME = "http://localhost:3000/"
 
+VITE_APP_HOST = "http://192.168.1.197"
+
 VITE_BASE_URL = "/cxyyWeb"
 VITE_OUT_DIR = "cxyyWeb"

+ 1 - 1
.env.production

@@ -9,7 +9,7 @@ VITE_APP_BASE_API = '/cxyy/api'
 
 VITE_APP_BASE_APIWS ='/websocket/api'
 
-VITE_APP_HOST = ""
+VITE_APP_HOST = "http://10.120.114.6"
 
 VITE_APP_HOME = "/cxyyAdmin"
 

+ 4 - 1
src/views/company/detail.vue

@@ -9,7 +9,7 @@
                 <el-image
                   class="image"
                   v-if="info.logo && info.logo.length > 0"
-                  :src="info.logo[0].url"
+                  :src="getUrl(info.logo)"
                   fit="fill"
                 />
               </el-col>
@@ -268,6 +268,9 @@ const toCollection = async (status) => {
     })
   }
 }
+const getUrl = (item) => {
+  if (item) return `${import.meta.env.VITE_APP_HOST}${item[0].uri}`
+}
 // 查看
 const toView = (item) => {
   router.push({ path: '/achievement/detail', query: { id: item.id || item._id } })

+ 4 - 1
src/views/company/index.vue

@@ -197,7 +197,7 @@
               @click="toView(item)"
             >
               <el-col :span="4" class="left">
-                <el-image class="image" :src="item.logo[0].url" fit="fill" />
+                <el-image class="image" :src="getUrl(item.logo)" fit="fill" />
               </el-col>
               <el-col :span="20" class="right">
                 <el-col :span="24" class="right_1">
@@ -458,6 +458,9 @@ const toDel = async (item, type) => {
   await search({ skip, limit })
   loading.value = false
 }
+const getUrl = (item) => {
+  if (item) return `${import.meta.env.VITE_APP_HOST}${item[0].uri}`
+}
 const currentPage = ref(1)
 // 分页
 const changePage = (page = currentPage.value) => {

+ 4 - 1
src/views/home/index.vue

@@ -165,7 +165,7 @@
                 @click="toView(item, '2')"
               >
                 <el-col :span="4" class="left">
-                  <el-image class="image" :src="item.logo[0].url" fit="fill" />
+                  <el-image class="image" :src="getUrl(item.logo)" fit="fill" />
                 </el-col>
                 <el-col :span="20" class="right">
                   <el-col :span="24" class="right_1">
@@ -608,6 +608,9 @@ const getDict = (data, model) => {
   else if (model == 'scale') res = scaleList.value.find((f) => f.value == data)
   return get(res, 'label')
 }
+const getUrl = (item) => {
+  if (item) return `${import.meta.env.VITE_APP_HOST}${item[0].uri}`
+}
 // 地区显示
 const getArea = (data) => {
   if (data) return data.join(',')

+ 4 - 1
src/views/innovation/detail.vue

@@ -9,7 +9,7 @@
                 <el-image
                   v-if="info.file && info.file.length > 0"
                   class="image"
-                  :src="info.file[0].url"
+                  :src="getUrl(info.file)"
                   fit="fill"
                 />
                 <el-image v-else class="image" :src="news" fit="fill" />
@@ -292,6 +292,9 @@ const selectOpen = (key) => {
 const toView = (item) => {
   router.push({ path: '/innovation/detail', query: { id: item.id || item._id } })
 }
+const getUrl = (item) => {
+  if (item) return `${import.meta.env.VITE_APP_HOST}${item[0].uri}`
+}
 // 报名参赛
 const toSign = () => {
   dialog.value = true

+ 4 - 1
src/views/innovation/index.vue

@@ -114,7 +114,7 @@
                 <el-image
                   v-if="item.file && item.file.length > 0"
                   class="image"
-                  :src="item.file[0].url"
+                  :src="getUrl(item.file)"
                   fit="fill"
                 />
                 <el-image v-else class="image" :src="news" fit="fill" />
@@ -303,6 +303,9 @@ const sizeChange = (limits) => {
   currentPage.value = 1
   search({ skip: 0, limit: limit })
 }
+const getUrl = (item) => {
+  if (item) return `${import.meta.env.VITE_APP_HOST}${item[0].uri}`
+}
 </script>
 <style scoped lang="scss">
 .main {

+ 5 - 1
src/views/main/one.vue

@@ -144,7 +144,7 @@
                   <el-image
                     v-if="item.file && item.file.length > 0"
                     class="image"
-                    :src="item.file[0].url"
+                    :src="getUrl(item.file)"
                     fit="cover"
                   />
                   <el-image v-else class="image" :src="match" fit="fill" />
@@ -285,6 +285,10 @@ const removeHtmlStyle = (html) => {
 const toLink = (item) => {
   window.open(item.href, '_blank') // 在新标签页中打开URL
 }
+const getUrl = (item) => {
+  if (item) return `${import.meta.env.VITE_APP_HOST}${item[0].uri}`
+}
+
 // 查看更多
 const toMore = () => {
   router.push({ path: `/five` })