|
@@ -1,144 +1,202 @@
|
|
|
<template>
|
|
|
<div class="message-body">
|
|
|
<div class="message">
|
|
|
- <div class="con">
|
|
|
- <ul class="form">
|
|
|
- <li>
|
|
|
- <span>留言人:</span>
|
|
|
- <div class="name">
|
|
|
- <sradio @click.native="select = 'nickName'" :checked="select == 'nickName'" class="radio lightradio" :name="'使用昵称'"/>
|
|
|
- <sradio @click.native="select = 'realName'" :checked="select == 'realName'" class="radio lightradio" :name="'使用真实姓名'"/>
|
|
|
- </div>
|
|
|
- </li>
|
|
|
- <li>
|
|
|
- <span>留言内容:</span>
|
|
|
- <div class="input">
|
|
|
- <textarea :placeholder="token?'请输入您的留言,您的留言将直接显示':'请输入您的留言'" maxlength='250' v-model="msg" rows="3" 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 dati_btn" @click="leaveMsg('','')">
|
|
|
- <span class="active">提交</span>
|
|
|
- </div>
|
|
|
-
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
+ <div class="con">
|
|
|
+ <ul class="form">
|
|
|
+ <li>
|
|
|
+ <span>留言人:</span>
|
|
|
+ <div class="name">
|
|
|
+ <sradio
|
|
|
+ @click.native="select = 'nickName'"
|
|
|
+ :checked="select == 'nickName'"
|
|
|
+ class="radio lightradio"
|
|
|
+ :name="'使用昵称'"
|
|
|
+ />
|
|
|
+ <sradio
|
|
|
+ @click.native="select = 'realName'"
|
|
|
+ :checked="select == 'realName'"
|
|
|
+ class="radio lightradio"
|
|
|
+ :name="'使用真实姓名'"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ <li>
|
|
|
+ <span>留言内容:</span>
|
|
|
+ <div class="input">
|
|
|
+ <textarea
|
|
|
+ :placeholder="
|
|
|
+ mseIsShow
|
|
|
+ ? '请输入您的留言,您的留言将直接显示'
|
|
|
+ : '请输入您的留言'
|
|
|
+ "
|
|
|
+ maxlength="250"
|
|
|
+ v-model="msg"
|
|
|
+ rows="3"
|
|
|
+ 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 dati_btn" @click="leaveMsg('', '')">
|
|
|
+ <span class="active">提交</span>
|
|
|
+ </div>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
+ </div>
|
|
|
+ <div class="leaving">
|
|
|
+ <div class="title">
|
|
|
+ <span
|
|
|
+ >全部留言
|
|
|
+ <i class="lightbtmLine"></i>
|
|
|
+ </span>
|
|
|
</div>
|
|
|
- <div class="leaving">
|
|
|
- <div class="title">
|
|
|
- <span>全部留言
|
|
|
- <i class="lightbtmLine"></i>
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- <ul class="content">
|
|
|
- <li v-for="(item,i) in message" :key="i">
|
|
|
- <div class="info">
|
|
|
- <span class="primaryTxt">{{(item.isRealName?item.realName:item.nickName)||'匿名用户'}}</span>
|
|
|
- <span>{{item.createTime}}</span>
|
|
|
+ <ul class="content">
|
|
|
+ <li v-for="(item, i) in message" :key="i">
|
|
|
+ <div class="info">
|
|
|
+ <span class="primaryTxt">{{
|
|
|
+ (item.isRealName ? item.realName : item.nickName) || "匿名用户"
|
|
|
+ }}</span>
|
|
|
+ <span>{{ item.createTime }}</span>
|
|
|
+ </div>
|
|
|
+ <div class="body">
|
|
|
+ <span>{{ item.content }}</span>
|
|
|
+ <div class="txtSameHovers" @click="showComment(item, i)">
|
|
|
+ <img
|
|
|
+ :src="require(`@/assets/images/btnlist/item_comment.png`)"
|
|
|
+ alt=""
|
|
|
+ />
|
|
|
+ <span>评论</span>
|
|
|
</div>
|
|
|
- <div class="body">
|
|
|
- <span>{{item.content}}</span>
|
|
|
- <div class="txtSameHovers" @click="showComment(item,i)">
|
|
|
- <img :src="require(`@/assets/images/btnlist/item_comment.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 lightborderThemeStyle" @click="leaveMsg(item,i)">提交</div>
|
|
|
- </template>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
- </div>
|
|
|
- <div v-if="!loadAll" class="loadmore" @click="loadmore"><span class="lightborderThemeStyle">加载更多</span></div>
|
|
|
+ <div
|
|
|
+ class="subbutton button primarybtn mySubbutton"
|
|
|
+ @click="leaveMsg(item, i)"
|
|
|
+ >
|
|
|
+ 提交
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </li>
|
|
|
+ </ul>
|
|
|
</div>
|
|
|
+ <div v-if="!loadAll" class="loadmore" @click="loadmore">
|
|
|
+ <span class="lightborderThemeStyle">加载更多</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:[],
|
|
|
+ msg: "",
|
|
|
+ message: [],
|
|
|
select: "nickName",
|
|
|
mtotal: 0,
|
|
|
mpageSize: 6,
|
|
|
mcurrentPage: 1,
|
|
|
- loadAll:false
|
|
|
+ loadAll: false,
|
|
|
+ // 是否有留言权限
|
|
|
+ mseIsShow: false,
|
|
|
};
|
|
|
},
|
|
|
- watch:{
|
|
|
- mpageSize(){
|
|
|
- this.getMessage()
|
|
|
- }
|
|
|
+ watch: {
|
|
|
+ mpageSize() {
|
|
|
+ this.getMessage();
|
|
|
+ },
|
|
|
},
|
|
|
- async mounted(){
|
|
|
- this.getMessage()
|
|
|
+ async mounted() {
|
|
|
+ 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
|
|
|
- })
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
+ );
|
|
|
+ },
|
|
|
+ },
|
|
|
+ async created() {
|
|
|
+ // 查看是否有留言权限
|
|
|
+ let res = await webMesCheck();
|
|
|
+ this.mseIsShow = res.data;
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
|
|
@@ -149,19 +207,19 @@ export default {
|
|
|
position: relative;
|
|
|
height: 80%;
|
|
|
z-index: 99;
|
|
|
- .message{
|
|
|
+ .message {
|
|
|
height: 100%;
|
|
|
- .con{
|
|
|
+ .con {
|
|
|
width: 100%;
|
|
|
- .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;
|
|
@@ -169,23 +227,23 @@ export default {
|
|
|
margin-right: 10px;
|
|
|
text-align: right;
|
|
|
}
|
|
|
- .name{
|
|
|
- .radio{
|
|
|
+ .name {
|
|
|
+ .radio {
|
|
|
margin-right: 50px;
|
|
|
}
|
|
|
}
|
|
|
- .input{
|
|
|
+ .input {
|
|
|
flex: auto;
|
|
|
width: 100%;
|
|
|
position: relative;
|
|
|
font-size: 0;
|
|
|
- >textarea{
|
|
|
+ > textarea {
|
|
|
width: 100%;
|
|
|
line-height: 2;
|
|
|
font-size: 16px;
|
|
|
color: #2d2d2d;
|
|
|
}
|
|
|
- >span{
|
|
|
+ > span {
|
|
|
display: inline-block;
|
|
|
color: rgba(153, 153, 153, 1);
|
|
|
position: absolute;
|
|
@@ -193,7 +251,7 @@ export default {
|
|
|
bottom: 5px;
|
|
|
right: 14px;
|
|
|
}
|
|
|
- .loginwarn{
|
|
|
+ .loginwarn {
|
|
|
left: 50%;
|
|
|
right: auto;
|
|
|
transform: translateX(-50%);
|
|
@@ -204,43 +262,43 @@ export default {
|
|
|
bottom: 10px;
|
|
|
padding: 4px;
|
|
|
border-radius: 2px;
|
|
|
- >img{
|
|
|
+ > img {
|
|
|
width: 20px;
|
|
|
margin-right: 4px;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .button{
|
|
|
+ .button {
|
|
|
flex-shrink: 0;
|
|
|
align-self: flex-end;
|
|
|
text-align: center;
|
|
|
border: none;
|
|
|
border-radius: 5px;
|
|
|
margin-left: 20px;
|
|
|
- >span{
|
|
|
+ > span {
|
|
|
width: 100%;
|
|
|
padding: 0;
|
|
|
border-radius: 5px;
|
|
|
margin-left: 0;
|
|
|
}
|
|
|
}
|
|
|
- &:last-of-type{
|
|
|
+ &:last-of-type {
|
|
|
margin-bottom: 10px;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- >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%;
|
|
@@ -248,7 +306,7 @@ export default {
|
|
|
color: rgba(153, 153, 153, 1);
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
- >img{
|
|
|
+ > img {
|
|
|
width: 24px;
|
|
|
height: 24px;
|
|
|
margin-right: 8px;
|
|
@@ -257,10 +315,10 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .leaving{
|
|
|
+ .leaving {
|
|
|
height: 40%;
|
|
|
|
|
|
- .title{
|
|
|
+ .title {
|
|
|
text-align: left;
|
|
|
font-size: 30px;
|
|
|
border-bottom: 1px solid #fff;
|
|
@@ -268,48 +326,48 @@ export default {
|
|
|
position: relative;
|
|
|
margin-bottom: 20px;
|
|
|
width: 98%;
|
|
|
- span{
|
|
|
+ span {
|
|
|
display: inline-block;
|
|
|
min-width: 118px;
|
|
|
font-size: 20px;
|
|
|
position: relative;
|
|
|
- >i{
|
|
|
+ > i {
|
|
|
bottom: -16px;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .content{
|
|
|
+ .content {
|
|
|
color: #fff;
|
|
|
text-align: left;
|
|
|
padding-right: 20px;
|
|
|
overflow-y: auto;
|
|
|
height: 80%;
|
|
|
- >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) {
|
|
|
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: #fff;
|
|
|
}
|
|
|
- .txtSameHovers{
|
|
|
+ .txtSameHovers {
|
|
|
color: #fff;
|
|
|
cursor: pointer;
|
|
|
- img{
|
|
|
+ img {
|
|
|
margin-right: 10px;
|
|
|
width: 16px;
|
|
|
position: relative;
|
|
@@ -317,17 +375,17 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .response{
|
|
|
+ .response {
|
|
|
margin-top: 10px;
|
|
|
border: 1px #fff solid;
|
|
|
width: 100%;
|
|
|
position: relative;
|
|
|
font-size: 0;
|
|
|
- >textarea{
|
|
|
+ > textarea {
|
|
|
line-height: 2;
|
|
|
color: #2d2d2d;
|
|
|
}
|
|
|
- >span{
|
|
|
+ > span {
|
|
|
display: inline-block;
|
|
|
color: #909399;
|
|
|
position: absolute;
|
|
@@ -336,14 +394,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;
|
|
@@ -351,7 +409,9 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .subbutton{
|
|
|
+ .subbutton {
|
|
|
+ font-size: 18px;
|
|
|
+ font-weight: bold;
|
|
|
display: inline-block;
|
|
|
text-align: center;
|
|
|
margin-top: 20px;
|
|
@@ -359,11 +419,11 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- .loadmore{
|
|
|
+ .loadmore {
|
|
|
margin-top: 70px;
|
|
|
- .lightborderThemeStyle{
|
|
|
- padding: 10px 30px;
|
|
|
- border-radius: 4px;
|
|
|
+ .lightborderThemeStyle {
|
|
|
+ padding: 10px 30px;
|
|
|
+ border-radius: 4px;
|
|
|
}
|
|
|
}
|
|
|
}
|