generated from ccsens_fe/uni-vue3-template
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
612 B
22 lines
612 B
import { post } from '@/api/base'
|
|
import { useUserStoreWidthOut } from '@/store/modules/user'
|
|
|
|
const userStore = useUserStoreWidthOut()
|
|
|
|
export const userApi = {
|
|
// 登录
|
|
login: async () => {
|
|
const localDeviceNo = uni.getStorageSync(uni.$u.LOCAL_KEY.DEVICE_NO)
|
|
if (!localDeviceNo) {
|
|
uni.showModal({ title: '提示', content: '请先设置平板信息' })
|
|
return null
|
|
}
|
|
try {
|
|
const token = await post('/pad/login', { param: { padNo: localDeviceNo } })
|
|
userStore.setToken(token)
|
|
return token
|
|
} catch (error) {
|
|
throw new Error(error as any)
|
|
}
|
|
},
|
|
}
|
|
|