feat: 完善淘宝小程序拍照、报告与登录流程

接入本地实时识别和自动三连拍,调整报告裁切、商品跳转、分享标题及居中页眉;完善游客会话、后台渠道隔离、部署脚本与回归测试。
This commit is contained in:
xsl
2026-11-04 15:07:51 +08:00
parent 381da60ae4
commit 774376fa16
147 changed files with 17420 additions and 597 deletions
-48
View File
@@ -404,51 +404,3 @@ page { background: #101823; }
box-sizing: border-box;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
/* ═══ 开发版入口(H5 无;保持低调) ═══ */
.dev-entries {
position: absolute;
z-index: 3;
top: max(10px, env(safe-area-inset-top));
left: 12px;
display: flex;
flex-direction: column;
gap: 6px;
}
.dev-entry {
font-size: 10px;
line-height: 1.5;
color: rgba(255, 255, 255, .42);
}
.diag-panel {
position: absolute;
z-index: 20;
left: 32rpx;
right: 32rpx;
top: 240rpx;
bottom: 160rpx;
background: rgba(6, 16, 26, .96);
border: 1rpx solid rgba(120, 200, 255, .35);
border-radius: 20rpx;
padding: 20rpx;
display: flex;
flex-direction: column;
box-sizing: border-box;
}
.diag-scroll { flex: 1; min-height: 0; }
.diag-text {
color: #9fd0ff;
font-size: 22rpx;
line-height: 1.7;
white-space: pre-wrap;
word-break: break-all;
}
.diag-close {
margin-top: 16rpx;
text-align: center;
color: #0b1622;
background: #ffd94d;
border-radius: 12rpx;
padding: 16rpx 0;
font-size: 26rpx;
}
+3 -16
View File
@@ -1,20 +1,7 @@
<import src="../../components/brand-header.axml" />
<template is="brand-header" data="{{brandHeader: brandHeader}}" />
<!-- ═════ 01 启动页 —— 对照 H5 index.html #s-splash(L43-58) + #p-privacy(L294-307) + #p-policy(L335-466) ═════ -->
<view class="splash">
<!-- 开发版入口(H5 无此入口,保持现有实现,样式低调) -->
<view class="dev-entries" a:if="{{showCameraDebug || showMvpDebug || showDiagnose}}">
<view class="dev-entry" a:if="{{showCameraDebug}}" onTap="onCameraDebug">开发调试 · 相机验收</view>
<view class="dev-entry" a:if="{{showMvpDebug}}" onTap="onMvpDebug">SAE MVP 连通性</view>
<view class="dev-entry" a:if="{{showDiagnose}}" onTap="onDiagnose">权限诊断</view>
<view class="dev-entry" a:if="{{showDiagnose}}" onTap="onCamTest">相机组件测试</view>
</view>
<!-- 诊断结果浮层:真机上唯一能看到相机能力/授权返回值的地方 -->
<view class="diag-panel" a:if="{{diagText}}">
<scroll-view class="diag-scroll" scroll-y>
<text class="diag-text">{{diagText}}</text>
</scroll-view>
<view class="diag-close" onTap="onCloseDiagnose">关闭</view>
</view>
<view class="splash" style="margin-top:{{brandHeader.height}}px;height:calc(100vh - {{brandHeader.height}}px);">
<!-- H5 .splash-bg -->
<image class="splash-bg" src="{{bgUrl}}" mode="aspectFill" />
+29 -45
View File
@@ -1,11 +1,10 @@
/* ═════ 启动页:品牌底图 + Slogan + 开始检测/我的报告 + 隐私授权弹窗
对照 H5 index.html #s-splash(L43-58)、#p-privacy(L294-307)、#p-policy(L335-466)
交互保持:登录(必须勾选协议)、restore、历史入口、退出登录、政策全文、开发版入口。 ═════ */
交互保持:登录(必须勾选协议)、restore、历史入口、退出登录、政策全文。 ═════ */
var api = require('../../utils/api.js');
var development = require('../../utils/development');
var config = require('../../config');
Page({
Page(require('../../utils/page-header').page({
onShareAppMessage: function () { return require('../../utils/share').message(); },
data: {
// 图片全部走 api.assetUrl(与 H5 h5/assets/ 同相对路径)
bgUrl: api.assetUrl('img/ui-20261009/bg-splash-h5.jpg'),
@@ -20,20 +19,27 @@ Page({
showPolicy: false,
busy: false,
signedIn: false,
guest: false,
accountLabel: '尚未登录', // H5 renderAccountStatus()
toastText: '', toastOn: false,
showCameraDebug: development.cameraDebugEnabled(),
showMvpDebug: config.mvpLocal === true || (config.transport === 'cloud' && config.environment !== 'production'),
showDiagnose: config.environment !== 'production',
diagText: ''
toastText: '', toastOn: false
},
onShow: function () {
var that = this;
api.restore().then(function (user) { that.setData({ signedIn: !!user, accountLabel: user ? '淘宝已登录' : '尚未登录' }); })
.catch(function () {});
this.alive = true;
api.restore().then(function (user) {
if (!that.alive) return;
if (!user) { my.redirectTo({ url: '/pages/login/login' }); return; }
var guest = user.kind === 'taobao_guest';
that.setData({ signedIn: !guest, guest: guest, accountLabel: guest ? '游客模式' : '淘宝已登录' });
}).catch(function (err) {
if (!that.alive) return;
that.setData({ signedIn: false, guest: false, accountLabel: '登录状态待确认' });
if (err.status === 401) my.redirectTo({ url: '/pages/login/login' });
else that.toast('网络异常,请重新登录或稍后重试');
});
},
onUnload: function () { this.alive = false; clearTimeout(this.toastTimer); },
// H5 .toast(自定义轻提示,替代系统 toast 以获得一致的视觉)
toast: function (msg) {
@@ -47,7 +53,8 @@ Page({
// 「开始检测」→ 隐私授权弹窗(H5 data-action="open-privacy")
onOpenPrivacy: function () {
if (api.user()) { my.navigateTo({ url: '/pages/profile/profile' }); return; }
if (!api.user()) { my.redirectTo({ url: '/pages/login/login' }); return; }
this.setData({ agreed: false });
this.setData({ showPrivacy: true });
},
onClosePrivacy: function () {
@@ -75,45 +82,22 @@ Page({
return;
}
this.setData({ busy: true });
api.login(true).then(function () {
that.setData({ showPrivacy: false, signedIn: true, accountLabel: '淘宝已登录' });
my.navigateTo({ url: '/pages/profile/profile' });
}).catch(function (err) {
that.toast(err.message);
}).then(function () { that.setData({ busy: false }); });
if (!api.user()) { this.setData({ busy: false }); my.redirectTo({ url: '/pages/login/login' }); return; }
this.setData({ showPrivacy: false, busy: false });
my.navigateTo({ url: '/pages/profile/profile' });
},
// H5 data-action="history" / 「我的报告」
onHistory: function () {
if (!api.user()) { this.onOpenPrivacy(); return; }
if (!api.user()) { my.redirectTo({ url: '/pages/login/login' }); return; }
my.navigateTo({ url: '/pages/history/history' });
},
onLogout: function () {
var that = this;
api.logout().then(function () {
that.setData({ signedIn: false, agreed: false, accountLabel: '尚未登录' });
(api.isGuest() ? api.endGuest() : api.logout()).then(function () {
that.setData({ signedIn: false, guest: false, agreed: false, accountLabel: '尚未登录' });
my.redirectTo({ url: '/pages/login/login' });
}).catch(function (err) { that.toast(err.message); });
},
onCameraDebug: function () {
if (!development.cameraDebugEnabled()) return;
my.navigateTo({ url: '/pages/camera/camera?debug=camera' });
},
onMvpDebug: function () {
if (!config.mvpLocal && !(config.transport === 'cloud' && config.environment !== 'production')) return;
my.navigateTo({ url: '/pages/mvp/mvp' });
},
// 相机/相册权限诊断:相机页可能整页崩掉,所以在启动页也能点
onDiagnose: function () {
var that = this;
this.setData({ diagText: '检测中…' });
require('../../utils/permissions').diagnose().then(function (info) {
that.setData({ diagText: info.join('\n') });
}).catch(function (err) {
that.setData({ diagText: 'diagnose error: ' + (err && err.message ? err.message : String(err)) });
});
},
onCloseDiagnose: function () { this.setData({ diagText: '' }); },
// 相机组件冒烟测试:单独一页只放 <camera>,用来判断淘宝真机是否支持该组件
onCamTest: function () { my.navigateTo({ url: '/pages/camtest/camtest' }); },
onLogin: function () { my.navigateTo({ url: '/pages/login/login?switch=1' }); },
noop: function () {} // 弹窗卡片内点击拦截冒泡用
});
}, typeof my === 'undefined' ? {} : my));
+7 -3
View File
@@ -1,5 +1,9 @@
{
"defaultTitle": "1'me在线肌肤测试",
"titleBarColor": "#101823",
"backgroundColor": "#101823"
"defaultTitle": "​",
"titleBarColor": "#FFFFFF",
"backgroundColor": "#101823",
"navigationBarTextStyle": "black",
"navigationBarForceEnable": true,
"transparentTitle": "always",
"gestureBack": "NO"
}