|
|
@@ -1,66 +1,70 @@ |
|
|
|
<template>
|
|
|
|
<view class="wrapper">
|
|
|
|
<view class="search-box">
|
|
|
|
<image :src="`${$imgUrl}service/icon-search.png`" class="icon" mode="aspectFill" @click="search()"></image>
|
|
|
|
<input class="search" placeholder="请输入业务名称" v-model="state.searchVal" @confirm="search()" />
|
|
|
|
</view>
|
|
|
|
<view class="content">
|
|
|
|
<view class="left">
|
|
|
|
<view v-for="(item,index) in menuShow.list" :key="index"
|
|
|
|
:class="activeTab === item.name ? 'menu active' : 'menu'" @click="tabHandle(item.name,index)">
|
|
|
|
<view :class="activeTab === item.name ? 'border on' : 'border'" :style="{ '--background': bgOn }"></view>
|
|
|
|
<view class="menu-text">{{item.name}}</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
<view class="right">
|
|
|
|
<rightListVue class="rightListVue" :menuList='menuShow.list[tableSelectIndex].children'
|
|
|
|
v-if="menuShow.list.length > 0" />
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { source } from "@/utils/network/difference";
|
|
|
|
import rightListVue from "./components/rightList.vue";
|
|
|
|
import {
|
|
|
|
ref,
|
|
|
|
reactive,
|
|
|
|
} from "vue";
|
|
|
|
import {
|
|
|
|
onLoad
|
|
|
|
} from "@dcloudio/uni-app";
|
|
|
|
import {
|
|
|
|
fileURL, fileURLList
|
|
|
|
} from "@/datas/fileURL.js";
|
|
|
|
import {
|
|
|
|
queryMenuConfig
|
|
|
|
} from "@/utils/network/api.js";
|
|
|
|
import {requestNew} from "@/utils/network/request.js";
|
|
|
|
import {
|
|
|
|
getItem,
|
|
|
|
StorageKeys,
|
|
|
|
} from "@/utils/storage";
|
|
|
|
const bgOn = `url(${fileURL}image/newHome/bg-on.png) center center no-repeat`;
|
|
|
|
import {hasLogin,confirm} from "@/utils/utils";
|
|
|
|
const activeTab = ref("");
|
|
|
|
const tableSelectIndex = ref(0);
|
|
|
|
// 切换
|
|
|
|
function tabHandle(val, index) {
|
|
|
|
activeTab.value = val;
|
|
|
|
tableSelectIndex.value = index
|
|
|
|
console.log(tableSelectIndex.value)
|
|
|
|
}
|
|
|
|
const menu = reactive({
|
|
|
|
list: [] //请求的真正的不会变得
|
|
|
|
});
|
|
|
|
const menuShow = reactive({
|
|
|
|
list: [],//展示的
|
|
|
|
});
|
|
|
|
const state = reactive({
|
|
|
|
searchVal: '', //input输入值
|
|
|
|
newArr: []
|
|
|
|
<template> |
|
|
|
<view class="wrapper"> |
|
|
|
<view class="search-box"> |
|
|
|
<image :src="`${$imgUrl}service/icon-search.png`" class="icon" mode="aspectFill" @click="search()"></image> |
|
|
|
<input class="search" placeholder="请输入业务名称" v-model="state.searchVal" @confirm="search()" /> |
|
|
|
</view> |
|
|
|
<view class="content"> |
|
|
|
<view class="left"> |
|
|
|
<view v-for="(item,index) in menuShow.list" :key="index" |
|
|
|
:class="activeTab === item.name ? 'menu active' : 'menu'" @click="tabHandle(item.name,index)"> |
|
|
|
<view :class="activeTab === item.name ? 'border on' : 'border'" :style="{ '--background': bgOn }"></view> |
|
|
|
<view class="menu-text">{{item.name}}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="right"> |
|
|
|
<rightListVue class="rightListVue" :menuList='menuShow.list[tableSelectIndex].children' |
|
|
|
v-if="menuShow.list.length > 0" /> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
<script lang="ts" setup> |
|
|
|
import { source } from "@/utils/network/difference"; |
|
|
|
import rightListVue from "./components/rightList.vue"; |
|
|
|
import { |
|
|
|
ref, |
|
|
|
reactive, |
|
|
|
} from "vue"; |
|
|
|
import { |
|
|
|
onLoad |
|
|
|
} from "@dcloudio/uni-app"; |
|
|
|
import { |
|
|
|
fileURL, fileURLList |
|
|
|
} from "@/datas/fileURL.js"; |
|
|
|
import { |
|
|
|
queryMenuConfig |
|
|
|
} from "@/utils/network/api.js"; |
|
|
|
import {requestNew} from "@/utils/network/request.js"; |
|
|
|
import { |
|
|
|
getItem, |
|
|
|
StorageKeys, |
|
|
|
} from "@/utils/storage"; |
|
|
|
const bgOn = `url(${fileURL}image/newHome/bg-on.png) center center no-repeat`; |
|
|
|
import {hasLogin,confirm,navTo} from "@/utils/utils"; |
|
|
|
const activeTab = ref(""); |
|
|
|
const tableSelectIndex = ref(0); |
|
|
|
// 切换 |
|
|
|
function tabHandle(val, index) { |
|
|
|
activeTab.value = val; |
|
|
|
tableSelectIndex.value = index |
|
|
|
console.log(tableSelectIndex.value) |
|
|
|
} |
|
|
|
const menu = reactive({ |
|
|
|
list: [] //请求的真正的不会变得 |
|
|
|
}); |
|
|
|
const menuShow = reactive({ |
|
|
|
list: [],//展示的 |
|
|
|
}); |
|
|
|
const state = reactive({ |
|
|
|
searchVal: '', //input输入值 |
|
|
|
newArr: [] |
|
|
|
}); |
|
|
|
onLoad(() => { |
|
|
|
load() |
|
|
|
});
|
|
|
|
onLoad(() => {
|
|
|
|
|
|
|
|
function load(){
|
|
|
|
console.log("1")
|
|
|
|
if (!hasLogin()) {
|
|
|
|
console.log("2")
|
|
|
@@ -81,253 +85,186 @@ |
|
|
|
activeTab.value = val.menuList[0]['name']
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
// 深拷贝
|
|
|
|
const deepClone = (obj) => {
|
|
|
|
if (typeof obj !== 'object' || obj === null) {
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
let clone = Array.isArray(obj) ? [] : {};
|
|
|
|
|
|
|
|
for (let key in obj) {
|
|
|
|
if (obj.hasOwnProperty(key)) {
|
|
|
|
clone[key] = deepClone(obj[key]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return clone;
|
|
|
|
}
|
|
|
|
const search = () => {
|
|
|
|
for (var i = 0; i < menu.list.length; i++) {
|
|
|
|
state.newArr[i]['children'] = [];
|
|
|
|
for (var j = 0; j < menu.list[i]['children'].length; j++) {
|
|
|
|
const name = menu.list[i]['children'][j].name;
|
|
|
|
if (name.indexOf(state.searchVal) >= 0) {
|
|
|
|
state.newArr[i]['children'].push(menu.list[i]['children'][j])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 清除没有孩子的父亲
|
|
|
|
const lastArr = []
|
|
|
|
for (var k = 0; k < state.newArr.length; k++) {
|
|
|
|
if (state.newArr[k]['children'].length != 0) {
|
|
|
|
lastArr.push(state.newArr[k])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
console.log("lastArr", lastArr)
|
|
|
|
if (state.searchVal) {
|
|
|
|
tableSelectIndex.value = 0
|
|
|
|
}
|
|
|
|
menuShow.list = lastArr
|
|
|
|
|
|
|
|
console.log("menuShow.list", menuShow.list, tableSelectIndex.value)
|
|
|
|
}
|
|
|
|
const queryMenuConfigAction = () => {
|
|
|
|
var data = {
|
|
|
|
openId: getItem(StorageKeys.OpenId),
|
|
|
|
systemType: source == "WECHAT" ? '6' : "9",
|
|
|
|
loginSource: getItem("loginSource")
|
|
|
|
};
|
|
|
|
const options = {
|
|
|
|
type: 2,
|
|
|
|
data: data,
|
|
|
|
method: "POST",
|
|
|
|
showLoading: true,
|
|
|
|
};
|
|
|
|
|
|
|
|
return new Promise(async (resolve, reject) => {
|
|
|
|
const res = await requestNew(queryMenuConfig, options);
|
|
|
|
const data = res;
|
|
|
|
console.log("dataqueryMenuConfigAction", data.menuList)
|
|
|
|
resolve(data);
|
|
|
|
}).catch((error) => {
|
|
|
|
reject(error);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function toNext(url) {
|
|
|
|
uni.navigateTo({
|
|
|
|
url: url,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
page {
|
|
|
|
height: 100%;
|
|
|
|
background: white;
|
|
|
|
}
|
|
|
|
|
|
|
|
.wrapper {
|
|
|
|
display: flex;
|
|
|
|
background: #01243A;
|
|
|
|
flex-direction: column;
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.search-box {
|
|
|
|
margin: 50rpx 40rpx;
|
|
|
|
height: 72rpx;
|
|
|
|
border-radius: 36rpx;
|
|
|
|
background: #f7f7f7;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.search-box .icon {
|
|
|
|
width: 48rpx;
|
|
|
|
height: 48rpx;
|
|
|
|
margin: 0 20rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
.search-box .search {
|
|
|
|
flex: 1;
|
|
|
|
margin-right: 20rpx;
|
|
|
|
height: 100%;
|
|
|
|
padding: 0 10rpx;
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: black;
|
|
|
|
background: transparent;
|
|
|
|
}
|
|
|
|
|
|
|
|
.content {
|
|
|
|
display: flex;
|
|
|
|
flex: 1;
|
|
|
|
flex-grow: 1;
|
|
|
|
background: #fff;
|
|
|
|
border-radius: 30rpx 30rpx 0 0;
|
|
|
|
padding-top: 40rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
.left {
|
|
|
|
width: 180rpx;
|
|
|
|
border-right: 1px solid #dcdcdc;
|
|
|
|
margin-right: 29rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
.left .menu-text {
|
|
|
|
font-size: 26rpx;
|
|
|
|
color: #666666;
|
|
|
|
width: 120rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
.left .menu {
|
|
|
|
padding-left: 15rpx;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
margin: 20rpx 0 60rpx 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
.left .active .menu-text {
|
|
|
|
font-weight: bold;
|
|
|
|
line-height: 32rpx;
|
|
|
|
font-family: NotoSansHans, NotoSansHans;
|
|
|
|
font-size: 28rpx;
|
|
|
|
color: #01243A;
|
|
|
|
}
|
|
|
|
|
|
|
|
.left .border {
|
|
|
|
width: 9rpx;
|
|
|
|
height: 26rpx;
|
|
|
|
border-radius: 4rpx;
|
|
|
|
margin-right: 20rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
.left .on {
|
|
|
|
/* background: linear-gradient(0deg, #43a1e0 0%, #13e7c1 100%); */
|
|
|
|
|
|
|
|
/* background: linear-gradient(0deg, #fff 0%, #C2A75F 50%, #C2A75F 100%); */
|
|
|
|
border-radius: 4rpx;
|
|
|
|
font-size: 28rpx;
|
|
|
|
background: var(--background);
|
|
|
|
background-size: 100% 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.right {
|
|
|
|
flex: 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* .right-content {
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// #ifdef MP-ALIPAY
|
|
|
|
.item {
|
|
|
|
width: 95rpx;
|
|
|
|
height: 95rpx;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
border-radius: 20rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
.right .item-box {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
margin-right: 26rpx;
|
|
|
|
margin-bottom: 39rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
// #endif
|
|
|
|
// #ifdef MP-WEIXIN
|
|
|
|
.item {
|
|
|
|
width: 105rpx;
|
|
|
|
height: 105rpx;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
border-radius: 20rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
.right .item-box {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
margin-right: 30rpx;
|
|
|
|
margin-bottom: 39rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
// #endif
|
|
|
|
.item image {
|
|
|
|
width: 64rpx;
|
|
|
|
height: 64rpx;
|
|
|
|
}
|
|
|
|
|
|
|
|
.right .text {
|
|
|
|
width: 105rpx;
|
|
|
|
font-size: 22rpx;
|
|
|
|
text-align: center;
|
|
|
|
height: 60rpx;
|
|
|
|
display: flex;
|
|
|
|
justify-content: center;
|
|
|
|
align-items: center;
|
|
|
|
margin-top: 19rpx;
|
|
|
|
color: #666666;
|
|
|
|
} */
|
|
|
|
|
|
|
|
.bg-blue {
|
|
|
|
background: var(--background);
|
|
|
|
}
|
|
|
|
|
|
|
|
.bg-orange {
|
|
|
|
background: var(--background);
|
|
|
|
}
|
|
|
|
|
|
|
|
.right .text-orange {
|
|
|
|
color: #fd8362;
|
|
|
|
}
|
|
|
|
|
|
|
|
.rightListVue {
|
|
|
|
height: 100%;
|
|
|
|
}
|
|
|
|
</style> |
|
|
|
|
|
|
|
// 深拷贝 |
|
|
|
const deepClone = (obj) => { |
|
|
|
if (typeof obj !== 'object' || obj === null) { |
|
|
|
return obj; |
|
|
|
} |
|
|
|
|
|
|
|
let clone = Array.isArray(obj) ? [] : {}; |
|
|
|
|
|
|
|
for (let key in obj) { |
|
|
|
if (obj.hasOwnProperty(key)) { |
|
|
|
clone[key] = deepClone(obj[key]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return clone; |
|
|
|
} |
|
|
|
const search = () => { |
|
|
|
for (var i = 0; i < menu.list.length; i++) { |
|
|
|
state.newArr[i]['children'] = []; |
|
|
|
for (var j = 0; j < menu.list[i]['children'].length; j++) { |
|
|
|
const name = menu.list[i]['children'][j].name; |
|
|
|
if (name.indexOf(state.searchVal) >= 0) { |
|
|
|
state.newArr[i]['children'].push(menu.list[i]['children'][j]) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 清除没有孩子的父亲 |
|
|
|
const lastArr = [] |
|
|
|
for (var k = 0; k < state.newArr.length; k++) { |
|
|
|
if (state.newArr[k]['children'].length != 0) { |
|
|
|
lastArr.push(state.newArr[k]) |
|
|
|
} |
|
|
|
} |
|
|
|
console.log("lastArr", lastArr) |
|
|
|
if (state.searchVal) { |
|
|
|
tableSelectIndex.value = 0 |
|
|
|
} |
|
|
|
menuShow.list = lastArr |
|
|
|
|
|
|
|
console.log("menuShow.list", menuShow.list, tableSelectIndex.value) |
|
|
|
} |
|
|
|
const queryMenuConfigAction = () => { |
|
|
|
var data = { |
|
|
|
openId: getItem(StorageKeys.OpenId), |
|
|
|
systemType: source == "WECHAT" ? '6' : "9", |
|
|
|
loginSource: getItem("loginSource") |
|
|
|
}; |
|
|
|
const options = { |
|
|
|
type: 2, |
|
|
|
data: data, |
|
|
|
method: "POST", |
|
|
|
showLoading: true, |
|
|
|
}; |
|
|
|
|
|
|
|
return new Promise(async (resolve, reject) => { |
|
|
|
const res = await requestNew(queryMenuConfig, options,false, ()=>{
|
|
|
|
console.log('---------------------我执行了!')
|
|
|
|
load()
|
|
|
|
}); |
|
|
|
const data = res; |
|
|
|
console.log("dataqueryMenuConfigAction", data.menuList) |
|
|
|
resolve(data); |
|
|
|
}).catch((error) => { |
|
|
|
reject(error); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function toNext(url) { |
|
|
|
navTo(url); |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style> |
|
|
|
page { |
|
|
|
height: 100%; |
|
|
|
background: white; |
|
|
|
} |
|
|
|
|
|
|
|
.wrapper { |
|
|
|
display: flex; |
|
|
|
background: #01243A; |
|
|
|
flex-direction: column; |
|
|
|
height: 100%; |
|
|
|
} |
|
|
|
|
|
|
|
.search-box { |
|
|
|
margin: 50rpx 40rpx; |
|
|
|
height: 72rpx; |
|
|
|
border-radius: 36rpx; |
|
|
|
background: #f7f7f7; |
|
|
|
display: flex; |
|
|
|
justify-content: center; |
|
|
|
align-items: center; |
|
|
|
} |
|
|
|
|
|
|
|
.search-box .icon { |
|
|
|
width: 48rpx; |
|
|
|
height: 48rpx; |
|
|
|
margin: 0 20rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.search-box .search { |
|
|
|
flex: 1; |
|
|
|
margin-right: 20rpx; |
|
|
|
height: 100%; |
|
|
|
padding: 0 10rpx; |
|
|
|
font-size: 28rpx; |
|
|
|
color: black; |
|
|
|
background: transparent; |
|
|
|
} |
|
|
|
|
|
|
|
.content { |
|
|
|
display: flex; |
|
|
|
flex: 1; |
|
|
|
flex-grow: 1; |
|
|
|
background: #fff; |
|
|
|
border-radius: 30rpx 30rpx 0 0; |
|
|
|
padding-top: 40rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.left { |
|
|
|
width: 180rpx; |
|
|
|
border-right: 1px solid #dcdcdc; |
|
|
|
margin-right: 29rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.left .menu-text { |
|
|
|
font-size: 26rpx; |
|
|
|
color: #666666; |
|
|
|
width: 120rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.left .menu { |
|
|
|
padding-left: 15rpx; |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
margin: 20rpx 0 60rpx 0; |
|
|
|
} |
|
|
|
|
|
|
|
.left .active .menu-text { |
|
|
|
font-weight: bold; |
|
|
|
line-height: 32rpx; |
|
|
|
font-family: NotoSansHans, NotoSansHans; |
|
|
|
font-size: 28rpx; |
|
|
|
color: #01243A; |
|
|
|
} |
|
|
|
|
|
|
|
.left .border { |
|
|
|
width: 9rpx; |
|
|
|
height: 26rpx; |
|
|
|
border-radius: 4rpx; |
|
|
|
margin-right: 20rpx; |
|
|
|
} |
|
|
|
|
|
|
|
.left .on { |
|
|
|
border-radius: 4rpx; |
|
|
|
font-size: 28rpx; |
|
|
|
background: var(--background); |
|
|
|
background-size: 100% 100%; |
|
|
|
} |
|
|
|
|
|
|
|
.right { |
|
|
|
flex: 1; |
|
|
|
} |
|
|
|
|
|
|
|
.bg-blue { |
|
|
|
background: var(--background); |
|
|
|
} |
|
|
|
|
|
|
|
.bg-orange { |
|
|
|
background: var(--background); |
|
|
|
} |
|
|
|
|
|
|
|
.right .text-orange { |
|
|
|
color: #fd8362; |
|
|
|
} |
|
|
|
|
|
|
|
.rightListVue { |
|
|
|
height: 100%; |
|
|
|
} |
|
|
|
</style> |