|
|
@@ -10,9 +10,9 @@
|
|
|
<i class="iconfont icon-sousuo"></i>
|
|
|
</span>
|
|
|
</div>
|
|
|
- <div class="attention-bus-list" v-if="attentionList.length > 0">
|
|
|
+ <div class="attention-bus-list" v-if="attentionList.content.length > 0">
|
|
|
<ul>
|
|
|
- <li v-for="(item, index) in attentionList" v-bind:key="index">
|
|
|
+ <li v-for="(item, index) in attentionList.content" v-bind:key="index">
|
|
|
<div class="item">
|
|
|
<div class="name">
|
|
|
{{ item.nameCn | filterStr}}
|
|
|
@@ -25,7 +25,7 @@
|
|
|
</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
- <div class="none-state" v-if="!isSearchSearchingMore && attentionList.length === 0">
|
|
|
+ <div class="none-state" v-if="!isSearchSearchingMore && attentionList.content.length === 0">
|
|
|
<img src="/images/mobile/@2x/search-empty.png">
|
|
|
<p>暂无数据</p>
|
|
|
<nuxt-link to="/">返回首页</nuxt-link>
|
|
|
@@ -39,15 +39,22 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+ import axios from '~/plugins/axios'
|
|
|
import { RemindBox, PullUp } from '~components/mobile/common'
|
|
|
export default {
|
|
|
name: 'attention-Bus',
|
|
|
layout: 'mobile',
|
|
|
middleware: 'authenticated',
|
|
|
- fetch({store}) {
|
|
|
- return Promise.all([
|
|
|
- store.dispatch('product/getUserCollectCode', {keyword: '', count: 20, page: 1, type: 'yes', enUU: store.state.option.user.data.enterprise.uu})
|
|
|
- ])
|
|
|
+ // fetch({store}) {
|
|
|
+ // return Promise.all([
|
|
|
+ // store.dispatch('product/getUserCollectCode', {keyword: '', count: 20, page: 1, type: 'yes', enUU: store.state.option.user.data.enterprise.uu})
|
|
|
+ // ])
|
|
|
+ // },
|
|
|
+ async asyncData({store}) {
|
|
|
+ let {data} = await axios.get('/produce/kindConcern/kindList', { params: {keyword: '', count: 20, page: 1, type: 'yes', enUU: store.state.option.user.data.enterprise.uu} })
|
|
|
+ return {
|
|
|
+ attentionList: data
|
|
|
+ }
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
@@ -61,23 +68,23 @@
|
|
|
isSearchSearchingMore: false
|
|
|
}
|
|
|
},
|
|
|
- watch: {
|
|
|
- 'getkindConcernList.data': {
|
|
|
- handler: function (val) {
|
|
|
- if (this.isChange) {
|
|
|
- this.attentionList = val.content
|
|
|
- this.isChange = false
|
|
|
- } else {
|
|
|
- this.attentionList = [...this.attentionList, ...val.content]
|
|
|
- }
|
|
|
- this.isSearchSearchingMore = false
|
|
|
- },
|
|
|
- immediate: true
|
|
|
- }
|
|
|
- },
|
|
|
+ // watch: {
|
|
|
+ // 'getkindConcernList.data': {
|
|
|
+ // handler: function (val) {
|
|
|
+ // if (this.isChange) {
|
|
|
+ // this.attentionList = val.content
|
|
|
+ // this.isChange = false
|
|
|
+ // } else {
|
|
|
+ // this.attentionList = [...this.attentionList, ...val.content]
|
|
|
+ // }
|
|
|
+ // this.isSearchSearchingMore = false
|
|
|
+ // },
|
|
|
+ // immediate: true
|
|
|
+ // }
|
|
|
+ // },
|
|
|
computed: {
|
|
|
allPage() {
|
|
|
- return Math.ceil(this.$store.state.product.component.collectCode.data.totalElements / 10)
|
|
|
+ return Math.ceil(this.attentionList.totalElements / 10)
|
|
|
},
|
|
|
getkindConcernList() {
|
|
|
return this.$store.state.product.component.collectCode
|
|
|
@@ -109,8 +116,8 @@
|
|
|
this.$http.post('/produce/kindConcern/modify', param).then(res => {
|
|
|
this.collectResult = '取消成功'
|
|
|
this.timeoutCount++
|
|
|
- // kindConcern.status = 0
|
|
|
- this.$store.dispatch('product/UpdateCollectCode', { key: index, status: 0 })
|
|
|
+ kindConcern.status = 0
|
|
|
+ // this.$store.dispatch('product/UpdateCollectCode', { key: index, status: 0 })
|
|
|
// this.attentionList.splice(index, 1)
|
|
|
// if (this.attentionList.length <= 15 && this.page < this.allPage) {
|
|
|
// this.page++
|
|
|
@@ -121,7 +128,8 @@
|
|
|
this.$http.post('/produce/kindConcern/modify', param).then(res => {
|
|
|
this.collectResult = '关注成功'
|
|
|
this.timeoutCount++
|
|
|
- this.$store.dispatch('product/UpdateCollectCode', {key: index, status: 1})
|
|
|
+ kindConcern.status = 1
|
|
|
+ // this.$store.dispatch('product/UpdateCollectCode', {key: index, status: 1})
|
|
|
// this.attentionList.splice(index, 1)
|
|
|
// if (this.attentionList.length <= 15 && this.page < this.allPage) {
|
|
|
// this.page++
|
|
|
@@ -130,13 +138,15 @@
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- getAttentionListArray(page) {
|
|
|
+ async getAttentionListArray(page) {
|
|
|
this.isSearchSearchingMore = true
|
|
|
- if (this.activeType === 'attention') {
|
|
|
- this.$store.dispatch('product/getUserCollectCode', {keyword: this.keyword, count: 20, page: page, enUU: this.$store.state.option.user.data.enterprise.uu})
|
|
|
- } else {
|
|
|
- this.$store.dispatch('product/getUserCollectCode', {keyword: this.keyword, count: 20, page: page, enUU: this.$store.state.option.user.data.enterprise.uu})
|
|
|
- }
|
|
|
+ let {data} = await axios.get('/produce/kindConcern/kindList', { params: {keyword: '', count: 20, page: page, type: 'yes', enUU: this.$store.state.option.user.data.enterprise.uu} })
|
|
|
+ this.attentionList.content = [...this.attentionList.content, ...data.content]
|
|
|
+ // if (this.activeType === 'attention') {
|
|
|
+ // this.$store.dispatch('product/getUserCollectCode', {keyword: this.keyword, count: 20, page: page, enUU: this.$store.state.option.user.data.enterprise.uu})
|
|
|
+ // } else {
|
|
|
+ // this.$store.dispatch('product/getUserCollectCode', {keyword: this.keyword, count: 20, page: page, enUU: this.$store.state.option.user.data.enterprise.uu})
|
|
|
+ // }
|
|
|
},
|
|
|
getMoreSearch() {
|
|
|
this.page++
|