feat:登录注册完成

This commit is contained in:
李伊帆
2026-10-09 14:29:58 +08:00
parent da83a58948
commit ee3ecc00eb
106 changed files with 4937 additions and 59 deletions

View File

@@ -0,0 +1,132 @@
<template>
<view class="pair-check-list">
<text class="pair-check-list__title">配对自检</text>
<view
v-for="(item, index) in items"
:key="item.id"
class="pair-check-list__row"
:class="{ 'pair-check-list__row--border': index < items.length - 1 }"
>
<view
class="pair-check-list__status"
:class="`pair-check-list__status--${item.status}`"
>
<text v-if="item.status === 'done'" class="pair-check-list__check">✓</text>
</view>
<text class="pair-check-list__label">{{ item.title }}</text>
<view
class="pair-check-list__tag"
:class="`pair-check-list__tag--${item.status}`"
>
<text class="pair-check-list__tag-text">{{ item.tag }}</text>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import type { PairCheckItem } from '../../pair.types'
defineProps<{
items: PairCheckItem[]
}>()
</script>
<style lang="scss" scoped>
.pair-check-list {
margin: 0 32rpx 24rpx;
padding: 28rpx 24rpx 8rpx;
background: #fff;
border-radius: 20rpx;
box-shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.04);
}
.pair-check-list__title {
display: block;
font-size: 30rpx;
font-weight: 600;
color: $color-text;
margin-bottom: 8rpx;
}
.pair-check-list__row {
display: flex;
align-items: center;
gap: 16rpx;
padding: 24rpx 0;
}
.pair-check-list__row--border {
border-bottom: 1rpx solid #f0f0f0;
}
.pair-check-list__status {
width: 36rpx;
height: 36rpx;
border-radius: 50%;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
}
.pair-check-list__status--done {
background: $color-primary;
}
.pair-check-list__status--syncing {
background: #ff9f43;
}
.pair-check-list__status--pending {
background: #e8eaed;
}
.pair-check-list__check {
font-size: 22rpx;
color: #fff;
font-weight: 700;
line-height: 1;
}
.pair-check-list__label {
flex: 1;
font-size: 28rpx;
color: $color-text;
}
.pair-check-list__tag {
padding: 8rpx 20rpx;
border-radius: 999rpx;
flex-shrink: 0;
}
.pair-check-list__tag--done {
background: #effbf4;
}
.pair-check-list__tag--syncing {
background: #fff4e8;
}
.pair-check-list__tag--pending {
background: #f5f6f8;
}
.pair-check-list__tag-text {
font-size: 24rpx;
font-weight: 500;
}
.pair-check-list__tag--done .pair-check-list__tag-text {
color: $color-primary;
}
.pair-check-list__tag--syncing .pair-check-list__tag-text {
color: #e67a2e;
}
.pair-check-list__tag--pending .pair-check-list__tag-text {
color: #98a2b3;
}
</style>

View File

@@ -0,0 +1,90 @@
<template>
<view class="pair-device-summary">
<image class="pair-device-summary__thumb" :src="thumbSrc" mode="aspectFill" />
<view class="pair-device-summary__info">
<text class="pair-device-summary__name">{{ device.name }}</text>
<text class="pair-device-summary__serial">设备编号:{{ device.serialMasked }}</text>
</view>
<view class="pair-device-summary__status">
<view class="pair-device-summary__status-dot" />
<text class="pair-device-summary__status-text">连接中</text>
</view>
</view>
</template>
<script setup lang="ts">
import { staticAssets } from '@/utils/static-assets'
import type { PairDeviceInfo } from '../../pair.types'
withDefaults(
defineProps<{
device: PairDeviceInfo
thumbSrc?: string
}>(),
{ thumbSrc: staticAssets.logo },
)
</script>
<style lang="scss" scoped>
.pair-device-summary {
margin: 0 32rpx;
padding: 24rpx;
background: #fff;
border-radius: 20rpx;
box-shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.04);
display: flex;
align-items: center;
gap: 20rpx;
}
.pair-device-summary__thumb {
width: 88rpx;
height: 88rpx;
border-radius: 16rpx;
background: #f0f2f5;
flex-shrink: 0;
}
.pair-device-summary__info {
flex: 1;
min-width: 0;
}
.pair-device-summary__name {
display: block;
font-size: 30rpx;
font-weight: 600;
color: $color-text;
margin-bottom: 8rpx;
}
.pair-device-summary__serial {
display: block;
font-size: 24rpx;
color: $color-text-secondary;
}
.pair-device-summary__status {
display: flex;
align-items: center;
gap: 8rpx;
padding: 10rpx 16rpx;
background: #effbf4;
border-radius: 999rpx;
flex-shrink: 0;
}
.pair-device-summary__status-dot {
width: 12rpx;
height: 12rpx;
border-radius: 50%;
border: 3rpx solid $color-primary;
box-sizing: border-box;
}
.pair-device-summary__status-text {
font-size: 24rpx;
color: $color-primary;
font-weight: 500;
}
</style>

View File

@@ -0,0 +1,123 @@
<template>
<view class="pair-hero">
<view class="pair-hero__visual">
<view class="pair-hero__glow" aria-hidden="true" />
<view class="pair-hero__pulses" aria-hidden="true">
<view
v-for="i in 3"
:key="i"
class="pair-hero__pulse"
:style="{ animationDelay: `${(i - 1) * 0.9}s` }"
/>
</view>
<image class="pair-hero__avatar" :src="thumbSrc" mode="aspectFill" />
</view>
</view>
</template>
<script setup lang="ts">
import { staticAssets } from '@/utils/static-assets'
withDefaults(
defineProps<{
thumbSrc?: string
}>(),
{ thumbSrc: staticAssets.logo },
)
</script>
<style lang="scss" scoped>
.pair-hero {
display: flex;
justify-content: center;
padding: 8rpx 0 24rpx;
}
.pair-hero__visual {
position: relative;
width: 280rpx;
height: 280rpx;
display: flex;
align-items: center;
justify-content: center;
}
.pair-hero__glow {
position: absolute;
left: 50%;
top: 50%;
width: 220rpx;
height: 220rpx;
transform: translate(-50%, -50%);
border-radius: 50%;
pointer-events: none;
background: radial-gradient(
circle,
rgba(201, 239, 217, 0.45) 0%,
rgba(201, 239, 217, 0.18) 42%,
transparent 72%
);
animation: pair-hero-glow 2.8s ease-in-out infinite;
}
.pair-hero__pulses {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
pointer-events: none;
}
.pair-hero__pulse {
position: absolute;
left: 50%;
top: 50%;
width: 120rpx;
height: 120rpx;
border-radius: 50%;
border: 3rpx solid rgba(33, 194, 94, 0.28);
box-sizing: border-box;
opacity: 0;
transform: translate(-50%, -50%) scale(1);
animation: pair-hero-pulse 2.7s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
}
.pair-hero__avatar {
position: relative;
z-index: 2;
width: 112rpx;
height: 112rpx;
border-radius: 50%;
border: 4rpx solid #fff;
box-shadow: 0 8rpx 24rpx rgba(0, 0, 0, 0.08);
flex-shrink: 0;
background: #f0f2f5;
}
@keyframes pair-hero-pulse {
0% {
transform: translate(-50%, -50%) scale(1);
opacity: 0.5;
}
70% {
opacity: 0.08;
}
100% {
transform: translate(-50%, -50%) scale(2.65);
opacity: 0;
}
}
@keyframes pair-hero-glow {
0%,
100% {
transform: translate(-50%, -50%) scale(1);
opacity: 1;
}
50% {
transform: translate(-50%, -50%) scale(1.08);
opacity: 0.85;
}
}
</style>

View File

@@ -0,0 +1,65 @@
<template>
<view class="pair-page">
<app-navbar title="设备配置" />
<scroll-view class="pair-page__scroll" scroll-y>
<view class="pair-page__body">
<bind-steps :steps="BIND_STEPS" :current="currentStep" />
<pair-hero />
<view class="pair-page__status">
<text class="pair-page__title">配对中...</text>
<text class="pair-page__desc">正在与设备建立安全连接,请保持手机靠近</text>
</view>
<view class="pair-page__progress-block">
<view class="pair-page__progress-head">
<text class="pair-page__progress-label">正在同步设备配置...</text>
<text class="pair-page__progress-percent">{{ progress }}%</text>
</view>
<view class="pair-page__progress-track">
<view
class="pair-page__progress-fill"
:style="{ width: `${progress}%` }"
/>
</view>
<text class="pair-page__progress-tip">
{{ progress >= 100 ? '配置同步完成' : `预计还需约 ${etaSeconds} 秒,请勿离开当前页面` }}
</text>
</view>
<pair-check-list :items="checkItems" />
<pair-device-summary :device="device" />
</view>
</scroll-view>
<view class="pair-page__footer">
<view class="pair-page__cancel" @tap="onCancelPair">
<text class="pair-page__cancel-text">取消配对</text>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app'
import BindSteps from '../components/bind-steps/index.vue'
import { BIND_STEPS } from '../use-add-device'
import PairCheckList from './components/pair-check-list/index.vue'
import PairDeviceSummary from './components/pair-device-summary/index.vue'
import PairHero from './components/pair-hero/index.vue'
import { usePairDevice } from './use-pair-device'
const { currentStep, device, progress, etaSeconds, checkItems, onCancelPair } =
usePairDevice()
onLoad((query) => {
if (query?.name) {
device.value.name = decodeURIComponent(String(query.name))
}
if (query?.serial) {
device.value.serialMasked = decodeURIComponent(String(query.serial))
}
})
</script>
<style lang="scss" scoped>
@import './pair.scss';
</style>

View File

@@ -0,0 +1,109 @@
.pair-page {
min-height: 100vh;
background: $color-bg-page;
display: flex;
flex-direction: column;
box-sizing: border-box;
}
.pair-page__scroll {
flex: 1;
height: 0;
}
.pair-page__body {
padding-bottom: 24rpx;
}
.pair-page__status {
padding: 0 40rpx;
margin-bottom: 32rpx;
display: flex;
flex-direction: column;
align-items: center;
}
.pair-page__title {
font-size: 40rpx;
font-weight: 700;
color: $color-text;
margin-bottom: 16rpx;
text-align: center;
}
.pair-page__desc {
font-size: 26rpx;
color: #98a2b3;
line-height: 1.65;
text-align: center;
padding: 0 24rpx;
}
.pair-page__progress-block {
margin: 0 32rpx 24rpx;
padding: 28rpx 24rpx;
background: #fff;
border-radius: 20rpx;
box-shadow: 0 4rpx 24rpx rgba(0, 0, 0, 0.04);
}
.pair-page__progress-head {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20rpx;
}
.pair-page__progress-label {
font-size: 28rpx;
color: $color-text;
font-weight: 500;
}
.pair-page__progress-percent {
font-size: 28rpx;
font-weight: 600;
color: $color-primary;
}
.pair-page__progress-track {
height: 16rpx;
border-radius: 999rpx;
background: #eef1f4;
overflow: hidden;
margin-bottom: 16rpx;
}
.pair-page__progress-fill {
height: 100%;
border-radius: 999rpx;
background: linear-gradient(90deg, #45d685 0%, #21c25e 100%);
transition: width 0.4s ease;
}
.pair-page__progress-tip {
font-size: 24rpx;
color: #98a2b3;
line-height: 1.5;
}
.pair-page__footer {
padding: 16rpx 32rpx calc(24rpx + env(safe-area-inset-bottom));
background: $color-bg-page;
}
.pair-page__cancel {
height: 96rpx;
border-radius: 24rpx;
background: #fff;
border: 2rpx solid #e8eaed;
display: flex;
align-items: center;
justify-content: center;
}
.pair-page__cancel-text {
font-size: 32rpx;
color: #666;
font-weight: 500;
}

View File

@@ -0,0 +1,13 @@
export type PairCheckStatus = 'done' | 'syncing' | 'pending'
export interface PairCheckItem {
id: string
title: string
status: PairCheckStatus
tag: string
}
export interface PairDeviceInfo {
name: string
serialMasked: string
}

View File

@@ -0,0 +1,81 @@
import { onUnmounted, ref, watch } from 'vue'
import type { PairCheckItem, PairDeviceInfo } from './pair.types'
const DEFAULT_DEVICE: PairDeviceInfo = {
name: 'Z2 空气净化器',
serialMasked: '****A3B2',
}
export function usePairDevice(initial?: Partial<PairDeviceInfo>) {
const currentStep = 3
const device = ref<PairDeviceInfo>({
...DEFAULT_DEVICE,
...initial,
})
const progress = ref(65)
const etaSeconds = ref(15)
const checkItems = ref<PairCheckItem[]>([
{ id: 'signal', title: '蓝牙信号强度', status: 'done', tag: '良好' },
{ id: 'credential', title: '设备凭证校验', status: 'done', tag: '通过' },
{ id: 'network', title: '网络配置下发', status: 'syncing', tag: '同步中' },
])
let etaTick = 0
const tick = setInterval(() => {
if (progress.value < 100) {
progress.value = Math.min(100, progress.value + 1)
}
etaTick += 1
if (etaTick % 2 === 0 && etaSeconds.value > 0 && progress.value < 100) {
etaSeconds.value = Math.max(0, etaSeconds.value - 1)
}
if (progress.value >= 100) {
checkItems.value = checkItems.value.map((item) =>
item.id === 'network'
? { ...item, status: 'done', tag: '完成' }
: item,
)
}
}, 500)
let navigated = false
watch(progress, (value) => {
if (value < 100 || navigated) return
navigated = true
const d = device.value
const q = [
`name=${encodeURIComponent(d.name)}`,
`serial=${encodeURIComponent(d.serialMasked)}`,
].join('&')
setTimeout(() => {
uni.redirectTo({ url: `/pages/add-device/complete/index?${q}` })
}, 600)
})
onUnmounted(() => {
clearInterval(tick)
})
function onCancelPair() {
uni.showModal({
title: '取消配对',
content: '确定要取消当前设备的配对吗?',
success: (res) => {
if (res.confirm) {
uni.navigateBack()
}
},
})
}
return {
currentStep,
device,
progress,
etaSeconds,
checkItems,
onCancelPair,
}
}