fix: 登录时保存username,修复订单列表无数据
This commit is contained in:
@@ -101,10 +101,12 @@ export default {
|
||||
const mockData = {
|
||||
token: 'mock-token-admin',
|
||||
userId: 'admin-001',
|
||||
username: 'admin',
|
||||
role: 'admin'
|
||||
}
|
||||
uni.setStorageSync('token', mockData.token)
|
||||
uni.setStorageSync('userId', mockData.userId)
|
||||
uni.setStorageSync('username', mockData.username)
|
||||
uni.setStorageSync('role', mockData.role)
|
||||
|
||||
uni.showToast({ title: '管理员登录成功', icon: 'success' })
|
||||
@@ -119,10 +121,12 @@ export default {
|
||||
const mockData = {
|
||||
token: 'mock-token-sales',
|
||||
userId: 'sales-001',
|
||||
username: '张三',
|
||||
role: 'sales'
|
||||
}
|
||||
uni.setStorageSync('token', mockData.token)
|
||||
uni.setStorageSync('userId', mockData.userId)
|
||||
uni.setStorageSync('username', mockData.username)
|
||||
uni.setStorageSync('role', mockData.role)
|
||||
|
||||
uni.showToast({ title: '销售人员登录成功', icon: 'success' })
|
||||
@@ -137,10 +141,12 @@ export default {
|
||||
const mockData = {
|
||||
token: 'mock-token-customer',
|
||||
userId: 'customer-001',
|
||||
username: '顾客',
|
||||
role: 'customer'
|
||||
}
|
||||
uni.setStorageSync('token', mockData.token)
|
||||
uni.setStorageSync('userId', mockData.userId)
|
||||
uni.setStorageSync('username', mockData.username)
|
||||
uni.setStorageSync('role', mockData.role)
|
||||
|
||||
uni.showToast({ title: '登录成功', icon: 'success' })
|
||||
@@ -155,6 +161,7 @@ export default {
|
||||
uni.setStorageSync('token', data.token)
|
||||
uni.setStorageSync('refreshToken', data.refreshToken)
|
||||
uni.setStorageSync('userId', data.userId)
|
||||
uni.setStorageSync('username', data.username || this.username)
|
||||
uni.setStorageSync('role', data.role || 'customer')
|
||||
|
||||
uni.showToast({ title: '登录成功', icon: 'success' })
|
||||
|
||||
Reference in New Issue
Block a user