121 lines
3.1 KiB
TypeScript
121 lines
3.1 KiB
TypeScript
|
|
import { defineComponent, onMounted, PropType, ref, watch, computed } from 'vue'
|
||
|
|
import { useUserStore } from '@store/UserStore'
|
||
|
|
import { ICircuit, IImgGallery, IUserFields, IUserProfile } from 'model'
|
||
|
|
import { costanti } from '@costanti'
|
||
|
|
import { shared_consts } from '@/common/shared_vuejs'
|
||
|
|
import { tools } from '@store/Modules/tools'
|
||
|
|
import { useQuasar } from 'quasar'
|
||
|
|
import { CSendCoins } from '@/components/CSendCoins'
|
||
|
|
import { CMyFieldRec } from '@/components/CMyFieldRec'
|
||
|
|
import { CSaldo } from '@/components/CSaldo'
|
||
|
|
import { CMySelectCity } from '@/components/CMySelectCity'
|
||
|
|
import { CMySelect } from '@/components/CMySelect'
|
||
|
|
import { CUserInfoAccount } from '@/components/CUserInfoAccount'
|
||
|
|
import { useI18n } from '@/boot/i18n'
|
||
|
|
import { useRoute, useRouter } from 'vue-router'
|
||
|
|
import { useCircuitStore } from '@store/CircuitStore'
|
||
|
|
|
||
|
|
export default defineComponent({
|
||
|
|
name: 'CMyProfileTutorial',
|
||
|
|
components: { CSendCoins, CSaldo, CUserInfoAccount,
|
||
|
|
CMySelectCity, CMyFieldRec, CMySelect },
|
||
|
|
emits: ['setCmd'],
|
||
|
|
props: {
|
||
|
|
mycontact: {
|
||
|
|
type: Object as PropType<IUserFields | null>,
|
||
|
|
required: false,
|
||
|
|
default: null,
|
||
|
|
},
|
||
|
|
myusername: {
|
||
|
|
type: String,
|
||
|
|
required: false,
|
||
|
|
default: null,
|
||
|
|
},
|
||
|
|
},
|
||
|
|
|
||
|
|
setup(props, { emit }) {
|
||
|
|
|
||
|
|
const userStore = useUserStore()
|
||
|
|
const circuitStore = useCircuitStore()
|
||
|
|
const $q = useQuasar()
|
||
|
|
const { t } = useI18n()
|
||
|
|
const $router = useRouter()
|
||
|
|
const $route = useRoute()
|
||
|
|
|
||
|
|
const showAccountInfo = ref(false)
|
||
|
|
const slide = ref('1')
|
||
|
|
|
||
|
|
const username = ref('')
|
||
|
|
const showsendCoinTo = ref(false)
|
||
|
|
|
||
|
|
const contact = ref(<IUserFields | null>null)
|
||
|
|
const circuit = ref(<ICircuit | null | undefined>null)
|
||
|
|
|
||
|
|
watch(() => props.mycontact, (newval, oldval) => {
|
||
|
|
console.log('watch: mycontact')
|
||
|
|
mounted()
|
||
|
|
})
|
||
|
|
|
||
|
|
function mounted() {
|
||
|
|
if (!props.mycontact) {
|
||
|
|
if (props.myusername) {
|
||
|
|
username.value = props.myusername
|
||
|
|
//++Todo: carica contact
|
||
|
|
contact.value = null
|
||
|
|
} else {
|
||
|
|
contact.value = userStore.my
|
||
|
|
}
|
||
|
|
} else {
|
||
|
|
if (props.mycontact) {
|
||
|
|
contact.value = props.mycontact
|
||
|
|
username.value = props.mycontact.username
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// circuit.value = circuitStore.getCircuitByName(props.circuitname)
|
||
|
|
}
|
||
|
|
|
||
|
|
function getImgUser(profile: IUserFields) {
|
||
|
|
return userStore.getImgByProfile(profile)
|
||
|
|
}
|
||
|
|
|
||
|
|
function naviga(path: string) {
|
||
|
|
$router.push(path)
|
||
|
|
}
|
||
|
|
|
||
|
|
function setCmd($q: any, cmd: number, myusername: string, value: any, dest: string) {
|
||
|
|
emit('setCmd', $q, cmd, myusername, value, dest)
|
||
|
|
}
|
||
|
|
|
||
|
|
const checkifDisabled = computed(() => {
|
||
|
|
let ret = true
|
||
|
|
if (slide.value === '1') {
|
||
|
|
// Invitante + Email
|
||
|
|
} else if (slide.value === '2') {
|
||
|
|
// Username
|
||
|
|
} else if (slide.value === '3') {
|
||
|
|
// Password
|
||
|
|
}
|
||
|
|
|
||
|
|
return ret
|
||
|
|
})
|
||
|
|
|
||
|
|
onMounted(mounted)
|
||
|
|
|
||
|
|
return {
|
||
|
|
contact,
|
||
|
|
costanti,
|
||
|
|
checkifDisabled,
|
||
|
|
getImgUser,
|
||
|
|
naviga,
|
||
|
|
setCmd,
|
||
|
|
shared_consts,
|
||
|
|
tools,
|
||
|
|
showsendCoinTo,
|
||
|
|
circuit,
|
||
|
|
showAccountInfo,
|
||
|
|
slide,
|
||
|
|
}
|
||
|
|
},
|
||
|
|
})
|