整合api请求、添加购买会员卡页面、登陆页面

This commit is contained in:
future
2026-06-23 22:17:53 +08:00
parent 1c547a717e
commit 8d8c823616
70 changed files with 7666 additions and 2656 deletions
@@ -3,97 +3,99 @@
<view class="bt-page">
<MemberInfoSubNav title="体测设置" @back="onBack" />
<view class="bt-page__body">
<view class="bt-card">
<text class="bt-card__title">连接与同步</text>
<view class="bt-setting">
<view>
<text class="bt-setting__label">蓝牙自动连接</text>
<text class="bt-setting__desc">进入体测页时自动搜索已配对设备</text>
</view>
<switch
:checked="settings.bluetoothEnabled"
color="#FF6B35"
@change="onSwitch('bluetoothEnabled', $event)"
/>
</view>
<view class="bt-setting">
<view>
<text class="bt-setting__label">测量完成自动同步</text>
<text class="bt-setting__desc">结果自动保存至云端与本地</text>
</view>
<switch
:checked="settings.autoSync"
color="#FF6B35"
@change="onSwitch('autoSync', $event)"
/>
</view>
</view>
<view class="bt-card">
<text class="bt-card__title">通知与隐私</text>
<view class="bt-setting">
<view>
<text class="bt-setting__label">测量完成通知</text>
<text class="bt-setting__desc">体测结束后推送报告摘要</text>
</view>
<switch
:checked="settings.notifyOnComplete"
color="#FF6B35"
@change="onSwitch('notifyOnComplete', $event)"
/>
</view>
<view class="bt-setting">
<view>
<text class="bt-setting__label">分享时匿名化</text>
<text class="bt-setting__desc">隐藏姓名与手机号</text>
</view>
<switch
:checked="settings.shareAnonymous"
color="#FF6B35"
@change="onSwitch('shareAnonymous', $event)"
/>
</view>
</view>
<view class="bt-card">
<text class="bt-card__title">单位制</text>
<view class="bt-setting">
<view>
<text class="bt-setting__label">度量单位</text>
<text class="bt-setting__desc">{{ unitLabel }}</text>
</view>
<view
hover-class="mi-tap--hover"
:hover-stay-time="150"
@tap="toggleUnit"
>
<text style="font-size: 14px; color: #1A4A6F; font-weight: 600;">切换</text>
<view class="bt-setting-row" @tap="toggleUnit">
<text class="bt-setting-row__label">单位制</text>
<view class="bt-setting-row__value">
<text class="bt-setting-row__text">{{ unitLabel }}</text>
<image
class="bt-setting-row__arrow"
src="https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/images/rightarrow.png"
mode="aspectFit"
/>
</view>
</view>
</view>
<view class="bt-card">
<text class="bt-card__title">设备管理</text>
<view class="bt-device">
<view class="bt-device__icon-wrap">
<image class="bt-device__icon" src="https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/images/mappin2.png" mode="aspectFit" />
<view class="bt-device-row">
<view class="bt-device-row__icon">
<image
src="https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/images/bluetooth.png"
mode="aspectFit"
/>
</view>
<view class="bt-device__info">
<text class="bt-device__name">{{ device.name }}</text>
<text class="bt-device__status">
{{ device.connected ? '已连接' : '未连接' }}
· 上次 {{ device.lastConnected || '--' }}
<view class="bt-device-row__info">
<text class="bt-device-row__name">{{ device.name || '未连接设备' }}</text>
<text class="bt-device-row__status">
{{ device.connected ? `已连接 · 电量 ${device.battery}%` : '点击连接体脂秤' }}
</text>
</view>
<view
v-if="device.connected"
class="bt-device-row__disconnect"
hover-class="mi-tap-btn--hover"
@tap="disconnect"
>
<text class="bt-device-row__disconnect-text">解除</text>
</view>
</view>
<view
class="bt-btn bt-btn--outline"
style="margin-top: 12px;"
hover-class="mi-tap-btn--hover"
:hover-stay-time="150"
@tap="disconnect"
>
<text class="bt-btn__text">解除设备配对</text>
</view>
<view class="bt-card">
<text class="bt-card__title">通知提醒</text>
<view class="bt-setting-row">
<text class="bt-setting-row__label">体测提醒</text>
<switch
:checked="settings.remindEnabled"
@change="(e) => onSwitch('remindEnabled', e)"
/>
</view>
<view v-if="settings.remindEnabled" class="bt-setting-row">
<text class="bt-setting-row__label">提醒周期</text>
<picker
mode="selector"
:range="['每周', '每两周', '每月']"
:value="settings.remindInterval"
@change="(e) => onSwitch('remindInterval', e)"
>
<view class="bt-setting-row__value">
<text class="bt-setting-row__text">
{{ ['每周', '每两周', '每月'][settings.remindInterval] }}
</text>
<image
class="bt-setting-row__arrow"
src="https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/images/rightarrow.png"
mode="aspectFit"
/>
</view>
</picker>
</view>
</view>
<view class="bt-card">
<text class="bt-card__title">隐私设置</text>
<view class="bt-setting-row">
<text class="bt-setting-row__label">数据可见性</text>
<picker
mode="selector"
:range="['仅本人', '教练可见', '完全公开']"
:value="settings.privacy"
@change="(e) => onSwitch('privacy', e)"
>
<view class="bt-setting-row__value">
<text class="bt-setting-row__text">
{{ ['仅本人', '教练可见', '完全公开'][settings.privacy] }}
</text>
<image
class="bt-setting-row__arrow"
src="https://gymfuture.oss-cn-chengdu.aliyuncs.com/static/images/rightarrow.png"
mode="aspectFit"
/>
</view>
</picker>
</view>
</view>
</view>
@@ -101,7 +103,8 @@
</view>
</template>
<script>
<script setup>
import { ref, computed } from 'vue'
import MemberInfoSubNav from '@/components/memberInfo/MemberInfoSubNav.vue'
import { PAGE, goBackOrTab } from '@/common/constants/routes.js'
import {
@@ -113,65 +116,59 @@ import {
disconnectBodyTestDevice
} from '@/common/memberInfo/bodyTestStore.js'
export default {
components: { MemberInfoSubNav },
data() {
return {
settings: {},
device: {}
}
},
computed: {
unitLabel() {
return this.settings.unitSystem === 'imperial' ? '英制 (lb / in)' : '公制 (kg / cm)'
}
},
onShow() {
this.refreshFromStore()
},
methods: {
refreshFromStore() {
const store = loadMemberStore()
this.settings = { ...store.bodyTest.settings }
this.device = { ...store.bodyTest.device }
},
onBack() {
goBackOrTab(PAGE.BODY_TEST_HOME)
},
onSwitch(key, e) {
const store = loadMemberStore()
updateBodyTestSettings(store, { [key]: e.detail.value })
persistMemberStore(store)
this.settings = { ...store.bodyTest.settings }
uni.showToast({ title: '已保存', icon: 'success' })
},
toggleUnit() {
const store = loadMemberStore()
const next = this.settings.unitSystem === 'metric' ? 'imperial' : 'metric'
updateBodyTestSettings(store, { unitSystem: next })
persistMemberStore(store)
this.settings = { ...store.bodyTest.settings }
uni.showToast({ title: `已切换为${this.unitLabel}`, icon: 'none' })
},
disconnect() {
uni.showModal({
title: '解除配对',
content: '解除后下次体测需重新连接设备,确定继续?',
success: (res) => {
if (!res.confirm) return
const store = loadMemberStore()
disconnectBodyTestDevice(store)
persistMemberStore(store)
this.refreshFromStore()
uni.showToast({ title: '已解除配对', icon: 'success' })
}
})
}
}
const settings = ref({})
const device = ref({})
const unitLabel = computed(() => {
return settings.value.unitSystem === 'imperial' ? '英制 (lb / in)' : '公制 (kg / cm)'
})
function refreshFromStore() {
const store = loadMemberStore()
settings.value = { ...store.bodyTest.settings }
device.value = { ...store.bodyTest.device }
}
function onBack() {
goBackOrTab(PAGE.BODY_TEST_HOME)
}
function onSwitch(key, e) {
const store = loadMemberStore()
updateBodyTestSettings(store, { [key]: e.detail.value })
persistMemberStore(store)
refreshFromStore()
uni.showToast({ title: '已保存', icon: 'success' })
}
function toggleUnit() {
const store = loadMemberStore()
const next = settings.value.unitSystem === 'metric' ? 'imperial' : 'metric'
updateBodyTestSettings(store, { unitSystem: next })
persistMemberStore(store)
refreshFromStore()
uni.showToast({ title: `已切换为${unitLabel.value}`, icon: 'none' })
}
function disconnect() {
uni.showModal({
title: '解除配对',
content: '解除后下次体测需重新连接设备,确定继续?',
success: (res) => {
if (!res.confirm) return
const store = loadMemberStore()
disconnectBodyTestDevice(store)
persistMemberStore(store)
refreshFromStore()
uni.showToast({ title: '已解除配对', icon: 'success' })
}
})
}
refreshFromStore()
</script>
<style>
<style lang="scss">
@import '@/common/style/base.css';
@import '@/common/style/memberInfo/pages/page-reset.css';
@import '@/common/style/memberInfo/pages/sub-page-base.css';