这版是公共号授权版
This commit is contained in:
@@ -5,6 +5,31 @@ page {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* loading 遮罩:未登录时显示,防止页面内容一闪 */
|
||||
.fullscreen-loading {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #f9f9f9;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 9999;
|
||||
}
|
||||
.fullscreen-loading .loading-spinner {
|
||||
width: 48rpx;
|
||||
height: 48rpx;
|
||||
border: 4rpx solid #e0e0e0;
|
||||
border-top-color: #07c160;
|
||||
border-radius: 50%;
|
||||
animation: fullscreen-spin 0.8s linear infinite;
|
||||
}
|
||||
@keyframes fullscreen-spin {
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.scrollarea {
|
||||
height: 90vh;
|
||||
display: flex;
|
||||
|
||||
@@ -5,7 +5,7 @@ import { htmlToWxNodes } from "../../../utils/html-to-wx-nodes";
|
||||
import { request } from "../../../utils/request";
|
||||
import { version, appversion, appId } from "../../../env";
|
||||
import { receiveRedPacket } from "../../../utils/util";
|
||||
|
||||
const app = getApp<IAppOption>()
|
||||
const isMobileEnvironment = (): boolean => {
|
||||
const platform = wx.getSystemInfoSync().platform?.toLowerCase() || '';
|
||||
return platform !== 'windows' && platform !== 'mac';
|
||||
@@ -24,18 +24,34 @@ Page({
|
||||
active: 0,
|
||||
canSubmit: false,
|
||||
safeBottom: 0,
|
||||
initialLoading: false,
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
async onLoad(options: any) {
|
||||
const app = getApp<IAppOption>();
|
||||
const openId = wx.getStorageSync("openId");
|
||||
if (!openId) {
|
||||
// 未登录:保持 loading 遮罩,跳转 web-view 授权
|
||||
const code = options.code || "";
|
||||
const url = `/pages/webview-auth/index?back=video&code=${code}`
|
||||
wx.navigateTo({ url });
|
||||
return;
|
||||
}
|
||||
|
||||
// 已登录(含授权返回):隐藏 loading 遮罩,直接进入页面
|
||||
this.setData({ initialLoading: true });
|
||||
|
||||
wx.hideShareMenu({
|
||||
menus: ["shareAppMessage"], // 单独禁用好友分享
|
||||
});
|
||||
new UrlParamsHandler(options);
|
||||
app.globalData.store = options;
|
||||
// 合并 URL 参数与 globalData.store 中已有的登录信息(来自 webview-auth)
|
||||
app.globalData.store = {
|
||||
...app.globalData.store,
|
||||
...options,
|
||||
};
|
||||
let safeBottom = 0;
|
||||
//@ts-ignore
|
||||
if (wx.getWindowInfo) {
|
||||
@@ -52,7 +68,7 @@ Page({
|
||||
}
|
||||
this.setData({
|
||||
safeBottom: safeBottom,
|
||||
store: options,
|
||||
store: app.globalData.store,
|
||||
});
|
||||
|
||||
if (!isMobileEnvironment()) {
|
||||
@@ -95,6 +111,9 @@ Page({
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
const openId = wx.getStorageSync("openId");
|
||||
if (!openId) return;
|
||||
this.setData({ initialLoading: true });
|
||||
this.search();
|
||||
},
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
<!--pages/video/video.wxml-->
|
||||
<view wx:if="{{!initialLoading}}" class="fullscreen-loading">
|
||||
<view class="loading-spinner"></view>
|
||||
</view>
|
||||
<view wx:else>
|
||||
<navigation-bar title="" back="{{false}}" bind:handleBack="handleBack" color="black" background="#FFF">
|
||||
<view slot="left" class="report-nav-btn" bind:tap="handleCustomReport">举报</view>
|
||||
</navigation-bar>
|
||||
@@ -36,4 +40,5 @@
|
||||
<image class="icon" src="./assets/1.png" />
|
||||
</view>
|
||||
</van-tabs>
|
||||
</scroll-view>
|
||||
</scroll-view>
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user