first commit

This commit is contained in:
编码猿
2024-09-27 01:32:49 +08:00
commit 28ebe05a64
7399 changed files with 1174529 additions and 0 deletions

View File

@@ -0,0 +1,116 @@
// mall/auth/auth.js
const app = getApp();
const regeneratorRuntime = app.loadAsync()
const model = app.loadModel("index")
const http = app.loadHttp()
const util = app.loadUtils("util")
Page({
/**
* 页面的初始数据
*/
data: {
index: "1",//tab选中
cartNum: 0
},
// tab选中
async tabSwitch(e) {
let index = e.currentTarget.dataset.index
if (index != 1 && index != 4 && index != 2) {
let isLogin = await util.isLoginJump()
if (isLogin == 1) return;
}
if (index == 2) {
wx.navigateTo({
url: "/mall/shopcart/shopcart"
})
return
}
if (index == 3) {
wx.navigateTo({
url: "/mall/laundryList/laundryList"
})
return
}
if (index == 4) {
wx.redirectTo({
url: "/pages/auth/auth?index=1"
})
return
}
this.setData({
index: index
})
},
// 实时更新购物车角标
async realUpdateCarker() {
let res = await model.shopCart.getCart()
app.globalData.cartNum = res.length
var that = this
app.setWatching('cartNum', (v) => {
that.setData({
cartNum: v
});
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.realUpdateCarker()
let that = this
// 需要跳转到首页tabbar时需要路径参数index,否则不激活
that.setData({
index: options.index || '1'
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.realUpdateCarker()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})