平台参数内容页增加页面

master
elliott 2 years ago
parent 9a8fe80c6a
commit 1919798bcf

@ -20,6 +20,8 @@ public class SysFile
*/
private String url;
private int index;
public String getName()
{
return name;
@ -40,6 +42,14 @@ public class SysFile
this.url = url;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -11,6 +11,9 @@ import org.springframework.web.multipart.MultipartFile;
import com.flossom.common.core.domain.R;
import com.flossom.common.core.utils.file.FileUtils;
import javax.annotation.Nullable;
import java.util.Objects;
/**
*
*
@ -46,4 +49,28 @@ public class SysFileController
return R.fail(e.getMessage());
}
}
/**
*
*/
@PostMapping("upload/else")
public R<SysFile> upload(MultipartFile file, int index)
{
try
{
// 上传并返回访问地址
System.out.println("文件上传开始");
String url = sysFileService.uploadFile(file);
SysFile sysFile = new SysFile();
sysFile.setName(FileUtils.getName(url));
sysFile.setUrl(url);
sysFile.setIndex(index);
return R.ok(sysFile);
}
catch (Exception e)
{
log.error("上传文件失败", e);
return R.fail(e.getMessage());
}
}
}

@ -34,20 +34,21 @@
</el-tab-pane>
<el-tab-pane label="介绍页" name="middlePage">
<div style="height: 500px;">
<div style="height: 600px;" v-for="(item,index) of imagesInfo">
<div class="block" style="float: left;margin-left: 3%;margin-top: 3%" >
<el-image :src="loginForm.filePath" style="width: 330px;height: 461px;">
<el-image :src="item.filePath" style="width: 330px;height: 461px;">
<div slot="placeholder" class="image-slot"><span class="dot"></span>
</div>
</el-image>
</div>
<div style="float: left;margin-left: 10%;margin-top: 10%;">
<div style="float: left;margin-left: 5%;margin-top: 10%;">
<el-upload
ref="upload"
:limit="1"
accept=".jpg, .png, .jpeg"
:data="{index:index}"
:headers="upload.headers"
:action="upload.url"
:action="upload.url+'/else'"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
@ -58,6 +59,25 @@
<div class="el-upload__tip" slot="tip">请上传登录页背景图片建议尺寸为375px*471p</div>
</el-upload>
</div>
<div style="float: left;margin-left: 5%;margin-top: 10%;">
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-row>
<el-col :span="24">
<el-form-item label="标题" prop="title">
<el-input v-model="item.title" placeholder="请输入标题" />
</el-form-item>
<el-form-item label="介绍文字" prop="content">
<el-input v-model="item.content" placeholder="请输入介绍文字" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer" style="margin-left: 10%;margin-top: 5%">
<el-button type="primary" @click="submitForm(item)"> </el-button>
<el-button @click="handleDelete(item)"> </el-button>
<el-button type="primary" @click="handleAddInfo"> </el-button>
</div>
</div>
</div>
</el-tab-pane>
<el-tab-pane label="登录页" name="logoPage">
@ -113,6 +133,8 @@ export default {
showSearch: true,
//
total: 0,
// videoimage
imagesInfo: [],
//
infoList: [],
//
@ -153,6 +175,7 @@ export default {
form: {},
//
rules: {
}
};
},
@ -163,22 +186,29 @@ export default {
/** 查询登录信息列表 */
getList() {
this.loading = true;
this.imagesInfo = [];
listInfo(this.queryParams).then(response => {
this.infoList = response.rows;
this.total = response.total;
this.loading = false;
//
this.infoList.forEach((item)=>{
if (item.type == 1) {
if (item.type == 1 && item.fileSuffix == 'video') {
//
this.videoForm = item;
this.$refs["video"].load();
this.$refs["video"].play();
} else {
} else if(item.type == 1 && item.fileSuffix == 'images') {
//
this.imagesInfo.push(item);
}else {
//
this.loginForm = item;
}
})
if (this.imagesInfo.length == 0) {
this.imagesInfo.push({"filePath":""});
}
});
},
handleClick(tab, event) {
@ -206,9 +236,10 @@ export default {
handleFileUploadProgress(event, file, fileList) {
// this.upload.isUploading = true;
console.log('上传处理中==>',JSON.stringify(event))
console.log('上传处理中==>file',JSON.stringify(file))
},
//
handleFileSuccess(response, file, fileList) {
handleFileSuccess(response, file, fileList, item) {
if(response.code == '200') {
if (this.activeName == 'startPage') {
//
@ -231,6 +262,9 @@ export default {
this.getList();
});
}
} else if(this.activeName == 'middlePage'){
this.imagesInfo[response.data.index].filePath = response.data.url;
console.log('结果',JSON.stringify(this.imagesInfo))
} else {
//
this.loginForm.filePath = response.data.url;
@ -257,6 +291,9 @@ export default {
console.log('上传后的结果==>',JSON.stringify(response))
},
handleAddInfo(){
this.imagesInfo.push({"filePath":""});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
@ -290,29 +327,32 @@ export default {
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
submitForm(item) {
this.form = item;
this.form.fileSuffix = 'images';
this.form.type = 1;
if (this.form.id != null) {
updateInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addInfo(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
},
/** 删除按钮操作 */
handleDelete(row) {
if (!row.id) {
this.$modal.msgError('目前数据状态不允许删除');
return;
}
const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除登录信息编号为"' + ids + '"的数据项?').then(function() {
this.$modal.confirm('是否确认删除登录信息编号为"' + ids + '"的数据项?').then(function() {
return delInfo(ids);
}).then(() => {
this.getList();

Loading…
Cancel
Save