Quellcode durchsuchen

路径转换替换

sys vor 2 Jahren
Ursprung
Commit
35e9d6acce
2 geänderte Dateien mit 6 neuen und 4 gelöschten Zeilen
  1. 5 0
      main.js
  2. 1 4
      pages/perfect/cards.vue

+ 5 - 0
main.js

@@ -5,6 +5,11 @@ import {
 	router,
 	RouterMount
 } from './service/router.js' //路径换成自己的
+import cosServe from "@/service/txOssSts";
+Vue.prototype.getCosPath = (urlName) => {
+	console.log('getCosPath:路径转换调用')
+	return cosServe.getSignUrl(urlName);
+};
 Vue.use(router)
 // #ifndef VUE3
 import Vue from 'vue'

+ 1 - 4
pages/perfect/cards.vue

@@ -11,7 +11,7 @@
           <text class="sys-color-green">真实照片</text>
           <text class="sys-color-gray-9">,否则部分功能可能会受限</text>
         </view>
-        <view class="card-img" :class="{'open-img':imgBg}" @click="openPopup" :style="{'height':'calc(100vh - '+navHeight+'px  - 278rpx - 270rpx - env(safe-area-inset-bottom)','background-image':'url('+imgBg+')'}">
+        <view class="card-img" :class="{'open-img':imgBg}" @click="openPopup" :style="{'height':'calc(100vh - '+navHeight+'px  - 278rpx - 270rpx - env(safe-area-inset-bottom)','background-image':'url('+getCosPath(imgBg)+')'}">
           <view class="add-box" v-if="!imgBg">
             <image class="add-img" src="/static/img/common/add.png" mode="aspectFill"></image>
           </view>
@@ -99,9 +99,7 @@ export default {
           if(res.tempFiles.length>0){
             console.log(res.tempFiles)
             res.tempFiles.forEach((item,key)=>{
-              console.log(item)
               cosServe.txUploadFile(item,'gallery').then((res)=>{
-                console.log(res)
                 if(key===0){
                   this.imgBg=res.Location
                   console.log('this.imgBg:'+this.imgBg)
@@ -109,7 +107,6 @@ export default {
                   console.log(this.imgBg)
                 }
                 this.imgList.push(res.Location)
-                this.imgList.push(cosServe.getSignUrl(res.Location))
               })
             })
             console.log( this.imgList)