mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-12 04:16:47 +08:00
添加传参方法
This commit is contained in:
@@ -9,15 +9,14 @@
|
||||
>
|
||||
<div class="drawerMain">
|
||||
<div class="header">
|
||||
|
||||
<div class="headerTitle">{{edit?'编辑':'添加'}}活动</div>
|
||||
<div class="headerTitle">{{ edit ? "编辑" : "添加" }}活动</div>
|
||||
<img
|
||||
style="width: 29px; height: 29px; cursor: pointer"
|
||||
src="../../assets/images/basicinfo/close.png"
|
||||
@click="closeDrawer"
|
||||
/>
|
||||
</div>
|
||||
<div class="contentMain">
|
||||
<div class="contentMain">
|
||||
<div class="main_left">
|
||||
<div class="main_item">
|
||||
<div class="signbox">
|
||||
@@ -72,7 +71,7 @@
|
||||
</div>
|
||||
<div class="main_item">
|
||||
<div class="signbox">
|
||||
<div class="sign">
|
||||
<div class="sign">
|
||||
<img
|
||||
src="@/assets/images/coursewareManage/asterisk.png"
|
||||
alt=""
|
||||
@@ -214,11 +213,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="main_btns">
|
||||
<button class="btn1" @click="closeDrawer">取消</button>
|
||||
<button class="btn2" @click="updateActivityInfo">确定</button>
|
||||
</div>
|
||||
<button class="btn1" @click="closeDrawer">取消</button>
|
||||
<button class="btn2" @click="updateActivityInfo">确定</button>
|
||||
</div>
|
||||
</div>
|
||||
</a-drawer>
|
||||
</template>
|
||||
@@ -226,9 +225,9 @@
|
||||
import { reactive, toRefs, ref } from "vue";
|
||||
import * as api from "../../api/indexActivity";
|
||||
import * as apiTask from "../../api/indexTaskadd";
|
||||
import { RouterEditTask } from "@/api/indexTask"
|
||||
import { RouterEditTask } from "@/api/indexTask";
|
||||
import { message } from "ant-design-vue";
|
||||
import dayjs from 'dayjs';
|
||||
import dayjs from "dayjs";
|
||||
const rowSelection = ref({
|
||||
checkStrictly: false,
|
||||
onChange: (selectedRowKeys, selectedRows) => {
|
||||
@@ -258,7 +257,8 @@ export default {
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
edit: { // 是否为编辑
|
||||
edit: {
|
||||
// 是否为编辑
|
||||
type: Boolean,
|
||||
default: null,
|
||||
},
|
||||
@@ -274,15 +274,18 @@ export default {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
isLevel: { // 是否是关卡页面触发
|
||||
isLevel: {
|
||||
// 是否是关卡页面触发
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
EditWorkId: { // 要编辑的workId
|
||||
EditWorkId: {
|
||||
// 要编辑的workId
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
projectTaskId: { // 要编辑的projectId
|
||||
projectTaskId: {
|
||||
// 要编辑的projectId
|
||||
type: Number,
|
||||
default: null,
|
||||
},
|
||||
@@ -293,7 +296,7 @@ export default {
|
||||
isactive: {
|
||||
type: Number,
|
||||
default: null,
|
||||
}
|
||||
},
|
||||
},
|
||||
setup(props, ctx) {
|
||||
//console.log("学习路径",props.isStudiscuss);
|
||||
@@ -322,35 +325,46 @@ export default {
|
||||
state.textV1 = "";
|
||||
state.textV2 = "";
|
||||
state.time = "";
|
||||
message.success(`${props.edit ? '编辑' : '新增'}关卡任务成功`)
|
||||
|
||||
message.success(`${props.edit ? "编辑" : "新增"}关卡任务成功`);
|
||||
localStorage.setItem("stageId", props.chooseStageId);
|
||||
localStorage.setItem("chapterId", props.isactive);
|
||||
};
|
||||
const queryActive = () => {
|
||||
console.log("props.EditActiveId======",props.EditActiveId,props.chooseStageId,props.routerTaskId);
|
||||
api.getActivity(props.EditActiveId).then(res => {
|
||||
console.log('获取讨论信息成功',res.data.data.standardSettings)
|
||||
|
||||
console.log(
|
||||
"props.EditActiveId======",
|
||||
props.EditActiveId,
|
||||
props.chooseStageId,
|
||||
props.routerTaskId
|
||||
);
|
||||
api
|
||||
.getActivity(props.EditActiveId)
|
||||
.then((res) => {
|
||||
console.log("获取讨论信息成功", res.data.data.standardSettings);
|
||||
|
||||
//更新讨论信息
|
||||
state.inputV1 = res.data.data.activityName;
|
||||
state.inputV1 = res.data.data.activityName;
|
||||
state.textV1 = res.data.data.activityNotice;
|
||||
state.textV2 = res.data.data.activityExplain;
|
||||
state.inputV2 = res.data.data.activityDuration;
|
||||
state.inputV3 = res.data.data.activityAddress;
|
||||
state.inputV5 = res.data.data.afterSignIn;
|
||||
state.inputV6 =res.data.data.signOutTime;
|
||||
state.inputV6 = res.data.data.signOutTime;
|
||||
state.inputV4 = res.data.data.beforeSignIn;
|
||||
state.radioV1 = Number(res.data.data.standardSettings);
|
||||
|
||||
state.time = [dayjs(res.data.data.activityStartTime, "YYYY-MM-DD"), dayjs(res.data.data.activityEndTime, "YYYY-MM-DD")]
|
||||
}).catch(err=>{
|
||||
console.log('获取讨论信息失败',err)
|
||||
|
||||
state.time = [
|
||||
dayjs(res.data.data.activityStartTime, "YYYY-MM-DD"),
|
||||
dayjs(res.data.data.activityEndTime, "YYYY-MM-DD"),
|
||||
];
|
||||
})
|
||||
}
|
||||
.catch((err) => {
|
||||
console.log("获取讨论信息失败", err);
|
||||
});
|
||||
};
|
||||
const afterVisibleChange = (bool) => {
|
||||
if(bool && props.edit){
|
||||
if (bool && props.edit) {
|
||||
queryActive();
|
||||
}
|
||||
|
||||
};
|
||||
const cloradio1 = (value) => {
|
||||
if (value != "") {
|
||||
@@ -358,109 +372,109 @@ export default {
|
||||
}
|
||||
};
|
||||
const updateTask = (res) => {
|
||||
if(props.isLevel == 1 ){
|
||||
if (props.isLevel == 1) {
|
||||
RouterEditTask({
|
||||
chapterId:props.isactive,
|
||||
courseId: res.data.data.activityId,
|
||||
duration: res.data.data.activityDuration,
|
||||
name: res.data.data.activityName,
|
||||
routerId: props.routerId,
|
||||
routerTaskId: props.routerTaskId ||0,
|
||||
type: 9,
|
||||
}).then(res => {
|
||||
console.log("新增关卡任务成功",res);
|
||||
|
||||
}).catch(err => {
|
||||
console.log("新增关卡任务失败",err);
|
||||
chapterId: props.isactive,
|
||||
courseId: res.data.data.activityId,
|
||||
duration: res.data.data.activityDuration,
|
||||
name: res.data.data.activityName,
|
||||
routerId: props.routerId,
|
||||
routerTaskId: props.routerTaskId || 0,
|
||||
type: 9,
|
||||
})
|
||||
.then((res) => {
|
||||
console.log("新增关卡任务成功", res);
|
||||
})
|
||||
}else if(props.isLevel==2){
|
||||
apiTask.addTask({
|
||||
.catch((err) => {
|
||||
console.log("新增关卡任务失败", err);
|
||||
});
|
||||
} else if (props.isLevel == 2) {
|
||||
apiTask
|
||||
.addTask({
|
||||
courseId: res.data.data.activityId,
|
||||
duration: res.data.data.activityDuration,
|
||||
name: res.data.data.activityName,
|
||||
projectId: props.projectId,
|
||||
projectTaskId: props.projectTaskId ||0,
|
||||
stageId:props.chooseStageId,
|
||||
projectTaskId: props.projectTaskId || 0,
|
||||
stageId: props.chooseStageId,
|
||||
type: 9,
|
||||
}).then((res)=> {
|
||||
console.log("更新任务列表成功",res);
|
||||
|
||||
})
|
||||
.catch((err)=> {
|
||||
console.log("更新任务列表失败",err);
|
||||
.then((res) => {
|
||||
console.log("更新任务列表成功", res);
|
||||
})
|
||||
}else if(props.isLevel == 3){
|
||||
.catch((err) => {
|
||||
console.log("更新任务列表失败", err);
|
||||
});
|
||||
} else if (props.isLevel == 3) {
|
||||
console.log("模板库更新更新任务列表");
|
||||
}
|
||||
}
|
||||
};
|
||||
//创建活动
|
||||
const updateActivityInfo = () => {
|
||||
if(!state.inputV1){
|
||||
if (!state.inputV1) {
|
||||
message.destroy();
|
||||
return message.warning("请输入活动名称");
|
||||
}
|
||||
if(!state.textV1){
|
||||
}
|
||||
if (!state.textV1) {
|
||||
message.destroy();
|
||||
return message.warning("请输入活动公告");
|
||||
}
|
||||
if(!state.time){
|
||||
}
|
||||
if (!state.time) {
|
||||
message.destroy();
|
||||
return message.warning("请输入活动时间");
|
||||
}
|
||||
if(!state.inputV2){
|
||||
}
|
||||
if (!state.inputV2) {
|
||||
message.destroy();
|
||||
return message.warning("请输入活动时长");
|
||||
}
|
||||
if(!state.inputV3){
|
||||
}
|
||||
if (!state.inputV3) {
|
||||
message.destroy();
|
||||
return message.warning("请输入活动地址");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
let obj = {
|
||||
activityAddress: state.inputV3, //活动地址
|
||||
activityDuration: state.inputV2, //活动时长
|
||||
activityExplain: state.textV2, //活动说明
|
||||
activityEndTime: dayjs(state.time[1]).format("YYYY-MM-DD"), //活动结束时间
|
||||
activityId: props.edit?props.EditActiveId:0, //活动ID
|
||||
activityName: state.inputV1, //活动名称
|
||||
activityNotice: state.textV1, //活动公告
|
||||
activityStartTime:dayjs(state.time[0]).format("YYYY-MM-DD"),//活动开始时间
|
||||
activityTag: "", //活动逻辑删除标识
|
||||
afterSignIn: state.inputV5, //活动开始后多少分钟签到
|
||||
beforeSignIn: state.inputV4, //活动开始前多少分钟签到
|
||||
signOutTime: state.inputV6, //签退开始时间
|
||||
standardSettings: state.radioV1, //标准设置
|
||||
|
||||
activityAddress: state.inputV3, //活动地址
|
||||
activityDuration: state.inputV2, //活动时长
|
||||
activityExplain: state.textV2, //活动说明
|
||||
activityEndTime: dayjs(state.time[1]).format("YYYY-MM-DD"), //活动结束时间
|
||||
activityId: props.edit ? props.EditActiveId : 0, //活动ID
|
||||
activityName: state.inputV1, //活动名称
|
||||
activityNotice: state.textV1, //活动公告
|
||||
activityStartTime: dayjs(state.time[0]).format("YYYY-MM-DD"), //活动开始时间
|
||||
activityTag: "", //活动逻辑删除标识
|
||||
afterSignIn: state.inputV5, //活动开始后多少分钟签到
|
||||
beforeSignIn: state.inputV4, //活动开始前多少分钟签到
|
||||
signOutTime: state.inputV6, //签退开始时间
|
||||
standardSettings: state.radioV1, //标准设置
|
||||
};
|
||||
if(props.edit){
|
||||
if (props.edit) {
|
||||
//更新编辑活动信息
|
||||
api
|
||||
.updateActivity(obj)
|
||||
.then((res) => {
|
||||
closeDrawer();
|
||||
updateTask(res);
|
||||
ctx.emit("changeData", false);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("更新失败",err);
|
||||
})
|
||||
}else{
|
||||
.updateActivity(obj)
|
||||
.then((res) => {
|
||||
closeDrawer();
|
||||
updateTask(res);
|
||||
ctx.emit("changeData", false);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("更新失败", err);
|
||||
});
|
||||
} else {
|
||||
//新建活动信息
|
||||
api
|
||||
.createActivity(obj)
|
||||
.then((res) => {
|
||||
.createActivity(obj)
|
||||
.then((res) => {
|
||||
message.success("创建成功");
|
||||
closeDrawer();
|
||||
updateTask(res);
|
||||
ctx.emit("changeData", false);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("创建失败",err);
|
||||
})
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("创建失败", err);
|
||||
});
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
return {
|
||||
...toRefs(state),
|
||||
afterVisibleChange,
|
||||
@@ -505,7 +519,7 @@ export default {
|
||||
border-radius: 8px;
|
||||
}
|
||||
.main_left {
|
||||
margin-top:32px;
|
||||
margin-top: 32px;
|
||||
padding-right: 30px;
|
||||
flex: 1;
|
||||
border-right: 1px solid #e8e8e8;
|
||||
|
||||
Reference in New Issue
Block a user