.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user