| "pages/msgModule/index", | "pages/msgModule/index", | ||||
| "pages/index/components/listDetails/Details", | "pages/index/components/listDetails/Details", | ||||
| "pages/index/components/homepage/homepage", | "pages/index/components/homepage/homepage", | ||||
| "pages/myModule/components/myRelease/myRelease" | |||||
| "pages/myModule/components/myRelease/myRelease", | |||||
| "pages/myModule/components/myAttention/myAttention" | |||||
| ], | ], | ||||
| "usingComponents": { | "usingComponents": { | ||||
| "tabBar": "/components/tabbar/tabbar", | "tabBar": "/components/tabbar/tabbar", |
| * 组件的属性列表 | * 组件的属性列表 | ||||
| */ | */ | ||||
| properties: { | properties: { | ||||
| // 数据 | |||||
| item: { | item: { | ||||
| type: Object, | type: Object, | ||||
| }, | }, | ||||
| type: String, | type: String, | ||||
| default: 'index', | default: 'index', | ||||
| }, | }, | ||||
| // 是否收藏 | |||||
| isCollect:{ | |||||
| type:Boolean, | |||||
| default:false | |||||
| }, | |||||
| // 类名 | |||||
| listClass:{ | |||||
| type:String, | |||||
| default:"", | |||||
| }, | |||||
| }, | }, | ||||
| /** | /** | ||||
| * 组件的初始数据 | * 组件的初始数据 | ||||
| */ | */ | ||||
| data: { | data: { | ||||
| // 是否收藏 | |||||
| isCollect:false, | |||||
| }, | }, | ||||
| /** | /** | ||||
| methods: { | methods: { | ||||
| // 进入详情 | // 进入详情 | ||||
| goDetails(e) { | goDetails(e) { | ||||
| if(this.data.listClass == 'disabled-model-view'){ | |||||
| return | |||||
| } | |||||
| let dataset = e.currentTarget.dataset; | let dataset = e.currentTarget.dataset; | ||||
| this.triggerEvent('getItem', dataset.item); | this.triggerEvent('getItem', dataset.item); | ||||
| }, | }, | ||||
| } | } | ||||
| }) | }) | ||||
| }, | }, | ||||
| // 收藏 | |||||
| productCollect(e){ | |||||
| this.triggerEvent('changeCollect'); | |||||
| }, | |||||
| } | } | ||||
| }) | }) |
| <!-- components/listItem/listItem.wxml --> | <!-- components/listItem/listItem.wxml --> | ||||
| <!-- 置顶 --> | |||||
| <image class="ontop-img" src="/images/home/ontop-icon.png" wx:if="{{ (pageStatus == 'homepage' || pageStatus == 'myRelease') && item.isOnTop == 1}}"/> | |||||
| <!-- 平台认证 --> | |||||
| <view class="list-certification" wx:if="{{ item.isPartner }}"> | |||||
| <image class="certification-img" src="/images/home/certification-icon.png" /> | |||||
| 平台认证 | |||||
| </view> | |||||
| <!-- 头部 --> | |||||
| <view class="list-avatar" wx:if="{{ pageStatus != 'homepage' && pageStatus != 'myRelease' }}"> | |||||
| <view class="list-chatHeads fl"> | |||||
| <image class="chatHeads-img" src="{{ item.chatHeads }}" /> | |||||
| <view class="{{ listClass }}"> | |||||
| <!-- 置顶 --> | |||||
| <image class="ontop-img" src="/images/home/ontop-icon.png" wx:if="{{ (pageStatus == 'homepage' || pageStatus == 'myRelease') && item.isOnTop == 1}}" /> | |||||
| <!-- 平台认证 --> | |||||
| <view class="list-certification" wx:if="{{ item.isPartner && listClass != 'disabled-model-view' }}"> | |||||
| <image class="certification-img" src="/images/home/certification-icon.png" /> | |||||
| 平台认证 | |||||
| </view> | </view> | ||||
| <view class="list-nick-name fl">{{ item.nickName }}</view> | |||||
| <view class="list-home fl" bindtap="goHomePage" data-customerid="{{ item.customerId }}"> | |||||
| <image class="home-img" src="{{ item.isPartner ? '/images/home/company-icon.png' : '/images/home/personal-icon.png' }}" /> | |||||
| 主页 | |||||
| </view> | |||||
| </view> | |||||
| <!-- 内容 --> | |||||
| <view class="list-content"> | |||||
| <view bindtap="goDetails" data-item="{{ item }}"> | |||||
| <!-- 详情 --> | |||||
| <view> | |||||
| <text space class="list-details-text" user-select wx:if="{{ pageStatus == 'detatil' || pageStatus == 'myRelease' }}">{{ item.info }}</text> | |||||
| <text wx:else class="list-details-text need">{{ item.info }}</text> | |||||
| <!-- 头部 --> | |||||
| <view class="list-avatar" wx:if="{{ pageStatus != 'homepage' && pageStatus != 'myRelease' }}"> | |||||
| <view class="list-chatHeads fl"> | |||||
| <image class="chatHeads-img" src="{{ item.chatHeads }}" /> | |||||
| </view> | </view> | ||||
| <!-- 标签 --> | |||||
| <view class="list-tag-view"> | |||||
| <view class="list-tag" wx:for="{{ item.type }}" wx:for-item="tag" wx:key="*this"> | |||||
| {{ tag }} | |||||
| </view> | |||||
| <view class="list-nick-name fl">{{ item.nickName }}</view> | |||||
| <view class="list-home fl" bindtap="goHomePage" data-customerid="{{ item.customerId }}"> | |||||
| <image class="home-img" src="{{ item.isPartner ? '/images/home/company-icon.png' : '/images/home/personal-icon.png' }}" /> | |||||
| 主页 | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <!-- 底部 --> | |||||
| <view class="list-foot {{ pageStatus == 'detatil' ? 'is-details-page' : '' }}"> | |||||
| <view class="fl list-foot-text-lf"> | |||||
| <image class="time-img" src="/images/home/time-icon.png" /> | |||||
| {{ item.createdOn }} | |||||
| </view> | |||||
| <view class="fl list-foot-text-lf"> | |||||
| <image class="browse-img" src="/images/home/browse-icon.png" /> | |||||
| {{ item.pageView }}浏览量 | |||||
| </view> | |||||
| <view class="fl list-collect-view" wx:if="{{ pageStatus == 'detatil' }}"> | |||||
| <image class="collect-img" src="/images/home/is-collect.png" wx:if="{{ isCollect }}" /> | |||||
| <image class="collect-img" src="/images/home/not-collect.png" wx:else /> | |||||
| 收藏 | |||||
| <!-- 内容 --> | |||||
| <view class="list-content"> | |||||
| <view bindtap="goDetails" data-item="{{ item }}"> | |||||
| <!-- 详情 --> | |||||
| <view> | |||||
| <text space class="list-details-text" user-select wx:if="{{ pageStatus == 'detatil' || pageStatus == 'myRelease' }}"> | |||||
| {{ item.info }} | |||||
| </text> | |||||
| <text space wx:elif="{{ pageStatus == 'myCollect' }}" class="list-details-text need"><text style="color:red">{{ item.isDeleted > 0 ? '【已删除】' : item.state < 0 ? '【已下架】' : '' }}</text>{{ item.info }} | |||||
| </text> | |||||
| <text space wx:else class="list-details-text need">{{ item.info }}</text> | |||||
| </view> | |||||
| <!-- 标签 --> | |||||
| <view class="list-tag-view"> | |||||
| <view class="list-tag" wx:for="{{ item.type }}" wx:for-item="tag" wx:key="*this"> | |||||
| {{ tag }} | |||||
| </view> | |||||
| </view> | |||||
| </view> | </view> | ||||
| <view class="fr list-foot-text-chat" wx:if="{{ pageStatus != 'myRelease' }}"> | |||||
| <image class="chat-img" src="/images/home/chat-icon.png" /> | |||||
| 聊一聊 | |||||
| <!-- 底部 --> | |||||
| <view class="list-foot {{ pageStatus == 'detatil' ? 'is-details-page' : '' }}"> | |||||
| <view class="fl list-foot-text-lf"> | |||||
| <image class="time-img" src="/images/home/time-icon.png" /> | |||||
| {{ item.createdOn }} | |||||
| </view> | |||||
| <view class="fl list-foot-text-lf"> | |||||
| <image class="browse-img" src="/images/home/browse-icon.png" /> | |||||
| {{ item.pageView }}浏览量 | |||||
| </view> | |||||
| <view class="fl list-collect-view" wx:if="{{ pageStatus == 'detatil' }}" bindtap="productCollect"> | |||||
| <image class="collect-img" src="/images/home/is-collect.png" wx:if="{{ isCollect }}" /> | |||||
| <image class="collect-img" src="/images/home/not-collect.png" wx:else /> | |||||
| 收藏 | |||||
| </view> | |||||
| <view class="fr list-foot-text-chat" wx:if="{{ pageStatus != 'myRelease' }}"> | |||||
| <image class="chat-img" src="/images/home/chat-icon.png" /> | |||||
| 聊一聊 | |||||
| </view> | |||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| </view> | </view> |
| top: 0; | top: 0; | ||||
| width: 67rpx; | width: 67rpx; | ||||
| height: 62rpx; | height: 62rpx; | ||||
| } | |||||
| .disabled-model-view .list-foot-text-chat{ | |||||
| background-color: #818181!important; | |||||
| } | |||||
| .disabled-model-view .list-tag{ | |||||
| background: #ededed!important; | |||||
| color: #9d9d9d!important; | |||||
| } | |||||
| .disabled-model-view .list-details-text{ | |||||
| color: #999!important; | |||||
| } | } |
| data: { | data: { | ||||
| // 页面Loading | // 页面Loading | ||||
| pageLoading: false, | pageLoading: false, | ||||
| customerId: "666678", | |||||
| // 路由接受的参数 | // 路由接受的参数 | ||||
| currentData: {}, | currentData: {}, | ||||
| // 感兴趣的需求---- | // 感兴趣的需求---- | ||||
| type: data.listDetail.type.join(), | type: data.listDetail.type.join(), | ||||
| pageLoading: true, | pageLoading: true, | ||||
| }) | }) | ||||
| this.getListData(); | |||||
| this.getIsCollect(); | |||||
| }) | }) | ||||
| }, | }, | ||||
| // 热门详情点击 | // 热门详情点击 | ||||
| goDetails(e){ | |||||
| goDetails(e) { | |||||
| this.setData({ | this.setData({ | ||||
| currentData: e.detail, | currentData: e.detail, | ||||
| type: e.detail.type.join(), | type: e.detail.type.join(), | ||||
| pageLoading: true, | pageLoading: true, | ||||
| listData:[], | |||||
| page:1, | |||||
| onRefresh:true, | |||||
| listData: [], | |||||
| page: 1, | |||||
| onRefresh: true, | |||||
| isCollect: false, | |||||
| }) | |||||
| wx.pageScrollTo({ | |||||
| scrollTop: 0, | |||||
| }); | |||||
| this.getIsCollect(); | |||||
| }, | |||||
| // 判断是否收藏 | |||||
| getIsCollect() { | |||||
| let { currentData, customerId } = this.data; | |||||
| $request.get('/businessCommunicationCollect/booleanIsCollect.action', | |||||
| { customerId, businessCommunicationDemandId: currentData.businessCommunicationDemandId } | |||||
| ).then(res => { | |||||
| console.log(res); | |||||
| if (res.status == 0) { | |||||
| this.setData({ | |||||
| isCollect: res.data == 0 ? false : true | |||||
| }) | |||||
| } | |||||
| this.getListData(); | |||||
| }).catch(err => { | |||||
| console.log(error, 'error appletLogin') | |||||
| }) | |||||
| }, | |||||
| // 切换收藏 | |||||
| changeCollect() { | |||||
| // console.log(this.data.currentData) | |||||
| let { currentData, customerId, isCollect } = this.data; | |||||
| let url = ""; | |||||
| let msg = ""; | |||||
| // 如果已收藏就取消收藏 else 反之 | |||||
| if (isCollect) { | |||||
| url = "/businessCommunicationCollect/deleteCollect.action", | |||||
| msg = "取消收藏成功" | |||||
| } else { | |||||
| url = "/businessCommunicationCollect/saveCollect.action", | |||||
| msg = "收藏成功" | |||||
| } | |||||
| wx.showLoading({ | |||||
| title: '操作中...', | |||||
| mask: true | |||||
| }) | |||||
| $request.post(url, | |||||
| { customerId, businessCommunicationDemandId: currentData.businessCommunicationDemandId } | |||||
| ).then(res => { | |||||
| wx.hideLoading() | |||||
| if (res.status == 0) { | |||||
| this.setData({ | |||||
| isCollect: !isCollect | |||||
| }) | |||||
| wx.showToast({ | |||||
| title: msg, | |||||
| icon: 'success', | |||||
| duration: 2000 | |||||
| }) | |||||
| } | |||||
| }).catch(err => { | |||||
| console.log(error, 'error appletLogin') | |||||
| }) | }) | ||||
| this.getListData(); | |||||
| }, | }, | ||||
| // 获取list数据 | // 获取list数据 | ||||
| getListData() { | getListData() { | ||||
| let { page, size, type,currentData } = this.data; | |||||
| let { page, size, type, currentData } = this.data; | |||||
| $request.get('/businessCommunicationDemand/getDemandByKeywordOrType.action', | $request.get('/businessCommunicationDemand/getDemandByKeywordOrType.action', | ||||
| { page, size, type, isInterest: 1,demandId:currentData.businessCommunicationDemandId } | |||||
| { page, size, type, isInterest: 1, demandId: currentData.businessCommunicationDemandId } | |||||
| ).then(res => { | ).then(res => { | ||||
| this.setData({ | this.setData({ | ||||
| pageLoading: false, | pageLoading: false, |
| </view> | </view> | ||||
| <view wx:else> | <view wx:else> | ||||
| <view class="list-view"> | <view class="list-view"> | ||||
| <listItem item="{{ currentData }}" pageStatus="detatil"/> | |||||
| <listItem item="{{ currentData }}" pageStatus="detatil" isCollect="{{ isCollect }}" bind:changeCollect="changeCollect"/> | |||||
| </view> | </view> | ||||
| <view class="view-interested">你可能感兴趣的需求</view> | <view class="view-interested">你可能感兴趣的需求</view> |
| margin-top: 15rpx; | margin-top: 15rpx; | ||||
| } | } | ||||
| .serach-input-view .search-img-view{ | |||||
| position: absolute; | |||||
| right: 52rpx; | |||||
| top: 30rpx; | |||||
| width: 29rpx; | |||||
| height: 29rpx; | |||||
| z-index: 666; | |||||
| } | |||||
| .serach-input-view .search-img{ | |||||
| width: 100%; | |||||
| height: 100%; | |||||
| } | |||||
| .search-view .input-box { | .search-view .input-box { | ||||
| width: calc(100% - 100rpx); | width: calc(100% - 100rpx); | ||||
| box-shadow: -2px 7px 13px 3px | box-shadow: -2px 7px 13px 3px | ||||
| rgba(130, 130, 130, 0.03); | rgba(130, 130, 130, 0.03); | ||||
| } | } | ||||
| .search-view .search-img-view { | |||||
| position: absolute; | |||||
| right: 52rpx; | |||||
| top: 0rpx; | |||||
| z-index: 666; | |||||
| width: 40rpx; | |||||
| height: 90rpx; | |||||
| line-height: 90rpx; | |||||
| } | |||||
| .search-view .search-img { | |||||
| width: 29rpx; | |||||
| height: 29rpx; | |||||
| position: relative; | |||||
| top: 5rpx; | |||||
| } | |||||
| .phcolor { | .phcolor { | ||||
| color: #b3bfcb; | color: #b3bfcb; | ||||
| } | } |
| // pages/myModule/components/myCollect/myAttention.js | |||||
| const $request = require('../../../../utils/request.js'); | |||||
| Page({ | |||||
| /** | |||||
| * 页面的初始数据 | |||||
| */ | |||||
| data: { | |||||
| pageLoading: false, | |||||
| types: [], | |||||
| selectedTags: [], | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面加载 | |||||
| */ | |||||
| onLoad: function (options) { | |||||
| const eventChannel = this.getOpenerEventChannel() | |||||
| // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据 | |||||
| eventChannel.on('customerid', data => { | |||||
| console.log(data) | |||||
| this.setData({ | |||||
| customerId: data.customerid, | |||||
| pageLoading: true, | |||||
| }) | |||||
| this.getAllType(); | |||||
| }) | |||||
| }, | |||||
| // 获取tab数据 | |||||
| getAllType() { | |||||
| $request.get('/businessCommunicationType/getAllType.action').then(res => { | |||||
| if (res.status == 0) { | |||||
| let datas = res.data; | |||||
| this.setData({ | |||||
| types: datas, | |||||
| }) | |||||
| this.getAttentionTypeIds(); | |||||
| } | |||||
| }).catch(error => { | |||||
| console.log(error, 'error appletLogin') | |||||
| }) | |||||
| }, | |||||
| // 获取关注类型 | |||||
| getAttentionTypeIds() { | |||||
| let customerId = this.data.customerId; | |||||
| $request.get(`/businessCommunicationCustomer/getAttentionTypeIds.action`, | |||||
| { customerId } | |||||
| ).then(res => { | |||||
| // console.log(res); | |||||
| if (res.status == 0) { | |||||
| let selectedTags = res.data ? res.data.split(',') : []; | |||||
| this.setData({ selectedTags }) | |||||
| this.initSelectedTags(); | |||||
| } | |||||
| this.setData({ | |||||
| pageLoading: false, | |||||
| }) | |||||
| }).catch(error => { | |||||
| console.log(error, 'error appletLogin') | |||||
| }) | |||||
| }, | |||||
| // 选中类型变化 | |||||
| changeTags(e) { | |||||
| let typename = e.currentTarget.dataset.typename; | |||||
| let selectedTags = this.data.selectedTags; | |||||
| // 1 如果选中的数组里没有当前type | |||||
| if (selectedTags.indexOf(typename) == -1) { | |||||
| // 2 如果选中的数组的长度小于3 直接push | |||||
| if (selectedTags.length < 5) { | |||||
| selectedTags.push(typename) | |||||
| } | |||||
| } | |||||
| // 3 如果选中的数组里有它,直接删除 | |||||
| else { | |||||
| selectedTags.forEach((el, inx) => { | |||||
| if (el == typename) { | |||||
| selectedTags.splice(inx, 1); | |||||
| } | |||||
| }) | |||||
| } | |||||
| this.setData({ selectedTags }) | |||||
| this.initSelectedTags(); | |||||
| }, | |||||
| // 初始化选中 | |||||
| initSelectedTags() { | |||||
| let { types, selectedTags } = this.data; | |||||
| types.forEach(el => { | |||||
| el.isActive = false; | |||||
| if (selectedTags.indexOf(el.typeName) != -1) { | |||||
| el.isActive = true; | |||||
| } | |||||
| }) | |||||
| this.setData({ types }) | |||||
| console.log(types, 'types') | |||||
| }, | |||||
| // 设置关注类型 | |||||
| setAttentionTypeIds() { | |||||
| let { customerId, selectedTags } = this.data; | |||||
| wx.showLoading({ | |||||
| title: '数据保存中...', | |||||
| mask: true | |||||
| }) | |||||
| $request.post(`/businessCommunicationCustomer/setAttentionTypeIds.action`, | |||||
| { customerId, type: selectedTags.join(',') } | |||||
| ).then(res => { | |||||
| console.log(res); | |||||
| if (res.status == 0) { | |||||
| wx.showToast({ | |||||
| title: '保存成功', | |||||
| icon: 'success', | |||||
| duration: 2000 | |||||
| }) | |||||
| } | |||||
| wx.hideLoading() | |||||
| }).catch(error => { | |||||
| console.log(error, 'error appletLogin') | |||||
| wx.hideLoading() | |||||
| }) | |||||
| }, | |||||
| /** | |||||
| * 用户点击右上角分享 | |||||
| */ | |||||
| onShareAppMessage: function () { | |||||
| } | |||||
| }) |
| { | |||||
| "usingComponents": {} | |||||
| } |
| <!-- pages/myModule/components/myCollect/myAttention.wxml --> | |||||
| <view class="my-attention-page page-container"> | |||||
| <view class="list-loading text-center" wx:if="{{ pageLoading }}"> | |||||
| <van-loading size="24px">加载中...</van-loading> | |||||
| </view> | |||||
| <view wx:else> | |||||
| <view class="attention-view"> | |||||
| <view class="attention-title-view"> | |||||
| 你关注的类型 | |||||
| <text class="sub-title">(最多可选5项)</text> | |||||
| </view> | |||||
| <view class="attention-info">选择后,平台推荐将更符合你的偏好</view> | |||||
| <van-row class="attention-types-view clearfix" gutter="20"> | |||||
| <van-col span="8" class="attention-type" wx:for="{{ types }}" wx:key="*this"> | |||||
| <view class="item-type {{ item.isActive ? 'isActive' : '' }}" bindtap="changeTags" data-typename="{{ item.typeName }}"> | |||||
| {{ item.typeName }} | |||||
| </view> | |||||
| </van-col> | |||||
| </van-row> | |||||
| </view> | |||||
| <view class="submit-btn"> | |||||
| <van-button | |||||
| block | |||||
| color="#5e73e5" | |||||
| round | |||||
| disabled="{{ selectedTags.length < 1 }}" | |||||
| bind:click="setAttentionTypeIds" | |||||
| > | |||||
| 保存 | |||||
| </van-button> | |||||
| </view> | |||||
| </view> | |||||
| </view> |
| /* pages/myModule/components/myCollect/myAttention.wxss */ | |||||
| .my-attention-page{ | |||||
| min-height: calc(100vh - 140rpx); | |||||
| } | |||||
| .attention-view { | |||||
| background: #fff; | |||||
| padding: 30rpx; | |||||
| border-radius: 20rpx; | |||||
| box-shadow: -1px 3px 12px 4px | |||||
| rgba(186, 186, 186, 0.1); | |||||
| } | |||||
| .attention-view .attention-title-view{ | |||||
| font-size: 30rpx; | |||||
| font-weight: bold; | |||||
| color: #333; | |||||
| margin-bottom: 5rpx; | |||||
| } | |||||
| .attention-view .attention-title-view .sub-title{ | |||||
| font-size: 22rpx; | |||||
| font-weight: normal; | |||||
| color: #999; | |||||
| } | |||||
| .attention-view .attention-info{ | |||||
| font-size: 22rpx; | |||||
| color: #556fb5; | |||||
| margin-bottom: 30rpx; | |||||
| } | |||||
| /* .attention-view .attention-type{ | |||||
| padding-bottom: 10rpx; | |||||
| } */ | |||||
| .attention-view .attention-type .item-type{ | |||||
| text-align: center; | |||||
| box-sizing: border-box; | |||||
| height: 69rpx; | |||||
| line-height: 68rpx; | |||||
| border: 1px solid #556fb5; | |||||
| border-radius: 34rpx; | |||||
| color: #556fb5; | |||||
| font-size: 31rpx; | |||||
| margin-bottom: 20rpx; | |||||
| } | |||||
| .attention-view .attention-type .item-type.isActive{ | |||||
| color: #fff; | |||||
| border: 0; | |||||
| background: #5e73e5; | |||||
| } | |||||
| .submit-btn{ | |||||
| margin-top: 60rpx; | |||||
| box-sizing: border-box; | |||||
| padding: 0 40rpx; | |||||
| } |
| // pages/myModule/components/myRelease/myRelease.js | |||||
| const $request = require('../../../../utils/request.js'); | |||||
| const $util = require('../../../../utils/util.js'); | |||||
| Page({ | |||||
| /** | |||||
| * 页面的初始数据 | |||||
| */ | |||||
| data: { | |||||
| listLoading: false, | |||||
| customerId: null, | |||||
| // 我发布的需求---- | |||||
| // item行加载 | |||||
| itemLoading: false, | |||||
| // 数据是否加载完成 | |||||
| isFinished: false, | |||||
| listData: [], | |||||
| page: 1, | |||||
| size: 10, | |||||
| total: 0, | |||||
| // 是否加载数据,true加载,false不加载 | |||||
| onRefresh: true, | |||||
| // 搜索值 | |||||
| keyword: "", | |||||
| }, | |||||
| /** | |||||
| * 生命周期函数--监听页面加载 | |||||
| */ | |||||
| onLoad: function (options) { | |||||
| const eventChannel = this.getOpenerEventChannel() | |||||
| // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据 | |||||
| eventChannel.on('customerid', data => { | |||||
| this.setData({ | |||||
| customerId: data.customerid, | |||||
| listLoading: true, | |||||
| }) | |||||
| this.getListData(); | |||||
| }) | |||||
| }, | |||||
| // tab切换 | |||||
| tabChange(e) { | |||||
| let code = e.currentTarget.dataset.code; | |||||
| this.setData({ | |||||
| currentTab: code | |||||
| }) | |||||
| this.toSearch(); | |||||
| }, | |||||
| // 搜索框输入同步值 | |||||
| bindKeyInput: function (e) { | |||||
| this.setData({ | |||||
| keyword: e.detail.value | |||||
| }) | |||||
| }, | |||||
| toSearch() { | |||||
| this.setData({ | |||||
| listData: [], | |||||
| onRefresh: true, | |||||
| isFinished: false, | |||||
| listLoading: true, | |||||
| page: 1, | |||||
| }) | |||||
| this.getListData(); | |||||
| }, | |||||
| // 进入详情 | |||||
| goDetails(e) { | |||||
| wx.navigateTo({ | |||||
| url: '/pages/index/components/listDetails/Details', | |||||
| success: function (res) { | |||||
| // 通过eventChannel向被打开页面传送数据 | |||||
| res.eventChannel.emit('acceptDataFromOpenerPage', { listDetail: e.detail }) | |||||
| } | |||||
| }) | |||||
| }, | |||||
| // 删除收藏 | |||||
| delCollect(e) { | |||||
| let businessCommunicationDemandId = e.currentTarget.dataset.id; | |||||
| let customerId = this.data.customerId; | |||||
| console.log({ customerId, businessCommunicationDemandId }); | |||||
| wx.showLoading({ | |||||
| title: '操作中...', | |||||
| mask: true | |||||
| }) | |||||
| $request.post("/businessCommunicationCollect/deleteCollect.action", | |||||
| { customerId, businessCommunicationDemandId } | |||||
| ).then(res => { | |||||
| wx.hideLoading() | |||||
| if (res.status == 0) { | |||||
| let listData = this.data.listData; | |||||
| listData.forEach((el, inx) => { | |||||
| if (el.businessCommunicationDemandId == businessCommunicationDemandId) { | |||||
| listData.splice(inx, 1); | |||||
| } | |||||
| }) | |||||
| this.setData({ | |||||
| listData | |||||
| }) | |||||
| } | |||||
| }).catch(err => { | |||||
| console.log(error, 'error appletLogin') | |||||
| }) | |||||
| }, | |||||
| // 数据加载提示 | |||||
| showLoading(title) { | |||||
| wx.showLoading({ | |||||
| title: title ? title : '加载中', | |||||
| mask: true | |||||
| }) | |||||
| }, | |||||
| getListData() { | |||||
| let { page, size, customerId, keyword } = this.data; | |||||
| $request.get('/businessCommunicationDemand/getDemandByCustomerId.action', | |||||
| { page, size, customerId, keyword } | |||||
| ).then(res => { | |||||
| let tempListData = this.data.listData; | |||||
| if (res.status == 0) { | |||||
| let datas = res.data; | |||||
| console.log(datas, 'datas') | |||||
| // 先push数据 | |||||
| tempListData.push(...datas.demandList); | |||||
| tempListData.forEach(el => { | |||||
| el.createdOn = $util.formatTime(new Date(el.createdOn), true); | |||||
| if (typeof el.type == 'string') { | |||||
| el.type = el.type.split(','); | |||||
| } | |||||
| }) | |||||
| // 设置总数 | |||||
| this.setData({ | |||||
| listData: tempListData, | |||||
| total: datas.total, | |||||
| }) | |||||
| // 如果数据大于了返回的总数 | |||||
| if (tempListData.length >= this.data.total) { | |||||
| // 停止累加数据 | |||||
| this.setData({ | |||||
| onRefresh: false, | |||||
| itemLoading: false, | |||||
| isFinished: true, | |||||
| }) | |||||
| } else { | |||||
| this.setData({ | |||||
| onRefresh: true, | |||||
| itemLoading: false, | |||||
| isFinished: false, | |||||
| page: page + 1 | |||||
| }) | |||||
| } | |||||
| } | |||||
| this.setData({ | |||||
| listLoading: false, | |||||
| }) | |||||
| }).catch(error => { | |||||
| console.log(error, 'error appletLogin') | |||||
| }) | |||||
| }, | |||||
| // | |||||
| /** | |||||
| * 页面上拉触底事件的处理函数 | |||||
| */ | |||||
| onReachBottom: function () { | |||||
| if (this.data.onRefresh) { | |||||
| this.setData({ | |||||
| itemLoading: true | |||||
| }) | |||||
| this.getListData(); | |||||
| } | |||||
| }, | |||||
| /** | |||||
| * 用户点击右上角分享 | |||||
| */ | |||||
| onShareAppMessage: function () { | |||||
| } | |||||
| }) |
| { | |||||
| "component": true, | |||||
| "usingComponents": {} | |||||
| } |
| <!-- pages/myModule/components/myRelease/myRelease.wxml --> | |||||
| <view class="my-release-page page-container"> | |||||
| <view class="header"> | |||||
| <view class="search-view"> | |||||
| <view class="input-box fl"> | |||||
| <input class="weui-serach-input" value="{{ keyword }}" bindinput="bindKeyInput" confirm-type="search" placeholder="请输入关键字搜索" placeholder-class="phcolor" bindconfirm="toSearch"></input> | |||||
| </view> | |||||
| <view class="search-img-view" bindtap="toSearch"> | |||||
| <image class="search-img" src="/images/home/search-icon.png" /> | |||||
| </view> | |||||
| </view> | |||||
| </view> | |||||
| <!-- list块 --> | |||||
| <view class="list-loading text-center" wx:if="{{ listLoading }}"> | |||||
| <van-loading size="24px">加载中...</van-loading> | |||||
| </view> | |||||
| <view wx:else> | |||||
| <view class="not-data" wx:if="{{ listData.length < 1 }}"> | |||||
| <image class="not-data-img" src="/images/home/not-data.png" /> | |||||
| <view class="not-info">暂无需求</view> | |||||
| </view> | |||||
| <view wx:else> | |||||
| <view class="list-view " wx:for="{{ listData }}" wx:key="*this"> | |||||
| <listItem item="{{ item }}" pageStatus="myCollect" bind:getItem="goDetails" listClass="{{ item.isDeleted > 0 || item.state < 0 ? 'disabled-model-view' : '' }}" /> | |||||
| <image class="disabled-model-img" src="/images/home/isDelete-icon.png" wx:if="{{ item.isDeleted > 0 }}"/> | |||||
| <image class="disabled-model-img" src="/images/home/isState-0-icon.png" wx:if="{{ item.isDeleted == 0 && item.state < 0}}"/> | |||||
| <view class="del-collect-view" bindtap="delCollect" data-id="{{ item.businessCommunicationDemandId }}"> | |||||
| <image class="del-collect-img" src="/images/home/del-collect.png" wx:if="{{ item.isDeleted > 0 || item.state < 0 }}"/> | |||||
| </view> | |||||
| </view> | |||||
| <view class="text-center" wx:if="{{ itemLoading }}"> | |||||
| <van-loading size="24px">加载中...</van-loading> | |||||
| </view> | |||||
| <view class="list-finished text-center" wx:if="{{ isFinished }}"> | |||||
| <image class="finished-img" src="/images/home/finished-icon.png" /> | |||||
| 没有更多啦~ | |||||
| </view> | |||||
| </view> | |||||
| </view> | |||||
| </view> |
| /* pages/myModule/components/myRelease/myRelease.wxss */ | |||||
| .my-release-page { | |||||
| min-height: calc(100vh - 20rpx); | |||||
| padding-bottom: 20rpx; | |||||
| } | |||||
| .header { | |||||
| box-sizing: border-box; | |||||
| padding: 0 20rpx; | |||||
| width: 100%; | |||||
| position: sticky; | |||||
| top: 0; | |||||
| z-index: 999; | |||||
| background: #f5f9ff; | |||||
| } | |||||
| .search-view { | |||||
| height: 90rpx; | |||||
| position: relative; | |||||
| padding: 20rpx 0; | |||||
| } | |||||
| .search-view .input-box{ | |||||
| width: 100%; | |||||
| } | |||||
| .search-view .weui-serach-input{ | |||||
| background: #fff; | |||||
| height: 90rpx; | |||||
| line-height: 90rpx; | |||||
| box-sizing: border-box; | |||||
| padding-left: 40rpx; | |||||
| padding-right: 80rpx; | |||||
| border-radius: 44rpx; | |||||
| box-shadow: -2px 7px 13px 3px | |||||
| rgba(130, 130, 130, 0.03); | |||||
| } | |||||
| .search-view .search-img-view { | |||||
| position: absolute; | |||||
| right: 52rpx; | |||||
| top: 20rpx; | |||||
| z-index: 666; | |||||
| width: 40rpx; | |||||
| height: 90rpx; | |||||
| line-height: 90rpx; | |||||
| } | |||||
| .search-view .search-img { | |||||
| width: 29rpx; | |||||
| height: 29rpx; | |||||
| position: relative; | |||||
| top: 5rpx; | |||||
| } | |||||
| /* .disabled-model { | |||||
| position: absolute; | |||||
| left: 0; | |||||
| top: 0; | |||||
| width: 100%; | |||||
| height: 100%; | |||||
| background: rgba(0, 0, 0, 0.3); | |||||
| border-radius: 20rpx; | |||||
| } */ | |||||
| .disabled-model-img{ | |||||
| position: absolute; | |||||
| width: 125rpx; | |||||
| height: 78rpx; | |||||
| top: 78rpx; | |||||
| right: 40rpx; | |||||
| z-index: 6; | |||||
| } | |||||
| .del-collect-view { | |||||
| position: absolute; | |||||
| right:10rpx; | |||||
| top: 20rpx; | |||||
| width: 40rpx; | |||||
| height: 40rpx; | |||||
| } | |||||
| .del-collect-view .del-collect-img{ | |||||
| width: 29rpx; | |||||
| height: 31rpx; | |||||
| } |
| .search-view .search-img-view { | .search-view .search-img-view { | ||||
| position: absolute; | position: absolute; | ||||
| right: 52rpx; | right: 52rpx; | ||||
| top: 30rpx; | |||||
| width: 29rpx; | |||||
| height: 29rpx; | |||||
| top: 0rpx; | |||||
| z-index: 666; | z-index: 666; | ||||
| width: 40rpx; | |||||
| height: 90rpx; | |||||
| line-height: 90rpx; | |||||
| } | } | ||||
| .search-view .search-img { | .search-view .search-img { | ||||
| width: 100%; | |||||
| height: 100%; | |||||
| width: 29rpx; | |||||
| height: 29rpx; | |||||
| position: relative; | |||||
| top: 5rpx; | |||||
| } | } | ||||
| .foot-btn { | .foot-btn { |
| name: "微信昵称微信昵称微微信微信昵称微信昵称微微信", | name: "微信昵称微信昵称微微信微信昵称微信昵称微微信", | ||||
| isPartner: true, | isPartner: true, | ||||
| address: "上海市·徐汇区", | address: "上海市·徐汇区", | ||||
| customerId:666967, | |||||
| // customerId:666967, | |||||
| customerId:666678, | |||||
| }, | }, | ||||
| listData: [ | listData: [ | ||||
| { | { | ||||
| if (code == 'my-release') { | if (code == 'my-release') { | ||||
| url = "/pages/myModule/components/myRelease/myRelease"; | url = "/pages/myModule/components/myRelease/myRelease"; | ||||
| } | } | ||||
| // 前往发布的需求 | |||||
| if (code == 'my-release') { | |||||
| url = "/pages/myModule/components/myRelease/myRelease"; | |||||
| } | |||||
| // 前往关注的类型 | |||||
| if (code == 'my-attention') { | |||||
| url = "/pages/myModule/components/myAttention/myAttention"; | |||||
| } | |||||
| wx.navigateTo({ | wx.navigateTo({ | ||||
| url, | url, | ||||
| success: function (res) { | success: function (res) { |