init: initial commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
Component({
|
||||
data: { visible: true, state: 'loading', message: '' },
|
||||
lifetimes: {
|
||||
attached: function() {
|
||||
this._startedAt = Date.now();
|
||||
this._unobserve = getApp().observeAuth((state, message) => {
|
||||
clearTimeout(this._exitTimer);
|
||||
if (state === 'ready' && !this._waiting) {
|
||||
this.setData({ visible: false });
|
||||
} else if (state === 'ready') {
|
||||
this._exitTimer = setTimeout(() => { this.setData({ visible: false }); }, Math.max(0, 350 - (Date.now() - this._startedAt)));
|
||||
} else {
|
||||
this._waiting = true;
|
||||
this.setData({ visible: true, 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,13 @@
|
||||
<view wx:if="{{visible}}" class="launch-screen" catchtouchmove="preventMove">
|
||||
<view class="launch-content">
|
||||
<text class="launch-mark {{state === 'loading' ? 'launch-animated' : ''}}">💝</text>
|
||||
<text class="launch-title">我们</text>
|
||||
<text class="launch-caption">把日常,写成我们的故事</text>
|
||||
<view wx:if="{{state === 'loading'}}" class="launch-progress"><view></view><view></view><view></view></view>
|
||||
<block wx:else>
|
||||
<text class="launch-error">{{message}}</text>
|
||||
<button class="launch-retry" bindtap="retry">重新连接</button>
|
||||
</block>
|
||||
</view>
|
||||
<text class="launch-footer">PAGES OF US</text>
|
||||
</view>
|
||||
@@ -0,0 +1,14 @@
|
||||
.launch-screen{position:fixed;top:0;right:0;bottom:0;left:0;z-index:99999;background:#FAF5EE;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;}}
|
||||
Reference in New Issue
Block a user