微信小程序页面迁移校验之前 P5任务处理之前
This commit is contained in:
4
apps/miniprogram - 副本/miniprogram/pages/mvp/mvp.json
Normal file
4
apps/miniprogram - 副本/miniprogram/pages/mvp/mvp.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"usingComponents": {},
|
||||
"navigationBarTitleText": "MVP验证"
|
||||
}
|
||||
45
apps/miniprogram - 副本/miniprogram/pages/mvp/mvp.ts
Normal file
45
apps/miniprogram - 副本/miniprogram/pages/mvp/mvp.ts
Normal file
@@ -0,0 +1,45 @@
|
||||
// MVP 全链路验证页面
|
||||
// 从后端 API 读取 test."xcx-test" 表 ti 列第一行并显示
|
||||
|
||||
import { API_BASE } from "../../utils/config"
|
||||
|
||||
Page({
|
||||
data: {
|
||||
tiValue: "加载中...",
|
||||
error: "",
|
||||
loading: true,
|
||||
},
|
||||
|
||||
onLoad() {
|
||||
this.fetchData()
|
||||
},
|
||||
|
||||
fetchData() {
|
||||
this.setData({ loading: true, error: "" })
|
||||
|
||||
wx.request({
|
||||
url: `${API_BASE}/api/xcx-test`,
|
||||
method: "GET",
|
||||
success: (res) => {
|
||||
if (res.statusCode === 200 && res.data) {
|
||||
const data = res.data as { ti: string }
|
||||
this.setData({
|
||||
tiValue: data.ti,
|
||||
loading: false,
|
||||
})
|
||||
} else {
|
||||
this.setData({
|
||||
error: `请求失败: ${res.statusCode}`,
|
||||
loading: false,
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
this.setData({
|
||||
error: `网络错误: ${err.errMsg}`,
|
||||
loading: false,
|
||||
})
|
||||
},
|
||||
})
|
||||
},
|
||||
})
|
||||
19
apps/miniprogram - 副本/miniprogram/pages/mvp/mvp.wxml
Normal file
19
apps/miniprogram - 副本/miniprogram/pages/mvp/mvp.wxml
Normal file
@@ -0,0 +1,19 @@
|
||||
<!--MVP 全链路验证页面-->
|
||||
<view class="container">
|
||||
<view class="title">小程序 MVP 验证</view>
|
||||
<view class="desc">数据来源: test_zqyy_app → test."xcx-test" → ti</view>
|
||||
|
||||
<view class="result" wx:if="{{!error}}">
|
||||
<text class="value">{{tiValue}}</text>
|
||||
</view>
|
||||
|
||||
<view class="error" wx:if="{{error}}">
|
||||
<text>{{error}}</text>
|
||||
</view>
|
||||
|
||||
<view class="retry" bindtap="fetchData">
|
||||
<text>点击刷新</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<dev-fab />
|
||||
48
apps/miniprogram - 副本/miniprogram/pages/mvp/mvp.wxss
Normal file
48
apps/miniprogram - 副本/miniprogram/pages/mvp/mvp.wxss
Normal file
@@ -0,0 +1,48 @@
|
||||
.container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
height: 100vh;
|
||||
padding: 40rpx;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 36rpx;
|
||||
font-weight: bold;
|
||||
margin-bottom: 20rpx;
|
||||
}
|
||||
|
||||
.desc {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
margin-bottom: 60rpx;
|
||||
}
|
||||
|
||||
.result {
|
||||
background: #f0f9ff;
|
||||
border: 2rpx solid #0ea5e9;
|
||||
border-radius: 16rpx;
|
||||
padding: 40rpx 80rpx;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.value {
|
||||
font-size: 48rpx;
|
||||
font-weight: bold;
|
||||
color: #0369a1;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: #dc2626;
|
||||
font-size: 28rpx;
|
||||
margin-bottom: 40rpx;
|
||||
}
|
||||
|
||||
.retry {
|
||||
padding: 20rpx 40rpx;
|
||||
background: #0ea5e9;
|
||||
color: #fff;
|
||||
border-radius: 8rpx;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user