Commit 4637c9f0 authored by mqf_0707's avatar mqf_0707

授权优化

parent 17ad1d24
...@@ -81,6 +81,17 @@ const config = { ...@@ -81,6 +81,17 @@ const config = {
generateScopedName: '[name]__[local]___[hash:base64:5]' generateScopedName: '[name]__[local]___[hash:base64:5]'
} }
} }
},
webpackChain(chain, webpack) {
chain.module
.rule('less')
.pre()
.use('style-resources')
.loader('style-resources-loader')
.options({
patterns: path.resolve(__dirname, '../src/styles/index.less'),
injector: 'append'
})
} }
} }
} }
......
...@@ -5344,21 +5344,6 @@ ...@@ -5344,21 +5344,6 @@
"prop-types": "^15.7.2" "prop-types": "^15.7.2"
} }
}, },
"tbcc-sdk-ts": {
"version": "1.0.13",
"resolved": "https://registry.npmjs.org/tbcc-sdk-ts/-/tbcc-sdk-ts-1.0.13.tgz",
"integrity": "sha512-dupA8ug1zz1/tfVw2ifOoNBlI6te9EXbtSHlsxycNDQxrykCSMP8objFujLeWUajrqNXbUoJlmV2JqbwU626mQ==",
"requires": {
"@types/lodash": "^4.14.160",
"@types/node": "^14.6.0",
"@typescript-eslint/eslint-plugin": "^3.9.1",
"@typescript-eslint/parser": "^3.9.1",
"eslint": "^7.7.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"prettier": "^2.0.5"
}
},
"text-table": { "text-table": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
"react": "^17.0.0", "react": "^17.0.0",
"react-dom": "^17.0.0", "react-dom": "^17.0.0",
"taro-ui": "^3.0.0-alpha.3", "taro-ui": "^3.0.0-alpha.3",
"tbcc-sdk-ts": "^1.0.13" "tbcc-sdk-ts": "^1.0.15"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.8.0", "@babel/core": "^7.8.0",
......
...@@ -23,12 +23,6 @@ export default { ...@@ -23,12 +23,6 @@ export default {
"pages": [ "pages": [
'game/game' 'game/game'
] ]
},
{
"root": "pages/packageComs",
"pages": [
'comsTest/comsTest'
]
} }
], ],
window: { window: {
...@@ -42,9 +36,9 @@ export default { ...@@ -42,9 +36,9 @@ export default {
version: '*', version: '*',
provider: '3000000026642582' provider: '3000000026642582'
}, },
memberBenefit: { // memberBenefit: {
version: '*', // version: '*',
provider: '3000000043103783' // provider: '3000000043103783'
} // }
} }
} }
\ No newline at end of file
...@@ -13,15 +13,15 @@ const { env, tornadoAPI, defaultActivityId, requestType } = config ...@@ -13,15 +13,15 @@ const { env, tornadoAPI, defaultActivityId, requestType } = config
cloud.init({ env }) cloud.init({ env })
Taro.onError(msg => { Taro?.onError && Taro?.onError(msg => {
cloundAlarm(msg, env, requestType) cloundAlarm(msg, env, requestType)
}) })
class App extends Component { class App extends Component {
onLaunch(options) { onLaunch(options) {
console.log('options :>> ', options) console.log('options :>> ', options)
const { activityId } = options.query || {} const { activityId } = options?.query || {}
const app = getApp() const app = Taro?.getApp() || {}
app.cloud = cloud app.cloud = cloud
app.tornadoAPI = tornadoAPI app.tornadoAPI = tornadoAPI
app.activityId = activityId || defaultActivityId app.activityId = activityId || defaultActivityId
......
export default { export default {
env: 'test', // 云函数环境 test 测试环境 online 线上环境 env: 'test', // 云函数环境 test 测试环境 online 线上环境
requestType: 'cloud', // cloud: 云函数, yapi: yapi 接口, ams: ams接口,tornadoAPI: 风驰台接口 requestType: 'yapi', // cloud: 云函数, yapi: yapi 接口, ams: ams接口,tornadoAPI: 风驰台接口
cloudName: 'HipPopGame', // 主云函数项目名 CommonToC cloudName: 'HipPopGame', // 主云函数项目名 CommonToC
sellerId: '4004811045', sellerId: '4004811045',
tornadoAPI: 'https://tornado.duibadev.com.cn/tbServer/api?db=db3000000038851072&proxyIp=172.16.130.158', // 新增:当requestType: 'tornadoAPI'时,找服务端提供地址 tornadoAPI: 'https://tornado.duibadev.com.cn/tbServer/api?db=db3000000038851072&proxyIp=172.16.130.158', // 新增:当requestType: 'tornadoAPI'时,找服务端提供地址
......
...@@ -13,18 +13,21 @@ export function useAuth(authSuccess = () => {}) { ...@@ -13,18 +13,21 @@ export function useAuth(authSuccess = () => {}) {
const onHandleSetting = useThrottle(async () => { const onHandleSetting = useThrottle(async () => {
const res = await getSetting() const res = await getSetting()
if(!res.authSetting?.userInfo) { if(!res.authSetting?.userInfo) {
const authResult = await authorize().catch(err => { await getAuthorize()
setVisible(true)
showToast({ title: '请先授权,授权成功后才可参与活动' })
completeHandle.current = true
})
if(authResult) {
authUserInfo()
}
}else { }else {
authUserInfo() authUserInfo()
} }
}) })
const getAuthorize = async () => {
const authResult = await authorize().catch(err => {
setVisible(true)
showToast({ title: '请先授权,授权成功后才可参与活动' })
completeHandle.current = true
})
if(authResult) {
authUserInfo()
}
}
// 打开授权设置 // 打开授权设置
const onOpenSetting = useThrottle(async () => { const onOpenSetting = useThrottle(async () => {
if(!completeHandle.current) return; if(!completeHandle.current) return;
...@@ -34,7 +37,7 @@ export function useAuth(authSuccess = () => {}) { ...@@ -34,7 +37,7 @@ export function useAuth(authSuccess = () => {}) {
// 获取用户授权信息 // 获取用户授权信息
const authUserInfo = async() => { const authUserInfo = async() => {
completeHandle.current = true completeHandle.current = true
const info = await getAuthUserInfo() const info = await getAuthUserInfo().catch(err => getAuthorize())
if (info) { if (info) {
authSuccess(info) authSuccess(info)
setVisible && setVisible(false) setVisible && setVisible(false)
......
export default {
navigationBarTitleText: '游戏页面',
enableSkia: 'true',
allowsBounceVertical: 'NO',
enableShareAppMessage: true,
usingComponents: {}
}
\ No newline at end of file
...@@ -10,7 +10,8 @@ const { addStat } = require('../api') ...@@ -10,7 +10,8 @@ const { addStat } = require('../api')
})(this, function() { })(this, function() {
'use strict' 'use strict'
console.log('...proxyMd') console.log('...proxyMd')
const oldPage = Page return true
const oldPage = Page || {}
const oldComponent = Component const oldComponent = Component
return ( return (
(Page = function(t) { (Page = function(t) {
......
...@@ -13894,10 +13894,10 @@ taro-ui@^3.0.0-alpha.3: ...@@ -13894,10 +13894,10 @@ taro-ui@^3.0.0-alpha.3:
lodash "^4.17.10" lodash "^4.17.10"
prop-types "^15.7.2" prop-types "^15.7.2"
tbcc-sdk-ts@^1.0.13: tbcc-sdk-ts@^1.0.15:
version "1.0.13" version "1.0.15"
resolved "https://registry.yarnpkg.com/tbcc-sdk-ts/-/tbcc-sdk-ts-1.0.13.tgz#179c6c7f8529a4b146c73a651f529aa56345b6fa" resolved "https://registry.yarnpkg.com/tbcc-sdk-ts/-/tbcc-sdk-ts-1.0.15.tgz#08ef923b2376f35f99f2df7aab65c76d9cd0c6fd"
integrity sha512-dupA8ug1zz1/tfVw2ifOoNBlI6te9EXbtSHlsxycNDQxrykCSMP8objFujLeWUajrqNXbUoJlmV2JqbwU626mQ== integrity sha512-d4wz5cOTBbtWmYVl/3dvVjqFEsnnDK+Sp3RPqWEJPA86Kp8ra2Krox8VAIG78amPo8z9KG2ZioGXhxlufUpT8Q==
optionalDependencies: optionalDependencies:
"@types/lodash" "^4.14.160" "@types/lodash" "^4.14.160"
"@types/node" "^14.6.0" "@types/node" "^14.6.0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment