ソースを参照

待开发:查看个人主页

release/210823_需求对对碰
王饶冀 3年前
コミット
c69cbc0ff1

+ 6
- 4
app.json ファイルの表示

@@ -1,19 +1,21 @@
{
"pages": [
"pages/releaseModule/index",
"pages/index/index",
"pages/logs/logs",
"pages/myModule/index",
"pages/releaseModule/index",
"pages/msgModule/index",
"pages/index/components/listDetails/Details"
"pages/index/components/listDetails/Details",
"pages/index/components/homepage/homepage"
],
"usingComponents": {
"tabBar": "/components/tabbar/tabbar",
"listItem":"/components/listItem/listItem",
"listItem": "/components/listItem/listItem",
"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"
"van-col": "/miniprogram_npm/@vant/weapp/col",
"van-button": "/miniprogram_npm/@vant/weapp/button"
},
"window": {
"backgroundTextStyle": "light",

+ 9
- 0
app.wxss ファイルの表示

@@ -1,5 +1,6 @@
/**app.wxss**/
@import '/miniprogram_npm/weui-miniprogram/weui-wxss/dist/style/weui.wxss';

.container {
width: 100%;
height: 100%;
@@ -88,4 +89,12 @@
height: 0;
clear: both;
visibility: hidden;
}


/* CSS超出显示... */
.yichu{
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
}

+ 12
- 1
components/listItem/listItem.js ファイルの表示

@@ -7,7 +7,7 @@ Component({
item: {
type: Object,
},
// index => 首页 detatil => 详情 home => 个人主页
// index => 首页 detatil => 详情 homepage => 个人主页
pageStatus: {
type: String,
default: 'index',
@@ -31,5 +31,16 @@ Component({
let dataset = e.currentTarget.dataset;
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 })
}
})
},
}
})

+ 8
- 5
components/listItem/listItem.wxml ファイルの表示

@@ -1,16 +1,18 @@
<!-- 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 }}">
<image class="certification-img" src="/images/home/certification-icon.png" />
平台认证
</view>
<!-- 头部 -->
<view class="list-avatar">
<view class="list-avatar" wx:if="{{ pageStatus != 'homepage' }}">
<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">
<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' }}" />
主页
</view>
@@ -20,7 +22,8 @@
<view bindtap="goDetails" data-item="{{ item }}">
<!-- 详情 -->
<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 class="list-tag-view">
@@ -40,8 +43,8 @@
{{ item.pageView }}浏览量
</view>
<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 class="fr list-foot-text-chat">

+ 9
- 0
components/listItem/listItem.wxss ファイルの表示

@@ -169,4 +169,13 @@

.is-details-page .list-foot-text-lf{
margin-right: 20rpx;
}

/* 置顶 */
.ontop-img {
position: absolute;
left: 0;
top: 0;
width: 67rpx;
height: 62rpx;
}

バイナリ
images/home/demands-icon.png ファイルの表示


バイナリ
images/home/ontop-icon.png ファイルの表示


+ 129
- 0
pages/index/components/homepage/homepage.js ファイルの表示

@@ -0,0 +1,129 @@
// 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 () {

}
})

+ 4
- 0
pages/index/components/homepage/homepage.json ファイルの表示

@@ -0,0 +1,4 @@
{
"usingComponents": {
}
}

+ 79
- 0
pages/index/components/homepage/homepage.wxml ファイルの表示

@@ -0,0 +1,79 @@
<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>

+ 131
- 0
pages/index/components/homepage/homepage.wxss ファイルの表示

@@ -0,0 +1,131 @@
/* 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;
}

+ 0
- 3
pages/index/components/listDetails/Details.js ファイルの表示

@@ -94,9 +94,6 @@ Page({
page: page + 1
})
}
console.log('-------------详情页 beg-------------------')
console.log(this.data.listData);
console.log('-------------详情页 end-------------------')
}
}).catch(error => {
console.log(error, 'error appletLogin')

+ 1
- 5
pages/index/index.js ファイルの表示

@@ -151,8 +151,7 @@ Page({
},
// 获取list数据
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;
if (currentTab == 'more') {
type = moreTab;
@@ -199,9 +198,6 @@ Page({
page: page + 1
})
}
console.log('-------------首页 beg-------------------')
console.log(this.data.listData);
console.log('-------------首页 end-------------------')
}
}).catch(error => {
console.log(error, 'error appletLogin')

+ 0
- 2
pages/index/index.json ファイルの表示

@@ -1,7 +1,5 @@
{
"usingComponents": {
"van-button":"/miniprogram_npm/@vant/weapp/button",
"van-sticky":"/miniprogram_npm/@vant/weapp/sticky",
"van-tab": "/miniprogram_npm/@vant/weapp/tab",
"van-tabs": "/miniprogram_npm/@vant/weapp/tabs",
"van-dropdown-menu": "/miniprogram_npm/@vant/weapp/dropdown-menu",

+ 94
- 17
pages/releaseModule/index.js ファイルの表示

@@ -13,10 +13,11 @@ Page({
min: 0,
max: 300,
// 用户有无点击过tag
isClickTag:false,
isClickTag: false,
// 选中tag
selectedTag:[],
detailValue:"",
selectedTag: [],
detailValue: "",
saveLoading:false,
},

/**
@@ -33,33 +34,33 @@ Page({
min: len
});
this.setData({
detailValue:value
detailValue: value
})
},
// tag选择切换
tagSelectedChange(e){
tagSelectedChange(e) {
let typename = e.currentTarget.dataset.typename;
let selectedTag = this.data.selectedTag;
let tempArr = [];
// 1 如果选中的数组里没有当前type
if(selectedTag.indexOf(typename) == -1){
if (selectedTag.indexOf(typename) == -1) {
// 2 如果选中的数组的长度小于3 直接push
if(selectedTag.length < 3){
if (selectedTag.length < 3) {
selectedTag.push(typename)
}
}
// 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;
tags.forEach(el=>{
tags.forEach(el => {
el.isActive = false
if(selectedTag.indexOf(el.typeName) != -1){
if (selectedTag.indexOf(el.typeName) != -1) {
el.isActive = true;
}
})
@@ -67,8 +68,84 @@ Page({
selectedTag,
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
getTags() {
@@ -81,14 +158,14 @@ Page({
})
if (res.status == 0) {
let datas = res.data;
datas.forEach(el=>{
datas.forEach(el => {
el.isActive = false;
})
this.setData({
tags: datas,
})
}
console.log(this.data.tags,'tags')
console.log(this.data.tags, 'tags')
}).catch(error => {
console.log(error, 'error appletLogin')
})

+ 13
- 1
pages/releaseModule/index.wxml ファイルの表示

@@ -6,7 +6,7 @@
<view wx:else>
<!-- 顶部 -->
<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>
<view class="tags-view">
@@ -19,6 +19,18 @@
</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>
<tabBar currentIndex="{{currentIndex}}"></tabBar>
</view>

+ 7
- 0
pages/releaseModule/index.wxss ファイルの表示

@@ -61,4 +61,11 @@
text-align: center;
color: #999999;
font-size: 26rpx;
}

/* 发布按钮 */
.submit-btn {
margin-top: 40rpx;
box-sizing: border-box;
padding: 0 40rpx;
}

読み込み中…
キャンセル
保存