feat:性别选择
This commit is contained in:
1 parent
1d63bc414b
commit
55a222e2d6
8 files changed
+94
-9
No files matched your search
@@ -267,6 +267,13 @@
|
||||
"navigationBarTitleText": "关于",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "gender-choose",
|
||||
"style": {
|
||||
"navigationBarTitleText": "选择性别",
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -113,8 +113,7 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<moment-card v-if="listData.length" v-for="item in listData" :data="item" />
|
||||
<view v-else class="flex px-4 py-4">
|
||||
<view v-if="isRefreshing" class="flex px-4 py-4">
|
||||
<wd-skeleton :row-col="[{ size: '50px', type: 'circle' }]" animation="flashed" />
|
||||
<wd-skeleton
|
||||
:custom-style="{ width: '100%', marginLeft: '12px' }"
|
||||
@@ -122,6 +121,8 @@
|
||||
theme="paragraph"
|
||||
/>
|
||||
</view>
|
||||
<moment-card v-else-if="listData.length" v-for="item in listData" :data="item" />
|
||||
<wd-status-tip v-else image="content" tip="暂无内容" />
|
||||
</scroll-list>
|
||||
|
||||
<view class="fixed bottom-100 left-0 right-0 flex justify-around bg-transparent">
|
||||
@@ -194,7 +195,7 @@
|
||||
refreshList();
|
||||
});
|
||||
|
||||
const { listData, loadMoreStatus, refreshList, listLoadMore } = useScroll(
|
||||
const { isRefreshing, listData, loadMoreStatus, refreshList, listLoadMore } = useScroll(
|
||||
RecentApi.quickPage,
|
||||
params,
|
||||
);
|
||||
@@ -308,7 +309,11 @@
|
||||
}
|
||||
|
||||
// 喜欢
|
||||
const handleLike = () => {
|
||||
uni.showToast({ title: '功能开发中...' });
|
||||
const handleLike = async () => {
|
||||
await RecentApi.recentOperate({
|
||||
memberId: userDetail.value.member.memberId,
|
||||
memberRecentId: userDetail.value.id,
|
||||
action: 'MEMBER_COLLECT',
|
||||
});
|
||||
};
|
||||
</script>
|
||||
@@ -0,0 +1,71 @@
|
||||
<template>
|
||||
<wd-config-provider theme="dark">
|
||||
<wd-navbar title="选择性别" fixed safeAreaInsetTop :bordered="false"></wd-navbar>
|
||||
</wd-config-provider>
|
||||
|
||||
<view class="flex-col-center px-6 pt-40">
|
||||
<view class="text-center mb-12 text-base">请选择您的性别</view>
|
||||
|
||||
<view class="flex justify-center gap-6">
|
||||
<view class="flex-col-center">
|
||||
<view
|
||||
class="flex-col-center w-240rpx h-250rpx rounded-full bg-#444 transition-all duration-300 border-2 border-solid"
|
||||
:style="{ border: userInfo.sex === 1 ? '8rpx solid #D29E52' : '8rpx solid transparent' }"
|
||||
@click="userInfo.sex = 1"
|
||||
>
|
||||
<image class="size-120rpx" src="@/static/gender-man.png" mode="aspectFill" />
|
||||
</view>
|
||||
<text class="text-lg mt-1">男</text>
|
||||
</view>
|
||||
|
||||
<view class="flex-col-center">
|
||||
<view
|
||||
class="flex-col-center w-240rpx h-250rpx rounded-full bg-#444 transition-all duration-100 border-2 border-solid"
|
||||
:style="{ border: userInfo.sex === 2 ? '8rpx solid #D29E52' : '8rpx solid transparent' }"
|
||||
@click="userInfo.sex = 2"
|
||||
>
|
||||
<image class="size-120rpx" src="@/static/gender-woman.png" mode="aspectFill" />
|
||||
</view>
|
||||
<text class="text-lg mt-1">女</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="bg-color-theme-dark px-10 py-2 mt-10 text-lg rounded-full c-black active:bg-color-theme"
|
||||
@click="handleSave"
|
||||
>
|
||||
保 存
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
// @ts-ignore
|
||||
import UserApi from '@/sheep/api/member/user';
|
||||
// @ts-ignore
|
||||
import sheep from '@/sheep';
|
||||
|
||||
// sex选中的性别:0-未知,1-男,2-女
|
||||
const userInfo = ref<any>({});
|
||||
|
||||
onLoad(async () => {
|
||||
const { data = null } = await UserApi.getUserInfo();
|
||||
userInfo.value = data ?? [];
|
||||
});
|
||||
|
||||
const handleSave = async () => {
|
||||
if (userInfo.value.sex != 1 && userInfo.value.sex != 2) {
|
||||
sheep.$helper.toast('请选择性别');
|
||||
return;
|
||||
}
|
||||
|
||||
await UserApi.updateUser(userInfo.value);
|
||||
await sheep.$store('user').getInfo();
|
||||
sheep.$helper.toast('保存成功');
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({ url: '/pages/home/home' });
|
||||
}, 500);
|
||||
};
|
||||
</script>
|
||||
@@ -3,7 +3,7 @@
|
||||
<view class="flex px-4 py-2">
|
||||
<image
|
||||
class="w-200rpx h-300rpx mr-3 rounded-2 bg-#777"
|
||||
:src="data.coverPic?.split(',')[0]"
|
||||
:src="member.memberAvatar"
|
||||
mode="aspectFill"
|
||||
/>
|
||||
<view class="flex-1 overflow-hidden">
|
||||
|
||||
@@ -55,6 +55,9 @@ const user = defineStore({
|
||||
return;
|
||||
}
|
||||
this.userInfo = data;
|
||||
if (data.sex !== 1 && data.sex !== 2) {
|
||||
return uni.reLaunch({ url: '/pages/profile/gender-choose' });
|
||||
}
|
||||
return Promise.resolve(data);
|
||||
},
|
||||
|
||||
@@ -112,7 +115,7 @@ const user = defineStore({
|
||||
// 获取最新信息
|
||||
await this.getInfo();
|
||||
this.getWallet();
|
||||
this.getNumData();
|
||||
// this.getNumData(); // 获取订单、优惠券等其他资产信息
|
||||
return this.userInfo;
|
||||
},
|
||||
|
||||
@@ -133,7 +136,7 @@ const user = defineStore({
|
||||
await this.updateUserData();
|
||||
|
||||
// 加载购物车
|
||||
cart().getList();
|
||||
// cart().getList();
|
||||
// 登录后设置全局分享参数
|
||||
$share.getShareInfo();
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 2.8 KiB |
@@ -15,7 +15,6 @@ export default {
|
||||
],
|
||||
shortcuts: [
|
||||
{
|
||||
'border-base': 'border border-gray-500_10',
|
||||
'flex-col-center': 'flex flex-col justify-center items-center',
|
||||
'flex-row-center': 'flex flex-row justify-center items-center',
|
||||
'flex-col': 'flex flex-col',
|
||||
|
||||
Reference in new issue
Block a user