From aae439cba27c3c77404f343c962be1c04314fb7d Mon Sep 17 00:00:00 2001 From: xpz2018 <107107461@qq.com> Date: Tue, 12 Jan 2021 17:38:58 +0800 Subject: [PATCH] no message --- app.json | 6 - pages/api/ztb.js | 11 +- pages/article/hot-index/index.js | 6 +- pages/article/list/index.js | 90 ++++++----- pages/article/publish/index.js | 14 +- pages/article/queue-detail/index.js | 6 +- pages/moment/create/index.js | 133 ---------------- pages/moment/create/index.json | 7 - pages/moment/create/index.wxml | 22 --- pages/moment/create/index.wxss | 17 -- pages/moment/detail/index.js | 202 ----------------------- pages/moment/detail/index.json | 10 -- pages/moment/detail/index.wxml | 112 ------------- pages/moment/detail/index.wxss | 35 ---- pages/moment/host-detail/index.js | 147 ----------------- pages/moment/host-detail/index.json | 12 -- pages/moment/host-detail/index.wxml | 85 ---------- pages/moment/host-detail/index.wxss | 31 ---- pages/moment/host-info/index.js | 78 --------- pages/moment/host-info/index.json | 7 - pages/moment/host-info/index.wxml | 35 ---- pages/moment/host-info/index.wxss | 1 - pages/moment/index.wxs | 32 ---- pages/moment/index/index.js | 239 ---------------------------- pages/moment/index/index.json | 16 -- pages/moment/index/index.wxml | 138 ---------------- pages/moment/index/index.wxss | 54 ------- pages/moment/list/index.js | 180 --------------------- pages/moment/list/index.json | 14 -- pages/moment/list/index.wxml | 101 ------------ pages/moment/list/index.wxss | 9 -- pages/moment/paper/index.js | 95 ----------- pages/moment/paper/index.json | 6 - pages/moment/paper/index.wxml | 10 -- pages/moment/paper/index.wxss | 1 - 35 files changed, 70 insertions(+), 1892 deletions(-) delete mode 100644 pages/moment/create/index.js delete mode 100644 pages/moment/create/index.json delete mode 100644 pages/moment/create/index.wxml delete mode 100644 pages/moment/create/index.wxss delete mode 100644 pages/moment/detail/index.js delete mode 100644 pages/moment/detail/index.json delete mode 100644 pages/moment/detail/index.wxml delete mode 100644 pages/moment/detail/index.wxss delete mode 100644 pages/moment/host-detail/index.js delete mode 100644 pages/moment/host-detail/index.json delete mode 100644 pages/moment/host-detail/index.wxml delete mode 100644 pages/moment/host-detail/index.wxss delete mode 100644 pages/moment/host-info/index.js delete mode 100644 pages/moment/host-info/index.json delete mode 100644 pages/moment/host-info/index.wxml delete mode 100644 pages/moment/host-info/index.wxss delete mode 100644 pages/moment/index.wxs delete mode 100644 pages/moment/index/index.js delete mode 100644 pages/moment/index/index.json delete mode 100644 pages/moment/index/index.wxml delete mode 100644 pages/moment/index/index.wxss delete mode 100644 pages/moment/list/index.js delete mode 100644 pages/moment/list/index.json delete mode 100644 pages/moment/list/index.wxml delete mode 100644 pages/moment/list/index.wxss delete mode 100644 pages/moment/paper/index.js delete mode 100644 pages/moment/paper/index.json delete mode 100644 pages/moment/paper/index.wxml delete mode 100644 pages/moment/paper/index.wxss diff --git a/app.json b/app.json index 4aa07c2..fa1e146 100644 --- a/app.json +++ b/app.json @@ -19,12 +19,6 @@ "pages/shop/order/index", "pages/shop/bidding/index", "pages/shop/bill/index", - "pages/moment/paper/index", - "pages/moment/create/index", - "pages/moment/detail/index", - "pages/moment/list/index", - "pages/moment/host-info/index", - "pages/moment/host-detail/index", "pages/article/publish/index", "pages/article/detail/index", "pages/article/price-detail/index", diff --git a/pages/api/ztb.js b/pages/api/ztb.js index bc024df..141c5de 100644 --- a/pages/api/ztb.js +++ b/pages/api/ztb.js @@ -18,6 +18,12 @@ const getAllFactoryList = () => mGet(`/recycle-service/get/all-paper-mill`, null const getFactoryPrice = () => mGet(`/recycle-service/get/paper-mill-paper-category-price-list`, null, zconfig) // /get/paper-mill-city 获取纸厂所有地区列表 const getFactoryCity = () => mGet(`/recycle-service/get/paper-mill-city`, null, zconfig) +// /get/index-info-id 首页获取公告id接口 +const getIndexInfoId = () => mGet(`/recycle-service/get/index-info-id`, null, zconfig) +// /get/paper-mill-list 获取纸厂列表 +const getFactoryList = () => mGet(`/recycle-service/get/paper-mill-list`, null, zconfig) +// /get/paper-mill-received-weight-list/on-today 获取纸厂今日收货量(排队)列表 +const getFactoryTodayList = (params) => mGet(`/recycle-service/get/paper-mill-received-weight-list/on-today`, params, zconfig) export { zconfig, @@ -25,5 +31,8 @@ export { getBaseInfo, getAllFactoryList, getFactoryPrice, - getFactoryCity + getFactoryCity, + getIndexInfoId, + getFactoryList, + getFactoryTodayList } \ No newline at end of file diff --git a/pages/article/hot-index/index.js b/pages/article/hot-index/index.js index ccc4910..64f0e53 100644 --- a/pages/article/hot-index/index.js +++ b/pages/article/hot-index/index.js @@ -1,7 +1,6 @@ // pages/stock/index.js import { getPreferList } from "../../api/moment" -import { getAllFactoryList } from "../../api/ztb" -const request = require('../../../utils/request') //导入模块 +import { getAllFactoryList, getIndexInfoId } from "../../api/ztb" const util = require('../../../utils/util') const storage = require('../../../utils/storage') const event = require('../../../utils/event.js') @@ -67,7 +66,6 @@ Component({ return } } - // /recycle-service/get/paper-mill-list getAllFactoryList().then(result => { result.data.sort((a, b)=> b.isRecommended - a.isRecommended) this.setData({ factoryList: result.data.slice(0, 8) }) @@ -127,7 +125,7 @@ Component({ return } this.data.loopRequesting = true - request.get('/recycle-service/get/index-info-id').then(result => { + getIndexInfoId().then(result => { //成功回调 this.data.loopRequesting = false this.data.noticeList = result.data diff --git a/pages/article/list/index.js b/pages/article/list/index.js index 08bd9b4..7ed068e 100644 --- a/pages/article/list/index.js +++ b/pages/article/list/index.js @@ -1,9 +1,8 @@ // pages/bidding/index/index.js -const request = require('../../../utils/request') //导入模块 +import { getMyList, getReplyList, getViewedList, deleteMoment } from "../../api/moment" const util = require('../../../utils/util') const event = require('../../../utils/event.js') const app = getApp() -const urlList = ['/information-center/article/get/my-Article-list', '/information-center/article-reply/get/my-reply-list', '/information-center/article/get/Article-view-list'] Page({ /** @@ -26,10 +25,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function (options) { - this.setData({ - height: app.globalData.fragmentHeight - 90, - CustomBar: app.globalData.CustomBar - }) + this.setData({ height: app.globalData.fragmentHeight - 90, CustomBar: app.globalData.CustomBar }) event.on('EventMessage', this, this.onEvent) this.fetchMessageList() }, @@ -57,49 +53,62 @@ Page({ } 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 - }) - } + if(this.data.tabIndex == 0){ + getMyList(this.data.form).then(result => { + this.doResult(result) + }).catch(err => { + this.setData({ requesting: false, loading: false }) + util.showToast(err) + }) + } else if(this.data.tabIndex == 1){ + getReplyList(this.data.form).then(result => { + this.doResult(result) + }).catch(err => { + this.setData({ requesting: false, loading: false }) + util.showToast(err) + }) + } else if(this.data.tabIndex == 2){ + getViewedList(this.data.form).then(result => { + this.doResult(result) + }).catch(err => { + this.setData({ requesting: false, loading: false }) + util.showToast(err) + }) + } + }, + doResult: function(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({ - finished: true, + [nowList]: respList, + total: result.data.total, + ['form.pageNum']: (num + 1), + finished, requesting: false, loading: false }) } - }).catch(err => { - //异常回调 + } else { this.setData({ + finished: true, requesting: false, loading: false }) - util.showToast(err) - }) + } }, lookItem: function (e) { var item = this.data.messageList[e.currentTarget.dataset.page][e.currentTarget.dataset.index] @@ -150,8 +159,7 @@ Page({ type: 'primary', onTap(e) { wx.showLoading({ title: '处理中', mask: true }) - // /article/delete/Article 删除文章 - request.post('/information-center/article/delete/Article', {id: item.id}).then(result => { + deleteMoment({id: item.id}).then(result => { //成功回调 wx.hideLoading() util.showToast('删除成功') diff --git a/pages/article/publish/index.js b/pages/article/publish/index.js index fe943ba..6198162 100644 --- a/pages/article/publish/index.js +++ b/pages/article/publish/index.js @@ -1,5 +1,6 @@ // pages/moment/create/index.js -const request = require('../../../utils/request') //导入模块 +import { getMomentDetail, postMoment, updateMoment } from "../../api/moment" +import { getFactoryList } from "../../api/ztb" const util = require('../../../utils/util') const event = require('../../../utils/event.js') @@ -25,7 +26,7 @@ Page({ this.data.factoryFlag = false this.setData({ ['form.millPaperName']: options.name }) } else { - request.get('/recycle-service/get/paper-mill-list').then(result => { + getFactoryList().then(result => { this.data.factoryList = [] for (let index = 0; index < result.data.records.length; index++) { const element = result.data.records[index] @@ -35,7 +36,7 @@ Page({ } if(options.id){ wx.showLoading({ title: '加载中', mask: true }) - request.get('/information-center/article/get/Article-detail/' + options.id).then(result => { + getMomentDetail(options.id).then(result => { // imgUrlList var fileList = [] if (result.data.imgUrlList && result.data.imgUrlList.length) { @@ -80,8 +81,7 @@ Page({ wx.showLoading({ title: '处理中', mask: true }) this.data.requesting = true if(util.isEmpty(this.data.form.id)){ - // /article/save/Article 发文章 - request.post('/information-center/article/save/Article', this.data.form).then(result => { + updateMoment(this.data.form).then(result => { //成功回调 wx.hideLoading() var what = 570 @@ -98,7 +98,7 @@ Page({ }) } else { // /article/update/Article/{id} 编辑文章 - request.post('/information-center/article/update/Article/' + this.data.form.id, this.data.form).then(result => { + postMoment(this.data.form.id, this.data.form).then(result => { //成功回调 wx.hideLoading() event.emit('EventMessage', { what: 501, desc: 'PostChange' }) @@ -120,7 +120,7 @@ Page({ this.pickerView.showPicker(this.data.factoryList) } else { wx.showLoading({ title: '加载中', mask: true }) - request.get('/recycle-service/get/paper-mill-list').then(result => { + getFactoryList().then(result => { this.data.factoryList = [] for (let index = 0; index < result.data.records.length; index++) { const element = result.data.records[index] diff --git a/pages/article/queue-detail/index.js b/pages/article/queue-detail/index.js index 8dbed87..dcd273f 100644 --- a/pages/article/queue-detail/index.js +++ b/pages/article/queue-detail/index.js @@ -1,5 +1,5 @@ // pages/moment/price/index.js -const request = require('../../../utils/request') //导入模块 +import { getFactoryTodayList } from "../../api/ztb" const app = getApp() Page({ @@ -41,9 +41,7 @@ Page({ } else { this.setData({ requesting: true }) } - // /recycle-service/get/paper-mill-received-weight-list/on-today - request.get('/recycle-service/get/paper-mill-received-weight-list/on-today', this.data.form).then(result => { - //成功回调 + getFactoryTodayList(this.data.form).then(result => { if (result.data.records.length) { var respList = result.data.records let nowList = `orderList[${this.data.orderList.length}]` diff --git a/pages/moment/create/index.js b/pages/moment/create/index.js deleted file mode 100644 index 7b3c918..0000000 --- a/pages/moment/create/index.js +++ /dev/null @@ -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) - }) - } - - } - -}) \ No newline at end of file diff --git a/pages/moment/create/index.json b/pages/moment/create/index.json deleted file mode 100644 index c9b0f13..0000000 --- a/pages/moment/create/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "usingComponents": { - "wux-button": "/components/button/index", - "wux-tag": "/components/tag/index", - "wux-uploader": "/components/uploader/index" - } -} \ No newline at end of file diff --git a/pages/moment/create/index.wxml b/pages/moment/create/index.wxml deleted file mode 100644 index 57c139f..0000000 --- a/pages/moment/create/index.wxml +++ /dev/null @@ -1,22 +0,0 @@ - - - 发帖 - - - - - 标题: - - - - - - - - {{item.name}} - - - - - 发布 - \ No newline at end of file diff --git a/pages/moment/create/index.wxss b/pages/moment/create/index.wxss deleted file mode 100644 index cc6778c..0000000 --- a/pages/moment/create/index.wxss +++ /dev/null @@ -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); -} \ No newline at end of file diff --git a/pages/moment/detail/index.js b/pages/moment/detail/index.js deleted file mode 100644 index bec30b4..0000000 --- a/pages/moment/detail/index.js +++ /dev/null @@ -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 - } - } -}) \ No newline at end of file diff --git a/pages/moment/detail/index.json b/pages/moment/detail/index.json deleted file mode 100644 index 0402d9d..0000000 --- a/pages/moment/detail/index.json +++ /dev/null @@ -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" - } -} \ No newline at end of file diff --git a/pages/moment/detail/index.wxml b/pages/moment/detail/index.wxml deleted file mode 100644 index d0253c8..0000000 --- a/pages/moment/detail/index.wxml +++ /dev/null @@ -1,112 +0,0 @@ - - - - 帖子详情 - - - - - - {{momentDetail.title}} - - - - - - {{momentDetail.ownerNickname}} - - {{moment.formatMTime(momentDetail.createTime)}} - - - {{item}} - - - - - {{momentDetail.content}} - - - - - - - - - - - - - {{momentDetail.paperBarInfo.name}} - - - 成员 - {{momentDetail.paperBarInfo.memberQuantity}} - 帖子 - {{momentDetail.paperBarInfo.postQuantity}} - - - - - - - - 评论 - - - - {{requesting? '正在加载' : '暂无评论'}} - - - - - - - - - - {{item.replierNickname}} - - {{item.likeQuantity || '赞'}} - - - - {{item.content}} - - {{moment.formatMTime(item.createTime)}} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/pages/moment/detail/index.wxss b/pages/moment/detail/index.wxss deleted file mode 100644 index c57f243..0000000 --- a/pages/moment/detail/index.wxss +++ /dev/null @@ -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; } \ No newline at end of file diff --git a/pages/moment/host-detail/index.js b/pages/moment/host-detail/index.js deleted file mode 100644 index 24fea45..0000000 --- a/pages/moment/host-detail/index.js +++ /dev/null @@ -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) - } -}) \ No newline at end of file diff --git a/pages/moment/host-detail/index.json b/pages/moment/host-detail/index.json deleted file mode 100644 index d51a3f4..0000000 --- a/pages/moment/host-detail/index.json +++ /dev/null @@ -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" - } -} \ No newline at end of file diff --git a/pages/moment/host-detail/index.wxml b/pages/moment/host-detail/index.wxml deleted file mode 100644 index 7f3f3db..0000000 --- a/pages/moment/host-detail/index.wxml +++ /dev/null @@ -1,85 +0,0 @@ - - - - 纸吧详情 - - - - - - - - - {{hostDetail.name}} - - - - {{hostDetail.memberQuantity}} - 成员 - - - {{hostDetail.postQuantity}} - 帖子 - - - - - {{hostDetail.join? '已加入' :'加入'}} - - - - - - - - - - - - - - - - {{item.ownerNickname}} - {{moment.formatMTime(item.createTime)}} - - 新帖 - - - {{item.title}} - - - - - - - {{label}} - - - - {{item.likeQuantity}} - - {{item.replyQuantity}} - - - - - - - - - - - {{finished?'到底啦~':'加载中...'}} - - - - - - - - - - - - \ No newline at end of file diff --git a/pages/moment/host-detail/index.wxss b/pages/moment/host-detail/index.wxss deleted file mode 100644 index 25cf110..0000000 --- a/pages/moment/host-detail/index.wxss +++ /dev/null @@ -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); -} \ No newline at end of file diff --git a/pages/moment/host-info/index.js b/pages/moment/host-info/index.js deleted file mode 100644 index f532048..0000000 --- a/pages/moment/host-info/index.js +++ /dev/null @@ -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) - }) - } - - } -}) \ No newline at end of file diff --git a/pages/moment/host-info/index.json b/pages/moment/host-info/index.json deleted file mode 100644 index 922c51c..0000000 --- a/pages/moment/host-info/index.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "usingComponents": { - "wux-image": "/components/image/index", - "wux-divider": "/components/divider/index", - "wux-button": "/components/button/index" - } -} \ No newline at end of file diff --git a/pages/moment/host-info/index.wxml b/pages/moment/host-info/index.wxml deleted file mode 100644 index b297210..0000000 --- a/pages/moment/host-info/index.wxml +++ /dev/null @@ -1,35 +0,0 @@ - - - 纸吧资料 - - - - - - - - {{hostDetail.name}} - - - - {{hostDetail.memberQuantity}} - 成员 - - - {{hostDetail.postQuantity}} - 帖子 - - - - - {{hostDetail.join? '退出纸吧' :'加入纸吧'}} - - - - - {{hostDetail.description || '暂无简介'}} - - - \ No newline at end of file diff --git a/pages/moment/host-info/index.wxss b/pages/moment/host-info/index.wxss deleted file mode 100644 index 6d26e1a..0000000 --- a/pages/moment/host-info/index.wxss +++ /dev/null @@ -1 +0,0 @@ -/* pages/moment/host-info/index.wxss */ \ No newline at end of file diff --git a/pages/moment/index.wxs b/pages/moment/index.wxs deleted file mode 100644 index a51b288..0000000 --- a/pages/moment/index.wxs +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/pages/moment/index/index.js b/pages/moment/index/index.js deleted file mode 100644 index 26fd51c..0000000 --- a/pages/moment/index/index.js +++ /dev/null @@ -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' - }) - } - } -}) \ No newline at end of file diff --git a/pages/moment/index/index.json b/pages/moment/index/index.json deleted file mode 100644 index 821fc85..0000000 --- a/pages/moment/index/index.json +++ /dev/null @@ -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" - } -} \ No newline at end of file diff --git a/pages/moment/index/index.wxml b/pages/moment/index/index.wxml deleted file mode 100644 index bc1d728..0000000 --- a/pages/moment/index/index.wxml +++ /dev/null @@ -1,138 +0,0 @@ - - - - 纸吧 - - - - - - - - - - - - - - - - - - - - 精选纸吧 - - - - - - - - - - {{item.name}} - - - - - - - - - - - - - - - - - - 千鸟纸价 - 选择品类 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 推荐帖子 - 我的帖子 - - - - - - - - - - - - - {{item.ownerNickname}} - {{moment.formatMTime(item.createTime)}} - - - - {{item.title}} - - - - - - #{{item.paperBarName}} - - - {{item.replyQuantity}} - - - {{item.likeQuantity}} - - - - - - - - - - - - {{finished?'到底啦~':'加载中...'}} - - - - - - \ No newline at end of file diff --git a/pages/moment/index/index.wxss b/pages/moment/index/index.wxss deleted file mode 100644 index d200052..0000000 --- a/pages/moment/index/index.wxss +++ /dev/null @@ -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; -} \ No newline at end of file diff --git a/pages/moment/list/index.js b/pages/moment/list/index.js deleted file mode 100644 index b1a6908..0000000 --- a/pages/moment/list/index.js +++ /dev/null @@ -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) - }) - } - }] - }) - } -}) \ No newline at end of file diff --git a/pages/moment/list/index.json b/pages/moment/list/index.json deleted file mode 100644 index 6a30aeb..0000000 --- a/pages/moment/list/index.json +++ /dev/null @@ -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" - } -} \ No newline at end of file diff --git a/pages/moment/list/index.wxml b/pages/moment/list/index.wxml deleted file mode 100644 index 33bea3f..0000000 --- a/pages/moment/list/index.wxml +++ /dev/null @@ -1,101 +0,0 @@ - - - - 我的帖子 - - - - - - - {{item.name}} - - - - - - - - - - - - {{loading? '正在加载' : '暂无数据'}} - - - - - - - - - - - - - - {{item.replierNickname}} - {{moment.formatMTime(item.createTime)}}评论了帖子 - - - - - - - - {{item.postDetail.title}} - - - - - - - - - #{{item.postDetail.paperBarName}} - - - - - - - - - - - - - - - - - {{item.ownerNickname}} - {{moment.formatMTime(item.createTime)}} - - - - {{item.title}} - - - - - - #{{item.paperBarName}} - - - - - - - - - - - - {{finished?'到底啦~':'加载中...'}} - - - - - - \ No newline at end of file diff --git a/pages/moment/list/index.wxss b/pages/moment/list/index.wxss deleted file mode 100644 index 17ea088..0000000 --- a/pages/moment/list/index.wxss +++ /dev/null @@ -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; -} \ No newline at end of file diff --git a/pages/moment/paper/index.js b/pages/moment/paper/index.js deleted file mode 100644 index 37984a2..0000000 --- a/pages/moment/paper/index.js +++ /dev/null @@ -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' }) - } - } - -}) \ No newline at end of file diff --git a/pages/moment/paper/index.json b/pages/moment/paper/index.json deleted file mode 100644 index 1c10f0f..0000000 --- a/pages/moment/paper/index.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "usingComponents": { - "wux-cell-group": "/components/cell-group/index", - "wux-cell": "/components/cell/index" - } -} \ No newline at end of file diff --git a/pages/moment/paper/index.wxml b/pages/moment/paper/index.wxml deleted file mode 100644 index 72f704c..0000000 --- a/pages/moment/paper/index.wxml +++ /dev/null @@ -1,10 +0,0 @@ - - - 纸品列表 - - - - - - - \ No newline at end of file diff --git a/pages/moment/paper/index.wxss b/pages/moment/paper/index.wxss deleted file mode 100644 index c98d427..0000000 --- a/pages/moment/paper/index.wxss +++ /dev/null @@ -1 +0,0 @@ -/* pages/moment/paper/index.wxss */ \ No newline at end of file