🌈 style(eslint): add eslint rules

This commit is contained in:
xuan
2022-11-26 14:35:05 +08:00
parent f3aa20f049
commit 99a920975f
245 changed files with 14909 additions and 14349 deletions
+11 -8
View File
@@ -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)
}