35 changed files with 70 additions and 1892 deletions
Split View
Diff Options
-
6app.json
-
11pages/api/ztb.js
-
6pages/article/hot-index/index.js
-
90pages/article/list/index.js
-
14pages/article/publish/index.js
-
6pages/article/queue-detail/index.js
-
133pages/moment/create/index.js
-
7pages/moment/create/index.json
-
22pages/moment/create/index.wxml
-
17pages/moment/create/index.wxss
-
202pages/moment/detail/index.js
-
10pages/moment/detail/index.json
-
112pages/moment/detail/index.wxml
-
35pages/moment/detail/index.wxss
-
147pages/moment/host-detail/index.js
-
12pages/moment/host-detail/index.json
-
85pages/moment/host-detail/index.wxml
-
31pages/moment/host-detail/index.wxss
-
78pages/moment/host-info/index.js
-
7pages/moment/host-info/index.json
-
35pages/moment/host-info/index.wxml
-
1pages/moment/host-info/index.wxss
-
32pages/moment/index.wxs
-
239pages/moment/index/index.js
-
16pages/moment/index/index.json
-
138pages/moment/index/index.wxml
-
54pages/moment/index/index.wxss
-
180pages/moment/list/index.js
-
14pages/moment/list/index.json
-
101pages/moment/list/index.wxml
-
9pages/moment/list/index.wxss
-
95pages/moment/paper/index.js
-
6pages/moment/paper/index.json
-
10pages/moment/paper/index.wxml
-
1pages/moment/paper/index.wxss
@ -1,133 +0,0 @@ |
|||
// pages/moment/create/index.js
|
|||
const request = require('../../../utils/request') //导入模块
|
|||
const util = require('../../../utils/util') |
|||
const event = require('../../../utils/event.js') |
|||
|
|||
Page({ |
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
form:{}, |
|||
requesting: false, |
|||
tagList:[] |
|||
}, |
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
if(options.barId){ |
|||
this.data.form.paperBarId = options.barId |
|||
} |
|||
request.get('/information-center/get/label-list').then(result => { |
|||
//成功回调
|
|||
this.setData({ tagList: result.data }) |
|||
}) |
|||
if(options.id){ |
|||
wx.showLoading({ title: '加载中', mask: true }) |
|||
request.get('/information-center/get/post-detail/' + options.id).then(result => { |
|||
// imgUrlList
|
|||
var fileList = [] |
|||
if (result.data.imgUrlList && result.data.imgUrlList.length) { |
|||
result.data.imgUrlList.forEach(element => { |
|||
fileList.push({ url: element, status: 8 }) |
|||
}) |
|||
} |
|||
// Tags
|
|||
if(this.data.tagList.length > 0 && result.data.labelList && result.data.labelList.length){ |
|||
for (let index = 0; index < this.data.tagList.length; index++) { |
|||
console.log(this.data.tagList) |
|||
for (let i = 0; i < result.data.labelList.length; i++) { |
|||
if(this.data.tagList[index].name == result.data.labelList[i]){ |
|||
this.data.tagList[index].check = true |
|||
break |
|||
} |
|||
} |
|||
} |
|||
} |
|||
this.setData({ |
|||
form: result.data, |
|||
fileList: fileList, |
|||
tagList: this.data.tagList |
|||
}) |
|||
wx.hideLoading() |
|||
}).catch(err => { |
|||
//异常回调
|
|||
wx.hideLoading() |
|||
}) |
|||
} |
|||
}, |
|||
tagChange: function(e){ |
|||
var item = this.data.tagList[e.target.dataset.index] |
|||
item.check = !item.check |
|||
this.setData({ |
|||
['tagList[' + e.target.dataset.index + ']']: item |
|||
}) |
|||
}, |
|||
bindInput: function (e) { |
|||
this.data.form[e.target.id] = e.detail.value |
|||
}, |
|||
onImageChange: function (e) { |
|||
if (e.detail) { |
|||
var list = [] |
|||
e.detail.forEach(element => { |
|||
if (!util.isEmpty(element.url)) { |
|||
list.push(element.url) |
|||
} |
|||
}) |
|||
this.data.form['imgUrlList'] = list |
|||
} |
|||
}, |
|||
submitForm: function(){ |
|||
if(this.data.requesting){ |
|||
return |
|||
} |
|||
if(util.isEmpty(this.data.form.title)){ |
|||
util.showToast('请输入标题') |
|||
return |
|||
} |
|||
if(util.isEmpty(this.data.form.content)){ |
|||
util.showToast('请输入内容') |
|||
return |
|||
} |
|||
var tags = [] |
|||
this.data.tagList.forEach(element => { |
|||
if (element.check) { |
|||
tags.push(element.id) |
|||
} |
|||
}) |
|||
this.data.form['labelIdList'] = tags |
|||
wx.showLoading({ |
|||
title: '处理中', |
|||
mask: true |
|||
}) |
|||
this.data.requesting = true |
|||
if(util.isEmpty(this.data.form.id)){ |
|||
request.post('/information-center/post', this.data.form).then(result => { |
|||
//成功回调
|
|||
wx.hideLoading() |
|||
event.emit('EventMessage', { what: 501, desc: 'PostChange' }) |
|||
util.showBackToast('发帖成功') |
|||
}).catch(err => { |
|||
//异常回调
|
|||
wx.hideLoading() |
|||
this.data.requesting = false |
|||
util.showToast(err) |
|||
}) |
|||
} else { |
|||
request.post('/information-center/update/post/' + this.data.form.id, this.data.form).then(result => { |
|||
//成功回调
|
|||
wx.hideLoading() |
|||
event.emit('EventMessage', { what: 501, desc: 'PostChange' }) |
|||
util.showBackToast('编辑成功') |
|||
}).catch(err => { |
|||
//异常回调
|
|||
wx.hideLoading() |
|||
this.data.requesting = false |
|||
util.showToast(err) |
|||
}) |
|||
} |
|||
|
|||
} |
|||
|
|||
}) |
|||
@ -1,7 +0,0 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"wux-button": "/components/button/index", |
|||
"wux-tag": "/components/tag/index", |
|||
"wux-uploader": "/components/uploader/index" |
|||
} |
|||
} |
|||
@ -1,22 +0,0 @@ |
|||
<!--pages/moment/create/index.wxml--> |
|||
<cu-custom bgColor="bg-white" isBack="{{true}}"> |
|||
<view slot="content">发帖</view> |
|||
</cu-custom> |
|||
|
|||
<view class="cu-list menu no-card sm-border"> |
|||
<view class="cu-item" style="justify-content: start"> |
|||
<view class="title text-gray">标题:</view> |
|||
<input id="title" placeholder-style="color:#aaa" maxlength="40" value="{{form.title}}" style="width:80%" placeholder="请输入标题,限定在40字以内" bindinput="bindInput"></input> |
|||
</view> |
|||
<view class="bg-white" style="padding:30rpx"> |
|||
<textarea id="content" class="textarea" maxlength="400" cursor-spacing="40" show-confirm-bar="{{false}}" adjust-position="{{true}}" bindinput="bindInput" placeholder="点击输入内容,限定在400字以内" placeholder-style="color:#aaa" auto-height="true" value="{{form.content}}"></textarea> |
|||
</view> |
|||
<wux-uploader count="9" fileList="{{fileList}}" bindcustomevent="onImageChange"></wux-uploader> |
|||
<view class="bg-white" style="padding:30rpx"> |
|||
<wux-tag wx:for="{{tagList}}" wx:key="index" color="{{item.check ? 'blue' : 'def'}}" data-index="{{index}}" bind:click="tagChange">{{item.name}}</wux-tag> |
|||
</view> |
|||
</view> |
|||
|
|||
<view style="padding: 48rpx 48rpx"> |
|||
<wux-button block type="positive" bind:click="submitForm">发布</wux-button> |
|||
</view> |
|||
@ -1,17 +0,0 @@ |
|||
/* pages/moment/create/index.wxss */ |
|||
.textarea { |
|||
min-height: 160rpx; |
|||
font-size: 14px; |
|||
position: relative; |
|||
display: block; |
|||
box-sizing: border-box; |
|||
width: 100%; |
|||
margin: 0; |
|||
line-height: 1.2; |
|||
text-align: left; |
|||
background-color: initial; |
|||
border: 0; |
|||
resize: none; |
|||
color: #323233; |
|||
color: var(--field-input-text-color, #323233); |
|||
} |
|||
@ -1,202 +0,0 @@ |
|||
const request = require('../../../utils/request') //导入模块
|
|||
const util = require('../../../utils/util') |
|||
const app = getApp() |
|||
// pages/moment/detail/index.js
|
|||
Page({ |
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
id: null, |
|||
height: app.globalData.fragmentHeight, |
|||
type: 0, |
|||
tabList: [ |
|||
{id: 0, name: '评论', badge: 12}, |
|||
{id: 1, name: '系统', badge: 0} |
|||
], |
|||
tabIndex: 0, |
|||
inputBottom: 0, |
|||
keyboardHeight: 0, |
|||
focus: false, |
|||
comment: '', |
|||
momentDetail: null, |
|||
commentList: [], |
|||
requesting: false, |
|||
finished: false, |
|||
form: { |
|||
pageNum: 1 |
|||
} |
|||
}, |
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
this.data.keyboardHeight = wx.getStorageSync('keyboardHeight') |
|||
if(options.type){ |
|||
this.data.type = Number(options.type) |
|||
} |
|||
this.setData({ type: this.data.type, height: app.globalData.fragmentHeight - 100 }) |
|||
if(options.id){ |
|||
this.data.id = options.id |
|||
wx.showLoading({ title: '加载中', mask: true }) |
|||
request.get('/information-center/get/post-detail/' + options.id).then(result => { |
|||
//成功回调
|
|||
this.setData({ momentDetail: result.data }) |
|||
this.fetchCommentList() |
|||
wx.hideLoading() |
|||
}).catch(err => { |
|||
//异常回调
|
|||
wx.hideLoading() |
|||
util.showToast(err) |
|||
}) |
|||
} |
|||
}, |
|||
onRefreshList: function () { |
|||
this.data.form.pageNum = 1 |
|||
this.data.finished = false |
|||
this.fetchCommentList() |
|||
}, |
|||
fetchCommentList: function(){ |
|||
if (this.data.requesting || this.data.finished) { |
|||
return |
|||
} |
|||
this.setData({ requesting: true }) |
|||
request.get('/information-center/get/reply-list/in/' + this.data.id, this.data.form).then(result => { |
|||
//成功回调
|
|||
if (result.data.records.length) { |
|||
var respList = result.data.records |
|||
let nowList = `commentList[${this.data.commentList.length}]` |
|||
var num = this.data.form.pageNum |
|||
var finished = this.data.form.pageNum >= result.data.pages |
|||
if(num == 1){ |
|||
this.setData({ |
|||
commentList: [], |
|||
[nowList]: respList, |
|||
requesting: false, |
|||
['form.pageNum']: (num + 1), |
|||
['momentDetail.replyQuantity']: result.data.total, |
|||
finished |
|||
}) |
|||
} else { |
|||
this.setData({ |
|||
[nowList]: respList, |
|||
requesting: false, |
|||
['form.pageNum']: (num + 1), |
|||
['momentDetail.replyQuantity']: result.data.total, |
|||
finished |
|||
}) |
|||
} |
|||
} else { |
|||
this.setData({ requesting: false, finished: true }) |
|||
} |
|||
}).catch(err => { |
|||
//异常回调
|
|||
this.setData({ requesting: false }) |
|||
}) |
|||
}, |
|||
onTabChange: function (e) { |
|||
if (this.data.tabIndex == Number(e.detail.key)) { |
|||
return |
|||
} |
|||
this.data.tabIndex = Number(e.detail.key) |
|||
}, |
|||
bindInput: function(e){ |
|||
this.data.comment = e.detail.value |
|||
}, |
|||
inputFocus: function(e) { |
|||
if(this.data.keyboardHeight){ |
|||
return |
|||
} |
|||
this.data.keyboardHeight = Number(e.detail.height) |
|||
wx.setStorageSync('keyboardHeight', this.data.keyboardHeight) |
|||
this.setData({ |
|||
inputBottom: e.detail.height |
|||
}) |
|||
}, |
|||
inputBlur: function(e) { |
|||
this.setData({ |
|||
inputBottom: 0, focus: false |
|||
}) |
|||
}, |
|||
showComment: function(e) { |
|||
if(this.data.keyboardHeight){ |
|||
this.setData({ focus: true,inputBottom: this.data.keyboardHeight }) |
|||
} else { |
|||
this.setData({ focus: true }) |
|||
} |
|||
}, |
|||
submitComment: function(){ |
|||
if(util.isEmpty(this.data.comment)){ |
|||
util.showToast('请输入评论内容') |
|||
return |
|||
} |
|||
wx.showLoading({ |
|||
title: '处理中', |
|||
mask: true |
|||
}) |
|||
var form = { content: this.data.comment, postId: this.data.id} |
|||
request.post('/information-center/reply', form).then(result => { |
|||
this.setData({ inputBottom: 0, focus: false, comment: '' }) |
|||
wx.hideLoading() |
|||
util.showToast('评论成功') |
|||
this.onRefreshList() |
|||
}).catch(error => { |
|||
wx.hideLoading() |
|||
util.showToast(error) |
|||
}) |
|||
}, |
|||
toHostinfo: function(){ |
|||
if(this.data.momentDetail){ |
|||
wx.navigateTo({ |
|||
url: '/pages/moment/host-detail/index?id=' + this.data.momentDetail.paperBarId |
|||
}) |
|||
} |
|||
}, |
|||
likeComment: function(e){ |
|||
var item = this.data.commentList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] |
|||
if(item.isLiked){ |
|||
util.showToast('请勿重复点赞') |
|||
return |
|||
} |
|||
request.post('/information-center/like-or-cancel/reply', {replyId: item.id}).then(result => { |
|||
if(item.isLiked){ |
|||
this.setData({ |
|||
['commentList[' + e.currentTarget.dataset.page + '][' + e.currentTarget.dataset.index + '].likeQuantity']: result.data.likeQuantity, |
|||
['commentList[' + e.currentTarget.dataset.page + '][' + e.currentTarget.dataset.index + '].isLiked']: 0 |
|||
}) |
|||
} else { |
|||
this.setData({ |
|||
['commentList[' + e.currentTarget.dataset.page + '][' + e.currentTarget.dataset.index + '].likeQuantity']: result.data.likeQuantity, |
|||
['commentList[' + e.currentTarget.dataset.page + '][' + e.currentTarget.dataset.index + '].isLiked']: 1 |
|||
}) |
|||
} |
|||
}).catch(error => { |
|||
util.showToast(error) |
|||
}) |
|||
}, |
|||
likePost: function(){ |
|||
if(this.data.momentDetail.isLiked){ |
|||
util.showToast('请勿重复点赞') |
|||
return |
|||
} |
|||
request.post('/information-center/like-or-cancel/post', {postId: this.data.id}).then(result => { |
|||
this.setData({ |
|||
['momentDetail.likeQuantity']: result.data.likeQuantity, |
|||
['momentDetail.isLiked']: 1 |
|||
}) |
|||
}).catch(error => { |
|||
util.showToast(error) |
|||
}) |
|||
}, |
|||
onShareAppMessage: function () { |
|||
var imageUrl = '/assets/image/icon_logo.png' |
|||
if(this.data.momentDetail.imgUrlList && this.data.momentDetail.imgUrlList.length > 0){ |
|||
imageUrl = this.data.momentDetail.imgUrlList[0] |
|||
} |
|||
return { |
|||
title: this.data.momentDetail.title, |
|||
path: 'pages/index/index?url=/pages/moment/detail/index&key=id&value=' + this.data.momentDetail.id, |
|||
imageUrl: imageUrl |
|||
} |
|||
} |
|||
}) |
|||
@ -1,10 +0,0 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"wux-badge": "/components/badge/index", |
|||
"wux-image": "/components/image/index", |
|||
"sudoku-image": "/components/sudoku-image/index", |
|||
"wux-divider": "/components/divider/index", |
|||
"refresh-view": "/components/refresher/index", |
|||
"wux-tag": "/components/tag/index" |
|||
} |
|||
} |
|||
@ -1,112 +0,0 @@ |
|||
<!--pages/moment/detail/index.wxml--> |
|||
<wxs module="moment" src="../../moment/index.wxs"></wxs> |
|||
<cu-custom bgColor="bg-white" isBack="{{true}}"> |
|||
<view slot="content">帖子详情</view> |
|||
</cu-custom> |
|||
|
|||
<scroll-view scroll-y style="height: {{height}}rpx;" bindscrolltolower="fetchCommentList" wx:if="{{momentDetail}}"> |
|||
|
|||
<view class="bg-white text-black text-bold" style="padding:30rpx"> |
|||
<text>{{momentDetail.title}}</text> |
|||
</view> |
|||
<view class="bg-white flex flex-center" style="padding:30rpx;justify-content: start"> |
|||
<wux-image width="{{20}}" height="{{20}}" shape="circle" src="{{momentDetail.ownerAvatarUrl}}" mode="aspectFill"> |
|||
<image class="image-load" slot="loading" style="width:20px;height:20px" src="/assets/image/def_image.png"></image> |
|||
</wux-image> |
|||
<view class="text-cut text-df" style="max-width:200rpx;margin-left:12rpx">{{momentDetail.ownerNickname}}</view> |
|||
<view class="text-black" style="border-left:2rpx solid #999999;margin-left:12rpx;height:24rpx;"></view> |
|||
<view class="text-cut text-df text-gray" style="max-width:400rpx;margin-left:12rpx">{{moment.formatMTime(momentDetail.createTime)}}</view> |
|||
</view> |
|||
<view class="bg-white" wx:if="{{momentDetail.labelList.length}}" style="padding-left:30rpx"> |
|||
<wux-tag wx:for="{{momentDetail.labelList}}" wx:key="index" color="blue">{{item}}</wux-tag> |
|||
</view> |
|||
<view class="bg-white cu-card dynamic no-card" style="padding-top:30rpx"> |
|||
<view class="cu-item shadow"> |
|||
<view class="text-content"> |
|||
<text>{{momentDetail.content}}</text> |
|||
</view> |
|||
<view style="padding:0rpx 30rpx"> |
|||
<sudoku-image image-list="{{momentDetail.imgUrlList}}" clickable="{{true}}" listed="{{true}}"></sudoku-image> |
|||
</view> |
|||
<view style="height:20rpx"></view> |
|||
<view wx:if="{{!type}}"> |
|||
<wux-divider show-text="{{ false }}" /> |
|||
<view class="flex flex-justify" style="padding:20rpx 30rpx" bindtap="toHostinfo"> |
|||
<view class="flex"> |
|||
<wux-image width="{{60}}" height="{{60}}" wux-class="image" shape="rounded" src="{{momentDetail.paperBarInfo.logoUrl}}" /> |
|||
<view class="flex flex-column flex-center" style="margin-left:24rpx;align-items:flex-start"> |
|||
<view class="flex flex-center"> |
|||
<text style="white-space: nowrap">{{momentDetail.paperBarInfo.name}}</text> |
|||
</view> |
|||
<view class="flex flex-center" style="font-size:12px;margin-top:12rpx"> |
|||
<text class="text-gray" style="font-size:12px">成员</text> |
|||
<text class="text-blue" style="font-size:12px;margin-left:20rpx">{{momentDetail.paperBarInfo.memberQuantity}}</text> |
|||
<text class="text-gray" style="font-size:12px;margin-left:40rpx">帖子</text> |
|||
<text class="text-blue" style="font-size:12px;margin-left:20rpx">{{momentDetail.paperBarInfo.postQuantity}}</text> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<text class="cuIcon-right text-gray" style="font-size:18px"></text> |
|||
</view> |
|||
</view> |
|||
<view style="height:20rpx;width:750rpx;background-color:#f3f3f3"></view> |
|||
<view class="text-bold text-lg" style="padding:36rpx 30rpx 10rpx 30rpx">评论</view> |
|||
<view class="bg-white list-empty" style="height:400rpx" wx:if="{{!commentList.length}}"> |
|||
<view class="load-spinner text-gray" wx:if="{{requesting}}" /> |
|||
<text class="cuIcon-message text-gray" wx:else style="font-size:40px"></text> |
|||
<view class="text-empty" style="margin-top:32rpx">{{requesting? '正在加载' : '暂无评论'}}</view> |
|||
</view> |
|||
<view wx:else> |
|||
<view wx:for-item="pageItem" class="cu-list menu-avatar comment" wx:for-index="pageIndex" wx:for="{{commentList}}" wx:key="pageIndex"> |
|||
<view wx:for="{{pageItem}}" wx:key="index" class="cu-item" style="padding:30rpx;align-items: flex-start"> |
|||
<wux-image width="{{40}}" height="{{40}}" shape="circle" src="{{item.replierAvatarUrl}}" mode="aspectFill"> |
|||
<image class="image-load" style="width:40px;height:40px" slot="loading" src="/assets/image/def_image.png"></image> |
|||
</wux-image> |
|||
<view class="content" style="padding-left:20rpx"> |
|||
<view class="flex flex-justify text-black"> |
|||
<view class="text-gray text-cut" style="width: 160px">{{item.replierNickname}}</view> |
|||
<view data-page="{{pageIndex}}" data-index="{{index}}" bindtap="likeComment"> |
|||
<text class="text-df text-black" style="margin-right:4rpx">{{item.likeQuantity || '赞'}}</text> |
|||
<text class="cuIcon-appreciate{{item.isLiked ? 'fill' : ''}} text-{{item.isLiked ? 'blue' : 'gray'}}"></text> |
|||
</view> |
|||
</view> |
|||
<view class="text-black text-content text-df">{{item.content}}</view> |
|||
<view class="margin-top-sm flex justify-between"> |
|||
<view class="text-gray text-df">{{moment.formatMTime(item.createTime)}}</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</scroll-view> |
|||
|
|||
<view class="cu-bar foot input" style="bottom:{{inputBottom}}px" wx:if="{{momentDetail}}"> |
|||
<view class="flex flex-center" wx:if="{{!focus}}"> |
|||
<view class="search-form" style="border-radius: 12rpx;width:430rpx" bindtap="showComment"> |
|||
<input placeholder="点击输入评论" disabled="true" adjust-position="{{false}}" focus="{{false}}"></input> |
|||
</view> |
|||
<view class="action" style="margin-right:18rpx"> |
|||
<wux-badge count="{{momentDetail.replyQuantity}}" top="-8" right="-8" overflowCount="999"> |
|||
<text class="cuIcon-comment text-gray"></text> |
|||
</wux-badge> |
|||
</view> |
|||
<view class="action" bindtap="likePost" style="margin-right:18rpx"> |
|||
<wux-badge count="{{momentDetail.likeQuantity}}" top="-8" right="-8" overflowCount="999"> |
|||
<text class="cuIcon-appreciate{{momentDetail.isLiked ? 'fill' : ''}} text-{{momentDetail.isLiked ? 'blue' : 'gray'}}"></text> |
|||
</wux-badge> |
|||
</view> |
|||
<view class="roder-add flex flex-center"> |
|||
<button open-type="share" class="share-btn"> |
|||
<text class="cuIcon-share text-gray" style="font-size:22px;"></text> |
|||
</button> |
|||
</view> |
|||
</view> |
|||
<view style="padding:30rpx 10rpx 30rpx 30rpx;width:100%" wx:else> |
|||
<textarea id="content" maxlength="180" style="height:160rpx;width:100%" focus="{{focus}}" cursor-spacing="40" show-confirm-bar="{{false}}" adjust-position="{{false}}" bindinput="bindInput" placeholder="输入评论,最多180字" placeholder-style="color:#aaa" bindfocus="inputFocus" bindblur="inputBlur"></textarea> |
|||
<view class="flex" style="justify-content: flex-end;"> |
|||
<button class="cu-btn offer-btn" style="background-color: #008AFF" bindtap="submitComment">发表</button> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
@ -1,35 +0,0 @@ |
|||
/* pages/moment/detail/index.wxss */ |
|||
.offer-btn { |
|||
width: 160rpx; |
|||
height: 56rpx; |
|||
background-color: #008AFF; |
|||
border-radius: 23px; |
|||
color: white; |
|||
font-size: 24rpx; |
|||
} |
|||
|
|||
.image-load { |
|||
width: 50px; |
|||
height: 50px; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
border-radius: 50rpx; |
|||
} |
|||
|
|||
.roder-add { |
|||
display: flex; |
|||
justify-content: center; |
|||
align-items: center; |
|||
width: 40px; |
|||
height: 40px; |
|||
} |
|||
|
|||
.share-btn{ |
|||
background-color: #fff; |
|||
padding-left: 0px; |
|||
padding-right: 0px; |
|||
height:32px; |
|||
line-height: 32px |
|||
} |
|||
.share-btn::after{ border: none; } |
|||
@ -1,147 +0,0 @@ |
|||
// pages/moment/host-detail/index.js
|
|||
const request = require('../../../utils/request') //导入模块
|
|||
const util = require('../../../utils/util') |
|||
const event = require('../../../utils/event.js') |
|||
const app = getApp() |
|||
|
|||
Page({ |
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
safeBottom: app.globalData.safeBottom, |
|||
height: app.globalData.fragmentHeight, |
|||
id: null, |
|||
hostDetail: null, |
|||
momentList: [], |
|||
top: 0, |
|||
requesting: false, |
|||
finished: false, |
|||
form: { |
|||
pageNum: 1 |
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
this.setData({height: app.globalData.fragmentHeight}) |
|||
if(options.id){ |
|||
this.data.id = options.id |
|||
event.on('EventMessage', this, this.onEvent) |
|||
this.fetchMomentList() |
|||
} |
|||
}, |
|||
onShow: function(){ |
|||
wx.showLoading({ |
|||
title: '加载中', |
|||
mask: true |
|||
}) |
|||
request.get('/information-center/paper-bar/get/' + this.data.id).then(result => { |
|||
//成功回调
|
|||
this.setData({ hostDetail: result.data }) |
|||
wx.hideLoading() |
|||
}).catch(err => { |
|||
//异常回调
|
|||
wx.hideLoading() |
|||
util.showToast(err) |
|||
}) |
|||
}, |
|||
onEvent: function (message) { |
|||
if (message.what == 501) { |
|||
this.onRefreshList() |
|||
} |
|||
}, |
|||
onRefreshList: function () { |
|||
this.setData({ |
|||
momentList: [], |
|||
['form.pageNum']: 1, |
|||
finished: false |
|||
}) |
|||
this.fetchMomentList() |
|||
}, |
|||
fetchMomentList: function(){ |
|||
if (this.data.requesting || this.data.finished) { |
|||
return |
|||
} |
|||
this.setData({ requesting: true }) |
|||
request.get('/information-center/get/post-list/in/' + this.data.id, this.data.form).then(result => { |
|||
//成功回调
|
|||
if (result.data.records.length) { |
|||
var respList = result.data.records |
|||
let nowList = `momentList[${this.data.momentList.length}]` |
|||
var num = this.data.form.pageNum |
|||
var finished = this.data.form.pageNum >= result.data.pages |
|||
if(num == 1){ |
|||
this.setData({ |
|||
momentList: [], |
|||
requesting: false, |
|||
[nowList]: respList, |
|||
['form.pageNum']: (num + 1), |
|||
finished |
|||
}) |
|||
} else { |
|||
this.setData({ |
|||
[nowList]: respList, |
|||
requesting: false, |
|||
['form.pageNum']: (num + 1), |
|||
finished |
|||
}) |
|||
} |
|||
} else { |
|||
this.setData({ finished: true, requesting: false }) |
|||
} |
|||
}).catch(err => { |
|||
//异常回调
|
|||
this.setData({ requesting: false }) |
|||
util.showToast(err) |
|||
}) |
|||
}, |
|||
/** |
|||
* 生命周期函数--监听页面初次渲染完成 |
|||
*/ |
|||
addMoment: function () { |
|||
if(!this.data.hostDetail.join){ |
|||
this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog') |
|||
var that = this |
|||
this.wuxDialog.open({ |
|||
resetOnClose: true, |
|||
title: '温馨提示', |
|||
content: '您还没有加入该纸吧,无法发帖,现在就加入纸吧?', |
|||
buttons: [{ |
|||
text: '取消' |
|||
},{ |
|||
text: '加入纸吧', |
|||
type: 'primary', |
|||
onTap(e) { |
|||
that.toHostinfo() |
|||
} |
|||
}] |
|||
}) |
|||
return |
|||
} |
|||
wx.navigateTo({ |
|||
url: '/pages/moment/create/index?barId=' + this.data.id |
|||
}) |
|||
}, |
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
toHostinfo: function () { |
|||
if(this.data.hostDetail){ |
|||
wx.navigateTo({ |
|||
url: '/pages/moment/host-info/index?id=' + this.data.hostDetail.id |
|||
}) |
|||
} |
|||
}, |
|||
lookItem: function(e){ |
|||
var item = this.data.momentList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] |
|||
wx.navigateTo({ |
|||
url: '/pages/moment/detail/index?type=1&id=' + item.id |
|||
}) |
|||
}, |
|||
onUnload: function(){ |
|||
event.remove('EventMessage', this) |
|||
} |
|||
}) |
|||
@ -1,12 +0,0 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"refresh-view": "/components/refresher/index", |
|||
"wux-button": "/components/button/index", |
|||
"wux-image": "/components/image/index", |
|||
"sudoku-image": "/components/sudoku-image/index", |
|||
"wux-dialog": "/components/dialog/index", |
|||
"wux-divider": "/components/divider/index", |
|||
"fold-text": "/components/fold-text/index", |
|||
"wux-tag": "/components/tag/index" |
|||
} |
|||
} |
|||
@ -1,85 +0,0 @@ |
|||
<!--pages/moment/host-detail/index.wxml--> |
|||
<wxs module="moment" src="../../moment/index.wxs"></wxs> |
|||
<cu-custom bgColor="bg-white" isBack="{{true}}"> |
|||
<view slot="content">纸吧详情</view> |
|||
</cu-custom> |
|||
|
|||
<refresh-view bind:refresh="onRefreshList" height="{{height}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchMomentList"> |
|||
<view class="bg-white flex flex-justify" style="padding:30rpx" wx:if="{{hostDetail}}"> |
|||
<view class="flex"> |
|||
<wux-image width="{{60}}" height="{{60}}" wux-class="image" shape="rounded" src="{{hostDetail.logoUrl}}" /> |
|||
<view class="flex flex-column flex-center" style="margin-left:24rpx;align-items:flex-start"> |
|||
<view class="flex flex-center"> |
|||
<text style="white-space: nowrap">{{hostDetail.name}}</text> |
|||
</view> |
|||
<view class="flex" style="font-size:12px;margin-top:12rpx"> |
|||
<view class="flex flex-center flex-column"> |
|||
<view class="text-blue text-lg">{{hostDetail.memberQuantity}}</view> |
|||
<view class="text-gray" style="font-size:12px">成员</view> |
|||
</view> |
|||
<view class="flex flex-center flex-column" style="margin-left:60rpx"> |
|||
<view class="text-blue text-lg">{{hostDetail.postQuantity}}</view> |
|||
<view class="text-gray" style="font-size:12px">帖子</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<wux-button type="{{hostDetail.join ? 'stable' : 'positive'}}" size="join" bind:click="toHostinfo">{{hostDetail.join? '已加入' :'加入'}}</wux-button> |
|||
</view> |
|||
<view class="bg-white text-gray" wx:if="{{hostDetail}}"> |
|||
<fold-text content="{{'简介:' + (hostDetail.description || '暂无简介')}}"></fold-text> |
|||
</view> |
|||
<view style="height:18rpx"></view> |
|||
<view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{momentList}}" wx:key="pageIndex"> |
|||
<view wx:for="{{pageItem}}" wx:key="index" class="cu-card dynamic no-card" data-page="{{pageIndex}}" data-index="{{index}}" bindtap="lookItem"> |
|||
<wux-divider show-text="{{ false }}" wx:if="{{pageIndex != 0 || index != 0 }}"></wux-divider> |
|||
<view class="cu-item shadow"> |
|||
<view class="cu-list menu-avatar"> |
|||
<view class="cu-item" style="justify-content: flex-start;padding-left:30rpx"> |
|||
<wux-image width="{{50}}" height="{{50}}" shape="circle" src="{{item.ownerAvatarUrl}}" mode="aspectFill"> |
|||
<image class="image-load" slot="loading" src="/assets/image/def_image.png"></image> |
|||
</wux-image> |
|||
<view style="flex:1;padding-left:16rpx"> |
|||
<view class="text-cut" style="max-width:400rpx">{{item.ownerNickname}}</view> |
|||
<view class="text-gray text-sm" style="margin-top:10rpx">{{moment.formatMTime(item.createTime)}}</view> |
|||
</view> |
|||
<wux-tag color="volcano" wx:if="{{item.isNew}}">新帖</wux-tag> |
|||
</view> |
|||
</view> |
|||
<view class="text-black text-bold text-lg" style="padding:30rpx">{{item.title}}</view> |
|||
<fold-text content="{{item.content}}"></fold-text> |
|||
<view style="padding:0rpx 30rpx"> |
|||
<sudoku-image image-list="{{item.imgUrlList}}"></sudoku-image> |
|||
</view> |
|||
<view class="flex flex-justify padding text-gray"> |
|||
<view> |
|||
<wux-tag wx:for="{{item.labelList}}" wx:for-item="label" wx:key="index" color="blue">{{label}}</wux-tag> |
|||
</view> |
|||
<view class="text-df"> |
|||
<text class="cuIcon-appreciate{{item.isLiked ? 'fill' : ''}} text-{{item.isLiked ? 'blue' : 'gray'}}"></text> |
|||
<text style="margin-left:8rpx">{{item.likeQuantity}}</text> |
|||
<text class="cuIcon-messagefill" style="margin-left:48rpx"></text> |
|||
<text style="margin-left:8rpx">{{item.replyQuantity}}</text> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<!--加载更多的UI--> |
|||
<view class="bg-white" wx:if="{{form.pageNum > 1}}" style="padding:30rpx"> |
|||
<wux-divider> |
|||
<view class="loadmore"> |
|||
<text class="icon--refresher" wx:if="{{!finished}}"></text> |
|||
<text class="text-sm" style="margin-left:8rpx">{{finished?'到底啦~':'加载中...'}}</text> |
|||
</view> |
|||
</wux-divider> |
|||
</view> |
|||
</refresh-view> |
|||
|
|||
<view class="booking-tool" style="bottom:{{ 180 + safeBottom}}rpx" wx:if="{{hostDetail}}" bindtap="addMoment"> |
|||
<view class="roder-add flex flex-center"> |
|||
<text class="cuIcon-add text-white" style="font-size:32px"></text> |
|||
</view> |
|||
</view> |
|||
|
|||
<wux-dialog id="wux-dialog" /> |
|||
@ -1,31 +0,0 @@ |
|||
/* pages/moment/host-detail/index.wxss */ |
|||
.image-load { |
|||
width: 100px; |
|||
height: 100px; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
border-radius: 8rpx; |
|||
} |
|||
|
|||
.booking-tool { |
|||
width: calc(100% - 20px); |
|||
background-color: #008AFF; |
|||
position: fixed; |
|||
bottom: 150px; |
|||
left: 25px; |
|||
} |
|||
|
|||
.roder-add { |
|||
display: flex; |
|||
justify-content: center; |
|||
align-items: center; |
|||
width: 100rpx; |
|||
height: 100rpx; |
|||
background-color: #008AFF; |
|||
border-radius: 50rpx; |
|||
position: absolute; |
|||
top: 24px; |
|||
right: 24px; |
|||
box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16); |
|||
} |
|||
@ -1,78 +0,0 @@ |
|||
// pages/moment/host-info/index.js
|
|||
const request = require('../../../utils/request') //导入模块
|
|||
const util = require('../../../utils/util') |
|||
|
|||
Page({ |
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
hostDetail: null |
|||
}, |
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
if(options.id){ |
|||
wx.showLoading({ |
|||
title: '加载中', |
|||
mask: true |
|||
}) |
|||
request.get('/information-center/paper-bar/get/' + options.id).then(result => { |
|||
//成功回调
|
|||
this.setData({ hostDetail: result.data }) |
|||
wx.hideLoading() |
|||
}).catch(err => { |
|||
//异常回调
|
|||
wx.hideLoading() |
|||
util.showToast(err) |
|||
}) |
|||
} |
|||
}, |
|||
/** |
|||
* 生命周期函数--监听页面隐藏 |
|||
*/ |
|||
inoutHost: function () { |
|||
if(!this.data.hostDetail){ |
|||
return |
|||
} |
|||
if(this.data.hostDetail.join){ |
|||
wx.showLoading({ |
|||
title: '处理中', |
|||
mask: true |
|||
}) |
|||
request.post('/information-center/paper-bar/quit/paper-bar/' + this.data.hostDetail.id).then(result => { |
|||
//成功回调
|
|||
wx.hideLoading() |
|||
this.setData({ |
|||
['hostDetail.join']: false, |
|||
['hostDetail.memberQuantity']: (this.data.hostDetail.memberQuantity - 1) |
|||
}) |
|||
util.showToast('退出成功!') |
|||
}).catch(err => { |
|||
//异常回调
|
|||
wx.hideLoading() |
|||
util.showToast(err) |
|||
}) |
|||
} else { |
|||
wx.showLoading({ |
|||
title: '处理中', |
|||
mask: true |
|||
}) |
|||
request.post('/information-center/paper-bar/join/paper-bar/' + this.data.hostDetail.id).then(result => { |
|||
//成功回调
|
|||
wx.hideLoading() |
|||
this.setData({ |
|||
['hostDetail.join']: true, |
|||
['hostDetail.memberQuantity']: (this.data.hostDetail.memberQuantity + 1) |
|||
}) |
|||
util.showToast('加入成功!') |
|||
}).catch(err => { |
|||
//异常回调
|
|||
wx.hideLoading() |
|||
util.showToast(err) |
|||
}) |
|||
} |
|||
|
|||
} |
|||
}) |
|||
@ -1,7 +0,0 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"wux-image": "/components/image/index", |
|||
"wux-divider": "/components/divider/index", |
|||
"wux-button": "/components/button/index" |
|||
} |
|||
} |
|||
@ -1,35 +0,0 @@ |
|||
<!--pages/moment/host-info/index.wxml--> |
|||
<cu-custom bgColor="bg-white" isBack="{{true}}"> |
|||
<view slot="content">纸吧资料</view> |
|||
</cu-custom> |
|||
|
|||
<view class="bg-white flex flex-justify" style="padding:30rpx" wx:if="{{hostDetail}}"> |
|||
<view class="flex"> |
|||
<wux-image width="{{60}}" height="{{60}}" wux-class="image" shape="rounded" src="{{hostDetail.logoUrl}}" /> |
|||
<view class="flex flex-column flex-center" style="margin-left:24rpx;align-items:flex-start"> |
|||
<view class="flex flex-center"> |
|||
<text style="white-space: nowrap">{{hostDetail.name}}</text> |
|||
</view> |
|||
<view class="flex" style="font-size:12px;margin-top:12rpx"> |
|||
<view class="flex flex-center flex-column"> |
|||
<view class="text-blue text-lg">{{hostDetail.memberQuantity}}</view> |
|||
<view class="text-gray" style="font-size:12px">成员</view> |
|||
</view> |
|||
<view class="flex flex-center flex-column" style="margin-left:60rpx"> |
|||
<view class="text-blue text-lg">{{hostDetail.postQuantity}}</view> |
|||
<view class="text-gray" style="font-size:12px">帖子</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<wux-button type="{{hostDetail.join ? 'assertive' : 'positive'}}" size="join" bind:click="inoutHost">{{hostDetail.join? '退出纸吧' :'加入纸吧'}}</wux-button> |
|||
</view> |
|||
|
|||
<view class="bg-white margin-top" style="padding:20rpx 30rpx" wx:if="{{hostDetail}}"> |
|||
<wux-divider text="纸吧简介" /> |
|||
<view class="text-content" style="max-height: 36.4em;margin-top:30rpx">{{hostDetail.description || '暂无简介'}}</view> |
|||
</view> |
|||
|
|||
<!-- <view style="padding:80rpx 48rpx" wx:if="{{hostDetail}}"> |
|||
<wux-button block type="{{hostDetail.join ? 'assertive' : 'positive'}}" bind:click="inoutHost">{{hostDetail.join? '退出纸吧' :'加入纸吧'}}</wux-button> |
|||
</view> --> |
|||
@ -1 +0,0 @@ |
|||
/* pages/moment/host-info/index.wxss */ |
|||
@ -1,32 +0,0 @@ |
|||
function isEmpty(val) { |
|||
return typeof val === 'undefined' || val === '' || val === null |
|||
} |
|||
|
|||
function formatMTime(time) { |
|||
if (isEmpty(time)) { |
|||
return '' |
|||
} |
|||
var minute = 60 * 1000 |
|||
var just = 3 * 60 * 1000 |
|||
var onehour = 60 * 60 * 1000 |
|||
var oneday = 24 * 60 * 60 * 1000 |
|||
time = time.replace(getRegExp('/\s/g', 'g'), '') |
|||
var datetime = getDate(time.trim()) |
|||
var gap = getDate().getTime() - datetime.getTime() |
|||
|
|||
if (gap > oneday) { |
|||
return time.substring(0, 10) |
|||
} else if (gap > onehour) { |
|||
return parseInt(gap / onehour) + '小时前' |
|||
} else if (gap > onehour) { |
|||
return parseInt(gap / onehour) + '小时前' |
|||
} else if (gap > just) { |
|||
return parseInt(gap / minute) + '分钟前' |
|||
} else { |
|||
return '刚刚更新' |
|||
} |
|||
} |
|||
|
|||
module.exports = { |
|||
formatMTime: formatMTime |
|||
} |
|||
@ -1,239 +0,0 @@ |
|||
// pages/stock/index.js
|
|||
const request = require('../../../utils/request') //导入模块
|
|||
const util = require('../../../utils/util') |
|||
const storage = require('../../../utils/storage') |
|||
const math = require('../../../utils/math') |
|||
const event = require('../../../utils/event.js') |
|||
var wxCharts = require('../../../utils/wxcharts.js') |
|||
const app = getApp() |
|||
var lineChart = null |
|||
const colors = ['#FF4229', '#FFAD2A', '#297BFF', '#29FF46', '#AD29FF'] |
|||
|
|||
Component({ |
|||
options: { |
|||
addGlobalClass: true, |
|||
multipleSlots: true |
|||
}, |
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
height: app.globalData.fragmentHeight - 100, |
|||
hostList: [], |
|||
chartList: null, |
|||
momentList: [], |
|||
requesting: false, |
|||
finished: false, |
|||
idList: '', |
|||
form: { |
|||
pageNum: 1 |
|||
} |
|||
}, |
|||
lifetimes: { |
|||
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
|||
attached: function () { |
|||
this.setData({ height: app.globalData.fragmentHeight - 100 }) |
|||
event.on('EventMessage', this, this.onEvent) |
|||
}, |
|||
detached: function () { |
|||
event.remove('EventMessage', this) |
|||
} |
|||
}, |
|||
methods: { |
|||
onRestart: function () { |
|||
// this.fetchMessageNumber()
|
|||
if (!this.data.firstShow) { |
|||
this.fetchHostList() |
|||
this.fetchChartList() |
|||
this.onRefreshList() |
|||
} |
|||
this.data.firstShow = true |
|||
}, |
|||
onEvent: function (message) { |
|||
if (message.what == 502) { |
|||
this.fetchChartList() |
|||
} |
|||
}, |
|||
//***********************************fetchHostList*****************************************//
|
|||
fetchHostList: function(){ |
|||
request.get('/information-center/paper-bar/get/top-paper-bar-list').then(result => { |
|||
//成功回调
|
|||
this.setData({ hostList: result.data }) |
|||
}) |
|||
}, |
|||
toHost: function(e){ |
|||
var item = this.data.hostList[e.currentTarget.dataset.index] |
|||
wx.navigateTo({ |
|||
url: '/pages/moment/host-detail/index?id=' + item.id |
|||
}) |
|||
}, |
|||
//***********************************fetchChartList*****************************************//
|
|||
fetchChartList: function(){ |
|||
var cateIds = storage.get('cateIdList' + app.globalData.userInfo.userId) |
|||
if(!util.isEmpty(cateIds)){ |
|||
this.data.idList = cateIds |
|||
} |
|||
request.get('/information-center/getPaperCategoryPrice', {idList: this.data.idList}).then(result => { |
|||
//成功回调
|
|||
if(result.data.length <= 0){ |
|||
return |
|||
} |
|||
var respList = result.data |
|||
var categoriesList = [] |
|||
var serieList = [] |
|||
var min = Number.MAX_VALUE |
|||
var max = 0 |
|||
for (let index = 0; index < respList.length; index++) { |
|||
const element = respList[index] |
|||
var dataList = [] |
|||
if(index == 0){ |
|||
element.list.forEach(item => { |
|||
categoriesList.push(item.data.substring(5)) |
|||
var price = math.times(item.unitPrice, 1000) |
|||
if(min > price){ |
|||
min = price |
|||
} |
|||
if(max < price){ |
|||
max = price |
|||
} |
|||
dataList.push(price) |
|||
}) |
|||
} else { |
|||
element.list.forEach(item => { |
|||
var price = math.times(item.unitPrice, 1000) |
|||
if(min > price){ |
|||
min = price |
|||
} |
|||
dataList.push(price) |
|||
}) |
|||
} |
|||
var series = { |
|||
name: element.list[0].name, |
|||
data: dataList, |
|||
format: function (val, name) { |
|||
return val + '元/吨' |
|||
}, |
|||
color: colors[index] |
|||
} |
|||
serieList.push(series) |
|||
} |
|||
this.setData({ chartList: { categories: categoriesList, serieList: serieList } }) |
|||
// if(min < 50){
|
|||
// min = 50
|
|||
// }
|
|||
this.initChart(min - 50, max + 50) |
|||
}) |
|||
}, |
|||
touchHandler: function (e) { |
|||
if(lineChart){ |
|||
lineChart.scrollStart(e) |
|||
} |
|||
}, |
|||
moveHandler: function (e) { |
|||
if(lineChart){ |
|||
lineChart.scroll(e) |
|||
} |
|||
}, |
|||
touchEndHandler: function (e) { |
|||
if(lineChart){ |
|||
lineChart.scrollEnd(e) |
|||
lineChart.showToolTip(e, { |
|||
format: function (item, category) { |
|||
return category + ' ' + item.name + ':' + item.data |
|||
} |
|||
}) |
|||
} |
|||
}, |
|||
initChart: function (min, max) { |
|||
lineChart = new wxCharts({ |
|||
canvasId: 'lineChart', |
|||
type: 'line', |
|||
categories: this.data.chartList.categories, |
|||
animation: false, |
|||
title: { name: '纸品单价 (元/吨)' }, |
|||
series: this.data.chartList.serieList, |
|||
xAxis: { disableGrid: false }, |
|||
yAxis: { |
|||
// title: '纸品单价 (元/吨)',
|
|||
format: function (val) { |
|||
return val; |
|||
}, |
|||
min, |
|||
max |
|||
}, |
|||
width: 350, |
|||
height: 200, |
|||
dataLabel: false, |
|||
dataPointShape: 'circle', |
|||
enableScroll: true, |
|||
extra: { lineStyle: 'curve' } |
|||
}, this) |
|||
}, |
|||
//*************************************************momentList************************************************//
|
|||
onRefreshList: function () { |
|||
this.setData({ |
|||
momentList: [], |
|||
['form.pageNum']: 1, |
|||
finished: false |
|||
}) |
|||
this.fetchMomentList() |
|||
}, |
|||
fetchMomentList: function(){ |
|||
if (this.data.requesting || this.data.finished) { |
|||
return |
|||
} |
|||
this.data.requesting = true |
|||
request.get('/information-center/get/prefer-post-list', this.data.form).then(result => { |
|||
//成功回调
|
|||
if (result.data.records.length) { |
|||
var respList = result.data.records |
|||
let nowList = `momentList[${this.data.momentList.length}]` |
|||
var num = this.data.form.pageNum |
|||
var finished = this.data.form.pageNum >= result.data.pages |
|||
this.setData({ |
|||
[nowList]: respList, |
|||
['form.pageNum']: (num + 1), |
|||
finished |
|||
}) |
|||
} else { |
|||
this.setData({ finished: true }) |
|||
} |
|||
this.data.requesting = false |
|||
}).catch(err => { |
|||
//异常回调
|
|||
this.data.requesting = false |
|||
}) |
|||
}, |
|||
lookItem: function(e){ |
|||
var item = this.data.momentList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] |
|||
wx.navigateTo({ |
|||
url: '/pages/moment/detail/index?id=' + item.id |
|||
}) |
|||
}, |
|||
likeItem: function(e){ |
|||
var item = this.data.momentList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] |
|||
if(item.isLiked){ |
|||
util.showToast('请勿重复点赞') |
|||
return |
|||
} |
|||
request.post('/information-center/like-or-cancel/post', {postId: item.id}).then(result => { |
|||
this.setData({ |
|||
['momentList[' + e.currentTarget.dataset.page + '][' + e.currentTarget.dataset.index + '].likeQuantity']: result.data.likeQuantity, |
|||
['momentList[' + e.currentTarget.dataset.page + '][' + e.currentTarget.dataset.index + '].isLiked']: 1 |
|||
}) |
|||
}).catch(error => { |
|||
util.showToast(error) |
|||
}) |
|||
}, |
|||
toMomentList: function(){ |
|||
wx.navigateTo({ |
|||
url: '/pages/moment/list/index' |
|||
}) |
|||
}, |
|||
toPaperList: function(){ |
|||
wx.navigateTo({ |
|||
url: '/pages/moment/paper/index' |
|||
}) |
|||
} |
|||
} |
|||
}) |
|||
@ -1,16 +0,0 @@ |
|||
{ |
|||
"component": true, |
|||
"usingComponents": { |
|||
"wux-skeleton": "/components/skeleton/index", |
|||
"wux-skeleton-avatar": "/components/skeleton-avatar/index", |
|||
"wux-skeleton-paragraph": "/components/skeleton-paragraph/index", |
|||
"wux-row": "/components/row/index", |
|||
"wux-col": "/components/col/index", |
|||
"wux-divider": "/components/divider/index", |
|||
"wux-image": "/components/image/index", |
|||
"sudoku-image": "/components/sudoku-image/index", |
|||
"fold-text": "/components/fold-text/index", |
|||
"refresh-view": "/components/refresher/index", |
|||
"wux-tag": "/components/tag/index" |
|||
} |
|||
} |
|||
@ -1,138 +0,0 @@ |
|||
<!--pages/main/index.wxml--> |
|||
<wxs module="moment" src="../../moment/index.wxs"></wxs> |
|||
<cu-custom bgColor="bg-white" isBack="{{false}}"> |
|||
<view slot="content" style="color:black;font-size:36rpx">纸吧</view> |
|||
</cu-custom> |
|||
|
|||
<scroll-view scroll-y style="height: {{height}}rpx;" lower-threshold="200" bindscrolltolower="fetchMomentList"> |
|||
<!-- <refresh-view bind:refresh="onRefreshList" height="{{height}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchMomentList"> --> |
|||
<!----------------------------------------------------精选纸吧----------------------------------------------------------------> |
|||
<wux-skeleton active wx:if="{{!hostList.length}}"> |
|||
<view class="bg-white flex flex-justify" style="padding:30rpx 0rpx 30rpx 30rpx"> |
|||
<wux-skeleton-paragraph rounded rows="1" wux-class="case-class" /> |
|||
<!-- <wux-skeleton-paragraph rounded rows="1" wux-class="case2-class" /> --> |
|||
</view> |
|||
<view class="bg-white flex" style="padding: 4rpx 30rpx"> |
|||
<view wx:for="{{5}}" wx:key="index" class="item-host" style="padding-left:{{index == 0? 0 : 8}}rpx;"> |
|||
<wux-skeleton-avatar shape="rounded" size="large" /> |
|||
<wux-skeleton-paragraph rounded rows="1" wux-class="host-class" /> |
|||
</view> |
|||
</view> |
|||
</wux-skeleton> |
|||
<view wx:else> |
|||
<view class="bg-white flex flex-justify" style="padding:24rpx 30rpx"> |
|||
<view class="text-bold text-lg" style="color:#333333">精选纸吧</view> |
|||
<!-- <view class="text-gray text-df">全部查看<text class="cuIcon-right text-gray" style="font-size:14px"></text></view> --> |
|||
</view> |
|||
<scroll-view class="bg-white" scroll-x scroll-with-animation="{{true}}"> |
|||
<view class="flex" style="padding: 4rpx 30rpx"> |
|||
<view wx:for="{{hostList}}" wx:key="index" class="item-host" style="padding-left:{{index==0?0:30}}rpx;flex:1" data-index="{{index}}" bindtap="toHost"> |
|||
<wux-image width="{{50}}" height="{{50}}" shape="rounded" src="{{item.logoUrl}}" mode="aspectFill"> |
|||
<image class="image-load" style="border-radius: 8rpx" slot="loading" src="/assets/image/def_image.png"></image> |
|||
<image class="image-load" style="border-radius: 8rpx" slot="error" src="/assets/image/def_image.png"></image> |
|||
</wux-image> |
|||
<view class="text-sm text-cut" style="text-align: center;width:96rpx;margin-top:4rpx">{{item.name}}</view> |
|||
</view> |
|||
</view> |
|||
</scroll-view> |
|||
</view> |
|||
<view class="bg-white" style="height:20rpx"></view> |
|||
<!----------------------------------------------------废纸指数----------------------------------------------------------------> |
|||
<wux-skeleton active wx:if="{{!chartList}}"> |
|||
<view class="bg-white flex flex-justify" style="padding:24rpx 0rpx 24rpx 30rpx"> |
|||
<wux-skeleton-paragraph rounded rows="1" wux-class="case-class" /> |
|||
<wux-skeleton-paragraph rounded rows="1" wux-class="case2-class" /> |
|||
</view> |
|||
<view class="bg-white flex flex-justify" style="padding:4rpx 0rpx 24rpx 30rpx"> |
|||
<wux-skeleton-paragraph rounded rows="7" wux-class="case3-class" /> |
|||
</view> |
|||
</wux-skeleton> |
|||
<view class="container" style="padding:30rpx;border-top:2rpx solid #eeeeee" wx:else> |
|||
<view class="flex flex-justify" style="margin-bottom:20rpx"> |
|||
<view class="text-bold text-lg" style="color:#333333">千鸟纸价</view> |
|||
<view class="text-gray text-df" bindtap="toPaperList">选择品类<text class="cuIcon-right" style="font-size:14px"></text></view> |
|||
</view> |
|||
<!-- <view wx:if="{{!serieList.length}}"> |
|||
<view class="list-empty" style="height:400rpx"> |
|||
<view class="load-spinner text-gray" style="margin-bottom:24px" wx:if="{{loading}}" /> |
|||
<image class="img-empty" src="/assets/image/list_empty.png" wx:else></image> |
|||
<view class="text-empty">{{loading? '正在加载' : '暂无数据'}}</view> |
|||
</view> |
|||
</view> --> |
|||
<!-- <view class="text-gray text-sm" style="color:#333333">千鸟纸价</view> --> |
|||
<canvas canvas-id="lineChart" disable-scroll="true" class="canvas" bindtouchstart="touchHandler" bindtouchmove="moveHandler" bindtouchend="touchEndHandler" /> |
|||
</view> |
|||
<!----------------------------------------------------帖子列表----------------------------------------------------------------> |
|||
<wux-skeleton active wx:if="{{!momentList.length}}"> |
|||
<view class="bg-white flex flex-justify" style="padding:24rpx 30rpx;"> |
|||
<wux-skeleton-paragraph rounded rows="1" wux-class="case-class" /> |
|||
<wux-skeleton-paragraph rounded rows="1" wux-class="case2-class" /> |
|||
</view> |
|||
<view class="cu-card dynamic no-card" wx:for="{{2}}" wx:key="index"> |
|||
<view class="cu-item shadow" style="padding-left:30rpx"> |
|||
<view class="cu-list menu-avatar"> |
|||
<view class="cu-item" style="justify-content: flex-start;"> |
|||
<wux-skeleton-avatar shape="circle" size="large" /> |
|||
<view class="content flex-sub"> |
|||
<wux-skeleton-paragraph rounded rows="1" wux-class="case2-class" /> |
|||
<view class="bg-white" style="height:8rpx"></view> |
|||
<wux-skeleton-paragraph rounded rows="1" wux-class="case-class" /> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<wux-skeleton-paragraph rounded rows="3" wux-class="case3-class" /> |
|||
</view> |
|||
</view> |
|||
</wux-skeleton> |
|||
<view wx:else> |
|||
<view class="bg-white flex flex-justify" style="padding:20rpx 30rpx;border-top:2rpx solid #eeeeee"> |
|||
<view class="text-bold text-lg" style="color:#333333">推荐帖子</view> |
|||
<view class="text-gray text-df" bindtap="toMomentList">我的帖子<text class="cuIcon-right text-gray" style="font-size:14px"></text></view> |
|||
</view> |
|||
<view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{momentList}}" wx:key="pageIndex"> |
|||
<view wx:for="{{pageItem}}" wx:key="index" class="cu-card dynamic no-card" data-page="{{pageIndex}}" data-index="{{index}}" bindtap="lookItem"> |
|||
<wux-divider show-text="{{ false }}" wx:if="{{pageIndex != 0 || index != 0 }}"></wux-divider> |
|||
<view class="cu-item shadow"> |
|||
<view class="cu-list menu-avatar"> |
|||
<view class="cu-item" style="justify-content: flex-start;padding-left:30rpx"> |
|||
<wux-image width="{{50}}" height="{{50}}" shape="circle" src="{{item.ownerAvatarUrl}}" mode="aspectFill"> |
|||
<image class="image-load" slot="loading" src="/assets/image/def_image.png"></image> |
|||
<image class="image-load" slot="error" src="/assets/image/def_image.png"></image> |
|||
</wux-image> |
|||
<view class="content flex-sub"> |
|||
<view class="text-cut" style="max-width:400rpx">{{item.ownerNickname}}</view> |
|||
<view class="text-gray text-sm">{{moment.formatMTime(item.createTime)}}</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="text-black text-bold text-lg" style="padding:10rpx 30rpx 30rpx 30rpx">{{item.title}}</view> |
|||
<fold-text content="{{item.content}}"></fold-text> |
|||
<view style="padding:0rpx 30rpx"> |
|||
<sudoku-image image-list="{{item.imgUrlList}}"></sudoku-image> |
|||
</view> |
|||
<view class="flex flex-justify padding text-gray"> |
|||
<wux-tag color="blue">#{{item.paperBarName}}</wux-tag> |
|||
<view class="flex flex-center text-df"> |
|||
<text class="cuIcon-messagefill" style="font-size:16px"></text> |
|||
<text style="margin-left:8rpx">{{item.replyQuantity}}</text> |
|||
<view style="margin-left:48rpx;" data-page="{{pageIndex}}" data-index="{{index}}" catchtap="likeItem"> |
|||
<text class="cuIcon-appreciate{{item.isLiked ? 'fill' : ''}} text-{{item.isLiked ? 'blue' : 'gray'}}" style="font-size:16px"></text> |
|||
<text class="text-df" style="margin-left:8rpx">{{item.likeQuantity}}</text> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<!--加载更多的UI--> |
|||
<view wx:if="{{form.pageNum > 1}}" style="padding:20rpx"> |
|||
<wux-divider> |
|||
<view class="loadmore"> |
|||
<text class="icon--refresher" wx:if="{{!finished}}"></text> |
|||
<text class="text-sm" style="margin-left:8rpx">{{finished?'到底啦~':'加载中...'}}</text> |
|||
</view> |
|||
</wux-divider> |
|||
</view> |
|||
</view> |
|||
<!-- </refresh-view> --> |
|||
</scroll-view> |
|||
@ -1,54 +0,0 @@ |
|||
/* pages/main/index.wxss */ |
|||
.container { |
|||
display: flex; |
|||
flex-direction: column; |
|||
box-sizing: border-box; |
|||
-webkit-text-size-adjust: none; |
|||
-webkit-user-select: none; |
|||
font-size: 35rpx; |
|||
color: #333; |
|||
background-color: white; |
|||
font-family: Helvetica, Arial, "Helvetica Neue", "Droid Sans", "Microsoft YaHei", sans-serif; |
|||
} |
|||
|
|||
.canvas { |
|||
width: 100%; |
|||
height: 200px; |
|||
} |
|||
|
|||
.swiper-image { |
|||
height: 150px; |
|||
border-radius: 6px; |
|||
width: 100%; |
|||
} |
|||
|
|||
.item-host { |
|||
width: 200rpx; |
|||
padding-right:20rpx |
|||
} |
|||
|
|||
.case-class{ |
|||
width: 320rpx; |
|||
} |
|||
|
|||
.case2-class{ |
|||
width: 160rpx; |
|||
} |
|||
|
|||
.case3-class{ |
|||
width: 600rpx; |
|||
} |
|||
|
|||
.host-class{ |
|||
width: 120rpx; |
|||
margin-top: 4rpx; |
|||
} |
|||
|
|||
.image-load { |
|||
width: 50px; |
|||
height: 50px; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
border-radius: 50rpx; |
|||
} |
|||
@ -1,180 +0,0 @@ |
|||
// pages/bidding/index/index.js
|
|||
const request = require('../../../utils/request') //导入模块
|
|||
const util = require('../../../utils/util') |
|||
const event = require('../../../utils/event.js') |
|||
const app = getApp() |
|||
const urlList = ['/information-center/get/my-post-list', '/information-center/get/my-reply-list', '/information-center/get/post-view-list'] |
|||
|
|||
Page({ |
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
height: app.globalData.fragmentHeight, |
|||
loading: true, |
|||
requesting: false, |
|||
finished: false, |
|||
tabList: [ |
|||
{id: 0, name: '我发布的', badge: 0}, |
|||
{id: 1, name: '我评论的', badge: 0}, |
|||
{id: 2, name: '最近浏览', badge: 0} |
|||
], |
|||
tabIndex: 0, |
|||
top: 0, |
|||
messageList: [], |
|||
form: { |
|||
pageNum: 1 |
|||
} |
|||
}, |
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
this.setData({ |
|||
height: app.globalData.fragmentHeight - 90, |
|||
CustomBar: app.globalData.CustomBar |
|||
}) |
|||
event.on('EventMessage', this, this.onEvent) |
|||
this.fetchMessageList() |
|||
}, |
|||
onEvent: function (message) { |
|||
if (message.what == 501) { |
|||
this.onRefreshList() |
|||
} |
|||
}, |
|||
onRefreshList: function () { |
|||
this.setData({ |
|||
messageList: [], |
|||
tabIndex: this.data.tabIndex, |
|||
['form.pageNum']: 1, |
|||
loading: true, |
|||
finished: false |
|||
}) |
|||
this.fetchMessageList() |
|||
}, |
|||
fetchMessageList: function () { |
|||
if (this.data.requesting || this.data.finished) { |
|||
return |
|||
} |
|||
if (this.data.loading) { |
|||
this.data.requesting = true |
|||
} else { |
|||
this.setData({ requesting: true }) |
|||
} |
|||
// /product/cheapList特价产品列表
|
|||
request.get(urlList[this.data.tabIndex], this.data.form).then(result => { |
|||
//成功回调
|
|||
if (result.data.records.length) { |
|||
var respList = result.data.records |
|||
let nowList = `messageList[${this.data.messageList.length}]` |
|||
var num = this.data.form.pageNum |
|||
var finished = this.data.form.pageNum >= result.data.pages |
|||
if(this.data.form.pageNum == 1){ |
|||
this.setData({ |
|||
[nowList]: respList, |
|||
total: result.data.total, |
|||
['form.pageNum']: (num + 1), |
|||
top: 0, |
|||
finished, |
|||
requesting: false, |
|||
loading: false |
|||
}) |
|||
} else { |
|||
this.setData({ |
|||
[nowList]: respList, |
|||
total: result.data.total, |
|||
['form.pageNum']: (num + 1), |
|||
finished, |
|||
requesting: false, |
|||
loading: false |
|||
}) |
|||
} |
|||
} else { |
|||
this.setData({ |
|||
finished: true, |
|||
requesting: false, |
|||
loading: false |
|||
}) |
|||
} |
|||
}).catch(err => { |
|||
//异常回调
|
|||
this.setData({ |
|||
requesting: false, |
|||
loading: false |
|||
}) |
|||
util.showToast(err) |
|||
}) |
|||
}, |
|||
lookItem: function (e) { |
|||
var item = this.data.messageList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] |
|||
if(item.postDetail && this.data.tabIndex == 1){ |
|||
wx.navigateTo({ |
|||
url: '/pages/moment/detail/index?id=' + item.postDetail.id |
|||
}) |
|||
} else { |
|||
wx.navigateTo({ |
|||
url: '/pages/moment/detail/index?id=' + item.id |
|||
}) |
|||
} |
|||
}, |
|||
onTabChange: function (e) { |
|||
if (this.data.tabIndex == Number(e.detail.key)) { |
|||
return |
|||
} |
|||
this.data.tabIndex = Number(e.detail.key) |
|||
this.onRefreshList() |
|||
}, |
|||
onUnload: function(){ |
|||
event.remove('EventMessage', this) |
|||
}, |
|||
showMenu: function(e){ |
|||
var that = this |
|||
var item = this.data.messageList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] |
|||
wx.showActionSheet({ |
|||
itemList: ['编辑', '删除'], |
|||
success(res){ |
|||
if (res.tapIndex === 0){ |
|||
that.editMoment(item) |
|||
}else if (res.tapIndex === 1){ |
|||
that.deleteMoment(item) |
|||
} |
|||
} |
|||
}) |
|||
}, |
|||
editMoment: function(item){ |
|||
wx.navigateTo({ |
|||
url: '/pages/moment/create/index?id=' + item.id |
|||
}) |
|||
}, |
|||
deleteMoment: function(item){ |
|||
this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog') |
|||
var that = this |
|||
this.wuxDialog.open({ |
|||
resetOnClose: true, |
|||
title: '温馨提示', |
|||
content: '确定删除该帖子', |
|||
buttons: [{ |
|||
text: '取消' |
|||
},{ |
|||
text: '确定', |
|||
type: 'primary', |
|||
onTap(e) { |
|||
wx.showLoading({ |
|||
title: '加载中', |
|||
mask: true |
|||
}) |
|||
request.post('/information-center/delete/post', {id: item.id}).then(result => { |
|||
//成功回调
|
|||
wx.hideLoading() |
|||
util.showToast('删除成功') |
|||
that.onRefreshList() |
|||
}).catch(err => { |
|||
//异常回调
|
|||
wx.hideLoading() |
|||
util.showToast(err) |
|||
}) |
|||
} |
|||
}] |
|||
}) |
|||
} |
|||
}) |
|||
@ -1,14 +0,0 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"refresh-view": "/components/refresher/index", |
|||
"wux-tabs": "/components/tabs/index", |
|||
"wux-tab": "/components/tab/index", |
|||
"wux-badge": "/components/badge/index", |
|||
"wux-tag": "/components/tag/index", |
|||
"wux-image": "/components/image/index", |
|||
"sudoku-image": "/components/sudoku-image/index", |
|||
"fold-text": "/components/fold-text/index", |
|||
"wux-dialog": "/components/dialog/index", |
|||
"wux-divider": "/components/divider/index" |
|||
} |
|||
} |
|||
@ -1,101 +0,0 @@ |
|||
<!--pages/moment/list/index.wxml--> |
|||
<wxs module="moment" src="../../moment/index.wxs"></wxs> |
|||
<cu-custom bgColor="bg-white" isBack="{{true}}"> |
|||
<view slot="content">我的帖子</view> |
|||
</cu-custom> |
|||
|
|||
<view class="nav bg-white fixed" style="top:{{CustomBar}}px;padding-right:24rpx"> |
|||
<wux-tabs controlled current="{{tabIndex}}" theme="positive" bindchange="onTabChange"> |
|||
<wux-tab wx:for="{{tabList}}" wx:key="index" key="{{item.id}}"> |
|||
<wux-badge count="{{item.badge}}" top="-12" right="-12"> |
|||
<view class="tab__badge">{{item.name}}</view> |
|||
</wux-badge> |
|||
</wux-tab> |
|||
</wux-tabs> |
|||
</view> |
|||
<view style="height:90rpx;width:100%"></view> |
|||
|
|||
<refresh-view bind:refresh="onRefreshList" height="{{height}}" triggered="{{requesting}}" scrollTop="{{top}}" bind:scrolltolower="fetchMessageList"> |
|||
<view wx:if="{{!messageList.length}}"> |
|||
<view class="list-empty" style="height:{{height}}rpx"> |
|||
<view class="load-spinner text-gray" style="margin-bottom:24px" wx:if="{{loading}}" /> |
|||
<image class="img-empty" src="/assets/image/list_empty.png" wx:else></image> |
|||
<view class="text-empty">{{loading? '正在加载' : '暂无数据'}}</view> |
|||
</view> |
|||
</view> |
|||
<view wx:elif="{{tabIndex == 1}}"> |
|||
<view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{messageList}}" wx:key="pageIndex"> |
|||
<view class="cu-card dynamic no-card" wx:for="{{pageItem}}" wx:key="index" data-page="{{pageIndex}}" data-index="{{index}}" bindtap="lookItem"> |
|||
<wux-divider show-text="{{ false }}" wx:if="{{pageIndex != 0 || index != 0 }}"></wux-divider> |
|||
<view class="cu-item shadow"> |
|||
<view class="cu-list menu-avatar"> |
|||
<view class="cu-item" style="justify-content: flex-start;padding-left:30rpx"> |
|||
<wux-image width="{{50}}" height="{{50}}" shape="circle" src="{{item.replierAvatarUrl}}" mode="aspectFill"> |
|||
<image class="image-load" slot="loading" src="/assets/image/def_image.png"></image> |
|||
</wux-image> |
|||
<view class="content flex-sub"> |
|||
<view class="text-cut" style="max-width:400rpx">{{item.replierNickname}}</view> |
|||
<view class="text-gray text-sm flex justify-between">{{moment.formatMTime(item.createTime)}}评论了帖子</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<fold-text content="{{item.content}}"></fold-text> |
|||
<!-- <sudoku-image image-list="{{item.imgUrlList}}"></sudoku-image> --> |
|||
<view style="padding:0rpx 30rpx"> |
|||
<view style="background:rgba(51,51,51,0.05);border-radius:12rpx;padding-bottom:30rpx"> |
|||
<view class="text-black text-bold text-lg" style="padding:20rpx 30rpx">{{item.postDetail.title}}</view> |
|||
<fold-text content="{{item.postDetail.content}}"></fold-text> |
|||
<!-- <view class="text-gray text-df" style="padding:0rpx 20rpx 20rpx 20rpx">{{item.postDetail.content}}</view> --> |
|||
<view style="padding:0rpx 30rpx"> |
|||
<sudoku-image image-list="{{item.postDetail.imgUrlList}}"></sudoku-image> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="flex flex-justify text-gray text-sm" style="padding:30rpx 30rpx 16rpx 30rpx;"> |
|||
<wux-tag color="blue">#{{item.postDetail.paperBarName}}</wux-tag> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view wx:else> |
|||
<view wx:for-item="pageItem" wx:for-index="pageIndex" wx:for="{{messageList}}" wx:key="pageIndex"> |
|||
<view class="cu-card dynamic no-card" wx:for="{{pageItem}}" wx:key="index" data-page="{{pageIndex}}" data-index="{{index}}" bindtap="lookItem"> |
|||
<wux-divider show-text="{{ false }}" wx:if="{{pageIndex != 0 || index != 0 }}"></wux-divider> |
|||
<view class="cu-item shadow"> |
|||
<view class="cu-list menu-avatar"> |
|||
<view class="cu-item" style="justify-content: flex-start;padding-left:30rpx"> |
|||
<wux-image width="{{50}}" height="{{50}}" shape="circle" src="{{item.ownerAvatarUrl}}" mode="aspectFill"> |
|||
<image class="image-load" slot="loading" src="/assets/image/def_image.png"></image> |
|||
</wux-image> |
|||
<view class="content flex-sub"> |
|||
<view class="text-cut" style="max-width:400rpx">{{item.ownerNickname}}</view> |
|||
<view class="text-gray text-sm flex justify-between">{{moment.formatMTime(item.createTime)}}</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<view class="text-black text-bold text-lg" style="padding:10rpx 30rpx 30rpx 30rpx">{{item.title}}</view> |
|||
<fold-text content="{{item.content}}"></fold-text> |
|||
<view style="padding:0rpx 30rpx"> |
|||
<sudoku-image image-list="{{item.imgUrlList}}"></sudoku-image> |
|||
</view> |
|||
<view class="flex flex-justify text-gray text-sm" style="padding:30rpx 30rpx 16rpx 30rpx;"> |
|||
<wux-tag color="blue">#{{item.paperBarName}}</wux-tag> |
|||
<text class="cuIcon-more" style="font-size:24px" data-page="{{pageIndex}}" data-index="{{index}}" catchtap="showMenu" wx:if="{{tabIndex == 0}}"></text> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
</view> |
|||
<!--加载更多的UI--> |
|||
<view wx:if="{{form.pageNum>1}}" style="padding:20rpx"> |
|||
<wux-divider> |
|||
<view class="loadmore"> |
|||
<text class="icon--refresher" wx:if="{{!finished}}"></text> |
|||
<text class="text-sm" style="margin-left:8rpx">{{finished?'到底啦~':'加载中...'}}</text> |
|||
</view> |
|||
</wux-divider> |
|||
</view> |
|||
</refresh-view> |
|||
|
|||
<wux-dialog id="wux-dialog" /> |
|||
@ -1,9 +0,0 @@ |
|||
/* pages/moment/list/index.wxss */ |
|||
.image-load { |
|||
width: 50px; |
|||
height: 50px; |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
border-radius: 50rpx; |
|||
} |
|||
@ -1,95 +0,0 @@ |
|||
// pages/moment/paper/index.js
|
|||
const request = require('../../../utils/request') //导入模块
|
|||
const util = require('../../../utils/util') |
|||
const storage = require('../../../utils/storage') |
|||
const event = require('../../../utils/event.js') |
|||
const app = getApp() |
|||
|
|||
Page({ |
|||
/** |
|||
* 页面的初始数据 |
|||
*/ |
|||
data: { |
|||
categoryList: [], |
|||
cateIds: null, |
|||
cateIdList: null |
|||
}, |
|||
/** |
|||
* 生命周期函数--监听页面加载 |
|||
*/ |
|||
onLoad: function (options) { |
|||
wx.showLoading({ |
|||
title: '加载中', |
|||
mask: true |
|||
}) |
|||
this.data.cateIds = storage.get('cateIdList' + app.globalData.userInfo.userId) |
|||
if(!util.isEmpty(this.data.cateIds)){ |
|||
this.data.cateIdList = this.data.cateIds.toString().split(',') |
|||
} |
|||
request.get('/information-center/paperCategoryList').then(result => { |
|||
//成功回调
|
|||
if(!util.isEmpty(this.data.cateIds)){ |
|||
for (let index = 0; index < result.data.length; index++) { |
|||
if(this.checkCategory(result.data[index].id)){ |
|||
result.data[index].checked = true |
|||
} |
|||
} |
|||
} |
|||
this.setData({categoryList: result.data}) |
|||
wx.hideLoading() |
|||
}).catch(err => { |
|||
//异常回调
|
|||
wx.hideLoading() |
|||
}) |
|||
}, |
|||
checkCategory: function(id){ |
|||
if(!this.data.cateIdList || !this.data.cateIdList.length){ |
|||
return false |
|||
} |
|||
for (let index = 0; index < this.data.cateIdList.length; index++) { |
|||
if(id == this.data.cateIdList[index]){ |
|||
return true |
|||
} |
|||
} |
|||
return false |
|||
}, |
|||
checkPaper: function(e) { |
|||
var index = e.target.dataset.index |
|||
var item = this.data.categoryList[index] |
|||
if(item.checked){ |
|||
this.setData({ ['categoryList[' + index + '].checked']: !item.checked}) |
|||
return |
|||
} |
|||
var sum = 0 |
|||
for (let i = 0; i < this.data.categoryList.length; i++) { |
|||
if(this.data.categoryList[i].checked){ |
|||
sum++ |
|||
} |
|||
} |
|||
if(sum >= 5){ |
|||
util.showToast('最多只能关注5个纸品') |
|||
return |
|||
} |
|||
this.setData({ ['categoryList[' + index + '].checked']: !item.checked}) |
|||
}, |
|||
onUnload: function(){ |
|||
var cateString = '' |
|||
for (let i = 0; i < this.data.categoryList.length; i++) { |
|||
if(this.data.categoryList[i].checked){ |
|||
if(util.isEmpty(cateString)){ |
|||
cateString = this.data.categoryList[i].id |
|||
} else { |
|||
cateString += ',' + this.data.categoryList[i].id |
|||
} |
|||
} |
|||
} |
|||
if(util.isEmpty(cateString) && util.isEmpty(this.data.cateIds)){ |
|||
return |
|||
} |
|||
if(cateString != this.data.cateIds){ |
|||
storage.put('cateIdList' + app.globalData.userInfo.userId, cateString) |
|||
event.emit('EventMessage', { what: 502, desc: 'CateChange' }) |
|||
} |
|||
} |
|||
|
|||
}) |
|||
@ -1,6 +0,0 @@ |
|||
{ |
|||
"usingComponents": { |
|||
"wux-cell-group": "/components/cell-group/index", |
|||
"wux-cell": "/components/cell/index" |
|||
} |
|||
} |
|||
@ -1,10 +0,0 @@ |
|||
<!--pages/moment/paper/index.wxml--> |
|||
<cu-custom bgColor="bg-white" isBack="{{true}}"> |
|||
<view slot="content">纸品列表</view> |
|||
</cu-custom> |
|||
<wux-cell-group> |
|||
<wux-cell wx:for="{{categoryList}}" wx:key="index" title="{{item.name}}" data-index="{{index}}" bind:click="checkPaper"> |
|||
<image slot="footer" style="width:48rpx;height:48rpx;" src="/assets/image/ico_checked.png" wx:if="{{item.checked}}"></image> |
|||
<image slot="footer" style="width:48rpx;height:48rpx;" src="/assets/image/ico_uncheck.png" wx:else></image> |
|||
</wux-cell> |
|||
</wux-cell-group> |
|||
@ -1 +0,0 @@ |
|||
/* pages/moment/paper/index.wxss */ |
|||
Write
Preview
Loading…
Cancel
Save