Browse Source

fix: 修复创建网站数据异常.

peter 7 months ago
parent
commit
3cad199e98
2 changed files with 49 additions and 16 deletions
  1. 13 1
      src/views/shop/shop-manage/site/au.vue
  2. 36 15
      src/views/shop/shop-manage/site/edit.vue

+ 13 - 1
src/views/shop/shop-manage/site/au.vue

@@ -229,7 +229,19 @@ export default {
     openDetail(num) {
       this.componentVisible = num
       // if (num === 2) {
-      //   this.editData = this.list[0]
+      this.editData = {
+        title: '',
+        pre: '',
+        other: '',
+        url: '',
+        margin: '',
+        setup_margin: '',
+        logo: '',
+        email: '',
+        contactus: '',
+        aboutus: '',
+        terms: '',
+      }
       // }
     },
     deleteListOpt(id) {

+ 36 - 15
src/views/shop/shop-manage/site/edit.vue

@@ -14,9 +14,10 @@
           style="width: 500px"
           placeholder="" />
       </el-form-item>
-      <el-form-item
-        label="logo"
-        prop="logo">
+      <el-form-item label="logo">
+        <template #label>
+          <span style="color: #f56c6c">*</span>&nbsp;logo
+        </template>
         <input
           style="display: none"
           type="text"
@@ -28,22 +29,29 @@
       </el-form-item>
       <el-form-item
         label="网址"
-        prop="url">
+        prop="">
         <el-radio-group v-model="domainType">
           <el-radio :label="1">catalogue域名</el-radio>
           <el-radio :label="2">第三方域名</el-radio>
         </el-radio-group>
+        <el-form-item
+          prop="pre"
+          v-if="domainType === 1">
+          <el-input
+            @change="(e) => (formData.url = e + '.promocatalogue.com.au')"
+            v-model="formData.pre">
+            <template #append>.promocatalogue.com.au</template>
+          </el-input>
+        </el-form-item>
+        <el-form-item
+          prop="other"
+          v-if="domainType === 2">
+          <el-input
+            @change="(e) => (formData.url = e)"
+            v-model="formData.other"></el-input>
+        </el-form-item>
         <el-input
-          @change="(e) => (formData.url = e + '.promocatalogue.com.au')"
-          v-model="formData.pre"
-          v-show="domainType === 1">
-          <template #append>.promocatalogue.com.au</template>
-        </el-input>
-        <el-input
-          @change="(e) => (formData.url = e)"
-          v-model="formData.other"
-          v-show="domainType === 2"></el-input>
-        <el-input
+          v-show="false"
           v-model="formData.url"
           style="width: 500px"
           placeholder="" />
@@ -168,7 +176,14 @@ export default {
             trigger: 'change',
           },
         ],
-        url: [
+        pre: [
+          {
+            required: true,
+            message: this.$t('text_please_input'),
+            trigger: 'blur',
+          },
+        ],
+        other: [
           {
             required: true,
             message: this.$t('text_please_input'),
@@ -246,6 +261,8 @@ export default {
             temp.other = temp.url.trim()
           }
         }
+      } else {
+        this.domainType = 1
       }
       this.formData = temp
       this.loading = false
@@ -265,6 +282,10 @@ export default {
         if (!valid) {
           return
         }
+        if (!this.imagesList.length) {
+          this.$message.error('请上传logo')
+          return
+        }
         const f = cloneDeep(this.formData)
         this.loading = true
         f.logo = this.imagesList[0].url.replace(this.$mediaRegExp, '/')