[AI Generated]: feat(*): 项目升级为 miniprogram/ 标准布局并新增登录及配网页面骨架

This commit is contained in:
17792275749
2026-05-11 14:19:30 +08:00
parent 497b6d9a56
commit f7e7f7c561
201 changed files with 24115 additions and 6139 deletions
+62
View File
@@ -0,0 +1,62 @@
{
"pages": [
"pages/login/login",
"pages/searchDevice/searchDevice",
"pages/connectedDevice/connectedDevice",
"pages/connectedWifi/connectedWifi",
"pages/supplementPersonal/supplementPersonal",
"pages/home/home",
"pages/equipment/equipment",
"pages/data/data",
"pages/my/my"
],
"window": {
"navigationBarBackgroundColor": "#ffffff",
"navigationBarTextStyle": "black",
"navigationBarTitleText": "智能体重秤"
},
"style": "v2",
"rendererOptions": {
"skyline": {
"defaultDisplayBlock": true,
"disableABTest": true,
"sdkVersionBegin": "3.0.0",
"sdkVersionEnd": "15.255.255"
}
},
"componentFramework": "glass-easel",
"sitemapLocation": "sitemap.json",
"lazyCodeLoading": "requiredComponents",
"tabBar": {
"color": "#999999",
"selectedColor": "#000000",
"backgroundColor": "#ffffff",
"borderStyle": "black",
"list": [
{
"pagePath": "pages/home/home",
"text": "首页",
"iconPath": "images/tabBar/home_default.png",
"selectedIconPath": "images/tabBar/home.png"
},
{
"pagePath": "pages/equipment/equipment",
"text": "设备",
"iconPath": "images/tabBar/equipment_default.png",
"selectedIconPath": "images/tabBar/equipment.png"
},
{
"pagePath": "pages/data/data",
"text": "数据",
"iconPath": "images/tabBar/data_default.png",
"selectedIconPath": "images/tabBar/data.png"
},
{
"pagePath": "pages/my/my",
"text": "我的",
"iconPath": "images/tabBar/my_default.png",
"selectedIconPath": "images/tabBar/my.png"
}
]
}
}
+22
View File
@@ -0,0 +1,22 @@
/**app.wxss**/
@import "./styles/index.less";
page {
width: 100%;
height: 100vh;
overflow: hidden;
box-sizing: border-box;
background: var(--color-bg);
/* 左右边距不加全局,避免全屏元素被挤 */
}
/* 需要页面标准边距的业务容器,在 WXML 根节点使用 */
.page-container {
padding-left: var(--page-padding-x);
padding-right: var(--page-padding-x);
}
image {
width: 100%;
height: 100%;
}
+18
View File
@@ -0,0 +1,18 @@
// app.ts
App<IAppOption>({
globalData: {},
onLaunch() {
// 展示本地存储能力
const logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
// 登录
wx.login({
success: res => {
console.log(res.code)
// 发送 res.code 到后台换取 openId, sessionKey, unionId
},
})
},
})
@@ -0,0 +1,5 @@
{
"component": true,
"styleIsolation": "apply-shared",
"usingComponents": {}
}
@@ -0,0 +1,96 @@
.weui-navigation-bar {
--weui-FG-0:rgba(0,0,0,.9);
--height: 44px;
--left: 16px;
}
.weui-navigation-bar .android {
--height: 48px;
}
.weui-navigation-bar {
overflow: hidden;
color: var(--weui-FG-0);
flex: none;
}
.weui-navigation-bar__inner {
position: relative;
top: 0;
left: 0;
height: calc(var(--height) + env(safe-area-inset-top));
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
padding-top: env(safe-area-inset-top);
width: 100%;
box-sizing: border-box;
}
.weui-navigation-bar__left {
position: relative;
padding-left: var(--left);
display: flex;
flex-direction: row;
align-items: flex-start;
height: 100%;
box-sizing: border-box;
}
.weui-navigation-bar__btn_goback_wrapper {
padding: 11px 18px 11px 16px;
margin: -11px -18px -11px -16px;
}
.weui-navigation-bar__btn_goback_wrapper.weui-active {
opacity: 0.5;
}
.weui-navigation-bar__btn_goback {
font-size: 12px;
width: 12px;
height: 24px;
-webkit-mask: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='24' viewBox='0 0 12 24'%3E %3Cpath fill-opacity='.9' fill-rule='evenodd' d='M10 19.438L8.955 20.5l-7.666-7.79a1.02 1.02 0 0 1 0-1.42L8.955 3.5 10 4.563 2.682 12 10 19.438z'/%3E%3C/svg%3E") no-repeat 50% 50%;
mask: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='24' viewBox='0 0 12 24'%3E %3Cpath fill-opacity='.9' fill-rule='evenodd' d='M10 19.438L8.955 20.5l-7.666-7.79a1.02 1.02 0 0 1 0-1.42L8.955 3.5 10 4.563 2.682 12 10 19.438z'/%3E%3C/svg%3E") no-repeat 50% 50%;
-webkit-mask-size: cover;
mask-size: cover;
background-color: var(--weui-FG-0);
}
.weui-navigation-bar__center {
font-size: 17px;
text-align: center;
position: relative;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
font-weight: bold;
flex: 1;
height: 100%;
}
.weui-navigation-bar__loading {
margin-right: 4px;
align-items: center;
}
.weui-loading {
font-size: 16px;
width: 16px;
height: 16px;
display: block;
background: transparent url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='UTF-8'%3F%3E%3Csvg width='80px' height='80px' viewBox='0 0 80 80' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Ctitle%3Eloading%3C/title%3E%3Cdefs%3E%3ClinearGradient x1='94.0869141%25' y1='0%25' x2='94.0869141%25' y2='90.559082%25' id='linearGradient-1'%3E%3Cstop stop-color='%23606060' stop-opacity='0' offset='0%25'%3E%3C/stop%3E%3Cstop stop-color='%23606060' stop-opacity='0.3' offset='100%25'%3E%3C/stop%3E%3C/linearGradient%3E%3ClinearGradient x1='100%25' y1='8.67370605%25' x2='100%25' y2='90.6286621%25' id='linearGradient-2'%3E%3Cstop stop-color='%23606060' offset='0%25'%3E%3C/stop%3E%3Cstop stop-color='%23606060' stop-opacity='0.3' offset='100%25'%3E%3C/stop%3E%3C/linearGradient%3E%3C/defs%3E%3Cg stroke='none' stroke-width='1' fill='none' fill-rule='evenodd' opacity='0.9'%3E%3Cg%3E%3Cpath d='M40,0 C62.09139,0 80,17.90861 80,40 C80,62.09139 62.09139,80 40,80 L40,73 C58.2253967,73 73,58.2253967 73,40 C73,21.7746033 58.2253967,7 40,7 L40,0 Z' fill='url(%23linearGradient-1)'%3E%3C/path%3E%3Cpath d='M40,0 L40,7 C21.7746033,7 7,21.7746033 7,40 C7,58.2253967 21.7746033,73 40,73 L40,80 C17.90861,80 0,62.09139 0,40 C0,17.90861 17.90861,0 40,0 Z' fill='url(%23linearGradient-2)'%3E%3C/path%3E%3Ccircle id='Oval' fill='%23606060' cx='40.5' cy='3.5' r='3.5'%3E%3C/circle%3E%3C/g%3E%3C/g%3E%3C/svg%3E%0A") no-repeat;
background-size: 100%;
margin-left: 0;
animation: loading linear infinite 1s;
}
@keyframes loading {
from {
transform: rotate(0);
}
to {
transform: rotate(360deg);
}
}
@@ -0,0 +1,105 @@
Component({
options: {
multipleSlots: true // 在组件定义时的选项中启用多slot支持
},
/**
* 组件的属性列表
*/
properties: {
extClass: {
type: String,
value: ''
},
title: {
type: String,
value: ''
},
background: {
type: String,
value: ''
},
color: {
type: String,
value: ''
},
back: {
type: Boolean,
value: true
},
loading: {
type: Boolean,
value: false
},
homeButton: {
type: Boolean,
value: false,
},
animated: {
// 显示隐藏的时候opacity动画效果
type: Boolean,
value: true
},
show: {
// 显示隐藏导航,隐藏的时候navigation-bar的高度占位还在
type: Boolean,
value: true,
observer: '_showChange'
},
// back为true的时候,返回的页面深度
delta: {
type: Number,
value: 1
},
},
/**
* 组件的初始数据
*/
data: {
displayStyle: ''
},
lifetimes: {
attached() {
const rect = wx.getMenuButtonBoundingClientRect()
wx.getSystemInfo({
success: (res) => {
const isAndroid = res.platform === 'android'
const isDevtools = res.platform === 'devtools'
this.setData({
ios: !isAndroid,
innerPaddingRight: `padding-right: ${res.windowWidth - rect.left}px`,
leftWidth: `width: ${res.windowWidth - rect.left }px`,
safeAreaTop: isDevtools || isAndroid ? `height: calc(var(--height) + ${res.safeArea.top}px); padding-top: ${res.safeArea.top}px` : ``
})
}
})
},
},
/**
* 组件的方法列表
*/
methods: {
_showChange(show: boolean) {
const animated = this.data.animated
let displayStyle = ''
if (animated) {
displayStyle = `opacity: ${
show ? '1' : '0'
};transition:opacity 0.5s;`
} else {
displayStyle = `display: ${show ? '' : 'none'}`
}
this.setData({
displayStyle
})
},
back() {
const data = this.data
if (data.delta) {
wx.navigateBack({
delta: data.delta
})
}
this.triggerEvent('back', { delta: data.delta }, {})
}
},
})
@@ -0,0 +1,64 @@
<view class="weui-navigation-bar {{extClass}}">
<view class="weui-navigation-bar__inner {{ios ? 'ios' : 'android'}}" style="color: {{color}}; background: {{background}}; {{displayStyle}}; {{innerPaddingRight}}; {{safeAreaTop}};">
<!-- 左侧按钮 -->
<view class='weui-navigation-bar__left' style="{{leftWidth}};">
<block wx:if="{{back || homeButton}}">
<!-- 返回上一页 -->
<block wx:if="{{back}}">
<view class="weui-navigation-bar__buttons weui-navigation-bar__buttons_goback">
<view
bindtap="back"
class="weui-navigation-bar__btn_goback_wrapper"
hover-class="weui-active"
hover-stay-time="100"
aria-role="button"
aria-label="返回"
>
<view class="weui-navigation-bar__button weui-navigation-bar__btn_goback"></view>
</view>
</view>
</block>
<!-- 返回首页 -->
<block wx:if="{{homeButton}}">
<view class="weui-navigation-bar__buttons weui-navigation-bar__buttons_home">
<view
bindtap="home"
class="weui-navigation-bar__btn_home_wrapper"
hover-class="weui-active"
aria-role="button"
aria-label="首页"
>
<view class="weui-navigation-bar__button weui-navigation-bar__btn_home"></view>
</view>
</view>
</block>
</block>
<block wx:else>
<slot name="left"></slot>
</block>
</view>
<!-- 标题 -->
<view class='weui-navigation-bar__center'>
<view wx:if="{{loading}}" class="weui-navigation-bar__loading" aria-role="alert">
<view
class="weui-loading"
aria-role="img"
aria-label="加载中"
></view>
</view>
<block wx:if="{{title}}">
<text>{{title}}</text>
</block>
<block wx:else>
<slot name="center"></slot>
</block>
</view>
<!-- 右侧留空 -->
<view class='weui-navigation-bar__right'>
<slot name="right"></slot>
</view>
</view>
</view>
Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 745 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 987 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 983 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 471 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 291 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 248 KiB

@@ -0,0 +1,4 @@
Page({
data: {},
onLoad() {}
})
@@ -0,0 +1,3 @@
{
"usingComponents": {}
}
@@ -0,0 +1 @@
<view class="page">connectedDevice 占位</view>
@@ -0,0 +1,4 @@
Page({
data: {},
onLoad() {}
})
@@ -0,0 +1,3 @@
{
"usingComponents": {}
}
@@ -0,0 +1 @@
<view class="page">connectedWifi 占位</view>
+3
View File
@@ -0,0 +1,3 @@
{
"usingComponents": {}
}
+5
View File
@@ -0,0 +1,5 @@
Page({
data: {},
onLoad() {},
})
+3
View File
@@ -0,0 +1,3 @@
<view class="container">
<text>数据</text>
</view>
+6
View File
@@ -0,0 +1,6 @@
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
@@ -0,0 +1,3 @@
{
"usingComponents": {}
}
+5
View File
@@ -0,0 +1,5 @@
Page({
data: {},
onLoad() {},
})
@@ -0,0 +1,3 @@
<view class="container">
<text>设备</text>
</view>
@@ -0,0 +1,6 @@
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
+3
View File
@@ -0,0 +1,3 @@
{
"usingComponents": {}
}
+5
View File
@@ -0,0 +1,5 @@
Page({
data: {},
onLoad() {},
})
+3
View File
@@ -0,0 +1,3 @@
<view class="container">
<text>首页</text>
</view>
+6
View File
@@ -0,0 +1,6 @@
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
+12
View File
@@ -0,0 +1,12 @@
Page({
data: {
loading: false,
},
/* 微信一键登录 */
onLogin() {
wx.navigateTo({
url: '/pages/connectedDevice/connectedDevice'
})
}
})
+4
View File
@@ -0,0 +1,4 @@
{
"navigationStyle": "custom",
"usingComponents": {}
}
+56
View File
@@ -0,0 +1,56 @@
.bg {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
z-index: 1;
}
.login {
position: relative;
z-index: 2;
width: 100%;
height: 100vh;
box-sizing: border-box;
padding: 300rpx 85rpx 88rpx;
display: flex;
flex-direction: column;
.title {
color: #FFFFFF;
width: 100%;
height: 80rpx;
font-size: 80rpx;
text-align: center;
font-weight: bold;
line-height: 80rpx;
margin-bottom: 48rpx;
}
.subTitle {
color: #FFFFFF;
width: 100%;
height: 40rpx;
font-size: 40rpx;
line-height: 40rpx;
font-weight: 500;
text-align: center;
}
.loginBtn {
color: #FFFFFF;
width: 100%;
height: 88rpx;
line-height: 88rpx;
font-size: 32rpx;
font-weight: bold;
text-align: center;
background: #252535;
border-radius: 44rpx;
border: 2rpx solid #FFFFFF;
margin-top: auto;
}
}
+9
View File
@@ -0,0 +1,9 @@
<view class="bg">
<image src="/images/login/bg.jpg" />
</view>
<view class="login">
<view class="title">智能体重秤</view>
<view class="subTitle">设备智联 · 掌握健康</view>
<view class="loginBtn" bind:tap="onLogin">微信一键登录</view>
</view>
+3
View File
@@ -0,0 +1,3 @@
{
"usingComponents": {}
}
+5
View File
@@ -0,0 +1,5 @@
Page({
data: {},
onLoad() {},
})
+3
View File
@@ -0,0 +1,3 @@
<view class="container">
<text>我的</text>
</view>
+6
View File
@@ -0,0 +1,6 @@
.container {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
@@ -0,0 +1,4 @@
Page({
data: {},
onLoad() {}
})
@@ -0,0 +1,3 @@
{
"usingComponents": {}
}
@@ -0,0 +1 @@
<view class="page">searchDevice 占位</view>
@@ -0,0 +1,4 @@
Page({
data: {},
onLoad() {}
})
@@ -0,0 +1,3 @@
{
"usingComponents": {}
}
@@ -0,0 +1 @@
<view class="page">supplementPersonal 占位</view>
+7
View File
@@ -0,0 +1,7 @@
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}
+7
View File
@@ -0,0 +1,7 @@
/* ================================================================
* 全局主题变量聚合入口
* ----------------------------------------------------------------
* 由 app.less 引入,Less 编译期合并到 app.wxss,无运行时开销。
* ================================================================ */
@import "./theme.less";
@import "./spacing.less";
+9
View File
@@ -0,0 +1,9 @@
/* ================================================================
* 全局主题变量(Design Token)—— 间距
* ----------------------------------------------------------------
* 规则:业务代码只允许引用本文件中的语义变量,严禁直接写硬编码值。
* ================================================================ */
page {
/* 页面边距 —— 仅用于 page 级容器横向 padding */
--page-padding-x: 30rpx; /* 页面左右统一边距 */
}
+52
View File
@@ -0,0 +1,52 @@
/* ================================================================
* 全局主题变量(Design Token)—— 颜色
* ----------------------------------------------------------------
* 规则:样式类型禁止混用。即使颜色值相同,也必须按语义独立定义,
* 业务代码只允许引用本文件中的语义变量,严禁直接写色值。
* 分组:品牌色 / 文字色 / 背景色 / 按钮色 / 线条色 / 状态色 / 阴影色
* ================================================================ */
page {
/* 品牌色 —— 主色调,用于链接、强调、聚焦等品牌表达 */
--color-primary: #000000; /* 主色 */
--color-primary-disabled: #cccccc; /* 主色禁用态 */
/* 文字色 —— 仅用于 color 属性,禁止用于按钮/背景 */
--color-text: #333333; /* 一级正文 */
--color-text-secondary: #999999; /* 二级辅助文字 */
--color-text-placeholder: #cccccc; /* 占位文字 */
--color-text-inverse: #ffffff; /* 反白文字(深底上的白字) */
--color-text-disabled: #cccccc; /* 禁用文字 */
/* 背景色 —— 仅用于容器 background,禁止用于按钮 */
--color-bg: #f5f5f5; /* 页面底色 */
--color-bg-card: #ffffff; /* 卡片/容器底色 */
--color-bg-elevated: #ffffff; /* 浮层/弹框底色 */
--color-bg-mask: rgba(0, 0, 0, 0.5); /* 弹框蒙层(action-sheet/confirm) */
/* 按钮色 —— 仅用于按钮组件,与文字色/背景色完全解耦 */
--color-btn-primary: #000000; /* 主按钮底色 */
--color-btn-primary-text: #ffffff; /* 主按钮文字 */
--color-btn-default: #ffffff; /* 默认按钮底色 */
--color-btn-default-text: #333333; /* 默认按钮文字 */
--color-btn-default-border: #e5e5e5; /* 默认按钮边框 */
--color-btn-disabled: #cccccc; /* 禁用按钮底色 */
--color-btn-disabled-text: #ffffff; /* 禁用按钮文字 */
--color-btn-danger: #fa5151; /* 危险按钮底色(删除等) */
--color-btn-danger-text: #ffffff; /* 危险按钮文字 */
--color-btn-link: #000000; /* 链接按钮文字色 */
/* 线条色 —— 仅用于 border,禁止用于文字/背景 */
--color-border: #e5e5e5; /* 常规边框 */
--color-border-light: #f0f0f0; /* 浅边框 */
--color-divider: #eeeeee; /* 分割线 */
/* 状态色 —— 成功/警告/危险/信息提示 */
--color-success: #07c160; /* 成功(微信绿) */
--color-warning: #ff9500; /* 警告(橙) */
--color-danger: #fa5151; /* 危险/错误(红) */
--color-info: #1677ff; /* 信息(蓝) */
/* 阴影色 —— 仅用于 box-shadow */
--color-shadow: rgba(0, 0, 0, 0.08); /* 常规阴影 */
--color-shadow-card: rgba(0, 0, 0, 0.04); /* 卡片浅阴影 */
}
+19
View File
@@ -0,0 +1,19 @@
export const formatTime = (date: Date) => {
const year = date.getFullYear()
const month = date.getMonth() + 1
const day = date.getDate()
const hour = date.getHours()
const minute = date.getMinutes()
const second = date.getSeconds()
return (
[year, month, day].map(formatNumber).join('/') +
' ' +
[hour, minute, second].map(formatNumber).join(':')
)
}
const formatNumber = (n: number) => {
const s = n.toString()
return s[1] ? s : '0' + s
}