|
|
@@ -0,0 +1,249 @@
|
|
|
+<template>
|
|
|
+ <div class="attention-bus-wrap" id="attention-bus-wrap">
|
|
|
+ <div class="product-switch-item">
|
|
|
+ <span :class="activeType==='attention'?'mobile-switch-btn active':'mobile-switch-btn'" @click="ChangeTab('attention')">已关注</span>
|
|
|
+ <span :class="activeType==='isattention'?'mobile-switch-btn active':'mobile-switch-btn'" @click="ChangeTab('isattention')">未关注</span>
|
|
|
+ </div>
|
|
|
+ <div class="search-content" style="padding-bottom: 0.25rem">
|
|
|
+ <input type="text" placeholder="请输入您要查找的品牌或型号" v-model="keyword" @keyup.13="searchSeek">
|
|
|
+ <span @click="searchSeek" >
|
|
|
+ <i class="iconfont icon-sousuo"></i>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <div class="attention-bus-list">
|
|
|
+ <ul>
|
|
|
+ <li v-for="item in attentionList">
|
|
|
+ <div class="item">
|
|
|
+ <div class="name">
|
|
|
+ {{ item.nameCn | filterStr}}
|
|
|
+ </div>
|
|
|
+ <div class="attention-button" @click="attentionFn(item)">
|
|
|
+ <i class="iconfont icon-shoucang" :class="{'active': item.status}"></i>
|
|
|
+ <p v-if="item.status === 1">取消关注</p>
|
|
|
+ <p v-else>关注</p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ <div class="fixedAlert" v-show="isShowAlert">
|
|
|
+ 关注类目,商机无限!
|
|
|
+ <i class="iconfont icon-guanbi" @click="isShowAlert = false"></i>
|
|
|
+ </div>
|
|
|
+ <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
|
|
|
+ <pull-up :fixId="'attention-bus-wrap'" :searchMore="isSearchSearchingMore" :allPage="allPage" :page="page" @pullUpAction="getMoreSearch"></pull-up>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+ 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: 10, page: 1, type: 'yes', enUU: store.state.option.user.data.enterprise.uu})
|
|
|
+ ])
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ activeType: 'attention',
|
|
|
+ keyword: '',
|
|
|
+ collectResult: '',
|
|
|
+ timeoutCount: 0,
|
|
|
+ page: 1,
|
|
|
+ attentionList: [],
|
|
|
+ isShowAlert: true,
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ allPage() {
|
|
|
+ return Math.ceil(this.$store.state.product.component.collectCode.data.totalElements / 10)
|
|
|
+ },
|
|
|
+ getkindConcernList() {
|
|
|
+ return this.$store.state.product.component.collectCode
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ ChangeTab(a) {
|
|
|
+ this.activeType = a
|
|
|
+ this.attentionList = []
|
|
|
+ this.page = 1
|
|
|
+ this.getAttentionListArray(this.page)
|
|
|
+ },
|
|
|
+ searchSeek() {
|
|
|
+ this.page = 0
|
|
|
+ this.attentionList = []
|
|
|
+ this.getMoreSearch()
|
|
|
+ },
|
|
|
+ attentionFn(item) {
|
|
|
+ if (item.status === 1) {
|
|
|
+ this.$http.post('/kind/concern', {kindConcern: item, type: 'del'}).then(res => {
|
|
|
+ this.collectResult = '取消成功'
|
|
|
+ this.timeoutCount++
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$http.post('/kind/concern', {indConcern: item, type: 'add'}).then(res => {
|
|
|
+ this.collectResult = '关注成功'
|
|
|
+ this.timeoutCount++
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getAttentionListArray(page) {
|
|
|
+ this.isSearchSearchingMore = true
|
|
|
+ if (this.activeType === 'attention') {
|
|
|
+ this.$store.dispatch('product/getUserCollectCode', {keyword: this.keyword, count: 10, page: page, type: 'yes', enUU: this.$store.state.option.user.data.enterprise.uu})
|
|
|
+ } else {
|
|
|
+ this.$store.dispatch('product/getUserCollectCode', {keyword: this.keyword, count: 10, page: page, type: 'no', enUU: this.$store.state.option.user.data.enterprise.uu})
|
|
|
+ }
|
|
|
+ },
|
|
|
+ getMoreSearch() {
|
|
|
+ this.page++
|
|
|
+ this.getAttentionListArray(this.page)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ components: {
|
|
|
+ RemindBox,
|
|
|
+ PullUp
|
|
|
+ },
|
|
|
+ filters: {
|
|
|
+ filterStr(val) {
|
|
|
+ if (val.length > 30) {
|
|
|
+ return val.substr(0, 30) + '...'
|
|
|
+ }
|
|
|
+ return val
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+<style scoped lang='scss'>
|
|
|
+ .attention-bus-wrap {
|
|
|
+ background: #f1f3f6;
|
|
|
+ margin: 1.26rem 0 0.98rem 0;
|
|
|
+ height: calc(100vh - 1.26rem - 0.98rem);
|
|
|
+ overflow-y: auto;
|
|
|
+ padding-bottom: 0.2rem;
|
|
|
+ .product-switch-item {
|
|
|
+ text-align: center;
|
|
|
+ background: #fff;
|
|
|
+ border-bottom: 1px solid #d8d8d8;
|
|
|
+ box-shadow: 0 1px 3px #ddd;
|
|
|
+ .mobile-switch-btn {
|
|
|
+ background: #fff;
|
|
|
+ color: #333;
|
|
|
+ display: inline-block;
|
|
|
+ height: .72rem;
|
|
|
+ line-height: .72rem;
|
|
|
+ font-size: .28rem;
|
|
|
+ width: 1.4rem;
|
|
|
+ &:first-child {
|
|
|
+ margin-right: 1.78rem;
|
|
|
+ }
|
|
|
+ &.active {
|
|
|
+ color: #3f84f6;
|
|
|
+ border-bottom: .04rem solid #3f84f6;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .search-content {
|
|
|
+ text-align: center;
|
|
|
+ padding: .25rem 0 0 0;
|
|
|
+ input {
|
|
|
+ width: 7.1rem;
|
|
|
+ border: 1px solid #376ff3;
|
|
|
+ }
|
|
|
+ span {
|
|
|
+ height: .46rem;
|
|
|
+ line-height: .46rem;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .attention-bus-list {
|
|
|
+ border: 0.01rem solid #e3e5e8;
|
|
|
+ border-radius: 4px;
|
|
|
+ background: #fff;
|
|
|
+ width: 7.1rem;
|
|
|
+ margin: 0 auto;
|
|
|
+ ul {
|
|
|
+ li {
|
|
|
+ display: table;
|
|
|
+ border-bottom: 1px solid #d3d3d3;
|
|
|
+ margin: 0 0.24rem;
|
|
|
+ height: 1.1rem;
|
|
|
+ &:nth-last-of-type(1) {
|
|
|
+ border-bottom: 0;
|
|
|
+ }
|
|
|
+ div {
|
|
|
+ display: table-cell;
|
|
|
+ vertical-align: middle;
|
|
|
+ position: relative;
|
|
|
+ word-wrap: break-word;
|
|
|
+ &.name {
|
|
|
+ font-size: 0.28rem;
|
|
|
+ color: #666;
|
|
|
+ width: 5.48rem;
|
|
|
+ overflow : hidden;
|
|
|
+ }
|
|
|
+ &.attention-button {
|
|
|
+ width: 1.2rem;
|
|
|
+ font-size: 0.24rem;
|
|
|
+ color: #666;
|
|
|
+ text-align: center;
|
|
|
+ .icon-shoucang {
|
|
|
+ &.active {
|
|
|
+ color: #ff7800
|
|
|
+ }
|
|
|
+ color: #dadada;
|
|
|
+ font-size: 0.5rem;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .fixedAlert {
|
|
|
+ position: fixed;
|
|
|
+ z-index: 11;
|
|
|
+ width: 4.91rem;
|
|
|
+ height: 0.7rem;
|
|
|
+ line-height:0.7rem;
|
|
|
+ left: 50%;
|
|
|
+ margin-left: -2.455rem;
|
|
|
+ background: rgba(82, 147, 255, 0.9);
|
|
|
+ border-radius: 0.7rem;
|
|
|
+ font-size: 0.32rem;
|
|
|
+ color: #fff;
|
|
|
+ text-align: center;
|
|
|
+ top: 2.6rem;
|
|
|
+ i {
|
|
|
+ font-size: 0.4rem;
|
|
|
+ position: absolute;
|
|
|
+ right: -0.15rem;
|
|
|
+ top: -0.28rem;
|
|
|
+ color: rgba(61, 61, 61, 0.76);
|
|
|
+ &:after {
|
|
|
+ position: absolute;
|
|
|
+ top: -0.1rem;
|
|
|
+ right: -0.1rem;
|
|
|
+ left: -0.1rem;
|
|
|
+ bottom: -0.1rem;
|
|
|
+ content: ' ';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|