241 lines
5.0 KiB
Vue
241 lines
5.0 KiB
Vue
<template>
|
||
<view class="common">
|
||
<view class="add" @click="handleAddUser">
|
||
<icon class="iconfont icon-tianjia"></icon>{{$t("common.titleManageAdd")}}
|
||
</view>
|
||
<view class="box" v-if="familayList.lenght!=0">
|
||
<view class="list">
|
||
<uni-swipe-action>
|
||
<uni-swipe-action-item v-for="(item ,index) in familayList" :key="index"
|
||
:right-options="item.options" @click="handleDeldet($event, index)">
|
||
<view class="item">
|
||
<view class="left">
|
||
<image :src="item.head_pic" class="image1" />
|
||
<view class="name">
|
||
<view class="title">
|
||
{{item.nickname}}
|
||
</view>
|
||
<view class="title2">
|
||
<text>{{item.gender==1?$t('common.infoMan'):$t('common.infoWoman')}}</text>
|
||
<text>{{item.age}}{{$t('common.infoAgeunit')}}</text>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="right" @click.stop>
|
||
<view class="blueBtn" @click="editorInfo(item)">{{$t('common.btnEdit')}}</view>
|
||
</view>
|
||
</view>
|
||
</uni-swipe-action-item>
|
||
</uni-swipe-action>
|
||
|
||
<!-- <view class="left">
|
||
<image :src="item.head_pic" class="image1" />
|
||
<view class="name">
|
||
<view class="title">
|
||
{{item.nickname}}
|
||
</view>
|
||
<view class="title2">
|
||
<text>{{item.gender==1?'男':'女'}}</text>
|
||
<text>{{item.age}}岁</text>
|
||
</view>
|
||
</view>
|
||
</view> -->
|
||
|
||
</view>
|
||
</view>
|
||
<view v-else>
|
||
{{$t('index.none')}}!
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import {
|
||
mapState
|
||
} from "vuex";
|
||
export default {
|
||
data() {
|
||
return {
|
||
visible: false,
|
||
ranklist: [],
|
||
language: "",
|
||
}
|
||
},
|
||
computed: {
|
||
...mapState(["familayList", "user"])
|
||
},
|
||
onLoad() {
|
||
console.log("语言", uni.getLocale())
|
||
},
|
||
onReady() {
|
||
uni.setNavigationBarTitle({
|
||
title: this.$t('common.titleManage'),
|
||
})
|
||
},
|
||
onPullDownRefresh() {
|
||
let that = this
|
||
that.handleUserList()
|
||
setTimeout(() => {
|
||
uni.stopPullDownRefresh()
|
||
}, 1000);
|
||
},
|
||
methods: {
|
||
//删除
|
||
handleDeldet(e, ind) {
|
||
let that = this
|
||
let id = that.familayList[ind].id
|
||
uni.showModal({
|
||
title: that.$t("tips.msgTitle"),
|
||
content: that.$t("tips.verifyDeleteUser"),
|
||
cancelText: that.$t('tips.btnSancellation'),
|
||
confirmText: that.$t('tips.btnConfirm'),
|
||
success: function(res) {
|
||
if (res.confirm) {
|
||
that.$model.getDelUser({
|
||
id: id,
|
||
}).then(res => {
|
||
if (res.code != 0) return
|
||
that.$tools.msg(that.$t("tips.msgDelete"));
|
||
that.familayList.splice(ind, 1)
|
||
that.handleUserList()
|
||
})
|
||
} else if (res.cancel) {
|
||
that.$tools.msg(that.$t("tips.msgCancel"));
|
||
}
|
||
}
|
||
});
|
||
},
|
||
handleUserList() {
|
||
let that = this
|
||
that.$model.getUserList({
|
||
type: 2
|
||
}).then(res => {
|
||
if (res.code != 0) {
|
||
that.$tools.msg(res.msg)
|
||
return
|
||
}
|
||
that.$store.commit('changeFamilay', res.data)
|
||
if (res.data.length) {
|
||
uni.setStorageSync('userid', res.data[0].id)
|
||
that.$store.dispatch('getUserInfo', {
|
||
aud_id: res.data[0].id
|
||
})
|
||
that.handlePublicRecord(res.data[0].id)
|
||
}
|
||
}).catch(err => {})
|
||
},
|
||
// 公共手动记录内容
|
||
handlePublicRecord(id) {
|
||
let that = this
|
||
that.$model.getPublicRecord({
|
||
aud_id: id
|
||
}).then(res => {
|
||
console.log("公共手动记录", res)
|
||
if (res.code == 0) {
|
||
that.$store.commit('changePublicRecord', res.data)
|
||
}
|
||
})
|
||
},
|
||
//编辑
|
||
editorInfo(item) {
|
||
console.log("familayList", this.familayList)
|
||
uni.navigateTo({
|
||
url: "/pageTwo/my/userInfo?info=" + JSON.stringify(item)
|
||
})
|
||
},
|
||
//添加
|
||
handleAddUser() {
|
||
uni.navigateTo({
|
||
url: "/pageTwo/my/userInfo"
|
||
})
|
||
},
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped="scoped" lang="scss">
|
||
.common {
|
||
padding: 15px;
|
||
background-color: #f7f7f7;
|
||
min-height: calc(100vh - 30px);
|
||
}
|
||
|
||
.add {
|
||
width: 100%;
|
||
height: 40px;
|
||
line-height: 40px;
|
||
font-size: 32rpx;
|
||
margin-bottom: 10px;
|
||
color: #fff;
|
||
border-radius: 15px;
|
||
display: flex;
|
||
justify-content: center;
|
||
background: $btncolor;
|
||
}
|
||
|
||
.box {
|
||
width: 100%;
|
||
height: auto;
|
||
margin: 15px 0;
|
||
padding-bottom: 40px;
|
||
}
|
||
|
||
.list {
|
||
width: 100%;
|
||
font-size: 36rpx;
|
||
|
||
.item {
|
||
background: #fff;
|
||
padding: 10px 15px;
|
||
width: calc(100% - 30px);
|
||
border-radius: 10px;
|
||
margin-top: 15px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
}
|
||
|
||
.left {
|
||
width: 75%;
|
||
display: flex;
|
||
align-items: center;
|
||
|
||
.image1 {
|
||
width: 120rpx;
|
||
height: 120rpx;
|
||
border-radius: 50%;
|
||
margin-right: 15px;
|
||
display: block;
|
||
}
|
||
|
||
.name {
|
||
width: calc(100% - 70px);
|
||
|
||
.title {
|
||
font-size: 34rpx;
|
||
overflow: hidden;
|
||
text-overflow: ellipsis;
|
||
white-space: nowrap;
|
||
margin-top: 5px;
|
||
}
|
||
|
||
.title2 {
|
||
font-size: 32rpx;
|
||
color: #999;
|
||
margin-top: 15px;
|
||
|
||
text {
|
||
margin-right: 10px;
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
.blueBtn {
|
||
width: auto;
|
||
font-size: 32rpx;
|
||
text-align: center;
|
||
}
|
||
}
|
||
</style> |