Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
RB_StrongestBrain_250520
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
SparkProjects
RB_StrongestBrain_250520
Commits
6eef1fb7
Commit
6eef1fb7
authored
May 22, 2025
by
cc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
df6c808e
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
69 additions
and
70 deletions
+69
-70
App.tsx
src/App.tsx
+13
-3
HomePage.tsx
src/pages/HomePage/HomePage.tsx
+4
-2
fetcher.ts
src/store/fetcher.ts
+28
-12
share.ts
src/store/share.ts
+24
-1
store.ts
src/store/store.ts
+0
-52
No files found.
src/App.tsx
View file @
6eef1fb7
...
...
@@ -12,7 +12,7 @@ import musicStore from "@/store/musicStore.ts";
import
{
initWx
}
from
"@/built-in/share/weixin/weixin.ts"
;
import
{
ModalCtrl
}
from
"@/core/ctrls/ModalCtrl.tsx"
;
import
{
PageCtrl
}
from
"@/core/ctrls/PageCtrl.tsx"
;
import
{
GetCurrSkinId
,
getCustomShareId
}
from
"@/utils/utils.ts"
;
import
{
GetCurrSkinId
,
getCustomShareId
,
isMiniprogram
}
from
"@/utils/utils.ts"
;
import
MyPrize
from
"@/pages/MyPrize/MyPrize.tsx"
;
import
LoadingDemo
from
"@/pages/LoadingDemo/LoadingDemo.tsx"
;
...
...
@@ -21,6 +21,9 @@ import GamePage from "@/pages/GamePage/GamePage.tsx";
import
HomePage
from
'./pages/HomePage/HomePage.tsx'
;
import
AgentSharepage
from
'./pages/agentSharepage/sharepage.jsx'
;
import
SharePage
from
'./pages/sharepage/sharepage.jsx'
;
import
{
onInitShare
}
from
'./utils/share.ts'
;
import
{
domain
,
ensureDomain
}
from
"@spark/dbdomain"
;
import
shareStore
from
'./store/share.ts'
;
@
observer
...
...
@@ -31,7 +34,8 @@ class App extends Component {
const
defaultPage
=
{
myPrize
:
MyPrize
,
// TODO 举例子 新宿台奖品页
index
:
LoadingDemo
,
}[
skinId
]
||
GamePage
;
sharepage
:
SharePage
,
}[
skinId
]
||
HomePage
;
PageCtrl
.
changePage
(
defaultPage
);
}
...
...
@@ -39,7 +43,13 @@ class App extends Component {
this
.
showDefaultPage
();
await
store
.
getFrontVariable
();
store
.
initShare
()
await
onInitShare
();
await
ensureDomain
();
CFG
.
domain
=
domain
;
if
(
isMiniprogram
()){
//小程序域名写死
CFG
.
domain
=
"https://96094-activity.dexfu.cn"
;
}
shareStore
.
initShare
()
}
componentWillUnmount
()
{
...
...
src/pages/HomePage/HomePage.tsx
View file @
6eef1fb7
...
...
@@ -13,6 +13,7 @@ import store from '@/store/store';
import
Taskpop
from
'@/panels/taskpop/taskpop.jsx'
;
import
RankPage
from
'../RankPage/RankPage.js'
;
import
MyPrize
from
'../MyPrize/MyPrize.js'
;
import
shareStore
from
'@/store/share.js'
;
@
observer
...
...
@@ -23,8 +24,9 @@ class Homepage extends React.Component {
this
.
handleButtonClick
=
this
.
handleButtonClick
.
bind
(
this
);
}
componentDidMount
()
{
store
.
updateIndex
()
async
componentDidMount
()
{
await
store
.
updateIndex
()
await
shareStore
.
doAssist
();
}
handleButtonClick
=
_asyncThrottle
(
async
(
number
)
=>
{
...
...
src/store/fetcher.ts
View file @
6eef1fb7
import
{
Toast
}
from
"@grace/ui"
;
// import { callApi } from "@spark/api-base";
// import { getDomain } from "@spark/dbdomain";
import
{
getDomain
}
from
"@spark/dbdomain"
;
import
{
Axios
}
from
'axios'
;
const
apiAxios
=
new
Axios
({
timeout
:
10000
,
});
/** 处理cookie */
export
const
saveCookies
=
async
()
=>
{
//
const domain = await getDomain();
const
domain
=
await
getDomain
();
// const data = await callApi(`${domain}/autoLogin/tempSaveCookie`);
// console.info(`%c cookieId: ${data}`, "font-size: 20px; color: orange");
// if (!!data) {
// localStorage.setItem("cookieId", data);
// }
const
resInfo
=
await
apiAxios
.
request
({
method
:
'get'
,
url
:
`
${
domain
}
/autoLogin/tempSaveCookie`
,
})
const
res
=
JSON
.
parse
(
resInfo
.
data
)
console
.
log
(
'res'
,
res
)
if
(
!
res
?.
success
)
{
return
;
}
if
(
!!
res
.
data
)
{
localStorage
.
setItem
(
"cookieId"
,
res
.
data
);
}
};
/** 设置cookies */
export
const
setCookies
=
async
()
=>
{
//
const cookieId = localStorage.getItem("cookieId");
//
const domain = await getDomain();
//
if (!!cookieId) {
const
cookieId
=
localStorage
.
getItem
(
"cookieId"
);
const
domain
=
await
getDomain
();
if
(
!!
cookieId
)
{
// await callApi(`${domain}/autoLogin/resetCookie?duibaTempCookieId=${cookieId}`);
// localStorage.removeItem("cookieId");
// }
const
resInfo
=
await
apiAxios
.
request
({
method
:
'get'
,
url
:
`
${
domain
}
/autoLogin/resetCookie?duibaTempCookieId=
${
cookieId
}
`
,
})
// const res = JSON.parse(resInfo.data)
localStorage
.
removeItem
(
"cookieId"
);
}
};
src/store/share.ts
View file @
6eef1fb7
...
...
@@ -3,7 +3,7 @@ import API from "../api/index";
import
{
showShareGuide
}
from
"@spark/share"
;
import
store
from
"./store"
;
import
{
isIos
,
isWeChat
,
onUpdateShare
}
from
"@/utils/share"
;
import
{
isMiniprogram
,
windowJumpUrl
}
from
"@/utils/utils"
;
import
{
GetCurrSkinId
,
getCustomShareId
,
getUrlParam
,
isMiniprogram
,
windowJumpUrl
}
from
"@/utils/utils"
;
// import modalStore from "./modal";
import
{
Toast
}
from
"@grace/ui"
;
function
isEnterpriseWeChat
()
{
...
...
@@ -12,6 +12,29 @@ function isEnterpriseWeChat() {
return
/wxwork/
.
test
(
userAgent
);
// 检查是否包含 "wxwork"
}
const
shareStore
=
makeAutoObservable
({
// 初始化分享
initShare
(){
const
skinId
=
GetCurrSkinId
()
||
getCustomShareId
()
||
'index'
;
console
.
log
(
"分享默认渠道==="
,
CFG
.
defaultChannel
);
const
shareInfo
=
JSON
.
parse
(
store
.
frontVariable
.
shareInfo
);
if
(
skinId
==
'index'
)
{
// 首页
let
shareUrl
=
`
${
CFG
.
domain
}${
CFG
.
shareUrl
}
`
;
shareUrl
+=
`&ykCode=
${
CFG
.
workerCode
||
CFG
.
agentCode
||
""
}
`
shareUrl
+=
`&channel=
${
CFG
.
defaultChannel
}
&agentCode=
${
CFG
.
agentCode
||
""
}
&actPlatforms=
${
CFG
.
actPlatforms
||
""
}
&actId=
${
CFG
.
actId
||
""
}
`
onUpdateShare
({
...(
shareInfo
),
url
:
`
${
CFG
.
domain
}${
CFG
.
indexLogin
}${
encodeURIComponent
(
shareUrl
)}
`
});
}
else
{
let
shareUrl
=
`
${
CFG
.
domain
}${
CFG
.
shareUrl
}${
getUrlParam
(
"inviteCode"
)
?
'&inviteCode='
+
getUrlParam
(
"inviteCode"
)
:
""
}
`
;
shareUrl
+=
`&ykCode=
${
CFG
.
workerCode
||
CFG
.
agentCode
||
""
}
`
if
(
CFG
.
channel
)
shareUrl
+=
`&channel=
${
CFG
.
defaultChannel
}
&agentCode=
${
CFG
.
agentCode
||
""
}
&actPlatforms=
${
CFG
.
actPlatforms
||
""
}
&actId=
${
CFG
.
actId
||
""
}
`
onUpdateShare
({
...(
shareInfo
),
url
:
`
${
CFG
.
domain
}${
CFG
.
indexLogin
}${
encodeURIComponent
(
shareUrl
)}
`
});
}
},
/** 普通分享 */
async
doShare
()
{
const
shareInfo
=
JSON
.
parse
(
store
.
frontVariable
.
shareInfo
);
...
...
src/store/store.ts
View file @
6eef1fb7
...
...
@@ -113,58 +113,6 @@ class Store {
return
true
;
}
/** 普通分享 */
async
initShare
()
{
const
domain
=
await
getDomain
();
console
.
error
(
'看下域名'
,
domain
);
let
url
=
`
${
domain
||
location
.
origin
}${
CFG
.
index
}
`
;
const
shareInfo
=
this
.
frontVariable
?.
shareInfo
?.[
0
]
let
option
=
{
title
:
shareInfo
?.
title
,
// 标题
desc
:
shareInfo
?.
desc
||
''
,
// 描述
imgUrl
:
shareInfo
?.
imgUrl
,
link
:
url
};
option
.
link
=
(
domain
||
location
.
origin
)
+
CFG
.
loginMidUrl
+
encodeURIComponent
(
url
);
initWx
(
option
);
}
/** 邀请好友 */
async
doInvite
(
taskCode
)
{
const
domain
=
await
getDomain
();
console
.
error
(
'看下域名'
,
domain
);
let
url
=
`
${
domain
||
location
.
origin
}${
CFG
.
index
}
`
;
const
shareInfo
=
this
.
frontVariable
?.
shareInfo
?.[
1
]
let
option
=
{
title
:
shareInfo
?.
title
,
// 标题
desc
:
shareInfo
?.
desc
||
''
,
// 描述
imgUrl
:
shareInfo
?.
imgUrl
,
link
:
url
};
showShareGuide
();
const
res
=
await
API
.
getChallengeInviteCode
({
taskCode
:
taskCode
})
url
+=
`&inviteCode=
${
res
.
data
.
inviteCode
}
`
;
option
.
link
=
(
domain
||
location
.
origin
)
+
CFG
.
loginMidUrl
+
encodeURIComponent
(
url
);
initWx
(
option
);
}
async
doAssist
()
{
let
inviteCode
=
getUrlParam
(
'inviteCode'
)
if
(
!
inviteCode
||
inviteCode
==
'null'
||
inviteCode
==
'undefined'
)
return
false
;
const
{
success
,
message
,
code
}
=
await
API
.
getChallengeAssist
({
inviteCode
:
inviteCode
});
history
.
replaceState
({},
''
,
location
.
href
.
replace
(
new
RegExp
(
`[?&]inviteCode=[^&]*`
),
''
));
}
async
bindYkCode
(
code
)
{
const
res
=
await
API
.
bindYk
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment