日常提交

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 app = getApp();
let token = wx.getStorageSync('accessToken'); let token = wx.getStorageSync('accessToken');
const sendRequest = (options)=>{ const sendRequest = (options)=>{
if(!app)app = getApp(); if(!app)app = getApp();
return new Promise((rs,rj)=>{ return new Promise((rs,rj)=>{

12
app.js
View File

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

View File

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

View File

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

View File

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

View File

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