.
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
<template>
|
||||
<view class="user-avatar-card-ctn">
|
||||
<view class="user-avatar-card-ctn" @click="jumpPage">
|
||||
<view class="upper-box">
|
||||
<view class="left-box">
|
||||
<view class="ss-flex" style="align-items: flex-end">
|
||||
<view style="font-size: 36rpx; margin-right: 12rpx">{{
|
||||
userInfo?.nickname || nickname
|
||||
}}</view>
|
||||
<view style="color: #999999; font-size: 24rpx">检测时间:</view>
|
||||
<view style="color: #999999; font-size: 24rpx"
|
||||
>检测时间:{{ detectionTime?.slice(0, 16) }}</view
|
||||
>
|
||||
</view>
|
||||
<view class="ss-flex user-info-block">
|
||||
<view class="user-info-item">{{ userFormData.sex }}</view>
|
||||
@@ -24,7 +26,6 @@
|
||||
: sheep.$url.static('https://puton.huimeimeta.com/imgs/default_avatar.png')
|
||||
"
|
||||
mode="aspectFill"
|
||||
@tap="sheep.$router.go('/pages/user/info')"
|
||||
>
|
||||
</image>
|
||||
</view>
|
||||
@@ -33,22 +34,22 @@
|
||||
<ul class="attr-ul ss-flex">
|
||||
<li class="attr-li">
|
||||
<view class="label">脸型</view>
|
||||
<view class="value">标准脸</view>
|
||||
<view class="value">{{ userFaceInfo.feature }}</view>
|
||||
<view class="line" />
|
||||
</li>
|
||||
<li class="attr-li">
|
||||
<view class="label">肤色</view>
|
||||
<view class="value">冷肤色</view>
|
||||
<view class="value">{{ userFaceInfo.complexion }}</view>
|
||||
<view class="line" />
|
||||
</li>
|
||||
<li class="attr-li">
|
||||
<view class="label">色彩偏好</view>
|
||||
<view class="value">中高明度</view>
|
||||
<view class="label">基因风格</view>
|
||||
<view class="value">{{ userFaceInfo.type }}</view>
|
||||
<view class="line" />
|
||||
</li>
|
||||
<li class="attr-li">
|
||||
<view class="label">色彩定位</view>
|
||||
<view class="value">中高纯度</view>
|
||||
<view class="value">{{ userFaceInfo.sj_color_type }}</view>
|
||||
</li>
|
||||
</ul>
|
||||
</view>
|
||||
@@ -64,6 +65,14 @@
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
userFaceInfo: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
detectionTime: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
});
|
||||
|
||||
// 是否登录
|
||||
@@ -71,6 +80,12 @@
|
||||
|
||||
// 用户信息
|
||||
const userInfo = computed(() => sheep.$store('user').userInfo);
|
||||
|
||||
const jumpPage = () => {
|
||||
uni.switchTab({
|
||||
url: `/pages/index/index`,
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -112,6 +127,7 @@
|
||||
.avatar-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+38
-2
@@ -10,10 +10,11 @@
|
||||
|
||||
<script setup>
|
||||
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 $share from '@/sheep/platform/share';
|
||||
import CoverViewTabbar from '@/pages/index/components/cover-view-tabbar.vue';
|
||||
import { getAccessToken } from '@/sheep/request';
|
||||
|
||||
// 隐藏原生tabBar
|
||||
uni.hideTabBar({
|
||||
@@ -26,6 +27,13 @@
|
||||
|
||||
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) => {
|
||||
// #ifdef MP
|
||||
// 小程序识别二维码
|
||||
@@ -50,9 +58,37 @@
|
||||
if (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>
|
||||
|
||||
<style lang="scss" scoped></style>
|
||||
|
||||
+13
-6
@@ -8,7 +8,12 @@
|
||||
:navbarStyle="template.navigationBar"
|
||||
onShareAppMessage
|
||||
>
|
||||
<userAvatarCard :userFormData="userFormData" />
|
||||
<userAvatarCard
|
||||
:userFormData="userFormData"
|
||||
:userFaceInfo="userFaceInfo"
|
||||
:detectionTime="detectionTime"
|
||||
v-if="userFaceInfo"
|
||||
/>
|
||||
|
||||
<s-block
|
||||
v-for="(item, index) in template.components"
|
||||
@@ -76,19 +81,21 @@
|
||||
async function getPersonalInfo() {
|
||||
const { data } = await UserApi.getInfoByUser();
|
||||
try {
|
||||
const { dataJson } = data;
|
||||
userFormData.value = dataJson ? JSON.parse(dataJson) : {};
|
||||
userFormData.value = data?.dataJson ? JSON.parse(data?.dataJson) : {};
|
||||
} catch (err) {
|
||||
userFormData.value = {};
|
||||
console.log(err);
|
||||
}
|
||||
}
|
||||
|
||||
const userFaceInfo = ref();
|
||||
const detectionTime = ref('');
|
||||
async function getFaceInfo() {
|
||||
await UserApi.getFaceInfo({ dataScope: '0' });
|
||||
const { result } = await UserApi.getFaceInfo({ dataScope: '0' });
|
||||
try {
|
||||
// const { dataJson } = data;
|
||||
// userFormData.value = dataJson ? JSON.parse(dataJson) : {};
|
||||
const dataObj = result?.length ? JSON.parse(result[0].thridResp) : null;
|
||||
userFaceInfo.value = dataObj?.data?.face_figure || null;
|
||||
detectionTime.value = result[0]?.time || '';
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user