mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-13 04:46:46 +08:00
feat:移动任务 选择面授
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
@after-visible-change="afterVisibleChange"
|
||||
>
|
||||
<div class="drawerMain">
|
||||
<div class="header">
|
||||
<div class="headerTitle">{{edit?'编辑':'添加'}}讨论</div>
|
||||
<div class="header">
|
||||
<div class="headerTitle">{{ edit ? "编辑" : "添加" }}讨论</div>
|
||||
<img
|
||||
style="width: 29px; height: 29px; cursor: pointer"
|
||||
src="../../assets/images/basicinfo/close.png"
|
||||
@@ -56,7 +56,9 @@
|
||||
<span style="margin-right: 3px">讨论设置:</span>
|
||||
</div>
|
||||
<div class="btnbox">
|
||||
<a-checkbox v-model:checked="checkedC1" @change = "checkRadio">允许评论</a-checkbox>
|
||||
<a-checkbox v-model:checked="checkedC1" @change="checkRadio"
|
||||
>允许评论</a-checkbox
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -66,14 +68,13 @@
|
||||
<button class="btn2" @click="updateDiscussInfo">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</a-drawer>
|
||||
</template>
|
||||
<script>
|
||||
import { reactive, toRefs, ref } from "vue";
|
||||
import * as api from "../../api/indexDiscuss";
|
||||
import * as apiTask from "../../api/indexTaskadd";
|
||||
import { RouterEditTask } from "@/api/indexTask"
|
||||
import { RouterEditTask } from "@/api/indexTask";
|
||||
import { message } from "ant-design-vue";
|
||||
const rowSelection = ref({
|
||||
checkStrictly: false,
|
||||
@@ -104,7 +105,8 @@ export default {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
edit: { // 是否为编辑
|
||||
edit: {
|
||||
// 是否为编辑
|
||||
type: Boolean,
|
||||
default: null,
|
||||
},
|
||||
@@ -120,15 +122,18 @@ export default {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
isLevel: { // 是否是关卡页面触发
|
||||
isLevel: {
|
||||
// 是否是关卡页面触发
|
||||
type: Boolean,
|
||||
default: null,
|
||||
},
|
||||
EditWorkId: { // 要编辑的workId
|
||||
EditWorkId: {
|
||||
// 要编辑的workId
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
projectTaskId: { // 要编辑的projectId
|
||||
projectTaskId: {
|
||||
// 要编辑的projectId
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
@@ -139,84 +144,103 @@ export default {
|
||||
isactive: {
|
||||
type: Number,
|
||||
default: null,
|
||||
}
|
||||
},
|
||||
},
|
||||
setup(props, ctx) {
|
||||
console.log("学习路径",props.isStudiscuss);
|
||||
console.log("学习路径", props.isStudiscuss);
|
||||
const state = reactive({
|
||||
inputV1: "",
|
||||
inputV2: "",
|
||||
textV1: "",
|
||||
checkedC1: false,
|
||||
discussSettings:"",
|
||||
addLoading:false,
|
||||
discussSettings: "",
|
||||
addLoading: false,
|
||||
});
|
||||
const checkRadio = () =>{
|
||||
if(state.checkedC1){
|
||||
state.discussSettings = "true"
|
||||
}else{
|
||||
const checkRadio = () => {
|
||||
if (state.checkedC1) {
|
||||
state.discussSettings = "true";
|
||||
} else {
|
||||
state.discussSettings = "false";
|
||||
}
|
||||
console.log("state.checkedC1=====",state.discussSettings,state.discussSettings=="true");
|
||||
}
|
||||
console.log(
|
||||
"state.checkedC1=====",
|
||||
state.discussSettings,
|
||||
state.discussSettings == "true"
|
||||
);
|
||||
};
|
||||
const closeDrawer = () => {
|
||||
ctx.emit("update:adddiscussVisible", false);
|
||||
ctx.emit("update:edit", false);
|
||||
state.inputV1 = "";
|
||||
state.textV1 = "";
|
||||
message.success(`${props.edit ? '编辑' : '新增'}关卡任务成功`)
|
||||
|
||||
message.success(`${props.edit ? "编辑" : "新增"}关卡任务成功`);
|
||||
localStorage.setItem("stageId", props.chooseStageId);
|
||||
};
|
||||
const queryDiscuss = () =>{
|
||||
if(props.edit){
|
||||
//编辑讨
|
||||
api.getDiscussDetail({discussId:props.EditDiscussId}).then(res => {
|
||||
console.log('获取讨论信息成功',res.data.data)
|
||||
//更新讨论信息
|
||||
state.inputV1 = res.data.data.discussName;
|
||||
state.textV1 = res.data.data.discussExplain;
|
||||
state.checkedC1 = res.data.data.discussSettings=="true"?true:false;
|
||||
console.log("props.EditDiscussId",res.data.data.discussSettings,"===",res.data.data.discussSettings=="true",state.checkedC1)
|
||||
}).catch(err=>{
|
||||
console.log('获取讨论信息失败',err)
|
||||
})
|
||||
|
||||
}
|
||||
const queryDiscuss = () => {
|
||||
if (props.edit) {
|
||||
//编辑讨
|
||||
api
|
||||
.getDiscussDetail({ discussId: props.EditDiscussId })
|
||||
.then((res) => {
|
||||
console.log("获取讨论信息成功", res.data.data);
|
||||
//更新讨论信息
|
||||
state.inputV1 = res.data.data.discussName;
|
||||
state.textV1 = res.data.data.discussExplain;
|
||||
state.checkedC1 =
|
||||
res.data.data.discussSettings == "true" ? true : false;
|
||||
console.log(
|
||||
"props.EditDiscussId",
|
||||
res.data.data.discussSettings,
|
||||
"===",
|
||||
res.data.data.discussSettings == "true",
|
||||
state.checkedC1
|
||||
);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("获取讨论信息失败", err);
|
||||
});
|
||||
}
|
||||
};
|
||||
const afterVisibleChange = (bool) => {
|
||||
if(bool){
|
||||
if (bool) {
|
||||
queryDiscuss();
|
||||
}
|
||||
};
|
||||
const updateTask = (res) => {
|
||||
console.log("jinlaile ========",props.isLevel);
|
||||
if(props.isLevel){
|
||||
RouterEditTask({
|
||||
chapterId:props.isactive,
|
||||
courseId: res.data.data.discussId,
|
||||
name: res.data.data.discussName,
|
||||
routerId: props.routerId,
|
||||
routerTaskId: props.routerTaskId ||0,
|
||||
type: 8,
|
||||
}).then(res => {
|
||||
console.log("新增关卡任务失败",res);
|
||||
}).catch(err => {console.log("新增关卡任务失败",err);})
|
||||
}else{
|
||||
apiTask
|
||||
.addTask({
|
||||
console.log("jinlaile ========", props.isLevel);
|
||||
if (props.isLevel) {
|
||||
RouterEditTask({
|
||||
chapterId: props.isactive,
|
||||
courseId: res.data.data.discussId,
|
||||
name: res.data.data.discussName,
|
||||
projectId: props.projectId,
|
||||
projectTaskId: props.projectTaskId || 0,
|
||||
stageId:props.chooseStageId,
|
||||
type: 8,
|
||||
}).then(r=>{
|
||||
console.log("新增关卡任务成功",r);
|
||||
}).catch(r=>{
|
||||
console.log('更新阶段任务失败',r)
|
||||
routerId: props.routerId,
|
||||
routerTaskId: props.routerTaskId || 0,
|
||||
type: 8,
|
||||
})
|
||||
}
|
||||
}
|
||||
.then((res) => {
|
||||
console.log("新增关卡任务失败", res);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("新增关卡任务失败", err);
|
||||
});
|
||||
} else {
|
||||
apiTask
|
||||
.addTask({
|
||||
courseId: res.data.data.discussId,
|
||||
name: res.data.data.discussName,
|
||||
projectId: props.projectId,
|
||||
projectTaskId: props.projectTaskId || 0,
|
||||
stageId: props.chooseStageId,
|
||||
type: 8,
|
||||
})
|
||||
.then((r) => {
|
||||
console.log("新增关卡任务成功", r);
|
||||
})
|
||||
.catch((r) => {
|
||||
console.log("更新阶段任务失败", r);
|
||||
});
|
||||
}
|
||||
};
|
||||
const updateDiscussInfo = () => {
|
||||
if (!state.inputV1) {
|
||||
message.destroy();
|
||||
@@ -226,36 +250,36 @@ export default {
|
||||
discussName: state.inputV1, //讨论名称
|
||||
discussExplain: state.textV1, //讨论说明
|
||||
discussSettings: state.discussSettings, //讨论设置
|
||||
discussId: props.edit?props.EditDiscussId:0,//讨论Id
|
||||
discussId: props.edit ? props.EditDiscussId : 0, //讨论Id
|
||||
projectId: 0, //项目id,接口多余字段,
|
||||
};
|
||||
console.log("dianwanle -======",String(state.checkedC1));
|
||||
if(props.edit){
|
||||
console.log("dianwanle -======", String(state.checkedC1));
|
||||
if (props.edit) {
|
||||
api
|
||||
.updateDiscuss(obj)
|
||||
.then((res)=> {
|
||||
.then((res) => {
|
||||
updateTask(res);
|
||||
closeDrawer();
|
||||
ctx.emit("changeData", false);
|
||||
console.log("更新成功",res);
|
||||
console.log("项目任务ID",props.projectTaskId)
|
||||
console.log("更新成功", res);
|
||||
console.log("项目任务ID", props.projectTaskId);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("更新失败",err)
|
||||
})
|
||||
}else{
|
||||
console.log("更新失败", err);
|
||||
});
|
||||
} else {
|
||||
api
|
||||
.createDiscuss(obj)
|
||||
.then((res)=> {
|
||||
updateTask(res);
|
||||
closeDrawer();
|
||||
ctx.emit("changeData", false);
|
||||
console.log("创建成功",res);
|
||||
console.log("项目任务ID",props.projectTaskId)
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("创建失败",err)
|
||||
})
|
||||
.createDiscuss(obj)
|
||||
.then((res) => {
|
||||
updateTask(res);
|
||||
closeDrawer();
|
||||
ctx.emit("changeData", false);
|
||||
console.log("创建成功", res);
|
||||
console.log("项目任务ID", props.projectTaskId);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("创建失败", err);
|
||||
});
|
||||
}
|
||||
};
|
||||
return {
|
||||
@@ -392,6 +416,5 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user