12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682 |
- <script setup>
- import { ref, reactive, onMounted, watch, nextTick } from "vue";
- import { useRoute } from "vue-router";
- // VR
- import "aframe";
- // i18n
- import { useI18n } from "vue-i18n";
- // Axios
- import axios from "axios";
- // Moment
- import moment from "moment";
- // Animate
- import "animate.css";
- // Swiper
- import { Swiper, SwiperSlide } from "swiper/vue";
- import { Navigation, Autoplay } from "swiper/modules";
- import "swiper/css";
- import "swiper/css/navigation";
- // Recorder
- import Recorder from "recorder-core";
- import "recorder-core/src/engine/mp3";
- import "recorder-core/src/engine/mp3-engine";
- // QR Code
- import { QrcodeStream, QrcodeDropZone, QrcodeCapture } from "vue-qrcode-reader";
- // Components
- import Navbar from "../components/Navbar.vue";
- import TicketPurchase from "../components/TicketPurchase.vue";
- const { t, locale } = useI18n();
- const route = useRoute();
- const routeParam = ref(null);
- let qrCodeDialog = ref(false);
- let qrCodeLoading = ref(true);
- let location = ref(""); // 當前位置
- // QR Code 掃描
- function onDetect(detectedCodes) {
- console.log("detectedCodes", detectedCodes);
- const url = new URL(detectedCodes[0].rawValue);
- location.value = url.searchParams.get("location");
- let val;
- let lang = getLang();
- if (lang === "en") {
- switch (location.value) {
- case "B1 鼎泰豐":
- val = "b1 Din Tai Fung";
- break;
- case "B1 中環":
- val = "b1 Centre";
- break;
- case "B1 2號電梯":
- val = "b1 Elevator No.2";
- break;
- case "B1 4號電梯":
- val = "b1 Elevator No.4";
- break;
- case "B1 3號電梯":
- val = "b1 Elevator No.3";
- break;
- case "1F 信義環":
- val = "1f South Xinyi";
- break;
- case "1F 3號電梯":
- val = "1f Elevator No.3";
- break;
- case "2F 3號電梯":
- val = "2f Elevator No.3";
- break;
- case "88F 觀景台":
- val = "88f Observatory";
- break;
- case "89F 觀景台":
- val = "89f Observatory";
- break;
- default:
- break;
- }
- } else if (lang === "ch") {
- val = location.value;
- }
- if (location.value && location.value !== "") {
- qrCodeDialog.value = false;
- messages.value.push({
- label: "text",
- author: "ai",
- body: `${t("current_location")}:${val}`,
- });
- changeLocation(location.value); // 選擇導覽位置
- } else {
- qrCodeDialog.value = false;
- messages.value.push({
- label: "text",
- author: "ai",
- body: "讀取錯誤,請重新掃描。",
- });
- }
- }
- // 判斷 vue-qrcode-reader 是否加載完成
- function onInit(capabilities) {
- qrCodeLoading.value = false;
- }
- onMounted(() => {
- // 取得當前路由參數
- routeParam.value = route.path.replace("/", "");
- console.log("網址參數", routeParam.value);
- window.addEventListener("resize", handleResize);
- });
- const userMessage = ref("");
- let modules = [Navigation, Autoplay]; // Swiper
- // AI 客服回覆訊息
- let messages = ref([]);
- watch(messages.value, (val) => {
- console.log("messages", val);
- scrollToBottom();
- updateMenuHeight();
- });
- let ad = ref({}); // 彈跳視窗廣告
- let qaQuery = reactive([]);
- const chatArea = ref(null); // 對話框
- // 滾動到對話框底部
- const scrollToBottom = () => {
- setTimeout(() => {
- // chatArea.value.scrollTop = chatArea.value.scrollHeight;
- window.scrollTo({
- top: document.body.scrollHeight,
- behavior: "smooth", // 平滑滾動
- });
- }, 100);
- // let list = messages.value;
- // const item = list[list.length - 1];
- // if (item.label === "text") {
- // setTimeout(() => {
- // chatArea.value.scrollTop = chatArea.value.scrollHeight;
- // }, 100);
- // }
- };
- // 對話選項(按鈕)
- function setBtnValue(val) {
- console.log("value", val);
- userMessage.value = val;
- sendMessage("text");
- }
- // 傳送訊息 (如 type="text" 代表為純文字訊息,不需語音回覆)
- async function sendMessage(type = "") {
- if (userMessage.value === "") {
- return;
- }
- console.log("sendMessage", userMessage.value);
- qaQuery.push(userMessage.value);
- let url = "https://devbox10.itri-nlp.tw:38125/v1/qa/";
- try {
- // 使用者訊息
- messages.value.push({
- label: "text",
- body: userMessage.value,
- author: "user",
- });
- userMessage.value = "";
- // hideMenu.value = true;
- axios
- .post(
- url,
- new URLSearchParams({
- query: JSON.stringify(qaQuery), // 使用者問句
- language: selectLang.value, // 語系
- category: assignCategory.value, // 類別
- subtype: assignSubtype.value, // 詳細類別(非必填)
- from_loc: "", // 定位點
- to_loc: "", // 導覽點
- }),
- {
- headers: {
- "Content-Type": "application/x-www-form-urlencoded",
- },
- }
- )
- .then((response) => {
- // if (showAnchor.value) {
- // getVideo(response.data);
- // }
- // AI 客服回傳訊息
- messages.value.push({
- label: "text",
- author: "ai",
- body: response.data.response,
- });
- console.log("response", response);
- if (type !== "text") {
- handleTTS(response.data.response); // 取得語音回覆
- }
- if (response.data.data.length) {
- let info = {
- buttonList: [], // 按鈕
- ticketList: [], // 票券
- };
- let labelContent;
- response.data.data.map((item) => {
- if (item.type === "button") {
- console.log("按鈕");
- info.buttonList.push(item);
- labelContent = "ticket";
- } else if (item.type === "ticket") {
- console.log("票");
- info.ticketList.push(item);
- labelContent = "ticket";
- } else if (item.type === "brand") {
- console.log("品牌");
- info.ticketList.push(item);
- labelContent = "brand";
- }
- });
- console.log("info", info);
- console.log("labelContent", labelContent);
- setTimeout(() => {
- messages.value.push({
- label: labelContent,
- author: "ai",
- body: info,
- });
- }, 10);
- }
- })
- .catch((error) => {
- console.error("Error:", error);
- });
- console.log("messages.value", messages.value);
- } catch (error) {
- console.log("error", error);
- }
- }
- // let isTTSVideo = ref(false); // API 是否回傳影片
- // let ttsVideo = ref(null); // 影片 dom
- // let ttsVideoSrc = ref(""); // 影片路徑
- // let videoPause = ref(false); // 暫停按鈕
- let hideMenu = ref(false); // 底部選單
- let showInput = ref(false); // 輸入框
- // 取得 mp4
- // async function getVideo(data) {
- // console.log("getVideo data", data);
- // // let url = `https://cmm.ai:9101/tts?message=${data.response}&type=101`;
- // let url = `https://bf18-61-230-0-215.ngrok-free.app/tts?message=${data.response}&type=101`;
- // try {
- // const response = await axios.post(url);
- // console.log("response", response);
- // if (response.status === 200) {
- // video.value.pause();
- // videoPause.value = false;
- // // ttsVideoSrc.value = `https://cmm.ai:9101/${response.data.url}`;
- // // ttsVideoSrc.value = `https://bf18-61-230-0-215.ngrok-free.app/${response.data.url}`;
- // ttsVideoSrc.value = response.data.url;
- // await ttsVideo.value.load();
- // await ttsVideo.value.play();
- // // AI 客服回傳訊息
- // // messages.value.splice(-1, 1);
- // messages.value.push({
- // type: data.type,
- // body: data.response,
- // author: data.author,
- // });
- // // isTTSVideo.value = true;
- // // 判斷影片是否結束
- // const videoPromise = new Promise((resolve, reject) => {
- // ttsVideo.value.onended = () => resolve(true);
- // });
- // const videoCompleted = await videoPromise; // 影片結束
- // if (videoCompleted) {
- // console.log("影片結束");
- // // isTTSVideo.value = false; // 切換為初始影片
- // hideAnchorPrologue.value = false; // 切換開場白影片
- // }
- // console.log("videoCompleted", videoCompleted);
- // }
- // } catch (error) {
- // console.log("error", error);
- // }
- // }
- // 影片暫停/播放
- // function handleVideo(isTTS) {
- // if (videoPause.value) {
- // if (isTTS) {
- // ttsVideo.value.play();
- // } else {
- // video.value.play();
- // }
- // videoPause.value = false;
- // } else {
- // if (isTTS) {
- // ttsVideo.value.pause();
- // } else {
- // video.value.pause();
- // }
- // videoPause.value = true;
- // }
- // }
- function getLang() {
- let lang = localStorage.getItem("lang");
- let langVal = "";
- switch (lang) {
- case "zh-tw":
- langVal = "ch";
- break;
- case "en-us":
- langVal = "en";
- break;
- default:
- break;
- }
- return langVal;
- }
- let showAd = ref(false);
- // 取得廣告
- async function setAd() {
- let lang = getLang();
- console.log("lang", lang);
- let url = `https://cmm.ai:9101/ad?language=${lang}`;
- try {
- const response = await axios.get(url);
- console.log("Ad response", response);
- ad.value = response.data.data.body;
- console.log("Ad", ad.value);
- } catch (error) {
- console.log("error", error);
- }
- }
- let video = ref(null);
- function videoPlay() {
- video.value.load();
- video.value.play();
- }
- // 底部選單
- const menu = ref(null);
- const menuHeight = ref(0);
- // let isRotate = ref(false);
- let isLanguagePage = ref(true);
- let selectLang = ref("");
- let chatLoading = ref(true);
- watch(isLanguagePage, (val) => {
- if (!val) {
- setTimeout(updateMenuHeight, 500);
- }
- });
- const handleResize = () => {
- updateMenuHeight();
- };
- // 取得底部選單高度
- const updateMenuHeight = () => {
- nextTick(() => {
- if (menu.value) {
- menuHeight.value = menu.value.clientHeight;
- chatLoading.value = false;
- }
- });
- };
- function chooseLang(lang) {
- console.log("選擇語言:", lang);
- selectLang.value = lang;
- isLanguagePage.value = false;
- locale.value = lang; // i18n locale
- localStorage.setItem("lang", lang);
- messages.value.push({
- label: "text",
- author: "ai",
- body: t("prologue"),
- });
- messages.value.push({
- label: "text",
- author: "ai",
- body: t("service"),
- });
- // messages.value.push({
- // label: "text",
- // author: "ai",
- // body: "請選擇問題類型:",
- // });
- // messages.value.push({
- // label: "btn-list",
- // author: "ai",
- // body: "",
- // });
- setAd();
- handleClick();
- console.log(" messages.value", messages.value);
- setTimeout(() => {
- showAd.value = true;
- // videoPlay();
- }, 500);
- }
- let assignSubtype = ref("");
- let assignCategory = ref("");
- let assignCategoryIndex = ref(null);
- // 美食伴手禮
- let diningList = reactive([
- {
- value: "特色/高空餐廳",
- text: "food_souvenirs_info.signature",
- },
- {
- value: "輕食/CAFÉ",
- text: "food_souvenirs_info.light",
- },
- {
- value: "美食街",
- text: "food_souvenirs_info.courts",
- },
- {
- value: "伴手禮",
- text: "food_souvenirs_info.souvenir",
- },
- ]);
- // 秘境花園觀景台
- let observationList = reactive([
- {
- value: "線上購票",
- text: "observatory_info.tickets.title",
- },
- {
- value: "參觀資訊",
- text: "observatory_info.visitor.title",
- },
- // {
- // value: "實境景色",
- // text: "observatory_info.view",
- // },
- {
- value: "前往秘境花園觀景台",
- text: "observatory_info.garden",
- },
- ]);
- // 購物及優惠
- let shoppingList = reactive([
- {
- value: "購物品牌查詢",
- text: "shopping_discounts_info.brands.title",
- },
- {
- value: "國際貴賓卡專屬禮遇",
- text: "shopping_discounts_info.tourist_card.title",
- },
- ]);
- // 購物品牌查詢
- let brandList = reactive([
- {
- value: "國際珠寶腕錶",
- text: "shopping_discounts_info.brands.jewely",
- },
- {
- value: "國際精品",
- text: "shopping_discounts_info.brands.boutique",
- },
- {
- value: "美妝保養品",
- text: "shopping_discounts_info.brands.skincare",
- },
- {
- value: "流行服飾",
- text: "shopping_discounts_info.brands.apparel",
- },
- {
- value: "生活居家/3C",
- text: "shopping_discounts_info.brands.lifestyle",
- },
- {
- value: "文化創意",
- text: "shopping_discounts_info.brands.cultural",
- },
- {
- value: "特色品牌",
- text: "shopping_discounts_info.brands.signature",
- },
- {
- value: "館外店家",
- text: "shopping_discounts_info.brands.outside",
- },
- ]);
- // 服務資訊
- let serviceList = reactive([
- {
- title: "service_info.business_hours",
- depiction: "service_info.business_hours_1",
- },
- {
- title: "service_info.tax_refund",
- depiction: "service_info.tax_refund_1",
- },
- {
- title: "service_info.toilets",
- depiction: "service_info.toilets_1",
- },
- {
- title: "service_info.charge",
- depiction: "service_info.charge_1",
- },
- // {
- // title: "AI 天燈",
- // depiction: "https://cmm.ai/101-postcard/#/skylanternhome",
- // },
- ]);
- // 定位點
- let locationList = reactive([
- {
- location: "B1 鼎泰豐", // 編號 1
- navigation: [
- {
- value: "景觀餐廳櫃台",
- text: "high_rise_restaurant_reception",
- },
- {
- value: "ATM",
- text: "atm",
- },
- {
- value: "觀景台售票處",
- text: "observatory_ticket_office",
- },
- {
- value: "鼎泰豐",
- text: "din_tai_fung",
- },
- {
- value: "捷運",
- text: "metro_station",
- },
- {
- value: "超市",
- text: "supermarket",
- },
- {
- value: "美食街",
- text: "food_court",
- },
- {
- value: "退稅/外幣兌換櫃台",
- text: "tax_refund_currency_exchange",
- },
- {
- value: "計程車乘車處",
- text: "taxi_station",
- },
- {
- value: "無障礙廁所",
- text: "accessible_facilities",
- },
- {
- value: "客服(停車折抵)",
- text: "service_counter_parking_discount",
- },
- {
- value: "哺乳室",
- text: "nursing_room",
- },
- {
- value: "飲水機",
- text: "ice_warmed_water_dispenser",
- },
- {
- value: "伴手禮區",
- text: "snackable_souvenirs",
- },
- {
- value: "廁所",
- text: "restroom",
- },
- {
- value: "置物櫃",
- text: "items_and_luggage_storage",
- },
- ],
- // navigation: [
- // "景觀餐廳櫃台",
- // "ATM",
- // "觀景台售票處",
- // "鼎泰豐",
- // "捷運",
- // "超市",
- // "美食街",
- // "退稅/外幣兌換櫃台",
- // "計程車乘車處",
- // "無障礙廁所",
- // "客服(停車折抵)",
- // "哺乳室",
- // "飲水機",
- // "伴手禮區",
- // "廁所",
- // "置物櫃",
- // ],
- },
- {
- location: "B1 中環", // 編號 2
- navigation: [
- {
- value: "景觀餐廳櫃台",
- text: "high_rise_restaurant_reception",
- },
- {
- value: "ATM",
- text: "atm",
- },
- {
- value: "觀景台售票處",
- text: "observatory_ticket_office",
- },
- {
- value: "美食街",
- text: "food_court",
- },
- {
- value: "伴手禮區",
- text: "snackable_souvenirs",
- },
- {
- value: "鼎泰豐",
- text: "din_tai_fung",
- },
- {
- value: "捷運",
- text: "metro_station",
- },
- {
- value: "超市",
- text: "supermarket",
- },
- {
- value: "計程車乘車處",
- text: "taxi_station",
- },
- {
- value: "無障礙廁所",
- text: "accessible_facilities",
- },
- ],
- // navigation: [
- // "景觀餐廳櫃台",
- // "ATM",
- // "觀景台售票處",
- // "美食街",
- // "伴手禮區",
- // "鼎泰豐",
- // "捷運",
- // "超市",
- // "計程車乘車處",
- // "無障礙廁所",
- // ],
- },
- {
- location: "B1 2號電梯", // 編號 3
- navigation: [
- {
- value: "景觀餐廳櫃台",
- text: "high_rise_restaurant_reception",
- },
- {
- value: "ATM",
- text: "atm",
- },
- {
- value: "觀景台售票處",
- text: "observatory_ticket_office",
- },
- {
- value: "客服(退稅櫃台/外幣兌換)",
- text: "tax_refund_currency_exchange",
- },
- {
- value: "計程車乘車處",
- text: "taxi_station",
- },
- {
- value: "無障礙廁所",
- text: "accessible_facilities",
- },
- {
- value: "超市",
- text: "supermarket",
- },
- {
- value: "鼎泰豐",
- text: "din_tai_fung",
- },
- {
- value: "捷運",
- text: "metro_station",
- },
- {
- value: "伴手禮區",
- text: "snackable_souvenirs",
- },
- {
- value: "廁所",
- text: "restroom",
- },
- {
- value: "置物櫃",
- text: "items_and_luggage_storage",
- },
- {
- value: "美食街",
- text: "food_court",
- },
- {
- value: "客服(停車折抵)",
- text: "service_counter_parking_discount",
- },
- {
- value: "哺乳室",
- text: "nursing_room",
- },
- {
- value: "飲水機",
- text: "ice_warmed_water_dispenser",
- },
- {
- value: "廁所",
- text: "restroom",
- },
- ],
- // navigation: [
- // "景觀餐廳櫃台",
- // "ATM",
- // "觀景台售票處",
- // "客服(退稅櫃台/外幣兌換)",
- // "計程車乘車處",
- // "無障礙廁所",
- // "超市",
- // "鼎泰豐",
- // "捷運",
- // "伴手禮區",
- // "廁所",
- // "置物櫃",
- // "美食街",
- // "客服(停車折抵)",
- // "哺乳室",
- // "飲水機",
- // "廁所",
- // ],
- },
- {
- location: "B1 4號電梯", // 編號 4
- navigation: [
- {
- value: "景觀餐廳櫃台",
- text: "high_rise_restaurant_reception",
- },
- {
- value: "ATM",
- text: "atm",
- },
- {
- value: "觀景台售票處",
- text: "observatory_ticket_office",
- },
- {
- value: "廁所",
- text: "restroom",
- },
- {
- value: "置物櫃",
- text: "items_and_luggage_storage",
- },
- {
- value: "客服(停車折抵)",
- text: "service_counter_parking_discount",
- },
- {
- value: "哺乳室",
- text: "nursing_room",
- },
- {
- value: "飲水機",
- text: "ice_warmed_water_dispenser",
- },
- {
- value: "退稅/外幣兌換櫃台",
- text: "tax_refund_currency_exchange",
- },
- {
- value: "計程車乘車處",
- text: "taxi_station",
- },
- {
- value: "無障礙廁所",
- text: "accessible_facilities",
- },
- {
- value: "伴手禮區",
- text: "snackable_souvenirs",
- },
- {
- value: "捷運",
- text: "metro_station",
- },
- {
- value: "鼎泰豐",
- text: "din_tai_fung",
- },
- {
- value: "美食街",
- text: "food_court",
- },
- {
- value: "超市",
- text: "supermarket",
- },
- ],
- // navigation: [
- // "景觀餐廳櫃台",
- // "ATM",
- // "觀景台售票處",
- // "廁所",
- // "置物櫃",
- // "客服(停車折抵)",
- // "哺乳室",
- // "飲水機",
- // "退稅/外幣兌換櫃台",
- // "計程車乘車處",
- // "無障礙廁所",
- // "伴手禮區",
- // "捷運",
- // "鼎泰豐",
- // "美食街",
- // "超市",
- // ],
- },
- {
- location: "B1 3號電梯", // 編號 5
- navigation: [
- {
- value: "景觀餐廳櫃台",
- text: "high_rise_restaurant_reception",
- },
- {
- value: "ATM",
- text: "atm",
- },
- {
- value: "觀景台售票處",
- text: "observatory_ticket_office",
- },
- {
- value: "廁所",
- text: "restroom",
- },
- {
- value: "無障礙廁所",
- text: "accessible_facilities",
- },
- {
- value: "計程車乘車處",
- text: "taxi_station",
- },
- {
- value: "客服(退稅櫃台/外幣兌換)",
- text: "tax_refund_currency_exchange",
- },
- {
- value: "飲水機",
- text: "ice_warmed_water_dispenser",
- },
- {
- value: "哺乳室",
- text: "nursing_room",
- },
- {
- value: "置物櫃",
- text: "items_and_luggage_storage",
- },
- {
- value: "客服(停車折抵)",
- text: "service_counter_parking_discount",
- },
- {
- value: "美食街",
- text: "food_court",
- },
- {
- value: "伴手禮區",
- text: "snackable_souvenirs",
- },
- {
- value: "鼎泰豐",
- text: "din_tai_fung",
- },
- {
- value: "捷運",
- text: "metro_station",
- },
- {
- value: "超市",
- text: "supermarket",
- },
- ],
- // navigation: [
- // "景觀餐廳櫃台",
- // "ATM",
- // "觀景台售票處",
- // "廁所",
- // "無障礙廁所",
- // "計程車乘車處",
- // "客服(退稅櫃台/外幣兌換)",
- // "飲水機",
- // "哺乳室",
- // "置物櫃",
- // "客服(停車折抵)",
- // "美食街",
- // "伴手禮區",
- // "鼎泰豐",
- // "捷運",
- // "超市",
- // ],
- },
- {
- location: "1F 信義環", // 編號 6
- navigation: [
- {
- value: "景觀餐廳櫃台",
- text: "high_rise_restaurant_reception",
- },
- {
- value: "ATM",
- text: "atm",
- },
- {
- value: "觀景台售票處",
- text: "observatory_ticket_office",
- },
- {
- value: "廁所",
- text: "restroom",
- },
- {
- value: "ATM",
- text: "atm",
- },
- {
- value: "置物櫃",
- text: "items_and_luggage_storage",
- },
- {
- value: "飲水機",
- text: "ice_warmed_water_dispenser",
- },
- {
- value: "無障礙廁所",
- text: "accessible_facilities",
- },
- {
- value: "哺乳室",
- text: "nursing_room",
- },
- {
- value: "客服(停車折抵)",
- text: "service_counter_parking_discount",
- },
- {
- value: "退稅/外幣兌換櫃台",
- text: "tax_refund_currency_exchange",
- },
- {
- value: "伴手禮區",
- text: "snackable_souvenirs",
- },
- {
- value: "美食街",
- text: "food_court",
- },
- {
- value: "捷運",
- text: "metro_station",
- },
- {
- value: "鼎泰豐",
- text: "din_tai_fung",
- },
- {
- value: "超市",
- text: "supermarket",
- },
- ],
- // navigation: [
- // "景觀餐廳櫃台",
- // "ATM",
- // "觀景台售票處",
- // "廁所",
- // "ATM",
- // "置物櫃",
- // "飲水機",
- // "無障礙廁所",
- // "哺乳室",
- // "客服(停車折抵)",
- // "退稅/外幣兌換櫃台",
- // "伴手禮區",
- // "美食街",
- // "捷運",
- // "鼎泰豐",
- // "超市",
- // ],
- },
- {
- location: "1F 3號電梯", // 編號 7
- navigation: [
- {
- value: "景觀餐廳櫃台",
- text: "high_rise_restaurant_reception",
- },
- {
- value: "ATM",
- text: "atm",
- },
- {
- value: "觀景台售票處",
- text: "observatory_ticket_office",
- },
- {
- value: "廁所",
- text: "restroom",
- },
- {
- value: "置物櫃",
- text: "items_and_luggage_storage",
- },
- {
- value: "飲水機",
- text: "ice_warmed_water_dispenser",
- },
- {
- value: "無障礙廁所",
- text: "accessible_facilities",
- },
- {
- value: "哺乳室",
- text: "nursing_room",
- },
- {
- value: "客服(停車折抵)",
- text: "service_counter_parking_discount",
- },
- {
- value: "退稅/外幣兌換櫃台",
- text: "tax_refund_currency_exchange",
- },
- {
- value: "計程車乘車處",
- text: "taxi_station",
- },
- {
- value: "美食街",
- text: "food_court",
- },
- {
- value: "超市",
- text: "supermarket",
- },
- {
- value: "捷運",
- text: "metro_station",
- },
- {
- value: "伴手禮區",
- text: "snackable_souvenirs",
- },
- ],
- // navigation: [
- // "景觀餐廳櫃台",
- // "ATM",
- // "觀景台售票處",
- // "廁所",
- // "置物櫃",
- // "飲水機",
- // "無障礙廁所",
- // "哺乳室",
- // "客服(停車折抵)",
- // "退稅/外幣兌換櫃台",
- // "計程車乘車處",
- // "美食街",
- // "超市",
- // "捷運",
- // "伴手禮區",
- // ],
- },
- {
- location: "2F 3號電梯", // 編號 8
- navigation: [
- {
- value: "景觀餐廳櫃台",
- text: "high_rise_restaurant_reception",
- },
- {
- value: "ATM",
- text: "atm",
- },
- {
- value: "觀景台售票處",
- text: "observatory_ticket_office",
- },
- {
- value: "廁所",
- text: "restroom",
- },
- {
- value: "置物櫃",
- text: "items_and_luggage_storage",
- },
- {
- value: "飲水機",
- text: "ice_warmed_water_dispenser",
- },
- {
- value: "無障礙廁所",
- text: "accessible_facilities",
- },
- {
- value: "哺乳室",
- text: "nursing_room",
- },
- {
- value: "計程車乘車處",
- text: "taxi_station",
- },
- {
- value: "退稅/外幣兌換櫃台",
- text: "tax_refund_currency_exchange",
- },
- {
- value: "客服(停車折抵)",
- text: "service_counter_parking_discount",
- },
- ],
- // navigation: [
- // "景觀餐廳櫃台",
- // "ATM",
- // "觀景台售票處",
- // "廁所",
- // "置物櫃",
- // "飲水機",
- // "無障礙廁所",
- // "哺乳室",
- // "計程車乘車處",
- // "退稅/外幣兌換櫃台",
- // "客服(停車折抵)",
- // ],
- },
- {
- location: "89F 觀景台", // 編號 9
- navigation: [
- {
- value: "景觀餐廳櫃台",
- text: "high_rise_restaurant_reception",
- },
- {
- value: "ATM",
- text: "atm",
- },
- {
- value: "客服",
- text: "service_counter",
- },
- {
- value: "91F戶外區",
- text: "91f_outdoor_area",
- },
- {
- value: "廁所",
- text: "restroom",
- },
- {
- value: "101F排隊處",
- text: "101f_queue_area",
- },
- ],
- // navigation: [
- // "景觀餐廳櫃台",
- // "ATM",
- // "客服",
- // "91F戶外區",
- // "廁所",
- // "101F排隊處",
- // ],
- },
- {
- location: "88F 觀景台", // 編號 10
- navigation: [
- {
- value: "景觀餐廳櫃台",
- text: "high_rise_restaurant_reception",
- },
- {
- value: "ATM",
- text: "atm",
- },
- {
- value: "廁所",
- text: "restroom",
- },
- {
- value: "飲水機",
- text: "ice_warmed_water_dispenser",
- },
- {
- value: "哺乳室",
- text: "nursing_room",
- },
- ],
- // navigation: ["景觀餐廳櫃台", "ATM", "廁所", "飲水機", "哺乳室"],
- },
- ]);
- // 平面圖
- let mapList = reactive([
- {
- title: "B1 平面圖",
- },
- {
- title: "1F 平面圖",
- },
- {
- title: "2F 平面圖",
- },
- ]);
- let assignLocation = ref("當前位置"); // 指定定位點
- let assignNavigationList = ref(null); // 指定導覽點列表
- // let assignLocationFloor = ref(null); // 指定定位點樓層
- // let assignNavigation = ref(null); // 指定導覽點
- // let navigationBtn = reactive(["B1", "1F", "2F", "4F", "5F", "89F", "91F"]);
- let arVideo = ref(null);
- let arVideoDialog = ref(false);
- // 取得 AR 導覽影片
- async function getArviews(route, text, type = "") {
- let url;
- let lang = getLang();
- console.log("text >>>", text);
- if (type === "garden") {
- console.log("route", route);
- let start;
- // if (route === "B1 鼎泰豐旁 數位屏幕") {
- // start = "B1 鼎泰豐";
- // } else if (route === "B1 松智藍梯梯廳") {
- // start = "B1 3號電梯";
- // }
- switch (route) {
- case "B1 鼎泰豐旁 數位屏幕":
- start = "B1 鼎泰豐";
- break;
- case "B1 中環WOW屏幕":
- start = "B1 中環";
- break;
- case "B1 信義橘梯梯廳":
- start = "B1 2號電梯";
- break;
- case "B1 信義綠梯梯廳":
- start = "B1 4號電梯";
- break;
- case "B1 松智藍梯梯廳":
- start = "B1 3號電梯";
- break;
- case "1F 信義綠梯出入口":
- start = "1F 信義環";
- break;
- case "1F 松智梯廳":
- start = "1F 3號電梯";
- break;
- case "2F 松智藍梯梯廳":
- start = "2F 3號電梯";
- break;
- default:
- break;
- }
- url = `https://cmm.ai:9101/arviews?language=${lang}&start=${start}&end=觀景台售票處`;
- } else {
- url = `https://cmm.ai:9101/arviews?language=${lang}&start=${assignLocation.value}&end=${route}`;
- }
- console.log("url", url);
- messages.value.push({
- label: "text",
- author: "ai",
- body: text,
- });
- try {
- const response = await axios.get(url);
- console.log("AR 導覽影片", response);
- messages.value.push({
- label: "ar_views",
- author: "ai",
- body: response.data,
- });
- } catch (error) {
- console.log("error", error);
- }
- }
- // 取得定位點 & 導覽點
- function changeLocation(item) {
- assignLocation.value = item;
- console.log("定位點:", item);
- let assign = locationList.filter((e) => e.location === item);
- console.log("assign", assign);
- assignNavigationList.value = assign[0].navigation;
- // assignLocation.value = item.location;
- // assignNavigationList.value = item.navigation;
- console.log("assignNavigationList.value", assignNavigationList.value);
- messages.value.push({
- label: "text",
- author: "ai",
- body: t("select_navigation_location"),
- });
- messages.value.push({
- label: "navigation",
- author: "ai",
- body: assignNavigationList.value,
- });
- }
- // 顯示平面圖
- function assignMapImg(item) {
- console.log("顯示平面圖 item", item);
- let name;
- if (item.title === "B1 平面圖") {
- name = "All_b1";
- } else if (item.title === "1F 平面圖") {
- name = "All_1";
- } else if (item.title === "2F 平面圖") {
- name = "All_2";
- }
- messages.value.push({
- label: "map_img",
- author: "ai",
- body: name,
- });
- }
- // 動態引入視頻文件
- const videoSources = ref([]); // 開場白影片(中)
- const videoSourcesEn = ref([]); // 開場白影片(英)
- const videoMuteSources = ref([]); // 點頭影片(靜音)
- const videoSpeakSources = ref([]); // 動嘴型影片
- const loadVideoSources = async () => {
- // 本地端影片路徑
- // const start1 = await import("@/assets/video/start_1.mp4");
- // const start2 = await import("@/assets/video/start_2.mp4");
- // const mute_1 = await import("@/assets/video/mute_1.mp4");
- // const mute_2 = await import("@/assets/video/mute_2.mp4");
- // const speak_1 = await import("@/assets/video/speak_1.mp4");
- // const speak_2 = await import("@/assets/video/speak_2.mp4");
- // videoSpeakSources.value = [speak_1.default, speak_2.default];
- videoSources.value = [
- "https://cmm.ai/101-ai-chatbot-new/video/start_1.mp4",
- "https://cmm.ai/101-ai-chatbot-new/video/start_2.mp4",
- ];
- videoSourcesEn.value = [
- "https://cmm.ai/101-ai-chatbot-new/video/start_en_1.mp4",
- "https://cmm.ai/101-ai-chatbot-new/video/start_en_2.mp4",
- ];
- videoMuteSources.value = [
- "https://cmm.ai/101-ai-chatbot-new/video/mute_1.mp4",
- "https://cmm.ai/101-ai-chatbot-new/video/mute_2.mp4",
- ];
- videoSpeakSources.value = [
- "https://cmm.ai/101-ai-chatbot-new/video/speak_1.mp4",
- "https://cmm.ai/101-ai-chatbot-new/video/speak_2.mp4",
- ];
- };
- let videoSrc = ref("");
- let hideAnchorPrologue = ref(false); // 顯示開場白 or 點頭影片
- let videoIndex = ref(null); // 影片編號
- // 選擇類別
- async function selectCategory(value, index) {
- assignCategory.value = value;
- assignCategoryIndex.value = index;
- console.log("selectCategory index", assignCategoryIndex.value);
- console.log("selectCategory value", assignCategory.value);
- if (value === "叫出真人客服") {
- showAnchor.value = true;
- if (currentAudio.value && isAudioPlaying.value) {
- // currentAudio.value.addEventListener("ended", onAudioEnded); // 監聽音訊播放結束
- // setTimeout(() => {
- // video.value.play();
- // }, 0);
- // return;
- handleVoice("pause"); // 暫停音訊
- }
- // 隨機取得影片路徑
- await loadVideoSources();
- // 主播開場白只顯示一次
- if (!hideAnchorPrologue.value) {
- let lang = getLang();
- let sources;
- if (lang === "ch") {
- sources = videoSources.value;
- } else if (lang === "en") {
- sources = videoSourcesEn.value;
- }
- const randomIndex = Math.floor(Math.random() * sources.length);
- videoSrc.value = sources[randomIndex];
- hideAnchorPrologue.value = true;
- videoIndex.value = randomIndex + 1;
- // const randomIndex = Math.floor(Math.random() * videoSources.value.length);
- // videoSrc.value = videoSources.value[randomIndex];
- // hideAnchorPrologue.value = true;
- // videoIndex.value = randomIndex + 1;
- } else {
- const randomIndex = Math.floor(
- Math.random() * videoMuteSources.value.length
- );
- videoSrc.value = videoMuteSources.value[randomIndex];
- videoIndex.value = randomIndex + 1;
- }
- // 播放影片
- setTimeout(() => {
- videoPlay();
- }, 0);
- // const randomIndex = Math.floor(Math.random() * videoSources.value.length);
- // videoSrc.value = videoSources.value[randomIndex];
- }
- // else if (value === "隱藏真人客服") {
- // showAnchor.value = false;
- // video.value.pause();
- // menuList[0][0].text = "customer_show";
- // menuList[0][0].value = "叫出真人客服";
- // }
- else if (value === "秘境花園觀景台") {
- messages.value.push({
- label: "text",
- author: "ai",
- body: t("observatory_info.tickets.purchase"),
- });
- messages.value.push({
- label: "observation_deck",
- author: "ai",
- body: observationList,
- });
- } else if (value === "位置導引") {
- messages.value.push({
- label: "text",
- author: "ai",
- body: t("qr_code_scan_prompt"),
- });
- // messages.value.push({
- // label: "map_img",
- // author: "ai",
- // body: mapList,
- // });
- messages.value.push({
- label: "location",
- author: "ai",
- body: locationList,
- });
- } else if (value === "美食/伴手禮") {
- getAd("美食伴手禮");
- messages.value.push({
- label: "text",
- author: "ai",
- body: t("food_souvenirs_info.searching"),
- });
- messages.value.push({
- label: "dining",
- author: "ai",
- body: diningList,
- });
- } else if (value === "購物及優惠") {
- getAd("購物及優惠");
- messages.value.push({
- label: "shopping",
- author: "ai",
- body: shoppingList,
- });
- } else if (value === "服務資訊") {
- messages.value.push({
- label: "text",
- author: "ai",
- body: t("service_info.inquiry_prompt"),
- });
- messages.value.push({
- label: "service",
- author: "ai",
- body: serviceList,
- });
- }
- }
- let secondaryAd = ref({}); // 隨機廣告
- let secondaryAdShow = ref(false);
- // 取得隨機廣告 (美食伴手禮/購物及優惠)
- async function getAd(type) {
- let lang = getLang();
- let url = `https://cmm.ai:9101/ad/${type}?language=${lang}`;
- try {
- const response = await axios.get(url);
- console.log("response", response);
- secondaryAd.value = response.data.data;
- // secondaryAdShow.value = true; // 取消蓋版廣告
- messages.value.push({
- label: "brand",
- author: "ai",
- body: [
- {
- info: response.data.data,
- },
- ],
- });
- } catch (error) {
- console.log("error", error);
- }
- }
- // 服務資訊回覆
- function handleService(title, depiction) {
- messages.value.push({
- label: "text",
- author: "user",
- body: title,
- });
- if (title !== "AI 天燈") {
- messages.value.push({
- label: "text",
- author: "ai",
- body: depiction,
- });
- } else {
- window.location.href = depiction;
- // window.open(depiction, "_blank"); // 另開天燈頁面
- }
- }
- // 參觀資訊回覆
- function handleVisit(title, depiction) {
- messages.value.push({
- label: "text",
- author: "user",
- body: title,
- });
- messages.value.push({
- label: "text",
- author: "ai",
- body: depiction,
- });
- }
- // 計算使用次數
- async function handleClick() {
- let url = "https://cmm.ai:9101/click";
- try {
- const response = await axios.get(url);
- console.log("Click", response);
- } catch (error) {
- console.log("error", error);
- }
- }
- let langList = reactive([
- {
- lang: "中文",
- value: "zh-tw",
- },
- {
- lang: "English",
- value: "en-us",
- },
- // {
- // lang: "日本語",
- // value: "ja-jp",
- // },
- // {
- // lang: "한국어",
- // value: "ko-kr",
- // },
- ]);
- const btnList = reactive([
- {
- title: "observation_deck",
- value: "秘境花園觀景台",
- },
- {
- title: "location_guide",
- value: "位置導引",
- },
- {
- title: "food_souvenirs",
- value: "美食伴手禮",
- },
- {
- title: "shopping_discounts",
- value: "購物及優惠",
- },
- {
- title: "service_information",
- value: "服務資訊",
- },
- ]);
- function getImageUrl(name) {
- return new URL(`../assets/img/icon/${name}`, import.meta.url).href;
- }
- let showAnchor = ref(false); // AI 主播影片
- let videoContent = ref(null); // 主播影片區塊
- // 動態更改主播區塊位置
- // watch(showAnchor, () => {
- // console.log("showAnchor", showAnchor.value);
- // nextTick(() => {
- // changeAnchorTop();
- // });
- // });
- // watch(hideMenu, () => {
- // nextTick(() => {
- // changeAnchorTop();
- // });
- // });
- // function changeAnchorTop() {
- // const menuOffsetTop = menu.value.offsetTop;
- // videoContent.value.style.top = `${menuOffsetTop - 170}px`;
- // }
- const menuList = reactive([
- [
- {
- imgSrc: "素材-05.png",
- text: "customer_show",
- value: "叫出真人客服",
- },
- { imgSrc: "素材-06.png", text: "service_information", value: "服務資訊" },
- { imgSrc: "素材-07.png", text: "shopping_discounts", value: "購物及優惠" },
- ],
- [
- {
- imgSrc: "素材-08.png",
- text: "observation_deck",
- value: "秘境花園觀景台",
- },
- { imgSrc: "素材-09.png", text: "food_souvenirs", value: "美食/伴手禮" },
- { imgSrc: "素材-10.png", text: "location_guide", value: "位置導引" },
- ],
- ]);
- // 美食伴手禮 or 購物及優惠類別篩選
- async function findBrand(value) {
- console.log("findBrand", value);
- if (value === "館外店家") {
- value = "館外";
- }
- let lang = getLang();
- let url = `https://cmm.ai:9101/find_brand?keyword=${value}&language=${lang}`;
- try {
- const response = await axios.get(url);
- console.log("response", response);
- // response.data.data.map(
- // (item) => (item.info.tags = JSON.parse(item.info.tags))
- // );
- messages.value.push({
- label: "brand",
- author: "ai",
- body: response.data.data,
- });
- assignCategoryIndex.value = null;
- assignCategory.value = "";
- // messages.value.push({
- // label: "text",
- // author: "ai",
- // body: "請選擇問題類型:",
- // });
- // messages.value.push({
- // label: "btn-list",
- // author: "ai",
- // body: "",
- // });
- } catch (error) {
- console.log("error", error);
- }
- }
- // 處理電話格式
- // function getPhoneNumber(phoneString) {
- // const parts = phoneString.split("\n");
- // return parts[1];
- // }
- // 取得線上購票
- async function getStaticTickets(type) {
- let url = `https://cmm.ai:9101/static_tickets?is_Chinese=${type}`;
- let info = {
- buttonList: [], // 按鈕
- ticketList: [], // 票券
- };
- try {
- const response = await axios.get(url);
- console.log("線上購票", response.data.result);
- response.data.result.map((item) => info.ticketList.push(item));
- console.log("info", info);
- messages.value.push({
- label: "ticket",
- author: "ai",
- body: info,
- });
- } catch (error) {
- console.log("error", error);
- }
- }
- // 秘境花園觀景台對話
- function handleObservationDialog(value) {
- console.log("value", value);
- if (value === "線上購票") {
- messages.value.push({
- label: "text",
- author: "ai",
- body: t("observatory_info.tickets.id_card"),
- });
- messages.value.push({
- label: "check",
- author: "ai",
- body: [
- {
- value: "是",
- text: "observatory_info.tickets.yes",
- },
- {
- value: "否",
- text: "observatory_info.tickets.no",
- },
- ],
- });
- } else if (value === "是" || value === "否") {
- if (value === "是") {
- getStaticTickets("1");
- } else if (value === "否") {
- getStaticTickets("0");
- }
- messages.value.push({
- label: "text",
- author: "ai",
- body: t("observatory_info.tickets.ticket_type"),
- });
- } else if (value === "參觀資訊") {
- messages.value.push({
- label: "text",
- author: "ai",
- body: t("observatory_info.visitor.question"),
- });
- messages.value.push({
- label: "text",
- author: "ai",
- body: t("observatory_info.visitor.faq"),
- });
- messages.value.push({
- label: "visit",
- author: "ai",
- body: visitList,
- });
- } else if (value === "實境景色") {
- // window.location.href = "https://www.youtube.com/watch?v=RVV00FZbeH0";
- window.open("https://www.youtube.com/watch?v=RVV00FZbeH0", "_blank"); // 另開頁面
- } else if (value === "前往秘境花園觀景台") {
- messages.value.push({
- label: "text",
- author: "ai",
- body: t("select_location"),
- });
- messages.value.push({
- label: "garden_route",
- author: "ai",
- body: [
- "B1 鼎泰豐旁 數位屏幕",
- "B1 中環WOW屏幕",
- "B1 信義橘梯梯廳",
- "B1 信義綠梯梯廳",
- "B1 松智藍梯梯廳",
- "1F 信義綠梯出入口",
- "1F 松智梯廳",
- "2F 松智藍梯梯廳",
- ],
- });
- }
- }
- // 購物及優惠對話
- function handleShoppingDialog(value) {
- console.log("value", value);
- if (value === "購物品牌查詢") {
- messages.value.push({
- label: "text",
- author: "ai",
- body: "請選擇品牌類別",
- });
- messages.value.push({
- label: "shopping_brand",
- author: "ai",
- body: brandList,
- });
- } else if (value === "國際貴賓卡專屬禮遇") {
- messages.value.push({
- label: "text",
- author: "user",
- body: "國際貴賓卡專屬禮遇",
- });
- messages.value.push({
- label: "text",
- author: "ai",
- body: t("shopping_discounts_info.tourist_card.content"),
- });
- } else if (value === "參觀資訊") {
- messages.value.push({
- label: "text",
- author: "ai",
- body: t("observatory_info.visitor.question"),
- });
- messages.value.push({
- label: "text",
- author: "ai",
- body: t("observatory_info.visitor.faq"),
- });
- messages.value.push({
- label: "visit",
- author: "ai",
- body: visitList,
- });
- }
- }
- let visitList = reactive([
- {
- title: "observatory_info.visitor.events_q",
- depiction: "observatory_info.visitor.events_a",
- },
- {
- title: "observatory_info.visitor.ball_q",
- depiction: "observatory_info.visitor.ball_a",
- },
- {
- title: "observatory_info.visitor.accessible_q",
- depiction: "observatory_info.visitor.accessible_a",
- },
- ]);
- // 判斷價格是否包含 $ 符號
- function formatPrice(price) {
- if (price === "") {
- return "";
- } else {
- if (price.includes("$")) {
- return price;
- } else {
- return `$${price}`;
- }
- }
- }
- let currentAudio = ref(null); // 當前音訊
- let audioDuration = ref(null); // 音訊秒數
- // 文字轉語音 (TTS)
- async function handleTTS(message) {
- console.log("handleTTS", message);
- let audioLang; // 音訊語言
- let lang = localStorage.getItem("lang");
- console.log("lang", lang);
- switch (lang) {
- case "zh-tw":
- audioLang = "cmn-TW";
- break;
- case "en-us":
- audioLang = "en-US";
- break;
- case "ja-jp":
- audioLang = "ja-JP";
- break;
- case "ko-kr":
- audioLang = "ko-KR";
- break;
- default:
- break;
- }
- // let url = `https://bf18-61-230-0-215.ngrok-free.app/ttsTry/tts_try?message=${message}&type=101`;
- let url = `https://bf18-61-230-0-215.ngrok-free.app/gcp/text-to-speech?language_code=${audioLang}&gender=female`;
- const formData = new FormData();
- formData.append("text", message);
- try {
- const response = await axios.post(url, formData, { responseType: "blob" });
- console.log("TTS response", response);
- const blob = new Blob([response.data], { type: "audio/mp3" });
- const audioUrl = URL.createObjectURL(blob);
- console.log("audioUrl", audioUrl);
- cutVideo();
- // 取得 mp3 音訊秒數
- // audio.addEventListener("loadedmetadata", function () {
- // audioDuration.value = audio.duration;
- // cutVideo();
- // });
- // 暫停當前音訊
- if (currentAudio.value) {
- currentAudio.value.pause();
- currentAudio.value.currentTime = 0;
- }
- // 播放音檔
- currentAudio.value = new Audio(audioUrl);
- } catch (error) {
- console.log("error", error);
- }
- }
- let videoLoading = ref(false);
- let isAudioPlaying = ref(false); // 音訊播放狀態
- // 取得語音回覆 mp4
- async function cutVideo() {
- videoSrc.value = videoSpeakSources.value[videoIndex.value - 1];
- video.value.load(); // 重新讀取影片
- // let duration = Math.floor(audioDuration.value); // 音訊秒數
- // 影片和音訊加載完成後播放
- video.value.oncanplay = () => {
- setTimeout(() => {
- // 監聽音訊播放結束
- currentAudio.value.addEventListener("ended", onAudioEnded);
- // 監聽音訊播放狀態
- currentAudio.value.addEventListener("play", onAudioPlay);
- currentAudio.value.addEventListener("pause", onAudioPause);
- video.value.play(); // 播放影片
- currentAudio.value.currentTime = 0; // 重置時間
- currentAudio.value.play(); // 播放音訊
- isVideoPause.value = true;
- videoLoading.value = false;
- }, 500);
- };
- // video.value.currentTime = 0;
- // video.value.play(); // 播放影片
- // currentAudio.value.play(); // 播放音訊
- // isVideoPause.value = true;
- // videoLoading.value = false;
- // setTimeout(()=>{
- // video.value.play(); // 播放影片
- // },300)
- // // 監聽音訊播放狀態
- // currentAudio.value.addEventListener("play", onAudioPlay);
- // currentAudio.value.addEventListener("pause", onAudioPause);
- // 監聽音訊播放結束
- // currentAudio.value.addEventListener("ended", onAudioEnded);
- // if (video.value.currentTime >= duration) {
- // video.value.pause();
- // }
- }
- // 音訊結束後暫停影片播放
- const onAudioEnded = () => {
- video.value.pause();
- };
- // 判斷音訊是否為播放狀態
- const onAudioPlay = () => {
- isAudioPlaying.value = true;
- console.log("isAudioPlaying.value", isAudioPlaying.value);
- };
- const onAudioPause = () => {
- isAudioPlaying.value = false;
- console.log("isAudioPlaying.value", isAudioPlaying.value);
- };
- const audioURL = ref(null);
- const audioFile = ref(null); // 音訊檔案
- let recordTime = ref(0); // 錄音時間
- let isRecording = ref(false); // 錄音狀態
- let timer;
- // 語音轉文字
- async function handleAudioToText() {
- isRecording.value = false;
- let audioLang; // 音訊語言
- let lang = localStorage.getItem("lang");
- console.log("lang", lang);
- switch (lang) {
- case "zh-tw":
- audioLang = "cmn-Hant-TW";
- break;
- case "en-us":
- audioLang = "en-US";
- break;
- case "ja-jp":
- audioLang = "ja-JP";
- break;
- case "ko-kr":
- audioLang = "ko-KR";
- break;
- default:
- break;
- }
- // let url = `http://172.104.93.163:9880/whisper/${audioLang}/`;
- // let url = `https://bf18-61-230-0-215.ngrok-free.app/whisper/${audioLang}/`;
- let url = `https://bf18-61-230-0-215.ngrok-free.app/gcp/speech-to-text?language_code=${audioLang}`;
- const formData = new FormData();
- formData.append("file", audioFile.value);
- try {
- console.log("audioFile.value", audioFile.value);
- const response = await axios.post(url, formData);
- console.log("語音轉文字 response", response);
- // showAnchor.value = false; // 關閉主播視窗
- userMessage.value = response.data[0];
- // handleTTS(userMessage.value); // 取得語音回覆
- if (response.data[0] && response.data[0] !== "") {
- sendMessage(); // 傳送使用者訊息
- } else {
- if (showAnchor.value) {
- alert("語音辨識有誤,請重新錄製。");
- videoLoading.value = false;
- return;
- } else {
- messages.value.push({
- label: "text",
- author: "user",
- body: "語音辨識有誤,請重新錄製。",
- });
- }
- }
- } catch (error) {
- console.log("error", error);
- }
- }
- // 語音轉文字 (使用 recorder-core 錄音)
- let rec, wave;
- // 調用 open 請求錄音權限
- let recOpen = function (success) {
- rec = Recorder({
- type: "mp3",
- sampleRate: 16000,
- bitRate: 16,
- onProcess: function (
- buffers,
- powerLevel,
- bufferDuration,
- bufferSampleRate,
- newBufferIdx,
- asyncEnd
- ) {
- wave &&
- wave.input(buffers[buffers.length - 1], powerLevel, bufferSampleRate);
- },
- });
- rec.open(
- function () {
- if (Recorder.WaveView) wave = Recorder.WaveView({ elem: ".recwave" });
- success && success();
- },
- function (msg, isUserNotAllow) {
- // 使用者未授權或不支援
- console.log((isUserNotAllow ? "UserNotAllow," : "") + "無法錄音:" + msg);
- }
- );
- };
- /** 開始錄音 **/
- function recStart() {
- togglePause("pause"); // 暫停影片音訊
- // 需先呼叫 recOpen() 開啟錄音後才能調用 start、stop 方法
- console.log("開始錄音");
- recOpen(function () {
- isRecording.value = true;
- // 開始計時
- timer = setInterval(() => {
- recordTime.value += 1;
- }, 1000);
- rec.start();
- });
- }
- /** 結束錄音 **/
- function recStop() {
- videoLoading.value = true;
- rec.stop(
- function (blob, duration) {
- // 利用 URL 產生本地檔案位址,不用時需要 revokeObjectURL
- let localUrl = (window.URL || webkitURL).createObjectURL(blob); // 該 url 只能本地端使用 (例如給 audio.src 進行播放,或是給 a.href download 進行下載)
- console.log(blob, localUrl, "時長:" + duration + "ms");
- // rec.close(); // 釋放錄音資源 (若不釋放系統或瀏覽器將持續提示在錄音中)
- // rec = null;
- // 將 Blob 轉換為 File 對象
- audioFile.value = new File([blob], "recording.mp3", {
- type: "audio/mp3",
- });
- console.log("audioFile", audioFile.value);
- // 自動播放(測試用)
- // const audio = document.createElement("audio");
- // audio.src = localUrl;
- // audio.autoplay = true;
- // audio
- // .play()
- // .then(() => {
- // console.log("Audio is playing automatically.");
- // })
- // .catch((error) => {
- // console.error("Error playing audio:", error);
- // });
- rec.close(); // 釋放錄音資源 (若不釋放系統或瀏覽器將持續提示在錄音中)
- rec = null;
- if (recordTime.value !== 0) {
- handleAudioToText(); // 語音轉文字
- } else {
- isRecording.value = false;
- }
- clearInterval(timer); // 清空計時秒數
- recordTime.value = 0;
- },
- function (msg) {
- console.log("錄音失敗:" + msg);
- rec.close(); // 可以透過 stop 方法的第 3 個參數來自動呼叫 close
- rec = null;
- }
- );
- }
- // 關閉主播視窗 (結束錄音)
- function closeRec() {
- video.value.pause();
- isVideoPause.value = true;
- recordTime.value = 0;
- clearInterval(timer); // 清空計時秒數
- if (isRecording.value) {
- recStop();
- }
- showAnchor.value = false;
- }
- // watch(showAnchor, (val) => {
- // if (val) {
- // isVideoPause.value = true;
- // }
- // });
- let isVideoPause = ref(true);
- // AI 主播影片播放 & 暫停
- function togglePause(val) {
- if (val === "pause") {
- // video.value.pause();
- isVideoPause.value = false;
- if (video.value) {
- video.value.pause();
- }
- if (currentAudio.value) {
- currentAudio.value.pause(); // 暫停音訊
- }
- } else {
- // video.value.play();
- isVideoPause.value = true;
- if (video.value) {
- video.value.play();
- }
- if (currentAudio.value) {
- currentAudio.value.play(); // 播放音訊
- currentAudio.value.addEventListener("ended", onAudioEnded);
- }
- }
- }
- // 語音暫停
- function handleVoice(state) {
- if (currentAudio.value) {
- if (state === "pause") {
- currentAudio.value.pause();
- isVideoPause.value = false;
- } else {
- currentAudio.value.play();
- isVideoPause.value = true;
- }
- }
- }
- </script>
- <template>
- <Navbar v-if="!isLanguagePage" />
- <div v-if="isLanguagePage" class="lang-content">
- <div class="btn-list">
- <button
- v-for="(item, index) in langList"
- :key="index"
- @click="chooseLang(item.value)"
- class="main-btn"
- >
- {{ item.lang }}
- </button>
- </div>
- </div>
- <div v-else-if="!isLanguagePage && !showAnchor" class="main-containar">
- <!-- <div class="video-content">
- <video
- ref="video"
- preload
- playsinline
- :style="{ opacity: !isTTSVideo ? '1' : '0' }"
- >
- <source src="../assets/video/start_1.mp4" type="video/mp4" />
- Your browser does not support the video tag.
- </video>
- <video
- ref="ttsVideo"
- preload
- playsinline
- :style="{ opacity: isTTSVideo ? '1' : '0' }"
- >
- <source :src="ttsVideoSrc" type="video/mp4" />
- Your browser does not support the video tag.
- </video>
- <button @click="handleVideo(isTTSVideo)" class="control-btn">
- <img v-if="!videoPause" src="../assets/img/pause-button.png" alt="" />
- <img v-else src="../assets/img/play-button.png" alt="" />
- </button>
- </div> -->
- <!-- <Navbar /> -->
- <div v-if="chatLoading" class="d-flex justify-center pt-5">
- <v-progress-circular color="primary" indeterminate></v-progress-circular>
- </div>
- <div
- v-else
- class="chat-content"
- :class="{ 'hide-menu': hideMenu }"
- :style="{ paddingBottom: !hideMenu ? menuHeight + 'px' : '50px' }"
- >
- <!-- <div class="headline">
- <h1>{{ t("title") }}</h1>
- <button @click="isRotate = !isRotate">
- <img
- :class="{ rotate: isRotate }"
- src="../assets/img/angles-up-solid.svg"
- alt=""
- />
- </button>
- </div> -->
- <!-- 購票介面 -->
- <TicketPurchase />
- <router-link
- to="/brand-search"
- style="color: #fff; text-decoration: none"
- class="ps-3"
- >館外品牌測試頁面</router-link
- >
- <!-- 語音暫停按鈕 -->
- <div v-if="currentAudio" class="voice-btn">
- <button v-if="isAudioPlaying" @click="togglePause('pause')">
- <img src="../assets/img/pause-button.png" alt="" />
- <p>語音</p>
- </button>
- <button v-else @click="togglePause('play')">
- <img src="../assets/img/play-button.png" alt="" />
- <p>語音</p>
- </button>
- </div>
- <section
- ref="chatArea"
- class="chat-area"
- :class="{ 'hide-menu': hideMenu }"
- >
- <div v-for="message in messages" class="message-content">
- <p
- v-if="message.label === 'text'"
- class="message animate__animated"
- :class="{
- 'message-out': message.author === 'user',
- 'message-in': message.author !== 'user',
- animate__fadeInRight: message.author === 'user',
- animate__fadeInLeft: message.author !== 'user',
- }"
- v-html="message.body"
- ></p>
- <!-- 問題類別 -->
- <!-- <div v-else-if="message.label === 'btn-list'">
- <ul class="btn-list">
- <li v-for="(btn, index) in btnList">
- <button
- :class="{ active: index === assignCategoryIndex }"
- @click="selectCategory(btn.value, index)"
- >
- {{ t(`${btn.title}`) }}
- </button>
- </li>
- </ul>
- </div> -->
- <!-- 秘境花園觀景台 -->
- <div v-else-if="message.label === 'observation_deck'">
- <swiper
- :slidesPerView="'auto'"
- :spaceBetween="20"
- :modules="modules"
- class="btn-swiper"
- >
- <swiper-slide v-for="item in message.body">
- <div class="btn-container">
- <button @click="handleObservationDialog(item.value)">
- {{ t(item.text) }}
- </button>
- </div>
- </swiper-slide>
- </swiper>
- </div>
- <!-- 確認按鈕 -->
- <div v-else-if="message.label === 'check'">
- <swiper
- :slidesPerView="'auto'"
- :spaceBetween="20"
- :modules="modules"
- class="btn-swiper"
- >
- <swiper-slide v-for="item in message.body">
- <div class="btn-container">
- <button @click="handleObservationDialog(item.value)">
- {{ t(item.text) }}
- </button>
- </div>
- </swiper-slide>
- </swiper>
- </div>
- <!-- 參觀資訊 -->
- <div v-else-if="message.label === 'visit'">
- <swiper
- :slidesPerView="'auto'"
- :spaceBetween="20"
- :modules="modules"
- class="btn-swiper"
- >
- <swiper-slide v-for="item in message.body">
- <div class="btn-container">
- <button
- @click="handleVisit(t(item.title), t(item.depiction))"
- >
- {{ t(item.title) }}
- </button>
- </div>
- </swiper-slide>
- </swiper>
- </div>
- <!-- 位置導引 (定位點) -->
- <div v-else-if="message.label === 'location'">
- <!-- <v-select
- @update:modelValue="changeLocation"
- v-model="assignLocation"
- label="當前位置"
- :items="locationList"
- item-title="location"
- item-value="location"
- variant="outlined"
- density="comfortable"
- hide-details
- color="primary"
- class="mt-5 me-15"
- :menu-props="{ maxHeight: '155px' }"
- ></v-select> -->
- <!-- 掃描 QR Code -->
- <v-btn @click="qrCodeDialog = true" color="primary" class="mt-5">
- {{ t("tap_to_start_scan") }}
- </v-btn>
- <v-dialog v-model="qrCodeDialog" width="auto">
- <v-card max-width="400">
- <v-card-text>
- <div v-if="qrCodeLoading" class="d-flex justify-center pt-5">
- <v-progress-circular
- color="primary"
- indeterminate
- ></v-progress-circular>
- </div>
- <qrcode-stream
- v-show="!qrCodeLoading"
- @detect="onDetect"
- @camera-on="onInit"
- ></qrcode-stream>
- </v-card-text>
- <template v-slot:actions>
- <v-btn
- class="ms-auto"
- text="關閉"
- @click="qrCodeDialog = false"
- ></v-btn>
- </template>
- </v-card>
- </v-dialog>
- <!-- <div class="d-flex">
- <v-menu location="top">
- <template v-slot:activator="{ props }">
- <v-btn class="mt-5 py-2" color="primary" dark v-bind="props">
- <p class="me-2">{{ assignLocation }}</p>
- <svg
- xmlns="http://www.w3.org/2000/svg"
- width="18"
- height="18"
- fill="currentColor"
- class="bi bi-caret-down-fill pt-1"
- viewBox="0 0 16 16"
- >
- <path
- 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"
- />
- </svg>
- </v-btn>
- </template>
- <v-list style="max-height: 155px; overflow-y: auto">
- <v-list-item
- v-for="(item, index) in locationList"
- :key="index"
- >
- <v-list-item-title @click="changeLocation(item)">
- {{ index + 1 }}. {{ item.location }}
- </v-list-item-title>
- </v-list-item>
- </v-list>
- </v-menu>
- <v-menu location="top">
- <template v-slot:activator="{ props }">
- <v-btn
- class="ms-5 mt-5 py-2"
- color="primary"
- dark
- v-bind="props"
- >
- <p class="me-2">查看平面圖</p>
- <svg
- xmlns="http://www.w3.org/2000/svg"
- width="18"
- height="18"
- fill="currentColor"
- class="bi bi-caret-down-fill pt-1"
- viewBox="0 0 16 16"
- >
- <path
- 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"
- />
- </svg>
- </v-btn>
- </template>
- <v-list style="max-height: 155px; overflow-y: auto">
- <v-list-item v-for="(item, index) in mapList" :key="index">
- <v-list-item-title @click="assignMapImg(item)">
- {{ item.title }}
- </v-list-item-title>
- </v-list-item>
- </v-list>
- </v-menu>
- </div> -->
- </div>
- <!-- 定位點平面圖 -->
- <!-- <div v-else-if="message.label === 'map_img'" class="mt-5">
- <img
- class="map-img"
- :class="{ 'show-anchor': showAnchor }"
- :src="`../src/assets/img/map/${message.body}.webp`"
- alt=""
- />
- </div> -->
- <!-- 位置導引 (導覽點) -->
- <div v-else-if="message.label === 'navigation'">
- <!-- <v-select
- @update:modelValue="changeLocation"
- v-model="assignNavigation"
- label="導覽位置"
- :items="assignNavigationList"
- variant="solo"
- hide-details
- class="bg-white mt-4"
- ></v-select> -->
- <swiper
- :slidesPerView="'auto'"
- :spaceBetween="20"
- :modules="modules"
- class="btn-swiper"
- >
- <swiper-slide v-for="item in message.body">
- <div class="btn-container">
- <button
- @click="
- getArviews(item.value, t(`navigation.${item.text}`))
- "
- >
- {{ t(`navigation.${item.text}`) }}
- </button>
- </div>
- </swiper-slide>
- </swiper>
- </div>
- <!-- 秘境花園觀景台 -->
- <div v-else-if="message.label === 'garden_route'">
- <!-- <v-select
- @update:modelValue="changeLocation"
- v-model="assignNavigation"
- label="導覽位置"
- :items="assignNavigationList"
- variant="solo"
- hide-details
- class="bg-white mt-4"
- ></v-select> -->
- <swiper
- :slidesPerView="'auto'"
- :spaceBetween="20"
- :modules="modules"
- class="btn-swiper"
- >
- <swiper-slide v-for="item in message.body">
- <div class="btn-container">
- <button @click="getArviews(item, item, 'garden')">
- {{ item }}
- </button>
- </div>
- </swiper-slide>
- </swiper>
- </div>
- <!-- AR 導覽影片 -->
- <div v-else-if="message.label === 'ar_views'">
- <div
- class="message animate__animated"
- :class="{
- 'message-out': message.author === 'user',
- 'message-in': message.author !== 'user',
- animate__fadeInRight: message.author === 'user',
- animate__fadeInLeft: message.author !== 'user',
- }"
- >
- <p v-html="message.body.words"></p>
- <button @click="arVideoDialog = true" class="ar-link my-3">
- 進行 AR 導覽
- </button>
- <v-dialog v-model="arVideoDialog" width="auto">
- <v-card class="ar-card">
- <v-card-title class="mt-3"> AR 導覽 </v-card-title>
- <v-card-text class="pa-0">
- <a-scene>
- <a-assets>
- <video
- id="vr-video"
- ref="arVideo"
- :src="message.body.url"
- autoplay
- crossorigin="anonymous"
- ecrossorigin="anonymous"
- ></video>
- </a-assets>
- <a-sky src="#vr-video"></a-sky>
- </a-scene>
- </v-card-text>
- <template v-slot:actions>
- <v-btn
- class="ms-auto"
- text="關閉"
- @click="arVideoDialog = false"
- ></v-btn>
- </template>
- </v-card>
- </v-dialog>
- </div>
- </div>
- <!-- 美食伴手禮 -->
- <div v-else-if="message.label === 'dining'">
- <!-- <ul class="btn-options">
- <li v-for="item in message.body">
- <button @click="findBrand(item.value)">
- {{ t(item.text) }}
- </button>
- </li>
- </ul> -->
- <swiper
- :slidesPerView="'auto'"
- :spaceBetween="20"
- :modules="modules"
- class="btn-swiper"
- >
- <swiper-slide v-for="item in message.body">
- <div class="btn-container">
- <button @click="findBrand(item.value)">
- {{ t(item.text) }}
- </button>
- </div>
- </swiper-slide>
- </swiper>
- </div>
- <!-- 購物及優惠 -->
- <div v-else-if="message.label === 'shopping'">
- <!-- <ul class="btn-options">
- <li v-for="item in message.body">
- <button @click="handleShoppingDialog(item.value)">
- {{ t(item.text) }}
- </button>
- </li>
- </ul> -->
- <swiper
- :slidesPerView="'auto'"
- :spaceBetween="20"
- :modules="modules"
- class="btn-swiper"
- >
- <swiper-slide v-for="item in message.body">
- <div class="btn-container">
- <button @click="handleShoppingDialog(item.value)">
- {{ t(item.text) }}
- </button>
- </div>
- </swiper-slide>
- </swiper>
- </div>
- <!-- 購物品牌查詢 -->
- <div v-else-if="message.label === 'shopping_brand'">
- <!-- <ul class="btn-options">
- <li v-for="item in message.body">
- <button @click="findBrand(item.value)">
- {{ item.value }}
- </button>
- </li>
- </ul> -->
- <swiper
- :slidesPerView="'auto'"
- :spaceBetween="20"
- :modules="modules"
- class="btn-swiper"
- >
- <swiper-slide v-for="item in message.body">
- <div class="btn-container">
- <button @click="findBrand(item.value)">
- {{ t(item.text) }}
- </button>
- </div>
- </swiper-slide>
- </swiper>
- </div>
- <!-- 服務資訊 (常見問題) -->
- <div v-else-if="message.label === 'service'">
- <swiper
- :slidesPerView="'auto'"
- :spaceBetween="20"
- :modules="modules"
- class="btn-swiper"
- >
- <swiper-slide v-for="item in message.body">
- <div class="btn-container">
- <button
- @click="handleService(t(item.title), t(item.depiction))"
- >
- {{ t(item.title) }}
- </button>
- </div>
- </swiper-slide>
- </swiper>
- </div>
- <!-- 推薦資訊 -->
- <div v-else-if="message.label === 'ticket'" class="ticket-item">
- <!-- 按鈕 -->
- <swiper
- v-if="message.body.buttonList.length"
- :slidesPerView="'auto'"
- :spaceBetween="20"
- :modules="modules"
- class="btn-swiper"
- :style="{
- marginBottom: message.body.ticketList.length ? '35px' : '0px',
- }"
- >
- <swiper-slide v-for="item in message.body.buttonList">
- <div class="btn-container">
- <button @click="setBtnValue(item.info.value)">
- {{ item.info.key }}
- </button>
- </div>
- </swiper-slide>
- </swiper>
- <!-- 票券 -->
- <swiper
- v-if="message.body.ticketList.length"
- :slidesPerView="1"
- :navigation="true"
- :modules="modules"
- class="ticket-slide"
- >
- <swiper-slide v-for="item in message.body.ticketList">
- <div class="slide-item">
- <img
- class="cover-img"
- :src="item.info.img || item.info.cover_img"
- alt=""
- />
- <section>
- <h3 class="title">
- {{ item.info.name || item.info.title }}
- </h3>
- <div class="price-info">
- <span>{{ item.info.floor || item.info.price }}</span>
- <div class="link-btn">
- <a
- :href="item.info.website_url || item.info.url"
- target="_blank"
- >
- {{ t("ctaGoUrl") }}
- </a>
- </div>
- </div>
- <p class="description">
- {{ item.info.content || item.info.description }}
- </p>
- </section>
- </div>
- </swiper-slide>
- </swiper>
- </div>
- <!-- 品牌資訊 -->
- <div v-else-if="message.label === 'brand'" class="ticket-item">
- <!-- 按鈕 -->
- <swiper
- v-if="message.body.buttonList?.length"
- :slidesPerView="'auto'"
- :spaceBetween="20"
- :modules="modules"
- class="btn-swiper"
- :style="{
- marginBottom: message.body.ticketList.length ? '35px' : '0px',
- }"
- >
- <swiper-slide v-for="item in message.body.buttonList">
- <div class="btn-container">
- <button @click="setBtnValue(item.info.value)">
- {{ item.info.key }}
- </button>
- </div>
- </swiper-slide>
- </swiper>
- <!-- 票券 -->
- <swiper
- v-if="message.body.ticketList?.length"
- :slidesPerView="1"
- :navigation="true"
- :modules="modules"
- class="ticket-slide"
- >
- <swiper-slide v-for="item in message.body.ticketList">
- <div class="slide-item">
- <img
- class="cover-img aa"
- :src="item.info.img || item.info.cover_img"
- alt=""
- />
- <section>
- <h3 class="title">
- {{ item.info.name || item.info.title }}
- </h3>
- <div class="price-info">
- <span>{{ item.info.floor || item.info.price }}</span>
- <div class="link-btn">
- <a :href="item.info.url" target="_blank">
- {{ t("ctaGoUrl") }}
- </a>
- </div>
- </div>
- <p class="description">
- {{ item.info.content || item.info.description }}
- </p>
- </section>
- </div>
- </swiper-slide>
- </swiper>
- <!-- 美食/伴手禮 -->
- <swiper
- v-if="message.body.length"
- :slidesPerView="1"
- :navigation="true"
- :modules="modules"
- class="ticket-slide"
- >
- <swiper-slide v-for="item in message.body">
- <div class="slide-item">
- <img
- class="cover-img"
- :src="item.info.img || item.info.cover_img"
- alt=""
- />
- <section>
- <h3 class="title">
- {{ item.info.name || item.info.title }}
- </h3>
- <div
- v-if="item.info.phone !== ''"
- class="d-flex align-center mt-3 mb-5"
- >
- <img
- src="../assets/img/phone-solid.svg"
- width="15"
- alt=""
- />
- <p class="ms-2">
- {{ item.info.phone }}
- </p>
- </div>
- <div class="price-info">
- <span>{{ item.info.floor || item.info.price }}</span>
- <div class="link-btn">
- <a :href="item.info.url" target="_blank">
- {{ t("ctaGoUrl") }}
- </a>
- </div>
- </div>
- <p class="description">
- {{ item.info.content || item.info.description }}
- </p>
- </section>
- </div>
- </swiper-slide>
- </swiper>
- <!-- <swiper
- v-if="message.body.length"
- :slidesPerView="'auto'"
- :spaceBetween="20"
- :modules="modules"
- >
- <swiper-slide v-for="item in message.body">
- <img
- class="cover-img"
- :src="item.info.img || item.info.cover_img"
- alt=""
- />
- <section>
- <h3 class="title">{{ item.info.name || item.info.title }}</h3>
- <div
- v-if="item.info.phone !== ''"
- class="d-flex align-center mt-3 mb-5"
- >
- <img
- src="../assets/img/phone-solid.svg"
- width="15"
- alt=""
- />
- <p class="ms-2">
- {{ getPhoneNumber(item.info.phone) }}
- </p>
- </div>
- <div class="price-info">
- <span>{{ item.info.floor || item.info.price }}</span>
- <div class="link-btn">
- <a :href="item.info.url" target="_blank">
- {{ t("ctaGoUrl") }}
- </a>
- </div>
- </div>
- <p class="description">
- {{ item.info.content || item.info.description }}
- </p>
- </section>
- </swiper-slide>
- </swiper> -->
- </div>
- <!-- 推薦資訊 -->
- <div v-else-if="message.label === 'recommend'" class="recommend-item">
- <img class="cover-img" :src="message.body.cover_img" alt="" />
- <section>
- <h3 class="title">{{ message.body.title }}</h3>
- <p class="description">{{ message.body.description }}</p>
- <div class="link-btn">
- <a
- :href="message.body.store_info_url || message.body.url"
- target="_blank"
- >
- {{ t("ctaBuyNow") }}
- </a>
- <a :href="message.body.website_url" target="_blank"> 官網 </a>
- </div>
- <p class="date">{{ message.body.date }} 限時搶購</p>
- </section>
- </div>
- <!-- 店家資訊 -->
- <div v-else-if="message.label === 'store'" class="store-item">
- <p class="headline">店家資訊</p>
- <div class="cover-img">
- <img :src="message.body.cover_img" alt="" />
- <h3 class="title">{{ message.body.title }}</h3>
- </div>
- <section>
- <div class="info">
- <p>
- <img
- src="../assets/img/location-dot-solid.svg"
- width="15"
- alt=""
- />
- {{ message.body.location }}
- </p>
- <p>
- <img src="../assets/img/phone-solid.svg" width="15" alt="" />
- {{ message.body.contact }}
- </p>
- </div>
- <p class="description">{{ message.body.description }}</p>
- </section>
- </div>
- <!-- 套票資訊 -->
- <div v-else-if="message.label === 'ticket'" class="ticket-item">
- <img class="cover-img" :src="message.body.cover_img" alt="" />
- <section>
- <h3 class="title">{{ message.body.title }}</h3>
- <div class="link-btn">
- <a :href="message.body.store_info_url" target="_blank">
- 線上預約
- </a>
- </div>
- <p class="description">{{ message.body.description }}</p>
- <span class="price-item">{{ message.body.price }}</span>
- </section>
- </div>
- </div>
- <!-- 對話輸入框 -->
- <!-- <form
- @submit.prevent="sendMessage('out')"
- class="chat-inputs"
- :class="{ 'd-none': !hideMenu }"
- >
- <button @click="hideMenu = false" class="menu-btn">
- <img src="../assets/img/icon/素材-02.png" alt="" width="50" />
- </button>
- <input
- v-model="userMessage"
- type="text"
- placeholder="Type a message..."
- />
- <button type="submit" class="submit">
- <img width="20" src="../assets/img/paper-plane-solid.svg" alt="" />
- </button>
- </form> -->
- </section>
- <!-- 廣告輪播 -->
- <!-- <div class="slider-content">
- <swiper
- :slidesPerView="1"
- :autoplay="{
- delay: 5000,
- disableOnInteraction: false,
- }"
- :modules="modules"
- >
- <swiper-slide>
- <img src="../assets/img/banner-1.jpg" alt="" />
- </swiper-slide>
- <swiper-slide>
- <img src="../assets/img/banner-2.jpg" alt="" />
- </swiper-slide>
- </swiper>
- </div> -->
- <!-- AI 主播影片 -->
- <!-- <div
- ref="videoContent"
- v-show="showAnchor"
- class="video-content"
- :class="{ 'video-down': hideMenu }"
- >
- <div v-show="!isTTSVideo">
- <video ref="video" preload playsinline>
- <source src="../assets/video/start_1.mp4" type="video/mp4" />
- Your browser does not support the video tag.
- </video>
- </div>
- <div v-show="isTTSVideo">
- <video ref="ttsVideo" preload playsinline>
- <source :src="ttsVideoSrc" type="video/mp4" />
- Your browser does not support the video tag.
- </video>
- </div>
- </div> -->
- </div>
- <!-- 底部選單 -->
- <div ref="menu" class="menu">
- <!-- AI 主播影片 -->
- <!-- <div
- v-show="showAnchor"
- class="video-content"
- :class="{ 'video-down': hideMenu }"
- >
- <div v-show="!isTTSVideo">
- <video ref="video" preload playsinline>
- <source src="../assets/video/start_1.mp4" type="video/mp4" />
- Your browser does not support the video tag.
- </video>
- </div>
- <div v-show="isTTSVideo">
- <video ref="ttsVideo" preload playsinline>
- <source
- :src="`https://bf18-61-230-0-215.ngrok-free.app/${ttsVideoSrc}`"
- type="video/mp4"
- />
- Your browser does not support the video tag.
- </video>
- </div>
- </div> -->
- <div class="menu-table" :class="{ 'hide-table': hideMenu }">
- <table class="mt-3">
- <tbody>
- <tr v-for="(row, rowIndex) in menuList" :key="rowIndex">
- <td v-for="(item, itemIndex) in row" :key="itemIndex">
- <button @click="selectCategory(item.value, itemIndex)">
- <img :src="getImageUrl(item.imgSrc)" alt="" class="icon" />
- <p>{{ t(`${item.text}`) }}</p>
- </button>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- <table class="mt-3">
- <tbody>
- <tr v-for="(row, rowIndex) in menuList" :key="rowIndex">
- <td v-for="(item, itemIndex) in row" :key="itemIndex">
- <button @click="selectCategory(item.value, itemIndex)">
- <img :src="getImageUrl(item.imgSrc)" alt="" class="icon" />
- <p>{{ t(`${item.text}`) }}</p>
- </button>
- </td>
- </tr>
- </tbody>
- </table> -->
- <div class="d-flex align-center position-relative">
- <div class="position-absolute">
- <button
- v-if="!showInput"
- @click="
- hideMenu = true;
- showInput = true;
- "
- class="ms-3 pt-1"
- >
- <img src="../assets/img/icon/素材-04.png" alt="" width="35" />
- </button>
- <button
- v-else
- @click="
- hideMenu = false;
- showInput = false;
- "
- >
- <img
- src="../assets/img/icon/素材-02.png"
- alt=""
- width="50"
- class="pt-2"
- />
- </button>
- </div>
- <div class="w-100 d-flex align-center justify-center">
- <button
- v-if="!showInput"
- @click="
- hideMenu = true;
- showInput = true;
- "
- class="d-flex align-center question-btn"
- >
- <img
- class="me-2"
- src="../assets/img/icon/素材-03.png"
- alt=""
- width="45"
- />
- {{ t("question") }}
- </button>
- <!-- 對話輸入框 -->
- <form
- v-else
- @submit.prevent="sendMessage('text')"
- class="chat-inputs"
- :class="{ 'd-none': !showInput }"
- >
- <!-- <button @click="hideMenu = false" class="menu-btn">
- <img src="../assets/img/icon/素材-02.png" alt="" width="50" />
- </button> -->
- <input
- v-model="userMessage"
- type="text"
- placeholder="Type a message..."
- />
- <button type="submit" class="submit">
- <img
- width="20"
- src="../assets/img/paper-plane-solid.svg"
- alt=""
- />
- </button>
- </form>
- </div>
- </div>
- </div>
- </div>
- <!-- AI 主播語音轉文字 -->
- <div v-else class="anchor-voice">
- <div v-show="showAnchor" class="video-content">
- <div>
- <video ref="video" preload playsinline>
- <source :src="videoSrc" type="video/mp4" />
- <!-- <source src="../assets/video/start_1.mp4" type="video/mp4" /> -->
- Your browser does not support the video tag.
- </video>
- <div v-if="videoLoading" class="video-progress">
- <v-progress-circular
- color="primary"
- indeterminate
- ></v-progress-circular>
- </div>
- </div>
- <!-- <div v-show="isTTSVideo">
- <video ref="ttsVideo" preload playsinline>
- <source
- :src="` ${ttsVideoSrc}`"
- type="video/mp4"
- />
- Your browser does not support the video tag.
- </video>
- </div> -->
- </div>
- <div class="control-item">
- <!-- <p class="text-center">連接中…</p> -->
- <div class="d-flex flex-column align-center">
- <audio v-if="audioURL" :src="audioURL" controls></audio>
- <!-- <p
- v-if="!isRecording"
- class="mb-3 text-center"
- v-html="t('system_construction')"
- ></p> -->
- <p v-if="!isRecording" class="mb-3">點選以進行錄音</p>
- <p v-else class="mb-3">錄音中:{{ recordTime }} 秒</p>
- <!-- 錄音按鈕 -->
- <v-btn
- v-if="!isRecording"
- @click="recStart"
- icon="mdi-circle"
- size="large"
- >
- <v-icon icon="mdi-circle" color="red" size="large"></v-icon>
- </v-btn>
- <v-btn
- v-else
- @click="recStop"
- icon="mdi-circle"
- size="large"
- color="success"
- >
- <v-icon icon="mdi-square" size="large"></v-icon>
- </v-btn>
- </div>
- <div class="d-flex justify-space-between mt-3 mx-10">
- <!-- 暫停按鈕 -->
- <v-btn
- v-if="isVideoPause"
- @click="togglePause('pause')"
- icon="mdi-pause"
- size="large"
- color="grey-darken-3"
- ></v-btn>
- <v-btn
- v-else
- @click="togglePause('play')"
- icon="mdi-play"
- size="large"
- color="grey-darken-3"
- ></v-btn>
- <!-- 關閉按鈕 -->
- <v-btn
- @click="closeRec()"
- icon="mdi-close-thick"
- size="large"
- color="red"
- ></v-btn>
- </div>
- </div>
- </div>
- <!-- 主要廣告 -->
- <v-dialog v-model="showAd">
- <div class="ad-content">
- <button @click="showAd = false" class="close-btn">
- <svg
- xmlns="http://www.w3.org/2000/svg"
- width="28"
- height="28"
- fill="currentColor"
- class="bi bi-x-circle"
- viewBox="0 0 16 16"
- >
- <path
- 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"
- />
- <path
- 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"
- />
- </svg>
- </button>
- <img class="cover-img" :src="ad.cover_img" alt="" />
- <section>
- <h2 class="title">{{ ad.title }}</h2>
- <span></span>
- <p v-html="ad.description"></p>
- <div v-if="ad.included.length" class="product">
- <p>訂單內含商品</p>
- <ul>
- <li v-for="(product, index) in ad.included" :key="index">
- {{ product }}
- </li>
- </ul>
- </div>
- <div v-if="ad.branch.length" class="branch">
- <p>分店資訊</p>
- <ul>
- <li v-for="(name, index) in ad.branch" :key="index">
- {{ name }}
- </li>
- </ul>
- </div>
- <!-- <p class="date">{{ item.body.date }}</p> -->
- <span v-if="ad.location !== ''" class="info justify-end">
- <svg
- xmlns="http://www.w3.org/2000/svg"
- width="20"
- height="20"
- viewBox="0 0 384 512"
- >
- <path
- 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"
- />
- </svg>
- <p>{{ ad.location }}</p>
- </span>
- </section>
- </div>
- </v-dialog>
- <!-- 隨機廣告 -->
- <v-dialog v-model="secondaryAdShow">
- <div class="ad-content">
- <button @click="secondaryAdShow = false" class="close-btn">
- <svg
- xmlns="http://www.w3.org/2000/svg"
- width="28"
- height="28"
- fill="currentColor"
- class="bi bi-x-circle"
- viewBox="0 0 16 16"
- >
- <path
- 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"
- />
- <path
- 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"
- />
- </svg>
- </button>
- <img class="cover-img" :src="secondaryAd.img" alt="" />
- <section>
- <h2 class="title">{{ secondaryAd.name }}</h2>
- <span class="price">
- <p>{{ formatPrice(secondaryAd.price) }}</p>
- <a :href="secondaryAd.url">前往官網</a>
- </span>
- <p class="mb-5" v-html="secondaryAd.content"></p>
- <span v-if="secondaryAd.phone !== ''" class="info">
- <img
- src="../assets/img/phone-solid.svg"
- width="15"
- alt=""
- style="
- filter: invert(50%) sepia(21%) saturate(1061%) hue-rotate(348deg)
- brightness(96%) contrast(92%);
- "
- />
- <p class="ms-1">{{ secondaryAd.phone }}</p>
- </span>
- <span v-if="secondaryAd.address !== ''" class="info">
- <svg
- xmlns="http://www.w3.org/2000/svg"
- width="20"
- height="20"
- viewBox="0 0 384 512"
- class="mt-1"
- >
- <path
- 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"
- />
- </svg>
- <p>{{ secondaryAd.address }}</p>
- </span>
- </section>
- </div>
- </v-dialog>
- <!-- <div
- v-show="showAd"
- v-for="(item, index) in ad"
- :key="index"
- class="ad-content"
- >
- <div>
- <button @click="showAd = false" class="close-btn">
- <svg
- xmlns="http://www.w3.org/2000/svg"
- width="28"
- height="28"
- fill="currentColor"
- class="bi bi-x-circle"
- viewBox="0 0 16 16"
- >
- <path
- 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"
- />
- <path
- 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"
- />
- </svg>
- </button>
- <img class="cover-img" :src="item.body.cover_img" alt="" />
- <section>
- <h2 class="title">{{ item.body.title }}</h2>
- <span></span>
- <p>
- {{ item.body.description }}
- </p>
- <div v-if="item.body.included.length" class="product">
- <p>訂單內含商品</p>
- <ul>
- <li v-for="(product, index) in item.body.included" :key="index">
- {{ product }}
- </li>
- </ul>
- </div>
- <div v-if="item.body.branch.length" class="branch">
- <p>分店資訊</p>
- <ul>
- <li v-for="(name, index) in item.body.branch" :key="index">
- {{ name }}
- </li>
- </ul>
- </div>
- <span v-if="item.body.location !== ''" class="map">
- <svg
- xmlns="http://www.w3.org/2000/svg"
- width="20"
- height="20"
- viewBox="0 0 384 512"
- >
- <path
- 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"
- />
- </svg>
- <p>{{ item.body.location }}</p>
- </span>
- </section>
- </div>
- </div> -->
- </template>
- <style lang="scss">
- .main-btn {
- padding: 16px 70px;
- font-size: 22px;
- font-weight: 600;
- border: none;
- border-radius: 100px;
- letter-spacing: 2px;
- color: white;
- background-color: var(--main-color);
- cursor: pointer;
- transition: all 0.3s;
- &:hover {
- background-color: #c19c75;
- }
- }
- .lang-content {
- width: 100%;
- height: 100vh;
- padding: 0 20vw;
- display: flex;
- align-items: center;
- justify-content: center;
- background-color: rgba(0, 0, 0, 0.6);
- background-blend-mode: multiply;
- background-image: url("@/assets/img/banner.jpg");
- background-size: cover;
- background-position: center center;
- .main-btn {
- margin-bottom: 40px;
- &:last-child {
- margin-bottom: 0;
- }
- }
- .btn-list {
- max-width: 400px;
- display: flex;
- flex-direction: column;
- }
- }
- .main-containar {
- width: 100%;
- background-color: var(--sub-color);
- // height: 150vh;
- // min-height: -webkit-fill-available;
- // display: flex;
- // flex-direction: column;
- // padding-bottom: 70vh;
- // min-height: 100%;
- // overflow-x: hidden;
- // overflow-y: scroll;
- .video-content {
- width: 25vw;
- position: absolute;
- right: -5px;
- top: -45vw;
- @media (max-width: 360px) {
- width: 22vw;
- top: -40vw;
- }
- video {
- // position: fixed;
- // top: 50px;
- // left: 0;
- // right: 0;
- // z-index: 10;
- width: 100%;
- height: auto;
- }
- .control-btn {
- width: 33px;
- height: 33px;
- display: flex;
- align-items: center;
- justify-content: center;
- position: absolute;
- z-index: 50;
- top: 70px;
- right: 7px;
- background: var(--main-color);
- border: none;
- border-radius: 100px;
- img {
- width: 25px;
- filter: invert(100%) sepia(0%) saturate(0%) hue-rotate(93deg)
- brightness(103%) contrast(103%); // 改成白色
- }
- }
- }
- .chat-content {
- width: 100%;
- position: relative;
- z-index: 200;
- letter-spacing: 1px;
- background-color: var(--sub-color);
- &.hide-menu {
- min-height: 90vh;
- }
- .headline {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 10px 25px;
- border-radius: 15px 15px 0 0;
- background-color: var(--main-color);
- h1 {
- font-size: 1.125rem;
- font-weight: 500;
- color: white;
- @media (max-width: 375px) {
- font-size: 0.875rem;
- }
- }
- button {
- padding-top: 3px;
- display: flex;
- align-items: center;
- border: none;
- background-color: transparent;
- cursor: pointer;
- img {
- width: 25px;
- height: 20px;
- transition: all 0.3s;
- transform: rotate(0deg);
- &.rotate {
- transform: rotate(180deg);
- }
- }
- }
- }
- .chat-area {
- // display: flex;
- // flex-direction: column;
- min-height: 60vh;
- background: var(--sub-color);
- padding: 0.5em 1em 1.5em;
- .btn-list {
- margin-top: 20px;
- display: flex;
- flex-wrap: wrap;
- list-style: none;
- button {
- margin-right: 15px;
- margin-bottom: 15px;
- padding: 5px 15px;
- color: white;
- border: 2px solid white;
- letter-spacing: 2px;
- font-weight: bold;
- text-shadow: 1px 1px 1px #939393;
- &.active {
- color: var(--sub-color);
- background-color: white;
- text-shadow: none;
- }
- }
- }
- }
- .message-content {
- display: flex;
- flex-direction: column;
- // margin-top: 20px;
- .message {
- max-width: 45%;
- border-radius: 20px;
- padding: 0.8em 1.2em;
- white-space: pre-line;
- &:first-child {
- margin-top: 0;
- }
- @media (max-width: 600px) {
- max-width: 75%;
- font-size: 0.875em;
- }
- &.message-out {
- margin-left: auto;
- background: var(--bg-grey);
- color: white;
- }
- &.message-in {
- margin-right: auto;
- background: #f1f0f0;
- color: black;
- }
- &.message-in,
- &.message-out {
- margin-top: 20px;
- }
- }
- }
- .branch {
- ul,
- li,
- p {
- margin: 10px 0;
- font-size: 14px;
- }
- }
- .recommend-item {
- width: 350px;
- border-radius: 10px;
- background-color: white;
- }
- .recommend-item,
- .ticket-item {
- .cover-img {
- width: 100%;
- height: 22.5vh;
- object-fit: contain;
- overflow: hidden;
- border-radius: 10px 10px 0 0;
- }
- section {
- padding: 15px 25px;
- letter-spacing: 1px;
- .title {
- margin-bottom: 0;
- font-weight: 600;
- font-size: 1.25rem;
- text-align: left;
- // 超過則省略
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- -webkit-line-clamp: 1;
- -webkit-box-orient: vertical;
- line-break: after-white-space;
- }
- .description {
- line-height: 1.8;
- // text-align: justify;
- font-size: 0.875rem;
- }
- .date {
- color: #646464;
- font-size: 0.875rem;
- text-align: center;
- }
- }
- .link-btn {
- display: flex;
- justify-content: center;
- a {
- display: block;
- width: 100%;
- max-width: 200px;
- margin: 25px 3px;
- padding: 8px;
- text-align: center;
- border-radius: 20px;
- color: white;
- background-color: var(--main-color);
- text-decoration: none;
- transition: all 0.3s;
- &:hover {
- opacity: 0.8;
- }
- }
- }
- }
- .store-item {
- width: 350px;
- .cover-img {
- position: relative;
- margin-bottom: -5px;
- img {
- width: 100%;
- height: 200px;
- object-fit: cover;
- }
- .title {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%, -50%);
- color: white;
- font-size: 1.25rem;
- letter-spacing: 2px;
- text-shadow: 2px 2px 4px #333;
- }
- }
- .headline {
- color: white;
- justify-content: center;
- }
- section {
- padding: 20px;
- letter-spacing: 1px;
- border-radius: 0 0 10px 10px;
- background-color: white;
- .info {
- margin-bottom: 15px;
- p {
- display: flex;
- align-items: center;
- img {
- margin-right: 10px;
- }
- &:last-child {
- margin-top: 3px;
- }
- }
- }
- }
- }
- .ticket-item {
- width: 100%;
- margin-top: 20px;
- h3 {
- margin-bottom: 10px;
- text-align: center;
- }
- .ticket-slide {
- width: 80%;
- position: relative;
- .slide-item {
- max-width: 60vw;
- border-radius: 10px;
- background-color: white;
- }
- .swiper-button-prev {
- display: none;
- }
- }
- .title,
- .description {
- // 超過則省略
- overflow: hidden;
- text-overflow: ellipsis;
- display: -webkit-box;
- // -webkit-line-clamp: 3;
- -webkit-box-orient: vertical;
- line-break: after-white-space;
- }
- .title {
- -webkit-line-clamp: 3;
- }
- .description {
- -webkit-line-clamp: 5;
- }
- section {
- margin-top: -6px;
- border-radius: 0 0 10px 10px;
- background-color: white;
- .link-btn {
- a {
- max-width: 150px;
- margin: 0;
- padding: 8px 12px;
- font-size: 0.75rem;
- }
- }
- .price-item {
- display: block;
- margin-top: 10px;
- text-align: end;
- }
- .price-info {
- margin: 20px 0;
- display: flex;
- align-items: center;
- justify-content: space-between;
- @media (max-width: 575px) {
- font-size: 0.875rem;
- // flex-direction: column;
- // align-items: start;
- }
- span {
- display: block;
- margin: 10px 0;
- padding-right: 5px;
- font-size: 1rem;
- font-weight: 600;
- color: var(--main-color);
- }
- }
- }
- }
- }
- }
- .btn-options {
- // max-width: 85%;
- margin-top: 15px;
- display: flex;
- flex-wrap: wrap;
- list-style: none;
- li {
- margin-top: 15px;
- margin-right: 20px;
- button {
- display: block;
- width: 100%;
- padding: 8px 16px;
- border-radius: 5px;
- color: white;
- border: none;
- background-color: var(--main-color);
- letter-spacing: 2px;
- transition: all 0.3s;
- font-size: 0.875rem;
- &:hover {
- opacity: 0.8;
- }
- }
- }
- }
- .btn-swiper {
- .swiper-slide {
- width: auto;
- // max-width: 185px;
- .btn-container {
- display: flex;
- justify-content: center;
- button {
- display: block;
- width: 100%;
- padding: 10px 20px;
- border-radius: 5px;
- color: white;
- border: none;
- background-color: var(--main-color);
- letter-spacing: 2px;
- transition: all 0.3s;
- font-size: 0.875rem;
- &:hover {
- opacity: 0.8;
- }
- }
- }
- }
- }
- .ad-content {
- // width: 90%;
- max-height: 95vh;
- padding: 35px;
- overflow-y: auto;
- // position: absolute;
- // z-index: 500;
- border-radius: 10px;
- background-color: #fff;
- // box-shadow: 2px 2px 14px #5f5f5f;
- .close-btn {
- position: absolute;
- top: 7px;
- right: 5px;
- border: none;
- background-color: transparent;
- transition: all 0.3s;
- cursor: pointer;
- svg {
- filter: invert(57%) sepia(45%) saturate(391%) hue-rotate(350deg)
- brightness(93%) contrast(84%);
- }
- &:hover {
- opacity: 0.8;
- }
- }
- .ar-link {
- display: flex;
- justify-content: center;
- }
- section {
- p {
- // padding: 0 10px;
- line-height: 1.7;
- letter-spacing: 2px;
- }
- .title {
- margin: 15px auto;
- color: var(--main-color);
- font-weight: 600;
- font-size: 1.375em;
- text-align: center;
- letter-spacing: 2px;
- }
- .product,
- .branch {
- margin-top: 20px;
- background-color: #f1e9dc;
- p {
- padding: 10px 0;
- font-weight: 500;
- font-size: 0.875em;
- text-align: center;
- border-bottom: 2px solid #fff;
- }
- ul {
- padding: 10px;
- list-style: none;
- li {
- padding-bottom: 5px;
- letter-spacing: 1px;
- font-weight: 500;
- font-size: 0.875em;
- }
- }
- }
- .date {
- margin: 20px 0;
- text-align: center;
- }
- .info {
- display: flex;
- align-items: center;
- margin-top: 5px;
- p {
- padding-left: 10px;
- letter-spacing: 2px;
- // font-weight: 500;
- // color: var(--main-color);
- }
- svg {
- filter: invert(57%) sepia(45%) saturate(391%) hue-rotate(350deg)
- brightness(93%) contrast(84%);
- }
- }
- }
- .cover-img {
- width: 100%;
- max-height: 250px;
- object-fit: cover;
- }
- .price {
- display: flex;
- flex-wrap: wrap;
- align-items: center;
- justify-content: space-between;
- margin: 10px 0;
- p {
- font-size: 1.25rem;
- font-weight: 500;
- color: var(--main-color);
- }
- a {
- max-width: 150px;
- margin: 10px 0;
- padding: 8px 25px;
- display: inline-block;
- text-decoration: none;
- text-align: center;
- border-radius: 20px;
- letter-spacing: 1px;
- color: white;
- background-color: var(--main-color);
- }
- }
- }
- .slider-content {
- width: 100%;
- img {
- width: 100%;
- margin-bottom: -5px;
- }
- }
- .branch {
- margin-top: 30px;
- ul {
- padding: 0;
- list-style: none;
- li {
- letter-spacing: 1px;
- }
- }
- }
- .video-progress {
- position: absolute;
- left: 50%;
- top: 40%;
- transform: translate(-50%, -50%);
- }
- .dialog-content {
- position: absolute;
- top: 60px;
- left: 0;
- z-index: 100;
- }
- .vr-content {
- width: 700px;
- height: 700px;
- }
- .ar-link {
- display: inline-block;
- padding: 7px 17px;
- color: #fff;
- background-color: var(--main-color);
- border-radius: 5px;
- text-decoration: none;
- }
- .ar-card {
- width: 85vw;
- height: 100vh;
- .v-card-title {
- text-align: center;
- }
- #vr-video {
- height: 77vh;
- }
- }
- .btn-swiper {
- margin-top: 20px;
- }
- .v-expansion-panel-text {
- font-size: 0.875rem;
- line-height: 1.7;
- }
- // 對話輸入框
- .chat-inputs {
- width: 100%;
- display: flex;
- padding: 10px 20px;
- background-color: white;
- input {
- width: 100%;
- border: none;
- margin-left: 2rem;
- &:focus-visible {
- outline: none;
- }
- }
- .menu-btn {
- position: absolute;
- top: 2px;
- left: 0;
- }
- button.submit {
- border: none;
- background: white;
- cursor: pointer;
- &:hover {
- img {
- opacity: 0.8;
- }
- }
- img {
- padding-top: 5px;
- transition: all 0.3s;
- filter: invert(75%) sepia(20%) saturate(459%) hue-rotate(360deg)
- brightness(100%) contrast(85%);
- }
- }
- ::placeholder {
- font-size: 1rem;
- font-weight: 500;
- color: var(--sub-color);
- opacity: 1; /* Firefox */
- }
- ::-ms-input-placeholder {
- /* Edge 12 -18 */
- color: var(--sub-color);
- }
- }
- // 底部選單
- .menu {
- position: fixed;
- z-index: 300;
- left: 0;
- bottom: 0px;
- right: 0;
- color: var(--text-color);
- background-color: white;
- &.hide-menu table {
- height: 0;
- z-index: -1;
- }
- .icon {
- width: 80px;
- @media (max-width: 414px) {
- width: 60px;
- }
- @media (max-width: 375px) {
- width: 45px;
- }
- }
- .menu-table {
- height: 100%;
- transition: all 0.3s;
- &.hide-table {
- height: 0;
- table {
- display: none;
- height: 0;
- }
- }
- table {
- width: 95%;
- height: 100%;
- margin: auto;
- border-collapse: collapse;
- position: relative;
- transition: all 0.3s;
- &::before,
- &::after {
- content: "";
- display: inline-block;
- width: 10px;
- height: 100%;
- background-color: #fff;
- position: absolute;
- bottom: 0%;
- @media (max-width: 390px) {
- width: 8px;
- }
- }
- &::before {
- left: -5px;
- }
- &::after {
- right: -5px;
- }
- tr {
- td {
- width: 50px;
- padding: 1rem 0;
- text-align: center;
- border: 1px solid #ccc;
- @media (max-width: 414px) {
- width: 100px;
- padding: 1rem 0;
- }
- @media (max-width: 390px) {
- padding: 0.5rem 0;
- }
- p {
- padding: 0 0.3rem;
- letter-spacing: 0.03rem;
- @media (max-width: 430px) {
- // width: 115px;
- font-size: 0.875rem;
- }
- }
- }
- &:first-child {
- td {
- border-top: 0px solid transparent;
- }
- }
- &:last-child {
- td {
- border-bottom: 0px solid transparent;
- }
- }
- }
- }
- }
- .question-btn {
- color: var(--main-color);
- font-size: 1.25rem;
- font-weight: 500;
- letter-spacing: 0.1rem;
- @media (max-width: 414px) {
- font-size: 1rem;
- }
- }
- }
- .anchor-voice {
- height: 94vh;
- color: white;
- background-color: black;
- .video-content {
- height: 70vh;
- overflow: hidden;
- @media (max-width: 375px) {
- height: 65vh;
- }
- video {
- width: 100%;
- @media (max-width: 375px) {
- margin-top: -50px;
- }
- }
- }
- .control-item {
- display: flex;
- flex-direction: column;
- justify-content: center;
- height: 24vh;
- @media (max-width: 375px) {
- height: 29vh;
- }
- }
- // .v-btn.v-btn--density-default {
- // height: 55px !important;
- // }
- }
- .map-img {
- max-width: 100%;
- &.show-anchor {
- max-width: 70%;
- }
- }
- .voice-btn {
- position: fixed;
- right: 5px;
- top: 55px;
- z-index: 100;
- button {
- display: flex;
- align-items: center;
- img {
- width: 22px;
- filter: invert(49%) sepia(66%) saturate(368%) hue-rotate(348deg)
- brightness(91%) contrast(92%);
- }
- p {
- margin-left: 5px;
- font-size: 0.85rem;
- color: var(--main-color);
- }
- }
- }
- .v-btn {
- // &.v-btn--density-default {
- // height: auto !important;
- // }
- p {
- font-size: 0.875rem;
- }
- }
- .v-field__outline {
- --v-field-border-width: 0 !important;
- }
- .swiper {
- // width: 300px;
- margin-left: 0;
- }
- .a-modal {
- position: relative !important;
- top: 50% !important;
- z-index: 15000 !important;
- }
- html.a-fullscreen {
- position: relative !important;
- }
- a-video-controls {
- position: absolute;
- bottom: 20px;
- left: 50%;
- transform: translateX(-50%);
- }
- .fc-direction-ltr {
- height: 500px;
- }
- .fc {
- .fc-scrollgrid,
- .fc-scrollgrid table,
- .fc-daygrid-body {
- height: 94%;
- width: 100% !important;
- }
- .fc-toolbar.fc-header-toolbar {
- padding: 5px;
- margin-bottom: 0;
- letter-spacing: 1px;
- background-color: #f2f2f2;
- border-radius: 5px 5px 0 0;
- }
- .fc-toolbar-title {
- font-size: 1.125em;
- }
- .fc-day-past {
- &.fc-day-other {
- a {
- text-decoration: none;
- }
- }
- a {
- color: #cccccc;
- text-decoration: line-through;
- }
- }
- .fc-button .fc-icon {
- color: #969696;
- font-size: 1em !important;
- vertical-align: baseline !important;
- }
- .fc-icon-chevron-left::before {
- content: "<";
- }
- .fc-icon-chevron-right::before {
- content: ">";
- }
- .fc-button-primary {
- border: none;
- background-color: transparent;
- &:hover,
- &:focus,
- &:not(:disabled):active:focus {
- box-shadow: none;
- background-color: transparent;
- }
- &:disabled {
- display: none;
- }
- }
- .fc-daygrid-day-top {
- justify-content: center;
- }
- .fc-day-today.fc-daygrid-day,
- .fc-day-future.fc-daygrid-day {
- cursor: pointer;
- }
- }
- </style>
|