{ | { | ||||
"pages": [ | "pages": [ | ||||
"pages/releaseModule/index", | |||||
"pages/index/index", | "pages/index/index", | ||||
"pages/logs/logs", | "pages/logs/logs", | ||||
"pages/myModule/index", | "pages/myModule/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" | |||||
], | ], | ||||
"usingComponents": { | "usingComponents": { | ||||
"tabBar": "/components/tabbar/tabbar", | "tabBar": "/components/tabbar/tabbar", | ||||
"listItem":"/components/listItem/listItem", | |||||
"listItem": "/components/listItem/listItem", | |||||
"van-loading": "/miniprogram_npm/@vant/weapp/loading", | "van-loading": "/miniprogram_npm/@vant/weapp/loading", | ||||
"van-icon": "/miniprogram_npm/@vant/weapp/icon", | "van-icon": "/miniprogram_npm/@vant/weapp/icon", | ||||
"van-row": "/miniprogram_npm/@vant/weapp/row", | "van-row": "/miniprogram_npm/@vant/weapp/row", | ||||
"van-col": "/miniprogram_npm/@vant/weapp/col" | |||||
"van-col": "/miniprogram_npm/@vant/weapp/col", | |||||
"van-button": "/miniprogram_npm/@vant/weapp/button" | |||||
}, | }, | ||||
"window": { | "window": { | ||||
"backgroundTextStyle": "light", | "backgroundTextStyle": "light", |
/**app.wxss**/ | /**app.wxss**/ | ||||
@import '/miniprogram_npm/weui-miniprogram/weui-wxss/dist/style/weui.wxss'; | @import '/miniprogram_npm/weui-miniprogram/weui-wxss/dist/style/weui.wxss'; | ||||
.container { | .container { | ||||
width: 100%; | width: 100%; | ||||
height: 100%; | height: 100%; | ||||
height: 0; | height: 0; | ||||
clear: both; | clear: both; | ||||
visibility: hidden; | visibility: hidden; | ||||
} | |||||
/* CSS超出显示... */ | |||||
.yichu{ | |||||
white-space:nowrap; | |||||
overflow:hidden; | |||||
text-overflow:ellipsis; | |||||
} | } |
item: { | item: { | ||||
type: Object, | type: Object, | ||||
}, | }, | ||||
// index => 首页 detatil => 详情 home => 个人主页 | |||||
// index => 首页 detatil => 详情 homepage => 个人主页 | |||||
pageStatus: { | pageStatus: { | ||||
type: String, | type: String, | ||||
default: 'index', | default: 'index', | ||||
let dataset = e.currentTarget.dataset; | let dataset = e.currentTarget.dataset; | ||||
this.triggerEvent('getItem', dataset.item); | this.triggerEvent('getItem', dataset.item); | ||||
}, | }, | ||||
// 进入个人主页 | |||||
goHomePage(e){ | |||||
let customerid = e.currentTarget.dataset.customerid; | |||||
wx.navigateTo({ | |||||
url: '/pages/index/components/homepage/homepage', | |||||
success: function (res) { | |||||
// 通过eventChannel向被打开页面传送数据 | |||||
res.eventChannel.emit('customerid', { customerid }) | |||||
} | |||||
}) | |||||
}, | |||||
} | } | ||||
}) | }) |
<!-- 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}}"/> | |||||
<!-- 平台认证 --> | <!-- 平台认证 --> | ||||
<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"> | |||||
<view class="list-avatar" wx:if="{{ pageStatus != 'homepage' }}"> | |||||
<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 class="list-nick-name fl">{{ item.nickName }}</view> | <view class="list-nick-name fl">{{ item.nickName }}</view> | ||||
<view class="list-home fl"> | |||||
<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' }}" /> | <image class="home-img" src="{{ item.isPartner ? '/images/home/company-icon.png' : '/images/home/personal-icon.png' }}" /> | ||||
主页 | 主页 | ||||
</view> | </view> | ||||
<view bindtap="goDetails" data-item="{{ item }}"> | <view bindtap="goDetails" data-item="{{ item }}"> | ||||
<!-- 详情 --> | <!-- 详情 --> | ||||
<view> | <view> | ||||
<text space class="list-details-text need">{{ item.info }}</text> | |||||
<text space class="list-details-text" user-select wx:if="{{ pageStatus == 'detatil' }}">{{ item.info }}</text> | |||||
<text wx:else class="list-details-text need">{{ item.info }}</text> | |||||
</view> | </view> | ||||
<!-- 标签 --> | <!-- 标签 --> | ||||
<view class="list-tag-view"> | <view class="list-tag-view"> | ||||
{{ item.pageView }}浏览量 | {{ item.pageView }}浏览量 | ||||
</view> | </view> | ||||
<view class="fl list-collect-view" wx:if="{{ pageStatus == 'detatil' }}"> | <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/> | |||||
<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> | ||||
<view class="fr list-foot-text-chat"> | <view class="fr list-foot-text-chat"> |
.is-details-page .list-foot-text-lf{ | .is-details-page .list-foot-text-lf{ | ||||
margin-right: 20rpx; | margin-right: 20rpx; | ||||
} | |||||
/* 置顶 */ | |||||
.ontop-img { | |||||
position: absolute; | |||||
left: 0; | |||||
top: 0; | |||||
width: 67rpx; | |||||
height: 62rpx; | |||||
} | } |
// pages/index/components/homepage/homepage.js | |||||
const $request = require('../../../../utils/request.js'); | |||||
const $util = require('../../../../utils/util.js'); | |||||
Page({ | |||||
/** | |||||
* 页面的初始数据 | |||||
*/ | |||||
data: { | |||||
pageLoading: false, | |||||
customerId: null, | |||||
// 我发布的需求---- | |||||
// item行加载 | |||||
itemLoading: false, | |||||
// 数据是否加载完成 | |||||
isFinished: false, | |||||
listData: [], | |||||
page: 1, | |||||
size: 10, | |||||
total: 0, | |||||
// 是否加载数据,true加载,false不加载 | |||||
onRefresh: true, | |||||
// 顶部数据 | |||||
customer: {}, | |||||
// 被关注 | |||||
beCollectDemand: 0, | |||||
// 关注 | |||||
collectDemand: 0, | |||||
// 发布需求 | |||||
postDemand: 0, | |||||
// 被浏览量 | |||||
totalPageView: 0, | |||||
}, | |||||
/** | |||||
* 生命周期函数--监听页面加载 | |||||
*/ | |||||
onLoad: function (options) { | |||||
const eventChannel = this.getOpenerEventChannel() | |||||
// 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据 | |||||
eventChannel.on('customerid', data => { | |||||
console.log(data) | |||||
this.setData({ | |||||
customerId: data.customerid, | |||||
pageLoading: true | |||||
}) | |||||
this.getListData(); | |||||
}) | |||||
}, | |||||
// 底部按钮点击 | |||||
footBtnClick(){ | |||||
console.log(`点击了底部按钮`) | |||||
}, | |||||
getListData() { | |||||
let { page, size, customerId } = this.data; | |||||
$request.get('/businessCommunicationDemand/getDemandHomePage.action', | |||||
{ page, size, customerId } | |||||
).then(res => { | |||||
this.setData({ | |||||
pageLoading: false, | |||||
}) | |||||
console.log(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(','); | |||||
} | |||||
}) | |||||
// datas.businessCommunicationCustomer.serviceProject = "公司注册,注销变更,银行开户,代理记账,园区合作,招募合作伙伴" | |||||
// 设置总数 | |||||
this.setData({ | |||||
listData: tempListData, | |||||
total:datas.total, | |||||
customer: datas.businessCommunicationCustomer, | |||||
beCollectDemand:datas.beCollectDemand, | |||||
collectDemand:datas.collectDemand, | |||||
postDemand:datas.postDemand, | |||||
totalPageView:datas.totalPageView, | |||||
}) | |||||
// 如果数据大于了返回的总数 | |||||
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-------------------') | |||||
} | |||||
}).catch(error => { | |||||
console.log(error, 'error appletLogin') | |||||
}) | |||||
}, | |||||
/** | |||||
* 页面上拉触底事件的处理函数 | |||||
*/ | |||||
onReachBottom: function () { | |||||
if (this.data.onRefresh) { | |||||
this.setData({ | |||||
itemLoading: true | |||||
}) | |||||
this.getListData(); | |||||
} | |||||
}, | |||||
/** | |||||
* 用户点击右上角分享 | |||||
*/ | |||||
onShareAppMessage: function () { | |||||
} | |||||
}) |
{ | |||||
"usingComponents": { | |||||
} | |||||
} |
<view class="home-page page-container"> | |||||
<view class="list-loading text-center" wx:if="{{ pageLoading }}"> | |||||
<van-loading size="24px">加载中...</van-loading> | |||||
</view> | |||||
<view wx:else> | |||||
<!-- 头部 --> | |||||
<view class="header-view"> | |||||
<view class="user-view"> | |||||
<view class="chatHeads-view fl"> | |||||
<image class="chatHeads-img" src="{{ customer.chatHeads }}" /> | |||||
</view> | |||||
<view class="customer-info fl"> | |||||
<view class="customer-nick-name yichu">{{ customer.nickName }}</view> | |||||
<view class="customer-address">{{ customer.address }}</view> | |||||
</view> | |||||
</view> | |||||
<view class="service-project" wx:if="{{ !!customer.serviceProject }}"> | |||||
服务项目:{{ customer.serviceProject }} | |||||
</view> | |||||
<view class="gird-view"> | |||||
<view class="gird-view-item fl"> | |||||
<view class="gird-view-num">{{ postDemand }}</view> | |||||
<view class="gird-view-text">发布需求</view> | |||||
</view> | |||||
<view class="gird-view-item fl"> | |||||
<view class="gird-view-num">{{ collectDemand }}</view> | |||||
<view class="gird-view-text">关注</view> | |||||
</view> | |||||
<view class="gird-view-item fl"> | |||||
<view class="gird-view-num">{{ beCollectDemand }}</view> | |||||
<view class="gird-view-text">被关注</view> | |||||
</view> | |||||
<view class="gird-view-item fl"> | |||||
<view class="gird-view-num">{{ totalPageView }}</view> | |||||
<view class="gird-view-text">被浏览量</view> | |||||
</view> | |||||
</view> | |||||
<view class="list-certification" wx:if="{{ customer.isPartner }}"> | |||||
<image class="certification-img" src="/images/home/certification-icon.png" /> | |||||
平台认证 | |||||
</view> | |||||
</view> | |||||
<!-- 需求行 --> | |||||
<view class="demands-view"> | |||||
<image class="demands-img" src="/images/home/demands-icon.png" /> | |||||
<text class="demands-text">需求</text> | |||||
</view> | |||||
<!-- 内容 --> | |||||
<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 }}" bind:getItem="goDetails" pageStatus="homepage"/> | |||||
</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 class="foot-view"> | |||||
<van-button | |||||
block | |||||
color="#5e73e5" | |||||
round | |||||
bind:click="footBtnClick" | |||||
> | |||||
立即沟通 | |||||
</van-button> | |||||
</view> | |||||
</view> | |||||
</view> |
/* pages/index/components/homepage/homepage.wxss */ | |||||
.header-view { | |||||
border-radius: 30rpx; | |||||
background: #fff; | |||||
box-sizing: border-box; | |||||
padding: 26rpx 42rpx; | |||||
padding-bottom: 0; | |||||
position: relative; | |||||
position: sticky; | |||||
top: 0; | |||||
z-index: 999; | |||||
} | |||||
.header-view .user-view{ | |||||
height: 104rpx; | |||||
} | |||||
.header-view .chatHeads-view{ | |||||
width: 104rpx; | |||||
height: 104rpx; | |||||
border-radius: 50%; | |||||
background: #999; | |||||
} | |||||
.header-view .chatHeads-view .chatHeads-img{ | |||||
width: 100%; | |||||
height: 100%; | |||||
border-radius: 50%; | |||||
} | |||||
.header-view .customer-info{ | |||||
width: calc(100% - 104rpx); | |||||
height: 104rpx; | |||||
box-sizing: border-box; | |||||
padding-left: 30rpx; | |||||
padding-bottom: 14rpx; | |||||
padding-top: 10rpx; | |||||
} | |||||
.header-view .customer-nick-name{ | |||||
height: 50rpx; | |||||
line-height: 50rpx; | |||||
font-size: 28rpx; | |||||
color: #333; | |||||
} | |||||
.header-view .customer-address{ | |||||
height: 30rpx; | |||||
line-height: 30rpx; | |||||
font-size: 24rpx; | |||||
color: #999; | |||||
} | |||||
.service-project { | |||||
margin-top: 20rpx; | |||||
color: #999999; | |||||
font-size: 24rpx; | |||||
box-sizing: border-box; | |||||
padding-left: 63rpx; | |||||
} | |||||
.header-view .gird-view{ | |||||
height: 100rpx; | |||||
margin-top: 30rpx; | |||||
} | |||||
.gird-view-item { | |||||
width: 25%; | |||||
text-align: center; | |||||
} | |||||
.gird-view-item .gird-view-num{ | |||||
font-size: 26rpx; | |||||
color: #728dd4; | |||||
font-weight: bold; | |||||
} | |||||
.gird-view-item .gird-view-text{ | |||||
font-size: 24rpx; | |||||
color: #333; | |||||
font-family: SourceHanSansCN-Medium; | |||||
} | |||||
/* 平台认证 */ | |||||
.list-certification { | |||||
position: absolute; | |||||
right: 0; | |||||
top: 22rpx; | |||||
width: 130rpx; | |||||
height: 40rpx; | |||||
line-height: 40rpx; | |||||
background-color: #fff0be; | |||||
border-radius: 18rpx 0 0 18rpx; | |||||
text-align: center; | |||||
color: #ef6f10; | |||||
font-size: 20rpx; | |||||
} | |||||
.list-certification .certification-img{ | |||||
width: 26rpx; | |||||
height: 27rpx; | |||||
position: relative; | |||||
top: 6rpx; | |||||
} | |||||
.demands-view { | |||||
height: 30rpx; | |||||
line-height: 30rpx; | |||||
margin: 30rpx 0; | |||||
} | |||||
.demands-view .demands-img{ | |||||
width: 31rpx; | |||||
height: 29rpx; | |||||
position: relative; | |||||
top: 5rpx; | |||||
} | |||||
.demands-view .demands-text{ | |||||
color: #333333; | |||||
font-size: 26rpx; | |||||
font-weight: bold; | |||||
margin-left: 10rpx; | |||||
} | |||||
.foot-view { | |||||
position: fixed; | |||||
bottom: 0; | |||||
background: #f5f9ff; | |||||
width: 100%; | |||||
box-sizing: border-box; | |||||
padding: 0 40rpx; | |||||
padding-bottom: 20rpx; | |||||
} |
page: page + 1 | page: page + 1 | ||||
}) | }) | ||||
} | } | ||||
console.log('-------------详情页 beg-------------------') | |||||
console.log(this.data.listData); | |||||
console.log('-------------详情页 end-------------------') | |||||
} | } | ||||
}).catch(error => { | }).catch(error => { | ||||
console.log(error, 'error appletLogin') | console.log(error, 'error appletLogin') |
}, | }, | ||||
// 获取list数据 | // 获取list数据 | ||||
getListData() { | getListData() { | ||||
let { page, size, keyword, currentTab, onRefresh, total, moreTab } = this.data; | |||||
console.log(currentTab, moreTab) | |||||
let { page, size, keyword, currentTab, moreTab } = this.data; | |||||
let type = currentTab; | let type = currentTab; | ||||
if (currentTab == 'more') { | if (currentTab == 'more') { | ||||
type = moreTab; | type = moreTab; | ||||
page: page + 1 | page: page + 1 | ||||
}) | }) | ||||
} | } | ||||
console.log('-------------首页 beg-------------------') | |||||
console.log(this.data.listData); | |||||
console.log('-------------首页 end-------------------') | |||||
} | } | ||||
}).catch(error => { | }).catch(error => { | ||||
console.log(error, 'error appletLogin') | console.log(error, 'error appletLogin') |
{ | { | ||||
"usingComponents": { | "usingComponents": { | ||||
"van-button":"/miniprogram_npm/@vant/weapp/button", | |||||
"van-sticky":"/miniprogram_npm/@vant/weapp/sticky", | |||||
"van-tab": "/miniprogram_npm/@vant/weapp/tab", | "van-tab": "/miniprogram_npm/@vant/weapp/tab", | ||||
"van-tabs": "/miniprogram_npm/@vant/weapp/tabs", | "van-tabs": "/miniprogram_npm/@vant/weapp/tabs", | ||||
"van-dropdown-menu": "/miniprogram_npm/@vant/weapp/dropdown-menu", | "van-dropdown-menu": "/miniprogram_npm/@vant/weapp/dropdown-menu", |
min: 0, | min: 0, | ||||
max: 300, | max: 300, | ||||
// 用户有无点击过tag | // 用户有无点击过tag | ||||
isClickTag:false, | |||||
isClickTag: false, | |||||
// 选中tag | // 选中tag | ||||
selectedTag:[], | |||||
detailValue:"", | |||||
selectedTag: [], | |||||
detailValue: "", | |||||
saveLoading:false, | |||||
}, | }, | ||||
/** | /** | ||||
min: len | min: len | ||||
}); | }); | ||||
this.setData({ | this.setData({ | ||||
detailValue:value | |||||
detailValue: value | |||||
}) | }) | ||||
}, | }, | ||||
// tag选择切换 | // tag选择切换 | ||||
tagSelectedChange(e){ | |||||
tagSelectedChange(e) { | |||||
let typename = e.currentTarget.dataset.typename; | let typename = e.currentTarget.dataset.typename; | ||||
let selectedTag = this.data.selectedTag; | let selectedTag = this.data.selectedTag; | ||||
let tempArr = []; | let tempArr = []; | ||||
// 1 如果选中的数组里没有当前type | // 1 如果选中的数组里没有当前type | ||||
if(selectedTag.indexOf(typename) == -1){ | |||||
if (selectedTag.indexOf(typename) == -1) { | |||||
// 2 如果选中的数组的长度小于3 直接push | // 2 如果选中的数组的长度小于3 直接push | ||||
if(selectedTag.length < 3){ | |||||
if (selectedTag.length < 3) { | |||||
selectedTag.push(typename) | selectedTag.push(typename) | ||||
} | } | ||||
} | } | ||||
// 3 如果选中的数组里有它,直接删除 | // 3 如果选中的数组里有它,直接删除 | ||||
else{ | |||||
selectedTag.forEach((el,inx)=>{ | |||||
if(el == typename){ | |||||
selectedTag.splice(inx,1); | |||||
else { | |||||
selectedTag.forEach((el, inx) => { | |||||
if (el == typename) { | |||||
selectedTag.splice(inx, 1); | |||||
} | } | ||||
}) | }) | ||||
} | } | ||||
let tags = this.data.tags; | let tags = this.data.tags; | ||||
tags.forEach(el=>{ | |||||
tags.forEach(el => { | |||||
el.isActive = false | el.isActive = false | ||||
if(selectedTag.indexOf(el.typeName) != -1){ | |||||
if (selectedTag.indexOf(el.typeName) != -1) { | |||||
el.isActive = true; | el.isActive = true; | ||||
} | } | ||||
}) | }) | ||||
selectedTag, | selectedTag, | ||||
tags | tags | ||||
}) | }) | ||||
console.log(this.data.selectedTag,'selectedTag'); | |||||
console.log(this.data.tags,'tags'); | |||||
// console.log(this.data.selectedTag,'selectedTag'); | |||||
// console.log(this.data.tags,'tags'); | |||||
}, | |||||
// 发布需求 | |||||
releaseDemands() { | |||||
this.setData({ | |||||
saveLoading:true | |||||
}) | |||||
let { selectedTag, detailValue } = this.data; | |||||
let param = { | |||||
customerId: 666967, | |||||
info: this.trimRight(detailValue), | |||||
type: selectedTag.join(','), | |||||
businessCommunicationDemandId: null, | |||||
}; | |||||
$request.post('/businessCommunicationDemand/saveDemand.action', param).then(res => { | |||||
this.setData({ | |||||
saveLoading:false | |||||
}) | |||||
let that = this; | |||||
if (res.status == 0) { | |||||
wx.showModal({ | |||||
title: '发布成功', | |||||
content: "请关注平台公众号,如有咨询,可及时接收消息通知!", | |||||
confirmText: "去关注", | |||||
cancelText:"关闭", | |||||
success (res1) { | |||||
if (res1.confirm) { | |||||
that.clearData(); | |||||
console.log('用户点击确定') | |||||
} else if (res1.cancel) { | |||||
let listDetail = res.data; | |||||
if (typeof listDetail.type == 'string') { | |||||
listDetail.type = listDetail.type.split(','); | |||||
} | |||||
that.clearData(); | |||||
wx.navigateTo({ | |||||
url: '/pages/index/components/listDetails/Details', | |||||
success: function (res2) { | |||||
// 通过eventChannel向被打开页面传送数据 | |||||
res2.eventChannel.emit('acceptDataFromOpenerPage', { listDetail }) | |||||
} | |||||
}) | |||||
} | |||||
} | |||||
}) | |||||
} else if (res.status == 501) { | |||||
wx.showModal({ | |||||
title: '发布失败', | |||||
content: res.msg, | |||||
showCancel: false, | |||||
}) | |||||
} | |||||
}).catch(err => { | |||||
console.log(err); | |||||
this.setData({ | |||||
saveLoading:false | |||||
}) | |||||
}) | |||||
}, | |||||
clearData(){ | |||||
this.setData({ | |||||
selectedTag:[], | |||||
detailValue:"", | |||||
}) | |||||
}, | |||||
trimRight(s) { | |||||
if (s == null) return ""; | |||||
var whitespace = new String(" \t\n\r"); | |||||
var str = new String(s); | |||||
if (whitespace.indexOf(str.charAt(str.length - 1)) != -1) { | |||||
var i = str.length - 1; | |||||
while (i >= 0 && whitespace.indexOf(str.charAt(i)) != -1) { | |||||
i--; | |||||
} | |||||
str = str.substring(0, i + 1); | |||||
} | |||||
return str; | |||||
}, | }, | ||||
// 获取tag | // 获取tag | ||||
getTags() { | getTags() { | ||||
}) | }) | ||||
if (res.status == 0) { | if (res.status == 0) { | ||||
let datas = res.data; | let datas = res.data; | ||||
datas.forEach(el=>{ | |||||
datas.forEach(el => { | |||||
el.isActive = false; | el.isActive = false; | ||||
}) | }) | ||||
this.setData({ | this.setData({ | ||||
tags: datas, | tags: datas, | ||||
}) | }) | ||||
} | } | ||||
console.log(this.data.tags,'tags') | |||||
console.log(this.data.tags, 'tags') | |||||
}).catch(error => { | }).catch(error => { | ||||
console.log(error, 'error appletLogin') | console.log(error, 'error appletLogin') | ||||
}) | }) |
<view wx:else> | <view wx:else> | ||||
<!-- 顶部 --> | <!-- 顶部 --> | ||||
<view class="section"> | <view class="section"> | ||||
<textarea class="section-textarea" bindinput="textareaInput" maxlength="{{ max }}" placeholder="请输入你的需求详情~ " /> | |||||
<textarea class="section-textarea" bindinput="textareaInput" maxlength="{{ max }}" placeholder="请输入你的需求详情~ " /> | |||||
<view class="limit">{{min}}/{{max}}</view> | <view class="limit">{{min}}/{{max}}</view> | ||||
</view> | </view> | ||||
<view class="tags-view"> | <view class="tags-view"> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
</view> | </view> | ||||
<view class="submit-btn"> | |||||
<van-button | |||||
block | |||||
color="#5e73e5" | |||||
round | |||||
disabled="{{ !(!!detailValue && selectedTag.length > 0) }}" | |||||
bind:click="releaseDemands" | |||||
loading="{{ saveLoading }}" | |||||
> | |||||
发布需求 | |||||
</van-button> | |||||
</view> | |||||
</view> | </view> | ||||
<tabBar currentIndex="{{currentIndex}}"></tabBar> | <tabBar currentIndex="{{currentIndex}}"></tabBar> | ||||
</view> | </view> |
text-align: center; | text-align: center; | ||||
color: #999999; | color: #999999; | ||||
font-size: 26rpx; | font-size: 26rpx; | ||||
} | |||||
/* 发布按钮 */ | |||||
.submit-btn { | |||||
margin-top: 40rpx; | |||||
box-sizing: border-box; | |||||
padding: 0 40rpx; | |||||
} | } |