Commit c85a9793 c85a9793b6cb095e95d74a6b6f2cd4b22402942e by yangjun@hikoon.cn

1

1 parent 352c6568
1 <template> 1 <template>
2 <div @click="handleGroupClick" class="scroll-container"> 2 <div @click="handleGroupClick" class="scroll-container">
3 <div class="group-item"> 3 <div class="group-item">
4 <avatar :src="group.avatar"/> 4 <avatar src=""/>
5 <div class="group-name text-ellipsis">{{ title }}</div> 5 <div class="group-name text-ellipsis">{{ group.title }}</div>
6 </div> 6 </div>
7 </div> 7 </div>
8 </template> 8 </template>
...@@ -24,27 +24,22 @@ export default { ...@@ -24,27 +24,22 @@ export default {
24 ] 24 ]
25 } 25 }
26 }, 26 },
27 computed: {
28 title() {
29 return (this.group.activity_type === 1 ? '推广' : '征集') + ' - ' + this.group.song_name.replace('《', '').replace('》', '')
30 }
31 },
32 methods: { 27 methods: {
33 handleGroupClick() { 28 handleGroupClick() {
34 if (this.group.is_join === 1) { 29 if (this.group.is_join === 0) {
35 const conversationID = `GROUP${this.group.esm_id}` 30 MessageBox.confirm('是否加入讨论组:' + this.group.title, '提示', {
36 this.$store.dispatch('checkoutConversation', conversationID)
37 } else {
38 MessageBox.confirm('是否加入讨论组:' + this.title, '提示', {
39 type: 'warning', showClose: false 31 type: 'warning', showClose: false
40 }).then(() => { 32 }).then(() => {
41 Helper.joinGroup(this.group.id).then(() => { 33 Helper.joinGroup(this.group.group_id).then(() => {
42 this.group.is_join = 1 34 this.group.is_join = 1
43 this.handleGroupClick() 35 this.handleGroupClick()
44 }) 36 })
45 }).catch(() => { 37 }).catch(() => {
46 38
47 }) 39 })
40 } else {
41 const conversationID = `GROUP${this.group.group_id}`
42 this.$store.dispatch('checkoutConversation', conversationID)
48 } 43 }
49 }, 44 },
50 quitGroup() { 45 quitGroup() {
......
1 <template> 1 <template>
2 <div class="list-container" 2 <div class="list-container">
3 v-loading="hideSearchLoading"
4 element-loading-text="拼命搜索中"
5 element-loading-background="rgba(0, 0, 0, 0.8)">
6 <div class="header-bar"> 3 <div class="header-bar">
7 <el-input v-model="search" size="mini" placeholder="筛选群名" prefix-icon="el-icon-search"/> 4 <el-input v-model="search" @keyup.enter.native="handleSearch" @clear="handleSearch" :clearable="true" size="mini"
5 placeholder="筛选群名"
6 prefix-icon="el-icon-search"/>
8 7
9 <!-- <el-autocomplete--> 8 <!-- <el-autocomplete-->
10 <!-- :value-key="'groupID'"--> 9 <!-- :value-key="'groupID'"-->
...@@ -24,9 +23,12 @@ ...@@ -24,9 +23,12 @@
24 <!-- </button>--> 23 <!-- </button>-->
25 </div> 24 </div>
26 <div class="group-container" v-infinite-scroll="fetch" :infinite-scroll-immediate="true" 25 <div class="group-container" v-infinite-scroll="fetch" :infinite-scroll-immediate="true"
26 v-loading="hideSearchLoading"
27 element-loading-text="拼命搜索中"
28 element-loading-background="rgba(0, 0, 0, 0.4)"
27 :infinite-scroll-delay="100" 29 :infinite-scroll-delay="100"
28 style="height: calc(80vh - 60px)"> 30 style="height: calc(80vh - 60px)">
29 <group-item v-for="group in groupList" :key="group.esm_id" :group="group"/> 31 <group-item v-for="group in groupList" :key="group.group_id" :group="group"/>
30 <!-- <el-dialog title="创建群组" :visible="createGroupModelVisible" @close="closeCreateGroupModel" width="30%">--> 32 <!-- <el-dialog title="创建群组" :visible="createGroupModelVisible" @close="closeCreateGroupModel" width="30%">-->
31 <!-- <create-group></create-group>--> 33 <!-- <create-group></create-group>-->
32 <!-- </el-dialog>--> 34 <!-- </el-dialog>-->
...@@ -56,9 +58,6 @@ export default { ...@@ -56,9 +58,6 @@ export default {
56 // CreateGroup, 58 // CreateGroup,
57 // ElAutocomplete: Autocomplete 59 // ElAutocomplete: Autocomplete
58 }, 60 },
59 mounted() {
60
61 },
62 computed: { 61 computed: {
63 groupList: function () { 62 groupList: function () {
64 return this.$store.state.group.groupList 63 return this.$store.state.group.groupList
...@@ -75,9 +74,13 @@ export default { ...@@ -75,9 +74,13 @@ export default {
75 methods: { 74 methods: {
76 fetch() { 75 fetch() {
77 Helper.groupList({ 76 Helper.groupList({
78 activityNameLike: this.search, size: this.size, page: this.page 77 title: this.search, size: this.size, page: this.page
79 }).then(res => { 78 }).then(res => {
80 this.onGroupUpdated(this.groupList.concat(res.data)) 79 if (this.page === 1) {
80 this.onGroupUpdated(res.data)
81 } else {
82 this.onGroupUpdated(this.groupList.concat(res.data))
83 }
81 ++this.page 84 ++this.page
82 }).finally(() => { 85 }).finally(() => {
83 this.hideSearchLoading = false 86 this.hideSearchLoading = false
...@@ -112,6 +115,11 @@ export default { ...@@ -112,6 +115,11 @@ export default {
112 showCreateGroupModel() { 115 showCreateGroupModel() {
113 this.$store.commit('updateCreateGroupModelVisible', true) 116 this.$store.commit('updateCreateGroupModelVisible', true)
114 }, 117 },
118 handleSearch() {
119 this.page = 1
120 this.hideSearchLoading = true
121 this.fetch()
122 },
115 applyJoinGroup(group) { 123 applyJoinGroup(group) {
116 this.tim 124 this.tim
117 .joinGroup({groupID: group.groupID}) 125 .joinGroup({groupID: group.groupID})
...@@ -153,7 +161,8 @@ export default { ...@@ -153,7 +161,8 @@ export default {
153 }, 161 },
154 watch: { 162 watch: {
155 'search'() { 163 'search'() {
156 this.fetch() 164 // this.page = 1
165 // this.fetch()
157 } 166 }
158 } 167 }
159 } 168 }
......