This commit is contained in:
fan 2020-05-27 11:25:50 +08:00
commit 8cc1dd66d1
4 changed files with 43 additions and 24 deletions

View File

@ -1,18 +1,21 @@
export default {
// 当被绑定的元素插入到 DOM 中时
inserted: function (el, obj) {
// 这是需要页面刚加载就能进行聚焦操作使用的钩子函数,可以省略的,视具体需求而定
// 对值进行判断
if (obj.value) {
// 聚焦元素
el.focus();
}
},
// 当指令所在组件的 VNode 及其子 VNode 全部更新后调用
// 这是每当绑定的值发生改变时触发的钩子函数
componentUpdated: function (el, obj) {
if (obj.value) {
el.focus();
}
}
// 当被绑定的元素插入到 DOM 中时
inserted: function (el, obj) {
// 这是需要页面刚加载就能进行聚焦操作使用的钩子函数,可以省略的,视具体需求而定
// 对值进行判断
const dom = el.querySelector('input') || el.querySelector('textarea');
dom.focus();
// el.focus();
// if (obj.value) {
// // 聚焦元素
// el.focus();
// }
},
// 当指令所在组件的 VNode 及其子 VNode 全部更新后调用
// 这是每当绑定的值发生改变时触发的钩子函数
componentUpdated: function (el, obj) {
if (obj.value) {
el.focus();
}
}
};

View File

@ -19,13 +19,18 @@ export default {
default() {
return '';
}
},
raceList:{
type: Array,
default() {
return '';
}
}
},
data() {
return {
dialogVisible: false,
mapList: [],
taskStatusList: [],
isEdit:false,
formModel: {
name: '',
mapId: '',
@ -34,11 +39,19 @@ export default {
};
},
computed: {
raceInfoList() {
const racelist = [];
this.raceList.forEach(each=>{
racelist.push({label:each.name, value:each.id});
});
return racelist;
},
form() {
const form = {
labelWidth: '120px',
items: [
{ prop: 'name', label: '实操名称', type: 'text' },
{ prop:'raceId', label:'竞赛名称', type:'select', options:this.raceInfoList, disabled:this.isEdit},
{ prop: 'description', label: '实操描述', type: 'textarea' }
]
};
@ -53,6 +66,9 @@ export default {
description: [
{ validator: this.validateDescription, trigger: 'blur' },
{ validator: this.validateDescription, trigger: 'change' }
],
raceId:[
{ required: true, message: '请选择竞赛', trigger: 'change' }
]
};
return crules;
@ -82,12 +98,13 @@ export default {
this.formModel = data;
this.formModel.id = questid;
this.dialogVisible = true;
this.isEdit = true;
});
} else {
this.formModel.mapId = this.$route.params.mapId;
this.dialogVisible = true;
this.isEdit = false;
}
},
doCreate() {
const self = this;

View File

@ -1,8 +1,8 @@
<template>
<div>
<query-list-page ref="user" :pager-config="pagerConfig" :query-form="queryForm" :query-list="queryList" />
<create-practice ref="createPractice" title="创建实操" @reloadTable="reloadTable" @create="handleConfirmCreate" />
<create-practice ref="modifyPractice" title="修改实操" @reloadTable="reloadTable" @create="handleConfirmModify" />
<create-practice ref="createPractice" :race-list="raceList" title="创建实操" @reloadTable="reloadTable" @create="handleConfirmCreate" />
<create-practice ref="modifyPractice" :race-list="raceList" title="修改实操" @reloadTable="reloadTable" @create="handleConfirmModify" />
</div>
</template>
<script>
@ -132,7 +132,8 @@ export default {
}).catch(() => { });
},
doRecord(index, row) {
practiceRecordNotify(row.id).then(resp => {
// row.id
practiceRecordNotify(83).then(resp => {
const query = { mapId: row.mapId, group: resp.data, scriptId: row.id, lang:row.lang, lineCode:this.$route.query.lineCode};
this.$router.push({ path: `${UrlConfig.practiceDisplayNew}/practice`, query });
launchFullscreen();

View File

@ -24,8 +24,6 @@ export default {
data() {
return {
dialogVisible: false,
mapList: [],
taskStatusList: [],
formModel: {
name: '',
mapId: '',