From 53af5b12b59c3f19f42234ec2744668f79924148 Mon Sep 17 00:00:00 2001 From: zhanglipeng Date: Mon, 18 Jan 2021 23:06:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/components/Editor/index.vue | 74 ++++++------ ruoyi-ui/src/views/benyi/news/index.vue | 107 ++++++++++-------- .../src/views/benyi/newsapproval/index.vue | 29 +++-- ruoyi-ui/src/views/system/teacher/index.vue | 89 ++++++++++++++- .../mybatis/benyi/BySchoolNewsMapper.xml | 2 +- 5 files changed, 202 insertions(+), 99 deletions(-) diff --git a/ruoyi-ui/src/components/Editor/index.vue b/ruoyi-ui/src/components/Editor/index.vue index 91fbc7d75..7f4012397 100644 --- a/ruoyi-ui/src/components/Editor/index.vue +++ b/ruoyi-ui/src/components/Editor/index.vue @@ -10,12 +10,12 @@ :on-success="quillImgSuccess" :on-error="uploadError" :before-upload="quillImgBefore" - accept='.jpg,.jpeg,.png,.gif' + accept=".jpg,.jpeg,.png,.gif" > + \ No newline at end of file + diff --git a/ruoyi-ui/src/views/benyi/news/index.vue b/ruoyi-ui/src/views/benyi/news/index.vue index a5a4aeb32..66fd152b7 100644 --- a/ruoyi-ui/src/views/benyi/news/index.vue +++ b/ruoyi-ui/src/views/benyi/news/index.vue @@ -4,9 +4,9 @@ :model="queryParams" ref="queryForm" :inline="true" - label-width="68px" + label-width="70px" > - + + + + 删除 - + - - + + - + + - + - - + + - + @@ -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 () {}); + // }, }, }; diff --git a/ruoyi-ui/src/views/benyi/newsapproval/index.vue b/ruoyi-ui/src/views/benyi/newsapproval/index.vue index d2bf3810a..0576db0c7 100644 --- a/ruoyi-ui/src/views/benyi/newsapproval/index.vue +++ b/ruoyi-ui/src/views/benyi/newsapproval/index.vue @@ -6,7 +6,7 @@ :inline="true" label-width="68px" > - + + + + - - + + -
-
+
--> - + @@ -383,7 +390,7 @@ export default { this.single = selection.length != 1; this.multiple = !selection.length; }, - + /** 修改按钮操作 */ handleUpdate(row) { this.reset(); @@ -406,11 +413,11 @@ export default { this.getList(); } }); - } + } } }); }, - + /** 导出按钮操作 */ handleExport() { const queryParams = this.queryParams; diff --git a/ruoyi-ui/src/views/system/teacher/index.vue b/ruoyi-ui/src/views/system/teacher/index.vue index 9a503bf40..ec9f728ff 100644 --- a/ruoyi-ui/src/views/system/teacher/index.vue +++ b/ruoyi-ui/src/views/system/teacher/index.vue @@ -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" }, ], }, }; diff --git a/ruoyi/src/main/resources/mybatis/benyi/BySchoolNewsMapper.xml b/ruoyi/src/main/resources/mybatis/benyi/BySchoolNewsMapper.xml index 52d9e99df..59cf2ee32 100644 --- a/ruoyi/src/main/resources/mybatis/benyi/BySchoolNewsMapper.xml +++ b/ruoyi/src/main/resources/mybatis/benyi/BySchoolNewsMapper.xml @@ -29,7 +29,7 @@ d.isdel = 'N' - and d.title = #{title} + and d.title like concat('%', #{title}, '%') and d.imgurl = #{imgurl} and d.abstractcontent = #{abstractcontent} and d.type = #{type}