init
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
view {
|
||||
margin-top: 16px;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
// pages/index/index.ts
|
||||
Page({
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
// 判断是否登录
|
||||
const token = wx.getStorageSync('token');
|
||||
if (!token) {
|
||||
wx.reLaunch({
|
||||
url: '/pages/login/login'
|
||||
});
|
||||
} else {
|
||||
// 获取token,用户信息 判断账号角色然后跳转到对应的首页
|
||||
let userInfo = wx.getStorageSync('userInfo');
|
||||
if (userInfo.type == '1') {
|
||||
wx.reLaunch({
|
||||
url: '/pages/driverIndex/index'
|
||||
});
|
||||
} else if (userInfo.type == '2') {
|
||||
wx.reLaunch({
|
||||
url: '/pages/manufacturerIndex/manufacturerIndex'
|
||||
});
|
||||
} else if (userInfo.type == '3') {
|
||||
wx.reLaunch({
|
||||
url: '/pages/projectIndex/projectIndex'
|
||||
});
|
||||
} else if (userInfo.type == '4') {
|
||||
wx.reLaunch({
|
||||
url: '/pages/maintenanceIndex/maintenanceIndex'
|
||||
});
|
||||
} else {
|
||||
wx.reLaunch({
|
||||
url: '/pages/login/login'
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage() {}
|
||||
});
|
||||
@@ -0,0 +1,2 @@
|
||||
<!--pages/index/index.wxml-->
|
||||
<view>页面加载中</view>
|
||||
Reference in New Issue
Block a user