17 changed files with 734 additions and 22 deletions
@ -0,0 +1,48 @@ |
|||||
|
// pages/topics/interactive/index.js
|
||||
|
Component({ |
||||
|
/** |
||||
|
* 组件的属性列表 |
||||
|
*/ |
||||
|
properties: { |
||||
|
list:{ |
||||
|
type:Array, |
||||
|
value:[] |
||||
|
} |
||||
|
}, |
||||
|
/** |
||||
|
* 组件的初始数据 |
||||
|
*/ |
||||
|
data: { |
||||
|
|
||||
|
}, |
||||
|
attached: function () { |
||||
|
console.log("center页面") |
||||
|
console.log(this.properties.list) |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 组件的方法列表 |
||||
|
*/ |
||||
|
methods: { |
||||
|
onTap(){ |
||||
|
wx.navigateTo({ |
||||
|
url: `/pages/topics/interactive/submitTopic/index`, |
||||
|
}) |
||||
|
}, |
||||
|
//点击列表cell
|
||||
|
clickListItem(e) { |
||||
|
//获取文章id
|
||||
|
const id = e.currentTarget.dataset.id |
||||
|
console.log("clickListItem") |
||||
|
// console.log(id)
|
||||
|
console.log(e) |
||||
|
wx.navigateTo({ |
||||
|
url: `/pages/article/index?id=${id}`, |
||||
|
}) |
||||
|
}, |
||||
|
deleteTopic(e){ |
||||
|
this.triggerEvent('deleteTopic', { id: e.detail.id }) |
||||
|
} |
||||
|
} |
||||
|
}) |
@ -0,0 +1,6 @@ |
|||||
|
{ |
||||
|
"component": true, |
||||
|
"usingComponents": { |
||||
|
|
||||
|
} |
||||
|
} |
@ -0,0 +1,27 @@ |
|||||
|
<!--pages/topics/interactive/index.wxml--> |
||||
|
<view class="container"> |
||||
|
<block wx:for="{{list}}" wx:key="{{index}}"> |
||||
|
<view class="cell" bindtap="clickListItem" data-id="{{item.id}}"> |
||||
|
<view class="content"> |
||||
|
<view class="left" wx:if="{{item.titlePic.length > 0}}"> |
||||
|
<image class="articleImg" src="{{item.titlePic}}"></image> |
||||
|
</view> |
||||
|
<view class="right {{articleImg === '' ? 'rightActive' : ''}}"> |
||||
|
<view class="right-top"> |
||||
|
<view class="right-title"> |
||||
|
{{item.title}} |
||||
|
<!-- 啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊 --> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="right-bottom"> |
||||
|
<view class="bottom-top" wx:if="{{item.isTop}}"> |
||||
|
置顶 |
||||
|
</view> |
||||
|
<view class="cell_info_meta">{{item.createTime}}</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</view> |
||||
|
</block> |
||||
|
</view> |
||||
|
|
@ -0,0 +1,125 @@ |
|||||
|
/* pages/topics/interactive/index.wxss */ |
||||
|
.publish{ |
||||
|
position: fixed; |
||||
|
width: 40px; |
||||
|
height: 40px; |
||||
|
right: 20px; |
||||
|
bottom: 40px; |
||||
|
} |
||||
|
|
||||
|
image{ |
||||
|
width: 100%; |
||||
|
height: 100%; |
||||
|
} |
||||
|
.container{ |
||||
|
font-family: PingFangSC-Regular; |
||||
|
font-weight: 300; |
||||
|
} |
||||
|
|
||||
|
.cell { |
||||
|
/* border-bottom: 1px solid #E7E7E7; |
||||
|
display: flex; |
||||
|
flex-direction: row; |
||||
|
padding: 10px 20px; |
||||
|
align-items: center; */ |
||||
|
/* min-height: 80px; */ |
||||
|
display: flex; |
||||
|
align-items: center; |
||||
|
justify-content: center; |
||||
|
width:100%; |
||||
|
border-bottom: 1px solid #E7E7E7; |
||||
|
} |
||||
|
|
||||
|
.content { |
||||
|
display: flex; |
||||
|
width:90%; |
||||
|
height:80px; |
||||
|
margin:15px 0px 5px 0px; |
||||
|
} |
||||
|
.left{ |
||||
|
width:22%; |
||||
|
/* background-color: #EEEEEE; */ |
||||
|
/* border:1px solid black; */ |
||||
|
display: flex; |
||||
|
/* align-items: center; */ |
||||
|
/* justify-content: center; */ |
||||
|
} |
||||
|
.articleImg{ |
||||
|
width: 55px; |
||||
|
height: 55px; |
||||
|
border-radius: 50%; |
||||
|
} |
||||
|
|
||||
|
.right{ |
||||
|
flex:1; |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
/* justify-content: space-between; */ |
||||
|
height: 100%; |
||||
|
/* align-items: center; */ |
||||
|
justify-content: center; |
||||
|
/* border:1px solid black; */ |
||||
|
} |
||||
|
.rightActive{ |
||||
|
|
||||
|
} |
||||
|
|
||||
|
.right-top{ |
||||
|
height:60%; |
||||
|
width:100%; |
||||
|
/* border:1px solid black; */ |
||||
|
display: flex; |
||||
|
/* 底部对齐 */ |
||||
|
align-items: center; |
||||
|
|
||||
|
} |
||||
|
.right-title{ |
||||
|
/* font-size: 17px; |
||||
|
color: #000; |
||||
|
display: -webkit-box; |
||||
|
-webkit-box-orient: vertical; |
||||
|
-webkit-line-clamp: 2; |
||||
|
overflow: hidden; |
||||
|
word-break: break-all; |
||||
|
text-overflow: ellipsis; |
||||
|
height:80%; |
||||
|
width:100%; */ |
||||
|
|
||||
|
font-size: 17px; |
||||
|
color: #000; |
||||
|
display: -webkit-box; |
||||
|
-webkit-box-orient: vertical; |
||||
|
-webkit-line-clamp: 2; |
||||
|
overflow: hidden; |
||||
|
word-break: break-all; |
||||
|
text-overflow: ellipsis; |
||||
|
/* height:85%; */ |
||||
|
/* border: 1px solid black; */ |
||||
|
} |
||||
|
|
||||
|
.right-bottom{ |
||||
|
display: flex; |
||||
|
/* flex-direction: row; */ |
||||
|
align-items: center; |
||||
|
justify-content: flex-end; |
||||
|
height: 40%; |
||||
|
margin:10px 0px 5px 0px; |
||||
|
/* border:1px solid black; */ |
||||
|
/* align-items: flex-end; */ |
||||
|
|
||||
|
} |
||||
|
.bottom-top{ |
||||
|
font-size: 14px; |
||||
|
color:red; |
||||
|
border-radius: 5px; |
||||
|
border:1px solid red; |
||||
|
margin:0px 10px; |
||||
|
padding:0px 5px; |
||||
|
} |
||||
|
.cell_info_meta { |
||||
|
display: flex; |
||||
|
flex-direction: row; |
||||
|
font-size: 12px; |
||||
|
color: #D4D4D4; |
||||
|
|
||||
|
} |
@ -1,7 +1,20 @@ |
|||||
<!--pages/topics/index.wxml--> |
<!--pages/topics/index.wxml--> |
||||
<view class="content-wrapper"> |
<view class="content-wrapper"> |
||||
<e-segment bind:tapSegment="tapSegment" headerTitles="{{headerTitles}}" defaultSelectIndex="{{selectedTitle}}"/> |
<e-segment bind:tapSegment="tapSegment" headerTitles="{{headerTitles}}" defaultSelectIndex="{{selectedTitle}}"/> |
||||
|
|
||||
|
|
||||
<interactive wx:if="{{segmentIndex==0}}" list="{{topicList}}" bind:deleteTopic="deleteTopic"/> |
<interactive wx:if="{{segmentIndex==0}}" list="{{topicList}}" bind:deleteTopic="deleteTopic"/> |
||||
<goodIdea wx:if="{{segmentIndex==1}}" list="{{goodIdeaList}}" bind:tapGoodIdeaPraise="tapGoodIdeaPraise" bind:deleteTopicComment="deleteTopicComment"/> |
|
||||
<message wx:if="{{segmentIndex==2}}" /> |
|
||||
|
|
||||
|
|
||||
|
<!-- <goodIdea wx:if="{{segmentIndex==1}}" list="{{goodIdeaList}}" bind:tapGoodIdeaPraise="tapGoodIdeaPraise" bind:deleteTopicComment="deleteTopicComment"/> --> |
||||
|
|
||||
|
|
||||
|
<!-- 一会改成centerList --> |
||||
|
<center wx:if="{{segmentIndex==1}}" list="{{centerList}}"/> |
||||
|
|
||||
|
|
||||
|
<!-- <message wx:if="{{segmentIndex==2}}" /> --> |
||||
|
<talents wx:if="{{segmentIndex==2}}" /> |
||||
</view> |
</view> |
||||
|
@ -1 +1,5 @@ |
|||||
/* pages/topics/index.wxss */ |
/* pages/topics/index.wxss */ |
||||
|
.content-wrapper{ |
||||
|
display: flex; |
||||
|
flex-direction: column; |
||||
|
} |
@ -0,0 +1,224 @@ |
|||||
|
// pages/topics/common/message/index.js
|
||||
|
import { config } from '../../../config.js' |
||||
|
import { store } from '../../../utils/store.js' |
||||
|
import { TopicModel } from '../../../models/topic.js' |
||||
|
let topicModel = new TopicModel() |
||||
|
|
||||
|
Component({ |
||||
|
/** |
||||
|
* 组件的属性列表 |
||||
|
*/ |
||||
|
properties: { |
||||
|
|
||||
|
}, |
||||
|
|
||||
|
/** |
||||
|
* 组件的初始数据 |
||||
|
*/ |
||||
|
data: { |
||||
|
messageTitle:"", |
||||
|
messageDetail:"", |
||||
|
files: [], |
||||
|
// 所在街道
|
||||
|
streets: [], |
||||
|
streetsIndex: 0, |
||||
|
|
||||
|
//接口街道的数据
|
||||
|
results:[], |
||||
|
//选择后获取的街道的I,
|
||||
|
streetID:'', |
||||
|
}, |
||||
|
// lifetimes: {
|
||||
|
// attached: function () {
|
||||
|
// // 在组件实例进入页面节点树时执行
|
||||
|
// },
|
||||
|
// detached: function () {
|
||||
|
// // 在组件实例被从页面节点树移除时执行
|
||||
|
// }
|
||||
|
// },
|
||||
|
// attached: function () {
|
||||
|
// console.log('啦啦啦')
|
||||
|
// },
|
||||
|
|
||||
|
/** |
||||
|
* 组件的方法列表 |
||||
|
*/ |
||||
|
attached: function () { |
||||
|
console.log('talents页面') |
||||
|
// var th = this;
|
||||
|
this.setData({ |
||||
|
uplaodFile: this.uplaodFile.bind(this) |
||||
|
}) |
||||
|
topicModel.getStreetList(res=>{ |
||||
|
var resultss = res.result |
||||
|
var streett = [] |
||||
|
resultss.forEach((value,index)=>{ |
||||
|
streett[index] = value.departName |
||||
|
}) |
||||
|
//把streett添加第一项设为空
|
||||
|
streett.unshift('') |
||||
|
console.log(streett) |
||||
|
|
||||
|
this.setData({ |
||||
|
streets: streett |
||||
|
}) |
||||
|
//把接口数据放在results里
|
||||
|
this.setData({ |
||||
|
results: resultss |
||||
|
}) |
||||
|
console.log(this.data.results) |
||||
|
}) |
||||
|
}, |
||||
|
methods: { |
||||
|
// 以下为修改
|
||||
|
bindPickerStreetsChange: function(e) { |
||||
|
// console.log("1"+e.detail.value)
|
||||
|
this.setData({ |
||||
|
streetsIndex: e.detail.value |
||||
|
}) |
||||
|
// console.log("2"+this.data.streetsIndex)
|
||||
|
this.setData({ |
||||
|
streetID: this.data.results[this.data.streetsIndex-1].id |
||||
|
}) |
||||
|
// console.log(this.data.streetID)
|
||||
|
}, |
||||
|
//以上为修改
|
||||
|
bindTextInput(e) { |
||||
|
this.setData({ |
||||
|
messageTitle: e.detail.value |
||||
|
}) |
||||
|
}, |
||||
|
bindTextAreaInput(e) { |
||||
|
this.setData({ |
||||
|
messageDetail: e.detail.value |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
uplaodFile(files) { |
||||
|
console.log('upload files', files) |
||||
|
// 文件上传的函数,返回一个promise
|
||||
|
const token = store.readToken() |
||||
|
console.log(token) |
||||
|
return new Promise((resolve, reject) => { |
||||
|
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) |
||||
|
let tempImages = this.data.files |
||||
|
const index = e.detail.index |
||||
|
|
||||
|
tempImages.splice(index, 1); |
||||
|
this.setData({ |
||||
|
files: tempImages |
||||
|
}) |
||||
|
}, |
||||
|
|
||||
|
submit() { |
||||
|
// if (this.data.messageTitle === '') {
|
||||
|
// wx.showModal({
|
||||
|
// title: '提示',
|
||||
|
// content: '请输入标题',
|
||||
|
// showCancel: false
|
||||
|
// })
|
||||
|
// return
|
||||
|
// }
|
||||
|
if (this.data.messageDetail === ''){ |
||||
|
wx.showModal({ |
||||
|
title: '提示', |
||||
|
content: '请输入正文内容', |
||||
|
showCancel:false |
||||
|
}) |
||||
|
return |
||||
|
} |
||||
|
//判断是否选择街道
|
||||
|
if (this.data.streetID === ''){ |
||||
|
wx.showModal({ |
||||
|
title: '提示', |
||||
|
content: '请输入街道', |
||||
|
showCancel:false |
||||
|
}) |
||||
|
return |
||||
|
} |
||||
|
//仿照这个方法添加文本,图片,街道
|
||||
|
// topicModel.addMessage(this.data.messageTitle, this.data.messageDetail,this.data.files,res=>{
|
||||
|
// if(res.code === 200){
|
||||
|
// this.setData({
|
||||
|
// messageTitle:'',
|
||||
|
// messageDetail: '',
|
||||
|
// files:[],
|
||||
|
// },()=>{
|
||||
|
// wx.showToast({
|
||||
|
// title: res.message,
|
||||
|
// icon: 'none'
|
||||
|
// })
|
||||
|
// })
|
||||
|
// }
|
||||
|
// })
|
||||
|
|
||||
|
topicModel.addTalents(this.data.messageDetail, this.data.files,this.data.streetID,res=>{ |
||||
|
if(res.code === 200){ |
||||
|
this.setData({ |
||||
|
messageDetail: '', |
||||
|
streetID:'', |
||||
|
files:[], |
||||
|
},()=>{ |
||||
|
// wx.showToast({
|
||||
|
// title: res.message,
|
||||
|
// icon: 'none'
|
||||
|
// })
|
||||
|
wx.showModal({ |
||||
|
title: '提交成功', |
||||
|
content: '问题已收到,我们会尽快给您答复的!', |
||||
|
cancelText:'知道了', |
||||
|
confirmText:'查看进度', |
||||
|
success (res) { |
||||
|
if (res.confirm) { |
||||
|
console.log('用户点击查看进度') |
||||
|
// 查看进度怎么填呀??
|
||||
|
|
||||
|
} else if (res.cancel) { |
||||
|
console.log('用户点击知道了') |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
|
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
|
||||
|
}) |
@ -0,0 +1,9 @@ |
|||||
|
{ |
||||
|
"component": true, |
||||
|
"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" |
||||
|
} |
||||
|
} |
@ -0,0 +1,64 @@ |
|||||
|
<!--pages/topics/common/message/index.wxml--> |
||||
|
<view class="container"> |
||||
|
|
||||
|
<!-- <view class="item"> |
||||
|
<view class="must_fill">*</view> |
||||
|
<input class="title" maxlength="95" value="{{messageTitle}}" bindinput="bindTextInput" placeholder="请输入标题"></input> |
||||
|
</view> --> |
||||
|
|
||||
|
<!-- <view class="line-view"></view> |
||||
|
<view class="item"> |
||||
|
<view class="must_fill">*</view> |
||||
|
<textarea class="textArea" maxlength="1000" value="{{messageDetail}}" bindinput="bindTextAreaInput" placeholder="请描述您的问题" /> |
||||
|
</view> |
||||
|
|
||||
|
<mp-cells ext-class="uploader_msg_bd"> |
||||
|
<mp-cell> |
||||
|
<mp-uploader ext-class="myUploader" binddelete="deleteFile" upload="{{uplaodFile}}" files="{{files}}" max-count="9" delete="true"></mp-uploader> |
||||
|
</mp-cell> |
||||
|
</mp-cells> --> |
||||
|
|
||||
|
<!-- 线 --> |
||||
|
<view class="line-view"></view> |
||||
|
<!-- 请描述您的问题加上传图片 --> |
||||
|
<view class="question-image"> |
||||
|
<!-- 文本框 --> |
||||
|
<view class="item"> |
||||
|
<textarea class="textArea" maxlength="1000" value="{{messageDetail}}" bindinput="bindTextAreaInput" placeholder="请描述您的问题" /> |
||||
|
</view> |
||||
|
<!-- 添加图片 --> |
||||
|
<view> |
||||
|
<!-- <mp-uploader max-count="9" delete="true" binddelete="deleteFile" upload="{{uplaodFile}}" files="{{files}}" select="{{selectFile}}" ></mp-uploader> --> |
||||
|
<mp-uploader ext-class="myUploader" delete="true" binddelete="deleteFile" upload="{{uplaodFile}}" files="{{files}}" select="{{selectFile}}" max-count="9" title=""></mp-uploader> |
||||
|
</view> |
||||
|
</view> |
||||
|
<!-- 线 --> |
||||
|
<view class="line-view"></view> |
||||
|
<!-- 所在街道 --> |
||||
|
<view class="select-view"> |
||||
|
<!-- 字体图标 --> |
||||
|
<view class="select-mark"> |
||||
|
<text class="fa fa-map-marker fa-lg"></text> |
||||
|
</view> |
||||
|
<!-- 选项 --> |
||||
|
<view class="select-picker"> |
||||
|
<picker bindchange="bindPickerStreetsChange" value="{{streetsIndex}}" range="{{streets}}" > |
||||
|
<view> |
||||
|
<block wx:if="{{streetsIndex == 0}}"> |
||||
|
选择街道 |
||||
|
</block> |
||||
|
<block wx:else> |
||||
|
{{streets[streetsIndex]}} |
||||
|
</block> |
||||
|
</view> |
||||
|
</picker> |
||||
|
</view> |
||||
|
<!-- 字体图标 --> |
||||
|
<view class="select-mark"> |
||||
|
<text class="fa fa-angle-right fa-lg" style="color:#ACACAE"></text> |
||||
|
</view> |
||||
|
</view> |
||||
|
<view class="btnView"> |
||||
|
<e-ibutton title="提交" bind:onTap="submit"/> |
||||
|
</view> |
||||
|
</view> |
@ -0,0 +1,87 @@ |
|||||
|
/* pages/topics/common/message/index.wxss */ |
||||
|
@import '../../../style/font.wxss'; |
||||
|
.container{ |
||||
|
padding: 0px 20px; |
||||
|
} |
||||
|
.item{ |
||||
|
display: flex; |
||||
|
flex-direction: row; |
||||
|
|
||||
|
/* align-items: center; */ |
||||
|
} |
||||
|
.must_fill{ |
||||
|
font-size: 13px; |
||||
|
color: red; |
||||
|
margin-right: 5px; |
||||
|
} |
||||
|
.title{ |
||||
|
font-size: 15px; |
||||
|
width: 100%; |
||||
|
} |
||||
|
.textArea{ |
||||
|
font-size: 14px; |
||||
|
width: 100%; |
||||
|
/* line-height: 10px; */ |
||||
|
} |
||||
|
.line-view{ |
||||
|
height: 1px; |
||||
|
background-color: #F1F1F1; |
||||
|
/* margin: 10px 0 10px 0; */ |
||||
|
margin: 0px 0 10px 0; |
||||
|
} |
||||
|
.btnView{ |
||||
|
position: fixed; |
||||
|
padding: 10px 20px 20px 20px; |
||||
|
bottom: 0; |
||||
|
left: 0; |
||||
|
right: 0; |
||||
|
} |
||||
|
.submitBtn{ |
||||
|
/* width: 100%; */ |
||||
|
/* margin-left: 20px; |
||||
|
margin-right: 20px; */ |
||||
|
/* position: fixed; |
||||
|
bottom: 10px; */ |
||||
|
height: 45px; |
||||
|
line-height: 40px; |
||||
|
border-radius: 5px; |
||||
|
color: white; |
||||
|
font-size: 14px; |
||||
|
background-image: linear-gradient( |
||||
|
to right, |
||||
|
#FD6553 30%, |
||||
|
#D70403 100% |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
.uploader_msg_bd .weui-cell{ |
||||
|
padding: 10px 0 10px 0; |
||||
|
} |
||||
|
/* .uploader_bd ::before{ |
||||
|
border-top: none; |
||||
|
} */ |
||||
|
.uploader_msg_bd .weui-uploader__title,.weui-uploader__info{ |
||||
|
font-size: 14px; |
||||
|
} |
||||
|
.uploader_msg_bd .weui-uploader__input, |
||||
|
.uploader_msg_bd .weui-uploader__input-box, |
||||
|
.uploader_msg_bd .weui-uploader__file_status, |
||||
|
.uploader_msg_bd .weui-uploader__img{ |
||||
|
width: 77px; |
||||
|
height: 77px; |
||||
|
} |
||||
|
|
||||
|
/* 以下为新增 */ |
||||
|
.question-image{ |
||||
|
padding:20px 0px; |
||||
|
} |
||||
|
.select-view{ |
||||
|
display: flex; |
||||
|
} |
||||
|
.select-mark{ |
||||
|
width:15px; |
||||
|
} |
||||
|
.select-picker{ |
||||
|
flex: 1; |
||||
|
margin:0px 10px; |
||||
|
} |
Loading…
Reference in new issue