Преглед изворни кода

完成我关注的类型

release/210823_需求对对碰
王饶冀 пре 3 година
родитељ
комит
fcfb5b8d13

BIN
images/home/not-data-attention-img.png Прегледај датотеку


+ 1
- 1
pages/index/components/homepage/homepage.wxml Прегледај датотеку

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

+ 2
- 1
pages/index/components/homepage/homepage.wxss Прегледај датотеку

@@ -128,4 +128,5 @@
box-sizing: border-box;
padding: 0 40rpx;
padding-bottom: 20rpx;
}
}


+ 28
- 8
pages/index/index.js Прегледај датотеку

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

+ 26
- 3
pages/index/index.wxml Прегледај датотеку

@@ -43,19 +43,42 @@
<van-loading size="24px">加载中...</van-loading>
</view>
<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" />
<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 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>
</view>
<view class="not-info" wx:else>抱歉,暂无任何需求</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 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">
<listItem item="{{ item }}" bind:getItem="goDetails" />
</view>

+ 45
- 31
pages/index/index.wxss Прегледај датотеку

@@ -7,44 +7,36 @@
box-sizing: border-box;
padding: 20rpx;
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;
}
.search-view .header-img{
.search-view .header-img {
position: absolute;
width: 249rpx;
height: 231rpx;
top: 78rpx;
right: 46rpx;
}
.serach-input-view{
.serach-input-view {
position: relative;
height: 68rpx;
z-index: 999;
}

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



.search-view .input-box {
width: calc(100% - 100rpx);
margin-left: 20rpx;
}
.search-view .weui-serach-input{
.search-view .weui-serach-input {
background: #fff;
height: 90rpx;
line-height: 90rpx;
@@ -52,8 +44,7 @@
padding-left: 40rpx;
padding-right: 80rpx;
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 {
@@ -72,12 +63,11 @@
top: 5rpx;
}


.phcolor {
color: #b3bfcb;
}
}

.search-view .title{
.search-view .title {
margin-top: 64rpx;
font-size: 33rpx;
font-weight: bold;
@@ -85,22 +75,22 @@
box-sizing: border-box;
}

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

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

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

.tab-view .tab-menu .van-dropdown-menu__title{
.tab-view .tab-menu .van-dropdown-menu__title {
width: 0;
padding: 0;
size: 0;
}
.tab-view .tab-menu .van-ellipsis{
.tab-view .tab-menu .van-ellipsis {
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…
Откажи
Сачувај