This commit is contained in:
杨鹏
2025-10-15 17:11:33 +08:00
parent c05f6e540d
commit c3fd0c2e00
4 changed files with 77 additions and 18 deletions
+24 -8
View File
@@ -1,12 +1,14 @@
<template> <template>
<view class="user-avatar-card-ctn"> <view class="user-avatar-card-ctn" @click="jumpPage">
<view class="upper-box"> <view class="upper-box">
<view class="left-box"> <view class="left-box">
<view class="ss-flex" style="align-items: flex-end"> <view class="ss-flex" style="align-items: flex-end">
<view style="font-size: 36rpx; margin-right: 12rpx">{{ <view style="font-size: 36rpx; margin-right: 12rpx">{{
userInfo?.nickname || nickname userInfo?.nickname || nickname
}}</view> }}</view>
<view style="color: #999999; font-size: 24rpx">检测时间</view> <view style="color: #999999; font-size: 24rpx"
>检测时间{{ detectionTime?.slice(0, 16) }}</view
>
</view> </view>
<view class="ss-flex user-info-block"> <view class="ss-flex user-info-block">
<view class="user-info-item">{{ userFormData.sex }}</view> <view class="user-info-item">{{ userFormData.sex }}</view>
@@ -24,7 +26,6 @@
: sheep.$url.static('https://puton.huimeimeta.com/imgs/default_avatar.png') : sheep.$url.static('https://puton.huimeimeta.com/imgs/default_avatar.png')
" "
mode="aspectFill" mode="aspectFill"
@tap="sheep.$router.go('/pages/user/info')"
> >
</image> </image>
</view> </view>
@@ -33,22 +34,22 @@
<ul class="attr-ul ss-flex"> <ul class="attr-ul ss-flex">
<li class="attr-li"> <li class="attr-li">
<view class="label">脸型</view> <view class="label">脸型</view>
<view class="value">标准脸</view> <view class="value">{{ userFaceInfo.feature }}</view>
<view class="line" /> <view class="line" />
</li> </li>
<li class="attr-li"> <li class="attr-li">
<view class="label">肤色</view> <view class="label">肤色</view>
<view class="value">冷肤色</view> <view class="value">{{ userFaceInfo.complexion }}</view>
<view class="line" /> <view class="line" />
</li> </li>
<li class="attr-li"> <li class="attr-li">
<view class="label">色彩偏好</view> <view class="label">基因风格</view>
<view class="value">中高明度</view> <view class="value">{{ userFaceInfo.type }}</view>
<view class="line" /> <view class="line" />
</li> </li>
<li class="attr-li"> <li class="attr-li">
<view class="label">色彩定位</view> <view class="label">色彩定位</view>
<view class="value">中高纯度</view> <view class="value">{{ userFaceInfo.sj_color_type }}</view>
</li> </li>
</ul> </ul>
</view> </view>
@@ -64,6 +65,14 @@
type: Object, type: Object,
default: () => {}, default: () => {},
}, },
userFaceInfo: {
type: Object,
default: () => {},
},
detectionTime: {
type: String,
default: '',
},
}); });
// 是否登录 // 是否登录
@@ -71,6 +80,12 @@
// 用户信息 // 用户信息
const userInfo = computed(() => sheep.$store('user').userInfo); const userInfo = computed(() => sheep.$store('user').userInfo);
const jumpPage = () => {
uni.switchTab({
url: `/pages/index/index`,
});
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -112,6 +127,7 @@
.avatar-img { .avatar-img {
width: 100%; width: 100%;
height: 100%; height: 100%;
border-radius: 50%;
} }
} }
} }
+38 -2
View File
@@ -10,10 +10,11 @@
<script setup> <script setup>
import { computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { onLoad, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app'; import { onLoad, onUnload, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
import sheep from '@/sheep'; import sheep from '@/sheep';
import $share from '@/sheep/platform/share'; import $share from '@/sheep/platform/share';
import CoverViewTabbar from '@/pages/index/components/cover-view-tabbar.vue'; import CoverViewTabbar from '@/pages/index/components/cover-view-tabbar.vue';
import { getAccessToken } from '@/sheep/request';
// 隐藏原生tabBar // 隐藏原生tabBar
uni.hideTabBar({ uni.hideTabBar({
@@ -26,6 +27,13 @@
const template = computed(() => sheep.$store('app').template?.home); const template = computed(() => sheep.$store('app').template?.home);
const tokenCheckTimer = ref(null);
const token = ref('');
const url = ref(
`https://fitting-room.huimeimeta.com/pages/report/index?token=${getAccessToken()}&t=${Date.now()}`,
);
onLoad((options) => { onLoad((options) => {
// #ifdef MP // #ifdef MP
// 小程序识别二维码 // 小程序识别二维码
@@ -50,9 +58,37 @@
if (options.page) { if (options.page) {
sheep.$router.go(decodeURIComponent(options.page)); sheep.$router.go(decodeURIComponent(options.page));
} }
token.value = getAccessToken();
startTokenListener();
}); });
const url = ref('https://fitting-room.huimeimeta.com/pages/report/index'); onUnload(() => {
stopTokenListener();
});
function checkTokenUpdate() {
const currentToken = getAccessToken() || '';
if (currentToken !== token.value) {
console.log('检测到token变化,更新H5页面');
token.value = currentToken;
url.value = `https://fitting-room.huimeimeta.com/pages/report/index?token=${currentToken}&t=${Date.now()}`;
}
}
function stopTokenListener() {
if (tokenCheckTimer.value) {
clearInterval(tokenCheckTimer.value);
tokenCheckTimer.value = null;
}
}
function startTokenListener() {
tokenCheckTimer.value = setInterval(() => {
checkTokenUpdate();
}, 1000);
}
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>
+13 -6
View File
@@ -8,7 +8,12 @@
:navbarStyle="template.navigationBar" :navbarStyle="template.navigationBar"
onShareAppMessage onShareAppMessage
> >
<userAvatarCard :userFormData="userFormData" /> <userAvatarCard
:userFormData="userFormData"
:userFaceInfo="userFaceInfo"
:detectionTime="detectionTime"
v-if="userFaceInfo"
/>
<s-block <s-block
v-for="(item, index) in template.components" v-for="(item, index) in template.components"
@@ -76,19 +81,21 @@
async function getPersonalInfo() { async function getPersonalInfo() {
const { data } = await UserApi.getInfoByUser(); const { data } = await UserApi.getInfoByUser();
try { try {
const { dataJson } = data; userFormData.value = data?.dataJson ? JSON.parse(data?.dataJson) : {};
userFormData.value = dataJson ? JSON.parse(dataJson) : {};
} catch (err) { } catch (err) {
userFormData.value = {}; userFormData.value = {};
console.log(err); console.log(err);
} }
} }
const userFaceInfo = ref();
const detectionTime = ref('');
async function getFaceInfo() { async function getFaceInfo() {
await UserApi.getFaceInfo({ dataScope: '0' }); const { result } = await UserApi.getFaceInfo({ dataScope: '0' });
try { try {
// const { dataJson } = data; const dataObj = result?.length ? JSON.parse(result[0].thridResp) : null;
// userFormData.value = dataJson ? JSON.parse(dataJson) : {}; userFaceInfo.value = dataObj?.data?.face_figure || null;
detectionTime.value = result[0]?.time || '';
} catch (err) { } catch (err) {
console.log(err); console.log(err);
} }
+2 -2
View File
@@ -1,7 +1,7 @@
<!-- 装修用户组件用户卡片 --> <!-- 装修用户组件用户卡片 -->
<template> <template>
<view class="ss-user-info-wrap ss-p-t-50" :style="[bgStyle, { marginLeft: `${data.space}px` }]"> <view class="ss-user-info-wrap ss-p-t-50" :style="[bgStyle, { marginLeft: `${data.space}px` }]">
<!-- <view class="ss-flex ss-col-center ss-row-between ss-m-b-20"> <view class="ss-flex ss-col-center ss-row-between ss-m-b-20">
<view class="left-box ss-flex ss-col-center ss-m-l-36"> <view class="left-box ss-flex ss-col-center ss-m-l-36">
<view class="avatar-box ss-m-r-24"> <view class="avatar-box ss-m-r-24">
<image <image
@@ -27,7 +27,7 @@
<text class="sicon-qrcode"></text> <text class="sicon-qrcode"></text>
</button> </button>
</view> </view>
</view> --> </view>
<!-- 提示绑定手机号 先隐藏 yudao 需要再修改 --> <!-- 提示绑定手机号 先隐藏 yudao 需要再修改 -->
<view <view