这版是公共号授权版
This commit is contained in:
@@ -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();
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user