Sfoglia il codice sorgente

提交代码~

release/210823_需求对对碰
王饶冀 3 anni fa
parent
commit
1df81eafae

+ 5
- 1
app.json Vedi File

@@ -7,7 +7,11 @@
"pages/msgModule/index"
],
"usingComponents": {
"tabBar": "/components/tabbar/tabbar"
"tabBar": "/components/tabbar/tabbar",
"van-loading": "/miniprogram_npm/@vant/weapp/loading",
"van-icon": "/miniprogram_npm/@vant/weapp/icon",
"van-row": "/miniprogram_npm/@vant/weapp/row",
"van-col": "/miniprogram_npm/@vant/weapp/col"
},
"window":{
"backgroundTextStyle":"light",

+ 22
- 0
app.wxss Vedi File

@@ -9,3 +9,25 @@
justify-content: space-between;
box-sizing: border-box;
}

.text-center {
text-align: center;
}

.fl{
float: left;
}
.fr{
float: right;
}
.not-data {
text-align: center;
padding-top: 70rpx;
}
.not-data .not-data-img{
width: 295rpx;
height: 240rpx;
}
.not-data .not-info{
color: #b3bfcb;
}

BIN
images/home/browse-icon.png Vedi File


BIN
images/home/certification-icon.png Vedi File


BIN
images/home/chat-icon.png Vedi File


BIN
images/home/company-icon.png Vedi File


BIN
images/home/finished-icon.png Vedi File


BIN
images/home/header-icon.png Vedi File


BIN
images/home/hhr-icon.png Vedi File


BIN
images/home/not-data.png Vedi File


BIN
images/home/personal-icon.png Vedi File


BIN
images/home/search-icon.png Vedi File


BIN
images/home/time-icon.png Vedi File


+ 204
- 155
pages/index/index.js Vedi File

@@ -10,44 +10,41 @@ Page({
tabData: [
{
text: "全部",
code: "all"
value: "all"
},
{
text: "我关注的",
code: "my1"
},
{
text: "工商类",
code: "my2"
},
{
text: "财税类",
code: "my3"
},
{
text: "公司转让",
code: "my4"
value: "my1"
},
],
currentTab: "all",
// 更多tab
moreTabOption:[
{ text: '资质类', value: "zizhi" },
{ text: '知识产权', value: "zhishi" },
{ text: '银行服务', value: "yinhang" },
{ text: '法律服务', value: "falv" },
{ text: '其他', value: "qita" },
],
moreTabOption: [],
moreTab: "gengduo",
moreTitle:"更多",
moreTitle: "更多",
// list数据加载
// list块加载
listLoading: false,
// item行加载
itemLoading: false,
// 数据是否加载完成
isFinished: false,
listData: [],
page: 1,
size: 10,
total: 0,
// 是否加载数据,true加载,false不加载
onRefresh: true,
},
onLoad() {
this.getListData();
this.setData({
listLoading: true,
})
// 获取分类
this.getAllType();
},
toggleMore() {
this.selectComponent('#item').toggle();
},
// 搜索框输入同步值
bindKeyInput: function (e) {
@@ -58,158 +55,210 @@ Page({
// 点击搜索
toSearch(e) {
console.log(this.data.keyword)
this.setData({
listData: [],
onRefresh: true,
isFinished: false,
listLoading: true,
page: 1,
})
this.getListData();
},
// tab切换
tabChange(e) {
let dataset = e.currentTarget.dataset;
// if(dataset.value == 'my1'){
// console.log(this.selectComponent('#shouquan'));
// return
// }
// 如果实在加载中点击无效
if (this.data.listLoading) {
return
}
// 如果当前tab是选中直接点击无效
if (this.data.currentTab == dataset.value) {
return
}
this.setData({
currentTab: dataset.code,
moreTitle:"更多",
currentTab: dataset.value,
moreTitle: "更多",
moreTab: "gengduo"
})
this.getListData();
this.toSearch();
},
// 更多tab切换
moreTabChange(e){
moreTabChange(e) {
// 如果实在加载中点击无效
if (this.data.listLoading) {
return
}
// 如果当前tab是选中直接点击无效
if (this.data.moreTab == e.detail) {
return
}
let moreTitle = "";
this.data.moreTabOption.forEach(el=>{
if(el.value == e.detail){
this.data.moreTabOption.forEach(el => {
if (el.value == e.detail) {
moreTitle = el.text;
}
})
this.setData({
currentTab: "more",
moreTab:e.detail,
moreTab: e.detail,
moreTitle
})
this.getListData();
this.toSearch();
},
// 获取tab数据
getAllType() {
$request.get('/businessCommunicationType/getAllType.action').then(res => {
console.log(res);
if (res.status == 0) {
let { tabData, moreTabOption } = this.data;
let datas = res.data;
datas.forEach(el => {
if (tabData.length < 5) {
tabData.push({
text: el.typeName,
value: el.typeName
})
} else {
moreTabOption.push({
text: el.typeName,
value: el.typeName
})
}
})
this.setData({
tabData,
moreTabOption
})
this.getListData();
}
}).catch(error => {
console.log(error, 'error appletLogin')
})
},
// 获取list数据
getListData() {
let { page, size, keyword, currentTab, onRefresh, total,moreTab } = this.data;
let { page, size, keyword, currentTab, onRefresh, total, moreTab } = this.data;
console.log(currentTab, moreTab)
let type = currentTab;
if(currentTab == 'more'){
type = moreTab
if (currentTab == 'more') {
type = moreTab;
}
if (type == 'all') {
type = "";
}
console.log({ page, size, keyword, onRefresh, total, type });
// $request.get('/businessCommunicationDemand/getDemandByKeywordOrType.action',
// { page, size }
// ).then(res => {
// if (res.status == 0) {
// let tempListData = this.data.listData;
// let datas = res.data;
// tempListData.push(...datas.demandList);
// // f赋值,且设置总数
// this.setData({
// listData: tempListData,
// total: res.data.total,
// })
// }
// }).catch(error => {
// console.log(error, 'error appletLogin')
// })
$request.get('/businessCommunicationDemand/getDemandByKeywordOrType.action',
{ page, size, keyword, type }
).then(res => {
// console.log(res);
this.setData({
listLoading: false
})
let tempListData = this.data.listData;
if (res.status == 0) {
let datas = res.data;
// 先push数据
tempListData.push(...datas.demandList);
tempListData.forEach(el => {
if (typeof el.type == 'string') {
el.type = el.type.split(',');
}
})
// 设置总数
this.setData({
listData: tempListData,
total: res.data.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(this.data.listData);
}
}).catch(error => {
console.log(error, 'error appletLogin')
})
},
// getListData() {
// let { page, size, keyword, currentTab, onRefresh,total } = this.data;
// $request.get('/businessCommunicationDemand/getDemandByKeywordOrType.action',
// { page, size }
// ).then(res => {
// // console.log(res);

// // let tempListData = this.data.listData;
// // if (res.status == 0) {
// // let datas = res.data;
// // // 先push数据
// // tempListData.push(...datas.demandList);
// // // 设置总数
// // this.setData({
// // listData: tempListData,
// // total: res.data.total,
// // })
// // console.log(tempListData.length,this.data.total)
// // // 如果数据大于了返回的总数
// // if(tempListData.length >= this.data.total){
// // // 停止累加数据
// // this.setData({
// // onRefresh: false
// // })
// // }else{
// // this.setData({
// // onRefresh: true
// // })
// // }
// // this.setData({
// // page: page + 1
// // })
// // if()
// // if (datas != null && datas.demandList.length > 0) {
// // if (onRefresh) {//false为重新刷新数据,true为分页累加数据
// // this.setData({
// // // total: 5,
// // listData: this.data.listData.concat(datas.demandList), //累加list,
// // page: page + 1
// // });
// // } else {
// // this.setData({
// // // total: 5,
// // listData: datas.demandList, //重新覆盖list,
// // page: page + 1
// // });
// // }

// // } else {
// // wx.showToast({
// // title: '没有更多数据了',
// // icon: 'none'
// // })
// // that.setData({
// // isloading: true
// // })

// // }
// // tempListData.push(...res.data.demandList);

// // console.log(this.data)
// }
// }).catch(error => {
// console.log(error, 'error appletLogin')
// })
// },
// /**
// * 页面相关事件处理函数--监听用户下拉动作
// */
// onPullDownRefresh: function () {
// console.log('fresh')

// var that = this;
// that.setData({
// page: 1,
// size: 10,
// onRefresh: false //重新加载数据
// });
// //调用刷新时将执行的方法
// //0.5s加载显示,如果不加会一直显示加载中,造成不好的用户体验
// // var that = this
// wx.showNavigationBarLoading() //在标题栏中显示加载
// setTimeout(function () {
// wx.showLoading({
// title: '加载中',//加载转圈显示
// });
// that.getListData();
// wx.hideNavigationBarLoading() //完成停止加载
// wx.stopPullDownRefresh() //停止下拉刷新
// }, 500);

// },

// /**
// * 页面上拉触底事件的处理函数
// */
// onReachBottom() {
// console.log('bottom');
// if(this.data.onRefresh){
// // wx.showLoading({
// // title: '加载中',//加载转圈显示
// // });
// this.getListData();
// }
// },
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
if (this.data.onRefresh) {
this.setData({
itemLoading: true
})
this.getListData();
}
},
/**
* 授权获取加密信息
*/
getPhoneNumber(e) {
if (!!e.detail.iv && !!e.detail.encryptedData) {
const iv = e.detail.iv
const encryptedData = e.detail.encryptedData
this.appletLogin(iv, encryptedData)
} else {
wx.showToast({
title: '请允许授权,获得更好的服务哦',
icon: "none",
duration: 3000
})
}
},
/**
* 用户授权信息存储
*/
appletLogin(iv, encrypted) {
$request.get('/com/appletLogin.action', {
// openid: app.globalData.openid,
iv: iv,
encryptedData: encrypted,
sessionKey: app.globalData.sessionKey,
loginState: "业务交流通",
}).then(res => {
this.getUserSession()
}).catch(error => {
console.log(error, 'error appletLogin')
})
},
/**
* 获取用户身份信息
*/
getUserSession() {
let that = this
wx.showLoading({
title: '加载中',
mask: true
})
$request.post('/script/getSession.action', {}).then(res => {
// 如果有传入的urlcustomer
// 跳转到传入地址页面
wx.setStorageSync('customerId', res.data.customer.customerId) //存储用户customerId到本地
that.setData({
isLogin: true
})
app.globalData.customerId = res.data.customer.customerId
wx.hideLoading()
that.checkIsFinish(res.data.customer.customerId, 1)
}).catch(error => {
console.log(error, "获取error")
})
},
})

+ 2
- 1
pages/index/index.json Vedi File

@@ -5,6 +5,7 @@
"van-tab": "/miniprogram_npm/@vant/weapp/tab",
"van-tabs": "/miniprogram_npm/@vant/weapp/tabs",
"van-dropdown-menu": "/miniprogram_npm/@vant/weapp/dropdown-menu",
"van-dropdown-item": "/miniprogram_npm/@vant/weapp/dropdown-item"
"van-dropdown-item": "/miniprogram_npm/@vant/weapp/dropdown-item",
"van-search": "/miniprogram_npm/@vant/weapp/search/index"
}
}

+ 98
- 22
pages/index/index.wxml Vedi File

@@ -3,34 +3,110 @@
<!-- 搜索块 -->
<view class="search-view">
<view class="serach-input-view">
<input class="serach-input weui-input" bindinput="bindKeyInput" bindconfirm="toSearch" placeholder="请输入关键字搜索" confirm-type="search" />
<image class="hhr-img fl" src="/images/home/hhr-icon.png" />
<view class="input-box fl">
<input class="weui-serach-input" value="{{ keyword }}" bindinput="bindKeyInput" confirm-type="search" placeholder="请输入关键字搜索" placeholder-class="phcolor"></input>
</view>
<view class="search-img-view" bindtap="toSearch">
<image class="search-img" src="/images/home/search-icon.png" />
</view>
</view>
<view class="title">
全方位需求
<text class="sub-title">交流平台</text>
</view>
<button type="default" plain open-type="getPhoneNumber" bindgetphonenumber="getPhoneNumber" class="set-attention" id="shouquan">
设置关注类型喜好 >>
</button>
<image class="header-img" src="/images/home/header-icon.png" />
</view>
<!-- tab块 -->
<van-sticky>
<view class="tab-view">
<view wx:for="{{tabData}}" class="tab-li" wx:key="*this">
<text class="tab-span {{currentTab == item.code ? 'isActive' : ''}}" bindtap="tabChange" data-code="{{ item.code }}">
{{item.text}}
</text>
</view>
<view class="tab-li last">
<van-dropdown-menu class="tab-menu" active-color="#5e73e5">
<van-dropdown-item
title="{{ moreTitle }}"
bindchange="moreTabChange"
title-class="{{ currentTab == 'more' ? 'isActive' : '' }}"
value="{{ moreTab }}"
options="{{ moreTabOption }}"
/>
</van-dropdown-menu>
<view class="tab-view">
<view wx:for="{{tabData}}" class="tab-li" wx:key="*this">
<view class="tab-span {{currentTab == item.value ? 'isActive' : ''}}" bindtap="tabChange" data-value="{{ item.value }}">
{{item.text}}
</view>
</view>
<view class="tab-li last">
<view class="tab-span {{currentTab == 'more' ? 'isActive' : ''}}" bindtap="toggleMore">
{{ moreTitle }}
</view>
</view>
</van-sticky>
<van-button>测试</van-button>
<view class="tab-li right">
<van-dropdown-menu class="tab-menu" active-color="#5e73e5">
<van-dropdown-item id="item" bindchange="moreTabChange" title-class="{{ currentTab == 'more' ? 'isActive' : '' }}" value="{{ moreTab }}" options="{{ moreTabOption }}" />
</van-dropdown-menu>
</view>
</view>
<!-- list块 -->
<view class="list-view" wx:for="{{ listData }}" wx:key="*this">
<view class="list-avatar">头像--{{ index }}</view>
<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" wx:if="{{ currentTab == 'all' }}">
抱歉,暂无任何需求
</view>
<view class="not-info" wx:else>
抱歉,暂无任何需求
</view>
</view>
<view wx:else>
<view class="list-view" wx:for="{{ listData }}" wx:key="*this">
<!-- 平台认证 -->
<view class="list-certification" wx:if="{{ item.isPartner }}">
<image class="certification-img" src="/images/home/certification-icon.png" />
平台认证
</view>
<!-- 头部 -->
<view class="list-avatar">
<view class="list-chatHeads fl">
<image class="chatHeads-img" src="{{ item.chatHeads }}" />
</view>
<view class="list-nick-name fl">{{ item.nickName }}</view>
<view class="list-home fl">
<image class="home-img" src="{{ item.isPartner ? '/images/home/company-icon.png' : '/images/home/personal-icon.png' }}" />
主页
</view>
</view>
<!-- 内容 -->
<view class="list-content">
<!-- 详情 -->
<view>
<text space class="list-details-text">{{ 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 class="list-foot">
<view class="fl list-foot-text-lf">
<image class="time-img" src="/images/home/time-icon.png" />
2021-07-23
</view>
<view class="fl list-foot-text-lf">
<image class="browse-img" src="/images/home/browse-icon.png" />
897浏览量
</view>
<view class="fr list-foot-text-chat">
<image class="chat-img" src="/images/home/chat-icon.png" />
聊一聊
</view>
</view>
</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>
<tabBar currentIndex="{{currentIndex}}"></tabBar>
</view>

+ 265
- 31
pages/index/index.wxss Vedi File

@@ -9,21 +9,99 @@

/* 搜索块 */
.search-view {
height: 230rpx;
background: #edeff4;
border-radius: 15rpx;
height: 290rpx;
border-radius: 20rpx;
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);
position: relative;
}
.search-view .header-img{
position: absolute;
width: 249rpx;
height: 231rpx;
top: 78rpx;
right: 46rpx;
}
.serach-input-view{
position: relative;
height: 68rpx;
z-index: 999;
}

.serach-input-view .hhr-img{
width: 68rpx;
height: 68rpx;
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 .serach-input {
border: 1px solid #dcdfe6;
.search-view .input-box {
width: calc(100% - 100rpx);
margin-left: 20rpx;
}
.search-view .weui-serach-input{
background: #fff;
height: 90rpx;
line-height: 90rpx;
box-sizing: border-box;
padding-left: 40rpx;
border-radius: 40rpx;
height: 80rpx;
padding-right: 80rpx;
border-radius: 44rpx;
box-shadow: -2px 7px 13px 3px
rgba(130, 130, 130, 0.03);
}
.phcolor {
color: #b3bfcb;
}

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

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

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

/* tab块 */
@@ -33,6 +111,11 @@
background: #fff;
border-radius: 10rpx;
padding: 0 20rpx;
width: 100%;
position: sticky;
top: 0;
z-index: 999;
box-sizing: border-box;
}
.tab-view .tab-li {
float: left;
@@ -40,49 +123,200 @@
height: 70rpx;
padding: 0 13rpx;
}
.tab-view .tab-li.last{
padding: 0 12rpx;
}

.tab-view .tab-span {
display: inline-block;
position: relative;
top: -26rpx;
font-size: 26rpx;
box-sizing: border-box;
padding-top: 15rpx;
}
.tab-view .tab-span.isActive {
color: #5e73e5;
border-bottom: 2px solid #5e73e5;
}
.tab-view .tab-li.right{
padding: 0;
}
.tab-view .tab-menu .van-dropdown-menu {
height: 70rpx;
background: transparent;
box-shadow:none;
position: relative;
left: -15rpx;
}
.tab-view .tab-menu .van-dropdown-menu__title {
padding: 0 8rpx;
top: 1rpx;
.tab-view .tab-menu .van-dropdown-menu__item {
width: 0;
}
.tab-view .tab-menu .isActive.van-dropdown-menu__title{
/* top: 1rpx; */
}
.tab-view .tab-menu .isActive .van-ellipsis{
color: #5e73e5;
border-bottom: 2px solid #5e73e5;

.tab-view .tab-menu .van-dropdown-menu__title{
width: 0;
padding: 0;
size: 0;
}
.tab-view .tab-menu .van-ellipsis{
font-size: 27rpx;
color: #000;
display: none;
}
.tab-view .tab-menu .van-dropdown-menu__title:after {
right: -10rpx;
}

/* list块 */
.list-view {
background: #fff;
height: 160rpx;
/* height: 315rpx; */
border-radius: 20rpx;
margin-bottom: 20rpx;
padding: 28rpx 18rpx;
position: relative;
}
.list-loading {
margin-top: 15vh;
}
.list-finished{
color: #8c97c0;
}
.list-finished .finished-img{
width: 25rpx;
height: 25rpx;
margin-right: 10rpx;
position: relative;
top: 1rpx;
}

/* list块-头部 */
.list-avatar {
height: 60rpx;
line-height: 60rpx;
}
.list-chatHeads{
width: 60rpx;
height: 60rpx;
border-radius: 50%;
background: #999;
}
.list-chatHeads .chatHeads-img{
width: 100%;
height: 100%;
border-radius: 50%;
}
/* 平台认证 */
.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;
}
/* 名称 */
.list-nick-name {
margin-left: 15rpx;
max-width: 300rpx;
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
font-weight: bold;
}
/* 主页 */
.list-home {
color: #827de5;
border-radius: 16px;
border: solid 1px #827de5;
width: 96rpx;
height: 32rpx;
line-height: 32rpx;
font-size: 20rpx;
text-align: center;
margin-top: 15rpx;
margin-left: 15rpx;
}
.list-home .home-img{
width: 22rpx;
height: 23rpx;
position: relative;
top: 2rpx;
}

/* 内容容器 */
.list-content {
padding-left: 75rpx;
padding-right: 15rpx;
}
/* 详情 */
.list-details-text{
margin: 15rpx 0;
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
}
/* 标签 */
.list-tag-view {
margin-bottom: 20rpx;
}
.list-tag-view .list-tag{
display: inline-block;
width: 120rpx;
height: 36rpx;
border-radius: 18rpx;
text-align: center;
line-height: 36rpx;
font-size: 20rpx;
margin-right: 15rpx;
}
.list-tag-view .list-tag:nth-child(1){
background-color: #e4f1f7;
color: #3d97e6;
}
.list-tag-view .list-tag:nth-child(2){
background-color: #f7eee4;
color: #f29f61;
}
.list-tag-view .list-tag:nth-child(3){
background-color: #eafee3;
color: #80c269;
}
/* 底部 */
.list-foot {
height: 62rpx;
line-height: 62rpx;
}
.list-foot-text-lf{
color: #999;
font-size: 24rpx;
margin-right: 40rpx;
}
.list-foot-text-lf .browse-img{
width: 24rpx;
height: 18rpx;
}
.list-foot-text-lf .time-img{
width: 24rpx;
height: 24rpx;
position: relative;
top: 1rpx;
}
.list-foot-text-chat {
height: 62rpx;
width: 180rpx;
background-color: #5e73e5;
box-shadow: -1px 3px 12px 4px
rgba(62, 95, 179, 0.14);
border-radius: 31rpx;
text-align: center;
color: #fff;
font-size: 24rpx;
}
.list-foot-text-chat .chat-img{
width: 28rpx;
height: 28rpx;
position: relative;
top: 4rpx;
left: -10rpx;
}

Loading…
Annulla
Salva