Browse Source

update 修改 议题相关 bug

master
fanp 6 years ago
parent
commit
f736afbc50
  1. 5
      models/user.js
  2. 3
      pages/topics/goodIdea/cell/index.wxml
  3. 6
      pages/topics/goodIdea/cell/index.wxss
  4. 2
      pages/topics/goodIdea/index.js
  5. 6
      pages/topics/index.js
  6. 23
      pages/topics/interactive/submitTopic/index.js
  7. 12
      pages/topics/interactive/submitTopic/index.wxml
  8. 11
      pages/topics/interactive/submitTopic/index.wxss
  9. 13
      pages/topics/interactive/topicArticle/index.js
  10. 7
      pages/topics/interactive/topicArticle/index.wxml
  11. 17
      pages/topics/interactive/topicArticle/index.wxss
  12. 41
      pages/user/index.js
  13. 2
      pages/user/index.wxml
  14. 10
      pages/user/myActivity/index.js
  15. 3
      pages/user/myActivity/index.json
  16. 1
      pages/user/myActivity/index.wxml
  17. 10
      pages/user/myFavorite/index.js
  18. 51
      pages/user/myIdea/index.js
  19. 2
      pages/user/myIdea/index.wxml
  20. 1
      pages/user/myInfo/index.json
  21. 44
      pages/user/myMessage/index.js
  22. 3
      pages/user/myTopics/myRelease/index.json
  23. 1
      pages/user/myTopics/myRelease/index.wxml

5
models/user.js

@ -26,7 +26,7 @@ class UserModel extends HTTP {
} }
updateUserInfo(avatarUrl, nickName, phone, company, position, success){ updateUserInfo(avatarUrl, nickName, success){
let params = { let params = {
url: UserConst.user_updateUserInfo_url, url: UserConst.user_updateUserInfo_url,
method: Method.POST, method: Method.POST,
@ -34,9 +34,6 @@ class UserModel extends HTTP {
isRegister: 2, //1.注册 2.修改用户信息 isRegister: 2, //1.注册 2.修改用户信息
avatar: avatarUrl, avatar: avatarUrl,
realName: nickName, realName: nickName,
phone: phone,
company: company,
position, position
}, },
success: success success: success
} }

3
pages/topics/goodIdea/cell/index.wxml

@ -8,9 +8,6 @@
<view class="userInfo-left"> <view class="userInfo-left">
<view class="userName">{{itemData.commentName}}</view> <view class="userName">{{itemData.commentName}}</view>
<view class="comment-time">{{itemData.commentTime}}</view> <view class="comment-time">{{itemData.commentTime}}</view>
<view class="goodIdeaIcon" wx:if="{{itemData.isGoodIdea === 1}}">
<image style="width:100%;height:100%;" src="./images/goodIdea.png"></image>
</view>
</view> </view>
<view class="userInfo-right" bindtap="onClickPraise" data-item="{{itemData}}" data-index='{{itemIndex}}'> <view class="userInfo-right" bindtap="onClickPraise" data-item="{{itemData}}" data-index='{{itemIndex}}'>
<view class="praiseNum">{{itemData.praiseNum}}</view> <view class="praiseNum">{{itemData.praiseNum}}</view>

6
pages/topics/goodIdea/cell/index.wxss

@ -49,11 +49,7 @@ image{
color: #66708B; color: #66708B;
font-size: 14px; font-size: 14px;
} }
.goodIdeaIcon{
width: 30px;
height: 15px;
line-height: 10px;
}
.comment-time{ .comment-time{
margin: 0 5px 0 5px; margin: 0 5px 0 5px;
font-size: 12px; font-size: 12px;

2
pages/topics/goodIdea/index.js

@ -26,8 +26,6 @@ Component({
methods: { methods: {
onClickPraise(e){ onClickPraise(e){
const itemData = e.detail.itemData; const itemData = e.detail.itemData;
// console.log(itemData);
// this.fetchGoodIdeaPraise(itemData.commentId)
this.triggerEvent('tapGoodIdeaPraise', { commentId: itemData.commentId }) this.triggerEvent('tapGoodIdeaPraise', { commentId: itemData.commentId })
} }
} }

6
pages/topics/index.js

@ -52,6 +52,12 @@ Page({
topicModel.getTopicList(page, res => { topicModel.getTopicList(page, res => {
console.log('议题列表') console.log('议题列表')
console.log(res) console.log(res)
if (res.result.list.length == 0) {
wx.showToast({
title: '暂无数据',
icon: 'none'
})
}
const datas = res.result.list const datas = res.result.list
let tempDatas = [] let tempDatas = []

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

@ -64,7 +64,16 @@ Page({
}) })
}) })
}, },
deleteFile(e){
console.log(e)
let tempImages = this.data.files
const index = e.detail.index
tempImages.splice(index, 1);
this.setData({
files:tempImages
})
},
submit(){ submit(){
if (this.data.topicTitle === ""){ if (this.data.topicTitle === ""){
wx.showToast({ wx.showToast({
@ -73,13 +82,13 @@ Page({
}) })
return return
} }
// if (this.data.topicDetail === "") { if (this.data.topicDetail === "") {
// wx.showToast({ wx.showToast({
// title: '请输入议题内容', title: '请输入议题内容',
// icon: 'none' icon: 'none'
// }) })
// return return
// } }
const tempImages = [] const tempImages = []
this.data.files.forEach(item=>{ this.data.files.forEach(item=>{
tempImages.push(item.url) tempImages.push(item.url)

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

@ -1,8 +1,16 @@
<!--pages/topics/interactive/submitTopic/index.wxml--> <!--pages/topics/interactive/submitTopic/index.wxml-->
<view class="container"> <view class="container">
<input class="title" value="{{topicTitle}}" bindinput="bindTextInput" placeholder="议题"></input> <view class="item">
<view class="must_fill">*</view>
<input class="title" value="{{topicTitle}}" bindinput="bindTextInput" placeholder="议题标题"></input>
</view>
<view class="line-view"></view> <view class="line-view"></view>
<textarea class="textArea" value="{{topicDetail}}" bindinput="bindTextAreaInput" placeholder="详情内容" /> <view class="item">
<view class="must_fill">*</view>
<textarea class="textArea" value="{{topicDetail}}" bindinput="bindTextAreaInput" placeholder="议题内容" />
</view>
<mp-cells ext-class="uploader_bd"> <mp-cells ext-class="uploader_bd">
<mp-cell> <mp-cell>
<mp-uploader ext-class="myUploader" binddelete="deleteFile" upload="{{uplaodFile}}" files="{{files}}" max-count="9" delete="true"></mp-uploader> <mp-uploader ext-class="myUploader" binddelete="deleteFile" upload="{{uplaodFile}}" files="{{files}}" max-count="9" delete="true"></mp-uploader>

11
pages/topics/interactive/submitTopic/index.wxss

@ -2,6 +2,17 @@
.container{ .container{
padding: 20px; padding: 20px;
} }
.item{
display: flex;
flex-direction: row;
/* align-items: center; */
}
.must_fill{
font-size: 13px;
color: red;
margin-right: 5px;
}
.title{ .title{
font-size: 15px; font-size: 15px;
} }

13
pages/topics/interactive/topicArticle/index.js

@ -63,13 +63,13 @@ Page({
topicId: data.id, topicId: data.id,
collectionId: data.collectionId, collectionId: data.collectionId,
isCollect: data.isCollect, isCollect: data.isCollect,
title:data.title, title: data.title || '',
time: data.createTime, time: data.createTime || '',
groupAvator: data.groupAvator, groupAvator: data.groupAvator,
author: data.author, author: data.author || '',
company: data.company, company: data.company || '',
position: data.position, position: data.position || '',
detail:data.content, detail: data.content || '',
imgArr: data.images.split(";").slice(0, -1) imgArr: data.images.split(";").slice(0, -1)
}) })
}) })
@ -87,6 +87,7 @@ Page({
id:item.id, id:item.id,
commentAvator: item.commentAvator, commentAvator: item.commentAvator,
userName: item.username, userName: item.username,
isGoldenIdea: item.isGoldenIdea,
detail: item.comment, detail: item.comment,
time: item.createTime, time: item.createTime,
praiseNum: item.supportNum praiseNum: item.supportNum

7
pages/topics/interactive/topicArticle/index.wxml

@ -49,7 +49,12 @@
<image class="comment_icon" src="{{item.commentAvator}}"></image> <image class="comment_icon" src="{{item.commentAvator}}"></image>
</view> </view>
<view class="comment_info_right"> <view class="comment_info_right">
<view class="comment_info_userName">{{item.userName}}</view> <view class="comment_top">
<view class="comment_info_userName">{{item.userName}}</view>
<view class="goodIdeaIcon" wx:if="{{item.isGoldenIdea === 1}}">
<image style="width:100%;height:100%;" src="/images/topic/gidea.png"></image>
</view>
</view>
<view class="comment_info_detail">{{item.detail}}</view> <view class="comment_info_detail">{{item.detail}}</view>
<view class="comment_info_time"> <view class="comment_info_time">
<view class="comment_info_time_left">{{item.time}}</view> <view class="comment_info_time_left">{{item.time}}</view>

17
pages/topics/interactive/topicArticle/index.wxss

@ -42,11 +42,17 @@ image{
.user_icon{ .user_icon{
width: 30px; width: 30px;
height: 30px; height: 30px;
border-radius: 50%; /* border-radius: 50%;
background-color: #EFECE8; background-color: #EFECE8; */
} }
.user_icon image { .user_icon image {
border-radius: 50%; /* border-radius: 50%; */
}
.goodIdeaIcon{
width: 30px;
height: 15px;
line-height: 10px;
margin-left: 5px;
} }
.user_text{ .user_text{
display: flex; display: flex;
@ -131,6 +137,11 @@ image{
flex-direction: column; flex-direction: column;
padding: 0 10px; padding: 0 10px;
} }
.comment_top{
display: flex;
flex-direction: row;
align-items: center;
}
.comment_info_userName{ .comment_info_userName{
font-size: 14px; font-size: 14px;
color: #66708B; color: #66708B;

41
pages/user/index.js

@ -36,15 +36,6 @@ Page({
}, },
onShow: function () { onShow: function () {
this.getUserInfo() this.getUserInfo()
if (store.hasPhone()) {
console.log('已经绑定手机号码')
this.getUserInfo()
} else {
console.log('未绑定手机号码')
wx.redirectTo({
url: '/pages/register/index',
})
}
}, },
isAuthUserInfo () { isAuthUserInfo () {
let that = this let that = this
@ -84,22 +75,22 @@ Page({
}, },
bindGetUserInfo (e) { bindGetUserInfo (e) {
console.log(e.detail.userInfo) console.log(e.detail.userInfo)
if (e.detail.userInfo){
let avatarUrl = e.detail.userInfo.avatarUrl
let nickName = e.detail.userInfo.nickName
let avatarUrl = e.detail.userInfo.avatarUrl this.updateUserInfo(avatarUrl,nickName)
let city = e.detail.userInfo.city }
let country = e.detail.userInfo.country
let gender = e.detail.userInfo.gender
let nickName = e.detail.userInfo.nickName
let province = e.detail.userInfo.province
this.updateUserInfo(avatarUrl, city, country, gender, nickName, province)
this.isAuthUserInfo()
}, },
hasBindUserInfo () { hasBindUserInfo () {
return store.hasBindUserInfo(); return store.hasBindUserInfo();
}, },
updateUserInfo (avatarUrl, city, country, gender, nickName, province) { // 将用户信息发送服务器
userModel.updateUserInfo(avatarUrl, city, country, gender, nickName, province, res => { updateUserInfo (avatarUrl, nickName) {
userModel.updateUserInfo(avatarUrl, nickName, res => {
if(res.code === 200){
this.isAuthUserInfo()
}
}) })
}, },
getUserInfo () { getUserInfo () {
@ -114,6 +105,16 @@ Page({
avatarUrl: res.result.avatarUrl, avatarUrl: res.result.avatarUrl,
nickName: res.result.nickName, nickName: res.result.nickName,
reAuth: true reAuth: true
},()=>{
if (store.hasPhone()) {
console.log('已经绑定手机号码')
this.getMsgStatus()
} else {
console.log('未绑定手机号码')
wx.redirectTo({
url: '/pages/register/index',
})
}
}) })
store.saveUserInfo({ store.saveUserInfo({
nickName: res.result.nickName, nickName: res.result.nickName,

2
pages/user/index.wxml

@ -12,7 +12,7 @@
<mp-cell> <mp-cell>
<view class="user_auth_hd"> <view class="user_auth_hd">
<!-- <open-data class="user_logo" type="userAvatarUrl"></open-data> --> <!-- <open-data class="user_logo" type="userAvatarUrl"></open-data> -->
<!--<open-data class="user_auth_name" type="userNickName"></open-data> --> <open-data class="user_auth_name" type="userNickName"></open-data>
<!-- 需要使用 button 来授权登录 --> <!-- 需要使用 button 来授权登录 -->
<button class="authBtn" size="mini" wx:if="{{canIUse}}" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">授权登录</button> <button class="authBtn" size="mini" wx:if="{{canIUse}}" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">授权登录</button>
<view wx:else>请升级微信版本</view> <view wx:else>请升级微信版本</view>

10
pages/user/myActivity/index.js

@ -17,19 +17,15 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.setData({
currentPage: 1
})
this.fetchDataList() this.fetchDataList()
}, },
fetchDataList(){ fetchDataList(){
let page = this.data.currentPage let page = this.data.currentPage
userModel.getMyActivityList(page,res=>{ userModel.getMyActivityList(page,res=>{
console.log(res)
if (res.result.list.length == 0) {
wx.showToast({
title: '暂无数据',
icon: 'none'
})
}
const datas = res.result.list const datas = res.result.list
let tempDatas = [] let tempDatas = []
datas.forEach(item => { datas.forEach(item => {

3
pages/user/myActivity/index.json

@ -2,6 +2,7 @@
"enablePullDownRefresh": true, "enablePullDownRefresh": true,
"navigationBarTitleText": "我的活动", "navigationBarTitleText": "我的活动",
"usingComponents": { "usingComponents": {
"e-cell": "/components/cell/index" "e-cell": "/components/cell/index",
"e-empty": "/components/empty/index"
} }
} }

1
pages/user/myActivity/index.wxml

@ -10,4 +10,5 @@
showTop="{{item.showTop}}" showTop="{{item.showTop}}"
bind:clickListItem="clickListItem"/> bind:clickListItem="clickListItem"/>
</block> </block>
<e-empty empty="{{list.length <= 0}}" message="暂无内容"/>
</view> </view>

10
pages/user/myFavorite/index.js

@ -21,19 +21,15 @@ Page({
}, },
onShow :function (){ onShow :function (){
this.setData({
currentPage: 1
})
this.fetchMyFavoriteList() this.fetchMyFavoriteList()
}, },
fetchMyFavoriteList () { fetchMyFavoriteList () {
console.log('啦啦啦') console.log('啦啦啦')
let page = this.data.currentPage let page = this.data.currentPage
userModel.getMyFavoriteList(page, res => { userModel.getMyFavoriteList(page, res => {
console.log(res)
if (res.result.list.length == 0) {
wx.showToast({
title: '暂无数据',
icon: 'none'
})
}
const datas = res.result.list const datas = res.result.list
let tempDatas = [] let tempDatas = []
datas.forEach(item => { datas.forEach(item => {

51
pages/user/myIdea/index.js

@ -5,6 +5,9 @@ dayjs.extend(relativeTime);
import { UserModel } from '../../../models/user.js' import { UserModel } from '../../../models/user.js'
let userModel = new UserModel() let userModel = new UserModel()
import { TopicModel } from '../../../models/topic.js'
let topicModel = new TopicModel()
Page({ Page({
/** /**
@ -19,6 +22,9 @@ Page({
* 生命周期函数--监听页面加载 * 生命周期函数--监听页面加载
*/ */
onLoad: function (options) { onLoad: function (options) {
this.setData({
currentPage: 1
})
this.fetchMyIdeaList() this.fetchMyIdeaList()
}, },
@ -71,33 +77,6 @@ Page({
wx.stopPullDownRefresh() wx.stopPullDownRefresh()
}) })
}, },
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
@ -127,12 +106,20 @@ Page({
}, },
clickListItem(e) { onClickPraise(e) {
const itemData = e.detail.itemData; const itemData = e.detail.itemData;
console.log(itemData); this.fetchGoodIdeaPraise(itemData.commentId)
}, },
tapGoodIdeaPraise(e){ fetchGoodIdeaPraise(id) {
console.log('啦啦啦') topicModel.topicCommentPraise(id, res => {
console.log(e) console.log(res)
if (res.code === 200) {
wx.showToast({
title: res.message,
icon: 'none'
})
this.onPullDownRefresh()
}
})
} }
}) })

2
pages/user/myIdea/index.wxml

@ -3,7 +3,7 @@
<block wx:for="{{list}}" wx:key="{{index}}"> <block wx:for="{{list}}" wx:key="{{index}}">
<cell <cell
itemData="{{item}}" itemData="{{item}}"
bind:clickListItem="clickListItem"/> bind:onClickPraise="onClickPraise"/>
</block> </block>
<e-empty empty="{{list.length <= 0}}" message="暂无内容"/> <e-empty empty="{{list.length <= 0}}" message="暂无内容"/>
</view> </view>

1
pages/user/myInfo/index.json

@ -1,4 +1,5 @@
{ {
"enablePullDownRefresh": true,
"navigationBarTitleText": "个人资料", "navigationBarTitleText": "个人资料",
"usingComponents": { "usingComponents": {
"e-ibutton": "/components/image-button/index", "e-ibutton": "/components/image-button/index",

44
pages/user/myMessage/index.js

@ -66,34 +66,6 @@ Page({
}) })
}, },
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/** /**
* 页面相关事件处理函数--监听用户下拉动作 * 页面相关事件处理函数--监听用户下拉动作
*/ */
@ -115,15 +87,17 @@ Page({
this.fetchMyMessageList() this.fetchMyMessageList()
}, },
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
clickListItem(e) { clickListItem(e) {
const itemData = e.detail.itemData; const itemData = e.detail.itemData;
console.log(itemData); console.log(itemData);
if(itemData.msgType === 1){
wx.navigateTo({
url: `/pages/topics/interactive/topicArticle/index?topicId=${itemData.contentId}`,
})
} else {
wx.navigateTo({
url: `/pages/article/index?id=${itemData.contentId}`,
})
}
} }
}) })

3
pages/user/myTopics/myRelease/index.json

@ -1,6 +1,7 @@
{ {
"component": true, "component": true,
"usingComponents": { "usingComponents": {
"cell": "../myParticipant/cell/index" "cell": "../myParticipant/cell/index",
"e-empty": "/components/empty/index"
} }
} }

1
pages/user/myTopics/myRelease/index.wxml

@ -11,4 +11,5 @@
commentNum="{{item.commentNum}}" commentNum="{{item.commentNum}}"
bind:clickListItem="clickListItem"/> bind:clickListItem="clickListItem"/>
</block> </block>
<e-empty empty="{{list.length <= 0}}" message="暂无内容"/>
</view> </view>

Loading…
Cancel
Save