启动页面跟登录页修改

master
elliott 2 years ago
parent 8e4f2bc1c1
commit af83e2a547

@ -33,6 +33,7 @@ public class SysFileController
try
{
// 上传并返回访问地址
System.out.println("文件上传开始");
String url = sysFileService.uploadFile(file);
SysFile sysFile = new SysFile();
sysFile.setName(FileUtils.getName(url));

@ -23,3 +23,8 @@ spring:
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
servlet:
multipart:
enabled: true #默认支持文件上传
max-file-size: 50MB #最大文件
max-request-size: 30MB #最大支持请求大小

@ -1,132 +1,76 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="文件路径" prop="filePath">
<el-input
v-model="queryParams.filePath"
placeholder="请输入文件路径"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="文件类型" prop="fileSuffix">
<el-input
v-model="queryParams.fileSuffix"
placeholder="请输入文件类型"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
</el-form-item>
</el-form>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="启动页" name="startPage">
<div class="block" style="float: left;margin-left: 3%;margin-top: 3%">
<video
ref="video"
class="play-video"
controls="controls"
autoplay="autoplay"
width="337px"
height="600px"
>
<source :src="videoForm.filePath" type="video/mp4" />
</video>
</div>
<div style="float: left;margin-left: 10%;margin-top: 10%;">
<el-upload
ref="upload"
:limit="1"
accept=".mp4"
:headers="upload.headers"
:action="upload.url"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip">请上传视频用于启动页显示比例建议为16: 9</div>
</el-upload>
</div>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['system:info:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['system:info:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['system:info:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['system:info:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</el-tab-pane>
<el-tab-pane label="登录页" name="logoPage">
<div class="block" style="float: left;margin-left: 3%;margin-top: 3%">
<el-image :src="loginForm.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%;">
<el-upload
ref="upload"
:limit="1"
accept=".jpg, .png, .jpeg"
:headers="upload.headers"
:action="upload.url"
:disabled="upload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip" slot="tip">请上传登录页背景图片建议尺寸为375px*471p</div>
</el-upload>
</div>
<el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键ID" align="center" prop="id" />
<el-table-column label="文件路径" align="center" prop="filePath" />
<el-table-column label="文件类型" align="center" prop="fileSuffix" />
<el-table-column label="类型(1-启动页 2-登录页)" align="center" prop="type" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:info:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:info:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
</el-tab-pane>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</el-tabs>
<div style="margin-left: 76%;margin-top: 2%" v-show="this.activeName != 'logoPage'">
<el-button type="primary" @click="submitForm"> </el-button>
</div>
<!-- 添加或修改登录信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="文件路径" prop="filePath">
<el-input v-model="form.filePath" placeholder="请输入文件路径" />
</el-form-item>
<el-form-item label="文件类型" prop="fileSuffix">
<el-input v-model="form.fileSuffix" placeholder="请输入文件类型" />
</el-form-item>
<el-form-item label="删除标识" prop="delFlag">
<el-input v-model="form.delFlag" placeholder="请输入删除标识" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listInfo, getInfo, delInfo, addInfo, updateInfo } from "@/api/system/firing";
import {getToken} from "@/utils/auth";
export default {
name: "Info",
data() {
@ -137,6 +81,7 @@ export default {
ids: [],
//
single: true,
activeName: 'startPage',
//
multiple: true,
//
@ -147,8 +92,30 @@ export default {
infoList: [],
//
title: "",
videoSrc: 'http://127.0.0.1:9300/statics/2023/12/16/0c49191de1ed8f91b28d9c2b12556154_20231216154804A002.mp4',
//
open: false,
//
upload: {
//
open: false,
//
title: "",
//
isUploading: false,
//
updateSupport: 0,
//
headers: { Authorization: "Bearer " + getToken() },
//
url: process.env.VUE_APP_BASE_API + "/file/upload"
},
videoForm:{
},
loginForm:{
},
//
queryParams: {
pageNum: 1,
@ -175,8 +142,23 @@ export default {
this.infoList = response.rows;
this.total = response.total;
this.loading = false;
//
this.infoList.forEach((item)=>{
if (item.type == 1) {
//
this.videoForm = item;
this.$refs["video"].load();
this.$refs["video"].play();
} else {
//
this.loginForm = item;
}
})
});
},
handleClick(tab, event) {
console.log(tab, event);
},
//
cancel() {
this.open = false;
@ -195,6 +177,59 @@ export default {
};
this.resetForm("form");
},
//
handleFileUploadProgress(event, file, fileList) {
// this.upload.isUploading = true;
console.log('上传处理中==>',JSON.stringify(event))
},
//
handleFileSuccess(response, file, fileList) {
if(response.code == '200') {
if (this.activeName == 'startPage') {
//
this.videoForm.filePath = response.data.url;
this.videoForm.fileUrl = response.data.url;
if (this.videoForm.id != null) {
//
updateInfo(this.videoForm).then(response => {
this.$modal.msgSuccess("更新成功");
this.open = false;
this.getList();
});
} else {
//
this.videoForm.type = 1;
addInfo(this.videoForm).then(response => {
this.$modal.msgSuccess("保存成功");
this.open = false;
this.getList();
});
}
} else {
//
this.loginForm.filePath = response.data.url;
this.loginForm.fileUrl = response.data.url;
if (this.loginForm.id != null) {
//
updateInfo(this.loginForm).then(response => {
this.$modal.msgSuccess("更新成功");
this.open = false;
this.getList();
});
} else {
//
this.loginForm.type = 2;
addInfo(this.loginForm).then(response => {
this.$modal.msgSuccess("保存成功");
this.open = false;
this.getList();
});
}
}
}
console.log('上传后的结果==>',JSON.stringify(response))
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;

@ -66,7 +66,7 @@
<el-upload
ref="upload"
:limit="1"
accept=".jpg, .png, .jpeg"
accept=".jpg, .png, .jpeg, .mp4"
:headers="upload.headers"
:action="upload.url"
:disabled="upload.isUploading"

Loading…
Cancel
Save