修改人胍資源

dev
Wayne 3 years ago
parent ef891ae6a5
commit e4b9ea534a

Binary file not shown.

@ -1,26 +1,26 @@
<template>
<Suspense>
<template #default>
<router-view/>
<router-view />
</template>
<template #fallback>
Loading
</template>
</Suspense>
</template>
</template>
<script setup>
import { getSiteConfig } from './api'
import { useStore } from 'vuex'
const store = useStore()
</script>
<style lang="less">
#app{
// margin-bottom: 40px;
}
</style>
<script setup>
// import { getSiteConfig } from './api'
// import { useStore } from 'vuex'
// const store = useStore()
</script>
<style lang="less">
#app {
// margin-bottom: 40px;
}
</style>

@ -25,8 +25,8 @@ export const setUserTpl = async (tpl) =>
export const toggleSendWithAD = async (type) =>
ajax(`/user/toggleSendWithAD`, { type }, "POST");
export const searchConnection = async (type) =>
ajax(`/user/searchConnection`, { type }, "POST");
export const searchConnection = async (params) =>
ajax(`/user/searchConnection`, params, "POST");
export const setUserNfcTpl = async (tpl) =>
ajax(`/user/setUserNfcTpl`, { tpl }, "POST");

@ -131,7 +131,7 @@ const routes = [
];
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
history: createWebHistory('/home'),
routes,
});

@ -1,449 +0,0 @@
<script setup>
import moment from 'moment'
import QrcodeVue from 'qrcode.vue'
import { useCountDown } from '@vant/use';
import { toClipboard } from '@soerenmartius/vue3-clipboard'
import { ref, computed, onBeforeMount, nextTick, inject } from "vue";
import { useRoute, useRouter } from 'vue-router';
import { useStore } from 'vuex';
import { showToast,showSuccessToast } from 'vant';
import { Dialog } from 'vant';
// import Footer from '@/components/Footer.vue'
import { login, bindCard } from '@/api'
const router = useRouter()
const route = useRoute()
const store = useStore()
const popShow = ref(true)
const showShare = ref(false)
const showNfcQrcode = ref(false)
const imageUrl = ref(import.meta.env.VITE_APP_IMAGE_URL)
const userLevel = {
0: '基礎款',
1: '標準款',
2: '自製款',
3: '客製款'
}
const is_due = ref(false)
// 使useCountDown
const countDown = useCountDown({time: 1 * 1000});
const current = countDown.current;
countDown.start();
onBeforeMount(async () => {
const liff = window.liff;
try {
if (!liff.isLoggedIn())
liff.login({ redirectUri: window.location.href });
} catch (err) {
console.log(`liff.state init error ${err}`);
showToast('登入失敗。請聯絡管理員')
router.push('/login')
}
if (!sessionStorage.getItem('token')) {
const profile = await liff.getProfile()
const id_token = liff.getIDToken()
let loginRes = await login({ line_id: profile.userId, token: id_token })
if (loginRes.code === 200) {
if (route.query.act === 'openright') {
showToast('您已經是本站會員')
}
sessionStorage.setItem('token', loginRes.data.token)
sessionStorage.setItem('uid', loginRes.data.uid)
} else if (loginRes.code === 202) {
if (route.query.act === 'openright') {
if (route.query.verify) {
//
Dialog.confirm({
title: '卡片綁定',
message: '確認是否綁定這張卡片'
}).then(async () => {
//
let bindRes = await bindCard({ uid: loginRes.data.uid, verify: route.query.verify })
if (bindRes.code === 200) {
showSuccessToast('綁定成功')
} else {
showToast.fail('綁定失敗')
}
}).catch(() => {
})
}
}
sessionStorage.setItem('token', loginRes.data.token)
sessionStorage.setItem('uid', loginRes.data.uid)
} else if (loginRes.code === 201) {
if (route.query.act === 'openright') {
if (route.query.verify) {
router.push({
path: '/register',
query: {
verify: route.query.verify
}
})
return
}
} else if (route.query.aid) {
router.push({
path: '/register',
query: {
aid: route.query.aid
}
})
return
} else {
showToast('請先註冊成為本站會員')
return router.push({
path: '/register',
query: { refer: route.query.refer }
})
}
} else {
showToast('登入失敗。請聯絡管理員')
router.push('/login')
}
}
store.dispatch('user/getUserInfo')
//
nextTick(() => {
// if(userInfo.value.level===0 && userInfo.value.nc_type===0){
// showToast('')
// return router.push('/shop/inputsn')
// }
})
})
const userInfo = computed(() => {
return store.state.user.userInfo
})
const nfcurl = computed(() => {
return encodeURI(store.state.user.userInfo.ufcurl)
})
const overdue = computed(() => {
if (store.state.user.userInfo.overdue_time > 0) {
return moment.unix(store.state.user.userInfo.overdue_time).format('YYYY-MM-DD')
} else {
return '無期限'
}
})
const goCardEdit = () => {
if (userInfo.value.nc_type < 2) {
router.push('/card/notice')
} else {
router.push('/card/edit')
}
}
const onSelect = (option) => {
showToast(option.name);
showShare.value = false;
};
const handleShowNfc = () => {
showNfcQrcode.value = true
}
const doCopy = () => {
toClipboard(userInfo.value.nfcurl)
showToast('已放入剪貼簿')
}
const doCopyUid = () => {
toClipboard(userInfo.value.user_id)
showToast('已放入剪貼簿')
}
const bindTggo = () => {
console.log(userInfo.value)
let url = `https://www.tggo.com.tw/u.cgi?&mnm=mybinding&ncode=${userInfo.value.uniqid}&name=${userInfo.value.real_name}&openExternalBrowser=1`;
window.open(url, '_blank');
}
const handleLogout = () => {
if (liff.isLoggedIn()) {
liff.logout();
}
sessionStorage.removeItem('token')
sessionStorage.removeItem('uid')
router.push('/login')
}
</script>
<template>
<div class="home" v-cloak>
<div class="my-account">
<div class="account-bg">
<img src="@/assets/images/topbg.png" />
</div>
<div class="avatar_box">
<img class="avater" :src="userInfo.line_picture || import('@/assets/images/user.jpg')" />
</div>
<div class="user-info">
<p class="uname">UTel電子名片系統</p>
<a href="javascript:;">
<p class="umoney phone">歡迎來到會員中心</p>
</a>
</div>
<div class="set" @click="handleLogout">
<a href="javascript:void(0)">登出</a>
</div>
</div>
<div class="recommend">
<ul>
<li @click="router.push('/member')">
<p>修改資料</p>
<span>修改名片資料</span>
</li>
<li @click="goCardEdit">
<p>商務卡片</p>
<span>設計專屬名片</span>
</li>
<li @click="router.push('/shop')">
<p>立即購買</p>
<span>付費開通方案</span>
</li>
<li @click="handleShowNfc">
<p>展示二維碼</p>
<span>提供好友掃描</span>
</li>
</ul>
</div>
<dl class="dl02" v-if="userInfo">
<a href="javascript:;">
<div class="menu">
<img class="titleImg" src="@/assets/images/icon-01.png" />
<div class="left">建立日期</div>
<div class="right">{{ userInfo.create_time }}</div>
<div style="clear: both"></div>
</div>
</a>
<a href="javascript:;">
<div class="menu">
<img class="titleImg" src="@/assets/images/icon-02.png" />
<div class="left">會員編號</div>
<div class="right">{{ userInfo.user_id }}
<span class="cp-btn" @click="doCopyUid"></span>
</div>
<div style="clear: both"></div>
</div>
</a>
<a href="javascript:;">
<div class="menu">
<img class="titleImg" src="@/assets/images/icon-02.png" />
<div class="left">公司名稱</div>
<div class="right">{{ userInfo.company }}</div>
<div style="clear: both"></div>
</div>
</a>
<a href="javascript:;">
<div class="menu">
<img class="titleImg" src="@/assets/images/icon-03.png" />
<div class="left">姓名</div>
<div class="right">{{ userInfo.real_name }}</div>
<div style="clear: both"></div>
</div>
</a>
<a href="javascript:;">
<div class="menu">
<img class="titleImg" src="@/assets/images/icon-04.png" />
<div class="left">會員等級</div>
<div class="right">{{ userInfo.level_name }}</div>
<div style="clear: both"></div>
</div>
</a>
<a href="javascript:;">
<div class="menu">
<img class="titleImg" src="@/assets/images/icon-05.png" />
<div class="left">使用期限</div>
<div class="right">{{ overdue }}</div>
<!-- <div class="right" @click="router.push('/shop/inputsn')" v-if="!is_due">{{overdue}}<br/>點此輸入購買序號</div>
<div class="right input-sn" @click="router.push('/shop/inputsn')" v-else>,<br/>點此輸入購買序號</div> -->
<div style="clear: both"></div>
</div>
</a>
<a href="javascript:;">
<div class="menu">
<img class="titleImg" src="@/assets/images/icon-06.png" />
<div class="left">名片連結</div>
<div class="right" style="color: #fe6867" @click="doCopy">
點擊複製您的連結
</div>
<div style="clear: both"></div>
</div>
</a>
<a href="javascript:;">
<div class="menu" @click="$router.push('/auth/auth')">
<img class="titleImg" src="@/assets/images/icon-04.png" />
<div class="left">授權商務卡片編輯</div>
<div class="right">授權</div>
<div style="clear: both"></div>
</div>
</a>
<a href="javascript:;" @click="$router.push('/auth/getauth')">
<div class="menu">
<img class="titleImg" src="@/assets/images/icon-04.png" />
<div class="left">代客編輯商務卡片</div>
<div class="right">編輯</div>
<div style="clear: both"></div>
</div>
</a>
<a href="javascript:;" v-if="userInfo.uniqid">
<div class="menu">
<img class="titleImg" src="@/assets/images/icon-06.png" />
<div class="left">綁定UTel淘金購會員</div>
<div class="right" style="color: #fe6867" @click="bindTggo">
點擊後前往綁定
</div>
<div style="clear: both"></div>
</div>
</a>
</dl>
<!-- <Footer /> -->
<van-dialog v-model:show="showNfcQrcode" title="電子名片二維碼" :show-cancel-button="true" cancel-button-text=""
:show-confirm-button="false">
<div class="qrcode">
<qrcode-vue :value="userInfo.nfcurl" :size="200" level="M" />
</div>
</van-dialog>
<van-overlay :show="popShow" z-index="1000" :style="{background:'rgba(0, 0, 0, .85)'}">
<div class="wrapper" @click.stop>
<div class="block">
<span class="van-icon van-icon-cross" @click="popShow = false" v-show="current.seconds == 0"></span>
{{ current.seconds }}
</div>
<iframe width="100%" style="aspect-ratio: 16/9;" src="https://www.youtube.com/embed/dUro-rg2Uz8?si=K5lDwRcM1NfNCEUR" title="YouTube video player" frameborder="0" controls="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
</div>
</van-overlay>
</div>
</template>
<style src="@/assets/css/style.css"></style>
<style lang="less" scoped>
[ v-cloak] {
display: none;
}
.recommend {
width: 100%;
padding-top: 2%;
}
.recommend ul {
width: 100%;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.recommend ul li {
box-sizing: content-box;
width: 44%;
height: 50px;
padding: 2%;
display: flex;
flex-direction: column;
margin: 1%;
-webkit-box-shadow: 0 0 2px #fdaf00;
-moz-box-shadow: 0 0 2px #fdaf00;
box-shadow: 0 0 2px #fdaf00;
}
.recommend ul li p {
margin-top: 2%;
font-size: 15px;
color: #333;
}
.recommend ul li span {
font-size: 14px !important;
color: #999 !important;
padding-top: 0.15rem !important;
}
.recommend ul li:nth-child(1) {
background: url(@/assets/images/icon-001.png) right 0.3rem center no-repeat #fff !important;
background-size: 30px !important;
}
.recommend ul li:nth-child(2) {
background: url(@/assets/images/icon-002.png) right 0.3rem center no-repeat #fff !important;
background-size: 30px !important;
}
.recommend ul li:nth-child(3) {
background: url(@/assets/images/icon-003.png) right 0.3rem center no-repeat #fff !important;
background-size: 30px !important;
}
.recommend ul li:nth-child(4) {
background: url(@/assets/images/icon-004.png) right 0.3rem center no-repeat #fff !important;
background-size: 30px !important;
}
.qrcode {
text-align: center;
}
.input-sn {
color: red !important;
}
.cp-btn {
border: #999 1px solid;
padding: 2px;
color: rgb(254, 104, 103);
}
.wrapper{
display: flex;
align-items: center;
height: 100%;
.block{
position:absolute;
color:#ffffff;
border-radius:50%;
top:10px;
right:10px;
margin-left:auto;
.van-icon{
cursor: pointer;
}
}
}
</style>

@ -191,33 +191,49 @@ const searchOnUpdateValue = (newValue) => {
});
};
const tab2result = ref('');
// START:
const search = ref({
type: 0,
keyword: '',
})
const tab2result = ref('你所需要的資源');
const tab2showPicker = ref(false);
const tab2columns = [
{ text: '台北', value: 'Taipei' },
{ text: '桃園', value: 'Taoyuan' },
{ text: '台中', value: 'Taichung' },
{ text: '彰化', value: 'Changhua' },
{ text: '高雄', value: 'Kaohsiung' },
{ text: '你所需要的資源', value: 0 },
{ text: '你能提供的資源', value: 1 },
];
const tab2OnConfirm = ({ selectedOptions }) => {
tab2result.value = selectedOptions[0].text;
search.value.type = selectedOptions[0].value;
tab2showPicker.value = false;
handleSearch();
};
const tab2OnSearch = async () => {
handleSearch();
};
const handleSearch = async () => {
let res = await searchConnection(search.value);
if(res.code===200){
tab2list.value = res.data;
}
// res = await addUserFavi({uf_user_id:form.value.user_id});
// // console.log(res);
// if(res.code===200){
// tab2AddFriend.value = res.data;
// }
};
const tab2list = ref([]);
const tab2Loading = ref(false);
const tab2Finished = ref(false);
const tab2TodoLists = ref([]);
const tab2AddFriend = ref([]);
onBeforeMount(async () => {
let res = await searchConnection();
if(res.code===200){
tab2list.value = res.data;
}
res = await addUserFavi({uf_user_id:form.value.user_id});
// console.log(res);
if(res.code===200){
tab2AddFriend.value = res.data;
}
});
const tab2ListonLoad = () => {
//
@ -237,16 +253,21 @@ const tab2ListonLoad = () => {
// }, 1000);
};
const tab2OnConfirm = ({ selectedOptions }) => {
tab2result.value = selectedOptions[0]?.text;
tab2showPicker.value = false;
};
const handleAddFavi = async (user_id) => {
let res = await addUserFavi({uf_user_id:user_id});
if(res.code===200){
return showToast({
message: '已加入好友',
duration: 1000,
});
}
return showToast({
message: '加入失敗',
duration: 1000,
});
}
// END:
const tab2searchValue = ref('');
const tab2OnSearch = () => {
// tab2TodoLists = tab2list.filter(tab2searchValue);
// console.log(tab2TodoLists)
};
const tab3list = ref([]);
onBeforeMount(async () => {
@ -635,8 +656,8 @@ onBeforeMount(async () => {
is-link
readonly
name="picker"
border="false"
placeholder="縣市"
:border="false"
placeholder="請選擇"
@click="tab2showPicker = true"
/>
<van-popup v-model:show="tab2showPicker" position="bottom">
@ -649,7 +670,7 @@ onBeforeMount(async () => {
</van-col>
<van-col span="16">
<van-search
v-model="tab2searchValue"
v-model="search.keyword"
placeholder="請輸入搜尋關鍵字"
@search="tab2OnSearch"
/>
@ -695,7 +716,7 @@ onBeforeMount(async () => {
<van-button size="normal" class="border-0" data-toggle="collapse" :href="`#c${index}`" role="button" aria-expanded="false" :aria-controls="`c${index}`">
<h5><i class="fa-solid fa-layer-group text-darkBlue"></i></h5>
</van-button>
<van-button size="normal" class="border-0"><h5><i class="fa-solid fa-comment-medical text-darkBlue"></i></h5></van-button>
<van-button size="normal" class="border-0" @click="handleAddFavi(item.user_id)"><h5><i class="fa-solid fa-comment-medical text-darkBlue"></i></h5></van-button>
</div>
<div class="bottom collapse" :id="`c${index}`" data-parent="#accordion">
<h6 class="text-darkBlue"><strong>我能分享的資源</strong></h6>

@ -7,7 +7,7 @@ import { resolve } from 'path';
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
return {
base: '/home',
base: './',
server: {
host: '0.0.0.0',
port: 5173,

Loading…
Cancel
Save