这版是公共号授权版

This commit is contained in:
cao123
2026-08-12 11:47:51 +08:00
parent d0776f9676
commit e47df01af9
18 changed files with 365 additions and 378 deletions
@@ -1,4 +1,3 @@
import { appId } from "../../../env";
import { request } from "../../../utils/request";
import { receiveRedPacket } from "../../../utils/util";
@@ -76,7 +75,7 @@ Page({
async handleReceive(e: any) {
const { id } = e.currentTarget.dataset;
const { code } = app.globalData.store || {};
const appId = wx.getStorageSync("appId");
try {
await receiveRedPacket(
{ appId, code, openId: wx.getStorageSync("openId"), redId: id },
+1 -2
View File
@@ -1,4 +1,3 @@
import { appId } from "../../../env";
import { request } from "../../../utils/request";
Page({
@@ -118,7 +117,7 @@ Page({
seeId: wx.getStorageSync("seeId") || '',
code: wx.getStorageSync("code") || '',
openId: wx.getStorageSync("openId") || '',
appId,
appId: wx.getStorageSync("appId") || '',
type: this.data.selectedReason,
description: this.data.description,
},
+25
View File
@@ -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;
+23 -4
View File
@@ -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();
},
+6 -1
View File
@@ -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>