Browse Source

fix; 问题单修改

master
chenglb 1 year ago
parent
commit
c882b3d436
  1. 7
      src/components/layout/SideBar/index.scss
  2. 28
      src/pages/Nav/index.scss
  3. 218
      src/pages/OperationCenter/AppMgm/WechatMenuMgm/loadable.jsx
  4. 16
      src/pages/SystemMgm/BusinessConfig/HotCbdConf/loadable.jsx
  5. 2
      src/router/index.jsx

7
src/components/layout/SideBar/index.scss

@ -12,6 +12,7 @@
}
}
}
.ant-menu-submenu .ant-menu-submenu .ant-menu-submenu-title{
padding-left: 20px !important;
}
@ -22,6 +23,12 @@
.ant-menu-submenu .ant-menu-sub .ant-menu-submenu::before{
display: none !important;
}
.menu-container>.ant-menu>.ant-menu-submenu>.ant-menu-submenu-title{
padding-left: 10px !important;
.ant-menu-title-content{
margin-left: 5px;
}
}
}
.ant-menu-submenu-popup .ant-menu-sub .ant-menu-submenu .ant-menu-title-content{

28
src/pages/Nav/index.scss

@ -30,9 +30,9 @@
background: url("@/assets/images/nav/nav_item.png");
background-size: 100% 100%;
background-position: center;
width: px2vw(246);
height: px2vh(680);
padding-top: px2vh(130);
width: 246px;
height: 680px;
padding-top: 130px;
position: relative;
&:hover{
@ -52,7 +52,7 @@
content: '';
display: block;
background-color: #3AA9FF;
width: px2vw(246);
width: 246px;
height: px2vh(4);
border-radius: px2vh(2);
position: absolute;
@ -60,43 +60,43 @@
}
}
.out-wrapper{
height: px2vh(180);
width: px2vw(180);
height: 180px;
width: 180px;
margin: auto;
}
.icon-wrapper{
margin: auto ;
font-size: 16px;
width: px2vw(120);
height: px2vw(120);
width: 120px;
height: 120px;
display: flex;
align-items: center;
justify-content: center;
// background-color: rgba(12, 43, 67, 0.6);
// border: 1px solid #3AA9FF;
.icon-pda{
width: px2vw(40) !important;
height: px2vh(40) !important;
width: 40px !important;
height: 40px !important;
}
}
.line{
height: 2px;
width: px2vw(120);
width: 120px;
margin: auto ;
// background-color: red;
border-bottom: 2px solid #3E536C;
}
.zh-name{
text-align: center;
margin-top: px2vh(60);
font-size: px2vw(18);
margin-top: 60px;
font-size: 18px;
font-weight: 700;
}
.en-name{
text-align: center;
font-weight: 400;
opacity: 0.4;
font-size: px2vw(12);
font-size: 12px;
}
}
.icon_pda{

218
src/pages/OperationCenter/AppMgm/WechatMenuMgm/loadable.jsx

@ -23,6 +23,15 @@ function WechatMenuMgm() {
if(res.status == 20000){
// console.log(res.data)
setConfigArray(res.data)
if(res.data.length){
let temp = res.data[0]
setRightData({
name: temp.name,
type: temp.type,
url: temp.url
})
setActiveMenuIndex(0)
}
}else{
}
@ -30,17 +39,7 @@ function WechatMenuMgm() {
.catch(err=>{
console.log(err)
})
}
const choseOneMenu = (index, idx)=>{
setActiveMenuIndex(index)
setActiveSubmenuIndex(idx)
let temp = configArray[index].children[idx]
setRightData(temp)
setIsEdit(true)
}
}
const deleteMenu = ()=>{
if(configArray[activeMenuIndex].children){
@ -67,9 +66,23 @@ function WechatMenuMgm() {
temp.splice(activeMenuIndex, 1)
setConfigArray(temp)
}
setActiveMenuIndex(-1)
// setActiveMenuIndex(-1)
setActiveSubmenuIndex(-1)
message.success('一级菜单删除成功')
if(temp.length > 0){
setActiveMenuIndex(0)
setRightData({
name: temp[0].name,
type: temp[0].type,
url: temp[0].url,
})
}else{
setActiveMenuIndex(-1)
setActiveSubmenuIndex(-1)
setRightData({
name: '', type: '', url:''
})
}
}
const deleteSubMenu = ()=>{
@ -78,11 +91,16 @@ function WechatMenuMgm() {
temp_children.splice(activeSubmenuIndex, 1)
temp[activeMenuIndex].children = temp_children
setConfigArray(temp)
setActiveMenuIndex(-1)
// setActiveMenuIndex(-1)
setActiveSubmenuIndex(-1)
message.success('子菜单删除成功')
setRightData({
name: temp[activeMenuIndex].name,
type: temp[activeMenuIndex].type,
url: temp[activeMenuIndex].url,
})
}
//
const clickMenu = (index)=>{
setActiveMenuIndex(index)
setActiveSubmenuIndex(-1)
@ -91,11 +109,29 @@ function WechatMenuMgm() {
type: configArray[index].type,
url: configArray[index].url
})
setIsEdit(true)
}
//
const choseOneMenu = (index, idx)=>{
setActiveMenuIndex(index)
setActiveSubmenuIndex(idx)
let temp = configArray[index].children[idx]
setRightData(temp)
}
//
const addOneMenu = (index)=>{
if(activeSubmenuIndex > -1){
if(!/^[\u4e00-\u9fa5]{1,4}$/.test(rightData.name) && !/^[a-zA-Z]{1,8}$/.test(rightData.name) ){
message.error('名称不符合规范, 请重新输入')
return
}
if(!rightData.url){
message.error('子菜单网络地址不能为空')
return
}
}
let temp = [...configArray]
temp[index].type = ''
temp[index].url = ''
if(temp[index].children){
let tempchildren = [...temp[index].children]
tempchildren.push({name: '子菜单' , type: 1, url: ""})
@ -103,35 +139,43 @@ function WechatMenuMgm() {
}else{
temp[index].children = [{name: '子菜单', type: 1, url: ""}]
}
setRightData({name: '子菜单', type: 1, url: ""})
setConfigArray(temp)
setActiveSubmenuIndex(temp[index].children?.length - 1)
// setRightData({name: '', type: 1, url: ""})
// setActiveMenuIndex(index)
// if(configArray[index].children?.length){
// setActiveSubmenuIndex(configArray[index].children?.length)
// if(temp[index].children?.length){
// setActiveSubmenuIndex(temp[index].children?.length)
// }else{
// setActiveSubmenuIndex(0)
// }
// setIsEdit(false)
}
const addFirstMenu = ()=>{
setRightData({name: '一级菜单', type: 1, url: ""})
if(activeSubmenuIndex > -1){
if(!/^[\u4e00-\u9fa5]{1,4}$/.test(rightData.name) && !/^[a-zA-Z]{1,8}$/.test(rightData.name) ){
message.error('子菜单名称不符合规范, 请重新输入')
return
}
if(!rightData.url){
message.error('子菜单网络地址不能为空')
return
}
}
setRightData({name: '一级菜单', type: '', url: ""})
if(configArray.length < 3){
setActiveMenuIndex(configArray.length)
let temp = [...configArray]
temp.push({name: '一级菜单', type: 1, url: ""})
temp.push({name: '一级菜单', type: '', url: ""})
setConfigArray(temp)
}
setActiveSubmenuIndex(-1)
setIsEdit(false)
}
const onChange = (type, e)=>{
// let value = e.target.value, temp = {...rightData}
// temp[type] = value
// setRightData(temp)
let value = e.target.value
let value = e.target.value, temp = {...rightData}
temp[type] = value
setRightData(temp)
let temp_config = [...configArray]
if(activeSubmenuIndex > -1 && activeMenuIndex > -1){
temp_config[activeMenuIndex].children[activeSubmenuIndex][type] = value
@ -142,6 +186,39 @@ function WechatMenuMgm() {
}
const publish = ()=>{
if(configArray.length == 0){
message.error('请先进行配置')
return
}
if(activeSubmenuIndex > -1){
if(rightData.url == '' ){
message.error('子菜单网页地址不能为空')
return
}
}
let flag = true;
for(let i = 0; i < configArray.length; i++){
if(!configArray[i].children){
if(configArray[i].type == '' || configArray[i].url == ''){
if(configArray[i].url == ''){
message.error('未添加子菜单的一级菜单网页地址不能为空')
}else if(configArray[i].type == ''){
message.error('未添加子菜单的一级菜单消息类型不能为空')
}
setActiveMenuIndex(i)
setRightData({
name: configArray[i].name,
type: configArray[i].type,
url: configArray[i].url
})
flag = false
break
}
}
}
if(!flag){
return
}
ajax.publishMenu(configArray).then(res=>{
if(res.status == 20000){
message.success(res.message)
@ -154,88 +231,7 @@ function WechatMenuMgm() {
})
}
const save = ()=>{
if(!/^[\u4e00-\u9fa5]{1,4}$/.test(rightData.name) && !/^[a-zA-Z]{1,8}$/.test(rightData.name) ){
message.error('名称不符合规范, 请重新输入')
return
}
if(!rightData.url){
message.error('网络地址不能为空')
return
}
if(activeMenuIndex > -1 && activeSubmenuIndex == -1){
//
// if(configArray.length){
// let lastMenu = configArray[configArray.length - 1]
// if(lastMenu.children?.length){ //, ,
// let flag = true;
// for(let i = 0; i < lastMenu.children.length ;i++){
// if(!lastMenu.children[i].url){
// message.error('')
// flag = false
// break
// }
// }
// if(!flag){
// return
// }
// }else{
// if(!/^[\u4e00-\u9fa5]{1,4}$/.test(lastMenu.name) && !/^[a-zA-Z]{1,8}$/.test(lastMenu.name) ){
// message.error(', ')
// return
// }
// if(!lastMenu.url){
// message.error('')
// return
// }
// }
// }
// let temp = [...configArray]
// temp.push({name: '', type: 1, url: ""})
// setConfigArray(temp)
// setActiveMenuIndex(configArray.length - 1)
// setRightData({name: '', type: 1, url: ""})
if(isEdit){
let temp = [...configArray]
temp[activeMenuIndex].name = rightData.name
temp[activeMenuIndex].type = rightData.type
temp[activeMenuIndex].url = rightData.url
setConfigArray(temp)
message.success('一级菜单编辑成功')
}else{
let temp = [...configArray]
temp.push(rightData)
setConfigArray(temp)
message.success('一级菜单添加成功')
setIsEdit(true)
}
}else{
if(isEdit){
let temp_arr = [...configArray];
console.log(temp_arr[activeMenuIndex])
// if(temp_arr[activeMenuIndex]?.children[activeSubmenuIndex]){
// temp_arr[activeMenuIndex]?.children[activeSubmenuIndex] = rightData
// }
temp_arr[activeMenuIndex].children[activeSubmenuIndex] = rightData
setConfigArray(temp_arr)
message.success('子菜单编辑成功')
}else{
let temp = [...configArray]
if(temp[activeMenuIndex].children){
let tempchildren = [...temp[activeMenuIndex].children]
tempchildren.push(rightData)
temp[activeMenuIndex].children = tempchildren
}else{
temp[activeMenuIndex].children = [rightData]
}
setConfigArray(temp)
message.success('子菜单添加成功')
setIsEdit(true)
}
}
const save = ()=>{
}
useEffect(()=>{
@ -350,8 +346,10 @@ function WechatMenuMgm() {
{/* &emsp;<Button type="primary" onClick={save}>保存</Button>&emsp; */}
</> : null
}
{
configArray.length > 0 ? <>&emsp; <Button type="primary" onClick={publish}>保存并发布</Button></> : null
}
&emsp;<Button type="primary" onClick={publish}>保存并发布</Button>
</div>
</div>
</div>

16
src/pages/SystemMgm/BusinessConfig/HotCbdConf/loadable.jsx

@ -86,7 +86,7 @@ function HotCbdConf() {
];
const [pageData, setPageData] = useSetState({ //
pn: defaultParams?.pn || 1,
size:defaultParams?.size || 20,
page_size:defaultParams?.page_size || 20,
})
//
const formSearch = [
@ -119,7 +119,7 @@ function HotCbdConf() {
const excuteSearch=()=>{
setPageData({...pageData, pn: 1})
search({pn: 1, size:pageData.size})
search({pn: 1, page_size:pageData.page_size})
}
//
@ -127,7 +127,7 @@ function HotCbdConf() {
let obj = params;
if(params.pn === undefined){
obj.pn = pageData.pn
obj.size = pageData.size
obj.page_size = pageData.page_size
}else if(params.area === undefined){
obj.name = formData.name
obj.area = formData.area
@ -234,7 +234,7 @@ function HotCbdConf() {
area: ''
})
setPageData({...pageData, pn: 1})
search({name: '', area: '', pn: 1, size: pageData.size})
search({name: '', area: '', pn: 1, page_size: pageData.page_size})
}
const addConfig = ()=>{
@ -244,16 +244,16 @@ function HotCbdConf() {
const onShowSizeChange = (current, pageSize) => {
let pn
if (pageData.size == pageSize) {
if (pageData.page_size == pageSize) {
pn = current
} else {
pn = 1
}
setPageData({
pn: pn,
size: pageSize,
page_size: pageSize,
})
search({pn: pn, size: pageSize})
search({pn: pn, page_size: pageSize})
}
//
const tranverseTreeData = (data)=>{
@ -370,7 +370,7 @@ function HotCbdConf() {
// showTotal={() => ` ${total_records} `}
total={total}
current={pageData.pn}
pageSize={pageData.size}
pageSize={pageData.page_size}
pageSizeOptions={dictionary?.pageSizeOptions}
onChange={onShowSizeChange}
onShowSizeChange={onShowSizeChange}

2
src/router/index.jsx

@ -15,7 +15,6 @@ function RouterMap(props) {
const location = useLocation();
const [loading, setLoading] = useState(true)
const storeRoutes = useSelector((state) => state.user.route)
// console.log(storeRoutes)
const skin = localStorage.getItem("skin")
const dispatch = useDispatch()
const renderElement = (route) => {
@ -94,6 +93,7 @@ function RouterMap(props) {
const reverseZoom = 1 / zoom;
window.zoom = zoom
document.getElementsByTagName('body')[0].style = `zoom:${zoom}`;
// document.getElementsByTagName('body')[0].style = `zoom:${reverseZoom}`;
};

Loading…
Cancel
Save