@@ -65,3 +65,10 @@ export function videoSave(data) { | |||||
data | data | ||||
}) | }) | ||||
} | } | ||||
export function shuzirenremark() { | |||||
return request({ | |||||
url: '/aigc/shuzirenremark', | |||||
method: 'get' | |||||
}) | |||||
} |
@@ -35,6 +35,44 @@ export default { | |||||
} | } | ||||
}, | }, | ||||
methods: { | methods: { | ||||
/* // 上传图片时限制图片的尺寸 | |||||
beforeUpload(file) { | |||||
//进行图片类型和大小的限制 | |||||
const isLt10M = file.size / 1024 / 1024 < 10; | |||||
if (!isLt10M) { | |||||
this.$message({ | |||||
message: "广告图大小不能超过10M!请重新选择!", | |||||
type: "warning", | |||||
}); | |||||
return false; //必须加上return false; 才能阻止 | |||||
} | |||||
const isSize = new Promise(function (resolve, reject) { | |||||
let width = 1920; | |||||
// let height = 500; | |||||
let _URL = window.URL || window.webkitURL; | |||||
let img = new Image(); | |||||
img.onload = function () { | |||||
let valid = | |||||
img.width == width && (img.height == 500 || img.height == 280); | |||||
valid ? resolve() : reject(); | |||||
}; | |||||
img.src = _URL.createObjectURL(file); | |||||
}).then( | |||||
() => { | |||||
return file; | |||||
}, | |||||
() => { | |||||
this.$message({ | |||||
message: "广告图尺寸只能是500或280*1920px!请重新选择!", | |||||
type: "warning", | |||||
}); | |||||
return Promise.reject(); | |||||
return false; //必须加上return false; 才能阻止 | |||||
} | |||||
); | |||||
return isLt10M && isSize; | |||||
}, */ | |||||
beforeAvatarUpload(file) { | beforeAvatarUpload(file) { | ||||
const isType = this.type === 'video' ? (file.type === ('video/mp4' || 'video/avi' || 'video/wmv' || 'video/mov')) : (file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg' || file.type === 'image/gif') | const isType = this.type === 'video' ? (file.type === ('video/mp4' || 'video/avi' || 'video/wmv' || 'video/mov')) : (file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg' || file.type === 'image/gif') | ||||
const isLt2M = this.type === 'video' ? file.size / 1024 / 1024 < 50 : file.size / 1024 < 500 | const isLt2M = this.type === 'video' ? file.size / 1024 / 1024 < 50 : file.size / 1024 < 500 | ||||
@@ -208,6 +208,11 @@ export const constantRoutes = [ | |||||
path: 'video', | path: 'video', | ||||
component: () => import('@/views/aigc/video'), | component: () => import('@/views/aigc/video'), | ||||
meta: { title: '数字人视频' } | meta: { title: '数字人视频' } | ||||
}, | |||||
{ | |||||
path: 'introduce', | |||||
component: () => import('@/views/aigc/introduce'), | |||||
meta: { title: '数字人介绍' } | |||||
} | } | ||||
] | ] | ||||
}, | }, | ||||
@@ -0,0 +1,97 @@ | |||||
<!-- | |||||
* @Date: 2021-07-08 11:02:40 | |||||
* @LastEditTime: 2022-07-27 10:48:43 | |||||
* @Description: 广告位 | |||||
--> | |||||
<template> | |||||
<div class="app-container"> | |||||
<el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="130px" class="resetform"> | |||||
<el-form-item label="图片" prop="image"> | |||||
<uploadFile :url.sync="ruleForm.image" type="image" /> | |||||
</el-form-item> | |||||
<el-form-item label="标题" prop="title"> | |||||
<el-input v-model="ruleForm.title"></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="描述" prop="remark"> | |||||
<el-input v-model="ruleForm.remark"></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="链接" prop="link"> | |||||
<el-input v-model="ruleForm.link"></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="链接标题" prop="linkTitle"> | |||||
<el-input v-model="ruleForm.linkTitle"></el-input> | |||||
</el-form-item> | |||||
<el-form-item label="是否新开页面打开"> | |||||
<el-radio-group v-model="ruleForm.newOpen"> | |||||
<el-radio :label="1">是</el-radio> | |||||
<el-radio :label="0">否</el-radio> | |||||
</el-radio-group> | |||||
</el-form-item> | |||||
<el-form-item> | |||||
<el-button type="primary" @click="submitForm('ruleForm')">保存</el-button> | |||||
</el-form-item> | |||||
</el-form> | |||||
</div> | |||||
</template> | |||||
<script> | |||||
import { shuzirenremark } from '@/api/aigc' | |||||
import { saveGuangGao } from '@/api/homePage' | |||||
import uploadFile from '@/components/uploadFile' | |||||
export default { | |||||
components: { | |||||
uploadFile | |||||
}, | |||||
data() { | |||||
return { | |||||
ruleForm: { | |||||
id: '', | |||||
image: '', | |||||
link: '', | |||||
newOpen: '1', | |||||
remark: '', | |||||
linkTitle: '' | |||||
}, | |||||
rules: { | |||||
image: [ | |||||
{ required: true, message: '请上传图片', trigger: 'blur' } | |||||
], | |||||
link: [ | |||||
{ required: true, message: '请输入链接', trigger: 'blur' } | |||||
] | |||||
} | |||||
} | |||||
}, | |||||
created() { | |||||
this.getData() | |||||
}, | |||||
methods: { | |||||
getData() { | |||||
shuzirenremark().then(res => { | |||||
this.ruleForm.id = res.id | |||||
this.ruleForm.image = res.image | |||||
this.ruleForm.link = res.link | |||||
this.ruleForm.newOpen = res.newOpen | |||||
this.ruleForm.linkTitle = res.linkTitle | |||||
this.ruleForm.remark = res.remark | |||||
this.ruleForm.title = res.title | |||||
}) | |||||
}, | |||||
submitForm(formName) { | |||||
this.$refs[formName].validate((valid) => { | |||||
if (valid) { | |||||
saveGuangGao(this.ruleForm).then(res => { | |||||
this.$message({ | |||||
message: '操作成功!', | |||||
type: 'success' | |||||
}) | |||||
}) | |||||
} else { | |||||
console.log('error submit!!') | |||||
return false | |||||
} | |||||
}) | |||||
} | |||||
} | |||||
} | |||||
</script> |