mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-11 11:56:46 +08:00
编辑外链
This commit is contained in:
@@ -15,7 +15,7 @@ export const deleteLink = (obj) => http.post('/link/deleteLink', { params: obj }
|
|||||||
})
|
})
|
||||||
|
|
||||||
//获取外链详细信息接口
|
//获取外链详细信息接口
|
||||||
export const getLink = (obj) => http.post('/link/getOne', { params: obj })
|
export const getLink = (obj) => http.post('/link/getOne', obj)
|
||||||
|
|
||||||
// 更新外链数据
|
// 更新外链数据
|
||||||
export const updateLinks = (obj) => http.post('/link/updateLinks', obj, {
|
export const updateLinks = (obj) => http.post('/link/updateLinks', obj, {
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
@click="closeDrawer"
|
@click="closeDrawer"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<a-form ref="formRef" name="custom-validation" :model="state" :rules="rules" v-bind="layout"
|
||||||
|
@finish="handleFinish" @validate="handleValidate" @finishFailed="handleFinishFailed">
|
||||||
<div class="contentMain">
|
<div class="contentMain">
|
||||||
<div class="main_left">
|
<div class="main_left">
|
||||||
<div class="main_item">
|
<div class="main_item">
|
||||||
@@ -68,6 +70,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</a-form>
|
||||||
<div class="main_btns">
|
<div class="main_btns">
|
||||||
<button class="btn1" @click="closeDrawer">取消</button>
|
<button class="btn1" @click="closeDrawer">取消</button>
|
||||||
<button class="btn2" @click="createExternalChain">确定</button>
|
<button class="btn2" @click="createExternalChain">确定</button>
|
||||||
@@ -81,6 +84,7 @@ import * as api from "../../api/indexExternalChain";
|
|||||||
import * as apiTask from "../../api/indexTaskadd";
|
import * as apiTask from "../../api/indexTaskadd";
|
||||||
import { message } from "ant-design-vue";
|
import { message } from "ant-design-vue";
|
||||||
import { RouterEditTask } from "@/api/indexTask";
|
import { RouterEditTask } from "@/api/indexTask";
|
||||||
|
//import { query } from "express";
|
||||||
const rowSelection = ref({
|
const rowSelection = ref({
|
||||||
checkStrictly: false,
|
checkStrictly: false,
|
||||||
onChange: (selectedRowKeys, selectedRows) => {
|
onChange: (selectedRowKeys, selectedRows) => {
|
||||||
@@ -143,12 +147,111 @@ export default {
|
|||||||
state.inputV1 = "";
|
state.inputV1 = "";
|
||||||
state.textV1 = "";
|
state.textV1 = "";
|
||||||
};
|
};
|
||||||
|
const updateRef = () => {
|
||||||
|
// 如果是关卡页面进入 ---------------------------------
|
||||||
|
if (props.isLevel) {
|
||||||
|
if(props.isRefEdit){
|
||||||
|
createExternalRef();
|
||||||
|
|
||||||
|
}else{
|
||||||
|
updateExternalRef();
|
||||||
|
}
|
||||||
|
console.log('关卡创建任务***************');
|
||||||
|
} else { // 任务页面进入------------------------------
|
||||||
|
if (props.isRefEdit) { // 编辑任务
|
||||||
|
console.log('编辑任务***************');
|
||||||
|
updateExternalChain();
|
||||||
|
} else { // 创建任务
|
||||||
|
console.log('创建任务***************');
|
||||||
|
createExternalChain();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
const afterVisibleChange = (bool) => {
|
const afterVisibleChange = (bool) => {
|
||||||
console.log("state", bool);
|
console.log("state", bool);
|
||||||
|
queryRef();
|
||||||
|
};
|
||||||
|
const handleFinish = values => {
|
||||||
|
console.log(values);
|
||||||
|
updateRef(props.workId)
|
||||||
|
};
|
||||||
|
const handleFinishFailed = errors => {
|
||||||
|
console.log(errors);
|
||||||
|
// message.error("handleFinishFailed");
|
||||||
};
|
};
|
||||||
|
|
||||||
//创建外链
|
//创建外链
|
||||||
const createExternalChain = () => {
|
const createExternalChain = () => {
|
||||||
|
if (!state.inputV1) return message.warning("请输入外链名称");
|
||||||
|
if (!state.inputV2) return message.warning("请输入链接");
|
||||||
|
let obj = {
|
||||||
|
linkAddress: state.inputV2,
|
||||||
|
linkDescription: state.textV1,
|
||||||
|
linkId: props.EditRefId == null ? 0 : props.EditRefId,
|
||||||
|
linkName: state.inputV1,
|
||||||
|
};
|
||||||
|
//编辑外链
|
||||||
|
|
||||||
|
api
|
||||||
|
.createExternalChain(obj)
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res.data.data, "外链添加成功了");
|
||||||
|
message.success("提交成功");
|
||||||
|
closeDrawer();
|
||||||
|
|
||||||
|
//项目的创建
|
||||||
|
apiTask
|
||||||
|
.addTask({
|
||||||
|
courseId: res.data.data.linkId,
|
||||||
|
duration: 0,
|
||||||
|
flag: true,
|
||||||
|
name: obj.linkName,
|
||||||
|
projectId: props.projectId,
|
||||||
|
projectTaskId: 0,
|
||||||
|
stageId: props.chooseStageId,
|
||||||
|
type: 7,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
console.log("调用项目添加接口后111", res.data, 11111);
|
||||||
|
ctx.emit("changeData", false);
|
||||||
|
//重新获取任务列表
|
||||||
|
// apiTask.getTask({ projectId: 28 });
|
||||||
|
// router.push("/taskadd");
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err, 111111);
|
||||||
|
});
|
||||||
|
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
|
||||||
|
};
|
||||||
|
const updateExternalChain = () => {
|
||||||
|
if (!state.inputV1) return message.warning("请输入外链名称");
|
||||||
|
if (!state.inputV2) return message.warning("请输入链接");
|
||||||
|
let obj = {
|
||||||
|
|
||||||
|
linkAddress: state.inputV2,
|
||||||
|
linkDescription: state.textV1,
|
||||||
|
linkId: props.EditRefId == null ? 0 : props.EditRefId,
|
||||||
|
linkName: state.inputV1,
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//编辑外链
|
||||||
|
api
|
||||||
|
.updateLinks(obj)
|
||||||
|
.then((res) => {
|
||||||
|
console.log("编辑成功", res);
|
||||||
|
message.success("编辑成功");
|
||||||
|
closeDrawer();
|
||||||
|
})
|
||||||
|
.catch((err) => console.log(err));
|
||||||
|
|
||||||
|
};
|
||||||
|
const createExternalRef = () => {
|
||||||
if (!state.inputV1) return message.warning("请输入外链名称");
|
if (!state.inputV1) return message.warning("请输入外链名称");
|
||||||
if (!state.inputV2) return message.warning("请输入链接");
|
if (!state.inputV2) return message.warning("请输入链接");
|
||||||
let obj = {
|
let obj = {
|
||||||
@@ -163,8 +266,9 @@ export default {
|
|||||||
updateTime: "",
|
updateTime: "",
|
||||||
updateUser: 0,
|
updateUser: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
//编辑外链
|
//编辑外链
|
||||||
if (props.isRefEdit == 2) {
|
if (props.isRefEdit) {
|
||||||
api
|
api
|
||||||
.updateLinks(obj)
|
.updateLinks(obj)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@@ -229,6 +333,103 @@ export default {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
const updateExternalRef = () => {
|
||||||
|
if (!state.inputV1) return message.warning("请输入外链名称");
|
||||||
|
if (!state.inputV2) return message.warning("请输入链接");
|
||||||
|
let obj = {
|
||||||
|
createUser: 0,
|
||||||
|
createTime: "",
|
||||||
|
linkAddress: state.inputV2,
|
||||||
|
linkDescription: state.textV1,
|
||||||
|
linkFlag: "",
|
||||||
|
linkId: props.EditRefId == null ? 0 : props.EditRefId,
|
||||||
|
linkName: state.inputV1,
|
||||||
|
linkTag: "",
|
||||||
|
updateTime: "",
|
||||||
|
updateUser: 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
//编辑外链
|
||||||
|
if (props.isRefEdit) {
|
||||||
|
api
|
||||||
|
.updateLinks(obj)
|
||||||
|
.then((res) => {
|
||||||
|
console.log("编辑成功", res);
|
||||||
|
message.success("编辑成功");
|
||||||
|
closeDrawer();
|
||||||
|
})
|
||||||
|
.catch((err) => console.log(err));
|
||||||
|
} else {
|
||||||
|
api
|
||||||
|
.createExternalChain(obj)
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res.data.data, "外链添加成功了");
|
||||||
|
message.success("提交成功");
|
||||||
|
closeDrawer();
|
||||||
|
//学习路径的创建
|
||||||
|
if (props.isStudy == 1) {
|
||||||
|
let objj = {
|
||||||
|
chapterId: 36,
|
||||||
|
courseId: 0,
|
||||||
|
duration: 0,
|
||||||
|
flag: true,
|
||||||
|
name: obj.linkName,
|
||||||
|
routerId: 92,
|
||||||
|
routerTaskId: 0,
|
||||||
|
type: 7,
|
||||||
|
};
|
||||||
|
RouterEditTask(objj)
|
||||||
|
.then((res) => {
|
||||||
|
console.log(res, 11111);
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err, 1111);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
//项目的创建
|
||||||
|
apiTask
|
||||||
|
.addTask({
|
||||||
|
courseId: res.data.data.linkId,
|
||||||
|
duration: 0,
|
||||||
|
flag: true,
|
||||||
|
name: obj.linkName,
|
||||||
|
projectId: props.projectId,
|
||||||
|
projectTaskId: 0,
|
||||||
|
stageId: props.chooseStageId,
|
||||||
|
type: 7,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
console.log("调用项目添加接口后111", res.data, 11111);
|
||||||
|
ctx.emit("changeData", false);
|
||||||
|
//重新获取任务列表
|
||||||
|
// apiTask.getTask({ projectId: 28 });
|
||||||
|
// router.push("/taskadd");
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err, 111111);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// 查询任务
|
||||||
|
const queryRef = () => {
|
||||||
|
let p =new FormData;
|
||||||
|
p.append('linkId',props.EditRefId);
|
||||||
|
api
|
||||||
|
.getLink(p).then((res) => {
|
||||||
|
// console.log(dayjs(res.data.data.submitStartTime).format("YYYY-MM-DD"));
|
||||||
|
state.inputV1 = res.data.data.linkName;
|
||||||
|
state.inputV2 =res.data.data.linkAddress;
|
||||||
|
state.textV1 =res.data.data.linkDescription;
|
||||||
|
console.log("查询成功=====inputv1",state.inputV1);
|
||||||
|
}).catch(() => {
|
||||||
|
message.error(`查询失败`)
|
||||||
|
})
|
||||||
|
};
|
||||||
//不生效
|
//不生效
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
state.title = props.isRefEdit == 2 ? "编辑" : "添加";
|
state.title = props.isRefEdit == 2 ? "编辑" : "添加";
|
||||||
@@ -239,6 +440,9 @@ export default {
|
|||||||
closeDrawer,
|
closeDrawer,
|
||||||
rowSelection,
|
rowSelection,
|
||||||
createExternalChain,
|
createExternalChain,
|
||||||
|
handleFinish,
|
||||||
|
handleFinishFailed,
|
||||||
|
updateRef,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -183,6 +183,7 @@
|
|||||||
v-model:chooseStageId="chooseStageId"
|
v-model:chooseStageId="chooseStageId"
|
||||||
v-model:isLiveEdit="isLiveEdit"
|
v-model:isLiveEdit="isLiveEdit"
|
||||||
v-model:EditLiveId="EditLiveId"
|
v-model:EditLiveId="EditLiveId"
|
||||||
|
v-model:projectTaskId="projectTaskId"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 添加直播侧弹窗 -->
|
<!-- 添加直播侧弹窗 -->
|
||||||
@@ -199,11 +200,13 @@
|
|||||||
<div>
|
<div>
|
||||||
<add-ref
|
<add-ref
|
||||||
v-model:addrefVisible="addrefvisible"
|
v-model:addrefVisible="addrefvisible"
|
||||||
|
:isLevel=false
|
||||||
@changeData="updateTableData"
|
@changeData="updateTableData"
|
||||||
v-model:projectId="projectId"
|
v-model:projectId="projectId"
|
||||||
v-model:chooseStageId="chooseStageId"
|
v-model:chooseStageId="chooseStageId"
|
||||||
v-model:isRefEdit="isRefEdit"
|
v-model:isRefEdit="isRefEdit"
|
||||||
v-model:EditRefId="EditRefId"
|
v-model:EditRefId="EditRefId"
|
||||||
|
v-model:projectTaskId="projectTaskId"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 添加外链侧弹窗 -->
|
<!-- 添加外链侧弹窗 -->
|
||||||
@@ -857,8 +860,8 @@ export default {
|
|||||||
: null,
|
: null,
|
||||||
chooseStageId: null,
|
chooseStageId: null,
|
||||||
edit: false,
|
edit: false,
|
||||||
isRefEdit: 1, //外链编辑
|
isRefEdit: false, //外链编辑
|
||||||
isLiveEdit: 1, //直播编辑
|
isLiveEdit:false, //直播编辑
|
||||||
EditRefId: null, //要编辑的外链的id
|
EditRefId: null, //要编辑的外链的id
|
||||||
EditLiveId: null, //要编辑的直播的id
|
EditLiveId: null, //要编辑的直播的id
|
||||||
editDiscussId:null,//要编辑的讨论的id
|
editDiscussId:null,//要编辑的讨论的id
|
||||||
@@ -1694,7 +1697,9 @@ export default {
|
|||||||
const showDrawerAddLive = () => {
|
const showDrawerAddLive = () => {
|
||||||
state.addlivevisible = true;
|
state.addlivevisible = true;
|
||||||
};
|
};
|
||||||
const showDrawerAddRef = () => {
|
const showDrawerAddRef = (id,eleId) => {
|
||||||
|
state.EditRefId = id
|
||||||
|
state.projectTaskId = eleId;
|
||||||
state.addrefvisible = true;
|
state.addrefvisible = true;
|
||||||
};
|
};
|
||||||
const showDrawerAddDiscuss = () => {
|
const showDrawerAddDiscuss = () => {
|
||||||
@@ -1804,7 +1809,7 @@ export default {
|
|||||||
//打开编辑外链的弹窗
|
//打开编辑外链的弹窗
|
||||||
const showEditRefDrawer = (id) => {
|
const showEditRefDrawer = (id) => {
|
||||||
state.addrefvisible = true;
|
state.addrefvisible = true;
|
||||||
state.isRefEdit = 2;
|
state.isRefEdit = true;
|
||||||
state.EditRefId = id;
|
state.EditRefId = id;
|
||||||
};
|
};
|
||||||
//打开编辑直播的弹窗
|
//打开编辑直播的弹窗
|
||||||
|
|||||||
Reference in New Issue
Block a user