群标签

This commit is contained in:
liuye
2023-05-24 18:01:09 +08:00
parent 1ac5605e06
commit dcbb58bdc1
3 changed files with 99 additions and 37 deletions

View File

@@ -3,11 +3,11 @@
<AiTopFixed> <AiTopFixed>
<div class="header-flex"> <div class="header-flex">
<div class="item"> <div class="item">
<h3>100</h3> <h3>{{totalInfo['已打标签']}}</h3>
<p>已打标签</p> <p>已打标签</p>
</div> </div>
<div class="item"> <div class="item">
<h3>100</h3> <h3>{{totalInfo['未打标签']}}</h3>
<p>未打标签</p> <p>未打标签</p>
</div> </div>
</div> </div>
@@ -18,7 +18,7 @@
</AiPagePicker> </AiPagePicker>
</div> </div>
</AiTopFixed> </AiTopFixed>
<div class="list-content"> <div class="list-content" v-if="list.length">
<div class="item" v-for="(item, index) in list" :key="index"> <div class="item" v-for="(item, index) in list" :key="index">
<div class="item-content" @click="viewList(index)"> <div class="item-content" @click="viewList(index)">
<div class="label">{{item.name}}</div> <div class="label">{{item.name}}</div>
@@ -29,11 +29,12 @@
<div class="item-list" v-if="activeIndex == index"> <div class="item-list" v-if="activeIndex == index">
<div class="row" v-for="(row, indexs) in item.tagList" :key="indexs" @click="toGrouping(row)"> <div class="row" v-for="(row, indexs) in item.tagList" :key="indexs" @click="toGrouping(row)">
<div class="row-label">{{row.name}}</div> <div class="row-label">{{row.name}}</div>
<div class="row-value">50</div> <div class="row-value">{{row.groupCount}}</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<AiEmpty v-else/>
</div> </div>
</template> </template>
@@ -44,10 +45,9 @@
data() { data() {
return { return {
deptList: [], deptList: [],
current: 1,
pages: 2,
list: [], list: [],
activeIndex: null activeIndex: null,
totalInfo: {}
} }
}, },
computed: { computed: {
@@ -56,27 +56,36 @@
onLoad() { onLoad() {
this.deptList = [{name: this.user.departName, id: this.user.departId}] this.deptList = [{name: this.user.departName, id: this.user.departId}]
this.getList() this.getList()
this.getTotal()
uni.$on('updateGroup', () => {
this.getList()
this.getTotal()
})
}, },
onShow() { onShow() {
document.title = '群标签' document.title = '群标签'
}, },
methods: { methods: {
getListInit() { getListInit() {
this.current = 1
this.pages = 2
this.getList() this.getList()
this.getTotal()
}, },
getList() { getList() {
if(this.current > this.pages) return this.$http.post(`/app/wxcp/wxgroupchattag/listAllByDeptId?departId=${this.deptList[0].id}`).then(res=> {
this.$http.post(`/app/wxcp/wxgroupchattag/listAll?current=${this.current}`).then(res=> {
if(res?.data) { if(res?.data) {
this.list = this.current == 1? res.data.records : [...this.list,...res.data.records] this.list = res.data
this.pages = res.data.pages }
})
},
getTotal() {
this.$http.post(`/app/wxcp/wxgroupchattag/simpleStatistics?departId=${this.deptList[0].id}`).then(res=> {
if(res?.data) {
this.totalInfo = res.data
} }
}) })
}, },
toGrouping(row) { toGrouping(row) {
uni.navigateTo({url: `./groupGrouping?name=${row.name}&id=${row.taggroupId}`}) uni.navigateTo({url: `./groupGrouping?name=${row.name}&tagId=${row.id}&departId=${this.deptList[0].id}`})
}, },
viewList(index) { viewList(index) {
if(this.activeIndex == index) { if(this.activeIndex == index) {
@@ -85,10 +94,6 @@
this.activeIndex = index this.activeIndex = index
} }
}, },
onReachBottom() {
this.current ++
this.getList()
}
} }
</script> </script>

View File

@@ -5,7 +5,7 @@
search-icon-color="#999" color="#333" height="58" @search="getListInit" @clear="getListInit"> search-icon-color="#999" color="#333" height="58" @search="getListInit" @clear="getListInit">
</u-search> </u-search>
</AiTopFixed> </AiTopFixed>
<div class="list-content"> <div class="list-content" v-if="list.length">
<div class="item" v-for="(item, index) in list" :key="index"> <div class="item" v-for="(item, index) in list" :key="index">
<img :src="item.qrCode" alt="" class="group-img"> <img :src="item.qrCode" alt="" class="group-img">
<div class="item-right"> <div class="item-right">
@@ -17,6 +17,7 @@
</div> </div>
</div> </div>
</div> </div>
<AiEmpty v-else/>
<AiAdd @add="add"/> <AiAdd @add="add"/>
</div> </div>
</template> </template>
@@ -30,9 +31,10 @@
keyword: '', keyword: '',
titleName: '', titleName: '',
tagId: '', tagId: '',
departId: '',
current: 1, current: 1,
pages: 2, pages: 2,
list: [] list: [],
} }
}, },
computed: { computed: {
@@ -40,8 +42,12 @@
}, },
onLoad(option) { onLoad(option) {
this.titleName = option.name this.titleName = option.name
this.tagId = option.id this.tagId = option.tagId
this.departId = option.departId
this.getList()
uni.$on('updateGroup', () => {
this.getListInit() this.getListInit()
})
}, },
onShow() { onShow() {
document.title = this.titleName document.title = this.titleName
@@ -54,10 +60,10 @@
}, },
getList() { getList() {
if(this.current > this.pages) return if(this.current > this.pages) return
this.$http.post(`/app/wxcp/wxgroup/list?current=${this.current}&groupName=${this.keyword}&size=10`).then(res=> { this.$http.post(`/app/wxcp/wxgroupchattag/queryGroupByTagId?tagId=${this.tagId}&departId=${this.departId}&name=${this.keyword}&current=${this.current}`).then(res=> {
if(res?.data) { if(res?.data) {
this.list = this.current == 1? res.data.records : [...this.list,...res.data.records] this.list = this.current == 1 ? res.data.records : [...this.list, ...rs,data.records]
this.pages = res.data.pages this.pages = res.data.total
} }
}) })
}, },
@@ -72,8 +78,8 @@
}) })
}, },
add() { add() {
uni.navigateTo({url: `./groupList`}) uni.navigateTo({url: `./groupList?tagId=${this.tagId}&departId=${this.departId}`})
} },
}, },
onReachBottom() { onReachBottom() {
this.current ++ this.current ++

View File

@@ -5,16 +5,18 @@
search-icon-color="#999" color="#333" height="58" @search="getListInit" @clear="getListInit"> search-icon-color="#999" color="#333" height="58" @search="getListInit" @clear="getListInit">
</u-search> </u-search>
</AiTopFixed> </AiTopFixed>
<div class="list-content"> <div class="list-content" v-if="list.length">
<div class="item" v-for="(item, index) in 20" :key="index"> <div class="item" v-for="(item, index) in list" :key="index">
<img src="./imgs/xz.png" alt="" class="choose-img" @click="checkClick(index)"> <img src="./imgs/xzh.png" alt="" class="choose-img" v-if="item.isCheck" @click="checkClick(index)">
<img src="./imgs/xz.png" alt="" class="choose-img" v-else @click="checkClick(index)">
<div class="item-right"> <div class="item-right">
<img src="./imgs/user-img.png" alt=""> <img src="./imgs/user-img.png" alt="">
<p>222222{{index}}</p> <p>{{item.name}}</p>
</div> </div>
</div> </div>
</div> </div>
<div class="footer"> <AiEmpty v-else/>
<div class="footer" @click="confirm">
<div>确定</div> <div>确定</div>
</div> </div>
</div> </div>
@@ -26,27 +28,76 @@
appName: '群列表', appName: '群列表',
data() { data() {
return { return {
tagId: '',
departId: '',
current: 1,
pages: 2,
list: [],
keyword: ''
} }
}, },
computed: { computed: {
...mapState(['user']), ...mapState(['user']),
}, },
onLoad(option) {
this.tagId = option.tagId
this.departId = option.departId
this.getList()
},
onShow() { onShow() {
document.title = '群列表' document.title = '群列表'
}, },
methods: { methods: {
getTotal() { getListInit() {
this.$http.post(`/app/appwxuserfamiliarityrate/wxTopStatistics`).then(res=> { this.current = 1
this.pages = 2
this.getList()
},
getList() {
if(this.current > this.pages) return
this.$http.post(`/app/wxcp/wxgroupchattag/queryGroupByDeptId?tagId=${this.tagId}&departId=${this.departId}&name=${this.keyword}`).then(res=> {
if(res?.data) { if(res?.data) {
this.form = {...res.data} res.data.records.map((item) => {
item.isCheck = false
})
this.list = this.current == 1 ? res.data.records : [...this.list, ...rs,data.records]
this.pages = res.data.total
} }
}) })
}, },
checkClick(index) { checkClick(index) {
this.list[index].isCheck = !this.list[index].isCheck
},
confirm() {
var ids = []
this.list.map((item) => {
if(item.isCheck) {
ids.push(item.id)
}
})
if(!ids.length) {
return this.$u.toast('请选择群')
}
var tagIds = [this.tagId]
this.$http.post(`/app/wxcp/wxgroupchattag/markTagForWeb`, {
tagIds: tagIds,
groupIds: ids,
type: 0
}).then(res=> {
if(res.code == 0) {
uni.$emit('updateGroup')
this.$u.toast('提交成功')
setTimeout(() => {
uni.navigateBack()
}, 1000)
}
})
} }
}, },
onReachBottom() {
this.current++
this.getList()
}
} }
</script> </script>