Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
yuping
2023-02-02 10:38:21 +08:00
2 changed files with 89 additions and 11 deletions

View File

@@ -73,7 +73,7 @@
</div>
<div class="btnn">
<button class="btn1" @click="closeDrawer">取消</button>
<button class="btn2" @click="closeDrawer">确定</button>
<button class="btn2" @click="saveUnlock">确定</button>
</div>
</div>
</a-drawer>
@@ -81,15 +81,31 @@
<script>
import { reactive, toRefs } from "vue";
import { editRoutered } from '@/api/indexLearningPath'
import { message } from "ant-design-vue";
// import { watch } from '@vue/runtime-core'
export default {
name: "UnlockMode",
props: {
unlockModeVisible: {
name: "UnlockMode",
props:{
unlockModeVisible:{
type: Boolean,
default: false,
default: false
},
routerInfo:{
type: Object
}
},
// watch:{
// unlockModeVisible(val){
// if(val){
// for(let key in this.formData){
// this.formData[key] = this.routerInfo[key]
// }
// }
// }
// },
setup(props, ctx) {
console.log("获取属性",props)
const state = reactive({
classify: [
{
@@ -108,6 +124,22 @@ export default {
selectClassifyType: 1,
checked: true,
radioSelect: 1,
formData: {
routerId:'',
organizationName:'',
organizationId:'',
name:'',
picUrl:'',
remark:'',
status:'', // 0 草稿 1 已发布 -1 已停用
attach:'',
attachSwitch:'',
enablePreview:'',
previewSetting:'',
enableStudy:'',
studySetting:'',
unlockMode:'',
}
});
const closeDrawer = () => {
state.selectClassifyType = 1;
@@ -116,17 +148,50 @@ export default {
ctx.emit("update:unlockModeVisible", false);
};
const saveUnlock =() =>{
editRoutered(state.formData).then(res=>{
if(res.data.code == 200){
message.success(res.data.msg)
ctx.emit("successA")
closeDrawer()
}else{
message.error(res.data.msg)
}
})
}
// watch:{
// unlockModeVisible(val){
// if(val){
// for(let key in this.formData){
// this.formData[key] = this.routerInfo[key]
// }
// }
// }
// },
const afterVisibleChange = (bool) => {
console.log("state", bool);
if(bool){
for(let key in state.formData){
state.formData[key] = props.routerInfo[key]
}
}
};
const selectClassify = (e) => {
state.selectClassifyType = e.type;
state.formData.unlockMode = e.type
};
return {
...toRefs(state),
afterVisibleChange,
closeDrawer,
saveUnlock,
// change,
selectClassify,
};

View File

@@ -195,12 +195,12 @@
<div class="select" style="margin-right:90px;">
<span>学习模式</span>
<div class="inputbox">
<input type="text" placeholder="按学习时间解锁" />
<input type="text" :placeholder="unlockMode === 1?'自由学习模式':unlockMode === 2?'按学习时间解锁':''" />
<div class="bottonbox" @click="showModeVisible">
<div class="btnText">切换模式</div>
</div>
</div>
<unlock-mode v-model:unlockModeVisible="unlockModeVisible" />
<unlock-mode ref="unlockModeModal" v-model:unlockModeVisible="unlockModeVisible" :routerInfo="routerInfo" @successA="successA"/>
</div>
<div class="line"></div>
<router-link to="/leveladd">
@@ -784,12 +784,12 @@
<div class="select">
<span>学习模式</span>
<div class="inputbox">
<input type="text" placeholder="按学习时间解锁" />
<input type="text" :placeholder="unlockMode === 1?'自由学习模式':unlockMode === 2?'按学习时间解锁':''" />
<div class="bottonbox" @click="showModeVisible">
<div class="btnText">切换模式</div>
</div>
</div>
<unlock-mode v-model:unlockModeVisible="unlockModeVisible" />
<unlock-mode ref="unlockModeModal" v-model:unlockModeVisible="unlockModeVisible" :routerInfo="routerInfo" @successA="successA"/>
</div>
<div class="line"></div>
<router-link to="/leveladd">
@@ -1061,7 +1061,7 @@
</div>
</template>
<script>
import { reactive, toRefs, onMounted, onUnmounted } from "vue";
import { reactive, toRefs, onMounted, onUnmounted ,ref } from "vue";
import AddStu from "../../components/drawers/AddLevelAddStu";
import ImpStu from "../../components/drawers/AddLevelImportStu";
import AddOnline from "../../components/drawers/AddOnline.vue";
@@ -1111,6 +1111,7 @@ export default {
},
setup() {
const router = useRouter();
const unlockModeModal = ref()
const state = reactive({
routerId: storage.get("routerId")
? JSON.parse(storage.get("routerId"))
@@ -1122,6 +1123,7 @@ export default {
// name: "默认关卡",
// },
],
unlockMode: 1, // 学习模式
tableData: [
// {
// key: 1,
@@ -1211,6 +1213,7 @@ export default {
styTitle: null,
creTime: null,
picUrl: null,
routerInfo:{},
//项目抽屉参数
time: undefined,
projId: null, //选项选到的id
@@ -1250,6 +1253,11 @@ export default {
state.value2 = "";
state.updateChapterID = null;
};
const successA = () =>{
getDetail()
}
//新建关卡
const editChapter = () => {
if (!state.value1) return message.warning("请输入关卡名称");
@@ -1465,6 +1473,7 @@ export default {
getDetail();
};
const getDetail = () => {
console.log('调用查询')
GetRouterDetail(state.routerId,"N")
.then((res) => {
//给level赋初始值
@@ -1472,6 +1481,8 @@ export default {
state.styTitle = res.data.data.routerInfo.name;
state.creTime = res.data.data.routerInfo.createTime;
state.picUrl = res.data.data.routerInfo.picUrl;
state.unlockMode = res.data.data.routerInfo.unlockMode
state.routerInfo = res.data.data.routerInfo
//增加两个字段
state.level.forEach((item) => {
item["value"] = item.chapterId;
@@ -1933,6 +1944,7 @@ export default {
};
return {
...toRefs(state),
unlockModeModal,
// tableDataFunc,
tableDataFunc2,
showModal,
@@ -1989,6 +2001,7 @@ export default {
closedeleteAll,
subdeleteAll,
successA
};
},
};