220 lines
4.3 KiB
Vue
220 lines
4.3 KiB
Vue
<template>
|
|
<view class="common">
|
|
<view class="add" @click="handleAddUser">
|
|
<icon class="iconfont icon-tianjia"></icon>添加成员
|
|
</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?'男':'女'}}</text>
|
|
<text>{{item.age}}岁</text>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="right" @click.stop>
|
|
<view class="blueBtn" @click="editorInfo(item)">编辑</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>
|
|
没有数据了!
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
mapState
|
|
} from "vuex";
|
|
export default {
|
|
data() {
|
|
return {
|
|
visible: false,
|
|
ranklist: [],
|
|
}
|
|
},
|
|
computed: {
|
|
...mapState(["familayList", "user"])
|
|
},
|
|
onLoad() {},
|
|
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: '友情提示',
|
|
content: '确定删除该成员吗',
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
that.$model.getDelUser({
|
|
id: id,
|
|
}).then(res => {
|
|
if (res.code != 0) return
|
|
that.$tools.msg("删除成功!");
|
|
that.familayList.splice(ind, 1)
|
|
that.handleUserList()
|
|
})
|
|
} else if (res.cancel) {
|
|
that.$tools.msg("您已取消删除!");
|
|
}
|
|
}
|
|
});
|
|
},
|
|
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) {
|
|
that.$store.dispatch('getUserInfo', {
|
|
aud_id: res.data[0].id
|
|
})
|
|
that.$store.dispatch("getCardList", {
|
|
aud_id: res.data[0].id
|
|
})
|
|
}
|
|
}).catch(err => {})
|
|
},
|
|
//编辑
|
|
editorInfo(item) {
|
|
console.log("familayList", this.familayList)
|
|
uni.navigateTo({
|
|
url: "/pages/my/userInfo?info=" + JSON.stringify(item)
|
|
})
|
|
},
|
|
//添加
|
|
handleAddUser() {
|
|
uni.navigateTo({
|
|
url: "/pages/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: 55px;
|
|
height: 55px;
|
|
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> |