diff --git a/.env.development b/.env.development index d25b245..ab9b223 100644 --- a/.env.development +++ b/.env.development @@ -4,7 +4,7 @@ VUE_ENV = stage VUE_APP_BASE_URL = https://utel.zltest.com.tw -VUE_APP_LINE_LIFF_ID = 1656948609-xMp7dWAz +VUE_APP_LINE_LIFF_ID = 1656907652-p38ddKzQ VUE_APP_SEND_URL = https://liff.line.me/1656948609-BYr8Nynp diff --git a/src/main.js b/src/main.js index 634cc1d..2a231c4 100644 --- a/src/main.js +++ b/src/main.js @@ -3,6 +3,7 @@ import App from "./App.vue"; import router from "./router"; import store from "./store"; +import liff from '@line/liff'; import { vant } from "@/plugins/vant"; import { VueClipboard } from "@soerenmartius/vue3-clipboard"; @@ -10,8 +11,19 @@ import "@/assets/css/normalize.css"; import "@/assets/css/common.less"; // import './registerServiceWorker' -const vue = createApp(App); +liff.init({ + liffId: process.env.VUE_APP_LINE_LIFF_ID + }).then(() => { -vant(vue); -vue.use(VueClipboard); -vue.use(store).use(router).mount("#app"); + window.liff = liff; + + const vue = createApp(App); + + // 將LIFF實例提供給應用 + vant(vue); + vue.use(VueClipboard); + vue.use(store).use(router).mount("#app"); + + }).catch((error) => { + console.error('初始化 LIFF 時出錯:', error); + }); diff --git a/src/utils/liff.js b/src/utils/liff.js new file mode 100644 index 0000000..ec10cb1 --- /dev/null +++ b/src/utils/liff.js @@ -0,0 +1,11 @@ +import liff from "@line/liff"; + +async function initLiff(app) { + await liff.init({ liffId: process.env.VUE_APP_LINE_LIFF_ID }); + if (!liff.isLoggedIn()){ + liff.login({ redirectUri: window.location.href }); + } + app.provide('liff', liff); +} + +export default initLiff; \ No newline at end of file diff --git a/src/views/Home/index.vue b/src/views/Home/index.vue index 5942881..09c4a02 100644 --- a/src/views/Home/index.vue +++ b/src/views/Home/index.vue @@ -1,151 +1,10 @@ - - + + \ No newline at end of file diff --git a/src/views/Register/index.vue b/src/views/Register/index.vue index 72c45fb..8ee72f5 100644 --- a/src/views/Register/index.vue +++ b/src/views/Register/index.vue @@ -1,330 +1,343 @@ - - \ No newline at end of file +} +