Browse Source

完成我关注的类型

release/210823_需求对对碰
王饶冀 4 years ago
parent
commit
fcfb5b8d13

BIN
images/home/not-data-attention-img.png View File


+ 1
- 1
pages/index/components/homepage/homepage.wxml View File

<!-- 需求行 --> <!-- 需求行 -->
<view class="demands-view"> <view class="demands-view">
<image class="demands-img" src="/images/home/demands-icon.png" /> <image class="demands-img" src="/images/home/demands-icon.png" />
<text class="demands-text">需求</text>
<text class="demands-text">{{ isOther ? '需求' : '我的需求'}}</text>
</view> </view>
<!-- 内容 --> <!-- 内容 -->
<view class="not-data" wx:if="{{ listData.length < 1 }}"> <view class="not-data" wx:if="{{ listData.length < 1 }}">

+ 2
- 1
pages/index/components/homepage/homepage.wxss View File

box-sizing: border-box; box-sizing: border-box;
padding: 0 40rpx; padding: 0 40rpx;
padding-bottom: 20rpx; padding-bottom: 20rpx;
}
}


+ 28
- 8
pages/index/index.js View File

total: 0, total: 0,
// 是否加载数据,true加载,false不加载 // 是否加载数据,true加载,false不加载
onRefresh: true, onRefresh: true,
// 当前登录用户已设置的关注类型
attentionTypeIds: "",
// 用来判断关注显示按钮
paramIsInterest:0,
}, },
onLoad() { onLoad() {
}, },
onShow(){
onShow() {
// console.log(`会触发吗?`) // console.log(`会触发吗?`)
this.toSearch(); this.toSearch();
const businessCommunicationCustomer = wx.getStorageSync('businessCommunicationCustomer') || null;
if (businessCommunicationCustomer) {
this.setData({
attentionTypeIds: businessCommunicationCustomer.attentionTypeIds.split(',')
})
}
}, },
toggleMore() { toggleMore() {
this.selectComponent('#item').toggle(); this.selectComponent('#item').toggle();
}) })
}, },
// 获取list数据 // 获取list数据
getListData() {
getListData(isInterest) {
let { page, size, keyword, currentTab, moreTab } = this.data; let { page, size, keyword, currentTab, moreTab } = this.data;
let type = currentTab; let type = currentTab;
if (currentTab == 'more') { if (currentTab == 'more') {
if (type == 'all') { if (type == 'all') {
type = ""; type = "";
} }
if(currentTab == 'my' ){
if (currentTab == 'my') {
type = app.globalData.businessCommunicationCustomer.attentionTypeIds; type = app.globalData.businessCommunicationCustomer.attentionTypeIds;
} }
let paramIsInterest = 0;
if(isInterest){
paramIsInterest = isInterest;
}
this.setData({
paramIsInterest
})
$request.get('/businessCommunicationDemand/getDemandByKeywordOrType.action', $request.get('/businessCommunicationDemand/getDemandByKeywordOrType.action',
{ page, size, keyword, type, isInterest: 0 }
{ page, size, keyword, type, isInterest: paramIsInterest }
).then(res => { ).then(res => {
// console.log(res); // console.log(res);
let tempListData = this.data.listData; let tempListData = this.data.listData;
if (res.status == 0) { if (res.status == 0) {
let datas = res.data; let datas = res.data;
this.setData({ this.setData({
listLoading: false listLoading: false
}) })
if(this.data.attentionTypeIds.length > 0 && res.data.total == 0){
this.getListData(1);
}
console.log(paramIsInterest,'isInterest')
}).catch(error => { }).catch(error => {
console.log(error, 'error appletLogin') console.log(error, 'error appletLogin')
}) })
} }
}, },
setAttention() { setAttention() {
if(!app.globalData.customerId){
if (!app.globalData.customerId) {
app.goLogin(); app.goLogin();
return return
} }
let customerid = app.globalData.customerId; let customerid = app.globalData.customerId;
wx.navigateTo({ wx.navigateTo({
url:"/pages/myModule/components/myAttention/myAttention",
url: "/pages/myModule/components/myAttention/myAttention",
success: function (res) { success: function (res) {
// 通过eventChannel向被打开页面传送数据 // 通过eventChannel向被打开页面传送数据
res.eventChannel.emit('customerid', { customerid }) res.eventChannel.emit('customerid', { customerid })

+ 26
- 3
pages/index/index.wxml View File

<van-loading size="24px">加载中...</van-loading> <van-loading size="24px">加载中...</van-loading>
</view> </view>
<view wx:else> <view wx:else>
<view class="not-data" wx:if="{{ listData.length < 1 }}">
<view class="not-data" wx:if="{{ listData.length < 1 && !(currentTab == 'my' && attentionTypeIds.length > 0) }}">
<image class="not-data-img" src="/images/home/not-data.png" /> <image class="not-data-img" src="/images/home/not-data.png" />
<view class="not-info" wx:if="{{ currentTab == 'all' }}">抱歉,暂无任何需求</view> <view class="not-info" wx:if="{{ currentTab == 'all' }}">抱歉,暂无任何需求</view>
<view class="not-info" wx:elif="{{ currentTab == 'my' }}">
<view class="not-info" wx:elif="{{ currentTab == 'my' && attentionTypeIds.length < 1}}">
<view>您尚未设置关注类型喜好</view> <view>您尚未设置关注类型喜好</view>
<view style="margin-bottom: 10rpx;">设置后将为您进行需求推荐~</view> <view style="margin-bottom: 10rpx;">设置后将为您进行需求推荐~</view>
<van-button class="set-attention-btn" color="#5e73e5" round bind:click="setAttention">
<van-button class="set-attention-btn" color="#5e73e5" round bind:click="setAttention">
设置关注类型喜好 设置关注类型喜好
</van-button> </van-button>
</view> </view>
<view class="not-info" wx:else>抱歉,暂无任何需求</view> <view class="not-info" wx:else>抱歉,暂无任何需求</view>
</view> </view>
<view class="not-data" wx:elif="{{ listData.length < 1 && (currentTab == 'my' && attentionTypeIds.length > 0) }}">
<view class="not-info-attention-type">
<view class="not-data-attention-view fl">
<image class="not-data-attention-img" src="/images/home/not-data-attention-img.png" />
</view>
<view class="not-info">抱歉,您关注的类型暂无任何需求</view>
<van-button class="set-attention-btn fl" color="#5e73e5" round bind:click="setAttention" size="small">
更换关注类型
</van-button>
</view>
</view>
<view wx:else> <view wx:else>
<view class="not-data clearfix" wx:if="{{ paramIsInterest == 1 }}">
<view class="not-info-attention-type">
<view class="not-data-attention-view fl">
<image class="not-data-attention-img" src="/images/home/not-data-attention-img.png" />
</view>
<view class="not-info">抱歉,您关注的类型暂无任何需求</view>
<van-button class="set-attention-btn fl" color="#5e73e5" round bind:click="setAttention" size="small">
更换关注类型
</van-button>
</view>
</view>
<view class="view-interested" wx:if="{{ paramIsInterest == 1 }}">为您推荐以下内容</view>
<view class="list-view" wx:for="{{ listData }}" wx:key="*this"> <view class="list-view" wx:for="{{ listData }}" wx:key="*this">
<listItem item="{{ item }}" bind:getItem="goDetails" /> <listItem item="{{ item }}" bind:getItem="goDetails" />
</view> </view>

+ 45
- 31
pages/index/index.wxss View File

box-sizing: border-box; box-sizing: border-box;
padding: 20rpx; padding: 20rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;
background-image: linear-gradient(45deg,
#ffffff 0%,
#e8eaf1 100%),
linear-gradient(
#f8f8f8,
#f8f8f8);
background-blend-mode: normal,
normal;
box-shadow: 0px 2px 26px 1px
rgba(0, 0, 0, 0.06);
background-image: linear-gradient(45deg, #ffffff 0%, #e8eaf1 100%),
linear-gradient(#f8f8f8, #f8f8f8);
background-blend-mode: normal, normal;
box-shadow: 0px 2px 26px 1px rgba(0, 0, 0, 0.06);
position: relative; position: relative;
} }
.search-view .header-img{
.search-view .header-img {
position: absolute; position: absolute;
width: 249rpx; width: 249rpx;
height: 231rpx; height: 231rpx;
top: 78rpx; top: 78rpx;
right: 46rpx; right: 46rpx;
} }
.serach-input-view{
.serach-input-view {
position: relative; position: relative;
height: 68rpx; height: 68rpx;
z-index: 999; z-index: 999;
} }


.serach-input-view .hhr-img{
.serach-input-view .hhr-img {
width: 68rpx; width: 68rpx;
height: 68rpx; height: 68rpx;
margin-top: 15rpx; margin-top: 15rpx;
} }




.search-view .input-box { .search-view .input-box {
width: calc(100% - 100rpx); width: calc(100% - 100rpx);
margin-left: 20rpx; margin-left: 20rpx;
} }
.search-view .weui-serach-input{
.search-view .weui-serach-input {
background: #fff; background: #fff;
height: 90rpx; height: 90rpx;
line-height: 90rpx; line-height: 90rpx;
padding-left: 40rpx; padding-left: 40rpx;
padding-right: 80rpx; padding-right: 80rpx;
border-radius: 44rpx; border-radius: 44rpx;
box-shadow: -2px 7px 13px 3px
rgba(130, 130, 130, 0.03);
box-shadow: -2px 7px 13px 3px rgba(130, 130, 130, 0.03);
} }


.search-view .search-img-view { .search-view .search-img-view {
top: 5rpx; top: 5rpx;
} }



.phcolor { .phcolor {
color: #b3bfcb; color: #b3bfcb;
}
}


.search-view .title{
.search-view .title {
margin-top: 64rpx; margin-top: 64rpx;
font-size: 33rpx; font-size: 33rpx;
font-weight: bold; font-weight: bold;
box-sizing: border-box; box-sizing: border-box;
} }


.search-view .sub-title{
.search-view .sub-title {
font-weight: normal; font-weight: normal;
} }


.search-view .set-attention{
.search-view .set-attention {
margin-top: 14rpx; margin-top: 14rpx;
padding-left: 40rpx; padding-left: 40rpx;
font-size: 24rpx; font-size: 24rpx;
color: #556fb5!important;
color: #556fb5 !important;
box-sizing: border-box; box-sizing: border-box;
text-align: left; text-align: left;
} }
.search-view .set-attention::after{
.search-view .set-attention::after {
display: none; display: none;
} }
.search-view .set-attention[type=default][plain] {
.search-view .set-attention[type="default"][plain] {
border: 0; border: 0;
} }


position: sticky; position: sticky;
top: 0; top: 0;
z-index: 999; z-index: 999;
box-sizing: border-box;
box-sizing: border-box;
} }
.tab-view .tab-li { .tab-view .tab-li {
float: left; float: left;
color: #5e73e5; color: #5e73e5;
border-bottom: 2px solid #5e73e5; border-bottom: 2px solid #5e73e5;
} }
.tab-view .tab-li.right{
.tab-view .tab-li.right {
padding: 0; padding: 0;
} }
.tab-view .tab-menu .van-dropdown-menu { .tab-view .tab-menu .van-dropdown-menu {
height: 70rpx; height: 70rpx;
background: transparent; background: transparent;
box-shadow:none;
box-shadow: none;
} }
.tab-view .tab-menu .van-dropdown-menu__item { .tab-view .tab-menu .van-dropdown-menu__item {
width: 0; width: 0;
} }


.tab-view .tab-menu .van-dropdown-menu__title{
.tab-view .tab-menu .van-dropdown-menu__title {
width: 0; width: 0;
padding: 0; padding: 0;
size: 0; size: 0;
} }
.tab-view .tab-menu .van-ellipsis{
.tab-view .tab-menu .van-ellipsis {
display: none; display: none;
} }


.not-info-attention-type .not-data-attention-view {
width: 194rpx;
height: 150rpx;
margin-left: 50rpx;
}
.not-info-attention-type .not-data-attention-view .not-data-attention-img {
width: 100%;
height: 100%;
}
.not-info-attention-type .not-info{
box-sizing: border-box;
padding-top: 20rpx;
}
.not-info-attention-type .set-attention-btn {
margin-top: 10rpx;
margin-left: 50rpx;
}
.not-info-attention-type .set-attention-btn .van-button--small {
padding: 0 30rpx;
}

.view-interested{
margin-top: 70rpx;
}

Loading…
Cancel
Save