Merge branch 'dev' into test

This commit is contained in:
zyy 2019-11-01 18:09:17 +08:00
commit 645326bf6a
27 changed files with 710 additions and 704 deletions

View File

@ -119,5 +119,6 @@ export default {
theBelongsProjectCannotBeEmpty: 'The belongs project cannot be empty', theBelongsProjectCannotBeEmpty: 'The belongs project cannot be empty',
pleaseSelectTheBelongsProject: 'Please select the belongs project', pleaseSelectTheBelongsProject: 'Please select the belongs project',
copyMapAs: 'Copy map as', copyMapAs: 'Copy map as',
whetherToCopyData: 'Whether to copy data' whetherToCopyData: 'Whether to copy data',
copy:'Copy'
}; };

View File

@ -123,5 +123,6 @@ export default {
theBelongsProjectCannotBeEmpty: '所属项目不能为空', theBelongsProjectCannotBeEmpty: '所属项目不能为空',
pleaseSelectTheBelongsProject: '请选择归属项目', pleaseSelectTheBelongsProject: '请选择归属项目',
copyMapAs: '复制地图为', copyMapAs: '复制地图为',
whetherToCopyData: '是否复制数据' whetherToCopyData: '是否复制数据',
copy:'复制'
}; };

View File

@ -49,10 +49,10 @@ import TeachDetail from '@/views/teach/detail/index';
import TeachHome from '@/views/teach/index'; import TeachHome from '@/views/teach/index';
import Pay from '@/views/components/pay/index'; import Pay from '@/views/components/pay/index';
import ExamDetail from '@/views/exam/detail/examDetail';
import ExamHome from '@/views/exam/index'; import ExamHome from '@/views/exam/index';
import ExamCourseDetail from '@/views/exam/detail/courseDetail';
import ExamResult from '@/views/exam/result'; import ExamResult from '@/views/exam/result';
import ExamDetail from '@/views/exam/detail/examDetail';
import ExamCourseDetail from '@/views/exam/detail/courseDetail';
import DemonstrationDetail from '@/views/demonstration/detail/index'; import DemonstrationDetail from '@/views/demonstration/detail/index';
@ -428,7 +428,7 @@ export const asyncRouter = [
}, },
hidden: true hidden: true
}, },
{ { // 剧本编辑 战场图
path: '/scriptDisplay/:mode', path: '/scriptDisplay/:mode',
component: ScriptDisplay, component: ScriptDisplay,
meta: { meta: {
@ -758,6 +758,7 @@ export const asyncRouter = [
} }
}, },
{ {
// 用户管理
path: 'userManage', path: 'userManage',
component: UserControl, component: UserControl,
meta: { meta: {
@ -765,6 +766,7 @@ export const asyncRouter = [
} }
}, },
{ {
// 缓存管理
path: 'cache', path: 'cache',
component: CacheControl, component: CacheControl,
meta: { meta: {
@ -800,6 +802,7 @@ export const asyncRouter = [
} }
}, },
{ {
// 子系统生成
path: 'systemGenerate', path: 'systemGenerate',
component: SystemGenerate, component: SystemGenerate,
meta: { meta: {
@ -807,6 +810,7 @@ export const asyncRouter = [
} }
}, },
{ {
// 产品编辑
path: 'product', path: 'product',
component: MapProduct, component: MapProduct,
meta: { meta: {
@ -814,6 +818,7 @@ export const asyncRouter = [
} }
}, },
{ {
// 实训录制
path: 'record', path: 'record',
redirect: 'record/training/0/null', redirect: 'record/training/0/null',
component: Trainingrecord, component: Trainingrecord,

View File

@ -49,53 +49,53 @@
import {reviewLessonDetail} from '@/api/designPlatform'; import {reviewLessonDetail} from '@/api/designPlatform';
export default { export default {
name: 'LessonApprovalDetail', name: 'LessonApprovalDetail',
components: { components: {
}, },
data() { data() {
return { return {
loading: false, loading: false,
tableData: [], tableData: [],
lessonName: '', lessonName: '',
lessonRemark: '', lessonRemark: '',
showDetail: false showDetail: false
}; };
}, },
computed: { computed: {
height() { height() {
return this.$store.state.app.height - 260; return this.$store.state.app.height - 260;
} }
}, },
watch: { watch: {
}, },
created() { created() {
}, },
mounted() { mounted() {
// this.loadInitData(); // this.loadInitData();
}, },
beforeDestroy() { beforeDestroy() {
}, },
methods: { methods: {
show(lessonId) { show(lessonId) {
this.showDetail = true; this.showDetail = true;
this.loadInitData(lessonId); this.loadInitData(lessonId);
}, },
loadInitData(lessonId) { loadInitData(lessonId) {
this.loading =true; this.loading = true;
reviewLessonDetail(lessonId).then(response =>{ reviewLessonDetail(lessonId).then(response =>{
this.tableData = response.data[0].children; this.tableData = response.data[0].children;
this.lessonName = response.data[0].name; this.lessonName = response.data[0].name;
this.lessonRemark = response.data[0].remarks; this.lessonRemark = response.data[0].remarks;
this.loading = false; this.loading = false;
}).catch(()=>{ }).catch(()=>{
this.$messageBox(this.$t('approval.failedToGetCourseData')); this.$messageBox(this.$t('approval.failedToGetCourseData'));
}); });
}, },
doClose() { doClose() {
} }
} }
}; };
</script> </script>

View File

@ -58,6 +58,7 @@ import { getDetailList } from '@/api/management/dictionary';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { launchFullscreen } from '@/utils/screen'; import { launchFullscreen } from '@/utils/screen';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
import LangStorage from '@/utils/lang';
export default { export default {
name: 'ExamDetailView', name: 'ExamDetailView',
@ -84,10 +85,7 @@ export default {
computed: { computed: {
...mapGetters('trainingList', [ ...mapGetters('trainingList', [
'trainingList' 'trainingList'
]), ])
height() {
return this.$store.state.app.height - 50;
}
}, },
watch: { watch: {
'$route.params.examId': function (val) { '$route.params.examId': function (val) {
@ -125,6 +123,36 @@ export default {
this.typeList = []; this.typeList = [];
await getDetailList('training_type').then(res => { await getDetailList('training_type').then(res => {
this.typeList = res.data; this.typeList = res.data;
if (LangStorage.getLang() == 'en') {
this.typeList.forEach(item => {
switch (item.code) {
case '01':
item.name = 'Control permission operation';
break;
case '02':
item.name = 'Signalling machine operation';
break;
case '03':
item.name = 'Turnout operation';
break;
case '04':
item.name = 'Section operation';
break;
case '05':
item.name = 'Platform operation';
break;
case '06':
item.name = 'Train scheduling operation';
break;
case '07':
item.name = 'Train operation';
break;
case '08':
item.name = 'Temporary speed limit operation of the whole line';
break;
}
});
}
}); });
}, },
async loadInitPage(examId) { async loadInitPage(examId) {

View File

@ -6,23 +6,10 @@
</div> </div>
</el-card> </el-card>
<el-card v-loading="loading"> <el-card v-loading="loading">
<el-table <el-table :data="tableData" border style="width: 100%">
:data="tableData" <el-table-column prop="name" :label="this.$t('exam.courseName')" />
border <el-table-column prop="remarks" show-overflow-tooltip :label="this.$t('exam.courseDescription')" />
style="width: 100%" <el-table-column :label="this.$t('global.operate')">
>
<el-table-column
prop="name"
:label="this.$t('exam.courseName')"
/>
<el-table-column
prop="remarks"
show-overflow-tooltip
:label="this.$t('exam.courseDescription')"
/>
<el-table-column
:label="this.$t('global.operate')"
>
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="primary" @click="goLesson(scope.row)"> <el-button size="mini" type="primary" @click="goLesson(scope.row)">
{{ $t('exam.enterTheExam') }} {{ $t('exam.enterTheExam') }}

View File

@ -1,43 +1,33 @@
<template> <template>
<div v-loading="loading"> <div v-loading="loading" class="joylink-card paper">
<el-card class="paper" :style="{height: height - 10 + 'px'}"> <div class="card-title">
<div slot="header" style="text-align: center;"> <span style="font-weight:bold ">{{ $t('exam.examResultsDetails') }}</span>
<span style="font-weight:bold ">{{ $t('exam.examResultsDetails') }}</span> </div>
</div> <div class="context">
<el-scrollbar wrap-class="scrollbar-wrapper" :style="{height: height - 150 + 'px'}"> <el-form ref="form" :model="resultModel" size="mini">
<div class="context"> <el-form-item :label="this.$t('exam.testQuestionsName')+':'" prop="name">
<el-form ref="form" :model="resultModel" size="mini"> <span>{{ resultModel.examName }}</span>
<el-form-item :label="this.$t('exam.testQuestionsName')+':'" prop="name"> </el-form-item>
<span>{{ resultModel.examName }}</span> <el-form-item :label="this.$t('exam.testScores')+':'" prop="score">
</el-form-item> <span>{{ resultModel.score + ' '+ $t('exam.points') }}</span>
<el-form-item :label="this.$t('exam.testScores')+':'" prop="score"> </el-form-item>
<span>{{ resultModel.score + ' '+ $t('exam.points') }}</span> <el-form-item :label="this.$t('exam.whetherThrough')+':'" prop="detail">
</el-form-item> <span v-if="resultModel.result === '01'" style="color:darkgray">{{ $t('exam.didNotCalculate') }}</span>
<el-form-item :label="this.$t('exam.whetherThrough')+':'" prop="detail"> <span v-else-if="resultModel.result === '02'" style="color:green">{{ $t('exam.pass') }}</span>
<span v-if="resultModel.result === '01'" style="color:darkgray">{{ $t('exam.didNotCalculate') }}</span> <span v-else-if="resultModel.result === '03'" style="color:red">{{ $t('exam.notPass') }}</span>
<span v-else-if="resultModel.result === '02'" style="color:green">{{ $t('exam.pass') }}</span> </el-form-item>
<span v-else-if="resultModel.result === '03'" style="color:red">{{ $t('exam.notPass') }}</span> <el-form-item :label="this.$t('exam.examTime')+':'" prop="detail">
</el-form-item> <span>{{ Math.ceil(resultModel.usedTime/60) + ' '+ $t('global.minutes') }}</span>
<el-form-item :label="this.$t('exam.examTime')+':'" prop="detail"> </el-form-item>
<span>{{ Math.ceil(resultModel.usedTime/60) + ' '+ $t('global.minutes') }}</span> </el-form>
</el-form-item> <el-table :data="resultModel.userExamQuestionsVOs" border style="width: 100%; min-height: 200px;" :summary-method="getSummaries" show-summary>
</el-form> <el-table-column prop="trainingName" :label="this.$t('exam.trainingName')" />
<el-table <el-table-column prop="score" :label="this.$t('exam.trainingScore')" />
:data="resultModel.userExamQuestionsVOs" </el-table>
border </div>
style="width: 100%" <div class="draf_box">
:summary-method="getSummaries" <el-button type="primary " @click="back">{{ $t('exam.returnToExamList') }}</el-button>
show-summary </div>
>
<el-table-column prop="trainingName" :label="this.$t('exam.trainingName')" />
<el-table-column prop="score" :label="this.$t('exam.trainingScore')" />
</el-table>
</div>
</el-scrollbar>
<div style="position: relative; float: right; right: 60px; bottom: -30px;">
<el-button type="primary " @click="back">{{ $t('exam.returnToExamList') }}</el-button>
</div>
</el-card>
</div> </div>
</template> </template>
<script> <script>
@ -124,19 +114,25 @@ export default {
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
/deep/ { .paper {
.scrollbar-wrapper { height: 100%;
margin-bottom: 0 !important; overflow: hidden;
.card-title{
height: 47px;
line-height: 47px;
border-bottom: 1px solid #e6e6e6;
text-align: center;
}
.context {
padding: 30px 60px;
height: calc(100% - 107px);
overflow: auto;
} }
} }
.paper { .draf_box{
width: 900px; padding: 10px 0;
margin: 0 auto; text-align: center;
border: 1px solid #F8F8F8;
}
.context {
margin: 30px 60px;
} }
</style> </style>

View File

@ -22,7 +22,6 @@
</template> </template>
<script> <script>
// import { getPublishMapListBySkinCode } from '@/api/jmap/map';
import { adminPublishLesson, releaseOrCancel } from '@/api/designPlatform'; import { adminPublishLesson, releaseOrCancel } from '@/api/designPlatform';
export default { export default {

View File

@ -6,28 +6,30 @@
<el-step title="" icon="el-icon-upload" /> <el-step title="" icon="el-icon-upload" />
</el-steps> </el-steps>
<el-card class="forms"> <el-card class="forms">
<el-tree <div style="height:100%;overflow-y:auto">
ref="lessonTree" <el-tree
:data="treeData" ref="lessonTree"
:props="defaultProps" :data="treeData"
draggable :props="defaultProps"
:allow-drop="allowDrop" draggable
default-expand-all :allow-drop="allowDrop"
:allow-drag="allowDrag" default-expand-all
expand-on-click-node :allow-drag="allowDrag"
highlight-current expand-on-click-node
style="margin:20px; min-height: 300px;" highlight-current
@node-drag-end="handleDragEnd" style="margin:20px; min-height:300px;"
> @node-drag-end="handleDragEnd"
<span slot-scope="{ node }"> >
<el-tooltip class="item" effect="dark" :content="node.label" placement="top" :open-delay="1000"> <span slot-scope="{ node }">
<span v-if="node.data.type === 'lesson'" class="el-icon-tickets">{{ node.label }}</span> <el-tooltip class="item" effect="dark" :content="node.label" placement="top" :open-delay="1000">
<span v-if="node.data.type === 'chapter'" class="el-icon-document">{{ node.label }} <span v-if="node.data.type === 'lesson'" class="el-icon-tickets">{{ node.label }}</span>
</span> <span v-if="node.data.type === 'chapter'" class="el-icon-document">{{ node.label }}
<span v-else> {{ node.label }}</span> </span>
</el-tooltip> <span v-else> {{ node.label }}</span>
</span> </el-tooltip>
</el-tree> </span>
</el-tree>
</div>
</el-card> </el-card>
<div class="draft"> <div class="draft">
<el-button type="primary" @click="goBack">{{ $t('global.back') }}</el-button> <el-button type="primary" @click="goBack">{{ $t('global.back') }}</el-button>
@ -50,11 +52,6 @@ export default {
} }
}; };
}, },
computed: {
height() {
return this.$store.state.app.height - 180;
}
},
methods: { methods: {
convertTreeData(list, data) { convertTreeData(list, data) {
let tree = []; let tree = [];
@ -143,6 +140,7 @@ export default {
.steps { .steps {
width: 980px; width: 980px;
margin: 0 auto; margin: 0 auto;
height: 100%;
/deep/ { /deep/ {
.el-step__icon.is-icon { .el-step__icon.is-icon {
@ -151,10 +149,15 @@ export default {
} }
} }
/deep/ .el-card__body{
height:100%;
}
.forms { .forms {
width: 800px; width: 800px;
margin: 0 auto; margin: 0 auto;
margin-top: 10px; margin-top: 10px;
height: calc(100% - 150px);
} }
.draft { .draft {
width: 300px; width: 300px;

View File

@ -68,23 +68,19 @@ export default {
// planId: '', // planId: '',
// planName: '', // planName: '',
type: 'add', type: 'add',
// defaultShowKeys: [],
runPlanList: [], runPlanList: [],
runPlanDict: {}, runPlanDict: {},
isCreate:false, isCreate:false,
PlanConvert: {} PlanConvert: {}
// defaultProps: {
// label: 'name'
// }
}; };
}, },
computed: { computed: {
height() { height() {
return this.$store.state.app.height - 60 - 30; return this.$store.state.app.height - 60 - 30;
}, },
skinCode() { // skinCode() {
return this.$route.query.skinCode || '02'; // return this.$route.query.skinCode || '02';
}, // },
hasRelease() { hasRelease() {
return this.$store.state.user.roles.includes('04') || return this.$store.state.user.roles.includes('04') ||
this.$store.state.user.roles.includes('05'); this.$store.state.user.roles.includes('05');
@ -96,6 +92,7 @@ export default {
} }
}, },
created() { created() {
debugger;
this.PlanConvert = this.$theme.loadPlanConvert(this.$route.query.skinCode); this.PlanConvert = this.$theme.loadPlanConvert(this.$route.query.skinCode);
}, },
mounted() { mounted() {

View File

@ -6,14 +6,14 @@
<script> <script>
import { getProductList, putMapProductOnLine, putMapProductOffLine } from '@/api/management/mapprd'; import { getProductList, putMapProductOnLine, putMapProductOffLine } from '@/api/management/mapprd';
import { getSkinCodeList } from '@/api/management/mapskin'; import { listPublishMap } from '@/api/jmap/map';
export default { export default {
name: 'PublishExam', name: 'PublishExam',
data() { data() {
return { return {
prdTypeList: [], prdTypeList: [],
skinCodeList: [], mapIdList: [],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
@ -42,10 +42,10 @@ export default {
prop: 'name' prop: 'name'
}, },
{ {
title: this.$t('publish.skinType'), title: this.$t('publish.mapName'),
prop: 'skinCode', prop: 'mapId',
type: 'tag', type: 'tag',
columnValue: (row) => { return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']); }, columnValue: (row) => { return this.$convertField(row.mapId, this.mapIdList, ['id', 'name']); },
tagType: (row) => { return ''; } tagType: (row) => { return ''; }
}, },
{ {
@ -94,9 +94,9 @@ export default {
this.prdTypeList = list; this.prdTypeList = list;
}); });
this.skinCodeList = []; this.mapIdList = [];
getSkinCodeList().then(response => { listPublishMap().then(response => {
this.skinCodeList = response.data; this.mapIdList = response.data;
}); });
}, },
handlePutaway(index, row) { handlePutaway(index, row) {

View File

@ -7,7 +7,6 @@
<script> <script>
import { publishLessonList, delPublishLesson, putLessonOnLine, putLessonOffLine, updatePublishLesson } from '@/api/jmap/lesson'; import { publishLessonList, delPublishLesson, putLessonOnLine, putLessonOffLine, updatePublishLesson } from '@/api/jmap/lesson';
import { getSkinCodeList } from '@/api/management/mapskin';
import localStore from 'storejs'; import localStore from 'storejs';
import UpdateOperate from './draft.vue'; import UpdateOperate from './draft.vue';
@ -19,7 +18,6 @@ export default {
data() { data() {
return { return {
cityList: [], cityList: [],
skinCodeList: [],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'
@ -118,11 +116,6 @@ export default {
}).catch(() => { }).catch(() => {
this.$messageBox(this.$t('error.loadingCityListFailed')); this.$messageBox(this.$t('error.loadingCityListFailed'));
}); });
this.skinCodeList = [];
getSkinCodeList().then(response => {
this.skinCodeList = response.data;
});
}, },
// //
handleEdit(index, row) { handleEdit(index, row) {

View File

@ -122,7 +122,7 @@ export default {
handleClick: this.handleSetProject handleClick: this.handleSetProject
}, },
{ {
name: '复制', name: this.$t('publish.copy'),
handleClick: this.handleCopy handleClick: this.handleCopy
} }
] ]

View File

@ -17,7 +17,6 @@ export default {
data() { data() {
return { return {
cityList: [], cityList: [],
skinCodeList: [],
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
pageIndex: 'pageNum' pageIndex: 'pageNum'

View File

@ -10,7 +10,7 @@
<script> <script>
import { runPlanTemplateList } from '@/api/runplan'; import { runPlanTemplateList } from '@/api/runplan';
import { getSkinCodeList } from '@/api/management/mapskin'; import { listPublishMap } from '@/api/jmap/map';
export default { export default {
name: 'ChooseTemplatePlan', name: 'ChooseTemplatePlan',
@ -18,7 +18,7 @@ export default {
return { return {
dialogShow: false, dialogShow: false,
loading: false, loading: false,
skinCodeList: [], mapIdList: [],
model: {}, model: {},
pagerConfig: { pagerConfig: {
pageSize: 'pageSize', pageSize: 'pageSize',
@ -44,11 +44,11 @@ export default {
prop: 'name' prop: 'name'
}, },
{ {
title: this.$t('publish.skinType'), title: this.$t('publish.mapName'),
prop: 'skinCode', prop: 'mapId',
type: 'tag', type: 'tag',
columnValue: (row) => { columnValue: (row) => {
return this.$convertField(row.skinCode, this.skinCodeList, ['code', 'name']); return this.$convertField(row.mapId, this.mapIdList, ['id', 'name']);
}, },
tagType: (row) => { return 'success'; } tagType: (row) => { return 'success'; }
} }
@ -65,9 +65,10 @@ export default {
}, },
methods: { methods: {
loadInitData() { loadInitData() {
this.skinCodeList = []; this.mapIdList = [];
getSkinCodeList().then(response => {
this.skinCodeList = response.data; listPublishMap().then(response => {
this.mapIdList = response.data;
}); });
}, },
doShow(model) { doShow(model) {
@ -80,7 +81,7 @@ export default {
this.dialogShow = false; this.dialogShow = false;
}, },
queryFunction(params) { queryFunction(params) {
params['skinCode'] = this.model.skinCode || ''; params['mapId'] = this.model.mapId || '';
return runPlanTemplateList(params); return runPlanTemplateList(params);
}, },
handleConfirm() { handleConfirm() {

View File

@ -1,14 +1,12 @@
<template> <template>
<div class="app-wrapper"> <div class="app-wrapper">
<el-scrollbar wrap-class="scrollbar-wrapper"> <div v-show="listShow" class="examList" :style="{width: widthLeft+'px'}">
<div v-show="listShow" class="examList" :style="{width: widthLeft+'px'}"> <demon-list ref="demonList" :height="height" />
<demon-list ref="demonList" :height="height" /> </div>
</div> <drap-left :width-left="widthLeft" @drapWidth="drapWidth" />
<drap-left :width-left="widthLeft" @drapWidth="drapWidth" /> <transition>
<transition> <router-view />
<router-view /> </transition>
</transition>
</el-scrollbar>
</div> </div>
</template> </template>
@ -19,41 +17,41 @@ import drapLeft from '@/views/components/drapLeft/index';
import localStore from 'storejs'; import localStore from 'storejs';
export default { export default {
name: 'Exam', name: 'Exam',
components: { components: {
demonList, demonList,
drapLeft drapLeft
}, },
data() { data() {
return { return {
listShow: true, listShow: true,
widthLeft: 450 widthLeft: 450
}; };
}, },
computed: { computed: {
...mapGetters([ ...mapGetters([
'lessonbar' 'lessonbar'
]), ]),
height() { height() {
return this.$store.state.app.height; return this.$store.state.app.height;
} }
}, },
watch: { watch: {
'lessonbar.opened': function (val) { 'lessonbar.opened': function (val) {
this.listShow = val; this.listShow = val;
} }
}, },
mounted() { mounted() {
this.widthLeft = Number(localStore.get('LeftWidth')); this.widthLeft = Number(localStore.get('LeftWidth'));
}, },
methods: { methods: {
refresh() { refresh() {
this.$refs && this.$refs.demonList && this.$refs.demonList.refresh(); this.$refs && this.$refs.demonList && this.$refs.demonList.refresh();
}, },
drapWidth(width) { drapWidth(width) {
this.widthLeft = Number(width); this.widthLeft = Number(width);
} }
} }
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -36,104 +36,104 @@ import { UrlConfig } from '@/router/index';
import { getSessionStorage, setSessionStorage, removeSessionStorage } from '@/utils/auth'; import { getSessionStorage, setSessionStorage, removeSessionStorage } from '@/utils/auth';
export default { export default {
name: 'ExamDetailList', name: 'ExamDetailList',
components: { components: {
FilterCity FilterCity
}, },
props: { props: {
height: { height: {
type: Number, type: Number,
required: true required: true
} }
}, },
data() { data() {
return { return {
loading: true, loading: true,
queryFunction: listPublishMap, queryFunction: listPublishMap,
defaultShowKeys: [], defaultShowKeys: [],
filterText: '', filterText: '',
treeData: [], treeData: [],
treeList: [], treeList: [],
selected: {}, selected: {},
defaultProps: { defaultProps: {
children: 'children', children: 'children',
label: 'name' label: 'name'
}, },
node: { node: {
}, },
screenList: [] screenList: []
}; };
}, },
watch: { watch: {
filterText(val) { filterText(val) {
this.treeList = this.treeData.filter((res) => { this.treeList = this.treeData.filter((res) => {
return res.name.includes(val); return res.name.includes(val);
}); });
} }
}, },
created() { created() {
this.getScreenLists(); this.getScreenLists();
}, },
beforeDestroy () { beforeDestroy () {
removeSessionStorage('screenMonitorList'); removeSessionStorage('screenMonitorList');
}, },
methods: { methods: {
async getScreenLists() { async getScreenLists() {
const list = await queryPermissionScreen(); const list = await queryPermissionScreen();
this.screenList = list.data || []; this.screenList = list.data || [];
}, },
filterNode(value, data) { filterNode(value, data) {
if (!value) return true; if (!value) return true;
return data.name.indexOf(value) !== -1; return data.name.indexOf(value) !== -1;
}, },
showContextMenu(e, obj, node, vueElem) { showContextMenu(e, obj, node, vueElem) {
if (obj) { if (obj) {
this.node = node; this.node = node;
this.selected = obj; this.selected = obj;
} }
}, },
clickEvent(obj) { clickEvent(obj) {
setSessionStorage('screenMonitorList', obj.id); setSessionStorage('screenMonitorList', obj.id);
this.$router.push({ path: `${UrlConfig.dp.detail}/${obj.id}` }); this.$router.push({ path: `${UrlConfig.dp.detail}/${obj.id}` });
}, },
refresh(filterSelect) { refresh(filterSelect) {
this.loading = true; this.loading = true;
this.treeData = this.treeList = []; this.treeData = this.treeList = [];
listPublishMap().then(res => { listPublishMap().then(res => {
(res.data || []).forEach(ele => { (res.data || []).forEach(ele => {
if (ele.cityCode == filterSelect) { if (ele.cityCode == filterSelect) {
ele.valid = false; ele.valid = false;
if (this.screenList.length) { if (this.screenList.length) {
ele.valid = true; ele.valid = true;
} }
this.treeData.push(ele); this.treeData.push(ele);
} }
}); });
this.treeList = this.filterText this.treeList = this.filterText
? this.treeData.filter((res) => { ? this.treeData.filter((res) => {
return res.name.includes(this.filterText); return res.name.includes(this.filterText);
}) })
: this.treeData; : this.treeData;
if (this.treeList.length == 0) { if (this.treeList.length == 0) {
this.$router.push({ path: `${UrlConfig.dp.prefix}/home` }); this.$router.push({ path: `${UrlConfig.dp.prefix}/home` });
} else { } else {
this.$nextTick(() => { this.$nextTick(() => {
const mapId = getSessionStorage('screenMonitorList')|| (this.treeList[0] || { id: 0 }).id; const mapId = getSessionStorage('screenMonitorList') || (this.treeList[0] || { id: 0 }).id;
this.$router.push({ path: `${UrlConfig.dp.detail}/${mapId}` }); this.$router.push({ path: `${UrlConfig.dp.detail}/${mapId}` });
this.$refs.tree.setCurrentKey(mapId); // value node-key this.$refs.tree.setCurrentKey(mapId); // value node-key
}); });
} }
this.$nextTick(() => { this.loading = false; }); this.$nextTick(() => { this.loading = false; });
}).catch(error => { }).catch(error => {
console.log(error); console.log(error);
this.loading = false; this.loading = false;
this.$messageBox(this.$t('error.refreshFailed')); this.$messageBox(this.$t('error.refreshFailed'));
}); });
} }
} }
}; };
</script> </script>
<style> <style>

View File

@ -1,107 +1,109 @@
<template> <template>
<el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center> <el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="doClose" center>
<data-form ref="dataform" :form="form" :formModel="formModel" :rules="rules"></data-form> <data-form ref="dataform" :form="form" :form-model="formModel" :rules="rules" />
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
<el-button type="primary" @click="doCreate">{{$t('global.confirm')}}</el-button> <el-button type="primary" @click="doCreate">{{ $t('global.confirm') }}</el-button>
<el-button @click="doClose">{{$t('global.cancel')}}</el-button> <el-button @click="doClose">{{ $t('global.cancel') }}</el-button>
</span> </span>
</el-dialog> </el-dialog>
</template> </template>
<script> <script>
import { listPublishMap } from '@/api/jmap/map' import { listPublishMap } from '@/api/jmap/map';
import { getQuestById} from '@/api/quest';
export default { import { getQuestById} from '@/api/quest';
name: 'ScriptDraft',
data() { export default {
return { name: 'ScriptDraft',
dialogVisible: false, props: {
mapList: [], title: {
taskStatusList: [], type: String,
formModel: { default() {
name: '', return '';
mapId: '',
description:''
}
}
},
props: {
title: String,
},
computed: {
form() {
let form = {
labelWidth: '150px',
items: [
{ prop: 'name', label: this.$t('scriptRecord.scriptName'), type: 'text', required: true},
{ prop: 'mapId', label: this.$t('scriptRecord.map'), type: 'select', required: true, options: this.mapList,disabled:true},
{ prop: 'description', label: this.$t('scriptRecord.scriptDescription'), type: 'textarea', required: true},
]
}
return form
},
rules() {
let crules = {
name: [
{ required: true, message: this.$t('scriptRecord.inputScriptName'), trigger: 'blur' },
{ required: true, message: this.$t('scriptRecord.inputScriptName'), trigger: 'change' },
],
mapId: [
{ required: true, message: this.$t('scriptRecord.selectMap'), trigger: 'change' },
],
description:[
{ required: true, message: this.$t('scriptRecord.inputScriptDescription'), trigger: 'blur' },
{ required: true, message: this.$t('scriptRecord.inputScriptDescription'), trigger: 'change' },
]
}
return crules
},
},
mounted() {
this.loadInitData();
},
methods: {
loadInitData() {
this.mapList = [];
listPublishMap().then(response => {
this.mapList = response.data.map(elem => { return { value: elem.id, label: elem.name } });
})
},
doShow(questid) {
if(questid)
{
getQuestById(questid).then(resp=>{
let data={'name':resp.data.name,'description':resp.data.description,'mapId':resp.data.mapId};
this.formModel=data;
this.formModel.id=questid;
this.dialogVisible = true
});
}
else
{
this.formModel.mapId=this.$route.params.mapId;
this.dialogVisible = true
}
},
doCreate() {
let self = this
this.$refs.dataform.validateForm(() => {
self.$emit('create', Object.assign({}, this.formModel));
self.doClose()
})
},
doClose() {
this.$refs.dataform.resetForm();
this.dialogVisible = false
} }
} }
},
data() {
return {
dialogVisible: false,
mapList: [],
taskStatusList: [],
formModel: {
name: '',
mapId: '',
description:''
}
};
},
computed: {
form() {
const form = {
labelWidth: '150px',
items: [
{ prop: 'name', label: this.$t('scriptRecord.scriptName'), type: 'text', required: true},
{ prop: 'mapId', label: this.$t('scriptRecord.map'), type: 'select', required: true, options: this.mapList, disabled:true},
{ prop: 'description', label: this.$t('scriptRecord.scriptDescription'), type: 'textarea', required: true}
]
};
return form;
},
rules() {
const crules = {
name: [
{ required: true, message: this.$t('scriptRecord.inputScriptName'), trigger: 'blur' },
{ required: true, message: this.$t('scriptRecord.inputScriptName'), trigger: 'change' }
],
mapId: [
{ required: true, message: this.$t('scriptRecord.selectMap'), trigger: 'change' }
],
description:[
{ required: true, message: this.$t('scriptRecord.inputScriptDescription'), trigger: 'blur' },
{ required: true, message: this.$t('scriptRecord.inputScriptDescription'), trigger: 'change' }
]
};
return crules;
}
},
mounted() {
this.loadInitData();
},
methods: {
loadInitData() {
this.mapList = [];
listPublishMap().then(response => {
this.mapList = response.data.map(elem => { return { value: elem.id, label: elem.name }; });
});
},
doShow(questid) {
if (questid) {
getQuestById(questid).then(resp=>{
const data = {'name':resp.data.name, 'description':resp.data.description, 'mapId':resp.data.mapId};
this.formModel = data;
this.formModel.id = questid;
this.dialogVisible = true;
});
} else {
this.formModel.mapId = this.$route.params.mapId;
this.dialogVisible = true;
}
},
doCreate() {
const self = this;
this.$refs.dataform.validateForm(() => {
self.$emit('create', Object.assign({}, this.formModel));
self.doClose();
});
},
doClose() {
this.$refs.dataform.resetForm();
this.dialogVisible = false;
}
} }
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/deep/ .el-dialog--center .el-dialog__body{ /deep/ .el-dialog--center .el-dialog__body{
padding: 25px 65px 30px 10px; padding: 25px 65px 30px 10px;
} }
</style> </style>

View File

@ -16,37 +16,35 @@ import TipScriptRecord from './tipScriptRecord';
import drapLeft from '@/views/components/drapLeft/index'; import drapLeft from '@/views/components/drapLeft/index';
export default { export default {
name: 'ScriptDisplay', name: 'ScriptDisplay',
components: { components: {
Display, Display,
TipScriptRecord, TipScriptRecord,
drapLeft drapLeft
}, },
data() { data() {
return { return {
widthLeft: 780, widthLeft: 780,
size: { size: {
width: document.documentElement.clientWidth - 780, width: document.documentElement.clientWidth - 780,
height: document.documentElement.clientHeight height: document.documentElement.clientHeight
}, },
group: this.$route.query.group group: this.$route.query.group
}; };
}, },
computed: { watch: {
}, '$store.state.app.windowSizeCount': function() {
watch: { this.size = { width: this.$store.state.app.width - 780, height: this.$store.state.app.height};
'$store.state.app.windowSizeCount': function() { },
this.size = { width: this.$store.state.app.width - 780, height: this.$store.state.app.height}; widthLeft: function(val) {
}, this.size = { width: this.$store.state.app.width - val, height: this.$store.state.app.height};
widthLeft: function(val) { }
this.size = { width: this.$store.state.app.width - val, height: this.$store.state.app.height}; },
} methods: {
}, drapWidth(width) {
methods: { this.widthLeft = Number(width);
drapWidth(width) { }
this.widthLeft = Number(width); }
}
}
}; };
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>

View File

@ -1,8 +1,8 @@
<template> <template>
<div class="reminder-drag"> <div class="reminder-drag">
<div ref="drapBox" class="reminder-box" :style="{height:'100%', width: width + 'px'}"> <div ref="drapBox" class="reminder-box" :style="{width: width + 'px'}">
<el-container class="actionPane"> <el-container class="actionPane">
<el-header style="height:50px;"> <el-header style="height: 50px;">
<el-row class="actionList"> <el-row class="actionList">
<span class="titleStyle">{{ $t('scriptRecord.scriptRecordTitle') }}</span> <span class="titleStyle">{{ $t('scriptRecord.scriptRecordTitle') }}</span>
<span class="titleStyle">( {{ $t('scriptRecord.language') }}: {{ $route.query.lang=="en"?$t('scriptRecord.english'):$t('scriptRecord.chinese') }} )</span> <span class="titleStyle">( {{ $t('scriptRecord.language') }}: {{ $route.query.lang=="en"?$t('scriptRecord.english'):$t('scriptRecord.chinese') }} )</span>
@ -195,7 +195,7 @@ export default {
float: left; float: left;
left: 0px; left: 0px;
top:0px; top:0px;
height:100%; height: 100%;
background-color: #fff; background-color: #fff;
overflow: hidden; overflow: hidden;
z-index: 10; z-index: 10;

View File

@ -1,21 +1,20 @@
<template> <template>
<el-card :style="{height: height+'px'}"> <div class="joylink-card">
<div class="scriptHeader"> <div class="scriptHeader">
<div class="scriptList">{{ $t('scriptRecord.scriptList') }}</div> <div class="scriptList">{{ $t('scriptRecord.scriptList') }}</div>
<el-button size="small" type="primary" class="createScript" @click="handleCreate">{{ $t('scriptRecord.scriptCreate') }}</el-button> <el-button size="small" type="primary" class="createScript" @click="handleCreate">{{ $t('scriptRecord.scriptCreate') }}</el-button>
</div> </div>
<QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" style="width: 91%;margin-left:4%;margin-top:20px;display: inline-block;" /> <QueryListPage ref="queryListPage" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" style="width: 91%;margin-left:4%;margin-top:20px;" />
<script-publish ref="publishScript" :title="$t('scriptRecord.publishScript')" @reloadTable="reloadTable" @create="handleConfirmPublish" /> <script-publish ref="publishScript" :title="$t('scriptRecord.publishScript')" @reloadTable="reloadTable" @create="handleConfirmPublish" />
<create-script ref="createScript" :title="$t('scriptRecord.createScript')" @reloadTable="reloadTable" @create="handleConfirmCreate" /> <create-script ref="createScript" :title="$t('scriptRecord.createScript')" @reloadTable="reloadTable" @create="handleConfirmCreate" />
<create-script ref="modifyScript" :title="$t('scriptRecord.modifyScript')" @reloadTable="reloadTable" @create="handleConfirmModify" /> <create-script ref="modifyScript" :title="$t('scriptRecord.modifyScript')" @reloadTable="reloadTable" @create="handleConfirmModify" />
</el-card> </div>
</template> </template>
<script> <script>
import Cookies from 'js-cookie'; import Cookies from 'js-cookie';
import ConstConfig from '@/scripts/ConstConfig'; import ConstConfig from '@/scripts/ConstConfig';
import { UrlConfig } from '@/router/index'; import { UrlConfig } from '@/router/index';
import { mapGetters } from 'vuex';
import { admin, superAdmin} from '@/router'; import { admin, superAdmin} from '@/router';
import { getQuestPageList, createQuest, deleteQuest, updateQuest, publishQuest, retractQuest} from '@/api/quest'; import { getQuestPageList, createQuest, deleteQuest, updateQuest, publishQuest, retractQuest} from '@/api/quest';
import { launchFullscreen } from '@/utils/screen'; import { launchFullscreen } from '@/utils/screen';
@ -25,7 +24,7 @@ import ScriptPublish from './publish';
export default { export default {
name: 'ScriptDraft', name: 'ScriptDraft',
components: { components: {
CreateScript, CreateScript,
ScriptPublish ScriptPublish
}, },
@ -111,11 +110,6 @@ export default {
} }
}; };
}, },
computed: {
height() {
return this.$store.state.app.height - 50 - 30;
}
},
watch: { watch: {
'$route' () { '$route' () {
this.reloadTable(); this.reloadTable();
@ -275,8 +269,13 @@ export default {
</script> </script>
<style rel="stylesheet/scss" lang="scss" scoped> <style rel="stylesheet/scss" lang="scss" scoped>
@import "src/styles/mixin.scss"; @import "src/styles/mixin.scss";
.joylink-card{
height: 100%;
overflow: auto;
}
.createScript{ .createScript{
display:inline-block;float:right;margin-right:20px; float: right;
margin-right:20px;
} }
.scriptHeader{ .scriptHeader{
display:inline-block;margin-top:40px;width: 90%;margin-left:5%; display:inline-block;margin-top:40px;width: 90%;margin-left:5%;

View File

@ -13,8 +13,12 @@
export default { export default {
name: 'ScriptOperate', name: 'ScriptOperate',
props: { props: {
title: String, title: {
type:String type: String,
default() {
return '';
}
}
}, },
data() { data() {
return { return {

View File

@ -176,7 +176,6 @@ export default {
if (Cookies.get('user_lang') == 'en') { if (Cookies.get('user_lang') == 'en') {
lastData = lastData.replace(new RegExp(rolename, 'g'), element.enLabel); lastData = lastData.replace(new RegExp(rolename, 'g'), element.enLabel);
} else { } else {
lastData = lastData.replace(new RegExp(rolename, 'g'), element.label); lastData = lastData.replace(new RegExp(rolename, 'g'), element.label);
} }
}); });
@ -185,7 +184,9 @@ export default {
this.getDeviceCode(); this.getDeviceCode();
this.resetDisabled(); this.resetDisabled();
this.initCommandActionData(); this.initCommandActionData();
}).catch(error => {}); }).catch(error => {
this.$message(error.message);
});
}, },
changeRole(index) { changeRole(index) {
const role = this.orginMemberList.find(elem=>{ return elem.id == index; }).role; const role = this.orginMemberList.find(elem=>{ return elem.id == index; }).role;
@ -231,7 +232,6 @@ export default {
this.commandData.action.type = 'Command'; this.commandData.action.type = 'Command';
if (this.commandData.action.deviceCommand == 'Train_Manual_Route_Blocking_Drive') { this.commandData.action.commandParamList = [this.commandData.param.startStation, this.commandData.param.endStation]; } if (this.commandData.action.deviceCommand == 'Train_Manual_Route_Blocking_Drive') { this.commandData.action.commandParamList = [this.commandData.param.startStation, this.commandData.param.endStation]; }
const data = this.commandData.action; const data = this.commandData.action;
const obj = this;
this.adding = true; this.adding = true;
addScriptAction(group, data).then(response=>{ addScriptAction(group, data).then(response=>{
this.adding = false; this.adding = false;
@ -256,7 +256,6 @@ export default {
const group = this.group; const group = this.group;
this.modalData.actionVO.type = 'Conversation'; this.modalData.actionVO.type = 'Conversation';
const data = this.modalData.actionVO; const data = this.modalData.actionVO;
const obj = this;
this.modifying = true; this.modifying = true;
if (this.operateType == 'add') { if (this.operateType == 'add') {
addScriptAction(group, data).then(response=>{ addScriptAction(group, data).then(response=>{

View File

@ -92,12 +92,12 @@ export default {
const member = memberVOList.find(elem=>{ return elem.id == element.memberId; }); const member = memberVOList.find(elem=>{ return elem.id == element.memberId; });
const memberName = member.name ? ' - ' + member.name:''; const memberName = member.name ? ' - ' + member.name : '';
switch (element.type) { switch (element.type) {
case 'Conversation': case 'Conversation':
{ {
const target = memberVOList.find(elem=>{ return elem.id == element.targetId; }); const target = memberVOList.find(elem=>{ return elem.id == element.targetId; });
const targetName = target.name ? ' - ' + target.name:''; const targetName = target.name ? ' - ' + target.name : '';
this.actionInfoList.push({id: element.id, isCoversition: true, memberName: member.role + memberName, targetName: target.role + targetName, reply: element.reply, row: element, visible: true}); this.actionInfoList.push({id: element.id, isCoversition: true, memberName: member.role + memberName, targetName: target.role + targetName, reply: element.reply, row: element, visible: true});
break; break;
} }

View File

@ -10,76 +10,76 @@ import { DeviceMenu } from '@/scripts/ConstDic';
import { putJointTrainingUserkicked } from '@/api/chat'; import { putJointTrainingUserkicked } from '@/api/chat';
export default { export default {
name: 'TrainingOperateMenu', name: 'TrainingOperateMenu',
components: { components: {
PopMenu PopMenu
}, },
props: { props: {
point: { point: {
type: Object, type: Object,
required: true required: true
}, },
clickUserId: { clickUserId: {
type: String, type: String,
required: true required: true
} }
}, },
data() { data() {
return { return {
menu: [], menu: [],
menuShow: [ menuShow: [
{ {
label: this.$t('trainRoom.kickOutTheRoom'), label: this.$t('trainRoom.kickOutTheRoom'),
handler: this.kicked handler: this.kicked
} }
], ],
userId: '' userId: ''
}; };
}, },
watch: { watch: {
'$store.state.menuOperation.menuCount': function (val) { '$store.state.menuOperation.menuCount': function (val) {
if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.JointRoom)) { if (this.$store.getters['menuOperation/checkDialogIsOpen'](DeviceMenu.JointRoom)) {
this.doShow(this.$store.state.menuOperation.menuPosition); this.doShow(this.$store.state.menuOperation.menuPosition);
} else { } else {
this.doClose(); this.doClose();
} }
} }
}, },
mounted() { mounted() {
this.userId = this.$store.state.user.id; this.userId = this.$store.state.user.id;
this.closeEvent(); this.closeEvent();
}, },
methods: { methods: {
closeEvent() { closeEvent() {
const self = this; const self = this;
window.onclick = function (e) { window.onclick = function (e) {
self.doClose(); self.doClose();
}; };
}, },
doShow(point) { doShow(point) {
this.closeEvent(); this.closeEvent();
if (this.userId != this.clickUserId) { if (this.userId != this.clickUserId) {
this.menu = this.menuShow; this.menu = this.menuShow;
if (this.$refs && this.$refs.popMenu) { if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.resetShowPosition(point); this.$refs.popMenu.resetShowPosition(point);
} }
} else { } else {
this.menu = []; this.menu = [];
} }
}, },
doClose() { doClose() {
if (this.$refs && this.$refs.popMenu) { if (this.$refs && this.$refs.popMenu) {
this.$refs.popMenu.close(); this.$refs.popMenu.close();
} }
}, },
async kicked() { async kicked() {
try { try {
await putJointTrainingUserkicked(this.clickUserId, this.$route.query.group); await putJointTrainingUserkicked(this.clickUserId, this.$route.query.group);
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
} }
} }
}; };
</script> </script>

View File

@ -35,12 +35,9 @@
id="dope" id="dope"
v-model="text" v-model="text"
style="width: 99%;height: 47px; border: none;outline: none;" style="width: 99%;height: 47px; border: none;outline: none;"
name=""
rows=""
cols=""
@keyup="changeText" @keyup="changeText"
/> />
<button class="sendBtn" @click="sendText()" :disabled="disabled">{{$t('trainRoom.sendText')}}</button> <button class="sendBtn" :disabled="disabled" @click="sendText()">{{ $t('trainRoom.sendText') }}</button>
<div <div
class="sendBtn yuyin_start zIndex1" class="sendBtn yuyin_start zIndex1"
:style="{background: background}" :style="{background: background}"
@ -48,7 +45,7 @@
@mouseup="stopRecording()" @mouseup="stopRecording()"
>{{ speak }}</div> >{{ speak }}</div>
<div v-show="sending" class="sendBtn yuyin_start zIndex2" :style="{background: background}"> <div v-show="sending" class="sendBtn yuyin_start zIndex2" :style="{background: background}">
{{$t('trainRoom.sending')}}</div> {{ $t('trainRoom.sending') }}</div>
</div> </div>
</div> </div>
</div> </div>
@ -59,168 +56,168 @@ import HZRecorder from '@/utils/HZRecorder';
import { getHistoryVoice, chatWithText, chatWithAudio } from '@/api/chat'; import { getHistoryVoice, chatWithText, chatWithAudio } from '@/api/chat';
export default { export default {
name: 'TrainChat', name: 'TrainChat',
props: { props: {
groupRoom: { groupRoom: {
type: String, type: String,
required: true required: true
} }
},
data() {
return {
textList: [],
topic: '/user/topic/chatroom',
text: '',
recorders: null,
stomp: null,
speak: this.$t('trainRoom.holdAndTalk'),
sending: false,
background: '',
userId: '',
disabled:true,
};
},
watch: {
'$store.state.socket.chatContentList': function (val) { //
if (val.chatInfo) {
this.handelTextList(val);
}
}
},
async mounted() {
this.userId = this.$store.state.user.id;
// this.getHistory(); //
},
methods: {
//
async sendText() {
if (!this.text.trim()) {
// alert(this.$t('trainRoom.contentIsEmptyAndCannotBeSent'));
// this.text = '';
} else {
try {
await chatWithText(this.text, this.groupRoom);
this.text = '';
this.disabled=true;
} catch (error) {
console.error(error);
}
}
}, },
changeText(){ data() {
if (!this.text.trim()){ return {
this.disabled=true; textList: [],
}else{ topic: '/user/topic/chatroom',
this.disabled=false; text: '',
} recorders: null,
stomp: null,
speak: this.$t('trainRoom.holdAndTalk'),
sending: false,
background: '',
userId: '',
disabled:true
};
}, },
// watch: {
startRecording() { '$store.state.socket.chatContentList': function (val) { //
this.background = '#ccc'; if (val.chatInfo) {
this.speak = this.$t('trainRoom.recording'); this.handelTextList(val);
this.sending = false; }
HZRecorder.init.get(rec => { }
if (typeof rec == 'object') { },
this.recorders = rec; async mounted() {
this.recorders.start(); this.userId = this.$store.state.user.id;
} // this.getHistory(); //
}); },
}, methods: {
// //
async stopRecording() { async sendText() {
this.background = ''; if (!this.text.trim()) {
this.speak = this.$t('trainRoom.holdAndTalk'); // alert(this.$t('trainRoom.contentIsEmptyAndCannotBeSent'));
this.sending = true; // this.text = '';
if (this.recorders) { } else {
this.recorders.stop(); try {
var fd = new FormData(); await chatWithText(this.text, this.groupRoom);
fd.append('file', this.recorders.getBlob()); this.text = '';
await chatWithAudio(fd, this.$route.query.group).catch(error => { this.disabled = true;
this.sending = false; } catch (error) {
const message = JSON.parse(error.message); console.error(error);
if (message.err_no == 3301) { }
this.$message({ }
showClose: true, },
message: this.$t('error.problemWithAudioQuality'), changeText() {
type: 'error' if (!this.text.trim()) {
}); this.disabled = true;
} else if (message.err_no == 3308) { } else {
this.$message({ this.disabled = false;
showClose: true, }
message: this.$t('error.audioIsTooLong'), },
type: 'error' //
}); startRecording() {
} else if (message.err_no == 3314) { this.background = '#ccc';
this.$message({ this.speak = this.$t('trainRoom.recording');
showClose: true, this.sending = false;
message: this.$t('error.audioIsTooShort'), HZRecorder.init.get(rec => {
type: 'error' if (typeof rec == 'object') {
}); this.recorders = rec;
} else { this.recorders.start();
this.$message({ }
showClose: true, });
message: this.$t('error.networkProblem'), },
type: 'error' //
}); async stopRecording() {
} this.background = '';
}); this.speak = this.$t('trainRoom.holdAndTalk');
this.recorders = null; this.sending = true;
} else { if (this.recorders) {
this.sending = false; this.recorders.stop();
this.$message({ var fd = new FormData();
showClose: true, fd.append('file', this.recorders.getBlob());
message: this.$t('error.audioIsTooShort'), await chatWithAudio(fd, this.$route.query.group).catch(error => {
type: 'error' this.sending = false;
}); const message = JSON.parse(error.message);
} if (message.err_no == 3301) {
}, this.$message({
playAudio(nor) { showClose: true,
this.$refs.audio.src = nor.src; message: this.$t('error.problemWithAudioQuality'),
this.$refs.audio.play(); type: 'error'
}, });
// } else if (message.err_no == 3308) {
async getHistory(obj, node, data) { this.$message({
this.textList = []; showClose: true,
try { message: this.$t('error.audioIsTooLong'),
const res = await getHistoryVoice(this.code); type: 'error'
res.data.forEach(item => { });
let isSelf = false; } else if (message.err_no == 3314) {
if (item.userId == this.userId) { this.$message({
isSelf = true; showClose: true,
} message: this.$t('error.audioIsTooShort'),
const param = { type: 'error'
join: false, });
value: item.message, } else {
self: isSelf, this.$message({
voice: item.isAudio, showClose: true,
src: item.isAudio ? `${process.env.VOICE_API}/jlcloud/audio/${item.audioPath}` : '', message: this.$t('error.networkProblem'),
other: !isSelf, type: 'error'
userName: item.nickName, });
chatTime: item.chatTime }
}; });
this.handelTextList(param); this.recorders = null;
}); } else {
} catch (error) { this.sending = false;
console.error(error); this.$message({
} showClose: true,
}, message: this.$t('error.audioIsTooShort'),
// list type: 'error'
handelTextList(params) { });
if (!params.inSimulation) { }
this.textList.push(params); },
this.textList.sort((a, b) => { playAudio(nor) {
return a.date - b.date; this.$refs.audio.src = nor.src;
}); this.$refs.audio.play();
} },
this.sending = false; //
this.$store.dispatch('socket/setChatContentList', {}); async getHistory(obj, node, data) {
this.$nextTick(() => { this.textList = [];
if (this.$refs.content) { try {
this.$refs.content.scrollTop = this.$refs.content.scrollHeight; const res = await getHistoryVoice(this.code);
} res.data.forEach(item => {
}); let isSelf = false;
} if (item.userId == this.userId) {
} isSelf = true;
}
const param = {
join: false,
value: item.message,
self: isSelf,
voice: item.isAudio,
src: item.isAudio ? `${process.env.VOICE_API}/jlcloud/audio/${item.audioPath}` : '',
other: !isSelf,
userName: item.nickName,
chatTime: item.chatTime
};
this.handelTextList(param);
});
} catch (error) {
console.error(error);
}
},
// list
handelTextList(params) {
if (!params.inSimulation) {
this.textList.push(params);
this.textList.sort((a, b) => {
return a.date - b.date;
});
}
this.sending = false;
this.$store.dispatch('socket/setChatContentList', {});
this.$nextTick(() => {
if (this.$refs.content) {
this.$refs.content.scrollTop = this.$refs.content.scrollHeight;
}
});
}
}
}; };
</script> </script>

View File

@ -34,7 +34,6 @@
</el-tree> </el-tree>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>