Commit 238791c1 authored by hong-IT-99's avatar hong-IT-99

update code

parent 4889b415
...@@ -35,10 +35,11 @@ export default defineComponent({ ...@@ -35,10 +35,11 @@ export default defineComponent({
components: { components: {
UploadImage, UploadImage,
}, },
setup() { setup(_, context) {
const selectedFile = (value: FileList) => { const selectedFile = (value: FileList) => {
console.log(value); // console.log(value);
console.log(URL.createObjectURL(value[0])); // console.log(URL.createObjectURL(value[0]));
context.emit('SetAvatar',{file:value[0], url:URL.createObjectURL(value[0])})
}; };
const upload = ref(null); const upload = ref(null);
const uploadBanner = () => { const uploadBanner = () => {
...@@ -176,5 +177,6 @@ export default defineComponent({ ...@@ -176,5 +177,6 @@ export default defineComponent({
'update:artistLevel', 'update:artistLevel',
'update:status', 'update:status',
'addNewArtist', 'addNewArtist',
'SetAvatar'
], ],
}); });
...@@ -3,9 +3,19 @@ ...@@ -3,9 +3,19 @@
<q-space></q-space> <q-space></q-space>
<div class="col-5"> <div class="col-5">
<div class="row q-mt-sm flex-center"> <div class="row q-mt-sm flex-center">
<div class="col-3 text-weight-medium"> <div class="col-3 text-weight-medium"></div>
<q-card style="max-width: 65%" @click="uploadBanner"> <div class="col-8 flex flex-center">
<!-- --> <div>
<q-card style="margin-bottom: 8px" v-if="avatar !== null">
<q-img :src="avatar" style="height: 180px; width: 135px"></q-img>
</q-card>
<q-card v-else style="margin-bottom: 8px">
<q-img
src="~/assets/noavatar.png"
style="height: 180px; width: 135px"
></q-img>
</q-card>
<q-card @click="uploadBanner">
<div align="center" class="flex flex-center q-py-xs"> <div align="center" class="flex flex-center q-py-xs">
<q-icon name="mdi-plus-circle-outline" :size="'xs'"></q-icon> <q-icon name="mdi-plus-circle-outline" :size="'xs'"></q-icon>
<div class="q-mt-xs">{{ $t('uploadImage.uploadBanner') }}</div> <div class="q-mt-xs">{{ $t('uploadImage.uploadBanner') }}</div>
...@@ -17,15 +27,9 @@ ...@@ -17,15 +27,9 @@
type="file" type="file"
accept="image/png, image/jpeg" accept="image/png, image/jpeg"
/> />
<!-- / @change="$emit('selectedFile', $event.target.files)" -->
</q-card> </q-card>
</div> </div>
<div class="col-8 flex flex-center">
<div style="width: 100%">
<q-img :src="avatar" style="max-width: 120px"></q-img>
</div>
</div> </div>
<!-- @selectedFile="uploadAvatar" -->
</div> </div>
<div class="row q-mt-sm flex-center"> <div class="row q-mt-sm flex-center">
<div class="col-3 text-weight-medium"> <div class="col-3 text-weight-medium">
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
:profession-options="professionOptions" :profession-options="professionOptions"
:artist-level-options="artistLevelOptions" :artist-level-options="artistLevelOptions"
:work-options="workOptions" :work-options="workOptions"
@SetAvatar="setAvatar($event)"
></PersonalInformation> ></PersonalInformation>
</q-tab-panel> </q-tab-panel>
<q-tab-panel name="vabAccount"> <q-tab-panel name="vabAccount">
......
...@@ -35,6 +35,10 @@ import { ...@@ -35,6 +35,10 @@ import {
TypeCardType, TypeCardType,
} from 'src/assets/type'; } from 'src/assets/type';
export type AvatarType ={
file?:File,
url?:string | null
}
export default defineComponent({ export default defineComponent({
components: { components: {
PersonalInformation, PersonalInformation,
...@@ -47,6 +51,7 @@ export default defineComponent({ ...@@ -47,6 +51,7 @@ export default defineComponent({
UpdateHotProduct, UpdateHotProduct,
UploadEmbedDialog, UploadEmbedDialog,
}, },
setup() { setup() {
const route = useRoute(); const route = useRoute();
const tab = ref('information'); const tab = ref('information');
...@@ -122,10 +127,7 @@ export default defineComponent({ ...@@ -122,10 +127,7 @@ export default defineComponent({
console.log(response, 'Artist Detail Info'); console.log(response, 'Artist Detail Info');
const ArtistInformation = response.data.data; const ArtistInformation = response.data.data;
id.value = ArtistInformation.id; id.value = ArtistInformation.id;
// avatar.value = ArtistInformation.avatar avatar.value = ArtistInformation.avatar;
avatar.value =
'https://static2.yan.vn/YanNews/2167221/201911/son-tung-mtp-so-huu-3-cong-ty-giai-tri-o-tuoi-25-cdm-qua-gioi-f53bb404.jpg';
account.value = ArtistInformation.account; account.value = ArtistInformation.account;
artistCode.value = ArtistInformation.artistCode; artistCode.value = ArtistInformation.artistCode;
fullName.value = ArtistInformation.fullName; fullName.value = ArtistInformation.fullName;
...@@ -164,6 +166,11 @@ export default defineComponent({ ...@@ -164,6 +166,11 @@ export default defineComponent({
); );
} }
}; };
const setAvatar =(value:BannerType)=>{
console.log(value);
avatar.value = value.url as string
};
const getFieldOptions = async () => { const getFieldOptions = async () => {
const response = (await api({ const response = (await api({
url: API_PATHS.getFieldOptions, url: API_PATHS.getFieldOptions,
...@@ -443,6 +450,7 @@ export default defineComponent({ ...@@ -443,6 +450,7 @@ export default defineComponent({
getTypeCardOptions, getTypeCardOptions,
rowDataAccBank, rowDataAccBank,
avatar, avatar,
setAvatar
}; };
}, },
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment