mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-12 20:36:45 +08:00
feat:外链编辑弹窗
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
:visible="addrefVisible"
|
||||
class="drawerStyle addrefDrawer"
|
||||
width="80%"
|
||||
title="添加外链"
|
||||
placement="right"
|
||||
@after-visible-change="afterVisibleChange"
|
||||
>
|
||||
@@ -77,7 +76,7 @@
|
||||
</a-drawer>
|
||||
</template>
|
||||
<script>
|
||||
import { reactive, toRefs, ref } from "vue";
|
||||
import { reactive, toRefs, ref, onMounted } from "vue";
|
||||
import * as api from "../../api/indexExternalChain";
|
||||
import * as apiTask from "../../api/indexTaskadd";
|
||||
import { message } from "ant-design-vue";
|
||||
@@ -123,17 +122,22 @@ export default {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
EditRefId: {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
setup(props, ctx) {
|
||||
const state = reactive({
|
||||
inputV1: "",
|
||||
inputV2: "",
|
||||
textV1: "",
|
||||
title: props.isRefEdit == 2 ? "编辑" : "添加",
|
||||
title: null,
|
||||
});
|
||||
const closeDrawer = () => {
|
||||
console.log(props, 1111);
|
||||
ctx.emit("update:addrefVisible", false);
|
||||
ctx.emit("update:isRefEdit", 1);
|
||||
console.log("props", props.routerId);
|
||||
state.inputV2 = "";
|
||||
state.inputV1 = "";
|
||||
@@ -142,7 +146,7 @@ export default {
|
||||
const afterVisibleChange = (bool) => {
|
||||
console.log("state", bool);
|
||||
};
|
||||
//编辑外链
|
||||
|
||||
//创建外链
|
||||
const createExternalChain = () => {
|
||||
if (!state.inputV1) return message.warning("请输入外链名称");
|
||||
@@ -153,66 +157,82 @@ export default {
|
||||
linkAddress: state.inputV2,
|
||||
linkDescription: state.textV1,
|
||||
linkFlag: "",
|
||||
linkId: 0,
|
||||
linkId: props.EditRefId == null ? 0 : props.EditRefId,
|
||||
linkName: state.inputV1,
|
||||
linkTag: "",
|
||||
updateTime: "",
|
||||
updateUser: 0,
|
||||
};
|
||||
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({
|
||||
//编辑外链
|
||||
if (props.isRefEdit == 2) {
|
||||
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,
|
||||
projectId: props.projectId,
|
||||
projectTaskId: 0,
|
||||
stageId: props.chooseStageId,
|
||||
routerId: 92,
|
||||
routerTaskId: 0,
|
||||
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);
|
||||
});
|
||||
};
|
||||
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);
|
||||
});
|
||||
}
|
||||
};
|
||||
//不生效
|
||||
onMounted(() => {
|
||||
state.title = props.isRefEdit == 2 ? "编辑" : "添加";
|
||||
});
|
||||
return {
|
||||
...toRefs(state),
|
||||
afterVisibleChange,
|
||||
|
||||
Reference in New Issue
Block a user