Commit 7fd8f3a1 by H.wb.wang.peixun

页面修改

parent 837b90ca
<template>
<div class="upload-file">
<el-upload class="upload-demo" drag :action="uploadFileUrl" :before-upload="handleBeforeUpload" :file-list="fileList"
:limit="limit" :on-error="handleUploadError" :on-exceed="handleExceed" :on-success="handleUploadSuccess"
:show-file-list="false" :headers="headers" ref="fileUpload">
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
<!-- <div class="el-upload__tip" slot="tip">只能上传jpg/png文件,且不超过500kb</div> -->
</el-upload>
<!-- 文件列表 -->
<transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
<li :key="file.url" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
<el-link :href="`${file.url}`" :underline="false" target="_blank">
<span class="el-icon-document"> {{ getFileName(file.name) }} </span>
</el-link>
<div class="ele-upload-list__item-content-action">
<el-link :underline="false" @click="handleDelete(index)" type="danger">删除</el-link>
</div>
</li>
</transition-group>
</div>
</template>
<script>
import { getToken } from "@/utils/auth";
import { listByIds, delOss } from "@/api/system/oss";
export default {
name: "FileUpload",
props: {
// 值
value: [String, Object, Array],
// 数量限制
limit: {
type: Number,
default: 5,
},
// 大小限制(MB)
fileSize: {
type: Number,
default: 5,
},
// 文件类型, 例如['png', 'jpg', 'jpeg']
fileType: {
type: Array,
default: () => ["doc", "xls", "ppt", "txt", "pdf", "xlsx"],
},
// 是否显示提示
isShowTip: {
type: Boolean,
default: true
}
},
data() {
return {
number: 0,
uploadList: [],
baseUrl: process.env.VUE_APP_BASE_API,
uploadFileUrl: process.env.VUE_APP_BASE_API + "/system/oss/upload", // 上传文件服务器地址
headers: {
Authorization: "Bearer " + getToken(),
},
fileList: [],
};
},
watch: {
value: {
async handler(val) {
if (val) {
let temp = 1;
// 首先将值转为数组
let list;
if (Array.isArray(val)) {
list = val;
} else {
await listByIds(val).then(res => {
list = res.data.map(oss => {
oss = { name: oss.originalName, url: oss.url, ossId: oss.ossId };
return oss;
});
})
}
// 然后将数组转为对象数组
this.fileList = list.map(item => {
item = { name: item.name, url: item.url, ossId: item.ossId };
item.uid = item.uid || new Date().getTime() + temp++;
return item;
});
} else {
this.fileList = [];
return [];
}
},
deep: true,
immediate: true
}
},
computed: {
// 是否显示提示
showTip() {
return this.isShowTip && (this.fileType || this.fileSize);
},
},
methods: {
// 上传前校检格式和大小
handleBeforeUpload(file) {
// 校检文件类型
if (this.fileType) {
const fileName = file.name.split('.');
const fileExt = fileName[fileName.length - 1];
const isTypeOk = this.fileType.indexOf(fileExt) >= 0;
if (!isTypeOk) {
this.$modal.msgError(`文件格式不正确, 请上传${this.fileType.join("/")}格式文件!`);
return false;
}
}
// 校检文件大小
if (this.fileSize) {
const isLt = file.size / 1024 / 1024 < this.fileSize;
if (!isLt) {
this.$modal.msgError(`上传文件大小不能超过 ${this.fileSize} MB!`);
return false;
}
}
this.$modal.loading("正在上传文件,请稍候...");
this.number++;
return true;
},
// 文件个数超出
handleExceed() {
this.$modal.msgError(`上传文件数量不能超过 ${this.limit} 个!`);
},
// 上传失败
handleUploadError(err) {
this.$modal.msgError("上传文件失败,请重试");
this.$modal.closeLoading();
},
// 上传成功回调
handleUploadSuccess(res, file) {
if (res.code === 200) {
this.uploadList.push({ name: res.data.fileName, url: res.data.url, ossId: res.data.ossId });
this.uploadedSuccessfully();
} else {
this.number--;
this.$modal.closeLoading();
this.$modal.msgError(res.msg);
this.$refs.fileUpload.handleRemove(file);
this.uploadedSuccessfully();
}
},
// 删除文件
handleDelete(index) {
let ossId = this.fileList[index].ossId;
delOss(ossId);
this.fileList.splice(index, 1);
this.$emit("input", this.listToString(this.fileList));
},
// 上传结束处理
uploadedSuccessfully() {
if (this.number > 0 && this.uploadList.length === this.number) {
this.fileList = this.fileList.concat(this.uploadList);
this.uploadList = [];
this.number = 0;
this.$emit("input", this.listToString(this.fileList));
this.$modal.closeLoading();
}
},
// 获取文件名称
getFileName(name) {
// 如果是url那么取最后的名字 如果不是直接返回
if (name.lastIndexOf("/") > -1) {
return name.slice(name.lastIndexOf("/") + 1);
} else {
return name;
}
},
// 对象转成指定字符串分隔
listToString(list, separator) {
let strs = "";
separator = separator || ",";
for (let i in list) {
strs += list[i].ossId + separator;
}
return strs != "" ? strs.substr(0, strs.length - 1) : "";
},
},
};
</script>
<style scoped lang="scss">
.upload-file-uploader {
margin-bottom: 5px;
}
.upload-file-list .el-upload-list__item {
border: 1px solid #e4e7ed;
line-height: 2;
margin-bottom: 10px;
position: relative;
}
.upload-file-list .ele-upload-list__item-content {
display: flex;
justify-content: space-between;
align-items: center;
color: inherit;
}
// .ele-upload-list__item-content-action .el-link {
// margin-right: 10px;
// }
</style>
......@@ -27,6 +27,8 @@ import RightToolbar from "@/components/RightToolbar"
import Editor from "@/components/Editor"
// 文件上传组件
import FileUpload from "@/components/FileUpload"
// 文件拖拽上传组件
import DragUpload from "@/components/DragUpload"
// 图片上传组件
import ImageUpload from "@/components/ImageUpload"
// 图片预览组件
......@@ -56,6 +58,7 @@ Vue.component('Pagination', Pagination)
Vue.component('RightToolbar', RightToolbar)
Vue.component('Editor', Editor)
Vue.component('FileUpload', FileUpload)
Vue.component('DragUpload', DragUpload)
Vue.component('ImageUpload', ImageUpload)
Vue.component('ImagePreview', ImagePreview)
......
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!-- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="父级id" prop="parentId">
<el-input
v-model="queryParams.parentId"
......@@ -21,7 +21,7 @@
<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-form> -->
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
......@@ -32,9 +32,9 @@
size="mini"
@click="handleAdd"
v-hasPermi="['school-paper:dict:add']"
>新增</el-button>
>新增类别</el-button>
</el-col>
<el-col :span="1.5">
<!-- <el-col :span="1.5">
<el-button
type="success"
plain
......@@ -65,18 +65,18 @@
@click="handleExport"
v-hasPermi="['school-paper:dict:export']"
>导出</el-button>
</el-col>
</el-col> -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dictList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键id" align="center" prop="id" v-if="true"/>
<el-table-column label="父级id" align="center" prop="parentId" />
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<el-table-column label="类别名称" prop="name" />
<!-- <el-table-column label="父级id" align="center" prop="parentId" />
<el-table-column label="类型:1 类别,2 阶段,3 班级" align="center" prop="type" />
<el-table-column label="名称" align="center" prop="typeValue" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="状态:0正常,1删除" align="center" prop="typeStatus" />
<el-table-column label="状态:0正常,1删除" align="center" prop="typeStatus" /> -->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
......@@ -85,7 +85,7 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['school-paper:dict:edit']"
>修改</el-button>
>编辑</el-button>
<el-button
size="mini"
type="text"
......@@ -107,7 +107,7 @@
<!-- 添加或修改字典对话框 -->
<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 ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="父级id" prop="parentId">
<el-input v-model="form.parentId" placeholder="请输入父级id" />
</el-form-item>
......@@ -117,17 +117,19 @@
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
</el-form> -->
<el-input v-model="form.remark" placeholder="请输入类别名称" />
<div slot="footer" class="dialog-footer" style="text-align: center;">
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
<!-- <el-button @click="cancel">取 消</el-button> -->
</div>
</el-dialog>
</div>
</template>
<script>
import { listDict, getDict, delDict, addDict, updateDict } from "@/api/school-paper/dict";
// import { listDict, getDict, delDict, addDict, updateDict } from "@/api/school-paper/dict";
export default {
name: "Dict",
......@@ -136,7 +138,7 @@ export default {
// 按钮loading
buttonLoading: false,
// 遮罩层
loading: true,
loading: false,
// 选中数组
ids: [],
// 非单个禁用
......@@ -148,7 +150,9 @@ export default {
// 总条数
total: 0,
// 字典表格数据
dictList: [],
dictList: [{
name:'1'
}],
// 弹出层标题
title: "",
// 是否显示弹出层
......@@ -188,7 +192,7 @@ export default {
};
},
created() {
this.getList();
// this.getList();
},
methods: {
/** 查询字典列表 */
......@@ -241,7 +245,7 @@ export default {
handleAdd() {
this.reset();
this.open = true;
this.title = "添加字典";
this.title = "请输入类别名称";
},
/** 修改按钮操作 */
handleUpdate(row) {
......
<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="profileName">
<el-form-item label="资料管理" prop="profileName">
<el-input
v-model="queryParams.profileName"
placeholder="请输入资料名称"
placeholder="请输入资料名称搜索"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="资料地址" prop="profileUrl">
<!-- <el-form-item label="资料地址" prop="profileUrl">
<el-input
v-model="queryParams.profileUrl"
placeholder="请输入资料地址"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
</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>
......@@ -32,9 +32,9 @@
size="mini"
@click="handleAdd"
v-hasPermi="['school-paper:profile:add']"
>新增</el-button>
>上传</el-button>
</el-col>
<el-col :span="1.5">
<!-- <el-col :span="1.5">
<el-button
type="success"
plain
......@@ -65,17 +65,17 @@
@click="handleExport"
v-hasPermi="['school-paper:profile:export']"
>导出</el-button>
</el-col>
</el-col> -->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="profileList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键id" align="center" prop="id" v-if="true"/>
<el-table-column label="资料名称" align="center" prop="profileName" />
<el-table-column label="资料地址" align="center" prop="profileUrl" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="状态:0正常,1删除" align="center" prop="status" />
<!-- <el-table-column type="selection" width="55" align="center" /> -->
<!-- <el-table-column label="主键id" align="center" prop="id" v-if="true"/> -->
<el-table-column label="资料名称" prop="profileName" />
<el-table-column label="上传者" prop="profileUrl" />
<!-- <el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="状态:0正常,1删除" align="center" prop="status" /> -->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
......@@ -84,7 +84,7 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['school-paper:profile:edit']"
>修改</el-button>
>下载</el-button>
<el-button
size="mini"
type="text"
......@@ -110,16 +110,13 @@
<el-form-item label="资料名称" prop="profileName">
<el-input v-model="form.profileName" placeholder="请输入资料名称" />
</el-form-item>
<el-form-item label="资料地址" prop="profileUrl">
<el-input v-model="form.profileUrl" placeholder="请输入资料地址" />
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" placeholder="请输入备注" />
<el-form-item label="上传文件" prop="profileUrl">
<DragUpload v-model="form.file" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
<div slot="footer" class="dialog-footer" style="text-align: center;">
<el-button @click="cancel">取 消</el-button>
<el-button :loading="buttonLoading" type="primary" @click="submitForm">上 传</el-button>
</div>
</el-dialog>
</div>
......
<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="用户id" prop="userId">
<el-form-item label="审批阅卷" prop="userId">
<el-input
v-model="queryParams.userId"
placeholder="请输入用户id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="试卷id" prop="testPaperId">
<el-input
v-model="queryParams.testPaperId"
placeholder="请输入试卷id"
placeholder="请输入试卷名称搜索"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="总得分" prop="totalPoints">
<el-input
v-model="queryParams.totalPoints"
placeholder="请输入总得分"
clearable
@keyup.enter.native="handleQuery"
/>
<el-form-item label="阶段" prop="testPaperId">
<el-select v-model="value" placeholder="请选择阶段">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
......@@ -31,7 +25,7 @@
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
......@@ -75,32 +69,41 @@
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
</el-row> -->
<el-table v-loading="loading" :data="testPaperRecordList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键id" align="center" prop="id" v-if="true"/>
<el-table-column label="用户id" align="center" prop="userId" />
<el-table-column label="试卷id" align="center" prop="testPaperId" />
<el-table-column label="状态:0 批卷中,1 批卷完成" align="center" prop="status" />
<el-table-column label="总得分" align="center" prop="totalPoints" />
<el-table-column label="备注" align="center" prop="remark" />
<el-table v-if="typePaper == 1" v-loading="loading" :data="testPaperRecordList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键id" align="center" prop="id" v-if="true"/> -->
<el-table-column label="试卷名称" align="center" prop="userId" />
<el-table-column label="满分" align="center" prop="testPaperId" />
<el-table-column label="阶段" align="center" prop="status" />
<!-- <el-table-column label="总得分" align="center" prop="totalPoints" />
<el-table-column label="备注" align="center" prop="remark" /> -->
<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="['school-paper:testPaperRecord:edit']"
>修改</el-button>
<el-button
<el-button type="primary" size="medium" @click="examination(1)">批卷</el-button>
<!-- <el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['school-paper:testPaperRecord:remove']"
>删除</el-button>
>删除</el-button> -->
</template>
</el-table-column>
</el-table>
<el-table v-if="typePaper == 2" v-loading="loading" :data="testPaperRecordList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键id" align="center" prop="id" v-if="true"/> -->
<el-table-column label="同学名称" align="center" prop="userId" />
<el-table-column label="班级" align="center" prop="testPaperId" />
<el-table-column label="得分" align="center" prop="status" />
<!-- <el-table-column label="总得分" align="center" prop="totalPoints" />
<el-table-column label="备注" align="center" prop="remark" /> -->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="primary" size="medium" @click="examination(2)">批卷</el-button>
</template>
</el-table-column>
</el-table>
......@@ -117,7 +120,8 @@
<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="用户id" prop="userId">
<el-input v-model="form.userId" placeholder="请输入用户id" />
<editor v-model="form.optionContent" :min-height="192"/>
</el-form-item>
<el-form-item label="试卷id" prop="testPaperId">
<el-input v-model="form.testPaperId" placeholder="请输入试卷id" />
......@@ -144,6 +148,24 @@ export default {
name: "TestPaperRecord",
data() {
return {
value:'',
typePaper:1,
options: [{
value: '选项1',
label: '黄金糕'
}, {
value: '选项2',
label: '双皮奶'
}, {
value: '选项3',
label: '蚵仔煎'
}, {
value: '选项4',
label: '龙须面'
}, {
value: '选项5',
label: '北京烤鸭'
}],
// 按钮loading
buttonLoading: false,
// 遮罩层
......@@ -202,6 +224,16 @@ export default {
this.getList();
},
methods: {
// 批卷
examination(val){
if(val == 1){
this.typePaper = 2
}else if(val == 2){
this.reset();
this.open = true;
this.title = "添加答题记录";
}
},
/** 查询答题记录列表 */
getList() {
this.loading = true;
......
......@@ -35,8 +35,8 @@ module.exports = {
proxy: {
// detail: https://cli.vuejs.org/config/#devserver-proxy
[process.env.VUE_APP_BASE_API]: {
/* target: `https://farming.nyinhong.com/api`,*/
target: `http://127.0.0.1:8111`,
target: `https://farming.nyinhong.com/api`,
// target: `http://127.0.0.1:8111`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment