zhangdan 4 vuotta sitten
vanhempi
commit
a2ff64c5b2
1 muutettua tiedostoa jossa 33 lisäystä ja 33 poistoa
  1. 33 33
      src/views/appSetting/bannerSetting.vue

+ 33 - 33
src/views/appSetting/bannerSetting.vue

@@ -45,8 +45,8 @@
         :hideRequiredMark="hideRequiredMark">
         <a-form-item label="名称" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
           <a-input
-            :maxLength="32"
-            v-decorator="['formData.title', { initialValue:formData.title,rules: [{ required: true, message: '请输入轮播图名称32个字以内!' }] }]"
+            :maxLength="30"
+            v-decorator="['formData.title', { initialValue:formData.title,rules: [{ required: true, message: '请输入轮播图名称30个字以内!' }] }]"
             :disabled="disabled"
             placeholder="请输入轮播图名称32个字以内" />
         </a-form-item>
@@ -88,9 +88,9 @@
             <Upload
               v-if="title != '查看详情'"
               v-decorator="[
-                'photo',
+                'formData.photoPath',
                 {
-                  initialValue: photo,
+                  initialValue: formData.photoPath,
                   rules: [{required: true,message: '请上传轮播图!'}]
                 }]"
               ref="bannerImage"
@@ -100,7 +100,7 @@
               listType="picture-card"
               upText="上传图片">
             </Upload>
-            <img v-else :src="photo" style="width:100px ;height: auto;" />
+            <img v-else :src="formData.photoPath" style="width:100px ;height: auto;" />
           </div>
         </a-form-item>
         <a-form-item :wrapper-col="{ span: 12, offset: 5 }" style="text-align: center;">
@@ -172,28 +172,30 @@ export default {
         dataIndex: 'url',
         align: 'center'
       },
-	  {
-	    title: '状态',
-	    minWidth: '100',
-	    dataIndex: 'status',
-	    align: 'center',
-	    scopedSlots: {
-	      customRender: 'status'
-	    }
-	  },
-	  {
-	    title: '操作',
-	    // dataIndex: 'action',
-	    minWidth: '100',
-	    align: 'center',
-	    scopedSlots: {
-	      customRender: 'action'
-	    }
-	  }
+      {
+        title: '状态',
+        minWidth: '100',
+        dataIndex: 'status',
+        align: 'center',
+        scopedSlots: {
+          customRender: 'status'
+        }
+      },
+      {
+        title: '操作',
+        // dataIndex: 'action',
+        minWidth: '100',
+        align: 'center',
+        scopedSlots: {
+          customRender: 'action'
+        }
+      }
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
-        return getBannerSettingList({ bannerType: 'app' })
+        return getBannerSettingList({
+          bannerType: 'app'
+        })
           .then(res => {
             // console.log(res, '1111')
             const no = 0
@@ -227,10 +229,8 @@ export default {
         status: '', // 状态
         sort: '', // 排序
         position: '', // 广告图位置
-        photoBasePath: '',	// 图片基础路径
-        photoPath: ''	// 图片路径
+        photoPath: '' // banner地址
       },
-      photo: '', // banner图片
       bannerType: 'app',
       disabled: false,
       value: '',
@@ -249,10 +249,11 @@ export default {
       delete this.formData.id
       this.visible = true
       this.title = '新增'
-	  this.hideRequiredMark = false
+      this.hideRequiredMark = false
     },
+    // 轮播图change
     getbannerImage (data) {
-      this.photo = data
+      this.formData.photoPath = data
     },
     // 点击保存;
     handleSubmit (e) {
@@ -264,8 +265,6 @@ export default {
           const formData = Object.assign({}, this.formData, values.formData, {
             bannerType: 'app'
           })
-          formData.photoBasePath = this.photo.substring(0, this.photo.lastIndexOf('/') + 1)
-          formData.photoPath = this.photo.substring(this.photo.lastIndexOf('/') + 1)
           console.log(formData, _this.radioGroup)
           saveItem(formData, _this.radioGroup).then(res => {
             console.log(res, 'rrrrrrrrr')
@@ -298,7 +297,7 @@ export default {
     assignment (row) {
       this.formData.id = row.id
       this.formData.title = row.title
-	  this.photo = row.photoBasePath + row.photoPath
+      this.formData.photoPath = row.photoPath
       this.formData.url = row.url
       this.formData.status = row.status
       this.formData.sort = row.sort
@@ -306,6 +305,7 @@ export default {
     },
     // 0 修改,1 查看详情
     handleEdit (row, type) {
+      const _this = this
       console.log(row)
       if (type == 1) {
         this.title = '查看详情'
@@ -318,7 +318,7 @@ export default {
       this.disabled = type == 1
       this.visible = true
       setTimeout(() => {
-        this.$refs.bannerImage.setFileList(this.photo)
+        _this.$refs.bannerImage.setFileList(this.formData.photoPath)
       }, 500)
     },
     // 删除