first commit
This commit is contained in:
1
衣莎项目/源码/YiShaXiYi/mall/auth/.pydio
Normal file
1
衣莎项目/源码/YiShaXiYi/mall/auth/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
ccdddbe7-34c2-4ec0-a0ca-b3c7ed05f1cb
|
||||
116
衣莎项目/源码/YiShaXiYi/mall/auth/auth.js
Normal file
116
衣莎项目/源码/YiShaXiYi/mall/auth/auth.js
Normal 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 () {
|
||||
|
||||
}
|
||||
})
|
||||
5
衣莎项目/源码/YiShaXiYi/mall/auth/auth.json
Normal file
5
衣莎项目/源码/YiShaXiYi/mall/auth/auth.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"usingComponents": {
|
||||
"index":"../index/index"
|
||||
}
|
||||
}
|
||||
36
衣莎项目/源码/YiShaXiYi/mall/auth/auth.wxml
Normal file
36
衣莎项目/源码/YiShaXiYi/mall/auth/auth.wxml
Normal file
@@ -0,0 +1,36 @@
|
||||
<!-- mall/auth/auth.wxml -->
|
||||
<view class="auth">
|
||||
<index wx:if="{{ index == 1 }}"></index>
|
||||
<!-- <shopcart wx:if="{{ index == 2 }}" ></shopcart> -->
|
||||
</view>
|
||||
<view class="TabBar">
|
||||
<view class="cu-bar tabbar bg-white">
|
||||
<view data-index="1" bind:tap="tabSwitch" class="action">
|
||||
<view class="cuIcon-cu-image">
|
||||
<image src="{{ index == 1 ? '/static/img/icon/scs.png' : '/static/img/icon/scs1.png' }}"></image>
|
||||
</view>
|
||||
<view class="{{ index == 1 ? 'text-green' : 'text-gray' }} mt10">商城</view>
|
||||
</view>
|
||||
<view data-index="2" bind:tap="tabSwitch" class="action">
|
||||
<view class="cuIcon-cu-image">
|
||||
<image src="{{ index == 2 ? '/static/img/icon/gwcs.png' : '/static/img/icon/gwcs1.png' }}"></image>
|
||||
<view wx:if="{{ cartNum > 0 }}" class="cu-tag badge">{{ cartNum }}</view>
|
||||
</view>
|
||||
<view class="{{ index == 2 ? 'text-green' : 'text-gray' }} mt10">购物车</view>
|
||||
</view>
|
||||
<view data-index="3" bind:tap="tabSwitch" class="action">
|
||||
<view class="cuIcon-cu-image">
|
||||
<image src="{{ index == 3 ? '/static/img/icon/dd1.png' : '/static/img/icon/dd.png' }}"></image>
|
||||
</view>
|
||||
<view class="{{ index == 3 ? 'text-green' : 'text-gray' }} mt10">订单</view>
|
||||
</view>
|
||||
<view data-index="4" bind:tap="tabSwitch" class="action">
|
||||
<view class="cuIcon-cu-image">
|
||||
<image src="{{ index == 4 ? '/static/img/icon/syxz.png' : '/static/img/icon/sy.png' }}"></image>
|
||||
</view>
|
||||
<view class="{{ index == 4 ? 'text-green' : 'text-gray' }} mt10">返回首页</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- toasta提示 -->
|
||||
<i-toast id="toast" />
|
||||
8
衣莎项目/源码/YiShaXiYi/mall/auth/auth.wxss
Normal file
8
衣莎项目/源码/YiShaXiYi/mall/auth/auth.wxss
Normal file
@@ -0,0 +1,8 @@
|
||||
/* mall/auth/auth.wxss */
|
||||
.cuIcon-cu-image image{
|
||||
width: 33rpx !important;
|
||||
height: 37rpx !important;
|
||||
}
|
||||
.TabBar{
|
||||
box-shadow: 0px -8px 20px 0px rgba(14, 5, 9, 0.06);
|
||||
}
|
||||
Reference in New Issue
Block a user