删除部分代码
This commit is contained in:
@@ -63,9 +63,6 @@ Page({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool = await app.login("video");
|
|
||||||
if (!bool) return;
|
|
||||||
|
|
||||||
// 开启防截屏(仅限当前页面生命周期内)
|
// 开启防截屏(仅限当前页面生命周期内)
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
wx.setVisualEffectOnCapture({
|
wx.setVisualEffectOnCapture({
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { BASE_URL, appId } from "../env";
|
import { BASE_URL } from "../env";
|
||||||
import { base64Encode } from "./crypto";
|
|
||||||
type RequestProps = {
|
type RequestProps = {
|
||||||
options: WechatMiniprogram.RequestOption;
|
options: WechatMiniprogram.RequestOption;
|
||||||
loadingTitle?: string;
|
loadingTitle?: string;
|
||||||
@@ -21,19 +20,12 @@ const generateFingerprint = (): string => {
|
|||||||
|
|
||||||
|
|
||||||
export const request = <T = any>(
|
export const request = <T = any>(
|
||||||
{ options, loadingTitle = "加载中", isLoading = true, needLogin = true }: RequestProps
|
{ options, loadingTitle = "加载中", isLoading = true }: RequestProps
|
||||||
): Promise<T> => {
|
): Promise<T> => {
|
||||||
const app = getApp<IAppOption>();
|
|
||||||
const header: any = {
|
const header: any = {
|
||||||
"X-Fingerprint": generateFingerprint(),
|
"X-Fingerprint": generateFingerprint(),
|
||||||
};
|
};
|
||||||
if (needLogin) {
|
|
||||||
if (!app.checkLoginState()) {
|
|
||||||
return Promise.reject(new Error('请先登录'));
|
|
||||||
}
|
|
||||||
const openId = wx.getStorageSync("openId") || "";
|
|
||||||
header.Authorization = `Basic ${base64Encode(`${openId}:${appId}`)}`
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user