|
@@ -15,23 +15,70 @@ const apiUrl = import.meta.env.VITE_API_URL;
|
|
|
const imgUrl = import.meta.env.VITE_API_IMG_URL;
|
|
|
console.log("VITE_API_URL", apiUrl);
|
|
|
|
|
|
-let assignBgImg = ref("");
|
|
|
+let race = store.assignRace; // 種族
|
|
|
+let gender = store.assignGender; // 性別
|
|
|
+let imgLoading = ref(false);
|
|
|
+let parameter = ref([]);
|
|
|
|
|
|
-function handleBgImg(item) {
|
|
|
- console.log("name", item);
|
|
|
- assignBgImg.value = item;
|
|
|
- store.assignBgImg = item;
|
|
|
- parameterList.value.filter((e, index) => {
|
|
|
- if (e.bg_img === item.bg_img) {
|
|
|
- store.styleNum = index;
|
|
|
- }
|
|
|
- });
|
|
|
+// 取得背景清單
|
|
|
+async function getTargetImageList() {
|
|
|
+ imgLoading.value = true;
|
|
|
+ let url = `http://172.104.93.163:3219/fs/target-image-list/${gender}/${race}`;
|
|
|
+ console.log("url", url);
|
|
|
+
|
|
|
+ try {
|
|
|
+ let response = await axios.get(url);
|
|
|
+ console.log("response", response);
|
|
|
|
|
|
+ let imagePromises = response.data.map((item, index) => {
|
|
|
+ let imageUrl = `http://172.104.93.163:3219/fs/target-image/${gender}/${race}/${item}`;
|
|
|
+ return getTargetImage(imageUrl, index); // 取得種族圖片
|
|
|
+ });
|
|
|
+
|
|
|
+ await Promise.all(imagePromises);
|
|
|
+ console.log("全部完成");
|
|
|
+
|
|
|
+ imgLoading.value = false;
|
|
|
+ } catch (error) {
|
|
|
+ console.log("error", error);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// 取得背景圖片
|
|
|
+async function getTargetImage(url, index) {
|
|
|
+ try {
|
|
|
+ // 設定 responseType 為 arraybuffer 以取得二進位數據
|
|
|
+ let response = await axios.get(url, { responseType: "arraybuffer" });
|
|
|
+
|
|
|
+ let blob = new Blob([response.data], { type: "image/png" }); // 創建 blob
|
|
|
+ let imageUrl = URL.createObjectURL(blob); // 創建圖片 URL
|
|
|
+ console.log("imageUrl", imageUrl);
|
|
|
+ parameter.value.push({ imgUrl: imageUrl, name: `${index}.jpg` });
|
|
|
+ console.log("parameter.value", parameter.value);
|
|
|
+ } catch (error) {
|
|
|
+ console.log("error", error);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function handleBgImg(item) {
|
|
|
+ console.log("item", item);
|
|
|
+ store.assignBgImg = item.name;
|
|
|
+ store.assignBgImgUrl = item.imgUrl;
|
|
|
console.log("store.assignBgImg", store.assignBgImg);
|
|
|
- console.log("store.styleNum", store.styleNum);
|
|
|
+ console.log("store.assignBgImgUrl", store.assignBgImgUrl);
|
|
|
+
|
|
|
+ // assignBgImg.value = item;
|
|
|
+ // store.assignBgImg = item;
|
|
|
+ // parameterList.value.filter((e, index) => {
|
|
|
+ // if (e.bg_img === item.bg_img) {
|
|
|
+ // store.styleNum = index;
|
|
|
+ // }
|
|
|
+ // });
|
|
|
+ // console.log("store.styleNum", store.styleNum);
|
|
|
}
|
|
|
|
|
|
onMounted(() => {
|
|
|
+ getTargetImageList();
|
|
|
getParameters();
|
|
|
});
|
|
|
|
|
@@ -70,135 +117,135 @@ const currentPage = computed(
|
|
|
let parameterList = ref([]);
|
|
|
|
|
|
// 背景清單
|
|
|
-let parameter = ref([
|
|
|
- {
|
|
|
- bg_img: "臺北陽明山-母親節.png",
|
|
|
- title: "taipei_yangmingshan",
|
|
|
- description: "taipei_yangmingshan_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "台南孔廟.png",
|
|
|
- title: "tainan_confucius_temple",
|
|
|
- description: "tainan_confucius_temple_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "臺北中正紀念堂-2.png",
|
|
|
- title: "taipei_chiang_kai_shek_memorial_hall_2",
|
|
|
- description: "taipei_chiang_kai_shek_memorial_hall_2_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "台東嘉明湖.png",
|
|
|
- title: "taitung_jiaming_lake",
|
|
|
- description: "taitung_jiaming_lake_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "中秋節.png",
|
|
|
- title: "mid_autumn_festival",
|
|
|
- description: "mid_autumn_festival_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "新北野柳女王頭.png",
|
|
|
- title: "new_taipei_yehliu_queen_head",
|
|
|
- description: "new_taipei_yehliu_queen_head_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "基隆和平島公園.png",
|
|
|
- title: "keelung_heping_island_park",
|
|
|
- description: "keelung_heping_island_park_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "台中日月潭.png",
|
|
|
- title: "taichung_sun_moon_lake",
|
|
|
- description: "taichung_sun_moon_lake_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "臺北中正紀念堂.png",
|
|
|
- title: "taipei_chiang_kai_shek_memorial_hall",
|
|
|
- description: "taipei_chiang_kai_shek_memorial_hall_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "台南鹽田.png",
|
|
|
- title: "tainan_salt_field",
|
|
|
- description: "tainan_salt_field_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "高雄美麗島.png",
|
|
|
- title: "kaohsiung_formosa_boulevard_station",
|
|
|
- description: "kaohsiung_formosa_boulevard_station_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "新北十分瀑布.png",
|
|
|
- title: "new_taipei_shifen_waterfall",
|
|
|
- description: "new_taipei_shifen_waterfall_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "臺北故宮.png",
|
|
|
- title: "taipei_national_palace_museum",
|
|
|
- description: "taipei_national_palace_museum_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "臺北故宮-2.png",
|
|
|
- title: "taipei_national_palace_museum_2",
|
|
|
- description: "taipei_national_palace_museum_2_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "台中歌劇院.png",
|
|
|
- title: "national_taichung_theater",
|
|
|
- description: "national_taichung_theater_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "嘉義森林之歌.png",
|
|
|
- title: "chiayi_song_of_forest",
|
|
|
- description: "chiayi_song_of_forest_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "基隆八斗子鐵路.png",
|
|
|
- title: "keelung_baduzi_railway",
|
|
|
- description: "keelung_baduzi_railway_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "花蓮清水斷崖.png",
|
|
|
- title: "hualien_qingshui_cliff",
|
|
|
- description: "hualien_qingshui_cliff_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "澎湖.png",
|
|
|
- title: "penghu",
|
|
|
- description: "penghu_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "南投清境農場.png",
|
|
|
- title: "nantou_qingjing_farm",
|
|
|
- description: "nantou_qingjing_farm_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "高雄流行音樂中心.png",
|
|
|
- title: "kaohsiung_music_center",
|
|
|
- description: "kaohsiung_music_center_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "花蓮金針花山.png",
|
|
|
- title: "hualien_daylily_mountain",
|
|
|
- description: "hualien_daylily_mountain_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "新北九份老街.png",
|
|
|
- title: "new_taipei_jiufen_old_street",
|
|
|
- description: "new_taipei_jiufen_old_street_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "嘉義阿里山小火車.png",
|
|
|
- title: "chiayi_alishan_forest_railways",
|
|
|
- description: "chiayi_alishan_forest_railways_description",
|
|
|
- },
|
|
|
- {
|
|
|
- bg_img: "台中高美濕地.png",
|
|
|
- title: "taichung_gaomei_wetland",
|
|
|
- description: "taichung_gaomei_wetland_description",
|
|
|
- },
|
|
|
-]);
|
|
|
-
|
|
|
-console.log("parameter", parameter.value);
|
|
|
+// let parameter = ref([
|
|
|
+// {
|
|
|
+// bg_img: "臺北陽明山-母親節.png",
|
|
|
+// title: "taipei_yangmingshan",
|
|
|
+// description: "taipei_yangmingshan_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "台南孔廟.png",
|
|
|
+// title: "tainan_confucius_temple",
|
|
|
+// description: "tainan_confucius_temple_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "臺北中正紀念堂-2.png",
|
|
|
+// title: "taipei_chiang_kai_shek_memorial_hall_2",
|
|
|
+// description: "taipei_chiang_kai_shek_memorial_hall_2_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "台東嘉明湖.png",
|
|
|
+// title: "taitung_jiaming_lake",
|
|
|
+// description: "taitung_jiaming_lake_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "中秋節.png",
|
|
|
+// title: "mid_autumn_festival",
|
|
|
+// description: "mid_autumn_festival_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "新北野柳女王頭.png",
|
|
|
+// title: "new_taipei_yehliu_queen_head",
|
|
|
+// description: "new_taipei_yehliu_queen_head_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "基隆和平島公園.png",
|
|
|
+// title: "keelung_heping_island_park",
|
|
|
+// description: "keelung_heping_island_park_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "台中日月潭.png",
|
|
|
+// title: "taichung_sun_moon_lake",
|
|
|
+// description: "taichung_sun_moon_lake_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "臺北中正紀念堂.png",
|
|
|
+// title: "taipei_chiang_kai_shek_memorial_hall",
|
|
|
+// description: "taipei_chiang_kai_shek_memorial_hall_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "台南鹽田.png",
|
|
|
+// title: "tainan_salt_field",
|
|
|
+// description: "tainan_salt_field_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "高雄美麗島.png",
|
|
|
+// title: "kaohsiung_formosa_boulevard_station",
|
|
|
+// description: "kaohsiung_formosa_boulevard_station_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "新北十分瀑布.png",
|
|
|
+// title: "new_taipei_shifen_waterfall",
|
|
|
+// description: "new_taipei_shifen_waterfall_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "臺北故宮.png",
|
|
|
+// title: "taipei_national_palace_museum",
|
|
|
+// description: "taipei_national_palace_museum_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "臺北故宮-2.png",
|
|
|
+// title: "taipei_national_palace_museum_2",
|
|
|
+// description: "taipei_national_palace_museum_2_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "台中歌劇院.png",
|
|
|
+// title: "national_taichung_theater",
|
|
|
+// description: "national_taichung_theater_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "嘉義森林之歌.png",
|
|
|
+// title: "chiayi_song_of_forest",
|
|
|
+// description: "chiayi_song_of_forest_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "基隆八斗子鐵路.png",
|
|
|
+// title: "keelung_baduzi_railway",
|
|
|
+// description: "keelung_baduzi_railway_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "花蓮清水斷崖.png",
|
|
|
+// title: "hualien_qingshui_cliff",
|
|
|
+// description: "hualien_qingshui_cliff_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "澎湖.png",
|
|
|
+// title: "penghu",
|
|
|
+// description: "penghu_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "南投清境農場.png",
|
|
|
+// title: "nantou_qingjing_farm",
|
|
|
+// description: "nantou_qingjing_farm_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "高雄流行音樂中心.png",
|
|
|
+// title: "kaohsiung_music_center",
|
|
|
+// description: "kaohsiung_music_center_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "花蓮金針花山.png",
|
|
|
+// title: "hualien_daylily_mountain",
|
|
|
+// description: "hualien_daylily_mountain_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "新北九份老街.png",
|
|
|
+// title: "new_taipei_jiufen_old_street",
|
|
|
+// description: "new_taipei_jiufen_old_street_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "嘉義阿里山小火車.png",
|
|
|
+// title: "chiayi_alishan_forest_railways",
|
|
|
+// description: "chiayi_alishan_forest_railways_description",
|
|
|
+// },
|
|
|
+// {
|
|
|
+// bg_img: "台中高美濕地.png",
|
|
|
+// title: "taichung_gaomei_wetland",
|
|
|
+// description: "taichung_gaomei_wetland_description",
|
|
|
+// },
|
|
|
+// ]);
|
|
|
+
|
|
|
+// console.log("parameter", parameter.value);
|
|
|
|
|
|
async function getParameters() {
|
|
|
let url = `${apiUrl}/sd/parameters`;
|
|
@@ -230,7 +277,20 @@ function checkImg() {
|
|
|
<template>
|
|
|
<div class="content">
|
|
|
<p class="title">{{ t("postcard.step2.text_2") }}</p>
|
|
|
- <div class="img-content">
|
|
|
+
|
|
|
+ <div
|
|
|
+ v-if="imgLoading"
|
|
|
+ class="d-flex flex-column align-center justify-center pt-15"
|
|
|
+ >
|
|
|
+ <v-progress-circular
|
|
|
+ :size="70"
|
|
|
+ :width="7"
|
|
|
+ color="white"
|
|
|
+ indeterminate
|
|
|
+ ></v-progress-circular>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div v-else class="img-content">
|
|
|
<div class="slider-btn">
|
|
|
<button class="prev" @click="prev">
|
|
|
<img class="arrow" src="../assets/img/arrow_l.png" alt="" />
|
|
@@ -245,7 +305,7 @@ function checkImg() {
|
|
|
v-for="item in currentPhotos"
|
|
|
class="bg-img"
|
|
|
>
|
|
|
- <v-img
|
|
|
+ <!-- <v-img
|
|
|
cover
|
|
|
class="cover"
|
|
|
:lazy-src="`http://172.104.93.163:3219/static/assets/img/bg/${item.bg_img}`"
|
|
@@ -259,12 +319,23 @@ function checkImg() {
|
|
|
></v-progress-circular>
|
|
|
</div>
|
|
|
</template>
|
|
|
- </v-img>
|
|
|
+ </v-img> -->
|
|
|
|
|
|
- <p>{{ t(item.title) }}</p>
|
|
|
+ <!-- <p>{{ t(item.title) }}</p> -->
|
|
|
+
|
|
|
+ <v-img cover class="cover" :lazy-src="item.imgUrl" :src="item.imgUrl">
|
|
|
+ <template v-slot:placeholder>
|
|
|
+ <div class="d-flex align-center justify-center fill-height">
|
|
|
+ <v-progress-circular
|
|
|
+ color="grey-lighten-4"
|
|
|
+ indeterminate
|
|
|
+ ></v-progress-circular>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </v-img>
|
|
|
|
|
|
<img
|
|
|
- v-if="item === assignBgImg"
|
|
|
+ v-if="item.name === store.assignBgImg"
|
|
|
class="icon active"
|
|
|
src="../assets/img/confirm.png"
|
|
|
alt=""
|
|
@@ -309,8 +380,8 @@ function checkImg() {
|
|
|
|
|
|
.cover {
|
|
|
max-width: 100%;
|
|
|
- width: 17rem;
|
|
|
- height: 20vh;
|
|
|
+ width: 75vw;
|
|
|
+ height: 50vw;
|
|
|
object-fit: cover;
|
|
|
}
|
|
|
}
|
|
@@ -320,10 +391,10 @@ function checkImg() {
|
|
|
}
|
|
|
|
|
|
.icon {
|
|
|
- width: 5rem;
|
|
|
+ width: 3.5rem;
|
|
|
position: absolute;
|
|
|
- top: 0.5rem;
|
|
|
- right: 0.5rem;
|
|
|
+ top: 0.1rem;
|
|
|
+ right: 0.1rem;
|
|
|
}
|
|
|
}
|
|
|
|