This commit is contained in:
@@ -96,6 +96,7 @@ export default {
|
||||
}
|
||||
|
||||
// 假登录(演示用)
|
||||
// 管理员
|
||||
if (this.username === 'admin' && this.password === 'admin') {
|
||||
const mockData = {
|
||||
token: 'mock-token-admin',
|
||||
@@ -106,7 +107,25 @@ export default {
|
||||
uni.setStorageSync('userId', mockData.userId)
|
||||
uni.setStorageSync('role', mockData.role)
|
||||
|
||||
uni.showToast({ title: '登录成功', icon: 'success' })
|
||||
uni.showToast({ title: '管理员登录成功', icon: 'success' })
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({ url: '/pages/index/index' })
|
||||
}, 1000)
|
||||
return
|
||||
}
|
||||
|
||||
// 销售人员
|
||||
if (this.username === 'sales' && this.password === 'sales') {
|
||||
const mockData = {
|
||||
token: 'mock-token-sales',
|
||||
userId: 'sales-001',
|
||||
role: 'sales'
|
||||
}
|
||||
uni.setStorageSync('token', mockData.token)
|
||||
uni.setStorageSync('userId', mockData.userId)
|
||||
uni.setStorageSync('role', mockData.role)
|
||||
|
||||
uni.showToast({ title: '销售人员登录成功', icon: 'success' })
|
||||
setTimeout(() => {
|
||||
uni.reLaunch({ url: '/pages/index/index' })
|
||||
}, 1000)
|
||||
|
||||
Reference in New Issue
Block a user