feat: init project with miniprogram, cloud functions and admin console

这个提交包含在:
Guoguo
2026-04-22 21:24:20 +08:00
当前提交 a84e37a6e2
修改 106 个文件,包含 5902 行新增0 行删除
+61
查看文件
@@ -0,0 +1,61 @@
var http = require('../../utils/request')
var app = getApp()
Page({
data: {
userInfo: null,
subscription: null,
deviceCount: 0,
subRemaining: 0
},
onShow: function () {
this.loadProfile()
},
loadProfile: function () {
var self = this
http.get('/api/v1/user/profile').then(function (profile) {
self.setData({
userInfo: profile,
deviceCount: profile.device_count || 0
})
}).catch(function () {})
http.get('/api/v1/subscription').then(function (sub) {
self.setData({
subscription: sub,
subRemaining: sub.remaining_days || 0
})
}).catch(function () {})
},
onManageDevice: function () {
wx.navigateTo({ url: '/pages/scan/scan' })
},
onViewSubscription: function () {
if (!this.data.subscription || this.data.subscription.status === 0) {
wx.navigateTo({ url: '/pages/subscribe-plans/subscribe-plans' })
} else {
wx.navigateTo({ url: '/pages/subscribe-prompt/subscribe-prompt' })
}
},
onViewHistory: function () {
wx.switchTab({ url: '/pages/history/history' })
},
onLogout: function () {
wx.showModal({
title: '退出登录',
content: '确定要退出登录吗?',
success: function (res) {
if (res.confirm) {
wx.removeStorageSync('token')
wx.reLaunch({ url: '/pages/login/login' })
}
}
})
}
})
+3
查看文件
@@ -0,0 +1,3 @@
{
"navigationBarTitleText": "我的"
}
+43
查看文件
@@ -0,0 +1,43 @@
<view class="container">
<view class="card profile-header">
<view class="avatar-area">
<image wx:if="{{userInfo && userInfo.avatar}}" src="{{userInfo.avatar}}" class="avatar" />
<view wx:else class="avatar-placeholder">{{(userInfo && userInfo.nickname ? userInfo.nickname[0] : '?')}}</view>
</view>
<view class="user-info">
<view class="nickname">{{userInfo && userInfo.nickname || '未设置昵称'}}</view>
<view class="text-muted">ID: {{userInfo && userInfo.user_id || ''}}</view>
</view>
</view>
<view class="card">
<view class="menu-item" bindtap="onManageDevice">
<text>设备管理</text>
<view class="flex-row">
<text class="text-muted">{{deviceCount}} 台设备</text>
<text class="arrow-sm">&#10095;</text>
</view>
</view>
<view class="divider"></view>
<view class="menu-item" bindtap="onViewSubscription">
<text>订阅管理</text>
<view class="flex-row">
<text class="text-muted">
{{subscription && subscription.status > 0 ? '剩余 ' + subRemaining + ' 天' : '未订阅'}}
</text>
<text class="arrow-sm">&#10095;</text>
</view>
</view>
<view class="divider"></view>
<view class="menu-item" bindtap="onViewHistory">
<text>护理记录</text>
<text class="arrow-sm">&#10095;</text>
</view>
</view>
<view class="card">
<view class="menu-item logout" bindtap="onLogout">
<text>退出登录</text>
</view>
</view>
</view>
+60
查看文件
@@ -0,0 +1,60 @@
.profile-header {
display: flex;
align-items: center;
padding: 40rpx 32rpx;
}
.avatar-area {
margin-right: 24rpx;
}
.avatar {
width: 96rpx;
height: 96rpx;
border-radius: 50%;
}
.avatar-placeholder {
width: 96rpx;
height: 96rpx;
border-radius: 50%;
background-color: #333333;
color: #ffffff;
font-size: 40rpx;
display: flex;
align-items: center;
justify-content: center;
}
.user-info {
flex: 1;
}
.nickname {
font-size: 34rpx;
font-weight: 600;
margin-bottom: 4rpx;
}
.menu-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 24rpx 0;
font-size: 28rpx;
}
.menu-item:active {
opacity: 0.7;
}
.arrow-sm {
font-size: 24rpx;
color: #cccccc;
margin-left: 8rpx;
}
.logout {
color: #ff4d4f;
justify-content: center;
}