This commit is contained in:
杨鹏
2025-10-12 18:01:59 +08:00
parent 09f8815234
commit e28858a340
6 changed files with 130 additions and 22 deletions
@@ -11,7 +11,7 @@
<block v-if="modelValue.favorite">
<image
class="item-icon"
:src="sheep.$url.static('/static/img/shop/goods/collect_1.gif')"
:src="sheep.$url.static('https://puton.huimeimeta.com/imgs/collect_1.gif')"
mode="aspectFit"
/>
<view class="item-title">已收藏</view>
@@ -19,7 +19,7 @@
<block v-else>
<image
class="item-icon"
:src="sheep.$url.static('/static/img/shop/goods/collect_0.png')"
:src="sheep.$url.static('https://puton.huimeimeta.com/imgs/collect_0.png')"
mode="aspectFit"
/>
<view class="item-title">收藏</view>
@@ -32,7 +32,7 @@
>
<image
class="item-icon"
:src="sheep.$url.static('/static/img/shop/goods/message.png')"
:src="sheep.$url.static('https://puton.huimeimeta.com/imgs/message.png')"
mode="aspectFit"
/>
<view class="item-title">客服</view>
@@ -44,7 +44,7 @@
>
<image
class="item-icon"
:src="sheep.$url.static('/static/img/shop/goods/share.png')"
:src="sheep.$url.static('https://puton.huimeimeta.com/imgs/share.png')"
mode="aspectFit"
/>
<view class="item-title">分享</view>
@@ -119,15 +119,15 @@
if (props.modelValue.favorite) {
const { code } = await FavoriteApi.deleteFavorite(props.modelValue.id);
if (code !== 0) {
return
return;
}
sheep.$helper.toast('取消收藏');
props.modelValue.favorite = false;
// 情况二:添加收藏
// 情况二:添加收藏
} else {
const { code } = await FavoriteApi.createFavorite(props.modelValue.id);
if (code !== 0) {
return
return;
}
sheep.$helper.toast('收藏成功');
props.modelValue.favorite = true;
+12 -5
View File
@@ -6,13 +6,13 @@
<view style="font-size: 36rpx; margin-right: 12rpx">{{
userInfo?.nickname || nickname
}}</view>
<view style="color: #999999; font-size: 24rpx">检测时间2024-08-09 15:51</view>
<view style="color: #999999; font-size: 24rpx">检测时间</view>
</view>
<view class="ss-flex user-info-block">
<view class="user-info-item"></view>
<view class="user-info-item">31</view>
<view class="user-info-item">168cm</view>
<view class="user-info-item">50kg</view>
<view class="user-info-item">{{ userFormData.sex }}</view>
<view class="user-info-item">{{ userFormData.age }}</view>
<view class="user-info-item">{{ userFormData.height }}cm</view>
<view class="user-info-item">{{ userFormData.weight }}kg</view>
</view>
</view>
<view class="right-box">
@@ -59,6 +59,13 @@
import { computed } from 'vue';
import sheep from '@/sheep';
const props = defineProps({
userFormData: {
type: Object,
default: () => {},
},
});
// 是否登录
const isLogin = computed(() => sheep.$store('user').isLogin);
+10 -4
View File
@@ -1,6 +1,6 @@
<template>
<view class="tryOn-ctn">
<view class="title">记录</view>
<view class="title">穿记录</view>
<ul class="record-ul">
<li
class="record-li"
@@ -8,7 +8,7 @@
:key="item.id"
@click="sheep.$router.go('/pages/user/tryOnPreview', {})"
>
<!-- <image class="record-img" mode="aspectFill" /> -->
<image :src="item.tryOnResultUrl" mode="widthFix" style="width: 100%" />
</li>
</ul>
</view>
@@ -18,7 +18,12 @@
import { reactive, ref } from 'vue';
import sheep from '@/sheep';
const recordList = ref([]);
const props = defineProps({
recordList: {
type: Array,
default: () => [],
},
});
</script>
<style lang="scss" scoped>
@@ -48,7 +53,8 @@
.record-li {
width: 25%;
aspect-ratio: 1/1.4;
border: 1rpx solid #000;
border: 1px solid #000;
box-sizing: border-box;
}
}
}
+76 -3
View File
@@ -8,7 +8,8 @@
:navbarStyle="template.navigationBar"
onShareAppMessage
>
<userAvatarCard />
<userAvatarCard :userFormData="userFormData" />
<s-block
v-for="(item, index) in template.components"
:key="index"
@@ -16,7 +17,17 @@
>
<s-block-item :type="item.id" :data="item.property" :styles="item.property.style" />
</s-block>
<userTryOn />
<userTryOn :recordList="dataState.pagination.list" />
<uni-load-more
v-if="dataState.pagination.total > 0"
:status="dataState.loadStatus"
:content-text="{
contentdown: '上拉加载更多',
}"
@tap="loadMore"
/>
<view class="logout-box" v-if="isLogin">
<button class="ss-rest-button logout-btn" @click="handleLayout">退出登录</button>
@@ -31,11 +42,19 @@
<script setup>
import { computed, reactive, ref } from 'vue';
import { onShow, onPageScroll, onPullDownRefresh } from '@dcloudio/uni-app';
import {
onShow,
onPageScroll,
onPullDownRefresh,
onReachBottom,
onLoad,
} from '@dcloudio/uni-app';
import sheep from '@/sheep';
import _ from 'lodash-es';
import userAvatarCard from './components/user-avatar-card.vue';
import userTryOn from './components/user-tryOn.vue';
import AuthUtil from '@/sheep/api/member/auth';
import UserApi from '@/sheep/api/member/user';
// 隐藏原生tabBar
uni.hideTabBar({
@@ -47,8 +66,23 @@
onShow(() => {
sheep.$store('user').updateUserData();
getInfo();
getTryOnList();
});
const userFormData = ref({});
async function getInfo() {
const { data } = await UserApi.getInfoByUser();
try {
const { dataJson } = data;
userFormData.value = dataJson ? JSON.parse(dataJson) : {};
} catch (err) {
userFormData.value = {};
console.log(err);
}
}
onPullDownRefresh(() => {
sheep.$store('user').updateUserData();
setTimeout(function () {
@@ -79,6 +113,45 @@
},
});
};
const dataState = reactive({
pagination: {
list: [],
total: 0,
pageNo: 1,
pageSize: 10,
},
loadStatus: '',
});
async function getTryOnList() {
dataState.loadStatus = 'loading';
const { code, data } = await UserApi.getTryOnList({
pageNo: dataState.pagination.pageNo,
pageSize: dataState.pagination.pageSize,
});
if (code !== 0) {
return;
}
dataState.pagination.list = _.concat(dataState.pagination.list, data.list);
dataState.pagination.total = data.total;
dataState.loadStatus =
dataState.pagination.list.length < dataState.pagination.total ? 'more' : 'noMore';
}
// 加载更多
function loadMore() {
if (dataState.loadStatus === 'noMore') {
return;
}
dataState.pagination.pageNo++;
getTryOnList();
}
// 上拉加载更多
onReachBottom(() => {
loadMore();
});
</script>
<style lang="scss" scoped>
+23 -1
View File
@@ -79,7 +79,29 @@ const UserApi = {
}
});
},
// 获取h5填写的表单信息
getInfoByUser: () => {
return request({
url: '/digital/records/get-by-user-id',
method: 'GET',
custom: {
showLoading: false,
auth: true,
},
});
},
// 获取试穿记录
getTryOnList: (params = {}) => {
return request({
url: '/digital/on-record/page',
method: 'GET',
params,
custom: {
showLoading: false,
auth: true,
},
});
},
};
export default UserApi;
+2 -2
View File
@@ -1,7 +1,7 @@
<!-- 装修用户组件用户卡片 -->
<template>
<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="avatar-box ss-m-r-24">
<image
@@ -27,7 +27,7 @@
<text class="sicon-qrcode"></text>
</button>
</view>
</view>
</view> -->
<!-- 提示绑定手机号 先隐藏 yudao 需要再修改 -->
<view