更新最新代码
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
Component({
|
||||
data: { visible: false, intro: false, state: 'loading', message: '' },
|
||||
lifetimes: {
|
||||
attached: function() {
|
||||
this._startedAt = Date.now();
|
||||
try { this._showIntro = !wx.getStorageSync('launchIntroSeen'); } catch (e) { this._showIntro = false; }
|
||||
if (this._showIntro) {
|
||||
this.setData({ visible: true, intro: true });
|
||||
// 设备首次展示即记住,跳转页面或再次启动都不会重复展示。
|
||||
try { wx.setStorageSync('launchIntroSeen', true); } catch (e) {}
|
||||
}
|
||||
this._unobserve = getApp().observeAuth((state, message) => {
|
||||
clearTimeout(this._exitTimer);
|
||||
if (state === 'ready') {
|
||||
this._retrying = false;
|
||||
if (this._showIntro) {
|
||||
this._exitTimer = setTimeout(() => {
|
||||
this._showIntro = false;
|
||||
this.setData({ visible: false, intro: false });
|
||||
}, Math.max(0, 350 - (Date.now() - this._startedAt)));
|
||||
} else {
|
||||
this.setData({ visible: false, intro: false });
|
||||
}
|
||||
} else if (state === 'error') {
|
||||
this._showIntro = false;
|
||||
this._retrying = true;
|
||||
this.setData({ visible: true, intro: false, state: state, message: message });
|
||||
} else {
|
||||
this.setData({ visible: !!(this._showIntro || this._retrying), intro: !!this._showIntro, state: state, message: message });
|
||||
}
|
||||
});
|
||||
},
|
||||
detached: function() {
|
||||
clearTimeout(this._exitTimer);
|
||||
if (this._unobserve) this._unobserve();
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
preventMove: function() {},
|
||||
retry: async function() {
|
||||
try {
|
||||
await getApp().silentLogin();
|
||||
// 重新加载失败的页面,保留分享链接、相册 id 等原始入口参数。
|
||||
var pages = getCurrentPages();
|
||||
var page = pages[pages.length - 1];
|
||||
if (!page) return;
|
||||
var query = Object.keys(page.options || {}).map(function(key) {
|
||||
return encodeURIComponent(key) + '=' + encodeURIComponent(page.options[key]);
|
||||
}).join('&');
|
||||
wx.reLaunch({ url: '/' + page.route + (query ? '?' + query : '') });
|
||||
} catch (error) {
|
||||
// App 已发布失败状态,保留重试画面。
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
{"component":true}
|
||||
@@ -0,0 +1,16 @@
|
||||
<view wx:if="{{visible}}" class="launch-screen" catchtouchmove="preventMove">
|
||||
<view class="launch-content">
|
||||
<block wx:if="{{intro}}">
|
||||
<image class="launch-mark launch-animated" src="/images/share.png" mode="aspectFit" />
|
||||
<text class="launch-title">我们past</text>
|
||||
<text class="launch-caption">让所有的爱都有迹可循</text>
|
||||
</block>
|
||||
<view wx:if="{{state === 'loading'}}" class="launch-progress"><view></view><view></view><view></view></view>
|
||||
<block wx:else>
|
||||
<text class="launch-title">连接暂时没有成功</text>
|
||||
<text class="launch-error">{{message}}</text>
|
||||
<button class="launch-retry" bindtap="retry">重新连接</button>
|
||||
</block>
|
||||
</view>
|
||||
<text wx:if="{{intro}}" class="launch-footer">PAGES OF US</text>
|
||||
</view>
|
||||
@@ -0,0 +1,18 @@
|
||||
.launch-screen{position:fixed;top:0;right:0;bottom:0;left:0;z-index:99999;background:linear-gradient(180deg, #FDE4EC 0%, #FFF0F5 48%, #FFF7FA 100%);display:flex;align-items:center;justify-content:center;color:#352E2A;}
|
||||
.launch-content{display:flex;align-items:center;flex-direction:column;width:100%;padding:0 60rpx;box-sizing:border-box;transform:translateY(-40rpx);}
|
||||
.launch-mark{display:block;width:152rpx;height:152rpx;line-height:152rpx;font-size:120rpx;text-align:center;}
|
||||
.launch-animated{animation:book-breathe 1.8s ease-in-out infinite;}
|
||||
.launch-title{font-size:44rpx;font-weight:600;letter-spacing:8rpx;margin:48rpx 0 18rpx;}
|
||||
.launch-caption{font-size:26rpx;color:#85776D;}
|
||||
.launch-progress{display:flex;gap:12rpx;margin-top:54rpx;}
|
||||
.launch-progress view{width:8rpx;height:8rpx;border-radius:50%;background:#B74768;animation:dot-breathe 1.2s ease-in-out infinite;}
|
||||
.launch-progress view:nth-child(2){animation-delay:.15s;}.launch-progress view:nth-child(3){animation-delay:.3s;}
|
||||
.launch-error{margin-top:42rpx;font-size:26rpx;line-height:1.6;text-align:center;color:#85776D;}
|
||||
.launch-retry{margin:28rpx 0 0;width:300rpx;background:#B74768;color:#FFFDF8;border-radius:18rpx;font-size:28rpx;line-height:84rpx;}.launch-retry::after{border:0;}
|
||||
.launch-footer{position:absolute;bottom:calc(56rpx + env(safe-area-inset-bottom));font-size:20rpx;letter-spacing:6rpx;color:#A39386;}
|
||||
@keyframes book-breathe{0%,100%{transform:translateY(0) rotate(-3deg);}50%{transform:translateY(-10rpx) rotate(1deg);}}
|
||||
@keyframes dot-breathe{0%,100%{opacity:.25;}50%{opacity:1;}}
|
||||
|
||||
@import '../../styles/button-theme.wxss';
|
||||
|
||||
@import '../../styles/typography.wxss';
|
||||
Reference in New Issue
Block a user