Compare commits

...

6 Commits
sta ... main

@ -2,7 +2,7 @@ NODE_ENV = production
VUE_APP_LINE_LIFF_ID = 1656907652-VJq33Pdg VUE_APP_LINE_LIFF_ID = 1656907652-VJq33Pdg
VUE_APP_BASE_URL = https://card.h888.fun VUE_APP_BASE_URL = http://localhost:8080
VUE_APP_SEND_URL = https://liff.line.me/1657876696-564NGMxy VUE_APP_SEND_URL = https://liff.line.me/1657876696-564NGMxy
@ -10,4 +10,5 @@ VUE_APP_API_URL = https://card.h888.fun/appapi/v1
VUE_APP_IMAGE_URL = https://card.h888.fun/storage VUE_APP_IMAGE_URL = https://card.h888.fun/storage
VUE_APP_MC_URL = https://liff.line.me/1657876696-MKYDJKgm # 會員中心網址
= https://liff.line.me/1657876696-MKYDJKgm

@ -12,4 +12,3 @@ VUE_APP_API_URL = https://utel.vip/appapi/v1
VUE_APP_IMAGE_URL = https://utel.vip/storage VUE_APP_IMAGE_URL = https://utel.vip/storage
VUE_APP_MC_URL = https://liff.line.me/1656969446-nQYlz77R

@ -11,5 +11,3 @@ VUE_APP_SEND_URL = https://liff.line.me/1661025693-veEM0lwZ
VUE_APP_API_URL = https://card.slash1000.com/appapi/v1 VUE_APP_API_URL = https://card.slash1000.com/appapi/v1
VUE_APP_IMAGE_URL = https://card.slash1000.com/storage VUE_APP_IMAGE_URL = https://card.slash1000.com/storage
VUE_APP_MC_URL = https://liff.line.me/1656907652-p38ddKzQ

@ -11,5 +11,3 @@ VUE_APP_SEND_URL = https://liff.line.me/1656948609-BYr8Nynp
VUE_APP_API_URL = https://utel.zltest.com.tw/appapi/v1 VUE_APP_API_URL = https://utel.zltest.com.tw/appapi/v1
VUE_APP_IMAGE_URL = https://utel.zltest.com.tw/storage VUE_APP_IMAGE_URL = https://utel.zltest.com.tw/storage
VUE_APP_MC_URL = https://liff.line.me/1656948609-xMp7dWAz

@ -11,5 +11,3 @@ VUE_APP_SEND_URL = https://liff.line.me/1656907652-VJq33Pdg
VUE_APP_API_URL = https://u168.vip/appapi/v1 VUE_APP_API_URL = https://u168.vip/appapi/v1
VUE_APP_IMAGE_URL = https://u168.vip/storage VUE_APP_IMAGE_URL = https://u168.vip/storage
VUE_APP_MC_URL = https://liff.line.me/1656907652-p38ddKzQ

16
package-lock.json generated

@ -4019,9 +4019,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001327", "version": "1.0.30001502",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001327.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001502.tgz",
"integrity": "sha512-1/Cg4jlD9qjZzhbzkzEaAC2JHsP0WrOc8Rd/3a3LuajGzGWR/hD7TVyvq99VqmTy99eVh8Zkmdq213OgvgXx7w==", "integrity": "sha512-AZ+9tFXw1sS0o0jcpJQIXvFTOB/xGiQ4OQ2t98QX3NDn2EZTSRBC801gxrsGgViuq2ak/NLkNgSNEPtCr5lfKg==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@ -4031,6 +4031,10 @@
{ {
"type": "tidelift", "type": "tidelift",
"url": "https://tidelift.com/funding/github/npm/caniuse-lite" "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
},
{
"type": "github",
"url": "https://github.com/sponsors/ai"
} }
] ]
}, },
@ -18071,9 +18075,9 @@
} }
}, },
"caniuse-lite": { "caniuse-lite": {
"version": "1.0.30001327", "version": "1.0.30001502",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001327.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001502.tgz",
"integrity": "sha512-1/Cg4jlD9qjZzhbzkzEaAC2JHsP0WrOc8Rd/3a3LuajGzGWR/hD7TVyvq99VqmTy99eVh8Zkmdq213OgvgXx7w==", "integrity": "sha512-AZ+9tFXw1sS0o0jcpJQIXvFTOB/xGiQ4OQ2t98QX3NDn2EZTSRBC801gxrsGgViuq2ak/NLkNgSNEPtCr5lfKg==",
"dev": true "dev": true
}, },
"case-sensitive-paths-webpack-plugin": { "case-sensitive-paths-webpack-plugin": {

@ -7,9 +7,9 @@
<van-tabs :lazy-render="true" v-model:active="activeName" v-show="user.level > 0"> <van-tabs :lazy-render="true" v-model:active="activeName" v-show="user.level > 0">
<van-tab title="我的名片" name="0"> <van-tab title="我的名片" name="0">
</van-tab> </van-tab>
<van-tab :title="card_title" name="1" v-if="showCusCard"> <van-tab :title="state.card_title" name="1" v-if="state.showCusCard">
</van-tab> </van-tab>
<van-tab :title="card.title" :name="card.id.toString()" v-for="card of vip_card" :key="card.id"> <van-tab :title="card.title" :name="card.id.toString()" v-for="card of state.vip_card" :key="card.id">
</van-tab> </van-tab>
</van-tabs> </van-tabs>
<div class="flex-section" v-if="activeName != '0'"> <div class="flex-section" v-if="activeName != '0'">
@ -32,7 +32,7 @@
</div> </div>
<div class="btn-area" v-if="user.level > 0"> <div class="btn-area" v-if="user.level > 0">
<dl class="dl02"> <dl class="dl02">
<a :href="`${imgUrl}/${user.user_id}/${user.user_id}.vcf`"> <a :href="`${state.imgUrl}/${user.user_id}/${user.user_id}.vcf`">
<div class="menu main">加入通訊錄</div> <div class="menu main">加入通訊錄</div>
</a> </a>
</dl> </dl>
@ -90,7 +90,7 @@
</van-popup> </van-popup>
</template> </template>
<script> <script setup>
import dayjs from 'dayjs' import dayjs from 'dayjs'
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
@ -107,249 +107,197 @@ import { genVipCard } from '@/utils/vipcard'
import { Toast } from 'vant' import { Toast } from 'vant'
export default { const token = encodeURIComponent(new URLSearchParams(window.location.search).get('params'))
name: 'LineCard', const cardid = encodeURIComponent(new URLSearchParams(window.location.search).get('cardid'))
setup() { const nouc = encodeURIComponent(new URLSearchParams(window.location.search).get('nouc'))
const state = reactive({
imgUrl: process.env.VUE_APP_IMAGE_URL, const state = reactive({
user: {}, imgUrl: process.env.VUE_APP_IMAGE_URL,
showCusCard: false, user: {},
card_title: '', showCusCard: false,
vip_card: [], card_title: '',
flexContent: {} vip_card: [],
}) flexContent: {}
})
const activeName = ref('0');
const activeName = ref('0')
let cid = ref(null) const cid = ref(null)
const isIOs = ref(null)
let isIOs = ref(null) const flexRef = ref(null)
const uc_temp = ref(null)
let flexRef = ref(null) const nolog = ref(encodeURIComponent(new URLSearchParams(window.location.search).get('nolog')))
const showUserConn = ref(false)
//user id const handleAddFavorite = async (userid) => {
let token = encodeURIComponent(new URLSearchParams(window.location.search).get('params')) if (!Cookies.get('token')) {
let cardid = encodeURIComponent(new URLSearchParams(window.location.search).get('cardid')) return Toast('您尚未登入Slash會員中心請按左上角Slash會員中心登入或加入')
let nouc = encodeURIComponent(new URLSearchParams(window.location.search).get('nouc')) }
let nolog = ref(encodeURIComponent(new URLSearchParams(window.location.search).get('nolog'))) const res = await addFavorite(state.user.user_id)
if (res.code === 200) {
return Toast('收藏成功')
}
}
cid.value = cardid const goSlash = () => {
window.location.href = 'https://card.slash1000.com/home/?refer=' + state.user.code
}
//iphone const goUC = (url) => {
var u = navigator.userAgent; showUserConn.value = false
isIOs.value = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); window.location.href = url + '&nouc=1'
}
const uc_temp = ref() const saveConnection = async (data) => {
const connData = {
userid: data.user_id,
name: data.name,
nfcurl: data.nfcurl,
company: data.company,
title: data.title,
avatar: data.avatar,
time: dayjs().format('YYYY/MM/DD HH:mm')
}
onBeforeMount(async () => { let n_user_conn = []
const chkRes = await checkUser(token) if (localStorage.getItem('user_conn')) {
let i = 0
const t_connData = JSON.parse(localStorage.getItem('user_conn')).filter(item => {
i++
return item.userid !== connData.userid && i < 5
})
if (chkRes.code !== 200) { n_user_conn = [connData, ...t_connData]
if (chkRes.code !== 201) { } else {
window.location.replace('/error.html') n_user_conn = [connData]
return }
}
window.location.replace(`${process.env.VUE_APP_MC_URL}/?act=openright&verify=${chkRes.data.verify.toUpperCase()}`) localStorage.setItem('user_conn', JSON.stringify(n_user_conn))
return
}
let userid = chkRes.data if (Cookies.get('token')) {
const res = await uploadUserConnections(JSON.stringify(n_user_conn))
if (res.code === 200) {
uc_temp.value = n_user_conn
}
}
}
let params = {} onBeforeMount(async () => {
if (userid) { const chkRes = await checkUser(token)
params = { userid }
}
const card1Res = await getCard(params) if (chkRes.code !== 200) {
if (chkRes.code !== 201) {
window.location.replace('/error.html')
return
}
if (card1Res.code !== 200) { //
Toast('操作錯誤') window.location.replace(`${process.env.VUE_APP_BASE_URL}/home/activation?params=${token}`)
return return
// window.location.replace('https://liff.line.me/1656948609-xMp7dWAz') }
}
changeMeta({ const userid = chkRes.data
site_name: "Utel電子名片",
title: card1Res.data.name + " " + card1Res.data.company,
description: card1Res.data.mark,
image: card1Res.data.avatar
})
state.user = card1Res.data const card1Res = await getCard({userid})
if (card1Res.data.level > 0 && card1Res.data.has_cuscard === 1 && card1Res.data.show_cus === 1) { if (card1Res.code !== 200) {
state.showCusCard = true Toast('操作錯誤')
state.card_title = card1Res.data.card_title return
} }
if (card1Res.data.nc_type > 2) { changeMeta({
let vipCardRes = await getVipCard({ userid: state.user.user_id }) site_name: "Utel電子名片",
title: card1Res.data.name + " " + card1Res.data.company,
description: card1Res.data.mark,
image: card1Res.data.avatar
})
state.vip_card = vipCardRes.data.filter(item => item.nfc_show === 1) state.user = card1Res.data
} else {
state.vip_card = []
}
// if (card1Res.data.level > 0 && card1Res.data.has_cuscard === 1 && card1Res.data.show_cus === 1) {
if(nouc != '1'){ state.showCusCard = true
saveConnection(card1Res.data) state.card_title = card1Res.data.card_title
} }
if (card1Res.data.nc_type > 2) {
const vipCardRes = await getVipCard({ userid: state.user.user_id })
state.vip_card = vipCardRes.data.filter(item => item.nfc_show === 1)
} else {
state.vip_card = []
}
}) if (nouc !== '1') {
saveConnection(card1Res.data)
}
})
// activeName.value = '0' watch(() => activeName.value, (newVal, oldVal) => {
watch(() => activeName.value, function (newVal, oldVal) { if (newVal !== oldVal) {
if (newVal !== oldVal) { if (newVal>0) {
if (newVal) { showFlex(newVal)
showFlex(newVal) }
}
}, { immediate: true })
const showFlex = async (id) => {
switch (id) {
case '0':
// let { card } = cardFactory({ tid: state.user.nc_template, vcard: state.user })
// state.flexContent = JSON.parse(card)
// flexRef.value.innerHTML = ''
// flex2html("flex", JSON.parse(card))
break
case '1':
if (state.user.level > 0) {
const card2Res = await getCusCard({ userid: state.user.user_id })
if (card2Res.code === 200) {
if (card2Res.data.cus_card) {
state.flexContent = genCard1(JSON.parse(card2Res.data.cus_card))
await nextTick()
flexRef.value.innerHTML = ''
flex2html("flex", state.flexContent)
} }
} }
}, { immediate: true }) } else {
// flexRef.value.innerHtml = ''
async function showFlex(id) {
switch (id) {
case '0':
// let { card } = cardFactory({ tid: state.user.nc_template, vcard: state.user })
// state.flexContent = JSON.parse(card)
// flexRef.value.innerHTML = ''
// flex2html("flex", JSON.parse(card))
break
case '1':
if (state.user.level > 0) {
let card2Res = await getCusCard({ userid: state.user.user_id })
if (card2Res.code === 200) {
if (card2Res.data.cus_card) {
state.flexContent = genCard1(JSON.parse(card2Res.data.cus_card))
await nextTick()
flexRef.value.innerHTML = ''
flex2html("flex", state.flexContent)
}
}
} else {
// flexRef.value.innerHtml = ''
}
break
default:
if (state.user.nc_type > 2) {
let res = state.vip_card.find(item => { return item.id == id })
if (res.type === 0) {
state.flexContent = genCard1(JSON.parse(res.content))
await nextTick()
flexRef.value.innerHTML = ''
flex2html("flex", state.flexContent)
} else {
state.flexContent = genVipCard(JSON.parse(res.content))
await nextTick()
if (flexRef.value) {
flexRef.value.innerHTML = ''
}
flex2html("flex", state.flexContent)
}
} else {
flexRef.value.innerHtml = ''
}
break
}
}
//
const showUserConn = ref(false)
async function saveConnection(data){
let connData = {
userid: data.user_id,
name: data.name,
nfcurl: data.nfcurl,
company: data.company,
title: data.title,
avatar: data.avatar,
time: dayjs().format('YYYY/MM/DD HH:mm')
}
let n_user_conn = []
if(localStorage.getItem('user_conn')){
//
let i = 0
let t_connData = JSON.parse(localStorage.getItem('user_conn')).filter(item=>{
i++
return item.userid !=connData.userid && i < 5
})
n_user_conn = [connData,...t_connData]
}else{
n_user_conn = [connData]
} }
break
localStorage.setItem('user_conn',JSON.stringify(n_user_conn)) default:
if (state.user.nc_type > 2) {
if(Cookies.get('token')){ const res = state.vip_card.find(item => item.id == id)
let res = await uploadUserConnections(JSON.stringify(n_user_conn)) if (res.type === 0) {
if(res.code === 200){ state.flexContent = genCard1(JSON.parse(res.content))
uc_temp.value = n_user_conn await nextTick()
flexRef.value.innerHTML = ''
flex2html("flex", state.flexContent)
} else {
state.flexContent = genVipCard(JSON.parse(res.content))
await nextTick()
if (flexRef.value) {
flexRef.value.innerHTML = ''
}
flex2html("flex", state.flexContent)
} }
} else {
flexRef.value.innerHtml = ''
} }
} break
}
}
const userConnections = computed(()=>{
if(uc_temp.value && uc_temp.value.length > 0){
return uc_temp.value
}
return JSON.parse(localStorage.getItem('user_conn'))
})
const goUC = (url)=>{
showUserConn.value = false
window.location.href = url + '&nouc=1'
// window.location.href = url
}
const handleAddFavorite = async (userid)=>{ const userConnections = computed(() => {
if(!Cookies.get('token')){ if (uc_temp.value && uc_temp.value.length > 0) {
return Toast('您尚未登入Slash會員中心請按左上角Slash會員中心登入或加入') return uc_temp.value
} }
let res = await addFavorite(state.user.user_id) return JSON.parse(localStorage.getItem('user_conn'))
if(res.code === 200){ })
return Toast('收藏成功')
}
}
const goSlash=()=>{ const {user} = toRefs(state)
window.location.href = 'https://card.slash1000.com/home/?refer=' + state.user.code
}
return {
...toRefs(state),
showUserConn,
activeName,
cid,
nolog,
flexRef,
isIOs,
userConnections,
goUC,
goSlash,
handleAddFavorite
}
}
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
[v-cloak] { [v-cloak] {
display: none; display: none;

@ -5,7 +5,8 @@ module.exports = {
publicPath: ["production", "u168", "stage", "slash"].includes(process.env.VUE_ENV) publicPath: ["production", "u168", "stage", "slash"].includes(process.env.VUE_ENV)
? "/card" ? "/card"
: "/card", : "/card",
outputDir: ["production", "u168", "slash"].includes(process.env.VUE_ENV) outputDir:
? "../api/public/card" ["production", "u168", "slash"].includes(process.env.VUE_ENV)
: "./dist" ? "../build/card"
: "./dist",
}; };

Loading…
Cancel
Save