+
+
+ -
+
diff --git a/.env.development b/.env.development index 10ef8ea..300a136 100644 --- a/.env.development +++ b/.env.development @@ -2,9 +2,7 @@ NODE_ENV = production VUE_ENV = development -# VUE_APP_BASE_URL = https://localhost:8080 - -VUE_APP_BASE_URL = https://557d-220-129-38-157.jp.ngrok.io +VUE_APP_BASE_URL = http://localhost:8080 VUE_APP_SEND_URL = https://liff.line.me/1657876696-MKYDJKgm @@ -14,7 +12,7 @@ VUE_APP_SSO_URL = https://sso.h888.fun/api/v1 VUE_APP_IMAGE_URL = https://card.h888.fun/storage -VUE_APP_DOMAIN = 557d-220-129-38-157.jp.ngrok.io +VUE_APP_DOMAIN = localhost VUE_APP_LINE_CLINE_ID = 1657876696 diff --git a/package-lock.json b/package-lock.json index 16b07ec..31a4be0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "lodash": "^4.17.21", "moment": "^2.29.1", "nprogress": "^0.2.0", + "pinia": "^2.0.35", "pwacompat": "^2.0.17", "qrcode.vue": "^3.3.3", "register-service-worker": "^1.7.1", @@ -3459,9 +3460,9 @@ "dev": true }, "node_modules/@vue/devtools-api": { - "version": "6.0.12", - "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.0.12.tgz", - "integrity": "sha512-iO/4FIezHKXhiDBdKySCvJVh8/mZPxHpiQrTy+PXVqJZgpTPTdHy4q8GXulaY+UKEagdkBb0onxNQZ0LNiqVhw==" + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.5.0.tgz", + "integrity": "sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==" }, "node_modules/@vue/preload-webpack-plugin": { "version": "1.1.2", @@ -11122,6 +11123,56 @@ "node": ">=6" } }, + "node_modules/pinia": { + "version": "2.0.35", + "resolved": "https://registry.npmjs.org/pinia/-/pinia-2.0.35.tgz", + "integrity": "sha512-P1IKKQWhxGXiiZ3atOaNI75bYlFUbRxtJdhPLX059Z7+b9Z04rnTZdSY8Aph1LA+/4QEMAYHsTQ638Wfe+6K5g==", + "dependencies": { + "@vue/devtools-api": "^6.5.0", + "vue-demi": "*" + }, + "funding": { + "url": "https://github.com/sponsors/posva" + }, + "peerDependencies": { + "@vue/composition-api": "^1.4.0", + "typescript": ">=4.4.4", + "vue": "^2.6.14 || ^3.2.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/pinia/node_modules/vue-demi": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.0.tgz", + "integrity": "sha512-gt58r2ogsNQeVoQ3EhoUAvUsH9xviydl0dWJj7dabBC/2L4uBId7ujtCwDRD0JhkGsV1i0CtfLAeyYKBht9oWg==", + "hasInstallScript": true, + "bin": { + "vue-demi-fix": "bin/vue-demi-fix.js", + "vue-demi-switch": "bin/vue-demi-switch.js" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@vue/composition-api": "^1.0.0-rc.1", + "vue": "^3.0.0-0 || ^2.6.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + } + } + }, "node_modules/pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", @@ -18780,9 +18831,9 @@ } }, "@vue/devtools-api": { - "version": "6.0.12", - "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.0.12.tgz", - "integrity": "sha512-iO/4FIezHKXhiDBdKySCvJVh8/mZPxHpiQrTy+PXVqJZgpTPTdHy4q8GXulaY+UKEagdkBb0onxNQZ0LNiqVhw==" + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.5.0.tgz", + "integrity": "sha512-o9KfBeaBmCKl10usN4crU53fYtC1r7jJwdGKjPT24t348rHxgfpZ0xL3Xm/gLUYnc0oTp8LAmrxOeLyu6tbk2Q==" }, "@vue/preload-webpack-plugin": { "version": "1.1.2", @@ -24911,6 +24962,23 @@ "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", "dev": true }, + "pinia": { + "version": "2.0.35", + "resolved": "https://registry.npmjs.org/pinia/-/pinia-2.0.35.tgz", + "integrity": "sha512-P1IKKQWhxGXiiZ3atOaNI75bYlFUbRxtJdhPLX059Z7+b9Z04rnTZdSY8Aph1LA+/4QEMAYHsTQ638Wfe+6K5g==", + "requires": { + "@vue/devtools-api": "^6.5.0", + "vue-demi": "*" + }, + "dependencies": { + "vue-demi": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.0.tgz", + "integrity": "sha512-gt58r2ogsNQeVoQ3EhoUAvUsH9xviydl0dWJj7dabBC/2L4uBId7ujtCwDRD0JhkGsV1i0CtfLAeyYKBht9oWg==", + "requires": {} + } + } + }, "pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", diff --git a/package.json b/package.json index 5b653f9..c0252e3 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "lodash": "^4.17.21", "moment": "^2.29.1", "nprogress": "^0.2.0", + "pinia": "^2.0.35", "pwacompat": "^2.0.17", "qrcode.vue": "^3.3.3", "register-service-worker": "^1.7.1", diff --git a/public/assets/images/logo/logo144.png b/public/assets/images/logo/logo144.png deleted file mode 100644 index d4127d0..0000000 Binary files a/public/assets/images/logo/logo144.png and /dev/null differ diff --git a/public/favicon.ico b/public/favicon.ico index d18816e..894ca4a 100644 Binary files a/public/favicon.ico and b/public/favicon.ico differ diff --git a/public/img/icons/android-chrome-96x96.png b/public/img/icons/android-chrome-96x96.png deleted file mode 100644 index e4055c0..0000000 Binary files a/public/img/icons/android-chrome-96x96.png and /dev/null differ diff --git a/public/img/icons/apple-touch-icon-114x114.png b/public/img/icons/apple-touch-icon-114x114.png deleted file mode 100644 index 09641ce..0000000 Binary files a/public/img/icons/apple-touch-icon-114x114.png and /dev/null differ diff --git a/public/img/icons/apple-touch-icon-120x120.png b/public/img/icons/apple-touch-icon-120x120.png deleted file mode 100644 index 92aa5a1..0000000 Binary files a/public/img/icons/apple-touch-icon-120x120.png and /dev/null differ diff --git a/public/img/icons/apple-touch-icon-152x152.png b/public/img/icons/apple-touch-icon-152x152.png deleted file mode 100644 index ae1c4b6..0000000 Binary files a/public/img/icons/apple-touch-icon-152x152.png and /dev/null differ diff --git a/public/img/icons/apple-touch-icon-57x57.png b/public/img/icons/apple-touch-icon-57x57.png deleted file mode 100644 index ff470a3..0000000 Binary files a/public/img/icons/apple-touch-icon-57x57.png and /dev/null differ diff --git a/public/img/icons/apple-touch-icon-60x60.png b/public/img/icons/apple-touch-icon-60x60.png deleted file mode 100644 index f3fd6c8..0000000 Binary files a/public/img/icons/apple-touch-icon-60x60.png and /dev/null differ diff --git a/public/img/icons/apple-touch-icon-72x72.png b/public/img/icons/apple-touch-icon-72x72.png deleted file mode 100644 index 96d228a..0000000 Binary files a/public/img/icons/apple-touch-icon-72x72.png and /dev/null differ diff --git a/public/img/icons/apple-touch-icon-76x76.png b/public/img/icons/apple-touch-icon-76x76.png deleted file mode 100644 index 605d305..0000000 Binary files a/public/img/icons/apple-touch-icon-76x76.png and /dev/null differ diff --git a/public/img/icons/apple-touch-icon.png b/public/img/icons/apple-touch-icon.png deleted file mode 100644 index 92aa5a1..0000000 Binary files a/public/img/icons/apple-touch-icon.png and /dev/null differ diff --git a/public/img/icons/favicon-16x16.png b/public/img/icons/favicon-16x16.png deleted file mode 100644 index 61c3dee..0000000 Binary files a/public/img/icons/favicon-16x16.png and /dev/null differ diff --git a/public/img/icons/favicon-32x32.png b/public/img/icons/favicon-32x32.png index ac03137..894ca4a 100644 Binary files a/public/img/icons/favicon-32x32.png and b/public/img/icons/favicon-32x32.png differ diff --git a/public/img/icons/favicon.ico b/public/img/icons/favicon.ico index d18816e..894ca4a 100644 Binary files a/public/img/icons/favicon.ico and b/public/img/icons/favicon.ico differ diff --git a/public/img/icons/logo.png b/public/img/icons/logo.png index ae1c4b6..b3d43f2 100644 Binary files a/public/img/icons/logo.png and b/public/img/icons/logo.png differ diff --git a/public/img/icons/mstile-150x150.png b/public/img/icons/mstile-150x150.png deleted file mode 100644 index d069616..0000000 Binary files a/public/img/icons/mstile-150x150.png and /dev/null differ diff --git a/public/index.html b/public/index.html index 237ef6f..ba18944 100644 --- a/public/index.html +++ b/public/index.html @@ -1,6 +1,5 @@ -
diff --git a/src/api/ajax.js b/src/api/ajax.js index 9a62a92..5a3797e 100644 --- a/src/api/ajax.js +++ b/src/api/ajax.js @@ -69,8 +69,8 @@ instance.interceptors.response.use( switch (error.response.status) { case 401: // 返回 401 清除token資訊並跳轉到登入頁面 - Cookies.remove('token',{ domain: process.env.VUE_APP_DOMAIN}) - Cookies.remove('uid',{ domain: process.env.VUE_APP_DOMAIN}) + Cookies.remove('token',{ domain: store.state.domain}) + Cookies.remove('uid',{ domain: store.state.domain}) store.commit(types.LOGOUT); @@ -91,7 +91,7 @@ function refreshToken(response) { let token = response.headers.authorization if (token) { console.log('change token') - Cookies.set('token', token , { expires: 365 ,domain: process.env.VUE_APP_DOMAIN}); + Cookies.set('token', token , { expires: 365 ,domain: store.state.domain}); } } diff --git a/src/api/auth.js b/src/api/auth.js index d19341a..415d9f1 100644 --- a/src/api/auth.js +++ b/src/api/auth.js @@ -1,4 +1,5 @@ import ajax from "./ajax"; -export const login = async (params) => ajax(`/auth/login`, params, "POST", {requestBase:'sso'}); +export const login = async (params) => ajax(`/auth/login`, params, "POST", { requestBase: 'sso' }); +export const sendVerify = async (username) => ajax(`/auth/sendVerify`, {username}, "POST", { requestBase: 'sso' }); diff --git a/src/assets/images/logo/logo.png b/src/assets/images/logo/logo.png index e80f176..b3d43f2 100644 Binary files a/src/assets/images/logo/logo.png and b/src/assets/images/logo/logo.png differ diff --git a/src/assets/images/logo/logo48.png b/src/assets/images/logo/logo48.png new file mode 100644 index 0000000..b3d43f2 Binary files /dev/null and b/src/assets/images/logo/logo48.png differ diff --git a/src/assets/images/logo/logo_w.jpg b/src/assets/images/logo/logo_w.jpg new file mode 100644 index 0000000..e3e81cf Binary files /dev/null and b/src/assets/images/logo/logo_w.jpg differ diff --git a/src/assets/images/logo/logo_w.png b/src/assets/images/logo/logo_w.png deleted file mode 100644 index 4454b64..0000000 Binary files a/src/assets/images/logo/logo_w.png and /dev/null differ diff --git a/src/components/Footer.vue b/src/components/Footer.vue index 0b76285..0024e1e 100644 --- a/src/components/Footer.vue +++ b/src/components/Footer.vue @@ -64,12 +64,12 @@ export default { const options = [ { name: '二维码', icon: 'qrcode', key: 'qrcode' }, { name: '分享連結', icon: 'link', key: 'link' }, - { name: 'Line', icon: 'https://card.h888.fun/images/icons/line.png', key: 'line'}, - { name: 'Facebook', icon: 'https://card.h888.fun/images/icons/facebook.png', key: 'fb'} + { name: 'Line', icon: 'https://card.'+store.state.domain+'/images/icons/line.png', key: 'line'}, + { name: 'Facebook', icon: 'https://card.'+store.state.domain+'/images/icons/facebook.png', key: 'fb'} ]; const onSelect = (option) => { - let share_url = `https://liff.line.me/${process.env.VUE_APP_LINE_LIFF_ID}/?refer=${store.state.user.userInfo.code}` + let share_url = `https://card.${store.state.domain}/home/?refer=${store.state.user.userInfo.code}` if (option.key === 'qrcode') { showShareQrcode.value = true diff --git a/src/main.js b/src/main.js index 91db7a0..db060b0 100644 --- a/src/main.js +++ b/src/main.js @@ -4,6 +4,7 @@ import router from "./router"; import store from "./store"; import { vant } from "@/plugins/vant"; + import { VueClipboard } from "@soerenmartius/vue3-clipboard"; import "@/assets/css/normalize.css"; @@ -11,16 +12,19 @@ import "@/assets/css/common.less"; import Cookies from "js-cookie"; // import './registerServiceWorker' -(function init(){ - //使用URLSearchParams API取得query string的refer參數,並寫到Cookie - const urlParams = new URLSearchParams(window.location.search); - //取得refer參數 - const refer = urlParams.get('refer'); +import { initStore, initSession } from './utils/init' + +(async function init() { + //使用URLSearchParams API取得query string的refer參數,並寫到Cookie + const urlParams = new URLSearchParams(window.location.search); + //取得refer參數 + const refer = urlParams.get('refer'); - //將refer參數寫入Cookie - if(!Cookies.get('refer_code') && refer){ - Cookies.set('refer_code', refer, { expires: 1 }); - } + //將refer參數寫入Cookie + if (!Cookies.get('refer_code') && refer) { + Cookies.set('refer_code', refer, { expires: 1 }); + } + await initStore() })() @@ -29,4 +33,6 @@ const vue = createApp(App); vant(vue); vue.use(VueClipboard); -vue.use(store).use(router).mount("#app"); +vue.use(store) +vue.use(router) +vue.mount("#app"); diff --git a/src/router/index.js b/src/router/index.js index fced36c..dd8c04a 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -149,7 +149,7 @@ router.beforeEach((to, from, next) => { NProgress.start(); if ( to.path !== "/login" && to.path !== "/register" && to.path !== "/linelogin/" && to.path !== "/linelogin") { if (!Cookies.get("token")) { - Toast('請重新登入,(0001)') + Toast('請重新登入') next("/login") } diff --git a/src/store/index.js b/src/store/index.js index 2e07866..2120d73 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -14,6 +14,7 @@ var ls = new SecureLS({ export default createStore({ state: () => ({ user_id: "", + domain: "", config: {}, token: Cookies.get("token") || "", }), @@ -24,6 +25,9 @@ export default createStore({ setSiteConfig(state, payload) { state.config = payload; }, + setDomain(state, { domain }){ + state.domain = domain + } }, modules: { user, diff --git a/src/utils/card/card1.js b/src/utils/card/card1.js index bd0d5f0..23f918b 100644 --- a/src/utils/card/card1.js +++ b/src/utils/card/card1.js @@ -1,3 +1,5 @@ +import store from '@/store' + function genCard(vcard) { let vcardLink; if (vcard.url.trim().length > 0) { @@ -188,7 +190,7 @@ function genCard(vcard) { contents: [ { type: "image", - url: process.env.VUE_APP_BASE_URL+"/images/tpl02_bg.png", + url: "https://card."+store.state.domain+"/images/tpl02_bg.png", size: "full", aspectMode: "cover", aspectRatio: "4:3", diff --git a/src/utils/card/card2.js b/src/utils/card/card2.js index dc40a4f..9d14b22 100644 --- a/src/utils/card/card2.js +++ b/src/utils/card/card2.js @@ -1,3 +1,5 @@ +import store from '@/store' + function genCard(vcard) { let vcardLink; if (vcard.url.trim().length > 0) { @@ -178,7 +180,7 @@ function genCard(vcard) { contents: [ { type: "image", - url: process.env.VUE_APP_BASE_URL+"/images/jcibg.png", + url: "https://card."+store.state.domain+"/images/jcibg.png", size: "full", aspectMode: "fit", aspectRatio: "4:3", diff --git a/src/utils/card/card3.js b/src/utils/card/card3.js index e39e724..869ed4d 100644 --- a/src/utils/card/card3.js +++ b/src/utils/card/card3.js @@ -1,3 +1,5 @@ +import store from '@/store' + function genCard(vcard) { let vcardLink; if (vcard.url.trim().length > 0) { @@ -182,7 +184,7 @@ function genCard(vcard) { aspectMode: "cover", aspectRatio: "4:3", gravity: "top", - url: process.env.VUE_APP_BASE_URL+"/images/tpl03_bg.png?v=1", + url: "https://card."+store.state.domain+"/images/tpl03_bg.png?v=1", }, { type: "box", diff --git a/src/utils/card/card4.js b/src/utils/card/card4.js index 2f2e880..7b7c387 100644 --- a/src/utils/card/card4.js +++ b/src/utils/card/card4.js @@ -1,3 +1,5 @@ +import store from '@/store' + function genCard(vcard) { let vcardLink; if (vcard.url.trim().length > 0) { diff --git a/src/utils/init.js b/src/utils/init.js new file mode 100644 index 0000000..7e034f0 --- /dev/null +++ b/src/utils/init.js @@ -0,0 +1,36 @@ +// import { v1 as uuidv1 } from 'uuid' +import Cookies from 'js-cookie' +// import { useShopStore } from "@/store/Shop" +// import { useUserStore } from "@/store/User" +// import { useCartStore } from "@/store/Cart" + +import store from '@/store/index.js' + +export async function initSession() { + // if(!Cookies.get('SessionId')){ + // Cookies.set('SessionId',uuidv1()) + // } +} + +export async function initStore() { + // 獲取當前頁面的主機名 + const hostname = window.location.hostname; + + //判斷hostname是否為ip + const reg = /^(\d+)\.(\d+)\.(\d+)\.(\d+)$/; + if(reg.test(hostname)){ + store.commit('setDomain',{domain:hostname}) + return + } + // 將主機名按照句點進行拆分 + const parts = hostname.split('.'); + let domain = ''; + // 如果主機名包含至少 3 個部分(例如 subdomain.example.com) + if (parts.length >= 3) { + // 獲取第二個部分(即 subdomain) + domain = parts[1]+'.'+parts[2]; + }else{ + domain = hostname; + } + store.commit('setDomain',{domain}) +} diff --git a/src/views/Connections/index.vue b/src/views/Connections/index.vue index 117aa6f..9c368be 100644 --- a/src/views/Connections/index.vue +++ b/src/views/Connections/index.vue @@ -3,7 +3,7 @@
-
-
+
+
+