Files
myprojplanet_vite/src/components/CMyTeacher/CMyTeacher.ts

59 lines
1.4 KiB
TypeScript
Raw Normal View History

2021-09-04 15:05:34 +02:00
import { computed, defineComponent, ref, watch } from 'vue'
import { tools } from '@store/Modules/tools'
import { CMyAvatar } from '../CMyAvatar'
import MixinOperator from '../../mixins/mixin-operator'
import MixinUsers from '../../mixins/mixin-users'
import { useGlobalStore } from '@store/globalStore'
export default defineComponent({
name: 'CMyTeacher',
components: { CMyAvatar },
props: {
username: {
type: String,
required: true,
default: '',
},
},
setup(props) {
const globalStore = useGlobalStore()
const showuserdetails = ref(false)
const autoplaydiscsaved = ref(0)
const tab = ref('one')
const { getOperatorByUsername, getImgTeacherByUsername, getTeacherByUsername } = MixinOperator()
const { isValidUsername } = MixinUsers()
const myop = computed(() => {
return getOperatorByUsername(props.username)
})
2021-10-03 15:09:17 +02:00
watch(() => showuserdetails, (value: any, old: any) => {
2021-09-04 15:05:34 +02:00
if (!showuserdetails.value) {
globalStore.autoplaydisc = autoplaydiscsaved.value
}
})
function executeclick(event: any) {
console.log('executeclick')
showuserdetails.value = true
autoplaydiscsaved.value = globalStore.autoplaydisc
globalStore.autoplaydisc = 0
}
return {
tab,
executeclick,
showuserdetails,
getImgTeacherByUsername,
isValidUsername,
getTeacherByUsername,
myop,
tools,
}
},
})