Browse Source

Merge branch 'master' of http://192.168.0.115:3000/chenzhiguang/xinjiang_army

zhouenguang 3 years ago
parent
commit
f4df6c83c4

+ 35 - 27
new_backstage/src/pages/content/collection/componets/img.vue

@@ -1,7 +1,11 @@
 <template>
   <div>
     <el-form-item label="标题:" prop="name">
-      <el-input v-model="form.name" :maxlength="INPUTLENGTH" show-word-limit></el-input>
+      <el-input
+        v-model="form.name"
+        :maxlength="INPUTLENGTH"
+        show-word-limit
+      ></el-input>
     </el-form-item>
 
     <el-form-item label="精品类型:">
@@ -13,11 +17,12 @@
       <ul class="tuku">
         <li v-for="(item, i) in filelist" :key="i">
           <div class="imgcon">
-            <el-image 
-              class="img" 
+            <el-image
+              class="img"
               :src="item.filePath"
               :fit="'cover'"
-              :preview-src-list="[item.filePath]">
+              :preview-src-list="[item.filePath]"
+            >
             </el-image>
             <div class="cover" v-if="item.isIndex">封面图片</div>
             <el-button
@@ -44,6 +49,10 @@
         </li>
       </ul>
     </el-form-item>
+    <!-- 新增的链接 -->
+    <el-form-item label="链接:">
+      <el-input v-model="form.href"></el-input>
+    </el-form-item>
   </div>
 </template>
 
@@ -62,26 +71,26 @@ export default {
       thumbUrl: this.$serverName + "cms/goods/uploadImg",
     };
   },
-  watch:{
-    'filelist':function (newVal) {
-      if (newVal.length<=0) {
-        this.form.indexId = ''
-        this.form.thumb = ''
+  watch: {
+    filelist: function (newVal) {
+      if (newVal.length <= 0) {
+        this.form.indexId = "";
+        this.form.thumb = "";
       }
-    }
+    },
   },
   methods: {
     setCover(item) {
-      this.form.indexId = item.id
-      this.form.thumb = item.filePath
+      this.form.indexId = item.id;
+      this.form.thumb = item.filePath;
       this.filelist.forEach((sub) => {
-            //匹配置为0
-            if (item.id == sub.id) {
-              sub.isIndex = 1;
-            } else {
-              sub.isIndex = 0;
-            }
-          });
+        //匹配置为0
+        if (item.id == sub.id) {
+          sub.isIndex = 1;
+        } else {
+          sub.isIndex = 0;
+        }
+      });
     },
 
     del(item, i) {
@@ -104,15 +113,14 @@ export default {
     reupload() {},
 
     updateImg(data) {
-      
       this.filelist.push({
         ...data,
-        isIndex:0
-      })
+        isIndex: 0,
+      });
 
-      if (this.filelist.length===1) {
-        this.form.indexId = data.id
-        this.form.thumb = data.filePath
+      if (this.filelist.length === 1) {
+        this.form.indexId = data.id;
+        this.form.thumb = data.filePath;
       }
     },
   },
@@ -136,13 +144,13 @@ export default {
       margin-bottom: @gap / 2;
       position: relative;
       background: #f0f0f0;
-      overflow:hidden;
+      overflow: hidden;
       .img {
         width: 100%;
         position: absolute;
         top: 50%;
         left: 50%;
-        transform: translate(-50%,-50%);
+        transform: translate(-50%, -50%);
       }
       .cover {
         position: absolute;

+ 40 - 12
new_backstage/src/pages/content/collection/componets/video.vue

@@ -1,7 +1,11 @@
 <template>
   <div>
     <el-form-item label="标题:" prop="name">
-      <el-input v-model="form.name" :maxlength="INPUTLENGTH" show-word-limit></el-input>
+      <el-input
+        v-model="form.name"
+        :maxlength="INPUTLENGTH"
+        show-word-limit
+      ></el-input>
     </el-form-item>
 
     <el-form-item label="精品类型:">
@@ -9,13 +13,38 @@
     </el-form-item>
 
     <el-form-item label="封面图片:" prop="thumb">
-      <uploadThumb :url="thumbUrl" @update="data=>{form.thumb = data}" :thumb="form.thumb" />
+      <uploadThumb
+        :url="thumbUrl"
+        @update="
+          (data) => {
+            form.thumb = data;
+          }
+        "
+        :thumb="form.thumb"
+      />
     </el-form-item>
 
-    <el-form-item label="视频文件:" prop="filePath">
-      <uploadFile :url="fileUrl"  @update="data=>{form.fileName = data.fileName,form.filePath = data.filePath}" :filePath="form.filePath" :desc="'支持mp4视频文件,大小不超过500MB'" />
-      <video class="svideo" v-if="form.filePath" controls :src="form.filePath">
-      </video>
+    <el-form-item label="视频文件:">
+      <uploadFile
+        :url="fileUrl"
+        @update="
+          (data) => {
+            (form.fileName = data.fileName), (form.filePath = data.filePath);
+          }
+        "
+        :filePath="form.filePath"
+        :desc="'支持mp4视频文件,大小不超过500MB'"
+      />
+      <video
+        class="svideo"
+        v-if="form.filePath"
+        controls
+        :src="form.filePath"
+      ></video>
+    </el-form-item>
+    <!-- 新增的链接 -->
+    <el-form-item label="链接:">
+      <el-input v-model="form.href"></el-input>
     </el-form-item>
   </div>
 </template>
@@ -25,10 +54,9 @@ import uploadThumb from "@/components/uploadThumb";
 import uploadFile from "@/components/uploadFile";
 
 export default {
-  props: ["data",'rule'],
-  components: { uploadThumb,uploadFile },
+  props: ["data", "rule"],
+  components: { uploadThumb, uploadFile },
   data() {
-    
     return {
       form: this.data,
       radio: "选中且禁用",
@@ -40,9 +68,9 @@ export default {
 </script>
 
 <style lang="less" scoped>
-.svideo{
+.svideo {
   max-width: 50%;
-  pointer-events: auto!important;
-  opacity: 1!important;
+  pointer-events: auto !important;
+  opacity: 1 !important;
 }
 </style>