12345678910111213141516171819202122232425262728293031 |
- import { DRIVER, ADMIN } from '@/config/constants'
- export const clone = (obj) => {
- return JSON.parse(JSON.stringify(obj))
- }
- export const validate = (field, message) => {
- if (!field || !field.trim()) {
- uni.showToast({
- title: message,
- icon: 'error',
- })
- return false
- }
- return true
- }
- export const showErr = (err) => {
- uni.showToast({
- title: err,
- icon: 'error'
- })
- }
- export const isDriver = () => {
- return getApp().globalData.userType === DRIVER
- }
- export const isAdmin = () => {
- return getApp().globalData.userType === ADMIN
- }
|