|
@@ -1,150 +1,207 @@
|
|
|
<template>
|
|
|
<div class="message-body">
|
|
|
<div class="message">
|
|
|
- <div class="con borderIrr">
|
|
|
- <i class="bottoml"></i>
|
|
|
- <i class="bottomr"></i>
|
|
|
- <ul class="form">
|
|
|
- <li>
|
|
|
- <span>留言人:</span>
|
|
|
- <div class="name">
|
|
|
- <sradio @click.native="select = 'nickName'" :checked="select == 'nickName'" class="radio" :name="'使用昵称'"/>
|
|
|
- <sradio @click.native="select = 'realName'" :checked="select == 'realName'" class="radio" :name="'使用真实姓名'"/>
|
|
|
- </div>
|
|
|
- </li>
|
|
|
- <li>
|
|
|
- <span>留言内容:</span>
|
|
|
- <div class="input">
|
|
|
- <textarea placeholder="请留下你的留言" maxlength='250' v-model="msg" rows="4" cols="80">
|
|
|
- </textarea>
|
|
|
- <span>{{msg.length}}/250</span>
|
|
|
- <span class="loginwarn" v-if="!token" @click.stop="tologin"><img :src="require('@/assets/images/warn.png')" alt="">
|
|
|
- 请先登录后,再进行留言</span>
|
|
|
- </div>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
- <div>
|
|
|
- <div class="button primarybtn" @click="leaveMsg('','')">
|
|
|
- 提交
|
|
|
+ <div class="con borderIrr">
|
|
|
+ <i class="bottoml"></i>
|
|
|
+ <i class="bottomr"></i>
|
|
|
+ <ul class="form">
|
|
|
+ <li>
|
|
|
+ <span>留言人:</span>
|
|
|
+ <div class="name">
|
|
|
+ <sradio
|
|
|
+ @click.native="select = 'nickName'"
|
|
|
+ :checked="select == 'nickName'"
|
|
|
+ class="radio"
|
|
|
+ :name="'使用昵称'"
|
|
|
+ />
|
|
|
+ <sradio
|
|
|
+ @click.native="select = 'realName'"
|
|
|
+ :checked="select == 'realName'"
|
|
|
+ class="radio"
|
|
|
+ :name="'使用真实姓名'"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>留言内容:</span>
|
|
|
+ <div class="input">
|
|
|
+ <textarea
|
|
|
+ :placeholder="mesTrue?'请输入您的留言,您的留言将直接显示':'请输入您的留言'"
|
|
|
+ maxlength="250"
|
|
|
+ v-model="msg"
|
|
|
+ rows="4"
|
|
|
+ cols="80"
|
|
|
+ >
|
|
|
+ </textarea>
|
|
|
+ <span>{{ msg.length }}/250</span>
|
|
|
+ <span class="loginwarn" v-if="!token" @click.stop="tologin"
|
|
|
+ ><img :src="require('@/assets/images/warn.png')" alt="" />
|
|
|
+ 请先登录后,再进行留言</span
|
|
|
+ >
|
|
|
</div>
|
|
|
- <div class="button" @click="msg=''">重置</div>
|
|
|
- </div>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ <div>
|
|
|
+ <div class="button primarybtn" @click="leaveMsg('', '')">提交</div>
|
|
|
+ <div class="button" @click="msg = ''">重置</div>
|
|
|
</div>
|
|
|
- <div class="leaving">
|
|
|
- <div class="title primaryColor">
|
|
|
- <span>全部留言
|
|
|
- <i class="btmLine"></i>
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- <ul class="content">
|
|
|
- <li v-for="(item,i) in message" :key="i">
|
|
|
- <div class="info">
|
|
|
- <span class="primaryColor">{{(item.isRealName?item.realName:item.nickName)||'匿名用户'}}</span>
|
|
|
- <span>{{item.createTime}}</span>
|
|
|
+ </div>
|
|
|
+ <div class="leaving">
|
|
|
+ <div class="title primaryColor">
|
|
|
+ <span
|
|
|
+ >全部留言
|
|
|
+ <i class="btmLine"></i>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
+ <ul class="content">
|
|
|
+ <li v-for="(item, i) in message" :key="i">
|
|
|
+ <div class="info">
|
|
|
+ <span class="primaryColor">{{
|
|
|
+ (item.isRealName ? item.realName : item.nickName) || "匿名用户"
|
|
|
+ }}</span>
|
|
|
+ <span>{{ item.createTime }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="body">
|
|
|
+ <span>{{ item.content }}</span>
|
|
|
+ <div class="txtSameHover" @click="showComment(item, i)">
|
|
|
+ <img
|
|
|
+ class="xhidden"
|
|
|
+ :src="require(`@/assets/images/xinjiang/content.png`)"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ <img
|
|
|
+ class="xshow"
|
|
|
+ :src="
|
|
|
+ require(`@/assets/images/xinjiang/content_${theme}.png`)
|
|
|
+ "
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ <span>评论</span>
|
|
|
</div>
|
|
|
- <div class="body">
|
|
|
- <span>{{item.content}}</span>
|
|
|
- <div class="txtSameHover" @click="showComment(item,i)">
|
|
|
- <img class="xhidden" :src="require(`@/assets/images/xinjiang/content.png`)" alt="">
|
|
|
- <img class="xshow" :src="require(`@/assets/images/xinjiang/content_${theme}.png`)" alt="">
|
|
|
- <span>评论</span>
|
|
|
+ </div>
|
|
|
+ <ul class="response-text" v-if="item.children">
|
|
|
+ <li v-for="(sub, idx) in item.children" :key="idx">
|
|
|
+ <div>{{ sub.content }}</div>
|
|
|
+ <div>
|
|
|
+ 来自:{{
|
|
|
+ sub.isRealName ? sub.realName : sub.nickName
|
|
|
+ }}
|
|
|
+ 的评论 {{ sub.createTime }}
|
|
|
</div>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ <template v-if="item.showComment">
|
|
|
+ <div class="response input">
|
|
|
+ <textarea
|
|
|
+ v-model="item.comment"
|
|
|
+ rows="3"
|
|
|
+ maxlength="250"
|
|
|
+ cols="80"
|
|
|
+ placeholder="请写下您的评论"
|
|
|
+ ></textarea>
|
|
|
+ <span>{{ item.comment.length }}/250</span>
|
|
|
</div>
|
|
|
- <ul class="response-text" v-if="item.children">
|
|
|
- <li v-for="(sub,idx) in item.children" :key="idx">
|
|
|
- <div>{{sub.content}}</div>
|
|
|
- <div>来自:{{sub.isRealName?sub.realName:sub.nickName}} 的评论 {{sub.createTime}}</div>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
- <template v-if="item.showComment">
|
|
|
- <div class="response input" >
|
|
|
- <textarea v-model="item.comment" rows="3" maxlength='250' cols="80" placeholder="请写下您的评论"></textarea>
|
|
|
- <span>{{item.comment.length}}/250</span>
|
|
|
- </div>
|
|
|
- <div class="subbutton button primarybtn" @click="leaveMsg(item,i)">提交</div>
|
|
|
- </template>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
- </div>
|
|
|
- <div v-if="!loadAll" class="loadmore" @click="loadmore"><span class="borderThemeStyle primaryColor">加载更多</span></div>
|
|
|
+ <div
|
|
|
+ class="subbutton button primarybtn"
|
|
|
+ @click="leaveMsg(item, i)"
|
|
|
+ >
|
|
|
+ 提交
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ <div v-if="!loadAll" class="loadmore" @click="loadmore">
|
|
|
+ <span class="borderThemeStyle primaryColor">加载更多</span>
|
|
|
</div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getMsg,saveMsg } from "@/config/api";
|
|
|
+import { getMsg, saveMsg, webMesCheck } from "@/config/api";
|
|
|
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
- msg:'',
|
|
|
- message:[],
|
|
|
+ mesTrue:false,
|
|
|
+ msg: "",
|
|
|
+ message: [],
|
|
|
select: "nickName",
|
|
|
mtotal: 0,
|
|
|
mpageSize: 6,
|
|
|
mcurrentPage: 1,
|
|
|
- loadAll:false
|
|
|
+ loadAll: false,
|
|
|
};
|
|
|
},
|
|
|
- watch:{
|
|
|
- mpageSize(){
|
|
|
- this.getMessage()
|
|
|
- }
|
|
|
+ watch: {
|
|
|
+ mpageSize() {
|
|
|
+ this.getMessage();
|
|
|
+ },
|
|
|
},
|
|
|
- mounted(){
|
|
|
- this.getMessage()
|
|
|
+ async mounted() {
|
|
|
+ // 每次进页面判断有没有直接显示的权限
|
|
|
+ let res = await webMesCheck();
|
|
|
+ this.mesTrue=res.data
|
|
|
+
|
|
|
+ this.getMessage();
|
|
|
},
|
|
|
- methods:{
|
|
|
- tologin(){
|
|
|
- window.scrollTo(0,0)
|
|
|
- this.$bus.$emit('showLogin',true)
|
|
|
+ methods: {
|
|
|
+ tologin() {
|
|
|
+ window.scrollTo(0, 0);
|
|
|
+ this.$bus.$emit("showLogin", true);
|
|
|
},
|
|
|
- loadmore(){
|
|
|
- this.mpageSize += this.mpageSize
|
|
|
+ loadmore() {
|
|
|
+ this.mpageSize += this.mpageSize;
|
|
|
},
|
|
|
- async leaveMsg(item='',i=''){
|
|
|
- let tmp = (item ? item.comment : this.msg).trim()
|
|
|
+ async leaveMsg(item = "", i = "") {
|
|
|
+ let tmp = (item ? item.comment : this.msg).trim();
|
|
|
if (!tmp) {
|
|
|
- return alert('留言不能为空')
|
|
|
+ return alert("留言不能为空");
|
|
|
}
|
|
|
- saveMsg('comment',{
|
|
|
- content: tmp,
|
|
|
- parentId: item.id||'',
|
|
|
- isRealName: Number(this.select == 'realName')
|
|
|
- },res=>{
|
|
|
- if (res.code==0) {
|
|
|
- this.msg = ''
|
|
|
- alert('留言成功')
|
|
|
- item && this.showComment(item,i)
|
|
|
- this.getMessage()
|
|
|
+ saveMsg(
|
|
|
+ "comment",
|
|
|
+ {
|
|
|
+ content: tmp,
|
|
|
+ parentId: item.id || "",
|
|
|
+ isRealName: Number(this.select == "realName"),
|
|
|
+ },
|
|
|
+ (res) => {
|
|
|
+ if (res.code == 0) {
|
|
|
+ this.msg = "";
|
|
|
+ alert("留言成功");
|
|
|
+ item && this.showComment(item, i);
|
|
|
+ this.getMessage();
|
|
|
+ }
|
|
|
}
|
|
|
- })
|
|
|
-
|
|
|
+ );
|
|
|
},
|
|
|
- showComment(item,i){
|
|
|
- item.showComment = !item.showComment
|
|
|
- item.comment = ''
|
|
|
- this.$set(this.message,i,item)
|
|
|
+ showComment(item, i) {
|
|
|
+ item.showComment = !item.showComment;
|
|
|
+ item.comment = "";
|
|
|
+ this.$set(this.message, i, item);
|
|
|
},
|
|
|
- async getMessage(){
|
|
|
- if (this.loadAll) return
|
|
|
- getMsg({
|
|
|
- pageNum: this.mcurrentPage,
|
|
|
- pageSize: this.mpageSize,
|
|
|
- },result=>{
|
|
|
- result.data.list.forEach(item=>{
|
|
|
- item.showComment = false
|
|
|
- item.comment = ''
|
|
|
- })
|
|
|
- if (result.data.list.length==this.message.length) {
|
|
|
- this.loadAll = true
|
|
|
+ async getMessage() {
|
|
|
+ if (this.loadAll) return;
|
|
|
+ getMsg(
|
|
|
+ {
|
|
|
+ pageNum: this.mcurrentPage,
|
|
|
+ pageSize: this.mpageSize,
|
|
|
+ },
|
|
|
+ (result) => {
|
|
|
+ result.data.list.forEach((item) => {
|
|
|
+ item.showComment = false;
|
|
|
+ item.comment = "";
|
|
|
+ });
|
|
|
+ if (result.data.list.length == this.message.length) {
|
|
|
+ this.loadAll = true;
|
|
|
+ }
|
|
|
+ this.message = result.data.list;
|
|
|
+ this.mtotal = result.data.total;
|
|
|
}
|
|
|
- this.message = result.data.list
|
|
|
- this.mtotal= result.data.total
|
|
|
- })
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
+ );
|
|
|
+ },
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
|
|
@@ -154,19 +211,19 @@ export default {
|
|
|
margin: 0 auto;
|
|
|
position: relative;
|
|
|
z-index: 99;
|
|
|
- .message{
|
|
|
- .con{
|
|
|
+ .message {
|
|
|
+ .con {
|
|
|
width: 100%;
|
|
|
padding: 30px 100px;
|
|
|
- .form{
|
|
|
+ .form {
|
|
|
text-align: left;
|
|
|
width: 100%;
|
|
|
- >li{
|
|
|
+ > li {
|
|
|
margin-bottom: 30px;
|
|
|
display: flex;
|
|
|
width: 100%;
|
|
|
align-items: flex-start;
|
|
|
- > span{
|
|
|
+ > span {
|
|
|
display: inline-block;
|
|
|
width: 100px;
|
|
|
flex-shrink: 0;
|
|
@@ -174,27 +231,27 @@ export default {
|
|
|
margin-right: 10px;
|
|
|
text-align: right;
|
|
|
}
|
|
|
- .name{
|
|
|
- .radio{
|
|
|
- &::before{
|
|
|
+ .name {
|
|
|
+ .radio {
|
|
|
+ &::before {
|
|
|
border: 1px solid #707070;
|
|
|
- content: '';
|
|
|
+ content: "";
|
|
|
}
|
|
|
margin-right: 50px;
|
|
|
}
|
|
|
}
|
|
|
- .input{
|
|
|
+ .input {
|
|
|
flex: auto;
|
|
|
width: 100%;
|
|
|
position: relative;
|
|
|
font-size: 0;
|
|
|
- >textarea{
|
|
|
+ > textarea {
|
|
|
width: 100%;
|
|
|
line-height: 2;
|
|
|
color: #2d2d2d;
|
|
|
font-size: 16px;
|
|
|
}
|
|
|
- >span{
|
|
|
+ > span {
|
|
|
display: inline-block;
|
|
|
color: rgba(153, 153, 153, 1);
|
|
|
position: absolute;
|
|
@@ -202,7 +259,7 @@ export default {
|
|
|
bottom: 5px;
|
|
|
right: 14px;
|
|
|
}
|
|
|
- .loginwarn{
|
|
|
+ .loginwarn {
|
|
|
left: 50%;
|
|
|
right: auto;
|
|
|
transform: translateX(-50%);
|
|
@@ -213,7 +270,7 @@ export default {
|
|
|
bottom: 10px;
|
|
|
padding: 4px;
|
|
|
border-radius: 2px;
|
|
|
- >img{
|
|
|
+ > img {
|
|
|
width: 20px;
|
|
|
margin-right: 4px;
|
|
|
}
|
|
@@ -221,18 +278,18 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- >div{
|
|
|
+ > div {
|
|
|
display: flex;
|
|
|
justify-content: center;
|
|
|
align-items: center;
|
|
|
-
|
|
|
- .button{
|
|
|
+
|
|
|
+ .button {
|
|
|
position: relative;
|
|
|
width: 150px;
|
|
|
- &:first-of-type{
|
|
|
+ &:first-of-type {
|
|
|
margin-right: 50px;
|
|
|
}
|
|
|
- >span{
|
|
|
+ > span {
|
|
|
position: absolute;
|
|
|
left: -220px;
|
|
|
top: 50%;
|
|
@@ -240,7 +297,7 @@ export default {
|
|
|
color: rgba(153, 153, 153, 1);
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
- >img{
|
|
|
+ > img {
|
|
|
width: 24px;
|
|
|
height: 24px;
|
|
|
margin-right: 8px;
|
|
@@ -249,53 +306,53 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .leaving{
|
|
|
+ .leaving {
|
|
|
margin-top: 40px;
|
|
|
- .title{
|
|
|
+ .title {
|
|
|
text-align: left;
|
|
|
font-size: 30px;
|
|
|
border-bottom: 1px solid rgba(153, 153, 153, 1);
|
|
|
padding-bottom: 10px;
|
|
|
position: relative;
|
|
|
margin-bottom: 20px;
|
|
|
- span{
|
|
|
+ span {
|
|
|
display: inline-block;
|
|
|
min-width: 118px;
|
|
|
font-size: 30px;
|
|
|
position: relative;
|
|
|
- .btmLine{
|
|
|
+ .btmLine {
|
|
|
bottom: -13px;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .content{
|
|
|
+ .content {
|
|
|
text-align: left;
|
|
|
- >li{
|
|
|
+ > li {
|
|
|
margin-bottom: 10px;
|
|
|
- .info{
|
|
|
- >span{
|
|
|
+ .info {
|
|
|
+ > span {
|
|
|
display: inline-block;
|
|
|
font-size: 20px;
|
|
|
margin-right: 10px;
|
|
|
- &:not(:first-of-type){
|
|
|
+ &:not(:first-of-type) {
|
|
|
color: rgba(153, 153, 153, 1);
|
|
|
font-size: 14px;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .body{
|
|
|
+ .body {
|
|
|
margin: 10px 0;
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
- >span{
|
|
|
+ > span {
|
|
|
width: 90%;
|
|
|
word-break: break-all;
|
|
|
display: inline-block;
|
|
|
color: rgba(112, 112, 112, 1);
|
|
|
}
|
|
|
- .txtSameHover{
|
|
|
+ .txtSameHover {
|
|
|
color: rgba(153, 153, 153, 1);
|
|
|
- img{
|
|
|
+ img {
|
|
|
margin-right: 10px;
|
|
|
width: 16px;
|
|
|
position: relative;
|
|
@@ -303,16 +360,16 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .response{
|
|
|
+ .response {
|
|
|
margin-top: 10px;
|
|
|
border: 1px rgba(153, 153, 153, 1) solid;
|
|
|
width: 100%;
|
|
|
position: relative;
|
|
|
font-size: 0;
|
|
|
- >textarea{
|
|
|
+ > textarea {
|
|
|
line-height: 2;
|
|
|
}
|
|
|
- >span{
|
|
|
+ > span {
|
|
|
display: inline-block;
|
|
|
color: #909399;
|
|
|
position: absolute;
|
|
@@ -321,14 +378,14 @@ export default {
|
|
|
right: 14px;
|
|
|
}
|
|
|
}
|
|
|
- .response-text{
|
|
|
+ .response-text {
|
|
|
border: 1px rgba(153, 153, 153, 1) solid;
|
|
|
- background-color: #F3F3F3;
|
|
|
+ background-color: #f3f3f3;
|
|
|
padding: 10px 13px;
|
|
|
color: rgba(153, 153, 153, 1);
|
|
|
- >li{
|
|
|
- >div{
|
|
|
- &:last-of-type{
|
|
|
+ > li {
|
|
|
+ > div {
|
|
|
+ &:last-of-type {
|
|
|
font-size: 14px;
|
|
|
text-align: right;
|
|
|
margin-top: 20px;
|
|
@@ -336,7 +393,7 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .subbutton{
|
|
|
+ .subbutton {
|
|
|
display: inline-block;
|
|
|
text-align: center;
|
|
|
margin-top: 20px;
|
|
@@ -344,9 +401,9 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .loadmore{
|
|
|
+ .loadmore {
|
|
|
margin-top: 40px;
|
|
|
- .borderThemeStyle{
|
|
|
+ .borderThemeStyle {
|
|
|
display: inline-block;
|
|
|
padding: 10px 50px;
|
|
|
}
|