Kaynağa Gözat

change: 站点域名编辑. 区分是否为三方域名.

peter 7 ay önce
ebeveyn
işleme
f5f09b7d50
1 değiştirilmiş dosya ile 46 ekleme ve 0 silme
  1. 46 0
      src/views/shop/shop-manage/site/edit.vue

+ 46 - 0
src/views/shop/shop-manage/site/edit.vue

@@ -29,6 +29,22 @@
       <el-form-item
         label="网址"
         prop="url">
+        <el-radio-group
+          v-model="domainType"
+          @change="onDomainChange">
+          <el-radio :label="1">catalogue域名</el-radio>
+          <el-radio :label="2">第三方域名</el-radio>
+        </el-radio-group>
+        <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-model="formData.url"
           style="width: 500px"
@@ -136,6 +152,7 @@ export default {
   },
   data() {
     return {
+      domainType: 1,
       loading: false,
       formData: {},
       rules: {
@@ -201,6 +218,16 @@ export default {
     // },
   },
   methods: {
+    onDomainChange(type) {
+      switch (type) {
+        case 1:
+          this.formData.url = this.formData.pre + '.promocatalogue.com.au'
+          break
+        case 2:
+          this.formData.url = this.formData.other.trim()
+          break
+      }
+    },
     transData() {
       this.loading = true
       const temp = this.form
@@ -217,6 +244,21 @@ export default {
           },
         ]
       }
+
+      if (temp.url) {
+        const regexp = /\.promocatalogue\.com\.au/
+        if (regexp.test(temp.url)) {
+          if (!temp.pre) {
+            this.domainType = 1
+            temp.pre = temp.url.replace(regexp, '')
+          }
+        } else {
+          if (!temp.other) {
+            this.domainType = 2
+            temp.other = temp.url.trim()
+          }
+        }
+      }
       this.formData = temp
       this.loading = false
     },
@@ -230,6 +272,10 @@ export default {
       this.formData.logo = this.imagesList.length
         ? this.imagesList[0].url.replace(this.$mediaRegExp, '/')
         : ''
+      this.formData.url =
+        this.domainType === 1
+          ? this.formData.pre + '.promocatalogue.com.au'
+          : this.formData.other.trim()
       this.$refs.form.validate((valid) => {
         if (!valid) {
           return