日常提交

This commit is contained in:
2025-03-01 02:03:29 +08:00
parent 9694f39780
commit 6c7e23af54
6 changed files with 17 additions and 13 deletions

View File

@ -9,6 +9,7 @@ if(envVersion=='develop'){
let app = getApp();
let token = wx.getStorageSync('accessToken');
const sendRequest = (options)=>{
if(!app)app = getApp();
return new Promise((rs,rj)=>{

12
app.js
View File

@ -2,14 +2,14 @@ import userApi from './api/user';
import commonApi from './api/common';
let token = wx.getStorageSync('accessToken');
App({
onLaunch(options) {
async onLaunch(options){
console.log('app onlaunch',new Date().getTime());
wx.getStorage({
key:'accessToken',
success:(res)=>{
this.globalData.accessToken = res.data;
}
});
this.getAppConfig();
wx.onAppRoute((res)=>{
const page = getCurrentPages();
const currentPage = page[page.length-1];
@ -32,8 +32,12 @@ App({
})
},
onShow(options){
//shared_user_code 通过分享进来的 分享者 的user_code
//这里必须放到onshow 里 才能实时获取 code 先保存在这里,再跳转登录的时候通过 url 带过去,防止刷新丢失 code
console.log('app onShow',new Date().getTime());
/**
* shared_user_code 通过分享进来的 分享者 的user_code
* 这里必须放到onshow 才能实时获取 code 先保存在这里再跳转登录的时候通过 url 带过去防止刷新丢失 code
* wx.getLaunchOptionsSync 也不行比如用户开始自行打开了 app然后再次点朋友的进来就无法获取 code
*/
if(options.query.shared_user_code){
this.globalData.shared_user_code = options.query.shared_user_code;
}

View File

@ -32,7 +32,6 @@ Component({
},
lifetimes:{
attached(){
console.log('1212121212');
const windowInfo = wx.getWindowInfo();
this.setData({

View File

@ -13,7 +13,7 @@ Page({
*/
onLoad(options) {
this.setData({
webUrl:options.url
webUrl:decodeURIComponent(options.url)
})
},

View File

@ -39,6 +39,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
console.log('page onload',new Date().getTime());
let height = this.selectComponent("#navBar").getHeight();
this.setData({
navBarHeight:height
@ -52,13 +53,6 @@ Page({
appConfig:data
})
})
// wx.login({
// success: (res) => {
// console.log(res);
// },
// })
},
/**
@ -66,11 +60,13 @@ Page({
*/
onReady() {
console.log('page onReady',new Date().getTime());
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
console.log('page onShow',new Date().getTime());
wx.getStorage({
key:'pre-order',
success:(res)=>{

View File

@ -96,6 +96,10 @@ Page({
},
navToPrivacy(){
// wx.navigateTo({
// url: `/pages/browser/index?url=${encodeURIComponent('https://beefast.co/#/how-to-use')}`,
// })
// return;
wx.navigateTo({
url: `/pages/browser/index?url=${this.data.appConfig.url_user_privacy}`,
})