panhui 3 anni fa
parent
commit
e4fb72957e
1 ha cambiato i file con 14 aggiunte e 8 eliminazioni
  1. 14 8
      src/components/PostTask.vue

+ 14 - 8
src/components/PostTask.vue

@@ -6,13 +6,9 @@
                     <img :src="img" />
                 </div>
                 <template v-if="!img">
-                    <div
-                        class="assignmentPost"
-                        v-if="assignment && pageUrl === 'productDetail'"
-                        ref="post"
-                        :style="{ backgroundImage: `url(${shareBg})` }"
-                    >
-                        <!-- <van-image class="assignmentPostBg" width="300" height="500" :src="shareBg" /> -->
+                    <div class="assignmentPost" v-if="assignment && pageUrl === 'productDetail'" ref="post">
+                        <!-- <van-image class="assignmentPostBg" fit="cover" width="300" height="500" :src="shareBg" /> -->
+                        <img class="assignmentPostBg" :src="shareBg" alt="" />
                         <div class="qrcode-text" :style="{ bottom: qrcodeBottom + 'px' }">
                             <div class="qrcode">
                                 <vue-qrcode :value="url" :options="{ width: qrcodeImg, margin: 0 }"></vue-qrcode>
@@ -187,7 +183,7 @@ export default {
                 useCORS: true,
                 allowTaint: true,
                 backgroundColor: null,
-                scale: 3
+                scale: 4
             }).then(canvas => {
                 this.$toast.clear();
                 this.img = canvas.toDataURL('image/png');
@@ -461,6 +457,7 @@ export default {
     position: relative;
     background-position: center center;
     background-size: cover;
+    overflow: hidden;
     .qrcode-text {
         background: #f5f7fa;
         border-radius: 6px;
@@ -487,6 +484,15 @@ export default {
             margin-top: 4px;
         }
     }
+    .assignmentPostBg {
+        position: absolute;
+        left: 0;
+        width: auto;
+        height: var(--app-height);
+        left: 50%;
+        top: 50%;
+        transform: translate(-50%, -50%);
+    }
 }
 
 .tips {