Browse Source

update topics

master
fanp 6 years ago
parent
commit
3b875d15d3
  1. 3
      app.json
  2. 2
      pages/topics/index.js
  3. 4
      pages/topics/interactive/index.js
  4. 70
      pages/topics/interactive/submitTopic/index.js
  5. 7
      pages/topics/interactive/submitTopic/index.json
  6. 7
      pages/topics/interactive/submitTopic/index.wxml
  7. 38
      pages/topics/interactive/submitTopic/index.wxss
  8. 119
      pages/topics/interactive/topicArticle/index.js
  9. 3
      pages/topics/interactive/topicArticle/index.json
  10. 61
      pages/topics/interactive/topicArticle/index.wxml
  11. 156
      pages/topics/interactive/topicArticle/index.wxss
  12. 4
      pages/topics/message/index.json
  13. 2
      pages/topics/message/index.wxml
  14. 7
      pages/topics/message/index.wxss

3
app.json

@ -16,7 +16,8 @@
"pages/user/myMessage/index",
"pages/user/myTopics/index",
"pages/user/myInfo/index",
"pages/topics/interactive/submitTopic/index"
"pages/topics/interactive/submitTopic/index",
"pages/topics/interactive/topicArticle/index"
],
"window": {
"backgroundTextStyle": "light",

2
pages/topics/index.js

@ -5,7 +5,7 @@ Page({
* 页面的初始数据
*/
data: {
headerTitles: ['互动区', '金点子', '留言箱', '1', '2', '3', '4', '5', '6'],
headerTitles: ['互动区', '金点子', '留言箱'],
selectedTitle: 0
},

4
pages/topics/interactive/index.js

@ -54,6 +54,10 @@ Component({
clickListItem(e) {
const articleId = e.detail.articleId;
console.log(articleId);
wx.navigateTo({
url: `/pages/topics/interactive/topicArticle/index?id=${articleId}`,
})
}
}
})

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

@ -5,15 +5,20 @@ Page({
* 页面的初始数据
*/
data: {
topicTitle:String,
topicDetail:String,
files:[]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
this.setData({
selectFile: this.selectFile.bind(this),
uplaodFile: this.uplaodFile.bind(this)
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
@ -55,11 +60,68 @@ Page({
onReachBottom: function () {
},
bindTextInput(e){
this.setData({
topicTitle:e.detail.value
})
},
bindTextAreaInput(e){
this.setData({
topicDetail: e.detail.value
})
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
chooseImage: 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)
});
}
})
},
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
return new Promise((resolve, reject) => {
setTimeout(() => {
reject('some error')
}, 1000)
})
},
deleteFile(e){
console.log(e.detai)
},
submit(){
console.log(this.data.topicTitle,this.data.topicDetail)
console.log(this.data.files)
}
})

7
pages/topics/interactive/submitTopic/index.json

@ -1,4 +1,9 @@
{
"navigationBarTitleText": "新建议题",
"usingComponents": {}
"usingComponents": {
"e-ibutton": "/components/image-button/index",
"mp-cells": "/components/weui/cells/cells",
"mp-cell": "/components/weui/cell/cell",
"mp-uploader": "/components/weui/uploader/uploader"
}
}

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

@ -3,7 +3,12 @@
<input class="title" bindinput="bindTextInput" placeholder="议题"></input>
<view class="line-view"></view>
<textarea class="textArea" 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-cell>
</mp-cells>
<view class="btnView">
<button class="submitBtn" bindtap="submit">提交</button>
<e-ibutton title="提交" bind:onTap="submit"/>
</view>
</view>

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

@ -16,20 +16,28 @@
.btnView{
position: fixed;
width: 90%;
height: 45px;
bottom: 10px;
}
.submitBtn{
/* background-image: url("/images/common/btn_bg.png"); */
height: 45px;
line-height: 40px;
border-radius: 5px;
color: white;
padding: 10px 20px 20px 20px;
bottom: 0;
left: 0;
right: 0;
}
.uploader_bd .weui-cell{
padding: 10px 0 10px 0;
}
/* .uploader_bd ::before{
border-top: none;
} */
.uploader_bd .weui-uploader__title,.weui-uploader__info{
font-size: 14px;
background-image: linear-gradient(
to right,
#FD6553 30%,
#D70403 100%
);
}
.uploader_bd .weui-uploader__input,
.uploader_bd .weui-uploader__input-box,
.uploader_bd .weui-uploader__file_status,
.uploader_bd .weui-uploader__img{
width: 77px;
height: 77px;
}
/* .uploader_bd .weui-uploader__input-box{
width: 60px;
height: 60px;
} */

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

@ -0,0 +1,119 @@
// pages/topics/interactive/article/index.js
Page({
/**
* 页面的初始数据
*/
data: {
title:"市北区举行国际航运贸易金融创新中心核心区产业建设",
time:"6月7日",
userInfo:{
icon:"",
name:"用户名",
company:"青岛誉群投资有限公司",
position:"董事长"
},
detail:"9月16日晚7时,市北区委、区政府在区机关二楼会议厅举行国际航运贸易金融创新中心核心区产业招商工作方案答辩。这是市北区借鉴市委、市政府推动15个攻势作战经验,围绕创新中心核心区建设举行的首场答辩。区委书记张新竹主持答辩并讲话。",
imgArr:['http://bpic.588ku.com/element_origin_min_pic/16/10/30/528aa13209e86d5d9839890967a6b9c1.jpg',
'http://bpic.588ku.com/element_origin_min_pic/16/10/30/54fcef525fa8f6037d180f3c26f3be65.jpg',
'http://bpic.588ku.com/element_origin_min_pic/16/10/30/62e3ca3a02dddb002eff00482078d194.jpg',
'http://bpic.588ku.com/element_origin_min_pic/16/10/31/c7167fcfb4ebcd12621c05b0c852e98e.jpg'
],
comments:[
{
userIcon:"",
userName:"用户名",
detail:"评论内容",
time:"刚刚",
praiseNum:"30"
},
{
userIcon: "",
userName: "用户名",
detail: "评论内容",
time: "1小时前",
praiseNum: "30"
}
],
unStar: '/images/common/star.png',
star: '/images/common/star_light.png',
isStar:true
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
onClickCollect() {
this.setData({
isStar: !this.data.isStar
})
// 收藏功能
},
previewImg: function (e) {
console.log(e.currentTarget.dataset.index);
var index = e.currentTarget.dataset.index;
var imgArr = this.data.imgArr;
wx.previewImage({
current: imgArr[index], //当前图片地址
urls: imgArr, //所有要预览的图片的地址集合 数组形式
success: function (res) { },
fail: function (res) { },
complete: function (res) { },
})
}
})

3
pages/topics/interactive/topicArticle/index.json

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

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

@ -0,0 +1,61 @@
<!--pages/topics/interactive/article/index.wxml-->
<view class="container">
<view class="topic_info">
<view class="topic_title">
{{title}}
</view>
<view class="topic_time">
<view class="topic_time_left">
{{time}}
</view>
<view class="topic_time_right">
<image src="{{isStar ? star : unStar}}" bindtap="onClickCollect"></image>
</view>
</view>
<view class="topic_userInfo">
<view class="user_icon">
<image src=""></image>
</view>
<view class="user_text">
<view>
{{userInfo.name}}
</view>
<view>
{{userInfo.company + ' ' + userInfo.position}}
</view>
</view>
</view>
</view>
<view class="topic_detail">
<view class="topic_detail_text">
{{detail}}
</view>
<view class="topic_detail_imgs">
<view class='imgList-li' wx:for='{{imgArr}}'>
<image class='img' src='{{item}}' data-index='{{index}}' bindtap='previewImg'></image>
</view>
</view>
</view>
<view class="section_line"></view>
<view class="topic_comment">
<view class="topic_comment_top">
{{'评论 ' + comments.length}}
</view>
<view class="comment_info" wx:for="{{comments}}">
<view class="comment_info_left">
<image class="comment_icon" src=""></image>
</view>
<view class="comment_info_right">
<view class="comment_info_userName">{{item.userName}}</view>
<view class="comment_info_detail">{{item.detail}}</view>
<view class="comment_info_time">
<view class="comment_info_time_left">{{item.time}}</view>
<view class="comment_info_time_right">
<view class="praiseNum">{{item.praiseNum}}</view>
<image class="praiseIcon" src="/images/common/zan.png"></image>
</view>
</view>
</view>
</view>
</view>
</view>

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

@ -0,0 +1,156 @@
.container{
display: flex;
flex-direction: column;
}
.topic_info{
display: flex;
flex-direction: column;
padding: 10px 20px 10px 20px;
}
.topic_title{
font-size: 18px;
}
.topic_time{
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 10px 0 10px 0;
}
.topic_time_left{
font-size: 13px;
color: #B3B3B3;
}
.topic_time_right{
padding: 0 10px;
width: 20px;
height: 20px;
line-height: -10px;
}
image{
width: 100%;
height: 100%;
}
.topic_userInfo{
border-radius: 5px;
padding: 10px;
background-color: #FEFAF6;
display: flex;
flex-direction: row;
align-items: center;
}
.user_icon{
width: 30px;
height: 30px;
border-radius: 50%;
background-color: #EFECE8;
}
.user_text{
display: flex;
flex-direction: column;
color: #808B8C;
padding: 0 10px;
font-weight: 0;
}
.user_text :first-child{
font-size: 14px;
}
.user_text :last-child{
font-size: 12px;
}
.topic_detail{
display: flex;
flex-direction: column;
padding: 20px 20px;
/* border-bottom: 7px solid #FAFAFA; */
}
.topic_detail_text{
color: #373737;
font-size: 15px;
}
.section_line {
padding: 0;
height: 7px;
width: 100%;
background-color: #FAFAFA;
}
.topic_detail_imgs{
width: 100%;
padding: 10px 0;
display: flex;
justify-content: flex-start;
flex-wrap: wrap;
}
.imgList-li {
width: 100px;
height: 100px;
margin: 5px 5px;
}
.img{
width: 100%;
height: 100%;
}
.topic_comment{
padding: 10px 20px;
display: flex;
flex-direction: column;
}
.topic_comment_top{
height: 40px;
border-bottom: 1px solid #E7E7E7;
}
.comment_info{
padding: 10px 0;
display: flex;
flex-direction: row;
border-bottom: 1px solid #E7E7E7;
}
.comment_info_left{
width: 30px;
height: 30px;
border-radius: 50%;
background-color: red;
}
.comment_icon{
width: 30px;
height: 30px;
}
.comment_info_right{
width: 100%;
display: flex;
flex-direction: column;
padding: 0 10px;
}
.comment_info_userName{
font-size: 14px;
color: #66708B;
}
.comment_info_detail{
font-size: 14px;
color: #3B3B3B;
}
.comment_info_time{
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.comment_info_time_left{
font-size: 10px;
color: #999999;
}
.comment_info_time_right{
display: flex;
flex-direction: row;
align-items: center;
}
.praiseNum{
font-size: 10px;
color: #ABABAB;
}
.praiseIcon{
margin-left: 5px;
width: 10px;
height: 10px;
}

4
pages/topics/message/index.json

@ -1,4 +1,6 @@
{
"component": true,
"usingComponents": {}
"usingComponents": {
"e-ibutton": "/components/image-button/index"
}
}

2
pages/topics/message/index.wxml

@ -4,7 +4,7 @@
<view class="section">
<textarea class="textArea" bindinput="bindTextAreaInput" placeholder="有什么想留言的内容?" />
<view class="btnView">
<button class="submitBtn" bindtap="submit">提交</button>
<e-ibutton title="提交" bind:onTap="submit"/>
</view>
</view>
</view>

7
pages/topics/message/index.wxss

@ -14,9 +14,10 @@
}
.btnView{
position: fixed;
width: 90%;
height: 45px;
bottom: 10px;
padding: 10px 20px 20px 20px;
bottom: 0;
left: 0;
right: 0;
}
.submitBtn{
/* width: 100%; */

Loading…
Cancel
Save