Browse Source

Merge refs/remotes/origin/master into refs/heads/master

master
lqq 6 years ago
parent
commit
1e7c1082cf
  1. 9
      models/topic.js
  2. 4
      models/user.js
  3. 20
      pages/topics/goodIdea/cell/index.js
  4. 48
      pages/topics/index.js
  5. 175
      pages/topics/interactive/submitTopic/index.js
  6. 2
      pages/topics/interactive/submitTopic/index.wxml
  7. 1
      pages/user/myIdea/index.js
  8. 10
      pages/user/myMessage/cell/index.wxml
  9. 6
      pages/user/myMessage/cell/index.wxss
  10. 21
      pages/user/myMessage/index.js

9
models/topic.js

@ -31,13 +31,14 @@ class TopicModel extends HTTP {
}
// 新建议题
topicAddGroup(){
topicAddGroup(title, content,images,success){
let params = {
url: TopicBaseUrl.topic_list_url,
url: TopicBaseUrl.topic_addGroup_url,
method: Method.POST,
data: {
page: page,
pageSize: 10,
title: title,
content: content,
images: images,
},
success: success
}

4
models/user.js

@ -1,6 +1,7 @@
import { HTTP, Method} from '../utils/http.js'
const UserConst = {
user_info: '', // 个人信息
user_unMessage_url:'/api/message/page', // 我的消息未读
user_myMessage_url:'/api/message/page', // 我的消息
user_myFavorite_url: '/api/collect/collectionList', // 我的收藏
user_goldenList_url: '/api/comment/goldenList', // 我的金点子
@ -26,9 +27,10 @@ class UserModel extends HTTP {
getMyMessageTotal(success) {
let params = {
url: UserConst.user_myTopics_url,
url: UserConst.user_unMessage_url,
method: Method.POST,
data:{
messageStatus:0,
page:1,
pageSize:10,
},

20
pages/topics/goodIdea/cell/index.js

@ -29,12 +29,13 @@ Component({
},
onClickPraise(e) {
const sIndex = e.currentTarget.dataset.index
// var selectItem = e.currentTarget.dataset.item
var selectItem = e.currentTarget.dataset.item
console.log(selectItem)
// var isPraise = "itemData.isPraise"
// this.setData({
// [isPraise]:!isPraise
// })
console.log('啦啦啦')
this.triggerEvent('tapGoodIdeaPraise', {index:sIndex})
// const commentList = this.data.commentList
// const tempList = []
@ -47,8 +48,21 @@ Component({
// this.setData({
// commentList: tempList,
// })
// this.fetchGoodIdeaPraise(selectItem.id)
this.fetchGoodIdeaPraise(selectItem.groupId)
// 评论点赞
},
fetchGoodIdeaPraise(id) {
topicModel.topicCommentPraise(id, res => {
console.log(res)
if (res.code === 200) {
wx.showToast({
title: res.message,
icon: 'none'
})
// this.fetchDetailComment()
}
})
},
}
})

48
pages/topics/index.js

@ -23,10 +23,10 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
onLoad: function () {
if (!store.hasPhone()) {
console.log('已经绑定手机号码')
this.fetchTopicList();
} else {
console.log('未绑定手机号码')
wx.redirectTo({
@ -34,6 +34,11 @@ Page({
})
}
},
onShow: function () {
// 页面出现在前台时执行
console.log('啦啦啦')
this.fetchTopicList();
},
fetchTopicList() {
let page = this.data.currPage
topicModel.getTopicList(page, res => {
@ -133,33 +138,6 @@ Page({
wx.stopPullDownRefresh()
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
@ -191,13 +169,6 @@ Page({
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
// 定义点击标题的事件处理函数,将选中标题的id赋值给selectedTitle
tapSegment: function (e) {
console.log(e)
@ -214,10 +185,5 @@ Page({
case 1:
return this.fetchGoodIdeaList()
}
},
// tapGoodIdeaPraise(e){
// console.log('华加快速度')
// console.log(e)
// }
}
})

175
pages/topics/interactive/submitTopic/index.js

@ -1,12 +1,17 @@
// pages/topics/interactive/submitTopic/index.js
import { config } from '../../../../config.js'
import { store } from '../../../../utils/store.js'
import { TopicModel } from '../../../../models/topic.js'
let topicModel = new TopicModel()
Page({
/**
* 页面的初始数据
*/
data: {
topicTitle:String,
topicDetail:String,
topicTitle:"",
topicDetail:"",
files:[]
},
@ -15,50 +20,8 @@ Page({
*/
onLoad: function (options) {
this.setData({
selectFile: this.selectFile.bind(this),
uplaodFile: this.uplaodFile.bind(this)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
bindTextInput(e){
this.setData({
@ -70,74 +33,78 @@ Page({
topicDetail: e.detail.value
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
upload: function (e) {
console.log(e)
var that = this;
wx.chooseImage({
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success: function (res) {
// 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
that.setData({
files: that.data.files.concat(res.tempFilePaths)
});
}
})
},
chooseImage: function (e) {
console.log('啦啦啦')
// console.log(e)
// var that = this;
// wx.chooseImage({
// sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
// sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
// success: function (res) {
// console.log('啦啦啦')
// // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
// that.setData({
// files: res.tempFilePaths
// });
// }
// })
},
// previewImage: function (e) {
// console.log(e)
// wx.previewImage({
// current: e.currentTarget.id, // 当前显示图片的http链接
// urls: this.data.files // 需要预览的图片http链接列表
// })
// },
uploadError(e) {
console.log('upload error', e.detail)
},
uploadSuccess(e) {
console.log('upload success', e.detail)
},
selectFile(files) {
console.log('files', files)
// 返回false可以阻止某次文件上传
},
uplaodFile(files) {
console.log('upload files', files)
// 文件上传的函数,返回一个promise
const token = store.readToken()
console.log(token)
return new Promise((resolve, reject) => {
setTimeout(() => {
reject('some error')
}, 1000)
files.tempFilePaths.forEach(item=>{
wx.uploadFile({
url: config.api_url + "/api/common/upload",
filePath: item,
header: {
'token': token,
'content-type': 'application/json',
},
name: 'files',
success: (res)=> {
console.log(res);
const data = JSON.parse(res.data)
const image = {
url: config.api_url + '/' + data.result.imgUrl,
}
this.setData({
files: [...this.data.files, image]
})
resolve(this.data.files)
}
})
})
})
},
deleteFile(e){
console.log(e.detai)
},
submit(){
console.log(this.data.topicTitle,this.data.topicDetail)
console.log(this.data.files)
if (this.data.topicTitle === ""){
wx.showToast({
title: '请输入议题标题',
icon: 'none'
})
return
}
// if (this.data.topicDetail === "") {
// wx.showToast({
// title: '请输入议题内容',
// icon: 'none'
// })
// return
// }
const tempImages = []
this.data.files.forEach(item=>{
tempImages.push(item.url)
})
let title = this.data.topicTitle
let content = this.data.topicDetail
let images = ''
if (this.data.files.length > 0) {
images = tempImages.join('')
}
topicModel.topicAddGroup(title,content,images,res=>{
console.log(res)
wx.showToast({
title: res.message,
icon: 'none',
duration:2000,
success(res){
setTimeout(function () {
wx.navigateBack({
delta: 1
})
}, 2000)
}
})
})
}
})

2
pages/topics/interactive/submitTopic/index.wxml

@ -5,7 +5,7 @@
<textarea class="textArea" value="{{topicDetail}}" bindinput="bindTextAreaInput" placeholder="详情内容" />
<mp-cells ext-class="uploader_bd">
<mp-cell>
<mp-uploader ext-class="myUploader" binddelete="deleteFile" bindfail="uploadError" bindsuccess="uploadSuccess" select="{{selectFile}}" upload="{{uplaodFile}}" files="{{files}}" max-count="5" delete="true"></mp-uploader>
<mp-uploader ext-class="myUploader" binddelete="deleteFile" upload="{{uplaodFile}}" files="{{files}}" max-count="9" delete="true"></mp-uploader>
</mp-cell>
</mp-cells>
<view class="btnView">

1
pages/user/myIdea/index.js

@ -166,6 +166,7 @@ Page({
console.log(itemData);
},
tapGoodIdeaPraise(e){
console.log('啦啦啦')
console.log(e)
}
})

10
pages/user/myMessage/cell/index.wxml

@ -1,14 +1,14 @@
<!--pages/user/myMessage/cell/index.wxml-->
<view class="cell" bindtap="onTap">
<view class="cell" id="cell" bindtap="onTap">
<view class="item-left">
<!-- <image wx:if="{{itemData.msgType === 0}}" src="/images/user/activity_icon.png"></image> -->
<image wx:if="{{itemData.msgType === 1}}" src="/images/user/msg_icon.png"></image>
<image wx:if="{{itemData.msgType === 2}}" src="/images/user/activity_icon.png"></image>
<image class="img" wx:if="{{itemData.msgType === 1}}" src="/images/user/msg_icon.png"></image>
<image class="img" wx:if="{{itemData.msgType === 2}}" src="/images/user/activity_icon.png"></image>
</view>
<view class="item-right">
<view class="item-text">
<view>{{itemData.msgName}}</view>
<view>{{itemData.title}}</view>
<view class="msgName">{{itemData.msgName}}</view>
<view class="title">{{itemData.title}}</view>
</view>
<view class="item-time">{{itemData.time}}</view>
</view>

6
pages/user/myMessage/cell/index.wxss

@ -9,7 +9,7 @@
width: 40px;
height: 40px;
}
image{
.img{
width: 40px;
height: 40px;
}
@ -21,11 +21,11 @@ image{
padding: 10px;
border-bottom: 1px solid #E7E7E7;
}
.item-text :first-child{
.msgName{
font-size: 15px;
color: #171717;
}
.item-text :last-child{
.title{
font-size: 13px;
color: #999999;
}

21
pages/user/myMessage/index.js

@ -11,26 +11,7 @@ Page({
* 页面的初始数据
*/
data: {
list:[
// {
// msgName:"活动提醒",
// msgType:0,
// title:"您的报名活动还有两天开始,立即查看",
// time:"11:58"
// },
// {
// msgName: "消息提醒",
// msgType: 1,
// title: "您的评论被点赞,立即查看",
// time: "11:58"
// },
// {
// msgName: "系统提醒",
// msgType: 2,
// title: "您的报名活动还有两天开始,查看详情",
// time: "11:58"
// }
],
list:[],
currentPage: 1
},

Loading…
Cancel
Save