mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-13 21:06:44 +08:00
256 lines
6.5 KiB
Vue
256 lines
6.5 KiB
Vue
<template>
|
||
<a-drawer
|
||
:visible="unlockModeVisible"
|
||
class="drawerStyle unlockmode"
|
||
placement="right"
|
||
width="70%"
|
||
@after-visible-change="afterVisibleChange"
|
||
>
|
||
<div class="drawerMain">
|
||
<div class="header">
|
||
<div class="headerTitle">选择解锁模式</div>
|
||
<img
|
||
style="width: 29px; height: 29px; cursor: pointer"
|
||
src="../../assets/images/basicinfo/close.png"
|
||
@click="closeDrawer"
|
||
/>
|
||
</div>
|
||
<div class="main">
|
||
<div class="classify">
|
||
<div
|
||
v-for="(item, index) in classify"
|
||
:key="index"
|
||
class="classifyItem"
|
||
@click="selectClassify(item)"
|
||
:style="{
|
||
color: item.type === selectClassifyType ? '#FFFFFF' : '#999999',
|
||
'background-color':
|
||
item.type === selectClassifyType ? '#4ea6ff' : '#FFFFFF',
|
||
border:
|
||
item.type === selectClassifyType
|
||
? '1px solid #4ea6ff'
|
||
: '1px solid #999999',
|
||
}"
|
||
>
|
||
{{ item.text }}
|
||
</div>
|
||
</div>
|
||
<div v-if="selectClassifyType === 1" class="type1">
|
||
<span style="font-weight: 500">描述:</span
|
||
><span>不设学习限制,学员可以在任何时间学习</span>
|
||
</div>
|
||
<div v-if="selectClassifyType === 2" class="type1 type3">
|
||
<div>
|
||
<span style="font-weight: 500">描述:</span
|
||
><span>前一个阶段达成目标后解锁下一个阶段</span>
|
||
</div>
|
||
<div class="radio" style="display: flex">
|
||
<div style="margin-top: 1px">解锁条件:</div>
|
||
<a-radio-group v-model:value="radioSelect" @change="changeUnlockMode">
|
||
<div>
|
||
<a-radio :value="2"
|
||
>逐个任务解锁,完成一个任务后解锁下一个</a-radio
|
||
>
|
||
</div>
|
||
<div v-if="types!==1" style="margin-top: 24px">
|
||
<a-radio :value="3"
|
||
>完成当前阶段所有必修任务解锁下一阶段</a-radio
|
||
>
|
||
</div>
|
||
</a-radio-group>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="btnn">
|
||
<button class="btn1" @click="closeDrawer">取消</button>
|
||
<button class="btn2" @click="saveUnlock">确定</button>
|
||
</div>
|
||
</div>
|
||
</a-drawer>
|
||
</template>
|
||
|
||
<script>
|
||
import {reactive, toRefs} from "vue";
|
||
export default {
|
||
name: "UnlockMode",
|
||
props:{
|
||
unlockModeVisible:{
|
||
type: Boolean,
|
||
default: false
|
||
},
|
||
types: {
|
||
type: Number,
|
||
default: null,
|
||
},
|
||
objData:{
|
||
type: Object
|
||
}
|
||
},
|
||
setup(props, ctx) {
|
||
console.log("获取属性",props)
|
||
const state = reactive({
|
||
classify: [
|
||
{
|
||
type: 1,
|
||
text: "自由学习模式",
|
||
},
|
||
{
|
||
type: 2,
|
||
text: "闯关模式",
|
||
},
|
||
],
|
||
selectClassifyType: 1,
|
||
checked: true,
|
||
radioSelect: 2,
|
||
formData: {
|
||
unlockMode:'',
|
||
}
|
||
});
|
||
const closeDrawer = () => {
|
||
state.selectClassifyType = 1;
|
||
state.checked = true;
|
||
state.radioSelect = 1;
|
||
ctx.emit("update:unlockModeVisible", false);
|
||
ctx.emit("closeUnlockModal", false)
|
||
};
|
||
|
||
|
||
|
||
const saveUnlock =() =>{
|
||
console.log(ctx,state.formData.unlockMode)
|
||
ctx.emit("saveUnlock",state.formData.unlockMode)
|
||
}
|
||
|
||
const afterVisibleChange = (bool) => {
|
||
if(bool){
|
||
for(let key in state.formData){
|
||
state.formData[key] = props.objData[key]
|
||
}
|
||
if(state.formData.unlockMode === 1){
|
||
state.selectClassifyType = 1
|
||
}else if(state.formData.unlockMode === 2 || state.formData.unlockMode === 3){
|
||
state.selectClassifyType = 2
|
||
state.radioSelect = state.formData.unlockMode
|
||
}
|
||
}
|
||
console.log("点开弹窗",state.formData,state.unlockMode)
|
||
};
|
||
|
||
const selectClassify = (e) => {
|
||
state.selectClassifyType = e.type;
|
||
if(e.type === 1){
|
||
state.formData.unlockMode = e.type
|
||
}
|
||
// 当为学习路径图时候 直接默认第一个选项 不用选中
|
||
if(e.type==2 && props.types==1){
|
||
state.formData.unlockMode = e.type
|
||
}
|
||
};
|
||
|
||
const changeUnlockMode = (e) =>{
|
||
|
||
state.formData.unlockMode = e.target.value
|
||
}
|
||
|
||
return {
|
||
...toRefs(state),
|
||
afterVisibleChange,
|
||
closeDrawer,
|
||
saveUnlock,
|
||
selectClassify,
|
||
changeUnlockMode
|
||
};
|
||
},
|
||
};
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
.unlockmode {
|
||
.drawerMain {
|
||
min-width: 600px;
|
||
margin: 0px 32px 0px 32px;
|
||
overflow-x: auto;
|
||
display: flex;
|
||
flex-direction: column;
|
||
.header {
|
||
height: 73px;
|
||
border-bottom: 1px solid #e8e8e8;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
// background-color: red;
|
||
margin-bottom: 20px;
|
||
.headerTitle {
|
||
font-size: 18px;
|
||
font-weight: 600;
|
||
color: #333333;
|
||
line-height: 25px;
|
||
// margin-left: 24px;
|
||
}
|
||
}
|
||
.main {
|
||
display: flex;
|
||
flex-direction: column;
|
||
.classify {
|
||
display: flex;
|
||
.classifyItem {
|
||
width: 160px;
|
||
height: 38px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border-radius: 4px;
|
||
border: 1px solid #999999;
|
||
font-size: 16px;
|
||
font-weight: 500;
|
||
color: #999999;
|
||
line-height: 22px;
|
||
margin-right: 16px;
|
||
cursor: pointer;
|
||
}
|
||
}
|
||
.type1 {
|
||
margin-top: 50px;
|
||
font-size: 14px;
|
||
font-weight: 400;
|
||
color: #333333;
|
||
line-height: 20px;
|
||
}
|
||
.radio {
|
||
margin-top: 24px;
|
||
}
|
||
}
|
||
.btnn {
|
||
height: 72px;
|
||
width: 100%;
|
||
position: absolute;
|
||
bottom: 0;
|
||
left: 0;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
box-shadow: 0px 1px 35px 0px rgba(118, 136, 166, 0.16);
|
||
.btn1 {
|
||
width: 100px;
|
||
height: 40px;
|
||
border: 1px solid #4ea6ff;
|
||
border-radius: 8px;
|
||
color: #4ea6ff;
|
||
background-color: #fff;
|
||
cursor: pointer;
|
||
}
|
||
.btn2 {
|
||
cursor: pointer;
|
||
width: 100px;
|
||
height: 40px;
|
||
background: #4ea6ff;
|
||
border-radius: 8px;
|
||
border: 0;
|
||
margin-left: 15px;
|
||
color: #fff;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
</style>
|