This commit is contained in:
zhanglipeng 2021-01-18 23:06:52 +08:00
parent 14227961db
commit 53af5b12b5
5 changed files with 202 additions and 99 deletions

View File

@ -10,12 +10,12 @@
:on-success="quillImgSuccess"
:on-error="uploadError"
:before-upload="quillImgBefore"
accept='.jpg,.jpeg,.png,.gif'
accept=".jpg,.jpeg,.png,.gif"
></el-upload>
<!-- 富文本组件 -->
<quill-editor
class="editor"
class="ql-editor"
v-model="content"
ref="quillEditor"
:options="editorOption"
@ -27,7 +27,7 @@
</template>
<script>
import { getToken } from '@/utils/auth'
import { getToken } from "@/utils/auth";
//
const toolbarOptions = [
@ -40,7 +40,7 @@ const toolbarOptions = [
[{ color: [] }, { background: [] }], //
[{ align: [] }], //
["clean"], //
["link", "image", "video"] //
["link", "image", "video"], //
];
import { quillEditor } from "vue-quill-editor";
@ -52,13 +52,13 @@ export default {
props: {
/* 编辑器的内容 */
value: {
type: String
type: String,
},
/* 图片大小 */
maxSize: {
type: Number,
default: 4000 //kb
}
default: 4000, //kb
},
},
components: { quillEditor },
data() {
@ -73,28 +73,28 @@ export default {
toolbar: {
container: toolbarOptions,
handlers: {
image: function(value) {
image: function (value) {
if (value) {
// input
document.querySelector(".quill-img input").click();
} else {
this.quill.format("image", false);
}
}
}
}
}
},
},
},
},
},
uploadImgUrl: process.env.VUE_APP_BASE_API + "/common/upload", //
headers: {
Authorization: 'Bearer ' + getToken()
}
Authorization: "Bearer " + getToken(),
},
};
},
watch: {
value: function() {
value: function () {
this.content = this.value;
}
},
},
methods: {
onEditorBlur() {
@ -111,10 +111,10 @@ export default {
//
quillImgBefore(file) {
let fileType = file.type;
if(fileType === 'image/jpeg' || fileType === 'image/png'){
if (fileType === "image/jpeg" || fileType === "image/png") {
return true;
}else {
this.$message.error('请插入图片类型文件(jpg/jpeg/png)');
} else {
this.$message.error("请插入图片类型文件(jpg/jpeg/png)");
return false;
}
},
@ -139,16 +139,16 @@ export default {
uploadError() {
// loading
this.$message.error("图片插入失败");
}
}
},
},
};
</script>
<style>
.editor {
/* .editor {
line-height: normal !important;
height: 192px;
}
} */
.quill-img {
display: none;
}

View File

@ -4,9 +4,9 @@
:model="queryParams"
ref="queryForm"
:inline="true"
label-width="68px"
label-width="70px"
>
<el-form-item label="类型" prop="type">
<el-form-item label="新闻类型" prop="type">
<el-select
v-model="queryParams.type"
placeholder="请选择类型"
@ -21,6 +21,13 @@
/>
</el-select>
</el-form-item>
<el-form-item label="新闻标题" prop="title">
<el-input
v-model="queryParams.title"
type="text"
placeholder="请输入新闻标题"
/>
</el-form-item>
<el-form-item>
<el-button
type="primary"
@ -68,7 +75,7 @@
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<!-- <el-col :span="1.5">
<el-button
type="warning"
icon="el-icon-download"
@ -77,7 +84,7 @@
v-hasPermi="['benyi:news:export']"
>导出</el-button
>
</el-col>
</el-col> -->
</el-row>
<el-table
@ -86,20 +93,30 @@
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="标题" align="center" prop="title" />
<!-- <el-table-column label="编号" align="center" prop="id" /> -->
<el-table-column label="新闻标题" align="center" prop="title" />
<el-table-column
label="类型"
label="新闻类型"
align="center"
prop="type"
:formatter="typeFormat"
/>
<el-table-column label="内容" align="center" prop="content" :show-overflow-tooltip="true">
<!-- <el-table-column
label="内容"
align="center"
prop="content"
:show-overflow-tooltip="true"
>
<template slot-scope="scope">
<div v-html="scope.row.content"></div>
<div class="ql-editor" v-html="scope.row.content"></div>
</template>
</el-table-column>
<el-table-column label="所属学校" align="center" prop="deptId" :formatter="deptFormat" />
</el-table-column> -->
<el-table-column
label="所属学校"
align="center"
prop="deptId"
:formatter="deptFormat"
/>
<el-table-column
label="是否审核"
align="center"
@ -152,14 +169,15 @@
/>
<!-- 添加或修改新闻中心对话框 -->
<el-dialog :title="title" :visible.sync="open" width="1024px" append-to-body>
<el-dialog
:title="title"
:visible.sync="open"
width="1024px"
append-to-body
>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="标题" prop="title">
<el-input
v-model="form.title"
type="textarea"
placeholder="请输入内容"
/>
<el-form-item label="新闻标题" prop="title">
<el-input v-model="form.title" type="text" placeholder="请输入新闻标题" />
</el-form-item>
<!-- <el-form-item label="类型">
<el-select v-model="form.type" placeholder="请选择类型">
@ -171,7 +189,7 @@
></el-option>
</el-select>
</el-form-item> -->
<el-form-item label="内容" prop="content">
<el-form-item label="内容" class="ql-snow" prop="content">
<Editor v-model="form.content" placeholder="请输入内容" />
</el-form-item>
</el-form>
@ -194,17 +212,16 @@ import {
} from "@/api/benyi/news";
import Editor from "@/components/Editor";
import { listDept, getDept, } from "@/api/system/dept";
import { listUser, getUser, } from "@/api/system/user";
import { listDept, getDept } from "@/api/system/dept";
import { listUser, getUser } from "@/api/system/user";
export default {
name: "News",
components: {
Editor
Editor,
},
data() {
return {
//
loading: true,
//
@ -254,19 +271,15 @@ export default {
form: {},
//
rules: {
title: [
{ required: true, message: "标题不能为空", trigger: "blur" },
],
content: [
{ required: true, message: "内容不能为空", trigger: "blur" },
],
title: [{ required: true, message: "标题不能为空", trigger: "blur" }],
content: [{ required: true, message: "内容不能为空", trigger: "blur" }],
},
};
},
created() {
this.getList();
this.getDeptList();
this.getUserList()
this.getUserList();
this.getDicts("sys_dm_newstype").then((response) => {
this.typeOptions = response.data;
});
@ -435,7 +448,7 @@ export default {
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm(
'是否确认删除新闻中心编号为"' + ids + '"的数据项?',
'是否确认删除选中的新闻中心数据项?',
"警告",
{
confirmButtonText: "确定",
@ -452,22 +465,22 @@ export default {
})
.catch(function () {});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm("是否确认导出所有新闻中心数据项?", "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(function () {
return exportNews(queryParams);
})
.then((response) => {
this.download(response.msg);
})
.catch(function () {});
},
// /** */
// handleExport() {
// const queryParams = this.queryParams;
// this.$confirm("?", "", {
// confirmButtonText: "",
// cancelButtonText: "",
// type: "warning",
// })
// .then(function () {
// return exportNews(queryParams);
// })
// .then((response) => {
// this.download(response.msg);
// })
// .catch(function () {});
// },
},
};
</script>

View File

@ -6,7 +6,7 @@
:inline="true"
label-width="68px"
>
<el-form-item label="类型" prop="type">
<el-form-item label="新闻类型" prop="type">
<el-select
v-model="queryParams.type"
placeholder="请选择类型"
@ -20,6 +20,13 @@
:value="dict.dictValue"
/>
</el-select>
</el-form-item>
<el-form-item label="新闻标题" prop="title">
<el-input
v-model="queryParams.title"
type="text"
placeholder="请输入新闻标题"
/>
</el-form-item>
<el-form-item label="是否审核" prop="ischeck">
<el-select
@ -69,15 +76,15 @@
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="编号" align="center" prop="id" />
<el-table-column label="标题" align="center" prop="title" />
<!-- <el-table-column label="编号" align="center" prop="id" /> -->
<el-table-column label="新闻标题" align="center" prop="title" />
<el-table-column
label="类型"
label="新闻类型"
align="center"
prop="type"
:formatter="typeFormat"
/>
<el-table-column
<!-- <el-table-column
label="内容"
align="center"
prop="content"
@ -86,7 +93,7 @@
<template slot-scope="scope">
<div v-html="scope.row.content"></div>
</template>
</el-table-column>
</el-table-column> -->
<el-table-column
label="所属学校"
align="center"
@ -152,10 +159,10 @@
append-to-body
>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
<el-form-item label="标题" prop="title">
<el-form-item label="新闻标题" prop="title">
<el-input
v-model="form.title"
type="textarea"
type="text"
placeholder="请输入内容"
/>
</el-form-item>

View File

@ -280,6 +280,89 @@ import {
export default {
name: "Teacher",
data() {
const idCardValidity = (rule, code, callback) => {
var city = {
11: "北京",
12: "天津",
13: "河北",
14: "山西",
15: "内蒙古",
21: "辽宁",
22: "吉林",
23: "黑龙江 ",
31: "上海",
32: "江苏",
33: "浙江",
34: "安徽",
35: "福建",
36: "江西",
37: "山东",
41: "河南",
42: "湖北 ",
43: "湖南",
44: "广东",
45: "广西",
46: "海南",
50: "重庆",
51: "四川",
52: "贵州",
53: "云南",
54: "西藏 ",
61: "陕西",
62: "甘肃",
63: "青海",
64: "宁夏",
65: "新疆",
71: "台湾",
81: "香港",
82: "澳门",
91: "国外 ",
};
var tip = "";
var pass = true;
if (
!code ||
!/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(
code
)
) {
tip = "身份证号格式错误";
pass = false;
} else if (!city[code.substr(0, 2)]) {
// tip = ""
tip = "身份证输入错误";
pass = false;
} else {
// 18
if (code.length === 18) {
code = code.split("");
// (ai×Wi)(mod 11)
//
var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
//
var parity = [1, 0, "X", 9, 8, 7, 6, 5, 4, 3, 2];
var sum = 0;
var ai = 0;
var wi = 0;
for (var i = 0; i < 17; i++) {
ai = code[i];
wi = factor[i];
sum += ai * wi;
}
var last = parity[sum % 11];
if (parity[sum % 11] != code[17]) {
// tip = ""
tip = "身份证输入错误";
pass = false;
}
}
}
if (!pass) {
callback(new Error(tip));
} else {
callback();
}
};
return {
//
loading: true,
@ -336,12 +419,12 @@ export default {
//
rules: {
zjhm: [
{ required: true, message: '请输入身份证号', trigger: 'blur' },
{
required: false,
pattern: /^\d{18}$/,
pattern: /(^\d{8}(0\d|10|11|12)([0-2]\d|30|31)\d{3}$)|(^\d{6}(18|19|20)\d{2}(0\d|10|11|12)([0-2]\d|30|31)\d{3}(\d|X|x)$)/,
message: "请输入正确的身份证号",
trigger: "blur",
},
{ validator: idCardValidity, trigger: "blur" },
],
},
};

View File

@ -29,7 +29,7 @@
<include refid="selectBySchoolNewsVo"/>
<where>
d.isdel = 'N'
<if test="title != null and title != ''">and d.title = #{title}</if>
<if test="title != null and title != ''">and d.title like concat('%', #{title}, '%')</if>
<if test="imgurl != null and imgurl != ''">and d.imgurl = #{imgurl}</if>
<if test="abstractcontent != null and abstractcontent != ''">and d.abstractcontent = #{abstractcontent}</if>
<if test="type != null and type != ''">and d.type = #{type}</if>