feat:添加讨论,添加活动,新建关卡接口对接

This commit is contained in:
岳佳鑫
2022-10-31 18:25:36 +08:00
parent a9d78e9c7c
commit f4fed29376
6 changed files with 170 additions and 37 deletions

19
src/api/activity.js Normal file
View File

@@ -0,0 +1,19 @@
import http from "./config";
//获取活动信息接口
export const getActivity = (obj) => http.get('/activity', { params: obj });
//创建活动接口
export const createActivity = (obj) => http.post('/activity/createActivity', obj);
//删除活动接口
export const deleteActivity = (obj) => http.post('/activity/deleteActivity', { params: obj });
//修改活动接口
export const updateActivity = (obj) => http.post('/activity/updateActivity', obj);
//修改活动是否为必修接口
export const updateActivityToCompulsory = (obj) => http.post('/activity/updateActivityToCompulsory', { params: obj });
//修改活动是否为选修接口
export const updateActivityToElective = (obj) => http.post('/activity/updateActivityToElective', { params: obj });

13
src/api/discuss.js Normal file
View File

@@ -0,0 +1,13 @@
import http from "./config";
//创建讨论
export const createDiscuss = (obj) => http.post('/discuss/createDiscuss', obj);
//获取讨论信息接口
export const getDiscussDetail = (obj) => http.post('/discuss/getDiscussDetail', { params: obj });
//删除讨论接口
export const deleteDiscuss = (obj) => http.post('/discuss/deleteDiscuss', { params: obj });
//修改讨论接口
export const updateDiscuss = (obj) => http.post('/discuss/updateDiscuss', { params: obj });

8
src/api/level.js Normal file
View File

@@ -0,0 +1,8 @@
import http from "./config";
//新建或编辑关卡
export const editChapter = (obj) => http.post('/admin/router/editChapter', obj, {
headers: {
'token': '123'
}
});

View File

@@ -65,6 +65,7 @@
v-model:value="textV2" v-model:value="textV2"
placeholder="请输入活动说明" placeholder="请输入活动说明"
allow-clear allow-clear
maxlength="150"
/> />
</div> </div>
</div> </div>
@@ -75,6 +76,7 @@
<div class="btnbox"> <div class="btnbox">
<a-range-picker <a-range-picker
style="width: 424px" style="width: 424px"
v-model:value="time"
:placeholder="[' 开始时间', ' 结束时间']" :placeholder="[' 开始时间', ' 结束时间']"
/> />
</div> </div>
@@ -208,13 +210,15 @@
</div> </div>
<div class="main_btns"> <div class="main_btns">
<button class="btn1">取消</button> <button class="btn1">取消</button>
<button class="btn2">确定</button> <button class="btn2" @click="createActivity">确定</button>
</div> </div>
</div> </div>
</a-drawer> </a-drawer>
</template> </template>
<script> <script>
import { reactive, toRefs, ref } from "vue"; import { reactive, toRefs, ref } from "vue";
import * as api from "../../api/activity";
import { message } from "ant-design-vue";
const rowSelection = ref({ const rowSelection = ref({
checkStrictly: false, checkStrictly: false,
onChange: (selectedRowKeys, selectedRows) => { onChange: (selectedRowKeys, selectedRows) => {
@@ -252,6 +256,7 @@ export default {
textV1: "", textV1: "",
textV2: "", textV2: "",
radioV1: "", radioV1: "",
time: "",
}); });
const closeDrawer = () => { const closeDrawer = () => {
ctx.emit("update:addactiveVisible", false); ctx.emit("update:addactiveVisible", false);
@@ -265,12 +270,50 @@ export default {
state.radioV1 = ""; state.radioV1 = "";
} }
}; };
//创建活动
const createActivity = () => {
if(!state.inputV1) return message.info("请输入活动名称");
if(!state.inputV2) return message.info("请输入活动时长");
if(!state.textV1) return message.info("请输入活动公告");
if(!state.inputV3) return message.info("请输入活动地址");
let obj = {
activityAddress: state.inputV3, //活动地址
activityDuration: state.inputV2, //活动时长
activityEndTime: "", //活动结束时间
activityId: 0, //活动ID
activityName: state.inputV1, //活动名称
activityNotice: state.textV1, //活动公告
activityStartTime: "", //活动开始时间
activityTag: "", //活动逻辑删除标识
afterSignIn: state.inputV5, //活动开始后多少分钟签到
beforeSignIn: state.inputV4, //活动开始前多少分钟签到
createTime: "", //创建时间
createUser: 0, //创建人
signOutTime: state.inputV6, //签退开始时间
standardSettings: state.radioV1, //标准设置
updateTime: "", //更新时间
updateUser: 0, //更新人
};
api
.createActivity(obj)
.then((res) => {
setTimeout(() => {
console.log("创建成功", res);
message.success("创建成功");
}, 1000);
})
.catch((err) => {
console.log("创建失败",err);
})
};
return { return {
...toRefs(state), ...toRefs(state),
afterVisibleChange, afterVisibleChange,
closeDrawer, closeDrawer,
rowSelection, rowSelection,
cloradio1, cloradio1,
createActivity,
}; };
}, },
}; };

View File

@@ -33,7 +33,8 @@
v-model:value="inputV1" v-model:value="inputV1"
style="width: 424px; height: 32px" style="width: 424px; height: 32px"
placeholder="请输入讨论名称" placeholder="请输入讨论名称"
maxlength="20" show-count
:maxlength="20"
/> />
</div> </div>
</div> </div>
@@ -46,6 +47,8 @@
v-model:value="textV1" v-model:value="textV1"
placeholder="请输入讨论说明" placeholder="请输入讨论说明"
allow-clear allow-clear
show-count
:maxlength="200"
/> />
</div> </div>
</div> </div>
@@ -61,13 +64,15 @@
</div> </div>
<div class="main_btns"> <div class="main_btns">
<button class="btn1">取消</button> <button class="btn1">取消</button>
<button class="btn2">确定</button> <button class="btn2" @click="createDiscuss">确定</button>
</div> </div>
</div> </div>
</a-drawer> </a-drawer>
</template> </template>
<script> <script>
import { reactive, toRefs, ref } from "vue"; import { reactive, toRefs, ref } from "vue";
import * as api from "../../api/discuss";
import { message } from "ant-design-vue";
const rowSelection = ref({ const rowSelection = ref({
checkStrictly: false, checkStrictly: false,
onChange: (selectedRowKeys, selectedRows) => { onChange: (selectedRowKeys, selectedRows) => {
@@ -103,15 +108,47 @@ export default {
}); });
const closeDrawer = () => { const closeDrawer = () => {
ctx.emit("update:adddiscussVisible", false); ctx.emit("update:adddiscussVisible", false);
state.inputV1 = "";
state.textV2 = "";
}; };
const afterVisibleChange = (bool) => { const afterVisibleChange = (bool) => {
console.log("state", bool); console.log("state", bool);
}; };
//创建讨论
const createDiscuss = () => {
if(!state.inputV1) return message.info("请输入讨论名称");
let obj = {
discussName: state.inputV1, //讨论名称
discussExplain: state.textV1, //讨论说明
discussSettings: state.checkedC1, //讨论设置
createTime: "", //创建时间
createUser: 0, //创建人
discussFlag: "", //活动逻辑删除标识
discussId: 0, //讨论Id
discussTag: "", //是否必修的标识
updateTime: "", //更新时间
updateUser: 0, //更新人
projectId: 0, //项目id
};
api
.createDiscuss(obj)
.then((res) => {
setTimeout(() => {
console.log("创建成功", res);
message.success("创建成功");
}, 1000);
})
.catch((err) => {
console.log("创建失败", err);
});
};
return { return {
...toRefs(state), ...toRefs(state),
afterVisibleChange, afterVisibleChange,
closeDrawer, closeDrawer,
rowSelection, rowSelection,
createDiscuss,
}; };
}, },
}; };
@@ -160,6 +197,9 @@ export default {
display: flex; display: flex;
flex: 1; flex: 1;
align-items: center; align-items: center;
.ant-input {
height: 100%;
}
.xkbtn { .xkbtn {
cursor: pointer; cursor: pointer;
width: 130px; width: 130px;
@@ -185,39 +225,21 @@ export default {
margin-right: 5px; margin-right: 5px;
} }
} }
.kqszbox { .textarea {
.qdqtbox { width: 423px;
margin-left: 56px; .ant-input {
width: 100%;
} }
.setbox { .ant-input-textarea-show-count {
display: flex; position: relative;
flex-wrap: wrap;
margin-top: 10px;
margin-bottom: 24px;
.timerbox {
margin-top: 6px;
margin-right: 32px;
display: flex;
align-items: center;
flex-wrap: nowrap;
} }
.ant-input-textarea-show-count::after {
position: absolute;
right: 10px;
bottom: 0px;
} }
} .ant-input {
.btnbox2 {
display: flex;
flex-direction: column;
justify-content: flex-start;
.xkbtn {
cursor: pointer;
width: 130px;
height: 40px;
background: #388be1;
border-radius: 8px; border-radius: 8px;
border: 0;
margin-right: 16px 8px 32px 0;
color: #fff;
margin-top: 16px;
margin-bottom: 60px;
} }
} }
} }

View File

@@ -86,7 +86,7 @@
</div> </div>
<div class="btn"> <div class="btn">
<button class="btn1">取消</button> <button class="btn1">取消</button>
<button class="btn2">确定</button> <button class="btn2" @click="editChapter">确定</button>
</div> </div>
</div> </div>
</div> </div>
@@ -504,6 +504,8 @@
import { reactive, toRefs, onMounted, onUnmounted } from "vue"; import { reactive, toRefs, onMounted, onUnmounted } from "vue";
import AddStu from "../../components/drawers/AddLevelAddStu"; import AddStu from "../../components/drawers/AddLevelAddStu";
import ImpStu from "../../components/drawers/AddLevelImportStu"; import ImpStu from "../../components/drawers/AddLevelImportStu";
import * as api from "../../api/level";
import { message } from "ant-design-vue";
export default { export default {
name: "LevelAddDetail", name: "LevelAddDetail",
components: { components: {
@@ -808,11 +810,36 @@ export default {
isActive: false, isActive: false,
projectChecked: null, //项目单选框 projectChecked: null, //项目单选框
}); });
//新建或编辑关卡
const editChapter = () => {
let obj = {
name: state.value1,
remark: state.value2,
routerId: 0,
};
api
.editChapter(obj)
.then((res) => {
setTimeout(() => {
console.log("创建成功", res);
message.success("创建成功");
// state.createLoading = false;
//state.currentPage = 1;
// getLearnPath();
}, 1000);
})
.catch((err) => {
console.log("创建失败", err);
});
}
const showDrawer = () => { const showDrawer = () => {
state.visible = true; state.visible = true;
}; };
const closeDrawer = () => { const closeDrawer = () => {
state.visible = false; state.visible = false;
state.value1 = "";
state.value2 = "";
}; };
const showModal = () => { const showModal = () => {
state.modal = true; state.modal = true;
@@ -1164,6 +1191,7 @@ export default {
showDeleteALLModal, showDeleteALLModal,
delete_exit, delete_exit,
drawertableColumns, drawertableColumns,
editChapter,
}; };
}, },
}; };