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
fa8b779c
Commit
fa8b779c
authored
Nov 12, 2021
by
王能飞
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'c_client_taro-pack' into 'c_client_taro'
会员插件优化 See merge request
!55
parents
3b4a134a
17ad1d24
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 @
fa8b779c
...
...
@@ -41,10 +41,10 @@ export default {
cemMember
:
{
version
:
'*'
,
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 @
fa8b779c
...
...
@@ -10,13 +10,7 @@ Component({
data
:
{}
},
didMount
(
query
)
{},
didUpdate
(
preProps
,
preData
)
{
// 实时监听数据更新
const
{
updateFlag
,
data
}
=
this
.
props
if
(
updateFlag
!==
1
&&
updateFlag
!==
preProps
.
updateFlag
)
{
this
.
postMessage
(
data
.
type
,
data
)
}
},
didUpdate
()
{},
didUnmount
()
{
// 页面被关闭
this
.
main
&&
this
.
main
.
destroy
();
...
...
@@ -63,7 +57,8 @@ Component({
},
data
:
{
netName
,
parameter
parameter
,
postMessage
:
(
netName
,
data
)
=>
this
.
postMessage
(
netName
,
data
)
}
})
}
else
{
...
...
c_client/src/pages/packageGame/game/game.jsx
View file @
fa8b779c
import
React
,
{
useEffect
,
useState
}
from
'react'
import
React
,
{
useEffect
,
use
Ref
,
use
State
}
from
'react'
import
{
View
}
from
'@tarojs/components'
import
{
useDidShow
,
useRouter
,
useDidHide
,
getApp
,
showToast
}
from
'@tarojs/taro'
import
API
from
'@/api'
...
...
@@ -19,11 +19,10 @@ function GamePage(props) {
const
app
=
getApp
()
const
{
activityInfo
,
setActivityInfoAndStatus
}
=
useActivityInfoModel
()
const
{
loginInfo
}
=
useLoginInfoModel
()
const
[
canvasData
,
setCanvasData
]
=
useState
({})
const
[
taskModalVisible
,
setTaskModalVisible
]
=
useState
(
false
)
const
[
canvasVisible
,
setCanvasVisible
]
=
useState
(
false
)
const
[
memberVisible
,
setMemberVisible
]
=
useState
(
false
)
const
[
updateFlag
,
setUpdateFlag
]
=
useState
(
1
)
const
onHandlePost
=
useRef
(
null
)
useEffect
(()
=>
{
// getImgShareUrl('cloud://2D60DC04FC1888AF6F865B88F0B2EBCC//share.png').then(res => {
...
...
@@ -46,8 +45,9 @@ function GamePage(props) {
//和main通信的方法,接收main的信息
const
onMessage
=
(
e
)
=>
{
// 接口名字 参数
const
{
netName
,
parameter
}
=
e
.
mpEvent
.
data
const
{
netName
,
parameter
,
postMessage
}
=
e
.
mpEvent
.
data
console
.
warn
(
'netName:'
+
netName
,
parameter
)
if
(
!
onHandlePost
.
current
)
onHandlePost
.
current
=
postMessage
//定制的授权
if
(
netName
==
"mine.authorize"
)
{
this
.
getAuth
()
...
...
@@ -60,10 +60,6 @@ function GamePage(props) {
else
if
(
netName
==
"mine.favorShop"
)
{
this
.
doFavorShop
()
}
//领养名字,有弹框的
else
if
(
netName
==
"mine.getAdoptName"
)
{
this
.
setData
({
"adoptModalVisible"
:
true
,
type
:
parameter
.
type
})
}
//打开详情页,还有成功失败
else
if
(
netName
==
"mine.openDetail"
)
{
openDetail
(
parameter
.
itemId
)
...
...
@@ -122,24 +118,7 @@ function GamePage(props) {
setMemberVisible
(
true
)
break
;
}
setUpdateFlag
(
Math
.
floor
(
Math
.
random
()
*
1000
))
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
})
})
onHandlePost
.
current
&&
onHandlePost
.
current
(
netName
,
data
)
}
}
// 入会插件
...
...
@@ -157,7 +136,7 @@ function GamePage(props) {
}
return
(
<
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
>
{
<
member
-
modal
expend=
{
memberVisible
}
onClose=
{
onClose
}
onAuthFail=
{
onAuthFail
}
onAuthSuccess=
{
onAuthSuccess
}
/>
}
</
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