慰问申请-校工会办公室审核:PC 进入审核时自动识别并清除 [object Object] 等异常签字缓存(localStorage.getItem('signature')),重新生成签字二维码;
This commit is contained in:
@@ -18,6 +18,7 @@ import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
import org.nutz.lang.Strings;
|
||||
import org.nutz.lang.util.NutMap;
|
||||
import org.nutz.mvc.annotation.At;
|
||||
import org.nutz.mvc.annotation.Ok;
|
||||
@@ -117,6 +118,10 @@ public class CondolenceVcrCon {
|
||||
&& !Integer.valueOf(3).equals(pass)) {
|
||||
return Result.error("请选择审批意见!");
|
||||
}
|
||||
String sign = review == null ? null : review.getSign();
|
||||
if (Strings.isBlank(sign) || !sign.startsWith("data:image/") || !sign.contains(";base64,")) {
|
||||
return Result.error("签字数据异常,请重新签字!");
|
||||
}
|
||||
review.setLoginname(ShiroUtil.getPrincipalProperty("loginname").toString());
|
||||
review.setUsername(ShiroUtil.getPrincipalProperty("username").toString());
|
||||
review.setTime(DateUtil.getDate());
|
||||
|
||||
@@ -237,6 +237,9 @@ layout("/layouts/platform.html"){
|
||||
'info': httpVueLoader('/components/condolence/Info.vue?v=1.0.2'),
|
||||
},
|
||||
methods: {
|
||||
isValidSign(sign) {
|
||||
return typeof sign === 'string' && /^data:image\/(png|jpeg|jpg);base64,/i.test(sign)
|
||||
},
|
||||
dropdownCommand(command) {
|
||||
const {type, data} = command
|
||||
if (type == 'view') {
|
||||
@@ -247,12 +250,18 @@ layout("/layouts/platform.html"){
|
||||
},
|
||||
async openReview(row) {
|
||||
const {id} = row
|
||||
const cachedSign = localStorage.getItem('signature')
|
||||
if (cachedSign && !this.isValidSign(cachedSign)) {
|
||||
// 仅清理当前浏览器中的异常签字缓存,避免 [object Object] 再次提交。
|
||||
localStorage.removeItem('signature')
|
||||
}
|
||||
|
||||
this.formData = {
|
||||
id,
|
||||
username: "${@shiro.getPrincipalProperty('username')}",
|
||||
time: moment().format('YYYY-MM-DD'),
|
||||
pass: null,
|
||||
sign: '',
|
||||
}
|
||||
this.subLoading1 = false
|
||||
this.subLoading2 = false
|
||||
@@ -268,8 +277,10 @@ layout("/layouts/platform.html"){
|
||||
this.formData.pass = pass
|
||||
}
|
||||
// 签字由自定义组件回写,审核提交前单独判断,避免 Element 表单漏过空签字。
|
||||
if (!this.formData.sign) {
|
||||
this.$message.warning('请签字')
|
||||
if (!this.isValidSign(this.formData.sign)) {
|
||||
localStorage.removeItem('signature')
|
||||
this.$set(this.formData, 'sign', '')
|
||||
this.$message.warning('签字数据异常,请重新签字')
|
||||
return
|
||||
}
|
||||
this.$refs["form"].validate(async (valid) => {
|
||||
|
||||
Reference in New Issue
Block a user