Selaa lähdekoodia

推广位接口修改

lilei 4 vuotta sitten
vanhempi
commit
edd4e0ded6
1 muutettua tiedostoa jossa 30 lisäystä ja 39 poistoa
  1. 30 39
      src/views/shop/bannerSetting.vue

+ 30 - 39
src/views/shop/bannerSetting.vue

@@ -23,14 +23,14 @@
         <a-icon
           type="edit"
           id="bannerSetting-handleEdit"
-          v-if="record.status == '0'"
+          v-if="record.state == '0'"
           title="编辑"
           class="actionBtn icon-blues"
           @click="handleEdit(record, 0)" />
         <a-icon
           type="delete"
           id="bannerSetting-delect"
-          v-if="record.status == '0'"
+          v-if="record.state == '0'"
           title="删除"
           class="actionBtn icon-red"
           @click="delect(record)" />
@@ -40,7 +40,7 @@
           checkedChildren="启用"
           unCheckedChildren="禁用"
           id="bannerSetting-changeFlagHandle"
-          v-model="record.status == 1 ? true : false"
+          v-model="record.state == 1 ? true : false"
           @change="changeFlagHandle(text, record)"
         />
       </span>
@@ -77,15 +77,15 @@
             code="ADVERT_POSITION"
             allowClear
             id="bannerSetting-position"
-            placeholder="请选择广告图位置"
+            placeholder="请选择推广位类型"
             :disabled="disabled"
-            v-decorator="['formData.position', { initialValue: formData.position, rules: [{ required: true, message: '请选择广告图位置!' }] }]"
+            v-decorator="['formData.type', { initialValue: formData.type, rules: [{ required: true, message: '请选择推广位类型!' }] }]"
           ></v-select>
         </a-form-item>
         <a-form-item label="跳转链接" :label-col="formItemLayout.labelCol" :wrapper-col="formItemLayout.wrapperCol">
           <a-textarea
             :maxLength="300"
-            v-decorator="['formData.url', { initialValue: formData.url, rules: [{ required: false, message: '请输入跳转链接(最多300字符)!' }] }]"
+            v-decorator="['formData.jumpUrl', { initialValue: formData.jumpUrl, rules: [{ required: false, message: '请输入跳转链接(最多300字符)!' }] }]"
             :disabled="disabled"
             id="bannerSetting-url"
             placeholder="请输入跳转链接(最多300字符)"
@@ -107,7 +107,7 @@
           <a-radio-group
             :disabled="disabled"
             id="bannerSetting-status"
-            v-decorator="['formData.status', { initialValue: formData.status, rules: [{ required: true, message: '请选择状态!' }] }]"
+            v-decorator="['formData.state', { initialValue: formData.state, rules: [{ required: true, message: '请选择状态!' }] }]"
           >
             <a-radio value="1">启用</a-radio>
             <a-radio value="0">禁用</a-radio>
@@ -118,9 +118,9 @@
             v-if="title != '查看详情'"
             id="bannerSetting-photoPath"
             v-decorator="[
-              'formData.photoPath',
+              'formData.image',
               {
-                initialValue: formData.photoPath,
+                initialValue: formData.image,
                 rules: [{ required: true, message: '请上传轮播图!' }]
               }
             ]"
@@ -131,7 +131,7 @@
             listType="picture-card"
             upText="上传"
           ></Upload>
-          <img v-else :src="formData.photoPath" style="width:100px ;height: auto;" />
+          <img v-else :src="formData.image" style="width:100px ;height: auto;" />
         </a-form-item>
         <a-form-item :wrapper-col="{ span: 12, offset: 6}" style="text-align: center;">
           <a-button type="primary" html-type="submit" v-if="!disabled" id="bannerSetting-submit" style="margin-right: 15px">保存</a-button>
@@ -163,9 +163,9 @@ export default {
           align: 'center'
         },
         {
-          title: '广告图位置',
+          title: '推广位类型',
           width: 200,
-          dataIndex: 'position',
+          dataIndex: 'type',
           align: 'center',
           scopedSlots: {
             customRender: 'position'
@@ -186,7 +186,7 @@ export default {
         {
           title: '跳转链接',
           width: 100,
-          dataIndex: 'url',
+          dataIndex: 'jumpUrl',
           align: 'center',
           customRender: (text) => {
             return text || '--'
@@ -195,7 +195,7 @@ export default {
         {
           title: '状态',
           width: 100,
-          dataIndex: 'status',
+          dataIndex: 'state',
           align: 'center',
           scopedSlots: {
             customRender: 'status'
@@ -212,10 +212,8 @@ export default {
       ],
       // 加载数据方法 必须为 Promise 对象
       loadData: parameter => {
-        return getBannerSettingList({
-          bannerType: 'app'
-        }).then(res => {
-          // console.log(res, '1111')
+        return getBannerSettingList().then(res => {
+          console.log(res, '1111')
           const no = 0
           for (let i = 0; i < res.data.length; i++) {
             const _item = res.data[i]
@@ -224,7 +222,6 @@ export default {
           return res.data
         })
       },
-
       title: '编辑',
       closable: true,
       visible: false,
@@ -242,11 +239,10 @@ export default {
       },
       formData: {
         title: '', // 标题
-        url: '', // 图片路径
         status: '', // 状态
         sort: '', // 排序
-        position: '', // 广告图位置
-        photoPath: '', // banner地址
+        type: '', // 广告图位置
+        image: '', // banner地址
         createDate: ''
       },
       bannerType: 'app',
@@ -280,12 +276,9 @@ export default {
       const _this = this
       this.form.validateFields((err, values) => {
         if (!err) {
-          console.log('Received values of form: ', values, this.formData)
-          const formData = Object.assign({}, this.formData, values.formData, {
-            bannerType: 'app'
-          })
-          console.log(formData, _this.radioGroup)
-          saveItem(formData, _this.radioGroup).then(res => {
+          const formData = Object.assign({}, this.formData, values.formData)
+          console.log(formData)
+          saveItem(formData).then(res => {
             console.log(res, 'rrrrrrrrr')
             if (res.status == 200) {
               _this.$message.success(res.message)
@@ -299,13 +292,11 @@ export default {
     close () {
       this.visible = false
       this.formData.title = ''
-      this.photo = ''
-      this.formData.url = ''
-      this.formData.status = ''
+      this.formData.jumpUrl = ''
+      this.formData.state = ''
       this.formData.sort = ''
-      this.formData.position = ''
-      this.formData.photoBasePath = ''
-      this.formData.photoPath = ''
+      this.formData.type = ''
+      this.formData.image = ''
       this.title = '新增'
       this.$refs.bannerImage.setFileList('')
       this.form.resetFields()
@@ -314,11 +305,11 @@ export default {
     assignment (row) {
       this.formData.id = row.id
       this.formData.title = row.title
-      this.formData.photoPath = row.photoPath
-      this.formData.url = row.url
-      this.formData.status = row.status
+      this.formData.image = row.image
+      this.formData.jumpUrl = row.jumpUrl
+      this.formData.state = row.state
       this.formData.sort = row.sort
-      this.formData.position = row.position
+      this.formData.type = row.type
       this.formData.createDate = row.createDate
     },
     // 0 修改,1 查看详情
@@ -336,7 +327,7 @@ export default {
       this.disabled = type == 1
       this.visible = true
       setTimeout(() => {
-        _this.$refs.bannerImage.setFileList(this.formData.photoPath)
+        _this.$refs.bannerImage.setFileList(this.formData.image)
       }, 500)
     },
     // 删除