hldy_app/component/public/leftMenu.vue

160 lines
3.5 KiB
Vue
Raw Normal View History

2025-03-05 17:29:32 +08:00
<!-- 左侧菜单提取已废弃保留一下待用 -->
<!-- <template>
<view class="left-container">
<view class="left-head">
<image class="left-head-img" src="/static/index/oldman.png" />
<text :class="darkFans?`left-head-font-dark`:`left-head-font`">
王金凤
</text>
</view>
<view class="left-img-container">
<view v-for="(item,index) in iconList" :key="index" class="blue-circle-pos" >
<view class="blue-circle" v-show="index == menuIndex">
<image class="blue-circle-size" :src="`/static/index/ray.png`" />
</view>
<image class="left-img" :src="index == menuIndex ? item.targetUrl : item.url"
@click="jumpTonew(item.path)" />
</view>
</view>
</view>
</template>
<script setup>
import {
defineProps,
defineEmits,
ref
} from 'vue';
// 定义 Props
const props = defineProps({
darkFans: {
type: Boolean,
default: false
},
menuIndex: {
type: Number,
default: 0
},
});
// 定义事件
const emit = defineEmits(['click']);
// 初始化左侧菜单列表
const iconList = ref([{
url: '/static/index/lefticon/index.png',
targetUrl: '/static/index/lefticontarget/blueindex.png',
path: `/pages/index/index`
},
{
url: '/static/index/lefticon/nurse.png',
targetUrl: '/static/index/lefticontarget/bluenurse.png',
path: `/pages/doctorsay/index`
},
{
url: '/static/index/lefticon/doctor.png',
targetUrl: '/static/index/lefticontarget/bluedoctor.png',
path: ''
},
{
url: '/static/index/lefticon/give.png',
targetUrl: '/static/index/lefticontarget/givedark.png',
path: ''
},
{
url: '/static/index/lefticon/wifi.png',
targetUrl: '/static/index/lefticontarget/bluewifi.png',
path: ''
},
{
url: '/static/index/lefticon/back.png',
targetUrl: '/static/index/lefticontarget/blueback.png',
path: ''
}
]);
const handleClick = () => {
emit('click'); // 触发父组件的事件
};
// 变更菜单
const jumpTonew = (path) => {
const pages = getCurrentPages(); // 获取当前页面栈
if (pages.length === 0) return; // 确保有页面
const currentPage = pages[pages.length - 1]; // 获取当前页面
const currentPath = '/' + currentPage.route; // 获取当前页面路径(带前缀 /
if ((currentPath !== path) && path) {
uni.redirectTo({
url: path,
animationType: 'none', // 取消动画效果
animationDuration: 0 // 设置动画持续时间为0表示没有动画
});
}
}
</script>
<style scoped lang="less">
.left-container {
width: 235rpx;
height: 100%;
.blue-circle-pos {
position: relative;
.blue-circle {
position: absolute;
top: -50rpx;
left: -68rpx;
.blue-circle-size {
width: 170rpx;
height: 250rpx;
}
}
}
.left-head {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
.left-head-img {
width: 150rpx;
height: 150rpx;
margin-top: 60rpx;
}
.left-head-font {
font-weight: 700;
font-size: 40rpx;
}
.left-head-font-dark {
font-weight: 700;
font-size: 40rpx;
background: linear-gradient(to right, #EBF4FF, #ADC4E0);
-webkit-background-clip: text;
color: transparent;
}
}
.left-img-container {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
// margin-top: 30rpx;
.left-img {
width: 93rpx;
height: 93rpx;
// margin-top: 25rpx;
// margin-bottom: 25rpx;
margin: 50rpx 0;
z-index: 100;
}
}
}
</style> -->