頁面修改、api串接

main
DESKTOP-8UQ1PPR\09158 2 years ago
parent c8c4d6e1c5
commit d07a8c2f8d

@ -76,6 +76,9 @@ export const getMarquee = async () =>
ajax(`/ads/getMarquee`);
//通訊錄
export const getUserFaviList = async (params) =>
ajax(`/UserFavi/getUserFaviList`, params , "GET");
export const addUserFavi = async (params) =>
ajax(`/UserFavi/addUserFavi`, params , "POST");

@ -3,11 +3,50 @@ import liff from "@line/liff";
import { showToast,showSuccessToast } from 'vant';
import { getUserFaviList, updateUserInfo, updateCard, searchConnection, addUserFavi, setUserNfcTpl } from '@/api'
import { onMounted, reactive, ref, toRefs, computed, watch } from 'vue'
const setShowPicker = ref(false);
const selectVal1 = ref(0);
const selectVal2 = ref('a');
const selectOpt1 = [
{ text: '全部商品', value: 0 },
{ text: '新款商品', value: 1 },
{ text: '活动商品', value: 2 },
];
const selectOpt2 = [
{ text: '默认排序', value: 'a' },
{ text: '好评排序', value: 'b' },
{ text: '销量排序', value: 'c' },
];
const elitelist = ref([
{
avatar:"https://fakeimg.pl/250x100/",
real_name:"樹林李敏鎬",
introduction:"test",
},
{
avatar:"https://fakeimg.pl/250x100/",
real_name:"樹林李敏鎬",
introduction:"test",
},
{
avatar:"https://fakeimg.pl/250x100/",
real_name:"樹林李敏鎬",
introduction:"test",
},
]);
// let res = await getUserFaviList();
// if (res.code === 200) {
// elitelist.value.data = res.data;
// console.log(elitelist)
// }
@ -28,23 +67,103 @@ const setShowPicker = ref(false);
<template #left>
<h4><i class="fa-solid fa-angle-left text-white" :style="{opacity:0.5}"></i></h4>
</template>
<template #right>
<h4><i class="fa-solid fa-sliders text-white" :style="{opacity:0.5}"></i></h4>
</template>
</van-nav-bar>
<van-popup v-model:show="setShowPicker" position="bottom">
<van-picker
:columns="setColumns"
@confirm="setConfirm"
@cancel="setShowPicker = false"
/>
</van-popup>
<div class="content">
<van-cell-group inset>
<van-dropdown-menu>
<van-dropdown-item v-model="selectVal1" :options="selectOpt1" />
<van-dropdown-item v-model="selectVal2" :options="selectOpt2" />
</van-dropdown-menu>
</van-cell-group>
<van-cell-group inset>
<!-- <van-list v-model:loading="loading" :finished="finished" finished-text="" @load="tab2ListonLoad" -->
<van-list class="accordion" id="accordion">
<div class="list-item" v-for="(item, index) in elitelist" :key="index">
<div class="left">
<div class="avatar"><img :src="item.avatar"></div>
<div class="text">
<h5 class="name ellipsis">{{ item.real_name }}</h5>
<div class="desc ellipsis">@{{ item.introduction }}</div>
</div>
</div>
<div class="right">
<van-button size="small" class="border-0">
<h5><i class="fa-solid fa-share-nodes text-darkBlue"></i></h5>
</van-button>
</div>
</div>
</van-list>
</van-cell-group>
</div>
</div>
</template>
<style lang="less" scoped>
.content{
min-height: calc(100vh - 54px);
}
.van-list {
.list-item {
display: flex;
align-items: center;
flex-wrap: wrap;
padding: 15px 0;
margin: 0 15px;
border-bottom: 1px #e3e3e3 solid;
.left {
flex: 1 0 0%;
display: flex;
align-items: center;
.avatar {
width: 55px;
min-width: 55px;
aspect-ratio: 1/1;
border-radius: 50%;
margin-right: 10px;
overflow: hidden;
img {
width: 100%;
height: 100%;
object-fit: cover;
}
}
.name {
font-weight: bold;
}
}
.right {
flex: 0 0 auto;
}
.bottom {
flex: 1 0 100%;
border: 1px #e3e3e3 solid;
border-radius: 10px;
padding: 0 10px;
margin: 0;
transition: all .2s;
&.show {
padding: 10px;
margin: 5px 0;
}
}
}
}
</style>

@ -25,6 +25,7 @@ const cardStore = useCardStore();
const showShare = ref(false);
const showNfcQrcode = ref(false);
const showQrcode = ref(false);
const checked = ref(true);
const imageUrl = ref(import.meta.env.VITE_APP_BASE_URL);
@ -135,10 +136,8 @@ const noticeClick = (num) => {
};
const handleAD = async () => {
if(userInfo.value.status === 1){
return;
}
console.log(userInfo.value);
if(userInfo.value.status !== 1){
let res;
res = await getMarquee();
if (res.code === 200) {
@ -146,21 +145,17 @@ const handleAD = async () => {
}
res = await getMovie();
if (res.code === 200) {
adData.value = res.data;
if (sessionStorage.getItem("isAdShow") == null) {
popShow.value = true;
}
}
};
// sessionStorage.setItem("isAdShow",false);
const popShow = ref(false);
const modalClose = ref(false);
const closeShow = () => {
sessionStorage.setItem("isAdShow", userInfo.value.level_name);
modalClose.value = true;
};
@ -218,6 +213,10 @@ const onSelect = (option) => {
showShare.value = false;
};
const handleShow = () => {
showQrcode.value = true;
};
const handleShowNfc = () => {
showNfcQrcode.value = true;
};
@ -252,7 +251,6 @@ const handleLogout = () => {
}
sessionStorage.removeItem("token");
sessionStorage.removeItem("uid");
sessionStorage.removeItem("isAdShow");
router.push("/login");
};
@ -302,11 +300,11 @@ const handleLogout = () => {
<h5 class="conpany">{{ userInfo.company }}</h5>
</div>
</div>
<div class="right">
<!-- <div class="right">
<div class="btn btn-sm text-darkBlue" @click="doShare">
<h4><i class="fa-solid fa-clone"></i></h4>
</div>
</div>
</div> -->
</div>
<div class="recommend">
@ -351,15 +349,27 @@ const handleLogout = () => {
<van-field :model-value="overdue" input-align="right" readonly>
<template #label><i class="fa-regular fa-fw fa-calendar-check"></i> 使用期限</template>
</van-field>
<van-field input-align="right" readonly>
<template #label><i class="fa-solid fa-fw fa-qrcode"></i> QRcode</template>
<template #button><van-button size="small" class="bg-darkBlue text-white border-0"
@click="handleShowNfc">開啟掃描</van-button></template>
<van-field input-align="right" class="longText" readonly>
<template #label><i class="fa-solid fa-fw fa-handshake-angle"></i> 分享加入</template>
<template #button>
<van-button size="small" class="btn-outline-skyBlue mr-1"
@click="handleShow"><i class="fa-solid fa-qrcode"></i> QRcode
</van-button>
<van-button size="small" class="btn-outline-skyBlue"
@click="doShare"><i class="fa-regular fa-copy"></i> 複製連結
</van-button>
</template>
</van-field>
<van-field input-align="right" readonly>
<template #label><i class="fa-solid fa-fw fa-link"></i> 名片連結</template>
<template #button><van-button size="small" class="bg-tomatoRed text-white border-0"
@click="doCopy">複製連結</van-button></template>
<van-field input-align="right" class="longText" readonly>
<template #label><i class="fa-solid fa-fw fa-chess-board"></i> NFC名片</template>
<template #button>
<van-button size="small" class="btn-outline-skyBlue mr-1"
@click="handleShowNfc"><i class="fa-solid fa-qrcode"></i> QRcode
</van-button>
<van-button size="small" class="btn-outline-skyBlue"
@click="doCopy"><i class="fa-regular fa-copy"></i> 複製連結
</van-button>
</template>
</van-field>
</van-cell-group>
@ -424,7 +434,14 @@ const handleLogout = () => {
</div>
<van-dialog v-model:show="showNfcQrcode" title="電子名片二維碼" :show-cancel-button="true" cancel-button-text=""
<van-dialog v-model:show="showQrcode" title="會員加入分享" :show-cancel-button="true" cancel-button-text=""
:show-confirm-button="false">
<div class="qrcode text-center pt-3">
<qrcode-vue :value="userInfo.referurl" :size="200" level="M" />
</div>
</van-dialog>
<van-dialog v-model:show="showNfcQrcode" title="NFC名片分享" :show-cancel-button="true" cancel-button-text=""
:show-confirm-button="false">
<div class="qrcode text-center pt-3">
<qrcode-vue :value="userInfo.nfcurl" :size="200" level="M" />

@ -797,6 +797,10 @@ const handleChangeTplSubmit = async() => {
<style src="@/assets/css/main.css"></style>
<style lang="less" scoped>
.content{
min-height: calc(100vh - 142px);
}
.cnt2 {
.van-list {
.list-item {

@ -29,6 +29,7 @@ const activeName = ref('0');
let flexRef = ref(null)
const userInfo = computed(() => {
console.log(store.state.user.userInfo,"AA");
return store.state.user.userInfo
})
@ -51,6 +52,7 @@ watch(() => activeName.value, function (newVal, oldVal) {
}
}, { immediate: true })
watch(() => userInfo.value.cus_card, function (newVal, oldVal) {
if (userInfo.value.level > 1 && newVal.length > 0) {
state.value.showCusCard = true
@ -68,8 +70,8 @@ async function showFlex(id) {
case '0':
let { data: res } = await getCard({ userid: sessionStorage.getItem('uid') })
let { card } = cardFactory({ tid: userInfo.value.nc_template, vcard: res })
state.value.flexContent = genAdCard(JSON.parse(card));
// state.value.flexContent = JSON.parse(card)
// state.value.flexContent = genAdCard(JSON.parse(card));
state.value.flexContent = JSON.parse(card)
flexRef.value.innerHTML = ''
flex2html("flex", state.value.flexContent)
// console.log(flex2html("flex", state.value.flexContent),"flex2html");

Loading…
Cancel
Save