From 7e7f901b2172281dc294dfbc67e6ad00625f09f4 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期一, 04 三月 2024 10:11:21 +0800 Subject: [PATCH] 合并代码 --- cloud-server-management/src/main/webapp/static/modular/system/tQuestion/TQuestion.js | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cloud-server-management/src/main/webapp/static/modular/system/tQuestion/TQuestion.js b/cloud-server-management/src/main/webapp/static/modular/system/tQuestion/TQuestion.js index 19bf113..0a6bd57 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/tQuestion/TQuestion.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/tQuestion/TQuestion.js @@ -14,7 +14,7 @@ TQuestion.initColumn = function () { return [ {field: 'selectItem', checkbox: true}, - {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'}, + {title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'}, {title: '问题标题', field: 'content', visible: true, align: 'center', valign: 'middle'}, {title: '添加时间', field: 'insertTime', visible: true, align: 'center', valign: 'middle', formatter: function (value, row, index) { @@ -121,7 +121,7 @@ data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 success: function(response) { Feng.success("上架成功!"); - window.parent.TQuestion.table.refresh(); + TQuestion.table.refresh(); }, error: function(xhr, status, error) { var errorMessage = xhr.responseText ? xhr.responseText : "上架失败!"; @@ -155,7 +155,8 @@ data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 success: function(response) { Feng.success("下架成功!"); - window.parent.TQuestion.table.refresh(); + TQuestion.table.refresh(); + }, error: function(xhr, status, error) { var errorMessage = xhr.responseText ? xhr.responseText : "下架失败!"; @@ -212,7 +213,7 @@ data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 success: function(response) { Feng.success("删除成功!"); - window.parent.TQuestion.table.refresh(); + TQuestion.table.refresh(); }, error: function(xhr, status, error) { var errorMessage = xhr.responseText ? xhr.responseText : "删除失败!"; @@ -260,6 +261,7 @@ }; $(function () { + const data1 = { id:null, phone:null, @@ -313,13 +315,15 @@ var addButton = document.getElementById('addButton'); addButton.addEventListener('click', function () { var phoneRegex = /^1[0-9]{10}$/; + var landlineRegex = /^\d{4}-\d{7}$/; + var inputField = document.getElementById('addPhone'); var dataContainer = document.getElementById('phone'); var inputData = inputField.value.trim(); if (TQuestion.dataCount>=2){ Feng.info("最多添加两个客服电话!"); // todo 添加正则表达式验证电话号码合法性 - }else if(!phoneRegex.test(inputData)){ + }else if(!phoneRegex.test(inputData)&&!landlineRegex.test(inputData)){ Feng.info("客服电话不合法,请重新输入!"); }else { if (inputData !== '' || document.querySelectorAll('.data-item').length !==0) { @@ -361,6 +365,7 @@ data: JSON.stringify(data1), // 将数据转换为 JSON 字符串 success: function(response) { Feng.success("添加成功!"); + TQuestion.table.refresh(); // window.parent.TQuestion.table.refresh(); TQuestion.phone = ""; }, -- Gitblit v1.7.1