2024-05-29 16:35:45 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<view>
|
|
|
|
|
|
<view class="header">
|
|
|
|
|
|
<view class="top" v-if="userList.length">
|
|
|
|
|
|
<view class="headimg">
|
2024-09-12 11:20:52 +08:00
|
|
|
|
<image :src="info.head_pic"></image>
|
2024-05-29 16:35:45 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
<view class="info">
|
2024-09-12 11:20:52 +08:00
|
|
|
|
<view class="size18 bold">{{info.nickname}}</view>
|
2024-08-22 09:48:00 +08:00
|
|
|
|
<view class="mt-10">
|
2024-09-12 11:20:52 +08:00
|
|
|
|
<text class="mr-10">性别:{{info.gender==1?'男':info.gender==2?'女':'未知'}}</text>
|
|
|
|
|
|
<text class="ml-10">年龄:{{info.age}}岁</text>
|
2024-08-22 09:48:00 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
<!-- <view class="mt-10">{{$t("index.birthday")}}:{{user.birthday}}</view> -->
|
2024-05-29 16:35:45 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
<text class="t-icon t-icon-qiehuan1" @click="$store.commit('changeDrawe', true)" v-if="isLeft"></text>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="top" v-else @click="handleAddUser">
|
|
|
|
|
|
<view class="info">
|
|
|
|
|
|
暂无成员,请先添加~
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<view class="add">
|
|
|
|
|
|
+
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<!-- 地区 -->
|
2024-07-22 14:13:19 +08:00
|
|
|
|
<view class="cityList">
|
|
|
|
|
|
<view class="area" v-if="isArea" @click="visible = true">
|
|
|
|
|
|
<view>选择地区标准:</view>
|
2024-09-12 11:20:52 +08:00
|
|
|
|
<view>{{region?region:info.address}}<uni-icons type="bottom"></uni-icons></view>
|
2024-07-22 14:13:19 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
<!-- -->
|
|
|
|
|
|
<view v-if="visible" class="visible" @click="visible=false">
|
|
|
|
|
|
<view @click.stop class="item">
|
|
|
|
|
|
<view class="groupBtn">
|
|
|
|
|
|
<view @click="visible=false">取消</view>
|
|
|
|
|
|
<view @click="handlesure()" class="sure">确定</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<picker-view @change="bindChange" :value="value" class="picker-view"
|
|
|
|
|
|
:indicator-style="indicatorStyle">
|
|
|
|
|
|
<picker-view-column>
|
|
|
|
|
|
<view class="item" v-for="(item,index) in province" :key="index">{{item.name}}</view>
|
|
|
|
|
|
</picker-view-column>
|
|
|
|
|
|
<picker-view-column>
|
|
|
|
|
|
<view class="item" v-for="(item,index) in city" :key="index">{{item}}</view>
|
|
|
|
|
|
</picker-view-column>
|
|
|
|
|
|
<!-- <picker-view-column>
|
|
|
|
|
|
<view class="item" v-for="(item,index) in area" :key="index">{{item?item:'请选择'}}</view>
|
|
|
|
|
|
</picker-view-column> -->
|
|
|
|
|
|
</picker-view>
|
|
|
|
|
|
</view>
|
2024-05-29 16:35:45 +08:00
|
|
|
|
</view>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
<!-- 切换成员 -->
|
|
|
|
|
|
<drawer></drawer>
|
|
|
|
|
|
</view>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
import {
|
|
|
|
|
|
mapState
|
|
|
|
|
|
} from "vuex";
|
2024-08-22 09:48:00 +08:00
|
|
|
|
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() {
|
|
|
|
|
|
return {
|
|
|
|
|
|
value: [2, 0],
|
|
|
|
|
|
visible: false,
|
|
|
|
|
|
region: "",
|
|
|
|
|
|
province: [], //省
|
|
|
|
|
|
city: [], //市
|
|
|
|
|
|
area: [], //区
|
|
|
|
|
|
indicatorStyle: `height: 45px;`,
|
|
|
|
|
|
};
|
|
|
|
|
|
},
|
|
|
|
|
|
computed: {
|
|
|
|
|
|
...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
|
|
|
|
|
|
},
|
|
|
|
|
|
userId() {
|
|
|
|
|
|
return this.user.id
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
2024-05-29 16:35:45 +08:00
|
|
|
|
props: {
|
|
|
|
|
|
isArea: {
|
|
|
|
|
|
type: Boolean,
|
|
|
|
|
|
default: true
|
|
|
|
|
|
},
|
|
|
|
|
|
isLeft: {
|
|
|
|
|
|
type: Boolean,
|
|
|
|
|
|
default: true
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
2024-07-22 14:13:19 +08:00
|
|
|
|
mounted() {
|
|
|
|
|
|
let that = this
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
|
if (that.isArea) {
|
|
|
|
|
|
that.handleCityList()
|
|
|
|
|
|
console.log("1111", this.user.address)
|
|
|
|
|
|
}
|
|
|
|
|
|
}, 500);
|
2024-05-29 16:35:45 +08:00
|
|
|
|
},
|
2024-07-22 14:13:19 +08:00
|
|
|
|
watch: {
|
|
|
|
|
|
userId() {
|
|
|
|
|
|
let that = this
|
|
|
|
|
|
that.region = that.user.address
|
|
|
|
|
|
if (that.province.length) {
|
|
|
|
|
|
let str = that.user.address.split(',')[0]
|
|
|
|
|
|
let str2 = that.user.address.split(',')[1]
|
|
|
|
|
|
var Index0 = that.province.findIndex((profile) => profile.name === str);
|
|
|
|
|
|
var Index2 = that.province[Index0].list.findIndex((ite) => ite === str2);
|
|
|
|
|
|
that.value[0] = Index0
|
|
|
|
|
|
that.value[1] = Index2
|
|
|
|
|
|
that.city = that.province[Index0].list
|
|
|
|
|
|
}
|
|
|
|
|
|
that.$emit("getAciveCity", that.region)
|
|
|
|
|
|
},
|
2024-05-29 16:35:45 +08:00
|
|
|
|
},
|
|
|
|
|
|
methods: {
|
2024-07-22 14:13:19 +08:00
|
|
|
|
bindChange: function(e) {
|
|
|
|
|
|
let that = this
|
|
|
|
|
|
if (e.detail.value[0] != that.value[0]) {
|
|
|
|
|
|
e.detail.value[1] = 0
|
|
|
|
|
|
}
|
|
|
|
|
|
that.value = e.detail.value
|
|
|
|
|
|
that.city = that.province[that.value[0]].list
|
|
|
|
|
|
},
|
|
|
|
|
|
handlesure() {
|
|
|
|
|
|
let that = this
|
|
|
|
|
|
let defaultRegion = [that.province[that.value[0]].name, that.city[that.value[1]]]
|
|
|
|
|
|
that.region = defaultRegion.join(",");
|
|
|
|
|
|
that.visible = false
|
|
|
|
|
|
that.$emit("getAciveCity", that.region)
|
|
|
|
|
|
},
|
2024-05-29 16:35:45 +08:00
|
|
|
|
// 添加成员
|
|
|
|
|
|
handleAddUser() {
|
2024-09-12 11:20:52 +08:00
|
|
|
|
if (uni.getStorageSync('token')) {
|
|
|
|
|
|
uni.navigateTo({
|
|
|
|
|
|
url: "/pages/my/userInfo"
|
|
|
|
|
|
})
|
|
|
|
|
|
} else {
|
|
|
|
|
|
uni.reLaunch({
|
|
|
|
|
|
url: '/pages/login/login'
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2024-05-29 16:35:45 +08:00
|
|
|
|
},
|
2024-07-22 14:13:19 +08:00
|
|
|
|
// 地区
|
|
|
|
|
|
handleCityList() {
|
|
|
|
|
|
let that = this
|
|
|
|
|
|
that.$model.getCityList({
|
|
|
|
|
|
type: 2
|
|
|
|
|
|
}).then((res) => {
|
|
|
|
|
|
console.log("|全部地区", res.data, that.user.address)
|
|
|
|
|
|
if (res.code != 0) return
|
|
|
|
|
|
that.province = res.data
|
|
|
|
|
|
let str = that.user.address.split(',')[0]
|
|
|
|
|
|
let str2 = that.user.address.split(',')[1]
|
|
|
|
|
|
var Index0 = res.data.findIndex((profile) => profile.name === str);
|
|
|
|
|
|
var Index2 = res.data[Index0].list.findIndex((ite) => ite === str2);
|
|
|
|
|
|
that.value[0] = Index0
|
|
|
|
|
|
that.value[1] = Index2
|
|
|
|
|
|
that.city = res.data[Index0].list
|
|
|
|
|
|
})
|
|
|
|
|
|
},
|
|
|
|
|
|
|
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-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;
|
|
|
|
|
|
z-index: 99;
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-08-22 09:48:00 +08:00
|
|
|
|
|
|
|
|
|
|
.t-icon-qiehuan1 {
|
|
|
|
|
|
width: 25px;
|
|
|
|
|
|
height: 25px;
|
|
|
|
|
|
}
|
2024-05-29 16:35:45 +08:00
|
|
|
|
</style>
|