ReedawFoodApp/components/bodyIndex/drawer.vue

131 lines
2.6 KiB
Vue
Raw Normal View History

2026-03-23 16:23:40 +08:00
<template>
<view class="wrapper" v-if="isDrawe">
<view class="bg" @click="clear"></view>
<view class="wrapper_box">
<view class="top">
<image class="headimage mt-10" v-if="userinfo.head_pic" :src="userinfo.head_pic"></image>
<view class="overflow">{{userinfo.nickname}}</view>
</view>
<view class="drawerList">
<view class="drawerList_item" v-for="(item, index) in List" :key="index" @click="toggle(item)"
v-if="List.length">
<image v-if="item.head_pic" :src="item.head_pic" class="image1"></image>
<view class="right">
<view class="name">
<view class="overflow">
{{item.nickname}}
</view>
2026-03-30 10:02:10 +08:00
<view class="dangqian" v-if="item.id == userinfo.aud_id">当前</view>
2026-03-23 16:23:40 +08:00
</view>
<view class="info">
<view>{{item.gender==1?'男':'女'}}</view>
<view>{{item.age}}</view>
</view>
</view>
</view>
<view class="add" @click="addInfo()">
+
</view>
</view>
</view>
</view>
</template>
<script>
import {
mapState
} from "vuex";
export default {
data() {
return {};
},
computed: {
...mapState(["user", "familayList", "isDrawe"]),
userinfo() {
return this.user
},
List() {
return this.familayList
},
},
methods: {
// 切换用户
toggle(val) {
let that = this
2026-03-30 10:02:10 +08:00
console.log("11111", val)
2026-03-23 16:23:40 +08:00
uni.setStorageSync('userid', val.id)
uni.setStorageSync('gender', val.gender)
2026-03-30 10:02:10 +08:00
that.$store.dispatch('getUserInfo', {
2026-03-23 16:23:40 +08:00
aud_id: val.id
})
2026-03-30 10:02:10 +08:00
that.$store.dispatch("getCountFoodInfo", {
aud_id: val.id,
time: that.$tools.getDate("start")
})
that.$store.dispatch("getResult", {
aud_id: val.id,
})
that.$store.dispatch("getPublicRecord", {
aud_id: val.id,
})
2026-03-25 17:27:29 +08:00
that.$store.commit("changehomeCard", 0);
2026-03-23 16:23:40 +08:00
that.$store.commit("changeDrawe", false);
},
//添加
addInfo() {
let that = this
uni.navigateTo({
2026-03-30 10:02:10 +08:00
url: "/body/my/userInfo"
2026-03-23 16:23:40 +08:00
})
that.$store.commit("changeDrawe", false);
},
clear() {
this.$store.commit("changeDrawe", false);
},
}
}
</script>
<style lang="scss" scoped>
.wrapper {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 999;
.bg {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.4);
z-index: 99;
}
}
.headimage {
width: 50px;
height: 50px;
margin: auto;
border-radius: 50%;
margin-bottom: 16rpx;
}
.dangqian {
font-size: 24upx !important;
}
@keyframes wrapper_box {
0% {
transform: translateX(-100%);
}
100% {
transform: translateX(0%);
}
}
</style>