Merge remote-tracking branch 'origin/test'

This commit is contained in:
fan 2020-11-17 18:44:19 +08:00
commit 7962e74640
11 changed files with 311 additions and 30 deletions

View File

@ -16,3 +16,54 @@ export function answerPost(data) {
data: data
});
}
// 评论留言
export function commentLevelMessage(messageId, data) {
return request({
url: `/api/learn/${messageId}/comment`,
method: 'post',
data: data
});
}
// 评论 留言的评论
export function commentComents(messageId, commentId, data) {
return request({
url: `/api/learn/${messageId}/${commentId}/comment`,
method: 'post',
data: data
});
}
// 管理员删除留言
export function deleteMessageByAdmin(messageId) {
return request({
url: `/api/learn/${messageId}/deleteMessage/admin`,
method: 'delete'
});
}
// 用户自己删除留言
export function deleteMessageBySelf(messageId) {
return request({
url: `/api/learn/${messageId}/deleteMessage/user`,
method: 'delete'
});
}
// 查询留言的评论列表
export function queryMessageCommentList(messageId) {
return request({
url: `/api/learn/${messageId}/list`,
method: 'get'
});
}
// 删除评论回复管理员
export function deleteCommentByAdmin(commentId) {
return request({
url: `/api/learn/${commentId}/deleteComment/admin`,
method: 'delete'
});
}
// 删除评论回复用户
export function deleteCommentBySelf(commentId) {
return request({
url: `/api/learn/${commentId}/deleteComment/user`,
method: 'delete'
});
}

BIN
src/assets/delete.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
src/assets/like.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
src/assets/reply.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
src/assets/unlike.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -58,6 +58,7 @@ export default {
return this.$refs.editor.quill;
},
options() {
const that = this;
return this.unloadImg ? {
modules: {
ImageExtend: {
@ -67,7 +68,9 @@ export default {
action: `https://test.joylink.club/jlfile/api/upload/PICTURE?appId=00001&appSecret=joylink00001`,
response: (res) => {
return `https://test.joylink.club/oss/joylink${res.data}`;
}
},
error: () => { that.$message.error('图片上传失败,请检查网络状态'); },
sizeError: () => { that.$message.error('图片上传失败图片大小限制3MB'); } //
},
toolbar: {
container: [

View File

@ -31,13 +31,14 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe
const data = JSON.parse(Response.body);
if(data.type != "TrainRun_3D"){
console.log(data);
if(data.type == "TrainRun_3D"){
trafficTrain.runList = data.body;
// console.log(data);
}
if(data.type == "BeAbout2Arrive_3D"){
if(toptrain.nowcode == data.body.groupNumber){
console.log(data);
// console.log(data);
}
}
@ -68,8 +69,14 @@ export function TrainConnect(trafficTrain,deviceaction,toptrain,routegroup,passe
num:data.body[i].num,
doorCode:1,
open:0,
text:"",
};
trafficTrain.trainList.push(train);
if(data.body[i].num == "0"){
train.text = data.body[i].code+"(无人)";
}else{
train.text = data.body[i].code+"(现有乘客"+data.body[i].num+"人)";
}
trafficTrain.trainList[train.code] = train;
}
}

View File

@ -83,6 +83,7 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
this.humanInSpeed = 0;
this.humanOutSpeed = 0;
this.runList = [];
//定义相机
camerass = new THREE.PerspectiveCamera(70, dom.offsetWidth / dom.offsetHeight, 0.01, 1000);
camerass.position.set(0, 80, 40);
@ -293,6 +294,10 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
return scope.trainList;
}
this.getRunList = function(){
return scope.runList;
}
let nowLeaveDoor = null;
this.updatePasserMove = function(doorData){
nowLeaveDoor = doorData.doorCode;
@ -330,9 +335,9 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
passerTrain.toptrain.nowcode = newCode;
scope.nowTrainCode = newCode;
// console.log(scope.trainList);
for(let i=0;i<scope.trainList.length;i++){
if(scope.trainList[i].code == newCode){
let trainDataList = getnum(scope.trainList[i].num,6);
for(let k in scope.trainList){
if(scope.trainList[k].code == newCode){
let trainDataList = getnum(scope.trainList[k].num,6);
scope.nowTrunk.code = newCode;
scope.nowTrunk.numList = trainDataList;
@ -351,8 +356,8 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
passerTrain.toptrain.action.down[an].play();
}
if(scope.trainList[i].open != "0"){
if(scope.trainList[i].doorCode == "1"){
if(scope.trainList[k].open != "0"){
if(scope.trainList[k].doorCode == "1"){
for(let an=passerTrain.toptrain.action.top.length-1;an>=0;an--){
passerTrain.toptrain.action.top[an].reset();
passerTrain.toptrain.action.top[an].time = passerTrain.toptrain.action.top[an]._clip.duration;
@ -370,7 +375,8 @@ export function Jl3dTrafficTrain(dom,skinCode,routegroup,viewMap) {
}
updateTrainNum(trainDataList);
i = scope.trainList.length;
break;
// i = scope.trainList.length;
}
}

View File

@ -1,8 +1,8 @@
export function getBaseUrl() {
let BASE_API;
if (process.env.NODE_ENV === 'development') {
BASE_API = 'https://joylink.club/jlcloud';
// BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'https://joylink.club/jlcloud';
BASE_API = 'https://test.joylink.club/jlcloud';
// BASE_API = 'http://192.168.8.107:9000'; // 袁琪
// BASE_API = 'http://192.168.8.129:9000'; // 旭强
// BASE_API = 'http://192.168.8.119:9000'; // 张赛

View File

@ -7,7 +7,7 @@
<el-option
v-for="item in trainlist"
:key="item.code"
:label="item.code"
:label="item.text"
:value="item.code"
/>
@ -24,7 +24,8 @@
<el-row class="tac">
<el-col :span="12">
<el-menu
default-active="2"
default-active="0"
:default-openeds="openeds"
class="el-menu-vertical-demo datatab"
@ -116,6 +117,7 @@ export default {
isActive:0,
localStatic:JL3D_LOCAL_STATIC,
openeds:['2','3','4','5','6','7'],
trunkAssetList:[
'/trafficplan/trunkhead.png',
'/trafficplan/trunkbody.png',
@ -154,13 +156,13 @@ export default {
if (this.loadingProjectList.includes(this.$route.query.project)) {
this.$store.dispatch('app/transitionAnimations');
}
document.querySelector("link[rel*='icon']").href = loginInfo[this.$route.query.project].linkIcon || ProjectIcon[this.$route.query.project];
// document.querySelector("link[rel*='icon']").href = loginInfo[this.$route.query.project].linkIcon || ProjectIcon[this.$route.query.project];
},
mounted() {
this.init();
this.takelist = this.getnum(this.allPassers,6);
console.log(this.takelist);
// console.log(this.takelist);
if (this.$route.query.type == 'CCTV') {
this.isCctv = false;
}
@ -177,7 +179,7 @@ export default {
this.jl3d = new Jl3dTrafficTrain(dom, this.$route.query.mapid, this.$route.query.group, 'normal');
},
assetSelect(index){
console.log(index);
// console.log(index);
this.isActive=index;
this.jl3d.switchcamera(index+'');
},
@ -197,10 +199,22 @@ export default {
// this.jl3d.updateNowTrainCode(codeData);
// },
updateTrainList(){
this.trainlist = this.jl3d.getTrainList();
this.trainlist = [];
let newTrainList = this.jl3d.getTrainList();
let newRunList = this.jl3d.getRunList();
for(let i=0;i<newRunList.length;i++){
this.trainlist.push(newTrainList[newRunList[i].code]);
}
// console.log(this.trainlist);
// if(){
//
// }
// // console.log(this.trainlist);
},
updateTrainCode(selVal) {
// console.log(selVal);
// this.jl3d.changeTrain(selVal);
this.isActive=0;
this.jl3d.updateNowTrainCode(selVal);

View File

@ -4,24 +4,65 @@
title="留言板"
:visible.sync="dialogVisible"
fullscreen
:show-close="false"
center
:before-close="handleClose"
>
<el-card class="box-card" style="width: 80%;margin-left: 10%;padding: 20px;margin-bottom: 20px;background-color: rgba(255,255,255,0)">
<div v-if="postCommentList.length">
<template v-for="(item,i) in postCommentList">
<div :key="i" style="border: 1px solid #C0C0C0;border-radius: 5px;margin-bottom: 20px;box-shadow: 2px 2px 3px #808080;padding: 10px;background-color: #fff">
<div :key="i" style="border: 1px solid #C0C0C0;border-radius: 5px;margin-bottom: 20px;box-shadow: 2px 2px 3px #808080;padding: 10px 20px;background-color: #fff">
<div style="margin-bottom: 10px;display: flex;align-items: center;">
<img :src="avatarUrl(item)" class="head_portrait">
<div style="display: inline-block;margin-right: 20px;margin-left:10px;font-size: 18px;color: #000;">{{ item.creatorNickName }}</div>
<div style="display: inline-block;">{{ item.createTime }}</div>
</div>
<div style="margin-left: 60px;" v-html="$escapeHTML(`${item.content}`)" />
<div style="width: 100%;display:flex;align-items: center;justify-content: flex-end;">
<!--<img :src="lickIcon" style="width: 20px;height: auto;margin-right: 30px;">-->
<!--<img :src="unlikeIcon" style="width: 20px;height: auto;margin-right: 30px;">-->
<img :src="replyIcon" style="width: 16px;height: auto;margin-right: 30px;cursor: pointer;" @click="replyLeaveMessage(item.id, i)">
<img v-if="userId == item.creatorId || superAdmin" :src="deleteIcon" style="width: 16px;height: auto;cursor:pointer;" @click="deleteMessage(item.id)">
</div>
<div v-if="item.comments && item.comments.total > 0" style="background: #F5F5F5;margin-top: 10px; width: calc(100% - 120px);margin-left: 60px; border-radius: 5px;padding: 1px 10px 10px;">
<div v-if="moreMessageId == item.id">
<template v-for="(elem,j) in allCommentList">
<div :key="j" style="font-size: 14px;margin-top: 10px;">
<span style="margin-right: 5px;">{{ computedCommentName(elem) }}</span>
<span style="margin-right: 15px;">{{ elem.content }}</span>
<span style="margin-right: 10px;">{{ elem.commentTime }}</span>
<span style="color:#409EFF;cursor: pointer;margin-right: 10px;" @click="replyLeaveMessage(item.id, i,elem.id, elem.userNickname)">回复</span>
<span v-if="userId == elem.userId || superAdmin" style="color:#409EFF;cursor: pointer;" type="text" @click="deleteComment(item.id, i, elem.id)">删除</span>
</div>
</template>
</div>
<div v-else>
<template v-for="(elem,j) in item.comments.list">
<div :key="j" style="font-size: 14px;margin-top: 18px;">
<span style="margin-right: 5px;">{{ computedCommentName(elem) }}</span>
<span style="margin-right: 15px;">{{ elem.content }}</span>
<span style="margin-right: 10px;">{{ elem.commentTime }}</span>
<span style="color:#409EFF;cursor: pointer;margin-right: 10px;" @click="replyLeaveMessage(item.id, i,elem.id, elem.userNickname)">回复</span>
<span v-if="userId == elem.userId || superAdmin" style="color:#409EFF;cursor: pointer;" type="text" @click="deleteComment(item.id, i, elem.id)">删除</span>
</div>
</template>
</div>
<div v-if="item.comments.total > 10 && moreMessageId != item.id" style="margin-top: 10px;">
<span class="view_more" @click="viewMoreComment(item)">{{ `${item.comments.total}条回复,点击查看更多>>` }}</span>
</div>
</div>
<div v-if="replyMessageId == item.id" style="width: 80%;margin-left: 10%;text-align: center;">
<el-input :id="'answerInput' + item.id" v-model="commentContent" type="textarea" placeholder="请输入内容" maxlength="300" style="margin-top: 10px;" :autosize="{ minRows: 2, maxRows: 4}" show-word-limit @input="changeCommentContent" />
<div style="margin-top: 10px;">
<el-button type="danger" size="small" @click="commentMessage">回复</el-button>
<el-button size="small" @click="cancelComment">取消</el-button>
</div>
</div>
</div>
</template>
</div>
<div v-else style="text-align: center;width: 100%;height: 50px;line-height: 50px;font-size: 18px;color: #ccc;">
<span>暂无评论</span>
<span>暂无留言</span>
</div>
<div style="width: 100%;text-align: center;">
<el-pagination
@ -33,21 +74,27 @@
/>
</div>
</el-card>
<quill-editor ref="quillEditor" v-model="content" style="width: 80%;margin-left: 10%;" placeholder="请输入内容" :margin-bottom="20" :unload-img="true" :noHandleP="true" />
<quill-editor ref="quillEditor" v-model="content" style="width: 80%;margin-left: 10%;" placeholder="请输入内容" :margin-bottom="20" :unload-img="true" :no-handle-p="true" />
<span id="boardBottom" class="dialog-footer">
<el-button @click="handleClear">清空</el-button>
<el-button type="primary" @click="commitComment">留言</el-button>
<el-button type="danger" @click="dialogVisible = false">返回</el-button>
<el-button type="danger" @click="commitComment">留言</el-button>
<!--<el-button type="danger" @click="dialogVisible = false">返回</el-button>-->
</span>
<el-button size="mini" type="danger" style="position: fixed; right: 100px;top: 80px;" @click="goSlide">我要留言</el-button>
<div v-show="imgShow" style="position: fixed;width: 100%;height: 100%;left: 0;top: 0;background: rgba(0,0,0,0.5);" @click="handelCloseImg">
<el-button size="mini" type="danger" style="position: fixed; right: 100px;top: 80px;width: 90px;" @click="goSlide">我要留言</el-button>
<el-button size="mini" style="position: fixed; right: 100px;top: 120px;width: 90px;" @click="dialogVisible = false">退出留言板</el-button>
<div v-show="imgShow" style="position: fixed;width: 100%;height: 100%;left: 0;top: 0;background: rgba(0,0,0,0.5);cursor: zoom-out;" @click="handelCloseImg">
<img id="targetImg" src="" style="position: fixed;top: 50%;left: 50%;transform: translate(-50%,-50%);min-width: 500px;max-height: 80%;height: auto;">
</div>
</el-dialog>
</template>
<script>
import { answerPost, queryPostPaging } from '@/api/learn';
import { answerPost, queryPostPaging, deleteMessageByAdmin, deleteMessageBySelf, commentLevelMessage, commentComents, queryMessageCommentList, deleteCommentByAdmin, deleteCommentBySelf } from '@/api/learn';
import lick_icon from '@/assets/like.png';
import unlike_icon from '@/assets/unlike.png';
import reply_icon from '@/assets/reply.png';
import delete_icon from '@/assets/delete.png';
import { superAdmin } from '@/router/index_APP_TARGET';
export default {
name: 'MessageBoard',
data() {
@ -58,9 +105,29 @@ export default {
pageSize: 10,
pageNum: 0,
total: 0,
imgShow: false
imgShow: false,
lickIcon: lick_icon,
unlikeIcon: unlike_icon,
replyIcon: reply_icon,
deleteIcon: delete_icon,
replyMessageId: '',
commentContent: '',
replyCommentId: '',
replyMessageIndex: '',
allCommentList: [],
moreMessageId: '',
replyUserName: '',
commentContentNoName: ''
};
},
computed: {
userId() {
return this.$store.state.user.id;
},
superAdmin() {
return this.$store.state.user.roles.includes(superAdmin);
}
},
created() {
const that = this;
window.handleZoomImg = function () {
@ -82,12 +149,17 @@ export default {
this.$message.error('留言内容使用图片应小于三张!');
return;
}
if (this.content.length > 1000) {
this.$message.error('留言内容超出最大长度!');
return;
}
answerPost({postId: 1, content: this.content}).then(resp => {
this.pageNum = Math.ceil(resp.data / this.pageSize);
this.handleCurrentChange();
this.$message.success('留言成功 ');
this.content = '';
}).catch(error => {
this.$message.error('留言失败 ');
console.log(error);
});
},
handleCurrentChange() {
@ -121,6 +193,121 @@ export default {
handelCloseImg() {
this.imgShow = false;
document.getElementById('targetImg').src = '';
},
replyLeaveMessage(messageId, messageIndex, commentId, userNickname) {
this.cancelComment();
this.replyMessageId = messageId;
this.replyCommentId = commentId;
this.replyMessageIndex = messageIndex;
if (commentId) {
this.replyUserName = '@' + userNickname + ' ';
this.commentContent = this.replyUserName + this.commentContentNoName;
}
this.$nextTick(()=>{
document.getElementById('answerInput' + messageId).focus();
});
},
cancelComment() {
this.replyMessageId = '';
this.commentContent = '';
this.replyCommentId = '';
this.replyMessageIndex = '';
this.replyUserName = '';
this.commentContentNoName = '';
},
commentMessage() {
if (this.replyCommentId) {
commentComents(this.replyMessageId, this.replyCommentId, {content:this.commentContentNoName}).then(resp => {
this.getCommentList(this.replyMessageId, this.replyMessageIndex);
this.cancelComment();
}).catch(error => {
this.$message.error('评论留言失败!');
console.error(error);
});
} else {
commentLevelMessage(this.replyMessageId, {content:this.commentContentNoName}).then(resp => {
this.getCommentList(this.replyMessageId, this.replyMessageIndex);
this.cancelComment();
}).catch(error => {
this.$message.error('评论留言失败!');
console.error(error);
});
}
},
getCommentList(messageId, messageIndex) {
queryMessageCommentList(messageId).then(resp => {
if (this.moreMessageId == messageId) {
this.allCommentList = resp.data;
}
if (resp.data.length > 10) {
this.postCommentList[messageIndex].comments.list = resp.data.slice(0, 10);
this.postCommentList[messageIndex].comments.total = resp.data.length;
} else {
this.postCommentList[messageIndex].comments.list = resp.data;
this.postCommentList[messageIndex].comments.total = resp.data.length;
}
}).catch(error => {
this.$message.error('更新回复失败!');
console.error(error);
});
},
computedCommentName(elem) {
if (elem.replyUserNickName) {
return `${elem.userNickname} 回复@ ${elem.replyUserNickName}`;
} else {
return elem.userNickname + '';
}
},
deleteMessage(messageId) {
if (this.superAdmin) {
deleteMessageByAdmin(messageId).then(resp => {
// this.$message.success('');
this.handleCurrentChange();
}).catch(error => {
this.$message.error('删除留言失败!');
console.error(error);
});
} else {
deleteMessageBySelf(messageId).then(resp => {
// this.$message.success('');
this.handleCurrentChange();
}).catch(error => {
this.$message.error('删除留言失败!');
console.error(error);
});
}
},
deleteComment(messageId, messageIndex, commentId) {
if (this.superAdmin) {
deleteCommentByAdmin(commentId).then(resp => {
this.getCommentList(messageId, messageIndex);
}).catch(error => {
this.$message.error('删除回复失败!');
console.error(error);
});
} else {
deleteCommentBySelf(commentId).then(resp => {
this.getCommentList(messageId, messageIndex);
}).catch(error => {
this.$message.error('删除回复失败!');
console.error(error);
});
}
},
viewMoreComment(data) {
queryMessageCommentList(data.id).then(resp => {
this.allCommentList = resp.data;
this.moreMessageId = data.id;
}).catch(error => {
console.error(error);
});
},
changeCommentContent(val) {
if (this.replyUserName && val.startsWith(this.replyUserName)) {
this.commentContentNoName = val.slice(this.replyUserName.length);
} else {
this.commentContent = this.replyUserName + this.commentContentNoName;
}
}
}
};
@ -137,14 +324,27 @@ export default {
height: 50px;
border-radius: 25px;
}
.view_more {
cursor: pointer;
}
.view_more:hover {
cursor: pointer;
color: #409EFF;
}
.img-box{
width: 100px;
height: auto;
}
/deep/.el-dialog.is-fullscreen{
/deep/ .el-dialog.is-fullscreen{
background-image:url('../../../../assets/bg_board.jpg');
}
/deep/.ql-container{
height: 80%;
}
/deep/.el-dialog__title{
font-size: 30px;
color: #F00;
font-family: 'fangsong';
font-weight: bolder;
}
</style>