Chat.vue 110 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501
  1. <script setup>
  2. import { ref, reactive, onMounted, watch, nextTick } from "vue";
  3. import { useRoute } from "vue-router";
  4. // VR
  5. import "aframe";
  6. // i18n
  7. import { useI18n } from "vue-i18n";
  8. // Axios
  9. import axios from "axios";
  10. // Moment
  11. // import moment from "moment";
  12. // Animate
  13. import "animate.css";
  14. // Swiper
  15. import { Swiper, SwiperSlide } from "swiper/vue";
  16. import { Navigation, Autoplay } from "swiper/modules";
  17. import "swiper/css";
  18. import "swiper/css/navigation";
  19. // Recorder
  20. import Recorder from "recorder-core";
  21. import "recorder-core/src/engine/mp3";
  22. import "recorder-core/src/engine/mp3-engine";
  23. // QR Code
  24. import { QrcodeStream, QrcodeDropZone, QrcodeCapture } from "vue-qrcode-reader";
  25. // Qrcode.vue
  26. import QrcodeVue from "qrcode.vue";
  27. // Components
  28. // import Navbar from "../components/Navbar.vue";
  29. // import TicketPurchase from "../components/TicketPurchase.vue";
  30. const { t, locale } = useI18n();
  31. const route = useRoute();
  32. const routeParam = ref(null);
  33. let qrCodeDialog = ref(false);
  34. let qrCodeLoading = ref(true);
  35. let location = ref(""); // 當前位置
  36. // QR Code 掃描
  37. function onDetect(detectedCodes) {
  38. console.log("detectedCodes", detectedCodes);
  39. const url = new URL(detectedCodes[0].rawValue);
  40. location.value = url.searchParams.get("location");
  41. let val;
  42. let lang = getLang();
  43. if (lang === "en") {
  44. switch (location.value) {
  45. case "B1 鼎泰豐":
  46. val = "b1 Din Tai Fung";
  47. break;
  48. case "B1 中環":
  49. val = "b1 Centre";
  50. break;
  51. case "B1 2號電梯":
  52. val = "b1 Elevator No.2";
  53. break;
  54. case "B1 4號電梯":
  55. val = "b1 Elevator No.4";
  56. break;
  57. case "B1 3號電梯":
  58. val = "b1 Elevator No.3";
  59. break;
  60. case "1F 信義環":
  61. val = "1f South Xinyi";
  62. break;
  63. case "1F 3號電梯":
  64. val = "1f Elevator No.3";
  65. break;
  66. case "2F 3號電梯":
  67. val = "2f Elevator No.3";
  68. break;
  69. case "88F 觀景台":
  70. val = "88f Observatory";
  71. break;
  72. case "89F 觀景台":
  73. val = "89f Observatory";
  74. break;
  75. default:
  76. break;
  77. }
  78. } else if (lang === "ch") {
  79. val = location.value;
  80. }
  81. if (location.value && location.value !== "") {
  82. qrCodeDialog.value = false;
  83. messages.value.push({
  84. label: "text",
  85. author: "ai",
  86. body: `${t("current_location")}:${val}`,
  87. });
  88. changeLocation(location.value); // 選擇導覽位置
  89. } else {
  90. qrCodeDialog.value = false;
  91. messages.value.push({
  92. label: "text",
  93. author: "ai",
  94. body: "讀取錯誤,請重新掃描。",
  95. });
  96. }
  97. }
  98. // QR Code 彈跳視窗
  99. let qrcodeImgDialog = ref(false);
  100. let qrcodeImgUrl = ref("");
  101. // 開啟掃描視窗
  102. function openQrcodeDialog(item) {
  103. console.log("item", item);
  104. qrcodeImgUrl.value = item;
  105. qrcodeImgDialog.value = true;
  106. }
  107. // 判斷 vue-qrcode-reader 是否加載完成
  108. function onInit(capabilities) {
  109. qrCodeLoading.value = false;
  110. }
  111. onMounted(() => {
  112. // 取得當前路由參數
  113. routeParam.value = route.path.replace("/", "");
  114. console.log("網址參數", routeParam.value);
  115. window.addEventListener("resize", handleResize);
  116. });
  117. const userMessage = ref("");
  118. let modules = [Navigation, Autoplay]; // Swiper
  119. // AI 客服回覆訊息
  120. let messages = ref([]);
  121. watch(messages.value, (val) => {
  122. console.log("messages", val);
  123. scrollToBottom();
  124. updateMenuHeight();
  125. });
  126. let ad = ref({}); // 彈跳視窗廣告
  127. let qaQuery = reactive([]);
  128. const chatArea = ref(null); // 對話框
  129. // 滾動到對話框底部
  130. const scrollToBottom = () => {
  131. setTimeout(() => {
  132. // chatArea.value.scrollTop = chatArea.value.scrollHeight;
  133. console.log("chatArea.value", chatArea.value.scrollHeight);
  134. chatArea.value.scrollTo({
  135. top: chatArea.value.scrollHeight,
  136. behavior: "smooth",
  137. });
  138. // window.scrollTo({
  139. // top: document.body.scrollHeight,
  140. // behavior: "smooth", // 平滑滾動
  141. // });
  142. }, 100);
  143. // let list = messages.value;
  144. // const item = list[list.length - 1];
  145. // if (item.label === "text") {
  146. // setTimeout(() => {
  147. // chatArea.value.scrollTop = chatArea.value.scrollHeight;
  148. // }, 100);
  149. // }
  150. };
  151. // 對話選項(按鈕)
  152. function setBtnValue(val) {
  153. console.log("value", val);
  154. userMessage.value = val;
  155. sendMessage("text");
  156. }
  157. // 傳送訊息 (如 type="text" 代表為純文字訊息,不需語音回覆)
  158. async function sendMessage(type = "") {
  159. if (userMessage.value === "") {
  160. return;
  161. }
  162. console.log("sendMessage", userMessage.value);
  163. qaQuery.push(userMessage.value);
  164. let message = userMessage.value;
  165. userMessage.value = "";
  166. let url = "https://api.itri-101-5g.com/v1/qa/";
  167. try {
  168. // 使用者訊息
  169. messages.value.push({
  170. label: "text",
  171. body: message,
  172. author: "user",
  173. });
  174. videoLoading.value = true;
  175. let isVideoCache = await getVideoCache(message); // 判斷使用者問題是否有 Video Cache
  176. console.log("isVideoCache", isVideoCache);
  177. // 如果有 Video Cache 則不需回傳工研院回答
  178. if (isVideoCache) {
  179. handleVideoCache(); // 播放 Video Cache
  180. if (audioFile.value && type !== "text") {
  181. messageSaveMp3(message, videoCacheData.value.answer, []);
  182. } else {
  183. messageSave(message, videoCacheData.value.answer, []);
  184. }
  185. return;
  186. }
  187. axios
  188. .post(
  189. url,
  190. new URLSearchParams({
  191. query: JSON.stringify(qaQuery), // 使用者問句
  192. language: selectLang.value, // 語系
  193. category: assignCategory.value, // 類別
  194. subtype: assignSubtype.value, // 詳細類別(非必填)
  195. from_loc: "", // 定位點
  196. to_loc: "", // 導覽點
  197. }),
  198. {
  199. headers: {
  200. "Content-Type": "application/x-www-form-urlencoded",
  201. },
  202. }
  203. )
  204. .then(async (response) => {
  205. // if (showAnchor.value) {
  206. // getVideo(response.data);
  207. // }
  208. // AI 客服回傳訊息
  209. messages.value.push({
  210. label: "text",
  211. author: "ai",
  212. body: response.data.response,
  213. });
  214. console.log("response", response);
  215. if (audioFile.value && type !== "text") {
  216. messageSaveMp3(message, response.data.response, response.data.data);
  217. } else {
  218. messageSave(message, response.data.response, response.data.data);
  219. }
  220. messageNotInCache(message, response.data.response); // 回傳未收錄問題
  221. if (type !== "text") {
  222. handleTTS(response.data.response); // 取得語音回覆
  223. }
  224. if (response.data.data.length) {
  225. let info = {
  226. buttonList: [], // 按鈕
  227. ticketList: [], // 票券
  228. };
  229. let labelContent;
  230. response.data.data.map((item) => {
  231. if (item.type === "button") {
  232. console.log("按鈕");
  233. info.buttonList.push(item);
  234. labelContent = "ticket";
  235. } else if (item.type === "ticket") {
  236. console.log("票");
  237. info.ticketList.push(item);
  238. labelContent = "ticket";
  239. } else if (item.type === "brand") {
  240. console.log("品牌");
  241. info.ticketList.push(item);
  242. labelContent = "brand";
  243. }
  244. });
  245. console.log("info", info);
  246. console.log("labelContent", labelContent);
  247. setTimeout(() => {
  248. messages.value.push({
  249. label: labelContent,
  250. author: "ai",
  251. body: info,
  252. });
  253. }, 10);
  254. }
  255. })
  256. .catch((error) => {
  257. console.error("Error:", error);
  258. });
  259. console.log("messages.value", messages.value);
  260. } catch (error) {
  261. console.log("error", error);
  262. }
  263. }
  264. let hideMenu = ref(true); // 底部選單
  265. let showInput = ref(true); // 輸入框
  266. function getLang() {
  267. let lang = localStorage.getItem("lang");
  268. let langVal = "";
  269. switch (lang) {
  270. case "zh-tw":
  271. langVal = "ch";
  272. break;
  273. case "en-us":
  274. langVal = "en";
  275. break;
  276. default:
  277. break;
  278. }
  279. return langVal;
  280. }
  281. let showAd = ref(false);
  282. // 取得廣告
  283. async function setAd() {
  284. let lang = getLang();
  285. console.log("lang", lang);
  286. let url = `https://cmm.ai:9101/ad?language=${lang}`;
  287. try {
  288. const response = await axios.get(url);
  289. console.log("Ad response", response);
  290. ad.value = response.data.data.body;
  291. console.log("Ad", ad.value);
  292. } catch (error) {
  293. console.log("error", error);
  294. }
  295. }
  296. let video = ref(null);
  297. function videoPlay() {
  298. video.value.load();
  299. video.value.play();
  300. }
  301. // 底部選單
  302. const menu = ref(null);
  303. const menuHeight = ref(0);
  304. let isRotate = ref(false);
  305. let isLanguagePage = ref(true);
  306. let selectLang = ref("");
  307. let chatLoading = ref(true);
  308. watch(isLanguagePage, (val) => {
  309. if (!val) {
  310. setTimeout(updateMenuHeight, 500);
  311. }
  312. });
  313. const handleResize = () => {
  314. updateMenuHeight();
  315. };
  316. // 取得底部選單高度
  317. const updateMenuHeight = () => {
  318. nextTick(() => {
  319. if (menu.value) {
  320. menuHeight.value = menu.value.clientHeight;
  321. chatLoading.value = false;
  322. }
  323. });
  324. };
  325. // 語言下拉選單 (Kiosk)
  326. function onLanguageChange(lang) {
  327. isVideoPause.value = true;
  328. if (lang === "中文") {
  329. chooseLang("zh-tw");
  330. } else if (lang === "English") {
  331. chooseLang("en-us");
  332. }
  333. }
  334. function chooseLang(lang) {
  335. console.log("選擇語言:", lang);
  336. selectLang.value = lang;
  337. isLanguagePage.value = false;
  338. locale.value = lang; // i18n locale
  339. localStorage.setItem("lang", lang);
  340. messages.value.push({
  341. label: "text",
  342. author: "ai",
  343. body: t("prologue"),
  344. });
  345. messages.value.push({
  346. label: "text",
  347. author: "ai",
  348. body: t("service"),
  349. });
  350. // 判斷語言修改 title
  351. const language = localStorage.getItem("lang") || "zh-tw";
  352. console.log("language", language);
  353. if (language === "zh-tw") {
  354. document.title = "New 台北101 AI智能客服";
  355. } else if (language === "en-us") {
  356. document.title = "New Taipei 101 AI Intelligent Customer Service";
  357. }
  358. setAd();
  359. handleClick();
  360. // 影片路徑
  361. loadVideoSources();
  362. // let lang = getLang();
  363. let sources;
  364. console.log("videoSources.value", videoSources.value);
  365. if (language === "zh-tw") {
  366. sources = videoSources.value;
  367. } else if (language === "en-us") {
  368. sources = videoSourcesEn.value;
  369. }
  370. const randomIndex = Math.floor(Math.random() * sources.length);
  371. videoSrc.value = sources[randomIndex];
  372. hideAnchorPrologue.value = true;
  373. videoIndex.value = randomIndex + 1;
  374. console.log("messages.value", messages.value);
  375. setTimeout(() => {
  376. showAd.value = true;
  377. videoPlay();
  378. }, 500);
  379. }
  380. let assignSubtype = ref("");
  381. let assignCategory = ref("");
  382. let assignCategoryIndex = ref(null);
  383. // 美食伴手禮
  384. let diningList = reactive([
  385. {
  386. value: "特色/高空餐廳",
  387. text: "food_souvenirs_info.signature",
  388. },
  389. {
  390. value: "輕食/CAFÉ",
  391. text: "food_souvenirs_info.light",
  392. },
  393. {
  394. value: "美食街",
  395. text: "food_souvenirs_info.courts",
  396. },
  397. {
  398. value: "伴手禮",
  399. text: "food_souvenirs_info.souvenir",
  400. },
  401. ]);
  402. // 秘境花園觀景台
  403. let observationList = reactive([
  404. {
  405. value: "線上購票",
  406. text: "observatory_info.tickets.title",
  407. },
  408. {
  409. value: "參觀資訊",
  410. text: "observatory_info.visitor.title",
  411. },
  412. // {
  413. // value: "實境景色",
  414. // text: "observatory_info.view",
  415. // },
  416. {
  417. value: "前往秘境花園觀景台",
  418. text: "observatory_info.garden",
  419. },
  420. ]);
  421. // 購物及優惠
  422. let shoppingList = reactive([
  423. {
  424. value: "購物品牌查詢",
  425. text: "shopping_discounts_info.brands.title",
  426. },
  427. {
  428. value: "國際貴賓卡專屬禮遇",
  429. text: "shopping_discounts_info.tourist_card.title",
  430. },
  431. ]);
  432. // 購物品牌查詢
  433. let brandList = reactive([
  434. {
  435. value: "國際珠寶腕錶",
  436. text: "shopping_discounts_info.brands.jewely",
  437. },
  438. {
  439. value: "國際精品",
  440. text: "shopping_discounts_info.brands.boutique",
  441. },
  442. {
  443. value: "美妝保養品",
  444. text: "shopping_discounts_info.brands.skincare",
  445. },
  446. {
  447. value: "流行服飾",
  448. text: "shopping_discounts_info.brands.apparel",
  449. },
  450. {
  451. value: "生活居家/3C",
  452. text: "shopping_discounts_info.brands.lifestyle",
  453. },
  454. {
  455. value: "文化創意",
  456. text: "shopping_discounts_info.brands.cultural",
  457. },
  458. {
  459. value: "特色品牌",
  460. text: "shopping_discounts_info.brands.signature",
  461. },
  462. {
  463. value: "館外店家",
  464. text: "shopping_discounts_info.brands.outside",
  465. },
  466. ]);
  467. // 服務資訊
  468. let serviceList = reactive([
  469. {
  470. title: "service_info.business_hours",
  471. depiction: "service_info.business_hours_1",
  472. },
  473. {
  474. title: "service_info.tax_refund",
  475. depiction: "service_info.tax_refund_1",
  476. },
  477. {
  478. title: "service_info.toilets",
  479. depiction: "service_info.toilets_1",
  480. },
  481. {
  482. title: "service_info.charge",
  483. depiction: "service_info.charge_1",
  484. },
  485. // {
  486. // title: "AI 天燈",
  487. // depiction: "https://cmm.ai/101-postcard/#/skylanternhome",
  488. // },
  489. ]);
  490. // 定位點
  491. // 定位點
  492. let locationList = reactive([
  493. {
  494. location: {
  495. value: "B1 鼎泰豐", // 編號 1
  496. text: "location.b1_din_tai_fung",
  497. },
  498. navigation: [
  499. {
  500. value: "景觀餐廳櫃台",
  501. text: "high_rise_restaurant_reception",
  502. },
  503. {
  504. value: "ATM",
  505. text: "atm",
  506. },
  507. {
  508. value: "觀景台售票處",
  509. text: "observatory_ticket_office",
  510. },
  511. {
  512. value: "鼎泰豐",
  513. text: "din_tai_fung",
  514. },
  515. {
  516. value: "捷運",
  517. text: "metro_station",
  518. },
  519. {
  520. value: "超市",
  521. text: "supermarket",
  522. },
  523. {
  524. value: "美食街",
  525. text: "food_court",
  526. },
  527. {
  528. value: "退稅/外幣兌換櫃台",
  529. text: "tax_refund_currency_exchange",
  530. },
  531. {
  532. value: "計程車乘車處",
  533. text: "taxi_station",
  534. },
  535. {
  536. value: "無障礙廁所",
  537. text: "accessible_facilities",
  538. },
  539. {
  540. value: "客服(停車折抵)",
  541. text: "service_counter_parking_discount",
  542. },
  543. {
  544. value: "哺乳室",
  545. text: "nursing_room",
  546. },
  547. {
  548. value: "飲水機",
  549. text: "ice_warmed_water_dispenser",
  550. },
  551. {
  552. value: "伴手禮區",
  553. text: "snackable_souvenirs",
  554. },
  555. {
  556. value: "廁所",
  557. text: "restroom",
  558. },
  559. {
  560. value: "置物櫃",
  561. text: "items_and_luggage_storage",
  562. },
  563. ],
  564. },
  565. {
  566. location: {
  567. value: "B1 中環", // 編號 2
  568. text: "location.b1_centre",
  569. },
  570. navigation: [
  571. {
  572. value: "景觀餐廳櫃台",
  573. text: "high_rise_restaurant_reception",
  574. },
  575. {
  576. value: "ATM",
  577. text: "atm",
  578. },
  579. {
  580. value: "觀景台售票處",
  581. text: "observatory_ticket_office",
  582. },
  583. {
  584. value: "美食街",
  585. text: "food_court",
  586. },
  587. {
  588. value: "伴手禮區",
  589. text: "snackable_souvenirs",
  590. },
  591. {
  592. value: "鼎泰豐",
  593. text: "din_tai_fung",
  594. },
  595. {
  596. value: "捷運",
  597. text: "metro_station",
  598. },
  599. {
  600. value: "超市",
  601. text: "supermarket",
  602. },
  603. {
  604. value: "計程車乘車處",
  605. text: "taxi_station",
  606. },
  607. {
  608. value: "無障礙廁所",
  609. text: "accessible_facilities",
  610. },
  611. ],
  612. // navigation: [
  613. // "景觀餐廳櫃台",
  614. // "ATM",
  615. // "觀景台售票處",
  616. // "美食街",
  617. // "伴手禮區",
  618. // "鼎泰豐",
  619. // "捷運",
  620. // "超市",
  621. // "計程車乘車處",
  622. // "無障礙廁所",
  623. // ],
  624. },
  625. {
  626. location: {
  627. value: "B1 2號電梯", // 編號 3
  628. text: "location.b1_elevator_no_2",
  629. },
  630. navigation: [
  631. {
  632. value: "景觀餐廳櫃台",
  633. text: "high_rise_restaurant_reception",
  634. },
  635. {
  636. value: "ATM",
  637. text: "atm",
  638. },
  639. {
  640. value: "觀景台售票處",
  641. text: "observatory_ticket_office",
  642. },
  643. {
  644. value: "客服(退稅櫃台/外幣兌換)",
  645. text: "tax_refund_currency_exchange",
  646. },
  647. {
  648. value: "計程車乘車處",
  649. text: "taxi_station",
  650. },
  651. {
  652. value: "無障礙廁所",
  653. text: "accessible_facilities",
  654. },
  655. {
  656. value: "超市",
  657. text: "supermarket",
  658. },
  659. {
  660. value: "鼎泰豐",
  661. text: "din_tai_fung",
  662. },
  663. {
  664. value: "捷運",
  665. text: "metro_station",
  666. },
  667. {
  668. value: "伴手禮區",
  669. text: "snackable_souvenirs",
  670. },
  671. {
  672. value: "廁所",
  673. text: "restroom",
  674. },
  675. {
  676. value: "置物櫃",
  677. text: "items_and_luggage_storage",
  678. },
  679. {
  680. value: "美食街",
  681. text: "food_court",
  682. },
  683. {
  684. value: "客服(停車折抵)",
  685. text: "service_counter_parking_discount",
  686. },
  687. {
  688. value: "哺乳室",
  689. text: "nursing_room",
  690. },
  691. {
  692. value: "飲水機",
  693. text: "ice_warmed_water_dispenser",
  694. },
  695. {
  696. value: "廁所",
  697. text: "restroom",
  698. },
  699. ],
  700. // navigation: [
  701. // "景觀餐廳櫃台",
  702. // "ATM",
  703. // "觀景台售票處",
  704. // "客服(退稅櫃台/外幣兌換)",
  705. // "計程車乘車處",
  706. // "無障礙廁所",
  707. // "超市",
  708. // "鼎泰豐",
  709. // "捷運",
  710. // "伴手禮區",
  711. // "廁所",
  712. // "置物櫃",
  713. // "美食街",
  714. // "客服(停車折抵)",
  715. // "哺乳室",
  716. // "飲水機",
  717. // "廁所",
  718. // ],
  719. },
  720. {
  721. location: {
  722. value: "B1 4號電梯", // 編號 4
  723. text: "location.b1_elevator_no_4",
  724. },
  725. navigation: [
  726. {
  727. value: "景觀餐廳櫃台",
  728. text: "high_rise_restaurant_reception",
  729. },
  730. {
  731. value: "ATM",
  732. text: "atm",
  733. },
  734. {
  735. value: "觀景台售票處",
  736. text: "observatory_ticket_office",
  737. },
  738. {
  739. value: "廁所",
  740. text: "restroom",
  741. },
  742. {
  743. value: "置物櫃",
  744. text: "items_and_luggage_storage",
  745. },
  746. {
  747. value: "客服(停車折抵)",
  748. text: "service_counter_parking_discount",
  749. },
  750. {
  751. value: "哺乳室",
  752. text: "nursing_room",
  753. },
  754. {
  755. value: "飲水機",
  756. text: "ice_warmed_water_dispenser",
  757. },
  758. {
  759. value: "退稅/外幣兌換櫃台",
  760. text: "tax_refund_currency_exchange",
  761. },
  762. {
  763. value: "計程車乘車處",
  764. text: "taxi_station",
  765. },
  766. {
  767. value: "無障礙廁所",
  768. text: "accessible_facilities",
  769. },
  770. {
  771. value: "伴手禮區",
  772. text: "snackable_souvenirs",
  773. },
  774. {
  775. value: "捷運",
  776. text: "metro_station",
  777. },
  778. {
  779. value: "鼎泰豐",
  780. text: "din_tai_fung",
  781. },
  782. {
  783. value: "美食街",
  784. text: "food_court",
  785. },
  786. {
  787. value: "超市",
  788. text: "supermarket",
  789. },
  790. ],
  791. // navigation: [
  792. // "景觀餐廳櫃台",
  793. // "ATM",
  794. // "觀景台售票處",
  795. // "廁所",
  796. // "置物櫃",
  797. // "客服(停車折抵)",
  798. // "哺乳室",
  799. // "飲水機",
  800. // "退稅/外幣兌換櫃台",
  801. // "計程車乘車處",
  802. // "無障礙廁所",
  803. // "伴手禮區",
  804. // "捷運",
  805. // "鼎泰豐",
  806. // "美食街",
  807. // "超市",
  808. // ],
  809. },
  810. {
  811. location: {
  812. value: "B1 3號電梯", // 編號 5
  813. text: "location.b1_elevator_no_3",
  814. },
  815. navigation: [
  816. {
  817. value: "景觀餐廳櫃台",
  818. text: "high_rise_restaurant_reception",
  819. },
  820. {
  821. value: "ATM",
  822. text: "atm",
  823. },
  824. {
  825. value: "觀景台售票處",
  826. text: "observatory_ticket_office",
  827. },
  828. {
  829. value: "廁所",
  830. text: "restroom",
  831. },
  832. {
  833. value: "無障礙廁所",
  834. text: "accessible_facilities",
  835. },
  836. {
  837. value: "計程車乘車處",
  838. text: "taxi_station",
  839. },
  840. {
  841. value: "客服(退稅櫃台/外幣兌換)",
  842. text: "tax_refund_currency_exchange",
  843. },
  844. {
  845. value: "飲水機",
  846. text: "ice_warmed_water_dispenser",
  847. },
  848. {
  849. value: "哺乳室",
  850. text: "nursing_room",
  851. },
  852. {
  853. value: "置物櫃",
  854. text: "items_and_luggage_storage",
  855. },
  856. {
  857. value: "客服(停車折抵)",
  858. text: "service_counter_parking_discount",
  859. },
  860. {
  861. value: "美食街",
  862. text: "food_court",
  863. },
  864. {
  865. value: "伴手禮區",
  866. text: "snackable_souvenirs",
  867. },
  868. {
  869. value: "鼎泰豐",
  870. text: "din_tai_fung",
  871. },
  872. {
  873. value: "捷運",
  874. text: "metro_station",
  875. },
  876. {
  877. value: "超市",
  878. text: "supermarket",
  879. },
  880. ],
  881. // navigation: [
  882. // "景觀餐廳櫃台",
  883. // "ATM",
  884. // "觀景台售票處",
  885. // "廁所",
  886. // "無障礙廁所",
  887. // "計程車乘車處",
  888. // "客服(退稅櫃台/外幣兌換)",
  889. // "飲水機",
  890. // "哺乳室",
  891. // "置物櫃",
  892. // "客服(停車折抵)",
  893. // "美食街",
  894. // "伴手禮區",
  895. // "鼎泰豐",
  896. // "捷運",
  897. // "超市",
  898. // ],
  899. },
  900. {
  901. location: {
  902. value: "1F 信義環", // 編號 6
  903. text: "location.1f_south_xinyi",
  904. },
  905. navigation: [
  906. {
  907. value: "景觀餐廳櫃台",
  908. text: "high_rise_restaurant_reception",
  909. },
  910. {
  911. value: "ATM",
  912. text: "atm",
  913. },
  914. {
  915. value: "觀景台售票處",
  916. text: "observatory_ticket_office",
  917. },
  918. {
  919. value: "廁所",
  920. text: "restroom",
  921. },
  922. {
  923. value: "ATM",
  924. text: "atm",
  925. },
  926. {
  927. value: "置物櫃",
  928. text: "items_and_luggage_storage",
  929. },
  930. {
  931. value: "飲水機",
  932. text: "ice_warmed_water_dispenser",
  933. },
  934. {
  935. value: "無障礙廁所",
  936. text: "accessible_facilities",
  937. },
  938. {
  939. value: "哺乳室",
  940. text: "nursing_room",
  941. },
  942. {
  943. value: "客服(停車折抵)",
  944. text: "service_counter_parking_discount",
  945. },
  946. {
  947. value: "退稅/外幣兌換櫃台",
  948. text: "tax_refund_currency_exchange",
  949. },
  950. {
  951. value: "伴手禮區",
  952. text: "snackable_souvenirs",
  953. },
  954. {
  955. value: "美食街",
  956. text: "food_court",
  957. },
  958. {
  959. value: "捷運",
  960. text: "metro_station",
  961. },
  962. {
  963. value: "鼎泰豐",
  964. text: "din_tai_fung",
  965. },
  966. {
  967. value: "超市",
  968. text: "supermarket",
  969. },
  970. ],
  971. // navigation: [
  972. // "景觀餐廳櫃台",
  973. // "ATM",
  974. // "觀景台售票處",
  975. // "廁所",
  976. // "ATM",
  977. // "置物櫃",
  978. // "飲水機",
  979. // "無障礙廁所",
  980. // "哺乳室",
  981. // "客服(停車折抵)",
  982. // "退稅/外幣兌換櫃台",
  983. // "伴手禮區",
  984. // "美食街",
  985. // "捷運",
  986. // "鼎泰豐",
  987. // "超市",
  988. // ],
  989. },
  990. {
  991. location: {
  992. value: "1F 3號電梯", // 編號 7
  993. text: "location.1f_elevator_no_3",
  994. },
  995. navigation: [
  996. {
  997. value: "景觀餐廳櫃台",
  998. text: "high_rise_restaurant_reception",
  999. },
  1000. {
  1001. value: "ATM",
  1002. text: "atm",
  1003. },
  1004. {
  1005. value: "觀景台售票處",
  1006. text: "observatory_ticket_office",
  1007. },
  1008. {
  1009. value: "廁所",
  1010. text: "restroom",
  1011. },
  1012. {
  1013. value: "置物櫃",
  1014. text: "items_and_luggage_storage",
  1015. },
  1016. {
  1017. value: "飲水機",
  1018. text: "ice_warmed_water_dispenser",
  1019. },
  1020. {
  1021. value: "無障礙廁所",
  1022. text: "accessible_facilities",
  1023. },
  1024. {
  1025. value: "哺乳室",
  1026. text: "nursing_room",
  1027. },
  1028. {
  1029. value: "客服(停車折抵)",
  1030. text: "service_counter_parking_discount",
  1031. },
  1032. {
  1033. value: "退稅/外幣兌換櫃台",
  1034. text: "tax_refund_currency_exchange",
  1035. },
  1036. {
  1037. value: "計程車乘車處",
  1038. text: "taxi_station",
  1039. },
  1040. {
  1041. value: "美食街",
  1042. text: "food_court",
  1043. },
  1044. {
  1045. value: "超市",
  1046. text: "supermarket",
  1047. },
  1048. {
  1049. value: "捷運",
  1050. text: "metro_station",
  1051. },
  1052. {
  1053. value: "伴手禮區",
  1054. text: "snackable_souvenirs",
  1055. },
  1056. ],
  1057. // navigation: [
  1058. // "景觀餐廳櫃台",
  1059. // "ATM",
  1060. // "觀景台售票處",
  1061. // "廁所",
  1062. // "置物櫃",
  1063. // "飲水機",
  1064. // "無障礙廁所",
  1065. // "哺乳室",
  1066. // "客服(停車折抵)",
  1067. // "退稅/外幣兌換櫃台",
  1068. // "計程車乘車處",
  1069. // "美食街",
  1070. // "超市",
  1071. // "捷運",
  1072. // "伴手禮區",
  1073. // ],
  1074. },
  1075. {
  1076. location: {
  1077. value: "2F 3號電梯", // 編號 8
  1078. text: "location.2f_elevator_no_3",
  1079. },
  1080. navigation: [
  1081. {
  1082. value: "景觀餐廳櫃台",
  1083. text: "high_rise_restaurant_reception",
  1084. },
  1085. {
  1086. value: "ATM",
  1087. text: "atm",
  1088. },
  1089. {
  1090. value: "觀景台售票處",
  1091. text: "observatory_ticket_office",
  1092. },
  1093. {
  1094. value: "廁所",
  1095. text: "restroom",
  1096. },
  1097. {
  1098. value: "置物櫃",
  1099. text: "items_and_luggage_storage",
  1100. },
  1101. {
  1102. value: "飲水機",
  1103. text: "ice_warmed_water_dispenser",
  1104. },
  1105. {
  1106. value: "無障礙廁所",
  1107. text: "accessible_facilities",
  1108. },
  1109. {
  1110. value: "哺乳室",
  1111. text: "nursing_room",
  1112. },
  1113. {
  1114. value: "計程車乘車處",
  1115. text: "taxi_station",
  1116. },
  1117. {
  1118. value: "退稅/外幣兌換櫃台",
  1119. text: "tax_refund_currency_exchange",
  1120. },
  1121. {
  1122. value: "客服(停車折抵)",
  1123. text: "service_counter_parking_discount",
  1124. },
  1125. ],
  1126. // navigation: [
  1127. // "景觀餐廳櫃台",
  1128. // "ATM",
  1129. // "觀景台售票處",
  1130. // "廁所",
  1131. // "置物櫃",
  1132. // "飲水機",
  1133. // "無障礙廁所",
  1134. // "哺乳室",
  1135. // "計程車乘車處",
  1136. // "退稅/外幣兌換櫃台",
  1137. // "客服(停車折抵)",
  1138. // ],
  1139. },
  1140. {
  1141. location: {
  1142. value: "89F 觀景台", // 編號 9
  1143. text: "location.89f_observatory",
  1144. },
  1145. navigation: [
  1146. {
  1147. value: "景觀餐廳櫃台",
  1148. text: "high_rise_restaurant_reception",
  1149. },
  1150. {
  1151. value: "ATM",
  1152. text: "atm",
  1153. },
  1154. {
  1155. value: "客服",
  1156. text: "service_counter",
  1157. },
  1158. {
  1159. value: "91F戶外區",
  1160. text: "91f_outdoor_area",
  1161. },
  1162. {
  1163. value: "廁所",
  1164. text: "restroom",
  1165. },
  1166. {
  1167. value: "101F排隊處",
  1168. text: "101f_queue_area",
  1169. },
  1170. ],
  1171. // navigation: [
  1172. // "景觀餐廳櫃台",
  1173. // "ATM",
  1174. // "客服",
  1175. // "91F戶外區",
  1176. // "廁所",
  1177. // "101F排隊處",
  1178. // ],
  1179. },
  1180. {
  1181. location: {
  1182. value: "88F 觀景台", // 編號 10
  1183. text: "location.88f_observatory",
  1184. },
  1185. navigation: [
  1186. {
  1187. value: "景觀餐廳櫃台",
  1188. text: "high_rise_restaurant_reception",
  1189. },
  1190. {
  1191. value: "ATM",
  1192. text: "atm",
  1193. },
  1194. {
  1195. value: "廁所",
  1196. text: "restroom",
  1197. },
  1198. {
  1199. value: "飲水機",
  1200. text: "ice_warmed_water_dispenser",
  1201. },
  1202. {
  1203. value: "哺乳室",
  1204. text: "nursing_room",
  1205. },
  1206. ],
  1207. // navigation: ["景觀餐廳櫃台", "ATM", "廁所", "飲水機", "哺乳室"],
  1208. },
  1209. ]);
  1210. // 平面圖
  1211. let mapList = reactive([
  1212. {
  1213. value: "B1 平面圖",
  1214. text: "b1_floor_plan",
  1215. },
  1216. {
  1217. value: "1F 平面圖",
  1218. text: "1f_floor_plan",
  1219. },
  1220. {
  1221. value: "2F 平面圖",
  1222. text: "2f_floor_plan",
  1223. },
  1224. ]);
  1225. let assignLocation = ref("當前位置"); // 指定定位點
  1226. let assignLocationText = ref(""); // 指定定位點 (i18n)
  1227. let assignNavigationList = ref(null); // 指定導覽點列表
  1228. let arVideo = ref(null);
  1229. let arVideoDialog = ref(false);
  1230. // 取得 AR 導覽影片
  1231. async function getArviews(route, text, type = "") {
  1232. let url;
  1233. let lang = getLang();
  1234. console.log("text >>>", text);
  1235. if (type === "garden") {
  1236. console.log("route", route);
  1237. let start;
  1238. switch (route) {
  1239. case "B1 鼎泰豐旁 數位屏幕":
  1240. start = "B1 鼎泰豐";
  1241. break;
  1242. case "B1 中環WOW屏幕":
  1243. start = "B1 中環";
  1244. break;
  1245. case "B1 信義橘梯梯廳":
  1246. start = "B1 2號電梯";
  1247. break;
  1248. case "B1 信義綠梯梯廳":
  1249. start = "B1 4號電梯";
  1250. break;
  1251. case "B1 松智藍梯梯廳":
  1252. start = "B1 3號電梯";
  1253. break;
  1254. case "1F 信義綠梯出入口":
  1255. start = "1F 信義環";
  1256. break;
  1257. case "1F 松智梯廳":
  1258. start = "1F 3號電梯";
  1259. break;
  1260. case "2F 松智藍梯梯廳":
  1261. start = "2F 3號電梯";
  1262. break;
  1263. default:
  1264. break;
  1265. }
  1266. url = `https://cmm.ai:9101/arviews?language=${lang}&start=${start}&end=觀景台售票處`;
  1267. } else {
  1268. url = `https://cmm.ai:9101/arviews?language=${lang}&start=${assignLocation.value}&end=${route}`;
  1269. }
  1270. console.log("url", url);
  1271. messages.value.push({
  1272. label: "text",
  1273. author: "ai",
  1274. body: text,
  1275. });
  1276. try {
  1277. const response = await axios.get(url);
  1278. console.log("AR 導覽影片", response);
  1279. messages.value.push({
  1280. label: "ar_views",
  1281. author: "ai",
  1282. body: response.data,
  1283. });
  1284. } catch (error) {
  1285. console.log("error", error);
  1286. }
  1287. }
  1288. // 取得定位點 & 導覽點
  1289. function changeLocation(item) {
  1290. console.log("item", item);
  1291. console.log("定位點:", item);
  1292. // 掃描 QR Code
  1293. // assignLocation.value = item;
  1294. // let assign = locationList.filter((e) => e.location === item);
  1295. // console.log("assign", assign);
  1296. // assignNavigationList.value = assign[0].navigation;
  1297. // 下拉選單
  1298. assignLocation.value = item.location.value;
  1299. assignNavigationList.value = item.navigation;
  1300. assignLocationText.value = item.location.text;
  1301. console.log("assignLocation.value", assignLocation.value);
  1302. console.log("assignNavigationList.value", assignNavigationList.value);
  1303. messages.value.push({
  1304. label: "text",
  1305. author: "ai",
  1306. body: t("select_navigation_location"),
  1307. });
  1308. messages.value.push({
  1309. label: "navigation",
  1310. author: "ai",
  1311. body: assignNavigationList.value,
  1312. });
  1313. }
  1314. // 顯示平面圖
  1315. function assignMapImg(item) {
  1316. console.log("顯示平面圖 item", item);
  1317. let name;
  1318. if (item.value === "B1 平面圖") {
  1319. name = "All_b1";
  1320. } else if (item.value === "1F 平面圖") {
  1321. name = "All_1";
  1322. } else if (item.value === "2F 平面圖") {
  1323. name = "All_2";
  1324. }
  1325. messages.value.push({
  1326. label: "map_img",
  1327. author: "ai",
  1328. body: name,
  1329. });
  1330. }
  1331. // 動態引入視頻文件
  1332. const videoSources = ref([]); // 開場白影片(中)
  1333. const videoSourcesEn = ref([]); // 開場白影片(英)
  1334. const videoMuteSources = ref([]); // 點頭影片(靜音)
  1335. const videoSpeakSources = ref([]); // 動嘴型影片
  1336. const loadVideoSources = async () => {
  1337. // 本地端影片路徑
  1338. // const start1 = await import("@/assets/video/start_1.mp4");
  1339. // const start2 = await import("@/assets/video/start_2.mp4");
  1340. // const mute_1 = await import("@/assets/video/mute_1.mp4");
  1341. // const mute_2 = await import("@/assets/video/mute_2.mp4");
  1342. // const speak_1 = await import("@/assets/video/speak_1.mp4");
  1343. // const speak_2 = await import("@/assets/video/speak_2.mp4");
  1344. // videoSpeakSources.value = [speak_1.default, speak_2.default];
  1345. videoSources.value = [
  1346. // "https://cmm.ai/101-ai-chatbot-new/video/start_1.mp4",
  1347. "https://cmm.ai/101-ai-chatbot-new/video/start_2.mp4",
  1348. ];
  1349. videoSourcesEn.value = [
  1350. // "https://cmm.ai/101-ai-chatbot-new/video/start_en_1.mp4",
  1351. "https://cmm.ai/101-ai-chatbot-new/video/start_en_2.mp4",
  1352. ];
  1353. videoMuteSources.value = [
  1354. // "https://cmm.ai/101-ai-chatbot-new/video/mute_1.mp4",
  1355. "https://cmm.ai/101-ai-chatbot-new/video/mute_2.mp4",
  1356. ];
  1357. videoSpeakSources.value = [
  1358. // "https://cmm.ai/101-ai-chatbot-new/video/speak_1.mp4",
  1359. "https://cmm.ai/101-ai-chatbot-new/video/speak_2.mp4",
  1360. ];
  1361. };
  1362. let videoSrc = ref("");
  1363. let hideAnchorPrologue = ref(false); // 顯示開場白 or 點頭影片
  1364. let videoIndex = ref(null); // 影片編號
  1365. // 選擇類別
  1366. async function selectCategory(value, index) {
  1367. assignCategory.value = value;
  1368. assignCategoryIndex.value = index;
  1369. if (value === "叫出真人客服") {
  1370. showAnchor.value = true;
  1371. if (currentAudio.value && isAudioPlaying.value) {
  1372. handleVoice("pause"); // 暫停音訊
  1373. }
  1374. // 隨機取得影片路徑
  1375. await loadVideoSources();
  1376. // 主播開場白只顯示一次
  1377. if (!hideAnchorPrologue.value) {
  1378. let lang = getLang();
  1379. let sources;
  1380. if (lang === "ch") {
  1381. sources = videoSources.value;
  1382. } else if (lang === "en") {
  1383. sources = videoSourcesEn.value;
  1384. }
  1385. const randomIndex = Math.floor(Math.random() * sources.length);
  1386. videoSrc.value = sources[randomIndex];
  1387. hideAnchorPrologue.value = true;
  1388. videoIndex.value = randomIndex + 1;
  1389. // const randomIndex = Math.floor(Math.random() * videoSources.value.length);
  1390. // videoSrc.value = videoSources.value[randomIndex];
  1391. // hideAnchorPrologue.value = true;
  1392. // videoIndex.value = randomIndex + 1;
  1393. } else {
  1394. const randomIndex = Math.floor(
  1395. Math.random() * videoMuteSources.value.length
  1396. );
  1397. videoSrc.value = videoMuteSources.value[randomIndex];
  1398. videoIndex.value = randomIndex + 1;
  1399. }
  1400. // 播放影片
  1401. setTimeout(() => {
  1402. videoPlay();
  1403. }, 0);
  1404. // const randomIndex = Math.floor(Math.random() * videoSources.value.length);
  1405. // videoSrc.value = videoSources.value[randomIndex];
  1406. }
  1407. // else if (value === "隱藏真人客服") {
  1408. // showAnchor.value = false;
  1409. // video.value.pause();
  1410. // menuList[0][0].text = "customer_show";
  1411. // menuList[0][0].value = "叫出真人客服";
  1412. // }
  1413. else if (value === "秘境花園觀景台") {
  1414. messages.value.push({
  1415. label: "text",
  1416. author: "ai",
  1417. body: t("observatory_info.tickets.purchase"),
  1418. });
  1419. messages.value.push({
  1420. label: "observation_deck",
  1421. author: "ai",
  1422. body: observationList,
  1423. });
  1424. } else if (value === "位置導引") {
  1425. assignLocationText.value = "";
  1426. messages.value.push({
  1427. label: "text",
  1428. author: "ai",
  1429. body: t("select_location"),
  1430. });
  1431. // 掃描 QR Code
  1432. // messages.value.push({
  1433. // label: "text",
  1434. // author: "ai",
  1435. // body: t("qr_code_scan_prompt"),
  1436. // });
  1437. // messages.value.push({
  1438. // label: "map_img",
  1439. // author: "ai",
  1440. // body: mapList,
  1441. // });
  1442. messages.value.push({
  1443. label: "location",
  1444. author: "ai",
  1445. body: locationList,
  1446. });
  1447. } else if (value === "美食/伴手禮") {
  1448. // getAd("美食伴手禮");
  1449. messages.value.push({
  1450. label: "text",
  1451. author: "ai",
  1452. body: t("food_souvenirs_info.searching"),
  1453. });
  1454. messages.value.push({
  1455. label: "dining",
  1456. author: "ai",
  1457. body: diningList,
  1458. });
  1459. } else if (value === "購物及優惠") {
  1460. // getAd("購物及優惠");
  1461. messages.value.push({
  1462. label: "shopping",
  1463. author: "ai",
  1464. body: shoppingList,
  1465. });
  1466. } else if (value === "服務資訊") {
  1467. messages.value.push({
  1468. label: "text",
  1469. author: "ai",
  1470. body: t("service_info.inquiry_prompt"),
  1471. });
  1472. messages.value.push({
  1473. label: "service",
  1474. author: "ai",
  1475. body: serviceList,
  1476. });
  1477. }
  1478. // 關閉選單
  1479. hideMenu.value = true;
  1480. showInput.value = true;
  1481. }
  1482. let secondaryAd = ref({}); // 隨機廣告
  1483. let secondaryAdShow = ref(false);
  1484. // 取得隨機廣告 (美食伴手禮/購物及優惠)
  1485. async function getAd(type) {
  1486. let lang = getLang();
  1487. let url = `https://cmm.ai:9101/ad/${type}?language=${lang}`;
  1488. try {
  1489. const response = await axios.get(url);
  1490. console.log("response", response);
  1491. secondaryAd.value = response.data.data;
  1492. // secondaryAdShow.value = true; // 取消蓋版廣告
  1493. messages.value.push({
  1494. label: "brand",
  1495. author: "ai",
  1496. body: [
  1497. {
  1498. info: response.data.data,
  1499. },
  1500. ],
  1501. });
  1502. } catch (error) {
  1503. console.log("error", error);
  1504. }
  1505. }
  1506. // 服務資訊回覆
  1507. function handleService(title, depiction) {
  1508. messages.value.push({
  1509. label: "text",
  1510. author: "user",
  1511. body: title,
  1512. });
  1513. if (title !== "AI 天燈") {
  1514. messages.value.push({
  1515. label: "text",
  1516. author: "ai",
  1517. body: depiction,
  1518. });
  1519. } else {
  1520. window.location.href = depiction;
  1521. // window.open(depiction, "_blank"); // 另開天燈頁面
  1522. }
  1523. }
  1524. // 參觀資訊回覆
  1525. function handleVisit(title, depiction) {
  1526. messages.value.push({
  1527. label: "text",
  1528. author: "user",
  1529. body: title,
  1530. });
  1531. messages.value.push({
  1532. label: "text",
  1533. author: "ai",
  1534. body: depiction,
  1535. });
  1536. }
  1537. // 計算使用次數
  1538. async function handleClick() {
  1539. let url = "https://cmm.ai:9101/click";
  1540. try {
  1541. const response = await axios.get(url);
  1542. console.log("Click", response);
  1543. } catch (error) {
  1544. console.log("error", error);
  1545. }
  1546. }
  1547. let langList = reactive([
  1548. {
  1549. lang: "中文",
  1550. value: "zh-tw",
  1551. },
  1552. {
  1553. lang: "English",
  1554. value: "en-us",
  1555. },
  1556. // {
  1557. // lang: "日本語",
  1558. // value: "ja-jp",
  1559. // },
  1560. // {
  1561. // lang: "한국어",
  1562. // value: "ko-kr",
  1563. // },
  1564. ]);
  1565. const btnList = reactive([
  1566. {
  1567. title: "observation_deck",
  1568. value: "秘境花園觀景台",
  1569. },
  1570. {
  1571. title: "location_guide",
  1572. value: "位置導引",
  1573. },
  1574. {
  1575. title: "food_souvenirs",
  1576. value: "美食伴手禮",
  1577. },
  1578. {
  1579. title: "shopping_discounts",
  1580. value: "購物及優惠",
  1581. },
  1582. {
  1583. title: "service_information",
  1584. value: "服務資訊",
  1585. },
  1586. ]);
  1587. function getImageUrl(name) {
  1588. return new URL(`../assets/img/icon/${name}`, import.meta.url).href;
  1589. }
  1590. let showAnchor = ref(false); // AI 主播影片
  1591. const menuList = reactive([
  1592. [
  1593. {
  1594. imgSrc: "素材-05.png",
  1595. text: "customer_show",
  1596. value: "叫出真人客服",
  1597. },
  1598. { imgSrc: "素材-06.png", text: "service_information", value: "服務資訊" },
  1599. { imgSrc: "素材-07.png", text: "shopping_discounts", value: "購物及優惠" },
  1600. ],
  1601. [
  1602. {
  1603. imgSrc: "素材-08.png",
  1604. text: "observation_deck",
  1605. value: "秘境花園觀景台",
  1606. },
  1607. { imgSrc: "素材-09.png", text: "food_souvenirs", value: "美食/伴手禮" },
  1608. { imgSrc: "素材-10.png", text: "location_guide", value: "位置導引" },
  1609. ],
  1610. ]);
  1611. // 美食伴手禮 or 購物及優惠類別篩選
  1612. async function findBrand(value) {
  1613. console.log("findBrand", value);
  1614. if (value === "館外店家") {
  1615. value = "館外";
  1616. }
  1617. let lang = getLang();
  1618. let url = `https://cmm.ai:9101/find_brand?keyword=${value}&language=${lang}`;
  1619. try {
  1620. const response = await axios.get(url);
  1621. console.log("response", response);
  1622. messages.value.push({
  1623. label: "brand",
  1624. author: "ai",
  1625. body: response.data.data,
  1626. });
  1627. assignCategoryIndex.value = null;
  1628. assignCategory.value = "";
  1629. } catch (error) {
  1630. console.log("error", error);
  1631. }
  1632. }
  1633. // 取得線上購票
  1634. async function getStaticTickets(type) {
  1635. let url = `https://cmm.ai:9101/static_tickets?is_Chinese=${type}`;
  1636. let info = {
  1637. buttonList: [], // 按鈕
  1638. ticketList: [], // 票券
  1639. };
  1640. try {
  1641. const response = await axios.get(url);
  1642. console.log("線上購票", response.data.result);
  1643. response.data.result.map((item) => info.ticketList.push(item));
  1644. console.log("info", info);
  1645. messages.value.push({
  1646. label: "ticket",
  1647. author: "ai",
  1648. body: info,
  1649. });
  1650. } catch (error) {
  1651. console.log("error", error);
  1652. }
  1653. }
  1654. // 秘境花園觀景台對話
  1655. function handleObservationDialog(value) {
  1656. console.log("value", value);
  1657. if (value === "線上購票") {
  1658. messages.value.push({
  1659. label: "text",
  1660. author: "ai",
  1661. body: t("observatory_info.tickets.id_card"),
  1662. });
  1663. messages.value.push({
  1664. label: "check",
  1665. author: "ai",
  1666. body: [
  1667. {
  1668. value: "是",
  1669. text: "observatory_info.tickets.yes",
  1670. },
  1671. {
  1672. value: "否",
  1673. text: "observatory_info.tickets.no",
  1674. },
  1675. ],
  1676. });
  1677. } else if (value === "是" || value === "否") {
  1678. if (value === "是") {
  1679. getStaticTickets("1");
  1680. } else if (value === "否") {
  1681. getStaticTickets("0");
  1682. }
  1683. messages.value.push({
  1684. label: "text",
  1685. author: "ai",
  1686. body: t("observatory_info.tickets.ticket_type"),
  1687. });
  1688. } else if (value === "參觀資訊") {
  1689. messages.value.push({
  1690. label: "text",
  1691. author: "ai",
  1692. body: t("observatory_info.visitor.question"),
  1693. });
  1694. messages.value.push({
  1695. label: "text",
  1696. author: "ai",
  1697. body: t("observatory_info.visitor.faq"),
  1698. });
  1699. messages.value.push({
  1700. label: "visit",
  1701. author: "ai",
  1702. body: visitList,
  1703. });
  1704. } else if (value === "實境景色") {
  1705. // window.location.href = "https://www.youtube.com/watch?v=RVV00FZbeH0";
  1706. window.open("https://www.youtube.com/watch?v=RVV00FZbeH0", "_blank"); // 另開頁面
  1707. } else if (value === "前往秘境花園觀景台") {
  1708. messages.value.push({
  1709. label: "text",
  1710. author: "ai",
  1711. body: t("select_location"),
  1712. });
  1713. messages.value.push({
  1714. label: "garden_route",
  1715. author: "ai",
  1716. body: gardenRouteList,
  1717. });
  1718. }
  1719. }
  1720. let gardenRouteList = reactive([
  1721. {
  1722. value: "B1 鼎泰豐旁 數位屏幕",
  1723. text: "location.b1_din_tai_fung",
  1724. },
  1725. {
  1726. value: "B1 中環WOW屏幕",
  1727. text: "location.b1_centre",
  1728. },
  1729. {
  1730. value: "B1 信義橘梯梯廳",
  1731. text: "location.b1_elevator_no_2",
  1732. },
  1733. {
  1734. value: "B1 信義綠梯梯廳",
  1735. text: "location.b1_elevator_no_4",
  1736. },
  1737. {
  1738. value: "B1 松智藍梯梯廳",
  1739. text: "location.b1_elevator_no_3",
  1740. },
  1741. {
  1742. value: "1F 信義綠梯出入口",
  1743. text: "location.1f_south_xinyi",
  1744. },
  1745. {
  1746. value: "1F 松智梯廳",
  1747. text: "location.1f_elevator_no_3",
  1748. },
  1749. {
  1750. value: "2F 松智藍梯梯廳",
  1751. text: "location.2f_elevator_no_3",
  1752. },
  1753. ]);
  1754. // 購物及優惠對話
  1755. function handleShoppingDialog(value) {
  1756. console.log("value", value);
  1757. if (value === "購物品牌查詢") {
  1758. messages.value.push({
  1759. label: "text",
  1760. author: "ai",
  1761. body: t("shopping_discounts_info.brands.choose"),
  1762. });
  1763. messages.value.push({
  1764. label: "shopping_brand",
  1765. author: "ai",
  1766. body: brandList,
  1767. });
  1768. } else if (value === "國際貴賓卡專屬禮遇") {
  1769. messages.value.push({
  1770. label: "text",
  1771. author: "user",
  1772. body: t("shopping_discounts_info.tourist_card.title"),
  1773. });
  1774. messages.value.push({
  1775. label: "text",
  1776. author: "ai",
  1777. body: t("shopping_discounts_info.tourist_card.content"),
  1778. });
  1779. } else if (value === "參觀資訊") {
  1780. messages.value.push({
  1781. label: "text",
  1782. author: "ai",
  1783. body: t("observatory_info.visitor.question"),
  1784. });
  1785. messages.value.push({
  1786. label: "text",
  1787. author: "ai",
  1788. body: t("observatory_info.visitor.faq"),
  1789. });
  1790. messages.value.push({
  1791. label: "visit",
  1792. author: "ai",
  1793. body: visitList,
  1794. });
  1795. }
  1796. }
  1797. let visitList = reactive([
  1798. {
  1799. title: "observatory_info.visitor.events_q",
  1800. depiction: "observatory_info.visitor.events_a",
  1801. },
  1802. {
  1803. title: "observatory_info.visitor.ball_q",
  1804. depiction: "observatory_info.visitor.ball_a",
  1805. },
  1806. {
  1807. title: "observatory_info.visitor.accessible_q",
  1808. depiction: "observatory_info.visitor.accessible_a",
  1809. },
  1810. ]);
  1811. // 判斷價格是否包含 $ 符號
  1812. function formatPrice(price) {
  1813. if (price === "") {
  1814. return "";
  1815. } else {
  1816. if (price.includes("$")) {
  1817. return price;
  1818. } else {
  1819. return `$${price}`;
  1820. }
  1821. }
  1822. }
  1823. let currentAudio = ref(null); // 當前音訊
  1824. let audioDuration = ref(null); // 音訊秒數
  1825. // 文字轉語音 (TTS)
  1826. async function handleTTS(message) {
  1827. console.log("handleTTS", message);
  1828. let audioLang; // 音訊語言
  1829. let lang = localStorage.getItem("lang");
  1830. console.log("lang", lang);
  1831. switch (lang) {
  1832. case "zh-tw":
  1833. audioLang = "cmn-TW";
  1834. break;
  1835. case "en-us":
  1836. audioLang = "en-US";
  1837. break;
  1838. case "ja-jp":
  1839. audioLang = "ja-JP";
  1840. break;
  1841. case "ko-kr":
  1842. audioLang = "ko-KR";
  1843. break;
  1844. default:
  1845. break;
  1846. }
  1847. // let url = `https://cmm.ai:9001/ttsTry/tts_try?message=${message}&type=101`;
  1848. let url = `https://cmm.ai:9001/gcp/text-to-speech?language_code=${audioLang}&gender=female`;
  1849. const formData = new FormData();
  1850. formData.append("text", message);
  1851. try {
  1852. const response = await axios.post(url, formData, { responseType: "blob" });
  1853. console.log("TTS response", response);
  1854. const blob = new Blob([response.data], { type: "audio/mp3" });
  1855. const audioUrl = URL.createObjectURL(blob);
  1856. console.log("audioUrl", audioUrl);
  1857. cutVideo(); // 剪接影片
  1858. // 取得 mp3 音訊秒數
  1859. // audio.addEventListener("loadedmetadata", function () {
  1860. // audioDuration.value = audio.duration;
  1861. // cutVideo();
  1862. // });
  1863. // 暫停當前音訊
  1864. if (currentAudio.value) {
  1865. currentAudio.value.pause();
  1866. currentAudio.value.currentTime = 0;
  1867. }
  1868. // 播放音檔
  1869. currentAudio.value = new Audio(audioUrl);
  1870. } catch (error) {
  1871. console.log("error", error);
  1872. }
  1873. }
  1874. let videoLoading = ref(false);
  1875. let isAudioPlaying = ref(false); // 音訊播放狀態
  1876. // 取得語音回覆 mp4
  1877. async function cutVideo() {
  1878. videoSrc.value = videoSpeakSources.value[videoIndex.value - 1];
  1879. video.value.load(); // 重新讀取影片
  1880. // 影片和音訊加載完成後播放
  1881. video.value.oncanplay = () => {
  1882. setTimeout(() => {
  1883. // 監聽音訊播放結束
  1884. currentAudio.value.addEventListener("ended", onAudioEnded);
  1885. // 監聽音訊播放狀態
  1886. currentAudio.value.addEventListener("play", onAudioPlay);
  1887. currentAudio.value.addEventListener("pause", onAudioPause);
  1888. video.value.play(); // 播放影片
  1889. currentAudio.value.currentTime = 0; // 重置時間
  1890. currentAudio.value.play(); // 播放音訊
  1891. isVideoPause.value = true;
  1892. videoLoading.value = false;
  1893. }, 500);
  1894. };
  1895. }
  1896. // 音訊結束後暫停影片播放
  1897. const onAudioEnded = () => {
  1898. video.value.pause();
  1899. };
  1900. // 判斷音訊是否為播放狀態
  1901. const onAudioPlay = () => {
  1902. isAudioPlaying.value = true;
  1903. console.log("isAudioPlaying.value", isAudioPlaying.value);
  1904. };
  1905. const onAudioPause = () => {
  1906. isAudioPlaying.value = false;
  1907. isVideoPause.value = false;
  1908. console.log("isAudioPlaying.value", isAudioPlaying.value);
  1909. };
  1910. const audioURL = ref(null);
  1911. const audioFile = ref(null); // 音訊檔案
  1912. let recordTime = ref(0); // 錄音時間
  1913. let isRecording = ref(false); // 錄音狀態
  1914. let timer;
  1915. // 語音轉文字
  1916. async function handleAudioToText() {
  1917. isRecording.value = false;
  1918. let audioLang; // 音訊語言
  1919. let lang = localStorage.getItem("lang");
  1920. console.log("lang", lang);
  1921. switch (lang) {
  1922. case "zh-tw":
  1923. audioLang = "cmn-Hant-TW";
  1924. break;
  1925. case "en-us":
  1926. audioLang = "en-US";
  1927. break;
  1928. case "ja-jp":
  1929. audioLang = "ja-JP";
  1930. break;
  1931. case "ko-kr":
  1932. audioLang = "ko-KR";
  1933. break;
  1934. default:
  1935. break;
  1936. }
  1937. // let url = `http://172.104.93.163:9880/whisper/${audioLang}/`;
  1938. // let url = `https://cmm.ai:9001/whisper/${audioLang}/`;
  1939. let url = `https://cmm.ai:9001/gcp/speech-to-text?language_code=${audioLang}`;
  1940. const formData = new FormData();
  1941. formData.append("file", audioFile.value);
  1942. try {
  1943. console.log("audioFile.value", audioFile.value);
  1944. const response = await axios.post(url, formData);
  1945. console.log("語音轉文字 response", response);
  1946. // showAnchor.value = false; // 關閉主播視窗
  1947. userMessage.value = response.data[0];
  1948. // handleTTS(userMessage.value); // 取得語音回覆
  1949. if (response.data[0] && response.data[0] !== "") {
  1950. sendMessage(); // 傳送使用者訊息
  1951. } else {
  1952. if (showAnchor.value) {
  1953. alert("語音辨識有誤,請重新錄製。");
  1954. videoLoading.value = false;
  1955. return;
  1956. } else {
  1957. messages.value.push({
  1958. label: "text",
  1959. author: "user",
  1960. body: t("speech_error"),
  1961. });
  1962. videoLoading.value = false;
  1963. }
  1964. }
  1965. } catch (error) {
  1966. console.log("error", error);
  1967. }
  1968. }
  1969. // 語音轉文字 (使用 recorder-core 錄音)
  1970. let rec, wave;
  1971. // 調用 open 請求錄音權限
  1972. let recOpen = function (success) {
  1973. rec = Recorder({
  1974. type: "mp3",
  1975. sampleRate: 16000,
  1976. bitRate: 16,
  1977. onProcess: function (
  1978. buffers,
  1979. powerLevel,
  1980. bufferDuration,
  1981. bufferSampleRate,
  1982. newBufferIdx,
  1983. asyncEnd
  1984. ) {
  1985. wave &&
  1986. wave.input(buffers[buffers.length - 1], powerLevel, bufferSampleRate);
  1987. },
  1988. });
  1989. rec.open(
  1990. function () {
  1991. if (Recorder.WaveView) wave = Recorder.WaveView({ elem: ".recwave" });
  1992. success && success();
  1993. },
  1994. function (msg, isUserNotAllow) {
  1995. // 使用者未授權或不支援
  1996. console.log((isUserNotAllow ? "UserNotAllow," : "") + "無法錄音:" + msg);
  1997. }
  1998. );
  1999. };
  2000. /** 開始錄音 **/
  2001. function recStart() {
  2002. togglePause("pause"); // 暫停影片音訊
  2003. // 需先呼叫 recOpen() 開啟錄音後才能調用 start、stop 方法
  2004. console.log("開始錄音");
  2005. recOpen(function () {
  2006. isRecording.value = true;
  2007. // 開始計時
  2008. timer = setInterval(() => {
  2009. recordTime.value += 1;
  2010. }, 1000);
  2011. rec.start();
  2012. });
  2013. }
  2014. /** 結束錄音 **/
  2015. function recStop() {
  2016. videoLoading.value = true;
  2017. rec.stop(
  2018. function (blob, duration) {
  2019. // 利用 URL 產生本地檔案位址,不用時需要 revokeObjectURL
  2020. let localUrl = (window.URL || webkitURL).createObjectURL(blob); // 該 url 只能本地端使用 (例如給 audio.src 進行播放,或是給 a.href download 進行下載)
  2021. console.log(blob, localUrl, "時長:" + duration + "ms");
  2022. // rec.close(); // 釋放錄音資源 (若不釋放系統或瀏覽器將持續提示在錄音中)
  2023. // rec = null;
  2024. // 將 Blob 轉換為 File 對象
  2025. audioFile.value = new File([blob], "recording.mp3", {
  2026. type: "audio/mp3",
  2027. });
  2028. console.log("audioFile", audioFile.value);
  2029. rec.close(); // 釋放錄音資源 (若不釋放系統或瀏覽器將持續提示在錄音中)
  2030. rec = null;
  2031. if (recordTime.value !== 0) {
  2032. handleAudioToText(); // 語音轉文字
  2033. } else {
  2034. isRecording.value = false;
  2035. }
  2036. clearInterval(timer); // 清空計時秒數
  2037. recordTime.value = 0;
  2038. },
  2039. function (msg) {
  2040. console.log("錄音失敗:" + msg);
  2041. rec.close(); // 可以透過 stop 方法的第 3 個參數來自動呼叫 close
  2042. rec = null;
  2043. }
  2044. );
  2045. }
  2046. let videoCacheData = ref({});
  2047. // 儲存問答 Log
  2048. async function messageSave(question, answer, data) {
  2049. let url = "https://cmm.ai:9101/message_save";
  2050. let parameters = {
  2051. question: question,
  2052. answer: answer,
  2053. data_list: data.length ? JSON.stringify(data) : "[]",
  2054. };
  2055. console.log("messageSave", parameters);
  2056. try {
  2057. const response = await axios.post(url, parameters);
  2058. console.log("response", response);
  2059. } catch (error) {
  2060. console.log("error", error);
  2061. }
  2062. }
  2063. // 儲存問答 Log (有使用者錄音檔)
  2064. async function messageSaveMp3(question, answer, data) {
  2065. let url = "https://cmm.ai:9101/message_save_mp3";
  2066. const formData = new FormData();
  2067. formData.append("question", question);
  2068. formData.append("answer", answer);
  2069. formData.append("data_list", data.length ? JSON.stringify(data) : "[]");
  2070. formData.append("mp3_file", audioFile.value);
  2071. try {
  2072. const response = await axios.post(url, formData);
  2073. console.log("response", response);
  2074. audioFile.value = null;
  2075. } catch (error) {
  2076. console.log("error", error);
  2077. }
  2078. }
  2079. async function getVideoCache(messages) {
  2080. let url = `https://cmm.ai:9101/video_cache?client_message=${messages}`;
  2081. try {
  2082. const response = await axios.post(url);
  2083. console.log("response", response);
  2084. console.log("response.status", response.status);
  2085. if (response.data.state === 200) {
  2086. videoCacheData.value = response.data.message[0];
  2087. console.log("videoCacheData.value", videoCacheData.value);
  2088. return true;
  2089. } else {
  2090. return false;
  2091. }
  2092. } catch (error) {
  2093. console.log("error", error);
  2094. }
  2095. }
  2096. // 播放 Video Cache
  2097. function handleVideoCache() {
  2098. console.log("播放 Video Cache", videoCacheData.value);
  2099. // AI 客服回傳訊息
  2100. messages.value.push({
  2101. label: "text",
  2102. author: "ai",
  2103. body: videoCacheData.value.answer,
  2104. });
  2105. // 播放 Cache 影片
  2106. videoSrc.value = `https://cmm.ai:9101${videoCacheData.value.video_url}`;
  2107. video.value.load();
  2108. // 清空音訊
  2109. if (currentAudio.value) {
  2110. currentAudio.value.pause();
  2111. currentAudio.value.currentTime = 0;
  2112. currentAudio.value = null;
  2113. }
  2114. video.value.play();
  2115. isVideoPause.value = true;
  2116. setTimeout(() => {
  2117. videoLoading.value = false;
  2118. }, 1000);
  2119. }
  2120. // 關閉主播視窗 (結束錄音)
  2121. function closeRec() {
  2122. video.value.pause();
  2123. isVideoPause.value = true;
  2124. recordTime.value = 0;
  2125. clearInterval(timer); // 清空計時秒數
  2126. if (isRecording.value) {
  2127. recStop();
  2128. }
  2129. showAnchor.value = false;
  2130. }
  2131. let isVideoPause = ref(true);
  2132. // AI 主播影片播放 & 暫停
  2133. function togglePause(val) {
  2134. if (val === "pause") {
  2135. // video.value.pause();
  2136. isVideoPause.value = false;
  2137. if (video.value) {
  2138. video.value.pause();
  2139. }
  2140. if (currentAudio.value) {
  2141. currentAudio.value.pause(); // 暫停音訊
  2142. }
  2143. } else {
  2144. isVideoPause.value = true;
  2145. if (video.value) {
  2146. video.value.play();
  2147. }
  2148. if (currentAudio.value) {
  2149. currentAudio.value.play(); // 播放音訊
  2150. currentAudio.value.addEventListener("ended", onAudioEnded);
  2151. }
  2152. }
  2153. }
  2154. // 語音暫停
  2155. function handleVoice(state) {
  2156. if (currentAudio.value) {
  2157. if (state === "pause") {
  2158. currentAudio.value.pause();
  2159. isVideoPause.value = false;
  2160. } else {
  2161. currentAudio.value.play();
  2162. isVideoPause.value = true;
  2163. }
  2164. }
  2165. }
  2166. // 回傳未收錄問題
  2167. async function messageNotInCache(question, answer) {
  2168. let url = `https://cmm.ai:9101/message_not_in_cache?question=${question}&answer=${answer}&client_id=0`;
  2169. try {
  2170. const response = await axios.post(url);
  2171. console.log("messageNotInCache response", response);
  2172. } catch (error) {
  2173. console.log("error", error);
  2174. }
  2175. }
  2176. </script>
  2177. <template>
  2178. <div v-if="isLanguagePage" class="lang-content">
  2179. <div class="btn-list">
  2180. <button
  2181. v-for="(item, index) in langList"
  2182. :key="index"
  2183. @click="chooseLang(item.value)"
  2184. class="main-btn"
  2185. >
  2186. {{ item.lang }}
  2187. </button>
  2188. </div>
  2189. </div>
  2190. <div v-else class="main-containar">
  2191. <div class="video-content">
  2192. <!-- 語言選單 -->
  2193. <div class="lang-select">
  2194. <v-select
  2195. label="切換語言"
  2196. :items="['中文', 'English']"
  2197. variant="solo"
  2198. @update:modelValue="onLanguageChange"
  2199. ></v-select>
  2200. </div>
  2201. <video ref="video" preload playsinline>
  2202. <source :src="videoSrc" type="video/mp4" />
  2203. <!-- <source src="../assets/video/start_1.mp4" type="video/mp4" /> -->
  2204. Your browser does not support the video tag.
  2205. </video>
  2206. <div v-if="videoLoading" class="video-progress">
  2207. <v-progress-circular
  2208. color="primary"
  2209. indeterminate
  2210. ></v-progress-circular>
  2211. </div>
  2212. <!-- <img src="../assets/img/logo.png" alt="" /> -->
  2213. <!-- <video
  2214. ref="video"
  2215. preload
  2216. playsinline
  2217. :style="{ opacity: !isTTSVideo ? '1' : '0' }"
  2218. >
  2219. <source src="../assets/video/start.mp4" type="video/mp4" />
  2220. Your browser does not support the video tag.
  2221. </video>
  2222. <video
  2223. ref="ttsVideo"
  2224. preload
  2225. playsinline
  2226. :style="{ opacity: isTTSVideo ? '1' : '0' }"
  2227. >
  2228. <source :src="ttsVideoSrc" type="video/mp4" />
  2229. Your browser does not support the video tag.
  2230. </video> -->
  2231. <!-- <button @click="togglePause('pause')" class="control-btn">
  2232. <img v-if="!isVideoPause" src="../assets/img/pause-button.png" alt="" />
  2233. <img v-else src="../assets/img/play-button.png" alt="" />
  2234. </button> -->
  2235. <button
  2236. v-if="isVideoPause"
  2237. @click="togglePause('pause')"
  2238. class="control-btn"
  2239. >
  2240. <img src="../assets/img/pause-button.png" alt="" />
  2241. <!-- <p>語音</p> -->
  2242. </button>
  2243. <button v-else @click="togglePause('play')" class="control-btn">
  2244. <img src="../assets/img/play-button.png" alt="" />
  2245. <!-- <p>語音</p> -->
  2246. </button>
  2247. <div class="control-item">
  2248. <!-- <p class="text-center">連接中…</p> -->
  2249. <div class="d-flex flex-column align-center">
  2250. <audio v-if="audioURL" :src="audioURL" controls></audio>
  2251. <!-- <p
  2252. v-if="!isRecording"
  2253. class="mb-3 text-center"
  2254. v-html="t('system_construction')"
  2255. ></p> -->
  2256. <p v-if="!isRecording" class="mb-3">
  2257. {{ t("tap_to_record") }}
  2258. </p>
  2259. <span v-else>
  2260. <p class="text-center">
  2261. {{ t("recording") }}:{{ recordTime }} {{ t("second") }}
  2262. </p>
  2263. <p class="text-center mb-3" v-html="t('stop_recording')"></p>
  2264. </span>
  2265. <!-- 錄音按鈕 -->
  2266. <v-btn
  2267. v-if="!isRecording"
  2268. @click="recStart"
  2269. icon="mdi-circle"
  2270. size="x-large"
  2271. >
  2272. <v-icon icon="mdi-circle" color="red" size="large"></v-icon>
  2273. </v-btn>
  2274. <v-btn
  2275. v-else
  2276. @click="recStop"
  2277. icon="mdi-circle"
  2278. size="large"
  2279. color="success"
  2280. >
  2281. <v-icon icon="mdi-square" size="large"></v-icon>
  2282. </v-btn>
  2283. </div>
  2284. <div class="d-flex justify-space-between mt-3 mx-10">
  2285. <!-- 暫停按鈕 -->
  2286. <!-- <v-btn
  2287. v-if="isVideoPause"
  2288. @click="togglePause('pause')"
  2289. icon="mdi-pause"
  2290. size="large"
  2291. color="grey-darken-3"
  2292. ></v-btn> -->
  2293. <!-- <v-btn
  2294. v-else
  2295. @click="togglePause('play')"
  2296. icon="mdi-play"
  2297. size="large"
  2298. color="grey-darken-3"
  2299. ></v-btn> -->
  2300. <!-- 關閉按鈕 -->
  2301. <!-- <v-btn
  2302. @click="closeRec()"
  2303. icon="mdi-close-thick"
  2304. size="large"
  2305. color="red"
  2306. ></v-btn> -->
  2307. </div>
  2308. </div>
  2309. <!-- <ArGuided /> -->
  2310. <!-- <div class="dialog-content pa-4">
  2311. <v-select
  2312. v-model="selectArGuided"
  2313. @update:modelValue="handleSelectChange"
  2314. label="AR 導覽"
  2315. :items="['5號 b1 松智藍梯梯廳 > 五樓觀景台售票處']"
  2316. variant="solo"
  2317. density="compact"
  2318. hide-details
  2319. style="min-width: 120px"
  2320. ></v-select>
  2321. <v-dialog v-model="arGuidedDialog" width="auto">
  2322. <v-card width="85vw" height="1000" class="rounded-lg">
  2323. <ArGuided />
  2324. <v-btn
  2325. class="mt-auto ms-auto mr-5 mb-5"
  2326. text="結束導覽"
  2327. @click="arGuidedDialog = false"
  2328. ></v-btn>
  2329. </v-card>
  2330. </v-dialog>
  2331. </div> -->
  2332. </div>
  2333. <div class="chat-content">
  2334. <div class="headline">
  2335. <h1>{{ t("title") }}</h1>
  2336. <!-- <button @click="isRotate = !isRotate">
  2337. <img
  2338. :class="{ rotate: isRotate }"
  2339. src="../assets/img/angles-up-solid.svg"
  2340. alt=""
  2341. />
  2342. </button> -->
  2343. </div>
  2344. <section
  2345. ref="chatArea"
  2346. class="chat-area"
  2347. :class="{ 'area-open': isRotate, 'hide-menu': hideMenu }"
  2348. :style="{ paddingBottom: !hideMenu ? menuHeight + 20 + 'px' : '90px' }"
  2349. >
  2350. <div v-for="message in messages" class="message-content">
  2351. <p
  2352. v-if="message.label === 'text'"
  2353. class="message animate__animated"
  2354. :class="{
  2355. 'message-out': message.author === 'user',
  2356. 'message-in': message.author !== 'user',
  2357. animate__fadeInRight: message.author === 'user',
  2358. animate__fadeInLeft: message.author !== 'user',
  2359. }"
  2360. v-html="message.body"
  2361. ></p>
  2362. <!-- 問題類別 -->
  2363. <!-- <div v-else-if="message.label === 'btn-list'">
  2364. <ul class="btn-list">
  2365. <li v-for="(btn, index) in btnList">
  2366. <button
  2367. :class="{ active: index === assignCategoryIndex }"
  2368. @click="selectCategory(btn.value, index)"
  2369. >
  2370. {{ t(`${btn.title}`) }}
  2371. </button>
  2372. </li>
  2373. </ul>
  2374. </div> -->
  2375. <!-- 秘境花園觀景台 -->
  2376. <div v-else-if="message.label === 'observation_deck'">
  2377. <swiper
  2378. :slidesPerView="'auto'"
  2379. :spaceBetween="20"
  2380. :modules="modules"
  2381. class="btn-swiper"
  2382. >
  2383. <swiper-slide v-for="item in message.body">
  2384. <div class="btn-container">
  2385. <button @click="handleObservationDialog(item.value)">
  2386. {{ t(item.text) }}
  2387. </button>
  2388. </div>
  2389. </swiper-slide>
  2390. </swiper>
  2391. </div>
  2392. <!-- 確認按鈕 -->
  2393. <div v-else-if="message.label === 'check'">
  2394. <swiper
  2395. :slidesPerView="'auto'"
  2396. :spaceBetween="20"
  2397. :modules="modules"
  2398. class="btn-swiper"
  2399. >
  2400. <swiper-slide v-for="item in message.body">
  2401. <div class="btn-container">
  2402. <button @click="handleObservationDialog(item.value)">
  2403. {{ t(item.text) }}
  2404. </button>
  2405. </div>
  2406. </swiper-slide>
  2407. </swiper>
  2408. </div>
  2409. <!-- 參觀資訊 -->
  2410. <div v-else-if="message.label === 'visit'">
  2411. <swiper
  2412. :slidesPerView="'auto'"
  2413. :spaceBetween="20"
  2414. :modules="modules"
  2415. class="btn-swiper"
  2416. >
  2417. <swiper-slide v-for="item in message.body">
  2418. <div class="btn-container">
  2419. <button
  2420. @click="handleVisit(t(item.title), t(item.depiction))"
  2421. >
  2422. {{ t(item.title) }}
  2423. </button>
  2424. </div>
  2425. </swiper-slide>
  2426. </swiper>
  2427. </div>
  2428. <!-- 位置導引 (定位點) -->
  2429. <div v-else-if="message.label === 'location'">
  2430. <!-- 定位點 & 平面圖下拉選單 -->
  2431. <div class="d-flex">
  2432. <v-menu location="top">
  2433. <template v-slot:activator="{ props }">
  2434. <v-btn class="mt-5 py-2" color="primary" dark v-bind="props">
  2435. <p class="me-2">
  2436. {{
  2437. assignLocationText !== ""
  2438. ? t(assignLocationText)
  2439. : t("current_location")
  2440. }}
  2441. </p>
  2442. <svg
  2443. xmlns="http://www.w3.org/2000/svg"
  2444. width="18"
  2445. height="18"
  2446. fill="currentColor"
  2447. class="bi bi-caret-down-fill pt-1"
  2448. viewBox="0 0 16 16"
  2449. >
  2450. <path
  2451. d="M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"
  2452. />
  2453. </svg>
  2454. </v-btn>
  2455. </template>
  2456. <v-list style="max-height: 155px; overflow-y: auto">
  2457. <v-list-item
  2458. v-for="(item, index) in locationList"
  2459. :key="index"
  2460. >
  2461. <v-list-item-title @click="changeLocation(item)">
  2462. {{ index + 1 }}. {{ t(item.location.text) }}
  2463. </v-list-item-title>
  2464. </v-list-item>
  2465. </v-list>
  2466. </v-menu>
  2467. <v-menu location="top">
  2468. <template v-slot:activator="{ props }">
  2469. <v-btn
  2470. class="ms-5 mt-5 py-2"
  2471. color="primary"
  2472. dark
  2473. v-bind="props"
  2474. >
  2475. <p class="me-2">{{ t("view_floor_plan") }}</p>
  2476. <svg
  2477. xmlns="http://www.w3.org/2000/svg"
  2478. width="18"
  2479. height="18"
  2480. fill="currentColor"
  2481. class="bi bi-caret-down-fill pt-1"
  2482. viewBox="0 0 16 16"
  2483. >
  2484. <path
  2485. d="M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"
  2486. />
  2487. </svg>
  2488. </v-btn>
  2489. </template>
  2490. <v-list style="max-height: 155px; overflow-y: auto">
  2491. <v-list-item v-for="(item, index) in mapList" :key="index">
  2492. <v-list-item-title @click="assignMapImg(item)">
  2493. {{ t(item.text) }}
  2494. </v-list-item-title>
  2495. </v-list-item>
  2496. </v-list>
  2497. </v-menu>
  2498. </div>
  2499. <!-- <v-select
  2500. @update:modelValue="changeLocation"
  2501. v-model="assignLocation"
  2502. label="當前位置"
  2503. :items="locationList"
  2504. item-title="location"
  2505. item-value="location"
  2506. variant="outlined"
  2507. density="comfortable"
  2508. hide-details
  2509. color="primary"
  2510. class="mt-5 me-15"
  2511. :menu-props="{ maxHeight: '155px' }"
  2512. ></v-select> -->
  2513. <!-- 掃描 QR Code -->
  2514. <!-- <v-btn @click="qrCodeDialog = true" color="primary" class="mt-5">
  2515. {{ t("tap_to_start_scan") }}
  2516. </v-btn>
  2517. <v-dialog v-model="qrCodeDialog" width="auto">
  2518. <v-card max-width="400">
  2519. <v-card-text>
  2520. <div v-if="qrCodeLoading" class="d-flex justify-center pt-5">
  2521. <v-progress-circular
  2522. color="primary"
  2523. indeterminate
  2524. ></v-progress-circular>
  2525. </div>
  2526. <qrcode-stream
  2527. v-show="!qrCodeLoading"
  2528. @detect="onDetect"
  2529. @camera-on="onInit"
  2530. ></qrcode-stream>
  2531. </v-card-text>
  2532. <template v-slot:actions>
  2533. <v-btn class="ms-auto" @click="qrCodeDialog = false">
  2534. {{ t("close") }}
  2535. </v-btn>
  2536. </template>
  2537. </v-card>
  2538. </v-dialog> -->
  2539. <!-- <div class="d-flex">
  2540. <v-menu location="top">
  2541. <template v-slot:activator="{ props }">
  2542. <v-btn class="mt-5 py-2" color="primary" dark v-bind="props">
  2543. <p class="me-2">{{ assignLocation }}</p>
  2544. <svg
  2545. xmlns="http://www.w3.org/2000/svg"
  2546. width="18"
  2547. height="18"
  2548. fill="currentColor"
  2549. class="bi bi-caret-down-fill pt-1"
  2550. viewBox="0 0 16 16"
  2551. >
  2552. <path
  2553. d="M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"
  2554. />
  2555. </svg>
  2556. </v-btn>
  2557. </template>
  2558. <v-list style="max-height: 155px; overflow-y: auto">
  2559. <v-list-item
  2560. v-for="(item, index) in locationList"
  2561. :key="index"
  2562. >
  2563. <v-list-item-title @click="changeLocation(item)">
  2564. {{ index + 1 }}. {{ item.location }}
  2565. </v-list-item-title>
  2566. </v-list-item>
  2567. </v-list>
  2568. </v-menu>
  2569. <v-menu location="top">
  2570. <template v-slot:activator="{ props }">
  2571. <v-btn
  2572. class="ms-5 mt-5 py-2"
  2573. color="primary"
  2574. dark
  2575. v-bind="props"
  2576. >
  2577. <p class="me-2">查看平面圖</p>
  2578. <svg
  2579. xmlns="http://www.w3.org/2000/svg"
  2580. width="18"
  2581. height="18"
  2582. fill="currentColor"
  2583. class="bi bi-caret-down-fill pt-1"
  2584. viewBox="0 0 16 16"
  2585. >
  2586. <path
  2587. d="M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z"
  2588. />
  2589. </svg>
  2590. </v-btn>
  2591. </template>
  2592. <v-list style="max-height: 155px; overflow-y: auto">
  2593. <v-list-item v-for="(item, index) in mapList" :key="index">
  2594. <v-list-item-title @click="assignMapImg(item)">
  2595. {{ item.title }}
  2596. </v-list-item-title>
  2597. </v-list-item>
  2598. </v-list>
  2599. </v-menu>
  2600. </div> -->
  2601. </div>
  2602. <!-- 定位點平面圖 -->
  2603. <div v-else-if="message.label === 'map_img'" class="mt-5">
  2604. <img
  2605. class="map-img"
  2606. :class="{ 'show-anchor': showAnchor }"
  2607. :src="`../src/assets/img/map/${message.body}.webp`"
  2608. alt=""
  2609. />
  2610. </div>
  2611. <!-- 位置導引 (導覽點) -->
  2612. <div v-else-if="message.label === 'navigation'">
  2613. <!-- <v-select
  2614. @update:modelValue="changeLocation"
  2615. v-model="assignNavigation"
  2616. label="導覽位置"
  2617. :items="assignNavigationList"
  2618. variant="solo"
  2619. hide-details
  2620. class="bg-white mt-4"
  2621. ></v-select> -->
  2622. <swiper
  2623. :slidesPerView="'auto'"
  2624. :spaceBetween="20"
  2625. :modules="modules"
  2626. class="btn-swiper"
  2627. >
  2628. <swiper-slide v-for="item in message.body">
  2629. <div class="btn-container">
  2630. <button
  2631. @click="
  2632. getArviews(item.value, t(`navigation.${item.text}`))
  2633. "
  2634. >
  2635. {{ t(`navigation.${item.text}`) }}
  2636. </button>
  2637. </div>
  2638. </swiper-slide>
  2639. </swiper>
  2640. </div>
  2641. <!-- 秘境花園觀景台 -->
  2642. <div v-else-if="message.label === 'garden_route'">
  2643. <!-- <v-select
  2644. @update:modelValue="changeLocation"
  2645. v-model="assignNavigation"
  2646. label="導覽位置"
  2647. :items="assignNavigationList"
  2648. variant="solo"
  2649. hide-details
  2650. class="bg-white mt-4"
  2651. ></v-select> -->
  2652. <swiper
  2653. :slidesPerView="'auto'"
  2654. :spaceBetween="20"
  2655. :modules="modules"
  2656. class="btn-swiper"
  2657. >
  2658. <swiper-slide v-for="item in message.body">
  2659. <div class="btn-container">
  2660. <button
  2661. @click="getArviews(item.value, t(item.text), 'garden')"
  2662. >
  2663. {{ t(item.text) }}
  2664. </button>
  2665. </div>
  2666. </swiper-slide>
  2667. </swiper>
  2668. </div>
  2669. <!-- AR 導覽影片 -->
  2670. <div v-else-if="message.label === 'ar_views'">
  2671. <div
  2672. class="message animate__animated"
  2673. :class="{
  2674. 'message-out': message.author === 'user',
  2675. 'message-in': message.author !== 'user',
  2676. animate__fadeInRight: message.author === 'user',
  2677. animate__fadeInLeft: message.author !== 'user',
  2678. }"
  2679. >
  2680. <p v-html="message.body.words"></p>
  2681. <button @click="arVideoDialog = true" class="ar-link my-3">
  2682. <!-- 進行 AR 導覽 -->
  2683. {{ t("ar_tour") }}
  2684. </button>
  2685. <v-dialog v-model="arVideoDialog" width="auto">
  2686. <v-card class="ar-card">
  2687. <v-card-title class="mt-3"> AR 導覽 </v-card-title>
  2688. <v-card-text class="pa-0">
  2689. <a-scene>
  2690. <a-assets>
  2691. <video
  2692. id="vr-video"
  2693. ref="arVideo"
  2694. :src="message.body.url"
  2695. autoplay
  2696. crossorigin="anonymous"
  2697. ecrossorigin="anonymous"
  2698. ></video>
  2699. </a-assets>
  2700. <a-sky src="#vr-video"></a-sky>
  2701. </a-scene>
  2702. </v-card-text>
  2703. <template v-slot:actions>
  2704. <v-btn class="ms-auto" @click="arVideoDialog = false">
  2705. {{ t("close") }}
  2706. </v-btn>
  2707. </template>
  2708. </v-card>
  2709. </v-dialog>
  2710. </div>
  2711. </div>
  2712. <!-- 美食伴手禮 -->
  2713. <div v-else-if="message.label === 'dining'">
  2714. <!-- <ul class="btn-options">
  2715. <li v-for="item in message.body">
  2716. <button @click="findBrand(item.value)">
  2717. {{ t(item.text) }}
  2718. </button>
  2719. </li>
  2720. </ul> -->
  2721. <swiper
  2722. :slidesPerView="'auto'"
  2723. :spaceBetween="20"
  2724. :modules="modules"
  2725. class="btn-swiper"
  2726. >
  2727. <swiper-slide v-for="item in message.body">
  2728. <div class="btn-container">
  2729. <button @click="findBrand(item.value)">
  2730. {{ t(item.text) }}
  2731. </button>
  2732. </div>
  2733. </swiper-slide>
  2734. </swiper>
  2735. </div>
  2736. <!-- 購物及優惠 -->
  2737. <div v-else-if="message.label === 'shopping'">
  2738. <!-- <ul class="btn-options">
  2739. <li v-for="item in message.body">
  2740. <button @click="handleShoppingDialog(item.value)">
  2741. {{ t(item.text) }}
  2742. </button>
  2743. </li>
  2744. </ul> -->
  2745. <swiper
  2746. :slidesPerView="'auto'"
  2747. :spaceBetween="20"
  2748. :modules="modules"
  2749. class="btn-swiper"
  2750. >
  2751. <swiper-slide v-for="item in message.body">
  2752. <div class="btn-container">
  2753. <button @click="handleShoppingDialog(item.value)">
  2754. {{ t(item.text) }}
  2755. </button>
  2756. </div>
  2757. </swiper-slide>
  2758. </swiper>
  2759. </div>
  2760. <!-- 購物品牌查詢 -->
  2761. <div v-else-if="message.label === 'shopping_brand'">
  2762. <!-- <ul class="btn-options">
  2763. <li v-for="item in message.body">
  2764. <button @click="findBrand(item.value)">
  2765. {{ item.value }}
  2766. </button>
  2767. </li>
  2768. </ul> -->
  2769. <swiper
  2770. :slidesPerView="'auto'"
  2771. :spaceBetween="20"
  2772. :modules="modules"
  2773. class="btn-swiper"
  2774. >
  2775. <swiper-slide v-for="item in message.body">
  2776. <div class="btn-container">
  2777. <button @click="findBrand(item.value)">
  2778. {{ t(item.text) }}
  2779. </button>
  2780. </div>
  2781. </swiper-slide>
  2782. </swiper>
  2783. </div>
  2784. <!-- 服務資訊 (常見問題) -->
  2785. <div v-else-if="message.label === 'service'">
  2786. <swiper
  2787. :slidesPerView="'auto'"
  2788. :spaceBetween="20"
  2789. :modules="modules"
  2790. class="btn-swiper"
  2791. >
  2792. <swiper-slide v-for="item in message.body">
  2793. <div class="btn-container">
  2794. <button
  2795. @click="handleService(t(item.title), t(item.depiction))"
  2796. >
  2797. {{ t(item.title) }}
  2798. </button>
  2799. </div>
  2800. </swiper-slide>
  2801. </swiper>
  2802. </div>
  2803. <!-- 推薦資訊 -->
  2804. <div v-else-if="message.label === 'ticket'" class="ticket-item">
  2805. <!-- 按鈕 -->
  2806. <swiper
  2807. v-if="message.body.buttonList.length"
  2808. :slidesPerView="'auto'"
  2809. :spaceBetween="20"
  2810. :modules="modules"
  2811. class="btn-swiper"
  2812. :style="{
  2813. marginBottom: message.body.ticketList.length ? '35px' : '0px',
  2814. }"
  2815. >
  2816. <swiper-slide v-for="item in message.body.buttonList">
  2817. <div class="btn-container">
  2818. <button @click="setBtnValue(item.info.value)">
  2819. {{ item.info.key }}
  2820. </button>
  2821. </div>
  2822. </swiper-slide>
  2823. </swiper>
  2824. <!-- 票券 -->
  2825. <swiper
  2826. v-if="message.body.ticketList.length"
  2827. :slidesPerView="1"
  2828. :navigation="true"
  2829. :modules="modules"
  2830. class="ticket-slide"
  2831. >
  2832. <swiper-slide v-for="(item, index) in message.body.ticketList">
  2833. <div class="slide-item">
  2834. <img
  2835. class="cover-img"
  2836. :src="item.info.img || item.info.cover_img"
  2837. alt=""
  2838. />
  2839. <section>
  2840. <h3 class="title">
  2841. {{ item.info.name || item.info.title }}
  2842. </h3>
  2843. <div class="price-info">
  2844. <span>{{ item.info.floor || item.info.price }}</span>
  2845. <div class="link-btn">
  2846. <!-- <a
  2847. :href="item.info.website_url || item.info.url"
  2848. target="_blank"
  2849. >
  2850. {{ t("cta_url") }}
  2851. </a> -->
  2852. <!-- 掃描 QR Code -->
  2853. <v-btn
  2854. @click="
  2855. openQrcodeDialog(
  2856. item.info.website_url || item.info.url
  2857. )
  2858. "
  2859. color="primary"
  2860. >
  2861. <p class="text-white m-0">{{ t("cta_url") }}</p>
  2862. </v-btn>
  2863. </div>
  2864. </div>
  2865. <p class="description">
  2866. {{ item.info.content || item.info.description }}
  2867. </p>
  2868. </section>
  2869. </div>
  2870. </swiper-slide>
  2871. </swiper>
  2872. </div>
  2873. <!-- 品牌資訊 -->
  2874. <div v-else-if="message.label === 'brand'" class="ticket-item">
  2875. <!-- 按鈕 -->
  2876. <swiper
  2877. v-if="message.body.buttonList?.length"
  2878. :slidesPerView="'auto'"
  2879. :spaceBetween="20"
  2880. :modules="modules"
  2881. class="btn-swiper"
  2882. :style="{
  2883. marginBottom: message.body.ticketList.length ? '35px' : '0px',
  2884. }"
  2885. >
  2886. <swiper-slide v-for="item in message.body.buttonList">
  2887. <div class="btn-container">
  2888. <button @click="setBtnValue(item.info.value)">
  2889. {{ item.info.key }}
  2890. </button>
  2891. </div>
  2892. </swiper-slide>
  2893. </swiper>
  2894. <!-- 票券 -->
  2895. <swiper
  2896. v-if="message.body.ticketList?.length"
  2897. :slidesPerView="1"
  2898. :navigation="true"
  2899. :modules="modules"
  2900. class="ticket-slide"
  2901. >
  2902. <swiper-slide v-for="(item, index) in message.body.ticketList">
  2903. <div class="slide-item">
  2904. <img
  2905. class="cover-img aa"
  2906. :src="item.info.img || item.info.cover_img"
  2907. alt=""
  2908. />
  2909. <section>
  2910. <h3 class="title">
  2911. {{ item.info.name || item.info.title }}
  2912. </h3>
  2913. <div class="price-info">
  2914. <span>{{ item.info.floor || item.info.price }}</span>
  2915. <div class="link-btn">
  2916. <!-- <a :href="item.info.url" target="_blank">
  2917. {{ t("cta_url") }}
  2918. </a> -->
  2919. <!-- 掃描 QR Code -->
  2920. <v-btn
  2921. @click="openQrcodeDialog(item.info.url)"
  2922. color="primary"
  2923. >
  2924. <p class="text-white m-0">{{ t("cta_url") }}</p>
  2925. </v-btn>
  2926. </div>
  2927. </div>
  2928. <p class="description">
  2929. {{ item.info.content || item.info.description }}
  2930. </p>
  2931. </section>
  2932. </div>
  2933. </swiper-slide>
  2934. </swiper>
  2935. <!-- 美食/伴手禮 -->
  2936. <swiper
  2937. v-if="message.body.length"
  2938. :slidesPerView="1"
  2939. :navigation="true"
  2940. :modules="modules"
  2941. class="ticket-slide"
  2942. >
  2943. <swiper-slide v-for="(item, index) in message.body">
  2944. <div class="slide-item">
  2945. <img
  2946. class="cover-img"
  2947. :src="item.info.img || item.info.cover_img"
  2948. alt=""
  2949. />
  2950. <section>
  2951. <h3 class="title">
  2952. {{ item.info.name || item.info.title }}
  2953. </h3>
  2954. <div
  2955. v-if="item.info.phone !== ''"
  2956. class="d-flex align-center mt-3 mb-5"
  2957. >
  2958. <img
  2959. src="../assets/img/phone-solid.svg"
  2960. width="15"
  2961. alt=""
  2962. />
  2963. <p class="ms-2">
  2964. {{ item.info.phone }}
  2965. </p>
  2966. </div>
  2967. <div class="price-info">
  2968. <span>{{ item.info.floor || item.info.price }}</span>
  2969. <div class="link-btn">
  2970. <!-- <a :href="item.info.url" target="_blank">
  2971. {{ t("cta_url") }}
  2972. </a> -->
  2973. <!-- 掃描 QR Code -->
  2974. <v-btn
  2975. @click="openQrcodeDialog(item.info.url)"
  2976. color="primary"
  2977. >
  2978. <p class="text-white m-0">{{ t("cta_url") }}</p>
  2979. </v-btn>
  2980. </div>
  2981. </div>
  2982. <p class="description">
  2983. {{ item.info.content || item.info.description }}
  2984. </p>
  2985. </section>
  2986. </div>
  2987. </swiper-slide>
  2988. </swiper>
  2989. <!-- <swiper
  2990. v-if="message.body.length"
  2991. :slidesPerView="'auto'"
  2992. :spaceBetween="20"
  2993. :modules="modules"
  2994. >
  2995. <swiper-slide v-for="item in message.body">
  2996. <img
  2997. class="cover-img"
  2998. :src="item.info.img || item.info.cover_img"
  2999. alt=""
  3000. />
  3001. <section>
  3002. <h3 class="title">{{ item.info.name || item.info.title }}</h3>
  3003. <div
  3004. v-if="item.info.phone !== ''"
  3005. class="d-flex align-center mt-3 mb-5"
  3006. >
  3007. <img
  3008. src="../assets/img/phone-solid.svg"
  3009. width="15"
  3010. alt=""
  3011. />
  3012. <p class="ms-2">
  3013. {{ getPhoneNumber(item.info.phone) }}
  3014. </p>
  3015. </div>
  3016. <div class="price-info">
  3017. <span>{{ item.info.floor || item.info.price }}</span>
  3018. <div class="link-btn">
  3019. <a :href="item.info.url" target="_blank">
  3020. {{ t("cta_url") }}
  3021. </a>
  3022. </div>
  3023. </div>
  3024. <p class="description">
  3025. {{ item.info.content || item.info.description }}
  3026. </p>
  3027. </section>
  3028. </swiper-slide>
  3029. </swiper> -->
  3030. </div>
  3031. <!-- 推薦資訊 -->
  3032. <div v-else-if="message.label === 'recommend'" class="recommend-item">
  3033. <img class="cover-img" :src="message.body.cover_img" alt="" />
  3034. <section>
  3035. <h3 class="title">{{ message.body.title }}</h3>
  3036. <p class="description">{{ message.body.description }}</p>
  3037. <div class="link-btn">
  3038. <a
  3039. :href="message.body.store_info_url || message.body.url"
  3040. target="_blank"
  3041. >
  3042. {{ t("cta_buy") }}
  3043. </a>
  3044. <a :href="message.body.website_url" target="_blank"> 官網 </a>
  3045. </div>
  3046. <p class="date">{{ message.body.date }} 限時搶購</p>
  3047. </section>
  3048. </div>
  3049. <!-- 店家資訊 -->
  3050. <div v-else-if="message.label === 'store'" class="store-item">
  3051. <p class="headline">店家資訊</p>
  3052. <div class="cover-img">
  3053. <img :src="message.body.cover_img" alt="" />
  3054. <h3 class="title">{{ message.body.title }}</h3>
  3055. </div>
  3056. <section>
  3057. <div class="info">
  3058. <p>
  3059. <img
  3060. src="../assets/img/location-dot-solid.svg"
  3061. width="15"
  3062. alt=""
  3063. />
  3064. {{ message.body.location }}
  3065. </p>
  3066. <p>
  3067. <img src="../assets/img/phone-solid.svg" width="15" alt="" />
  3068. {{ message.body.contact }}
  3069. </p>
  3070. </div>
  3071. <p class="description">{{ message.body.description }}</p>
  3072. </section>
  3073. </div>
  3074. <!-- 套票資訊 -->
  3075. <div v-else-if="message.label === 'ticket'" class="ticket-item">
  3076. <img class="cover-img" :src="message.body.cover_img" alt="" />
  3077. <section>
  3078. <h3 class="title">{{ message.body.title }}</h3>
  3079. <div class="link-btn">
  3080. <a :href="message.body.store_info_url" target="_blank">
  3081. 線上預約
  3082. </a>
  3083. </div>
  3084. <p class="description">{{ message.body.description }}</p>
  3085. <span class="price-item">{{ message.body.price }}</span>
  3086. </section>
  3087. </div>
  3088. </div>
  3089. </section>
  3090. <!-- <form @submit.prevent="sendMessage('text')" class="chat-inputs">
  3091. <input
  3092. v-model="userMessage"
  3093. type="text"
  3094. placeholder="Type a message..."
  3095. />
  3096. <button type="submit">
  3097. <img width="20" src="../assets/img/paper-plane-solid.svg" alt="" />
  3098. </button>
  3099. </form> -->
  3100. <!-- 底部選單 -->
  3101. <div ref="menu" class="menu">
  3102. <!-- AI 主播影片 -->
  3103. <!-- <div
  3104. v-show="showAnchor"
  3105. class="video-content"
  3106. :class="{ 'video-down': hideMenu }"
  3107. >
  3108. <div v-show="!isTTSVideo">
  3109. <video ref="video" preload playsinline>
  3110. <source src="../assets/video/start_1.mp4" type="video/mp4" />
  3111. Your browser does not support the video tag.
  3112. </video>
  3113. </div>
  3114. <div v-show="isTTSVideo">
  3115. <video ref="ttsVideo" preload playsinline>
  3116. <source
  3117. :src="`https://cmm.ai:9001/${ttsVideoSrc}`"
  3118. type="video/mp4"
  3119. />
  3120. Your browser does not support the video tag.
  3121. </video>
  3122. </div>
  3123. </div> -->
  3124. <div class="menu-table mb-3" :class="{ 'hide-table': hideMenu }">
  3125. <table class="mt-3">
  3126. <tbody>
  3127. <tr v-for="(row, rowIndex) in menuList" :key="rowIndex">
  3128. <td v-for="(item, itemIndex) in row" :key="itemIndex">
  3129. <button @click="selectCategory(item.value, itemIndex)">
  3130. <img :src="getImageUrl(item.imgSrc)" alt="" class="icon" />
  3131. <p>{{ t(`${item.text}`) }}</p>
  3132. </button>
  3133. </td>
  3134. </tr>
  3135. </tbody>
  3136. </table>
  3137. </div>
  3138. <!-- <table class="mt-3">
  3139. <tbody>
  3140. <tr v-for="(row, rowIndex) in menuList" :key="rowIndex">
  3141. <td v-for="(item, itemIndex) in row" :key="itemIndex">
  3142. <button @click="selectCategory(item.value, itemIndex)">
  3143. <img :src="getImageUrl(item.imgSrc)" alt="" class="icon" />
  3144. <p>{{ t(`${item.text}`) }}</p>
  3145. </button>
  3146. </td>
  3147. </tr>
  3148. </tbody>
  3149. </table> -->
  3150. <div class="d-flex align-center position-relative" style="bottom: 20px">
  3151. <div class="position-absolute">
  3152. <button
  3153. v-if="!showInput"
  3154. @click="
  3155. hideMenu = true;
  3156. showInput = true;
  3157. "
  3158. class="ms-3 pt-1"
  3159. >
  3160. <img src="../assets/img/icon/素材-04.png" alt="" width="35" />
  3161. </button>
  3162. <button
  3163. v-else
  3164. @click="
  3165. hideMenu = false;
  3166. showInput = false;
  3167. "
  3168. >
  3169. <img
  3170. src="../assets/img/icon/素材-02.png"
  3171. alt=""
  3172. width="50"
  3173. class="pt-2"
  3174. />
  3175. </button>
  3176. </div>
  3177. <div class="w-100 d-flex align-center justify-center">
  3178. <button
  3179. v-if="!showInput"
  3180. @click="
  3181. hideMenu = true;
  3182. showInput = true;
  3183. "
  3184. class="d-flex align-center question-btn"
  3185. >
  3186. <img
  3187. class="me-2"
  3188. src="../assets/img/icon/素材-03.png"
  3189. alt=""
  3190. width="45"
  3191. />
  3192. {{ t("question") }}
  3193. </button>
  3194. <!-- 對話輸入框 -->
  3195. <form
  3196. v-else
  3197. @submit.prevent="sendMessage()"
  3198. class="chat-inputs"
  3199. :class="{ 'd-none': !showInput }"
  3200. >
  3201. <!-- <button @click="hideMenu = false" class="menu-btn">
  3202. <img src="../assets/img/icon/素材-02.png" alt="" width="50" />
  3203. </button> -->
  3204. <input
  3205. v-model="userMessage"
  3206. type="text"
  3207. placeholder="Type a message..."
  3208. />
  3209. <button type="submit" class="submit">
  3210. <img
  3211. width="20"
  3212. src="../assets/img/paper-plane-solid.svg"
  3213. alt=""
  3214. />
  3215. </button>
  3216. </form>
  3217. </div>
  3218. </div>
  3219. </div>
  3220. <!-- 廣告輪播 -->
  3221. <!-- <div class="slider-content">
  3222. <swiper
  3223. :slidesPerView="1"
  3224. :autoplay="{
  3225. delay: 5000,
  3226. disableOnInteraction: false,
  3227. }"
  3228. :modules="modules"
  3229. >
  3230. <swiper-slide>
  3231. <img src="../assets/img/banner-1.jpg" alt="" />
  3232. </swiper-slide>
  3233. <swiper-slide>
  3234. <img src="../assets/img/banner-2.jpg" alt="" />
  3235. </swiper-slide>
  3236. </swiper>
  3237. </div> -->
  3238. </div>
  3239. </div>
  3240. <!-- 主要廣告 -->
  3241. <!-- <v-dialog v-model="showAd">
  3242. <div class="ad-content">
  3243. <button @click="showAd = false" class="close-btn">
  3244. <svg
  3245. xmlns="http://www.w3.org/2000/svg"
  3246. width="28"
  3247. height="28"
  3248. fill="currentColor"
  3249. class="bi bi-x-circle"
  3250. viewBox="0 0 16 16"
  3251. >
  3252. <path
  3253. d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14m0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16"
  3254. />
  3255. <path
  3256. d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708"
  3257. />
  3258. </svg>
  3259. </button>
  3260. <img class="cover-img" :src="ad.cover_img" alt="" />
  3261. <section>
  3262. <h2 class="title">{{ ad.title }}</h2>
  3263. <span></span>
  3264. <p v-html="ad.description"></p>
  3265. <div v-if="ad.included.length" class="product">
  3266. <p>訂單內含商品</p>
  3267. <ul>
  3268. <li v-for="(product, index) in ad.included" :key="index">
  3269. {{ product }}
  3270. </li>
  3271. </ul>
  3272. </div>
  3273. <div v-if="ad.branch.length" class="branch">
  3274. <p>分店資訊</p>
  3275. <ul>
  3276. <li v-for="(name, index) in ad.branch" :key="index">
  3277. {{ name }}
  3278. </li>
  3279. </ul>
  3280. </div>
  3281. <span v-if="ad.location !== ''" class="info justify-end">
  3282. <svg
  3283. xmlns="http://www.w3.org/2000/svg"
  3284. width="20"
  3285. height="20"
  3286. viewBox="0 0 384 512"
  3287. >
  3288. <path
  3289. d="M215.7 499.2C267 435 384 279.4 384 192C384 86 298 0 192 0S0 86 0 192c0 87.4 117 243 168.3 307.2c12.3 15.3 35.1 15.3 47.4 0zM192 128a64 64 0 1 1 0 128 64 64 0 1 1 0-128z"
  3290. />
  3291. </svg>
  3292. <p>{{ ad.location }}</p>
  3293. </span>
  3294. </section>
  3295. </div>
  3296. </v-dialog> -->
  3297. <!-- 掃描視窗 -->
  3298. <v-dialog v-model="qrcodeImgDialog" width="auto">
  3299. <v-card class="pa-5">
  3300. <v-card-title class="text-center"> 請掃描 QR Code 前往 </v-card-title>
  3301. <v-card-text>
  3302. <qrcode-vue
  3303. :value="qrcodeImgUrl"
  3304. class="w-100 h-100"
  3305. style="max-width: 300px"
  3306. />
  3307. </v-card-text>
  3308. </v-card>
  3309. </v-dialog>
  3310. </template>
  3311. <style lang="scss">
  3312. .main-btn {
  3313. padding: 16px 70px;
  3314. font-size: 22px;
  3315. font-weight: 600;
  3316. border: none;
  3317. border-radius: 100px;
  3318. letter-spacing: 2px;
  3319. color: white;
  3320. background-color: var(--main-color);
  3321. cursor: pointer;
  3322. transition: all 0.3s;
  3323. &:hover {
  3324. background-color: #c19c75;
  3325. }
  3326. }
  3327. .lang-content {
  3328. width: 100%;
  3329. height: 100vh;
  3330. padding: 0 20vw;
  3331. display: flex;
  3332. align-items: center;
  3333. justify-content: center;
  3334. background-color: rgba(0, 0, 0, 0.6);
  3335. background-blend-mode: multiply;
  3336. background-image: url("@/assets/img/banner.jpg");
  3337. background-size: cover;
  3338. background-position: center center;
  3339. .main-btn {
  3340. margin-bottom: 40px;
  3341. &:last-child {
  3342. margin-bottom: 0;
  3343. }
  3344. }
  3345. .btn-list {
  3346. max-width: 400px;
  3347. display: flex;
  3348. flex-direction: column;
  3349. }
  3350. }
  3351. .main-containar {
  3352. width: 100%;
  3353. height: 100%;
  3354. display: flex;
  3355. flex-direction: column;
  3356. overflow-x: hidden;
  3357. .video-content {
  3358. height: 73vh;
  3359. display: flex;
  3360. justify-content: center;
  3361. transform: scale(1);
  3362. background-color: #cab78e;
  3363. // background-color: #d1bf99;
  3364. // background-color: var(--sub-color);
  3365. video {
  3366. width: 100%;
  3367. height: 100%;
  3368. position: fixed;
  3369. top: 55px;
  3370. left: 0;
  3371. right: 0;
  3372. z-index: 10;
  3373. @media (max-width: 575px) {
  3374. top: 15px;
  3375. }
  3376. @media (max-width: 375px) {
  3377. top: 40px;
  3378. }
  3379. }
  3380. .control-btn {
  3381. width: 33px;
  3382. height: 33px;
  3383. display: flex;
  3384. align-items: center;
  3385. justify-content: center;
  3386. position: absolute;
  3387. z-index: 50;
  3388. top: 70px;
  3389. right: 7px;
  3390. background: var(--main-color);
  3391. border: none;
  3392. border-radius: 100px;
  3393. img {
  3394. width: 25px;
  3395. filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(93deg)
  3396. brightness(103%) contrast(103%); // 改成白色
  3397. }
  3398. }
  3399. .control-item {
  3400. display: flex;
  3401. justify-content: end;
  3402. flex-direction: column;
  3403. z-index: 10;
  3404. position: absolute;
  3405. bottom: 20px;
  3406. @media (max-width: 375px) {
  3407. height: 29vh;
  3408. }
  3409. p {
  3410. color: #fff;
  3411. font-size: 1rem;
  3412. letter-spacing: 1px;
  3413. text-shadow: 1px 1px 2px #333;
  3414. }
  3415. }
  3416. }
  3417. .map-img {
  3418. max-width: 100%;
  3419. &.show-anchor {
  3420. max-width: 70%;
  3421. }
  3422. }
  3423. .chat-content {
  3424. width: 100%;
  3425. height: 65vh;
  3426. margin-top: -1rem;
  3427. position: relative;
  3428. z-index: 100;
  3429. letter-spacing: 1px;
  3430. border-radius: 10px 10px 0 0;
  3431. // box-shadow: 2px 2px 8px #ccc;
  3432. .headline {
  3433. display: flex;
  3434. align-items: center;
  3435. justify-content: space-between;
  3436. padding: 10px 25px;
  3437. border-radius: 15px 15px 0 0;
  3438. background-color: var(--main-color);
  3439. h1 {
  3440. font-size: 1.125rem;
  3441. font-weight: 500;
  3442. color: white;
  3443. @media (max-width: 375px) {
  3444. font-size: 1rem;
  3445. }
  3446. }
  3447. button {
  3448. padding-top: 3px;
  3449. display: flex;
  3450. align-items: center;
  3451. border: none;
  3452. background-color: transparent;
  3453. cursor: pointer;
  3454. img {
  3455. width: 25px;
  3456. height: 20px;
  3457. transition: all 0.3s;
  3458. transform: rotate(0deg);
  3459. &.rotate {
  3460. transform: rotate(180deg);
  3461. }
  3462. }
  3463. }
  3464. }
  3465. .chat-area {
  3466. display: flex;
  3467. flex-direction: column;
  3468. background: var(--sub-color);
  3469. height: 45vh;
  3470. padding: 0 1em 2em;
  3471. overflow-x: hidden;
  3472. overflow-y: auto;
  3473. transition: all 0.3s;
  3474. // @media (max-width: 575px) {
  3475. // height: 50vh;
  3476. // }
  3477. &.area-open {
  3478. height: 75vh;
  3479. @media (max-width: 400px) {
  3480. height: 67vh;
  3481. }
  3482. }
  3483. .btn-list {
  3484. margin-top: 20px;
  3485. display: flex;
  3486. flex-wrap: wrap;
  3487. list-style: none;
  3488. button {
  3489. margin-right: 15px;
  3490. margin-bottom: 15px;
  3491. padding: 5px 15px;
  3492. color: white;
  3493. border: 2px solid white;
  3494. letter-spacing: 2px;
  3495. font-weight: bold;
  3496. text-shadow: 1px 1px 1px #939393;
  3497. &.active {
  3498. color: var(--sub-color);
  3499. background-color: white;
  3500. text-shadow: none;
  3501. }
  3502. }
  3503. }
  3504. }
  3505. .message-content {
  3506. display: flex;
  3507. flex-direction: column;
  3508. // margin-top: 20px;
  3509. .message {
  3510. max-width: 45%;
  3511. border-radius: 20px;
  3512. padding: 0.5em 1.2em;
  3513. white-space: pre-line;
  3514. &:first-child {
  3515. margin-top: 0;
  3516. }
  3517. @media (max-width: 600px) {
  3518. max-width: 80%;
  3519. font-size: 1rem;
  3520. }
  3521. &.message-out {
  3522. margin-left: auto;
  3523. background: var(--bg-grey);
  3524. color: white;
  3525. }
  3526. &.message-in {
  3527. margin-right: auto;
  3528. background: #f1f0f0;
  3529. color: black;
  3530. }
  3531. &.message-in,
  3532. &.message-out {
  3533. margin-top: 20px;
  3534. }
  3535. }
  3536. }
  3537. .branch {
  3538. ul,
  3539. li,
  3540. p {
  3541. margin: 10px 0;
  3542. font-size: 14px;
  3543. }
  3544. }
  3545. .chat-inputs {
  3546. width: 100%;
  3547. display: flex;
  3548. padding: 13px 20px;
  3549. background-color: white;
  3550. input {
  3551. width: 100%;
  3552. border: none;
  3553. margin-left: 2rem;
  3554. &:focus-visible {
  3555. outline: none;
  3556. }
  3557. }
  3558. button {
  3559. border: none;
  3560. background: white;
  3561. cursor: pointer;
  3562. &:hover {
  3563. img {
  3564. opacity: 0.8;
  3565. }
  3566. }
  3567. img {
  3568. padding-top: 5px;
  3569. transition: all 0.3s;
  3570. filter: invert(75%) sepia(20%) saturate(459%) hue-rotate(360deg)
  3571. brightness(100%) contrast(85%);
  3572. }
  3573. }
  3574. ::placeholder {
  3575. font-size: 1rem;
  3576. font-weight: 500;
  3577. color: var(--sub-color);
  3578. opacity: 1; /* Firefox */
  3579. }
  3580. ::-ms-input-placeholder {
  3581. /* Edge 12 -18 */
  3582. color: var(--sub-color);
  3583. }
  3584. }
  3585. .recommend-item {
  3586. width: 350px;
  3587. border-radius: 10px;
  3588. background-color: white;
  3589. }
  3590. .recommend-item,
  3591. .ticket-item {
  3592. .cover-img {
  3593. width: 100%;
  3594. height: 22.5vh;
  3595. object-fit: contain;
  3596. overflow: hidden;
  3597. border-radius: 10px 10px 0 0;
  3598. }
  3599. section {
  3600. padding: 15px 25px;
  3601. letter-spacing: 1px;
  3602. .title {
  3603. margin-bottom: 0;
  3604. font-weight: 600;
  3605. font-size: 1.25rem;
  3606. text-align: left;
  3607. // 超過則省略
  3608. overflow: hidden;
  3609. text-overflow: ellipsis;
  3610. display: -webkit-box;
  3611. -webkit-line-clamp: 1;
  3612. -webkit-box-orient: vertical;
  3613. line-break: after-white-space;
  3614. }
  3615. .description {
  3616. line-height: 1.8;
  3617. // text-align: justify;
  3618. font-size: 1rem;
  3619. }
  3620. .date {
  3621. color: #646464;
  3622. font-size: 1rem;
  3623. text-align: center;
  3624. }
  3625. }
  3626. .link-btn {
  3627. display: flex;
  3628. justify-content: center;
  3629. a {
  3630. display: block;
  3631. width: 100%;
  3632. max-width: 200px;
  3633. margin: 25px 3px;
  3634. padding: 8px;
  3635. text-align: center;
  3636. border-radius: 20px;
  3637. color: white;
  3638. background-color: var(--main-color);
  3639. text-decoration: none;
  3640. transition: all 0.3s;
  3641. &:hover {
  3642. opacity: 0.8;
  3643. }
  3644. }
  3645. }
  3646. }
  3647. .store-item {
  3648. width: 350px;
  3649. .cover-img {
  3650. position: relative;
  3651. margin-bottom: -5px;
  3652. img {
  3653. width: 100%;
  3654. height: 200px;
  3655. object-fit: cover;
  3656. }
  3657. .title {
  3658. position: absolute;
  3659. top: 50%;
  3660. left: 50%;
  3661. transform: translate(-50%, -50%);
  3662. color: white;
  3663. font-size: 1.25rem;
  3664. letter-spacing: 2px;
  3665. text-shadow: 2px 2px 4px #333;
  3666. }
  3667. }
  3668. .headline {
  3669. color: white;
  3670. justify-content: center;
  3671. }
  3672. section {
  3673. padding: 20px;
  3674. letter-spacing: 1px;
  3675. border-radius: 0 0 10px 10px;
  3676. background-color: white;
  3677. .info {
  3678. margin-bottom: 15px;
  3679. p {
  3680. display: flex;
  3681. align-items: center;
  3682. img {
  3683. margin-right: 10px;
  3684. }
  3685. &:last-child {
  3686. margin-top: 3px;
  3687. }
  3688. }
  3689. }
  3690. }
  3691. }
  3692. .ticket-item {
  3693. width: 100%;
  3694. margin-top: 20px;
  3695. h3 {
  3696. margin-bottom: 10px;
  3697. text-align: center;
  3698. }
  3699. .ticket-slide {
  3700. width: 63%;
  3701. margin: 0;
  3702. position: relative;
  3703. @media (max-width: 767px) {
  3704. width: 90%;
  3705. }
  3706. .swiper-slide {
  3707. margin-left: 1px;
  3708. .slide-item {
  3709. max-width: 50vw;
  3710. border-radius: 10px;
  3711. background-color: white;
  3712. @media (max-width: 767px) {
  3713. max-width: 70vw;
  3714. }
  3715. }
  3716. }
  3717. .swiper-button-prev {
  3718. display: none;
  3719. }
  3720. }
  3721. .title,
  3722. .description {
  3723. // 超過則省略
  3724. overflow: hidden;
  3725. text-overflow: ellipsis;
  3726. display: -webkit-box;
  3727. // -webkit-line-clamp: 3;
  3728. -webkit-box-orient: vertical;
  3729. line-break: after-white-space;
  3730. }
  3731. .title {
  3732. -webkit-line-clamp: 3;
  3733. }
  3734. .description {
  3735. -webkit-line-clamp: 5;
  3736. }
  3737. section {
  3738. margin-top: -6px;
  3739. border-radius: 0 0 10px 10px;
  3740. background-color: white;
  3741. .link-btn {
  3742. a {
  3743. max-width: 150px;
  3744. margin: 0;
  3745. padding: 8px 12px;
  3746. font-size: 0.75rem;
  3747. }
  3748. }
  3749. .price-item {
  3750. display: block;
  3751. margin-top: 10px;
  3752. text-align: end;
  3753. }
  3754. .price-info {
  3755. margin: 20px 0;
  3756. display: flex;
  3757. align-items: center;
  3758. justify-content: space-between;
  3759. @media (max-width: 575px) {
  3760. font-size: 1rem;
  3761. // flex-direction: column;
  3762. // align-items: start;
  3763. }
  3764. button {
  3765. border-radius: 100px;
  3766. }
  3767. span {
  3768. &:first-child {
  3769. display: block;
  3770. margin: 10px 0;
  3771. padding-right: 5px;
  3772. font-size: 1rem;
  3773. font-weight: 600;
  3774. color: var(--main-color);
  3775. }
  3776. }
  3777. }
  3778. }
  3779. }
  3780. }
  3781. }
  3782. .btn-swiper {
  3783. .swiper-slide {
  3784. width: auto;
  3785. // max-width: 185px;
  3786. .btn-container {
  3787. display: flex;
  3788. justify-content: center;
  3789. button {
  3790. display: block;
  3791. width: 100%;
  3792. padding: 10px 20px;
  3793. border-radius: 10px;
  3794. color: white;
  3795. border: none;
  3796. background-color: var(--main-color);
  3797. letter-spacing: 2px;
  3798. font-size: 1rem;
  3799. transition: all 0.3s;
  3800. &:hover {
  3801. opacity: 0.8;
  3802. }
  3803. }
  3804. }
  3805. }
  3806. }
  3807. .a-modal {
  3808. display: none !important;
  3809. }
  3810. .ad-content {
  3811. max-height: 95vh;
  3812. padding: 35px;
  3813. overflow-y: auto;
  3814. border-radius: 10px;
  3815. background-color: #fff;
  3816. .close-btn {
  3817. position: absolute;
  3818. top: 7px;
  3819. right: 5px;
  3820. border: none;
  3821. background-color: transparent;
  3822. transition: all 0.3s;
  3823. cursor: pointer;
  3824. svg {
  3825. filter: invert(57%) sepia(45%) saturate(391%) hue-rotate(350deg)
  3826. brightness(93%) contrast(84%);
  3827. }
  3828. &:hover {
  3829. opacity: 0.8;
  3830. }
  3831. }
  3832. section {
  3833. p {
  3834. padding: 0 10px;
  3835. line-height: 1.7;
  3836. letter-spacing: 2px;
  3837. }
  3838. .title {
  3839. margin: 15px auto;
  3840. color: var(--main-color);
  3841. font-weight: 600;
  3842. font-size: 1.375em;
  3843. text-align: center;
  3844. letter-spacing: 2px;
  3845. }
  3846. .product,
  3847. .branch {
  3848. margin-top: 20px;
  3849. background-color: #f1e9dc;
  3850. p {
  3851. padding: 10px 0;
  3852. font-weight: 500;
  3853. font-size: 1rem;
  3854. text-align: center;
  3855. border-bottom: 2px solid #fff;
  3856. }
  3857. ul {
  3858. padding: 10px;
  3859. list-style: none;
  3860. li {
  3861. padding-bottom: 5px;
  3862. letter-spacing: 1px;
  3863. font-weight: 500;
  3864. font-size: 1rem;
  3865. }
  3866. }
  3867. }
  3868. .date {
  3869. margin: 20px 0;
  3870. text-align: center;
  3871. }
  3872. .map {
  3873. display: flex;
  3874. align-items: center;
  3875. justify-content: end;
  3876. p {
  3877. padding-left: 10px;
  3878. font-weight: 500;
  3879. letter-spacing: 2px;
  3880. color: var(--main-color);
  3881. }
  3882. svg {
  3883. filter: invert(57%) sepia(45%) saturate(391%) hue-rotate(350deg)
  3884. brightness(93%) contrast(84%);
  3885. }
  3886. }
  3887. }
  3888. .cover-img {
  3889. width: 100%;
  3890. object-fit: cover;
  3891. }
  3892. }
  3893. .slider-content {
  3894. width: 100%;
  3895. img {
  3896. width: 100%;
  3897. margin-bottom: -5px;
  3898. }
  3899. }
  3900. .branch {
  3901. margin-top: 30px;
  3902. ul {
  3903. padding: 0;
  3904. list-style: none;
  3905. li {
  3906. letter-spacing: 1px;
  3907. }
  3908. }
  3909. }
  3910. .video-progress {
  3911. position: absolute;
  3912. left: 50%;
  3913. top: 40%;
  3914. z-index: 100;
  3915. transform: translate(-50%, -50%);
  3916. }
  3917. .dialog-content {
  3918. position: absolute;
  3919. top: 60px;
  3920. left: 0;
  3921. z-index: 100;
  3922. }
  3923. .vr-content {
  3924. width: 700px;
  3925. height: 700px;
  3926. }
  3927. .ar-link {
  3928. display: inline-block;
  3929. padding: 7px 17px;
  3930. color: #fff;
  3931. background-color: var(--main-color);
  3932. border-radius: 5px;
  3933. text-decoration: none;
  3934. }
  3935. .ar-card {
  3936. width: 85vw;
  3937. height: 100vh;
  3938. }
  3939. .btn-swiper {
  3940. margin-top: 20px;
  3941. }
  3942. .v-expansion-panel-text {
  3943. font-size: 1rem;
  3944. line-height: 1.7;
  3945. }
  3946. // 底部選單
  3947. .menu {
  3948. position: fixed;
  3949. z-index: 300;
  3950. left: 0;
  3951. bottom: 0px;
  3952. right: 0;
  3953. color: var(--text-color);
  3954. background-color: white;
  3955. box-shadow: 0px -3px 10px rgba(150, 150, 150, 0.7);
  3956. &.hide-menu table {
  3957. height: 0;
  3958. z-index: -1;
  3959. }
  3960. .icon {
  3961. width: 80px;
  3962. @media (max-width: 767px) {
  3963. width: 50px;
  3964. }
  3965. // @media (max-width: 375px) {
  3966. // width: 45px;
  3967. // }
  3968. }
  3969. .menu-table {
  3970. height: 100%;
  3971. transition: all 0.3s;
  3972. &.hide-table {
  3973. height: 0;
  3974. table {
  3975. display: none;
  3976. height: 0;
  3977. }
  3978. }
  3979. table {
  3980. width: 95%;
  3981. height: 100%;
  3982. margin: auto;
  3983. border-collapse: collapse;
  3984. position: relative;
  3985. transition: all 0.3s;
  3986. &::before,
  3987. &::after {
  3988. content: "";
  3989. display: inline-block;
  3990. width: 10px;
  3991. height: 100%;
  3992. background-color: #fff;
  3993. position: absolute;
  3994. bottom: 0%;
  3995. @media (max-width: 390px) {
  3996. width: 8px;
  3997. }
  3998. }
  3999. &::before {
  4000. left: -5px;
  4001. }
  4002. &::after {
  4003. right: -5px;
  4004. }
  4005. tr {
  4006. td {
  4007. width: 50px;
  4008. padding: 1rem 0;
  4009. text-align: center;
  4010. border: 1px solid #ccc;
  4011. @media (max-width: 767px) {
  4012. width: 100px;
  4013. padding: 0.5rem 0;
  4014. }
  4015. p {
  4016. padding: 0 0.3rem;
  4017. letter-spacing: 0.03rem;
  4018. @media (max-width: 430px) {
  4019. // width: 115px;
  4020. font-size: 1rem;
  4021. }
  4022. }
  4023. }
  4024. &:first-child {
  4025. td {
  4026. border-top: 0px solid transparent;
  4027. }
  4028. }
  4029. &:last-child {
  4030. td {
  4031. border-bottom: 0px solid transparent;
  4032. }
  4033. }
  4034. }
  4035. }
  4036. }
  4037. .question-btn {
  4038. color: var(--main-color);
  4039. font-size: 1.25rem;
  4040. font-weight: 500;
  4041. letter-spacing: 0.1rem;
  4042. @media (max-width: 414px) {
  4043. font-size: 1rem;
  4044. }
  4045. }
  4046. }
  4047. .lang-select {
  4048. position: absolute;
  4049. z-index: 100;
  4050. bottom: 15px;
  4051. right: 20px;
  4052. width: 130px;
  4053. }
  4054. </style>