feat:添加讨论和添加活动接口对接

This commit is contained in:
岳佳鑫
2022-11-01 11:27:14 +08:00
parent 88cbb07567
commit 2172900d7e
6 changed files with 58 additions and 23 deletions

View File

@@ -120,7 +120,7 @@
<a-input
v-model:value="inputV3"
style="width: 424px; height: 32px"
placeholder="请输入授课老师"
placeholder="请输入活动地址"
/>
</div>
</div>
@@ -145,7 +145,7 @@
border-radius: 8px;
overflow: hidden;
"
:v-model:value="inputV4"
v-model:value="inputV4"
/>
<span style="color: #999999; margin-left: 8px">分钟</span>
</div>
@@ -161,7 +161,7 @@
border-radius: 8px;
overflow: hidden;
"
:v-model:value="inputV5"
v-model:value="inputV5"
/>
<span style="color: #999999; margin-left: 8px">分钟</span>
</div>
@@ -182,7 +182,7 @@
border-radius: 8px;
overflow: hidden;
"
:v-model:value="inputV6"
v-model:value="inputV6"
/>
<span style="color: #999999; margin-left: 8px"
>分钟提前签退则记为早退</span
@@ -209,7 +209,7 @@
</div>
</div>
<div class="main_btns">
<button class="btn1">取消</button>
<button class="btn1" @click="closeDrawer">取消</button>
<button class="btn2" @click="createActivity">确定</button>
</div>
</div>
@@ -217,8 +217,9 @@
</template>
<script>
import { reactive, toRefs, ref } from "vue";
import * as api from "../../api/activity";
import * as api from "../../api/indexActivity";
import { message } from "ant-design-vue";
import { toDate } from "../../api/method.js";
const rowSelection = ref({
checkStrictly: false,
onChange: (selectedRowKeys, selectedRows) => {
@@ -261,6 +262,15 @@ export default {
const closeDrawer = () => {
ctx.emit("update:addactiveVisible", false);
state.radioV1 = "";
state.inputV1 = "";
state.inputV2 = "";
state.inputV3 = "";
state.inputV4 = "";
state.inputV5 = "";
state.inputV6 = "";
state.textV1 = "";
state.textV2 = "";
state.time = "";
};
const afterVisibleChange = (bool) => {
console.log("state", bool);
@@ -273,18 +283,21 @@ export default {
//创建活动
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("请输入活动地址");
if(!state.inputV1) return message.warning("请输入活动名称");
if(!state.inputV2) return message.warning("请输入活动时长");
if(!state.textV1) return message.warning("请输入活动公告");
if(!state.inputV3) return message.warning("请输入活动地址");
let startTime = toDate(new Date(state.time[0].$d).getTime() / 1000, "Y-M-D");
let endTime = toDate(new Date(state.time[1].$d).getTime() / 1000, "Y-M-D");
let obj = {
activityAddress: state.inputV3, //活动地址
activityDuration: state.inputV2, //活动时长
activityEndTime: "", //活动结束时间
activityExplain: state.textV2, //活动说明
activityEndTime: endTime, //活动结束时间
activityId: 0, //活动ID
activityName: state.inputV1, //活动名称
activityNotice: state.textV1, //活动公告
activityStartTime: "", //活动开始时间
activityStartTime: startTime, //活动开始时间
activityTag: "", //活动逻辑删除标识
afterSignIn: state.inputV5, //活动开始后多少分钟签到
beforeSignIn: state.inputV4, //活动开始前多少分钟签到
@@ -301,6 +314,17 @@ export default {
setTimeout(() => {
console.log("创建成功", res);
message.success("创建成功");
state.radioV1 = "";
state.inputV1 = "";
state.inputV2 = "";
state.inputV3 = "";
state.inputV4 = "";
state.inputV5 = "";
state.inputV6 = "";
state.textV1 = "";
state.textV2 = "";
state.time = "";
ctx.emit("update:addactiveVisible", false);
}, 1000);
})
.catch((err) => {
@@ -341,6 +365,9 @@ export default {
.contentMain {
display: flex;
justify-content: space-between;
.ant-picker {
border-radius: 8px;
}
.main_left {
padding-right: 30px;
flex: 1;

View File

@@ -63,7 +63,7 @@
</div>
</div>
<div class="main_btns">
<button class="btn1">取消</button>
<button class="btn1" @click="closeDrawer">取消</button>
<button class="btn2" @click="createDiscuss">确定</button>
</div>
</div>
@@ -71,7 +71,7 @@
</template>
<script>
import { reactive, toRefs, ref } from "vue";
import * as api from "../../api/discuss";
import * as api from "../../api/indexDiscuss";
import { message } from "ant-design-vue";
const rowSelection = ref({
checkStrictly: false,
@@ -109,7 +109,7 @@ export default {
const closeDrawer = () => {
ctx.emit("update:adddiscussVisible", false);
state.inputV1 = "";
state.textV2 = "";
state.textV1 = "";
};
const afterVisibleChange = (bool) => {
console.log("state", bool);
@@ -117,7 +117,7 @@ export default {
//创建讨论
const createDiscuss = () => {
if(!state.inputV1) return message.info("请输入讨论名称");
if(!state.inputV1) return message.warning("请输入讨论名称");
let obj = {
discussName: state.inputV1, //讨论名称
discussExplain: state.textV1, //讨论说明
@@ -136,8 +136,12 @@ export default {
.then((res) => {
setTimeout(() => {
console.log("创建成功", res);
state.inputV1 = "";
state.textV1 = "";
message.success("创建成功");
ctx.emit("update:adddiscussVisible", false);
}, 1000);
})
.catch((err) => {
console.log("创建失败", err);

View File

@@ -85,7 +85,7 @@
<div class="co1">{{ value2.length }}/100</div>
</div>
<div class="btn">
<button class="btn1">取消</button>
<button class="btn1" @click="closeModal">取消</button>
<button class="btn2" @click="editChapter">确定</button>
</div>
</div>
@@ -504,7 +504,7 @@
import { reactive, toRefs, onMounted, onUnmounted } from "vue";
import AddStu from "../../components/drawers/AddLevelAddStu";
import ImpStu from "../../components/drawers/AddLevelImportStu";
import * as api from "../../api/level";
import * as api from "../../api/indexLevel";
import { message } from "ant-design-vue";
export default {
name: "LevelAddDetail",
@@ -813,6 +813,7 @@ export default {
//新建或编辑关卡
const editChapter = () => {
if(!state.value1) return message.warning("请输入关卡名称");
let obj = {
name: state.value1,
remark: state.value2,
@@ -824,6 +825,9 @@ export default {
setTimeout(() => {
console.log("创建成功", res);
message.success("创建成功");
state.value1 = "";
state.value2 = "";
state.modal = false;
// state.createLoading = false;
//state.currentPage = 1;
// getLearnPath();
@@ -838,14 +842,14 @@ export default {
};
const closeDrawer = () => {
state.visible = false;
state.value1 = "";
state.value2 = "";
};
const showModal = () => {
state.modal = true;
};
const closeModal = () => {
state.modal = false;
state.value1 = "";
state.value2 = "";
};
const afterVisibleChange = (bool) => {
console.log("visible", bool);
@@ -1317,9 +1321,9 @@ export default {
width: 100px;
height: 40px;
border-radius: 4px;
border: 1px solid #387df7;
border: 1px solid #409EFF;
font-size: 14px;
color: #387df7;
color: #409EFF;
cursor: pointer;
background: #ffffff;
margin-right: 20px;
@@ -1332,7 +1336,7 @@ export default {
color: #fff;
cursor: pointer;
border: 0;
background: #388be1;
background: #409EFF;
}
}
}