Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taobao-mini-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinhaitao
taobao-mini-template
Commits
17ad1d24
Commit
17ad1d24
authored
Nov 12, 2021
by
mqf_0707
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
会员插件优化
parent
8132299c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
39 deletions
+13
-39
app.config.js
c_client/src/app.config.js
+4
-4
canvasComp.js
...ient/src/components/_miniprogram/canvasComp/canvasComp.js
+3
-8
game.jsx
c_client/src/pages/packageGame/game/game.jsx
+6
-27
No files found.
c_client/src/app.config.js
View file @
17ad1d24
...
@@ -41,10 +41,10 @@ export default {
...
@@ -41,10 +41,10 @@ export default {
cemMember
:
{
cemMember
:
{
version
:
'*'
,
version
:
'*'
,
provider
:
'3000000026642582'
provider
:
'3000000026642582'
},
memberBenefit
:
{
version
:
'*'
,
provider
:
'3000000043103783'
}
}
},
memberBenefit
:
{
version
:
'*'
,
provider
:
'3000000043103783'
}
}
}
}
\ No newline at end of file
c_client/src/components/_miniprogram/canvasComp/canvasComp.js
View file @
17ad1d24
...
@@ -10,13 +10,7 @@ Component({
...
@@ -10,13 +10,7 @@ Component({
data
:
{}
data
:
{}
},
},
didMount
(
query
)
{},
didMount
(
query
)
{},
didUpdate
(
preProps
,
preData
)
{
didUpdate
()
{},
// 实时监听数据更新
const
{
updateFlag
,
data
}
=
this
.
props
if
(
updateFlag
!==
1
&&
updateFlag
!==
preProps
.
updateFlag
)
{
this
.
postMessage
(
data
.
type
,
data
)
}
},
didUnmount
()
{
didUnmount
()
{
// 页面被关闭
// 页面被关闭
this
.
main
&&
this
.
main
.
destroy
();
this
.
main
&&
this
.
main
.
destroy
();
...
@@ -63,7 +57,8 @@ Component({
...
@@ -63,7 +57,8 @@ Component({
},
},
data
:
{
data
:
{
netName
,
netName
,
parameter
parameter
,
postMessage
:
(
netName
,
data
)
=>
this
.
postMessage
(
netName
,
data
)
}
}
})
})
}
else
{
}
else
{
...
...
c_client/src/pages/packageGame/game/game.jsx
View file @
17ad1d24
import
React
,
{
useEffect
,
useState
}
from
'react'
import
React
,
{
useEffect
,
use
Ref
,
use
State
}
from
'react'
import
{
View
}
from
'@tarojs/components'
import
{
View
}
from
'@tarojs/components'
import
{
useDidShow
,
useRouter
,
useDidHide
,
getApp
,
showToast
}
from
'@tarojs/taro'
import
{
useDidShow
,
useRouter
,
useDidHide
,
getApp
,
showToast
}
from
'@tarojs/taro'
import
API
from
'@/api'
import
API
from
'@/api'
...
@@ -19,11 +19,10 @@ function GamePage(props) {
...
@@ -19,11 +19,10 @@ function GamePage(props) {
const
app
=
getApp
()
const
app
=
getApp
()
const
{
activityInfo
,
setActivityInfoAndStatus
}
=
useActivityInfoModel
()
const
{
activityInfo
,
setActivityInfoAndStatus
}
=
useActivityInfoModel
()
const
{
loginInfo
}
=
useLoginInfoModel
()
const
{
loginInfo
}
=
useLoginInfoModel
()
const
[
canvasData
,
setCanvasData
]
=
useState
({})
const
[
taskModalVisible
,
setTaskModalVisible
]
=
useState
(
false
)
const
[
taskModalVisible
,
setTaskModalVisible
]
=
useState
(
false
)
const
[
canvasVisible
,
setCanvasVisible
]
=
useState
(
false
)
const
[
canvasVisible
,
setCanvasVisible
]
=
useState
(
false
)
const
[
memberVisible
,
setMemberVisible
]
=
useState
(
false
)
const
[
memberVisible
,
setMemberVisible
]
=
useState
(
false
)
const
[
updateFlag
,
setUpdateFlag
]
=
useState
(
1
)
const
onHandlePost
=
useRef
(
null
)
useEffect
(()
=>
{
useEffect
(()
=>
{
// getImgShareUrl('cloud://2D60DC04FC1888AF6F865B88F0B2EBCC//share.png').then(res => {
// getImgShareUrl('cloud://2D60DC04FC1888AF6F865B88F0B2EBCC//share.png').then(res => {
...
@@ -46,8 +45,9 @@ function GamePage(props) {
...
@@ -46,8 +45,9 @@ function GamePage(props) {
//和main通信的方法,接收main的信息
//和main通信的方法,接收main的信息
const
onMessage
=
(
e
)
=>
{
const
onMessage
=
(
e
)
=>
{
// 接口名字 参数
// 接口名字 参数
const
{
netName
,
parameter
}
=
e
.
mpEvent
.
data
const
{
netName
,
parameter
,
postMessage
}
=
e
.
mpEvent
.
data
console
.
warn
(
'netName:'
+
netName
,
parameter
)
console
.
warn
(
'netName:'
+
netName
,
parameter
)
if
(
!
onHandlePost
.
current
)
onHandlePost
.
current
=
postMessage
//定制的授权
//定制的授权
if
(
netName
==
"mine.authorize"
)
{
if
(
netName
==
"mine.authorize"
)
{
this
.
getAuth
()
this
.
getAuth
()
...
@@ -60,10 +60,6 @@ function GamePage(props) {
...
@@ -60,10 +60,6 @@ function GamePage(props) {
else
if
(
netName
==
"mine.favorShop"
)
{
else
if
(
netName
==
"mine.favorShop"
)
{
this
.
doFavorShop
()
this
.
doFavorShop
()
}
}
//领养名字,有弹框的
else
if
(
netName
==
"mine.getAdoptName"
)
{
this
.
setData
({
"adoptModalVisible"
:
true
,
type
:
parameter
.
type
})
}
//打开详情页,还有成功失败
//打开详情页,还有成功失败
else
if
(
netName
==
"mine.openDetail"
)
{
else
if
(
netName
==
"mine.openDetail"
)
{
openDetail
(
parameter
.
itemId
)
openDetail
(
parameter
.
itemId
)
...
@@ -122,24 +118,7 @@ function GamePage(props) {
...
@@ -122,24 +118,7 @@ function GamePage(props) {
setMemberVisible
(
true
)
setMemberVisible
(
true
)
break
;
break
;
}
}
setUpdateFlag
(
Math
.
floor
(
Math
.
random
()
*
1000
))
onHandlePost
.
current
&&
onHandlePost
.
current
(
netName
,
data
)
setCanvasData
(
data
)
}
else
{
//获取后端接口
const
{
function
:
fc
}
=
app
.
cloud
;
//处理下带上activityId
if
(
!
parameter
)
parameter
=
{};
parameter
.
activityId
=
app
.
activityId
;
//netName得分割下
fc
.
invoke
(
netName
.
split
(
"."
)[
0
],
parameter
,
netName
.
split
(
"."
)[
1
])
.
then
(
res
=>
{
// console.log("返回数据" + JSON.stringify(res));
//发送消息
this
.
postMessage
(
netName
,
res
||
{
success
:
false
})
},
(
err
)
=>
{
//网络异常,返回失败
this
.
postMessage
(
netName
,
{
success
:
false
})
})
}
}
}
}
// 入会插件
// 入会插件
...
@@ -157,7 +136,7 @@ function GamePage(props) {
...
@@ -157,7 +136,7 @@ function GamePage(props) {
}
}
return
(
return
(
<
View
>
<
View
>
{
canvasVisible
&&
<
canvas
-
comp
data=
{
canvasData
}
onMessage=
{
onMessage
}
updateFlag=
{
updateFlag
}
/>
}
{
canvasVisible
&&
<
canvas
-
comp
onMessage=
{
onMessage
}
/>
}
<
View
className=
{
styles
[
'test-box'
]
}
onClick=
{
(
e
)
=>
onTestHandle
(
e
)
}
>
入会按钮
</
View
>
<
View
className=
{
styles
[
'test-box'
]
}
onClick=
{
(
e
)
=>
onTestHandle
(
e
)
}
>
入会按钮
</
View
>
{
<
member
-
modal
expend=
{
memberVisible
}
onClose=
{
onClose
}
onAuthFail=
{
onAuthFail
}
onAuthSuccess=
{
onAuthSuccess
}
/>
}
{
<
member
-
modal
expend=
{
memberVisible
}
onClose=
{
onClose
}
onAuthFail=
{
onAuthFail
}
onAuthSuccess=
{
onAuthSuccess
}
/>
}
</
View
>
</
View
>
...
...
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