tj
2025-06-05 b84ced02cc40cad7cdd99d80b54638f72ccab7e6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<template>
    <up-popup :show="showPopup" mode="left" @open="handleOpen" @close="handleClose" closeOnClickOverlay
        customStyle="background-color: #FAFAFA;">
        <scroll-view scroll-y class="setting-scroll">
            <view class="setting-page">
                <up-cell-group v-for="(group, groupIndex) in cellGroupList" :key="groupIndex" :border="false"
                    :customStyle="cellGroupStyle">
                    <up-cell v-for="(item, index) in group" :key="index" :title="item.title" :url="item.url"
                        :border="false"  @click="handleCellClick(item, index)">
                        <template #icon>
                            <up-icon :size="item.btnSize" :name="item.icon" />
                        </template>
                    </up-cell>
                </up-cell-group>
            </view>
        </scroll-view>
 
        <view class="opeartor-view">
            <up-grid :border="false">
                <up-grid-item v-for="(item, index) in baseList" :key="index" @click="handleGridClick(item, index)">
                    <up-icon :customStyle="{ paddingTop: '20rpx' }" :name="item.name" :size="30" />
                    <text class="grid-text">{{ item.title }}</text>
                </up-grid-item>
            </up-grid>
        </view>
    </up-popup>
</template>
 
<script setup lang="ts">
import { computed, ref, watch } from 'vue'
 
const props = defineProps<{
    modelValue: boolean
}>()
 
const emit = defineEmits(['update:modelValue']);  // 修改这里
 
const showPopup = ref(props.modelValue);
 
const cellGroupStyle = 'background-color: #ffffff; margin-bottom: 20rpx; border-radius: 16rpx;'
const btnSize = "22"
 
const cellGroupList = [
    [
        { title: "发现好友", icon: "man-add", url: "/pages/componentsB/tag/tag" ,btnSize: btnSize}
    ],
    [
        { title: "创作者中心", icon: "/static/common/light.png", url: "/pages/componentsB/tag/tag",btnSize: btnSize }
    ],
    [
        { title: "我的草稿", icon: "file-text", url: "/pages/componentsB/tag/tag" ,btnSize: btnSize},
        { title: "我的评论", icon: "chat", url: "/pages/componentsB/tag/tag" ,btnSize: btnSize},
        { title: "浏览记录", icon: "clock", url: "/pages/componentsB/tag/tag" ,btnSize: btnSize}
    ],
    [
        { title: "订单", icon: "order", url: "/pages/componentsB/tag/tag" ,btnSize: btnSize},
        { title: "购物车", icon: "shopping-cart", url: "/pages/componentsB/tag/tag" ,btnSize: btnSize},
        { title: "钱包", icon: "/static/common/wallet.png", url: "/pages/componentsB/tag/tag" ,btnSize: 15}
    ],
    [
        { title: "小程序", icon: "/static/common/xcx.png", url: "/pages/componentsB/tag/tag",btnSize: 15 }
    ],
    [
        { title: "社区公约", icon: "/static/common/sqgy.png", url: "/pages/componentsB/tag/tag" ,btnSize: 15}
    ]
];
 
const baseList = [
    { name: 'scan', title: '扫一扫',url:'/sub-pages/mine/settings'},
    { name: 'kefu-ermai', title: '帮助与客服' ,url:'/sub-pages/mine/settings'},
    { name: 'setting', title: '设置',url:'/sub-pages/mine/settings' },
]
 
const handleGridClick = (item: { name: string; title: string; url?: string }, index: number) => {
    
    uni.navigateTo({ url: item.url })
}
const handleCellClick = (item: { title: string; icon: string; url?: string;btnSize:String }, index: number) => {
    
    uni.navigateTo({ url: item.url })
}
 
const handleOpen = () => { }
 
const handleClose = () => {
    showPopup.value = false;
}
watch(
    () => props.modelValue,
    (newVal) => {
        showPopup.value = newVal;
    }
);
 
// 监听内部 showPopup 变化,通知外部更新 modelValue
watch(showPopup, (val) => { 
    emit('update:modelValue', val);
});
</script>
 
<style lang="scss" scoped>
.setting-page {
    width: 400rpx;
    padding: 20rpx;
    box-sizing: border-box;
    overflow-y: auto;
    height: calc(100vh - 200rpx);
}
 
.opeartor-view {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 10rpx;
    box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.05);
    z-index: 10;
    box-sizing: border-box;
    height: 200rpx;
 
    .grid-text {
        font-size: 26rpx;
        color: #909399;
        padding: 10rpx 0 20rpx 0;
        box-sizing: border-box;
    }
}
</style>