examTeamApp/element/headerIndex.vue

164 lines
3.1 KiB
Vue
Raw Normal View History

2024-05-29 16:35:45 +08:00
<template>
<view>
<view class="header">
<view class="top" v-if="userList.length">
2024-10-11 10:04:19 +08:00
<view class="headimg" @click="handleAddUser(1)">
2024-09-12 11:20:52 +08:00
<image :src="info.head_pic"></image>
2024-05-29 16:35:45 +08:00
</view>
2024-10-11 10:04:19 +08:00
<view class="info" @click="handleAddUser(1)">
2024-09-12 11:20:52 +08:00
<view class="size18 bold">{{info.nickname}}</view>
<view class="mt-5">
2025-05-10 14:31:09 +08:00
<text class="mr-10">
{{$t("common.infoGender")}}{{info.gender==1?$t("common.infoMan"):info.gender==2?$t("common.infoWoman"):$t("common.infoUnknown")}}
</text>
<text class="ml-10">
{{$t("common.infoAge")}}{{info.age}}{{$t("common.infoAgeunit")}}
</text>
2025-04-29 17:29:44 +08:00
</view>
2024-05-29 16:35:45 +08:00
</view>
2025-05-10 14:31:09 +08:00
<view class="t-icon t-icon-qiehuan1" @click="$store.commit('changeDrawe', true)"></view>
2024-05-29 16:35:45 +08:00
</view>
2024-10-11 10:04:19 +08:00
<view class="top" v-else @click="handleAddUser(2)">
2024-05-29 16:35:45 +08:00
<view class="info">
2025-04-18 14:53:38 +08:00
{{$t("tips.msgAddUser")}}
2024-05-29 16:35:45 +08:00
</view>
<view class="add">
+
</view>
</view>
</view>
<!-- 切换成员 -->
<drawer></drawer>
</view>
</template>
<script>
import {
mapState
} from "vuex";
import drawer from "@/element/drawer.vue"
2024-05-29 16:35:45 +08:00
export default {
name: "headerIndex",
components: {
drawer
},
2024-07-22 14:13:19 +08:00
data() {
2025-05-10 14:31:09 +08:00
return {};
2024-07-22 14:13:19 +08:00
},
computed: {
2025-05-10 14:31:09 +08:00
...mapState(["user", "familayList"]),
2024-09-12 11:20:52 +08:00
info() {
return this.user
},
2024-07-22 14:13:19 +08:00
userList() {
return this.familayList
},
2024-05-29 16:35:45 +08:00
},
2024-07-22 14:13:19 +08:00
mounted() {
let that = this
2024-05-29 16:35:45 +08:00
},
methods: {
// 添加成员
2024-10-11 10:04:19 +08:00
handleAddUser(ind) {
let that = this
2024-09-12 11:20:52 +08:00
if (uni.getStorageSync('token')) {
2024-10-11 10:04:19 +08:00
let index = that.userList.findIndex((profile) => profile.id == that.info.id)
2024-09-12 11:20:52 +08:00
uni.navigateTo({
2024-10-11 10:04:19 +08:00
url: ind == 1 ? "/pageTwo/my/userInfo?info=" + JSON.stringify(that.userList[index]) :
"/pageTwo/my/userInfo"
2024-09-12 11:20:52 +08:00
})
} else {
uni.reLaunch({
2024-10-11 10:04:19 +08:00
url: '/pageTwo/login/login'
2024-09-12 11:20:52 +08:00
})
}
2024-05-29 16:35:45 +08:00
},
}
}
</script>
<style lang="scss" scoped>
.info {
display: flex;
flex-wrap: wrap;
margin-left: 15px;
width: calc(100% - 70px);
view {
width: 100%;
}
2024-06-13 18:03:50 +08:00
last-child {
margin-top: 2px !important;
}
2024-05-29 16:35:45 +08:00
}
.area {
margin: 15px 10px 0;
padding: 15px 10px 10px;
background-color: #fff;
width: calc(100% - 40px);
display: flex;
border-radius: 10px;
justify-content: space-between;
2024-10-11 10:04:19 +08:00
box-shadow: 0px 1px 5px 2px #dfe2e1fc;
2024-05-29 16:35:45 +08:00
}
2024-07-22 14:13:19 +08:00
.item {
line-height: 80rpx;
text-align: center;
}
.visible {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
2024-10-11 10:04:19 +08:00
z-index: 9999;
2024-07-22 14:13:19 +08:00
background-color: rgba(0, 0, 0, 0.6);
.groupBtn {
height: 50px;
line-height: 50px;
background-color: #fff;
display: flex;
justify-content: space-between;
padding: 0 15px;
border-bottom: 1px solid #dfdfdf;
position: absolute;
left: 0;
right: 0;
bottom: 45%;
z-index: 999;
view {
height: 30px;
line-height: 30px;
padding: 0 10px;
background-color: #dfdfdf;
border-radius: 5px;
margin-top: 10px;
}
.sure {
background-color: $textcolor;
color: #fff !important;
}
}
.picker-view {
width: 100%;
height: 45%;
bottom: 0;
position: absolute;
background-color: #fff;
}
}
.t-icon-qiehuan1 {
width: 25px;
height: 25px;
}
2024-05-29 16:35:45 +08:00
</style>