'修改路径下的学习模式'

This commit is contained in:
fooperage
2023-02-02 09:24:26 +08:00
parent e15cabe750
commit 6b1638e55c
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,
};