update

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