feat(taobao): add native mini program with shared backend
Preserve H5 flows while adding Taobao identity, native capture, reports and isolated local development. Fix canceled province selection and expired-session logout. Record passing local regressions, two pre-existing H5 assertion failures and pending platform validation.
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
page { background: #EFEFEF; }
|
||||
.history { padding-bottom: 48rpx; }
|
||||
.history-note { padding: 32rpx; color: #666; text-align: center; }
|
||||
.history-item { line-height: 1.9; }
|
||||
.history-open { color: #666; text-align: right; }
|
||||
@@ -0,0 +1,10 @@
|
||||
<view class="history">
|
||||
<view class="history-note">最近5份检测报告</view>
|
||||
<view a:if="{{loading}}" class="history-note">加载中…</view>
|
||||
<view a:if="{{error}}" class="history-note" onTap="load">{{error}},点击重试</view>
|
||||
<view a:if="{{!loading && !error && !items.length}}" class="history-note">暂无检测报告</view>
|
||||
<view class="card history-item" a:for="{{items}}" a:key="id" data-id="{{item.id}}" onTap="onOpen">
|
||||
<view>{{item.date}}</view><view>综合评分 {{item.total}} · 肌肤年龄 {{item.skinAge}} 岁</view>
|
||||
<view class="history-open">查看报告 ›</view>
|
||||
</view>
|
||||
</view>
|
||||
@@ -0,0 +1,34 @@
|
||||
var api = require('../../utils/api');
|
||||
Page({
|
||||
data: { items: [], loading: false, error: '' },
|
||||
onShow: function () {
|
||||
if (!api.user()) { this.setData({ items: [] }); my.redirectTo({ url: '/pages/splash/splash' }); return; }
|
||||
this.load();
|
||||
},
|
||||
onUnload: function () { this.closed = true; },
|
||||
load: function () {
|
||||
var that = this;
|
||||
this.setData({ loading: true, error: '' });
|
||||
api.request('reports').then(function (data) {
|
||||
if (that.closed) return;
|
||||
that.setData({ items: data.items.map(function (item) {
|
||||
var date = new Date(item.created_at);
|
||||
return { id: item.id, total: item.total == null ? '--' : item.total, skinAge: item.skinAge == null ? '--' : item.skinAge,
|
||||
date: date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() };
|
||||
}) });
|
||||
}).catch(function (err) { if (!that.closed) that.setData({ error: err.message }); })
|
||||
.then(function () { if (!that.closed) that.setData({ loading: false }); });
|
||||
},
|
||||
onOpen: function (e) {
|
||||
if (this.data.loading) return;
|
||||
var that = this;
|
||||
this.setData({ loading: true });
|
||||
api.request('reports', { id: e.currentTarget.dataset.id }).then(function (data) {
|
||||
if (that.closed) return;
|
||||
getApp().globalData.photos = data.report.photos;
|
||||
getApp().globalData.payload = Object.assign({}, data.report.payload, { vm: data.report.vm, presentation: data.report.presentation });
|
||||
my.navigateTo({ url: '/pages/report/report' });
|
||||
}).catch(function (err) { my.showToast({ content: err.message, type: 'none' }); })
|
||||
.then(function () { if (!that.closed) that.setData({ loading: false }); });
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
{ "defaultTitle": "历史报告", "backgroundColor": "#EFEFEF" }
|
||||
Reference in New Issue
Block a user