|
@@ -6,33 +6,36 @@ let name = {
|
|
1: '游戏账号失败列表:',
|
|
1: '游戏账号失败列表:',
|
|
}
|
|
}
|
|
var time: any = null
|
|
var time: any = null
|
|
-let api= "http://47.99.157.216:8023"
|
|
|
|
-// let api= "http://127.0.0.1:8023"
|
|
|
|
-function QQAuth(props: { qqVisible: boolean, callBack: () => void }) {
|
|
|
|
- const { qqVisible, callBack } = props
|
|
|
|
|
|
+// let api = "http://47.99.157.216:8023"
|
|
|
|
+let api = "http://127.0.0.1:8023"
|
|
|
|
+function QQAuth(props: { qqVisible: boolean, callBack: () => void, adAppType: 0 | 1, title: string, smType?: "QQ" | "WX", isOld?: boolean }) {
|
|
|
|
+ const { qqVisible, callBack, adAppType, smType, title, isOld } = props
|
|
let [visible, setVisible] = useState(false)
|
|
let [visible, setVisible] = useState(false)
|
|
- let [loading,setLoading]=useState(false)
|
|
|
|
|
|
+ let [loading, setLoading] = useState(false)
|
|
let [codeUrl, setCodeUrl] = useState('')
|
|
let [codeUrl, setCodeUrl] = useState('')
|
|
let [err, setErr] = useState({})
|
|
let [err, setErr] = useState({})
|
|
let [data, setData] = useState({
|
|
let [data, setData] = useState({
|
|
userId: localStorage.getItem('userId'),
|
|
userId: localStorage.getItem('userId'),
|
|
- adAppType: 1,
|
|
|
|
|
|
+ adAppType,
|
|
users: [],
|
|
users: [],
|
|
callbackPage: 'http%3A%2F%2Ferp.zanxiangnet.com%2FadCode',
|
|
callbackPage: 'http%3A%2F%2Ferp.zanxiangnet.com%2FadCode',
|
|
- authorization: `Bearer ${sessionStorage.getItem('Admin-Token')}`
|
|
|
|
|
|
+ authorization: `Bearer ${sessionStorage.getItem('Admin-Token')}`,
|
|
|
|
+ smType: smType ? "WX" : "QQ",
|
|
|
|
+ isOld
|
|
})
|
|
})
|
|
let adAppIdonChange = useCallback((checkedValue) => {
|
|
let adAppIdonChange = useCallback((checkedValue) => {
|
|
let v = checkedValue.target.value
|
|
let v = checkedValue.target.value
|
|
- console.log("checkedValue===>",v)
|
|
|
|
- setData({ ...data, adAppType:v})
|
|
|
|
|
|
+ console.log("checkedValue===>", v)
|
|
|
|
+ setData({ ...data, adAppType: v })
|
|
}, [data])
|
|
}, [data])
|
|
let submit = useCallback(() => {
|
|
let submit = useCallback(() => {
|
|
if (data.users.some(user => isNaN(user))) {
|
|
if (data.users.some(user => isNaN(user))) {
|
|
message.error('账号请使用数字!!!!!!')
|
|
message.error('账号请使用数字!!!!!!')
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+ console.log(data)
|
|
setLoading(true)
|
|
setLoading(true)
|
|
- fetch(api+'/qq/auth', {
|
|
|
|
|
|
+ fetch(api + '/qq/auth', {
|
|
method: 'POST',
|
|
method: 'POST',
|
|
headers: {
|
|
headers: {
|
|
"content-type": "application/json",
|
|
"content-type": "application/json",
|
|
@@ -42,11 +45,11 @@ function QQAuth(props: { qqVisible: boolean, callBack: () => void }) {
|
|
if (r?.data?.codeImgUrl) {
|
|
if (r?.data?.codeImgUrl) {
|
|
setCodeUrl(r?.data?.codeImgUrl)
|
|
setCodeUrl(r?.data?.codeImgUrl)
|
|
setVisible(true)
|
|
setVisible(true)
|
|
- let n=0
|
|
|
|
|
|
+ let n = 0
|
|
time = setInterval(() => {
|
|
time = setInterval(() => {
|
|
- if(n< 60){
|
|
|
|
- n+=1
|
|
|
|
- fetch(`${api}/qq/isOk?userId=${localStorage.getItem('userId')}`, {
|
|
|
|
|
|
+ if (n < 60) {
|
|
|
|
+ n += 1
|
|
|
|
+ fetch(`${api}/qq/isOk?userId=${localStorage.getItem('userId')}&smType=${data.smType}`, {
|
|
method: 'GET'
|
|
method: 'GET'
|
|
}).then(res => res.json()).then(r => {
|
|
}).then(res => res.json()).then(r => {
|
|
if (r.data) {
|
|
if (r.data) {
|
|
@@ -56,17 +59,17 @@ function QQAuth(props: { qqVisible: boolean, callBack: () => void }) {
|
|
setLoading(false)
|
|
setLoading(false)
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- }else{
|
|
|
|
|
|
+ } else {
|
|
message.error('扫码超时请重新扫码!')
|
|
message.error('扫码超时请重新扫码!')
|
|
setVisible(false)
|
|
setVisible(false)
|
|
setCodeUrl("")
|
|
setCodeUrl("")
|
|
clearInterval(time)
|
|
clearInterval(time)
|
|
setLoading(false)
|
|
setLoading(false)
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
}, 1000)
|
|
}, 1000)
|
|
} else {
|
|
} else {
|
|
- message.success('已经开始授权,稍后自行查看结果!')
|
|
|
|
|
|
+ message.success('已经开始授权,稍后自行查看结果!如遇到问题请点击清除账号状态按钮重试!')
|
|
setLoading(false)
|
|
setLoading(false)
|
|
}
|
|
}
|
|
console.log(r)
|
|
console.log(r)
|
|
@@ -100,16 +103,29 @@ function QQAuth(props: { qqVisible: boolean, callBack: () => void }) {
|
|
width={800}
|
|
width={800}
|
|
onCancel={callBack}
|
|
onCancel={callBack}
|
|
maskClosable={false}
|
|
maskClosable={false}
|
|
|
|
+ title={<>{title}<span style={{ color: 'red' }}>(如需更换手机扫码请先点击清除账号状态)</span></>}
|
|
>
|
|
>
|
|
<div>
|
|
<div>
|
|
<Row>
|
|
<Row>
|
|
|
|
+ <Col span='24'>
|
|
|
|
+ <Row>
|
|
|
|
+ <Col span={3}><h3>扫码渠道:</h3></Col>
|
|
|
|
+ <Col span={20}>
|
|
|
|
+ <Radio.Group style={{ width: '100%' }} onChange={(e) => {
|
|
|
|
+ setData({ ...data, smType: e.target.value })
|
|
|
|
+ }} defaultValue={data.smType}>
|
|
|
|
+ <Radio value={"QQ"}>QQ</Radio>
|
|
|
|
+ {!isOld && <Radio value={"WX"}>微信</Radio>}
|
|
|
|
+ </Radio.Group>
|
|
|
|
+ </Col>
|
|
|
|
+ </Row>
|
|
|
|
+ </Col>
|
|
<Col span='24'>
|
|
<Col span='24'>
|
|
<Row>
|
|
<Row>
|
|
<Col span={3}><h3>平台选择:</h3></Col>
|
|
<Col span={3}><h3>平台选择:</h3></Col>
|
|
<Col span={20}>
|
|
<Col span={20}>
|
|
<Radio.Group style={{ width: '100%' }} onChange={adAppIdonChange} defaultValue={data.adAppType}>
|
|
<Radio.Group style={{ width: '100%' }} onChange={adAppIdonChange} defaultValue={data.adAppType}>
|
|
- {/* <Radio value={0}>小说</Radio> */}
|
|
|
|
- <Radio value={1}>游戏</Radio>
|
|
|
|
|
|
+ {adAppType === 0 ? <Radio value={0}>小说</Radio> : <Radio value={1}>游戏</Radio>}
|
|
</Radio.Group>
|
|
</Radio.Group>
|
|
</Col>
|
|
</Col>
|
|
</Row>
|
|
</Row>
|
|
@@ -123,7 +139,7 @@ function QQAuth(props: { qqVisible: boolean, callBack: () => void }) {
|
|
</Row>
|
|
</Row>
|
|
<Row style={{ display: 'flex', justifyContent: 'center', marginTop: 20 }}>
|
|
<Row style={{ display: 'flex', justifyContent: 'center', marginTop: 20 }}>
|
|
<Space>
|
|
<Space>
|
|
- <Button type='primary' onClick={submit} loading={loading}>提交</Button>
|
|
|
|
|
|
+ <Button type='primary' onClick={submit} loading={loading} disabled={data.users.length === 0}>提交</Button>
|
|
<Button type='default' onClick={query} >查询授权失败账号</Button>
|
|
<Button type='default' onClick={query} >查询授权失败账号</Button>
|
|
<Popconfirm title={'清除账号状态将清除所有失败记录,并清空上一次扫码授权状态!'} onConfirm={del} >
|
|
<Popconfirm title={'清除账号状态将清除所有失败记录,并清空上一次扫码授权状态!'} onConfirm={del} >
|
|
<Button type='primary' danger >清除账号状态</Button>
|
|
<Button type='primary' danger >清除账号状态</Button>
|
|
@@ -146,13 +162,17 @@ function QQAuth(props: { qqVisible: boolean, callBack: () => void }) {
|
|
<Modal
|
|
<Modal
|
|
visible={visible}
|
|
visible={visible}
|
|
footer={null}
|
|
footer={null}
|
|
- width={200}
|
|
|
|
- onCancel={() => setVisible(false)}
|
|
|
|
|
|
+ width={250}
|
|
|
|
+ onCancel={() => { setVisible(false); location.reload() }}
|
|
maskClosable={false}
|
|
maskClosable={false}
|
|
|
|
+ title={<>{data?.smType === 'QQ' ? "QQ扫码" : "微信扫码"}</>}
|
|
>
|
|
>
|
|
- <Image
|
|
|
|
- style={{ width: 150 }}
|
|
|
|
- src={codeUrl} />
|
|
|
|
|
|
+ <div style={{ display: 'flex', justifyItems: "center", alignItems: 'center' }}>
|
|
|
|
+ <Image
|
|
|
|
+ style={{ width: 150 }}
|
|
|
|
+ src={codeUrl} />
|
|
|
|
+ <strong style={{ color: 'red', width: '100%', textAlign: 'center' }}>扫码成功后自动关闭窗口</strong>
|
|
|
|
+ </div>
|
|
</Modal>
|
|
</Modal>
|
|
</div>
|
|
</div>
|
|
</Modal>
|
|
</Modal>
|