mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-06-21 09:30:24 +08:00
支持 OSS CDN 配置项
This commit is contained in:
@@ -84,6 +84,17 @@
|
|||||||
<span class="desc">文件访问路径,例如:/files 或完整域名</span>
|
<span class="desc">文件访问路径,例如:/files 或完整域名</span>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
|
<FormItem label="启用CDN" key="cdnEnabled" prop="cdnEnabled">
|
||||||
|
<i-switch v-model="formValidate.cdnEnabled" :true-value="true" :false-value="false" size="large">
|
||||||
|
<span slot="open">开</span>
|
||||||
|
<span slot="close">关</span>
|
||||||
|
</i-switch>
|
||||||
|
</FormItem>
|
||||||
|
<FormItem v-if="formValidate.cdnEnabled" label="CDN访问前缀" key="cdnUrlPrefix" prop="cdnUrlPrefix">
|
||||||
|
<Input v-model="formValidate.cdnUrlPrefix" placeholder="https://cdn.example.com"/>
|
||||||
|
<span class="desc">开启后接口输出图片资源时替换为该前缀,关闭时返回原始存储地址</span>
|
||||||
|
</FormItem>
|
||||||
|
|
||||||
<div class="label-btns">
|
<div class="label-btns">
|
||||||
<Button type="primary" @click="submit('formValidate')">保存</Button>
|
<Button type="primary" @click="submit('formValidate')">保存</Button>
|
||||||
|
|
||||||
@@ -121,6 +132,8 @@ export default {
|
|||||||
tencentCOSEndPoint: "",
|
tencentCOSEndPoint: "",
|
||||||
localFilePath: "data/uploads",
|
localFilePath: "data/uploads",
|
||||||
localFileUrlPrefix: "/files",
|
localFileUrlPrefix: "/files",
|
||||||
|
cdnEnabled: false,
|
||||||
|
cdnUrlPrefix: "",
|
||||||
},
|
},
|
||||||
result:""
|
result:""
|
||||||
};
|
};
|
||||||
@@ -133,6 +146,10 @@ export default {
|
|||||||
// 保存
|
// 保存
|
||||||
submit(name) {
|
submit(name) {
|
||||||
let that = this;
|
let that = this;
|
||||||
|
if (this.formValidate.cdnEnabled && !this.formValidate.cdnUrlPrefix) {
|
||||||
|
this.$Message.error("请填写CDN访问前缀");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (handleSubmit(that, name)) {
|
if (handleSubmit(that, name)) {
|
||||||
this.setupSetting()
|
this.setupSetting()
|
||||||
}
|
}
|
||||||
@@ -151,8 +168,11 @@ export default {
|
|||||||
init() {
|
init() {
|
||||||
this.result = JSON.parse(this.res);
|
this.result = JSON.parse(this.res);
|
||||||
|
|
||||||
this.$set(this, "formValidate", {...this.result});
|
this.$set(this, "formValidate", {...this.formValidate, ...this.result});
|
||||||
Object.keys(this.formValidate).forEach((item) => {
|
Object.keys(this.formValidate).forEach((item) => {
|
||||||
|
if (item === "cdnEnabled" || item === "cdnUrlPrefix") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.ruleValidate[item] = [
|
this.ruleValidate[item] = [
|
||||||
{
|
{
|
||||||
required: true,
|
required: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user