| "pages/releaseModule/index", | "pages/releaseModule/index", | ||||
| "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" | |||||
| ], | ], | ||||
| "usingComponents": { | "usingComponents": { | ||||
| "tabBar": "/components/tabbar/tabbar", | "tabBar": "/components/tabbar/tabbar", |
| <!-- components/listItem/listItem.wxml --> | <!-- components/listItem/listItem.wxml --> | ||||
| <!-- 置顶 --> | <!-- 置顶 --> | ||||
| <image class="ontop-img" src="/images/home/ontop-icon.png" wx:if="{{ pageStatus == 'homepage' && item.isOnTop == 1}}"/> | |||||
| <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 }}"> | <view class="list-certification" wx:if="{{ item.isPartner }}"> | ||||
| <image class="certification-img" src="/images/home/certification-icon.png" /> | <image class="certification-img" src="/images/home/certification-icon.png" /> | ||||
| 平台认证 | 平台认证 | ||||
| </view> | </view> | ||||
| <!-- 头部 --> | <!-- 头部 --> | ||||
| <view class="list-avatar" wx:if="{{ pageStatus != 'homepage' }}"> | |||||
| <view class="list-avatar" wx:if="{{ pageStatus != 'homepage' && pageStatus != 'myRelease' }}"> | |||||
| <view class="list-chatHeads fl"> | <view class="list-chatHeads fl"> | ||||
| <image class="chatHeads-img" src="{{ item.chatHeads }}" /> | <image class="chatHeads-img" src="{{ item.chatHeads }}" /> | ||||
| </view> | </view> | ||||
| <view bindtap="goDetails" data-item="{{ item }}"> | <view bindtap="goDetails" data-item="{{ item }}"> | ||||
| <!-- 详情 --> | <!-- 详情 --> | ||||
| <view> | <view> | ||||
| <text space class="list-details-text" user-select wx:if="{{ pageStatus == 'detatil' }}">{{ item.info }}</text> | |||||
| <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> | <text wx:else class="list-details-text need">{{ item.info }}</text> | ||||
| </view> | </view> | ||||
| <!-- 标签 --> | <!-- 标签 --> | ||||
| <image class="collect-img" src="/images/home/not-collect.png" wx:else /> | <image class="collect-img" src="/images/home/not-collect.png" wx:else /> | ||||
| 收藏 | 收藏 | ||||
| </view> | </view> | ||||
| <view class="fr list-foot-text-chat"> | |||||
| <view class="fr list-foot-text-chat" wx:if="{{ pageStatus != 'myRelease' }}"> | |||||
| <image class="chat-img" src="/images/home/chat-icon.png" /> | <image class="chat-img" src="/images/home/chat-icon.png" /> | ||||
| 聊一聊 | 聊一聊 | ||||
| </view> | </view> |
| <view class="serach-input-view"> | <view class="serach-input-view"> | ||||
| <image class="hhr-img fl" src="/images/home/hhr-icon.png" /> | <image class="hhr-img fl" src="/images/home/hhr-icon.png" /> | ||||
| <view class="input-box fl"> | <view class="input-box fl"> | ||||
| <input class="weui-serach-input" value="{{ keyword }}" bindinput="bindKeyInput" confirm-type="search" placeholder="请输入关键字搜索" placeholder-class="phcolor"></input> | |||||
| <input class="weui-serach-input" value="{{ keyword }}" bindinput="bindKeyInput" bindconfirm="toSearch" confirm-type="search" placeholder="请输入关键字搜索" placeholder-class="phcolor"></input> | |||||
| </view> | </view> | ||||
| <view class="search-img-view" bindtap="toSearch"> | <view class="search-img-view" bindtap="toSearch"> | ||||
| <image class="search-img" src="/images/home/search-icon.png" /> | <image class="search-img" src="/images/home/search-icon.png" /> |
| // pages/myModule/components/myRelease/myRelease.js | |||||
| const $request = require('../../../../utils/request.js'); | |||||
| const $util = require('../../../../utils/util.js'); | |||||
| Page({ | |||||
| /** | |||||
| * 页面的初始数据 | |||||
| */ | |||||
| data: { | |||||
| tabs: [ | |||||
| { | |||||
| tab: "发布中", | |||||
| code: 'release' | |||||
| }, | |||||
| { | |||||
| tab: "已下架", | |||||
| code: 'remove' | |||||
| } | |||||
| ], | |||||
| currentTab: 'release', | |||||
| 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 => { | |||||
| console.log(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(); | |||||
| }, | |||||
| // 上架/下架需求 | |||||
| productRelease(e) { | |||||
| let item = e.currentTarget.dataset.item; | |||||
| let that = this; | |||||
| wx.showModal({ | |||||
| title: '提示', | |||||
| content: "是否确认下架?", | |||||
| confirmText: "确认", | |||||
| cancelText: "取消", | |||||
| success(res) { | |||||
| if (res.confirm) { | |||||
| that.productReleasePost(item); | |||||
| } | |||||
| } | |||||
| }) | |||||
| }, | |||||
| productReleasePost(item) { | |||||
| let { businessCommunicationDemandId, state } = item; | |||||
| $request.post(`/businessCommunicationDemand/outDemand.action`, { businessCommunicationDemandId, state } | |||||
| ).then(res => { | |||||
| if (res.status == 0) { | |||||
| wx.showToast({ | |||||
| title: state == 0 ? '下架' : '上架' + '成功', | |||||
| icon: 'success', | |||||
| duration: 2000 | |||||
| }) | |||||
| let listData = this.data.listData; | |||||
| listData.forEach(el => { | |||||
| if (el.businessCommunicationDemandId == businessCommunicationDemandId) { | |||||
| el.state = state == 0 ? 1 : 0; | |||||
| } | |||||
| }) | |||||
| this.setData({ | |||||
| listData | |||||
| }) | |||||
| } | |||||
| }).catch(error => { | |||||
| console.log(error, 'error appletLogin') | |||||
| }) | |||||
| }, | |||||
| getListData() { | |||||
| let { page, size, customerId, keyword, currentTab } = this.data; | |||||
| $request.get('/businessCommunicationDemand/getDemandByStateAndCustomerId.action', | |||||
| { page, size, customerId, keyword, state: currentTab } | |||||
| ).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 | |||||
| }) | |||||
| } | |||||
| console.log('-------------个人主页 beg-------------------') | |||||
| console.log(this.data.listData); | |||||
| console.log('-------------个人主页 end-------------------') | |||||
| } | |||||
| 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 () { | |||||
| } | |||||
| }) |
| { | |||||
| "usingComponents": { } | |||||
| } |
| <!-- pages/myModule/components/myRelease/myRelease.wxml --> | |||||
| <view class="my-release-page page-container"> | |||||
| <view class="header"> | |||||
| <view class="header-tab"> | |||||
| <view class="tab-item fl {{ currentTab == item.code ? 'isActive' : '' }}" wx:for="{{ tabs }}" wx:key="*this" bindtap="tabChange" data-code="{{ item.code }}"> | |||||
| <image class="{{ item.code }}-img" src="/images/home/{{ item.code }}-icon.png" /> | |||||
| {{ item.tab }} | |||||
| </view> | |||||
| </view> | |||||
| <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="myRelease"/> | |||||
| <view class="foot-btn"> | |||||
| <van-button plain type="info" size="small" round class="foot-van-btn"> | |||||
| {{ item.isOnTop ? '取消置顶' : '置顶' }} | |||||
| </van-button> | |||||
| <van-button plain type="info" size="small" round class="foot-van-btn">修改</van-button> | |||||
| <van-button plain type="info" size="small" round class="foot-van-btn" data-item="{{ item }}" bindtap="productRelease"> | |||||
| {{ item.state == 0 ? '下架' : '上架' }} | |||||
| </van-button> | |||||
| <van-button plain type="info" size="small" round class="foot-van-btn">删除</van-button> | |||||
| </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; | |||||
| } | |||||
| .header-tab { | |||||
| height: 110rpx; | |||||
| } | |||||
| .header-tab .tab-item { | |||||
| width: 49%; | |||||
| height: 110rpx; | |||||
| background: #fff; | |||||
| border-radius: 20rpx; | |||||
| text-align: center; | |||||
| color: #333; | |||||
| font-weight: bold; | |||||
| line-height: 110rpx; | |||||
| } | |||||
| .header-tab .tab-item.isActive { | |||||
| color: #5e73e5; | |||||
| } | |||||
| .header-tab .tab-item:first-child { | |||||
| margin-right: 2%; | |||||
| } | |||||
| .header-tab .release-img, | |||||
| .header-tab .remove-img { | |||||
| position: relative; | |||||
| margin-right: 10rpx; | |||||
| top: 4px; | |||||
| } | |||||
| .header-tab .release-img { | |||||
| width: 46rpx; | |||||
| height: 40rpx; | |||||
| } | |||||
| .header-tab .remove-img { | |||||
| width: 40rpx; | |||||
| height: 36rpx; | |||||
| } | |||||
| .search-view { | |||||
| /* width: 100%; */ | |||||
| margin-top: 20rpx; | |||||
| height: 90rpx; | |||||
| position: relative; | |||||
| padding-bottom: 20rpx; | |||||
| } | |||||
| .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: 30rpx; | |||||
| width: 29rpx; | |||||
| height: 29rpx; | |||||
| z-index: 666; | |||||
| } | |||||
| .search-view .search-img { | |||||
| width: 100%; | |||||
| height: 100%; | |||||
| } | |||||
| .foot-btn { | |||||
| border-top: 1px solid #eaedf4; | |||||
| height: 65rpx; | |||||
| line-height: 95rpx; | |||||
| text-align: right; | |||||
| } | |||||
| .foot-btn .foot-van-btn{ | |||||
| margin-left: 10rpx; | |||||
| } |
| { | { | ||||
| title: "我发布的需求", | title: "我发布的需求", | ||||
| code: "my-release", | code: "my-release", | ||||
| url: "我发布的需求", | |||||
| }, | }, | ||||
| { | { | ||||
| title: "我收藏的需求", | title: "我收藏的需求", | ||||
| code: "my-collect", | code: "my-collect", | ||||
| url: "我收藏的需求", | |||||
| }, | }, | ||||
| { | { | ||||
| title: "我关注的类型", | title: "我关注的类型", | ||||
| code: "my-attention", | code: "my-attention", | ||||
| url: "我关注的类型", | |||||
| }, | }, | ||||
| { | { | ||||
| title: "联系客服", | title: "联系客服", | ||||
| code: "my-contact", | code: "my-contact", | ||||
| url: "联系客服", | |||||
| }, | }, | ||||
| ], | ], | ||||
| }, | }, | ||||
| // 路由跳转 | // 路由跳转 | ||||
| goRouterPage(e) { | goRouterPage(e) { | ||||
| let url = e.currentTarget.dataset.url; | |||||
| let code = e.currentTarget.dataset.code; | |||||
| let customerid = this.data.user.customerId; | let customerid = this.data.user.customerId; | ||||
| let url = ""; | |||||
| // 前往主页 | // 前往主页 | ||||
| if (url == 'homepage') { | |||||
| wx.navigateTo({ | |||||
| url: '/pages/index/components/homepage/homepage', | |||||
| success: function (res) { | |||||
| // 通过eventChannel向被打开页面传送数据 | |||||
| res.eventChannel.emit('customerid', { customerid }) | |||||
| } | |||||
| }) | |||||
| if (code == 'homepage') { | |||||
| url = "/pages/index/components/homepage/homepage"; | |||||
| } | } | ||||
| // 前往发布的需求 | |||||
| if (code == 'my-release') { | |||||
| url = "/pages/myModule/components/myRelease/myRelease"; | |||||
| } | |||||
| wx.navigateTo({ | |||||
| url, | |||||
| success: function (res) { | |||||
| // 通过eventChannel向被打开页面传送数据 | |||||
| res.eventChannel.emit('customerid', { customerid }) | |||||
| } | |||||
| }) | |||||
| }, | }, | ||||
| }) | }) |
| <view class="user-address fl"> | <view class="user-address fl"> | ||||
| {{ user.address }} | {{ user.address }} | ||||
| </view> | </view> | ||||
| <view class="show-home-page fl" bindtap="goRouterPage" data-url="homepage"> | |||||
| <view class="show-home-page fl" bindtap="goRouterPage" data-code="homepage"> | |||||
| <image class="home-page-img" src="/images/home/home-page-icon.png" /> | <image class="home-page-img" src="/images/home/home-page-icon.png" /> | ||||
| 查 看 主 页 >> | 查 看 主 页 >> | ||||
| </view> | </view> | ||||
| </view> | </view> | ||||
| <!-- 内容 --> | <!-- 内容 --> | ||||
| <view class="content card-view"> | <view class="content card-view"> | ||||
| <view class="li-view" wx:for="{{ listData }}" wx:key="*this" bindtap="goRouterPage" data-url="{{ item.url }}"> | |||||
| <view class="li-view" wx:for="{{ listData }}" wx:key="*this" bindtap="goRouterPage" data-code="{{ item.code }}"> | |||||
| <image class="{{ item.code }}-img" src="/images/home/{{ item.code }}-icon.png" /> | <image class="{{ item.code }}-img" src="/images/home/{{ item.code }}-icon.png" /> | ||||
| {{ item.title }} | {{ item.title }} | ||||
| <view class="right-icon fr"> | <view class="right-icon fr"> |