Merge remote-tracking branch 'origin/feature-20240104' into feature-20240104

master
382696293@qq.com 2 years ago
commit 4a078a9983

@ -20,6 +20,8 @@ public class SysFile
*/ */
private String url; private String url;
private int index;
public String getName() public String getName()
{ {
return name; return name;
@ -40,6 +42,14 @@ public class SysFile
this.url = url; this.url = url;
} }
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 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.domain.R;
import com.flossom.common.core.utils.file.FileUtils; 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()); 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>
<el-tab-pane label="介绍页" name="middlePage"> <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%" > <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 slot="placeholder" class="image-slot"><span class="dot"></span>
</div> </div>
</el-image> </el-image>
</div> </div>
<div style="float: left;margin-left: 10%;margin-top: 10%;"> <div style="float: left;margin-left: 5%;margin-top: 10%;">
<el-upload <el-upload
ref="upload" ref="upload"
:limit="1" :limit="1"
accept=".jpg, .png, .jpeg" accept=".jpg, .png, .jpeg"
:data="{index:index}"
:headers="upload.headers" :headers="upload.headers"
:action="upload.url" :action="upload.url+'/else'"
:disabled="upload.isUploading" :disabled="upload.isUploading"
:on-progress="handleFileUploadProgress" :on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess" :on-success="handleFileSuccess"
@ -58,6 +59,25 @@
<div class="el-upload__tip" slot="tip">请上传登录页背景图片建议尺寸为375px*471p</div> <div class="el-upload__tip" slot="tip">请上传登录页背景图片建议尺寸为375px*471p</div>
</el-upload> </el-upload>
</div> </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> </div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="登录页" name="logoPage"> <el-tab-pane label="登录页" name="logoPage">
@ -113,6 +133,8 @@ export default {
showSearch: true, showSearch: true,
// //
total: 0, total: 0,
// videoimage
imagesInfo: [],
// //
infoList: [], infoList: [],
// //
@ -153,6 +175,7 @@ export default {
form: {}, form: {},
// //
rules: { rules: {
} }
}; };
}, },
@ -163,22 +186,29 @@ export default {
/** 查询登录信息列表 */ /** 查询登录信息列表 */
getList() { getList() {
this.loading = true; this.loading = true;
this.imagesInfo = [];
listInfo(this.queryParams).then(response => { listInfo(this.queryParams).then(response => {
this.infoList = response.rows; this.infoList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
// //
this.infoList.forEach((item)=>{ this.infoList.forEach((item)=>{
if (item.type == 1) { if (item.type == 1 && item.fileSuffix == 'video') {
// //
this.videoForm = item; this.videoForm = item;
this.$refs["video"].load(); this.$refs["video"].load();
this.$refs["video"].play(); this.$refs["video"].play();
} else if(item.type == 1 && item.fileSuffix == 'images') {
//
this.imagesInfo.push(item);
}else { }else {
// //
this.loginForm = item; this.loginForm = item;
} }
}) })
if (this.imagesInfo.length == 0) {
this.imagesInfo.push({"filePath":""});
}
}); });
}, },
handleClick(tab, event) { handleClick(tab, event) {
@ -206,9 +236,10 @@ export default {
handleFileUploadProgress(event, file, fileList) { handleFileUploadProgress(event, file, fileList) {
// this.upload.isUploading = true; // this.upload.isUploading = true;
console.log('上传处理中==>',JSON.stringify(event)) 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(response.code == '200') {
if (this.activeName == 'startPage') { if (this.activeName == 'startPage') {
// //
@ -231,6 +262,9 @@ export default {
this.getList(); this.getList();
}); });
} }
} else if(this.activeName == 'middlePage'){
this.imagesInfo[response.data.index].filePath = response.data.url;
console.log('结果',JSON.stringify(this.imagesInfo))
} else { } else {
// //
this.loginForm.filePath = response.data.url; this.loginForm.filePath = response.data.url;
@ -257,6 +291,9 @@ export default {
console.log('上传后的结果==>',JSON.stringify(response)) console.log('上传后的结果==>',JSON.stringify(response))
}, },
handleAddInfo(){
this.imagesInfo.push({"filePath":""});
},
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
@ -290,9 +327,10 @@ export default {
}); });
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm(item) {
this.$refs["form"].validate(valid => { this.form = item;
if (valid) { this.form.fileSuffix = 'images';
this.form.type = 1;
if (this.form.id != null) { if (this.form.id != null) {
updateInfo(this.form).then(response => { updateInfo(this.form).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
@ -306,13 +344,15 @@ export default {
this.getList(); this.getList();
}); });
} }
}
});
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
if (!row.id) {
this.$modal.msgError('目前数据状态不允许删除');
return;
}
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除登录信息编号为"' + ids + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除登录信息编号为"' + ids + '"的数据项?').then(function() {
return delInfo(ids); return delInfo(ids);
}).then(() => { }).then(() => {
this.getList(); this.getList();

Loading…
Cancel
Save