🌈 style(eslint): add eslint rules
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { alert } from '@/common/common'
|
||||
import Taro from '@tarojs/taro'
|
||||
import { memo, useCallback, useState } from 'react'
|
||||
import { alert } from '@/common/common'
|
||||
|
||||
type Scope =
|
||||
| 'scope.userLocation'
|
||||
@@ -16,21 +16,22 @@ type Scope =
|
||||
| 'scope.invoiceTitle'
|
||||
| 'scope.invoice'
|
||||
| 'scope.userInfo'
|
||||
type Param = {
|
||||
interface Param {
|
||||
scope: Scope
|
||||
msg: string //检查不通过时警告
|
||||
msg: string // 检查不通过时警告
|
||||
}
|
||||
export default ({ scope, msg }: Param) => {
|
||||
//这个hook微信授权检查授权
|
||||
// 这个hook微信授权检查授权
|
||||
const check = useCallback(() => {
|
||||
return new Promise((reslove, reject) => {
|
||||
Taro.getSetting({
|
||||
success: (res) => {
|
||||
if (res.authSetting[scope]) {
|
||||
reslove(true)
|
||||
} else if (res.authSetting[scope] === undefined) {
|
||||
}
|
||||
else if (res.authSetting[scope] === undefined) {
|
||||
Taro.authorize({
|
||||
scope: scope,
|
||||
scope,
|
||||
success() {
|
||||
reslove(true)
|
||||
},
|
||||
@@ -39,12 +40,14 @@ export default ({ scope, msg }: Param) => {
|
||||
reject(false)
|
||||
},
|
||||
})
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
Taro.openSetting({
|
||||
success(res) {
|
||||
if (res.authSetting[scope]) {
|
||||
reslove(true)
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
alert.none(msg)
|
||||
reject(false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user