You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
// app.js 这是小程序应用的入口文件,用于定义整个小程序的全局配置、生命周期函数以及共享的数据等
var http = require ( "utils/http.js" ) ; // 引入名为http.js的工具模块, 可能用于处理网络请求等相关功能
App ( {
// onLaunch是小程序的生命周期函数, 在小程序初始化完成时触发
onLaunch : function ( ) {
console . log ( 'mall4j.v230313' ) ; // 在控制台打印出一个标识字符串,可能用于版本之类的标记
// http.getToken(); // 原本可能是用于获取令牌( token) 的调用, 目前被注释掉了, 也许暂时不需要在启动时获取或者功能还未完善
// 以下是获取用户授权设置信息的代码块
wx . getSetting ( {
success ( res ) {
// 判断用户是否已经授权了'scope.userInfo'(用户信息相关权限),如果没有授权
if ( ! res . authSetting [ 'scope.userInfo' ] ) {
// 则跳转到名为'/pages/login/login'的页面,引导用户进行登录授权操作
wx . navigateTo ( {
url : '/pages/login/login' ,
} )
}
}
} )
} ,
globalData : {
// 定义全局请求队列,可用于存放待处理的请求等相关操作,初始化为一个空数组
requestQueue : [ ] ,
// 用于标记是否正在进行登录操作, 初始值设为true, 后续可根据实际登录状态进行修改
isLanding : true ,
// 用于记录购物车中的商品总数量, 初始值设为0, 在购物车相关操作时可更新这个值
totalCartCount : 0
}
} )