update

parent b4243afb
export const config = {
API_ENDPOINT: 'http://cms.vab.xteldev.com/api/',
API_IMAGE_ENDPOINT: 'http://cms.vab.xteldev.com/file/upload/',
API_RES_CODE: {
OK: {
code: 0,
......
......@@ -88,6 +88,7 @@ export default defineComponent({
const avatar: Ref<string | null> = ref(null);
const avatarFile: Ref<File | null> = ref(null);
const avatarUploaded: Ref<string | null> = ref(null);
const avatarNoChange: Ref<string | null> = ref(null);
const artistCode: Ref<string> = ref('');
const fullName: Ref<string> = ref('');
const artistName: Ref<string | null> = ref(null);
......@@ -262,10 +263,10 @@ export default defineComponent({
console.log(response, 'Artist Detail Info');
const ArtistInformation = response.data.data;
id.value = ArtistInformation.id;
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
avatar.value =
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
'http://cms.vab.xteldev.com/file/upload/' + ArtistInformation.avatar;
avatar.value = config.API_IMAGE_ENDPOINT + ArtistInformation.avatar;
avatarNoChange.value = ArtistInformation.avatar;
account.value = ArtistInformation.account;
artistCode.value = ArtistInformation.artistCode;
fullName.value = ArtistInformation.fullName;
......@@ -505,7 +506,6 @@ export default defineComponent({
const addStory = (value: StoriesType) => {
stories.value.push(value);
console.log(stories, 'storiesstoriesstories');
};
const deleteStory = (idx: number) => {
......@@ -531,9 +531,6 @@ export default defineComponent({
});
};
const UpdateBirtday = (value: string) => {
// console.log(value);
console.log(value, 'birthdayyyy');
birthday.value = value;
};
const callApiUploadAvatar = async (file: File) => {
......@@ -542,12 +539,13 @@ export default defineComponent({
bodyFormData.append('file', file);
const response = (await api({
headers: { 'Content-Type': 'multipart/form-data' },
url: 'http://cms.vab.xteldev.com/file/upload',
url: config.API_IMAGE_ENDPOINT,
method: 'POST',
data: bodyFormData,
})) as AxiosResponse<BaseResponseBody<FileUploadType>>;
if (response.data.error.code === config.API_RES_CODE.OK.code) {
avatarUploaded.value = response.data.data.fileName;
console.log(avatarUploaded.value, 'aksdjaklsdjaklsd');
}
} catch (error) {}
};
......@@ -557,7 +555,7 @@ export default defineComponent({
bodyFormData.append('file', file);
const response = (await api({
headers: { 'Content-Type': 'multipart/form-data' },
url: 'http://cms.vab.xteldev.com/file/upload',
url: 'http://cms.vab.xteldev.com/file/upload/',
method: 'POST',
data: bodyFormData,
})) as AxiosResponse<BaseResponseBody<FileUploadType>>;
......@@ -575,7 +573,7 @@ export default defineComponent({
bodyFormData.append('file', file);
const response = (await api({
headers: { 'Content-Type': 'multipart/form-data' },
url: 'http://cms.vab.xteldev.com/file/upload',
url: config.API_IMAGE_ENDPOINT,
method: 'POST',
data: bodyFormData,
})) as AxiosResponse<BaseResponseBody<FileUploadType>>;
......@@ -669,7 +667,7 @@ export default defineComponent({
try {
if (avatarFile.value !== null) {
await callApiUploadAvatar(avatarFile.value);
} else avatarUploaded.value = avatar.value;
} else avatarUploaded.value = avatarNoChange.value;
for (let index = 0; index < banners.value.length; index++) {
const element = banners.value[index];
if (element.file !== undefined) {
......
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