Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
xiaoxiaole
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
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
wildfirecode13
xiaoxiaole
Commits
7c3f0db5
Commit
7c3f0db5
authored
Oct 11, 2019
by
邱旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
46d69171
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
230 additions
and
123 deletions
+230
-123
index.html
egret/index.html
+51
-0
NetName.ts
egret/libs/tw/enum/NetName.ts
+7
-1
NetManager.ts
egret/libs/tw/manager/NetManager.ts
+3
-3
InviteItemSkin.exml
egret/resource/skins/InviteItemSkin.exml
+1
-1
InviteSkin.exml
egret/resource/skins/InviteSkin.exml
+6
-3
MapScene.ts
egret/src/mapScene/MapScene.ts
+6
-1
InvitePanel.ts
egret/src/panels/InvitePanel.ts
+131
-97
getInviteInfo.json
mock/happyclear/getInviteInfo.json
+24
-16
getShareCode.json
mock/happyclear/getShareCode.json
+1
-1
No files found.
egret/index.html
View file @
7c3f0db5
...
@@ -47,6 +47,57 @@
...
@@ -47,6 +47,57 @@
<script
src=
"libs/aes.js"
></script>
<script
src=
"libs/aes.js"
></script>
<script
src=
"libs/pad-zeropadding.js"
></script>
<script
src=
"libs/pad-zeropadding.js"
></script>
<img
id=
"pic"
style=
"width:100%;position: absolute;z-index: 999;display: none;"
/>
<img
id=
"pic"
style=
"width:100%;position: absolute;z-index: 999;display: none;"
/>
<script>
/*
* 邀请有礼分享
*/
function
inviteShare
(
shareCode
)
{
let
title
=
""
;
let
content
=
""
;
let
targetUrl
=
""
+
"?shareCode="
+
shareCode
;
// 待修改
let
iconUrl
=
"http://yun.duiba.com.cn/db_games/xiaoxiaole.jpg"
;
let
shareWays
=
"1,2"
;
console
.
log
(
"AppReady"
);
if
(
isIphone
())
{
console
.
log
(
"IOS"
);
console
.
log
(
window
.
SNNativeClient
);
window
.
callNativeShareResult
=
function
()
{
};
window
.
SNNativeClient
.
callNativeShare
(
title
,
content
,
targetUrl
,
iconUrl
,
shareWays
);
}
else
{
console
.
log
(
"安卓"
);
console
.
log
(
shareApi
);
console
.
log
(
shareApi
.
callMediaShare
);
shareApi
.
callNativeShare
(
title
,
content
,
targetUrl
,
iconUrl
,
shareWays
);
}
}
function
share
()
{
let
title
=
""
;
let
content
=
""
;
let
targetUrl
=
""
;
let
iconUrl
=
"http://yun.duiba.com.cn/db_games/xiaoxiaole.jpg"
;
let
shareWays
=
""
;
console
.
log
(
"AppReady"
);
if
(
isIphone
())
{
console
.
log
(
"IOS"
);
console
.
log
(
window
.
SNNativeClient
);
window
.
callNativeShareResult
=
function
()
{
};
window
.
SNNativeClient
.
callNativeShare
(
title
,
content
,
targetUrl
,
iconUrl
,
shareWays
);
}
else
{
console
.
log
(
"安卓"
);
console
.
log
(
shareApi
);
console
.
log
(
shareApi
.
callMediaShare
);
shareApi
.
callNativeShare
(
title
,
content
,
targetUrl
,
iconUrl
,
shareWays
);
}
}
function
isIphone
()
{
var
ua
=
navigator
.
userAgent
.
toLocaleLowerCase
();
if
(
ua
.
match
(
/iphone|ipad/
))
{
return
true
;
}
else
if
(
ua
.
match
(
/android/
))
{
return
false
;
}
}
</script>
<script>
<script>
window
[
'signconfigs'
]
=
[
window
[
'signconfigs'
]
=
[
{
nums
:
'0.15元'
,
type
:
'quan15'
},
{
nums
:
'0.15元'
,
type
:
'quan15'
},
...
...
egret/libs/tw/enum/NetName.ts
View file @
7c3f0db5
...
@@ -71,5 +71,11 @@ export enum NetName {
...
@@ -71,5 +71,11 @@ export enum NetName {
SIGN_DO_SIGN
,
SIGN_DO_SIGN
,
//查询奖品记录
//查询奖品记录
GET_RECORD
GET_RECORD
,
// 邀请有礼
GET_SHARECODE
,
DO_HELP
,
GET_INVATE_INFO
}
}
\ No newline at end of file
egret/libs/tw/manager/NetManager.ts
View file @
7c3f0db5
...
@@ -1901,7 +1901,7 @@ export class NetManager extends ABNetManager {
...
@@ -1901,7 +1901,7 @@ export class NetManager extends ABNetManager {
*/
*/
public
getShareCode
(
callback
:
Function
):
void
{
public
getShareCode
(
callback
:
Function
):
void
{
const
net
:
INetData
=
{
const
net
:
INetData
=
{
name
:
NetName
.
CUSTOM_THROUGH_SUBMIT
,
name
:
NetName
.
GET_SHARECODE
,
uri
:
'/customActivity/happyclear/getShareCode'
,
uri
:
'/customActivity/happyclear/getShareCode'
,
type
:
'post'
,
type
:
'post'
,
dataType
:
'json'
,
dataType
:
'json'
,
...
@@ -1921,7 +1921,7 @@ export class NetManager extends ABNetManager {
...
@@ -1921,7 +1921,7 @@ export class NetManager extends ABNetManager {
*/
*/
public
doHelp
(
callback
:
Function
,
shareCode
:
any
,
orderId
:
number
):
void
{
public
doHelp
(
callback
:
Function
,
shareCode
:
any
,
orderId
:
number
):
void
{
const
net
:
INetData
=
{
const
net
:
INetData
=
{
name
:
NetName
.
CUSTOM_THROUGH_SUBMIT
,
name
:
NetName
.
DO_HELP
,
uri
:
'/customActivity/happyclear/doHelp'
,
uri
:
'/customActivity/happyclear/doHelp'
,
type
:
'post'
,
type
:
'post'
,
dataType
:
'json'
,
dataType
:
'json'
,
...
@@ -1941,7 +1941,7 @@ export class NetManager extends ABNetManager {
...
@@ -1941,7 +1941,7 @@ export class NetManager extends ABNetManager {
*/
*/
public
getInvateInfo
(
callback
:
Function
):
void
{
public
getInvateInfo
(
callback
:
Function
):
void
{
const
net
:
INetData
=
{
const
net
:
INetData
=
{
name
:
NetName
.
CUSTOM_THROUGH_SUBMIT
,
name
:
NetName
.
GET_INVATE_INFO
,
uri
:
'/customActivity/happyclear/invitationInfo'
,
uri
:
'/customActivity/happyclear/invitationInfo'
,
type
:
'post'
,
type
:
'post'
,
dataType
:
'json'
,
dataType
:
'json'
,
...
...
egret/resource/skins/InviteItemSkin.exml
View file @
7c3f0db5
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<e:Skin
class=
"InviteItemSkin"
width=
"90"
height=
"90"
xmlns:e=
"http://ns.egret.com/eui"
xmlns:w=
"http://ns.egret.com/wing"
>
<e:Skin
class=
"InviteItemSkin"
width=
"90"
height=
"90"
xmlns:e=
"http://ns.egret.com/eui"
xmlns:w=
"http://ns.egret.com/wing"
>
<e:Image
id=
"img"
left=
"0"
top=
"0"
bottom=
"0"
right=
"0"
source=
"
"
/>
<e:Image
id=
"img"
source=
""
top=
"0"
left=
"0"
bottom=
"0"
right=
"0
"
/>
</e:Skin>
</e:Skin>
\ No newline at end of file
egret/resource/skins/InviteSkin.exml
View file @
7c3f0db5
...
@@ -23,13 +23,16 @@
...
@@ -23,13 +23,16 @@
</e:Button>
</e:Button>
<e:Label
id=
"numLabel"
text=
"仅差3人可获得"
y=
"679.33"
textColor=
"0xf54500"
size=
"28"
horizontalCenter=
"0"
/>
<e:Label
id=
"numLabel"
text=
"仅差3人可获得"
y=
"679.33"
textColor=
"0xf54500"
size=
"28"
horizontalCenter=
"0"
/>
<e:Label
id=
"cutTimeLabel"
text=
"将在23:43:21后失效"
y=
"883.33"
size=
"28"
textColor=
"0xffffff"
horizontalCenter=
"0"
/>
<e:Label
id=
"cutTimeLabel"
text=
"将在23:43:21后失效"
y=
"883.33"
size=
"28"
textColor=
"0xffffff"
horizontalCenter=
"0"
/>
<e:Scroller
width=
"554"
height=
"90"
y=
"766.33"
anchorOffsetX=
"0"
anchorOffsetY=
"0"
horizontalCenter=
"0
"
>
<e:Scroller
width=
"554"
height=
"90"
y=
"766.33"
anchorOffsetX=
"0"
anchorOffsetY=
"0"
x=
"98
"
>
<e:Group
anchorOffsetX=
"0"
>
<e:Group
anchorOffsetX=
"0"
>
<e:List
id=
"list"
x=
"0"
height=
"100%"
y=
"0"
anchorOffsetX=
"0"
width=
"100%
"
>
<e:List
id=
"list"
x=
"0"
y=
"0"
anchorOffsetX=
"0
"
>
<e:layout>
<e:layout>
<e:HorizontalLayout
horizontalAlign=
"center"
verticalAlign=
"middle"
gap=
"66
"
/>
<e:HorizontalLayout
gap=
"66"
horizontalAlign=
"center"
verticalAlign=
"middle
"
/>
</e:layout>
</e:layout>
</e:List>
</e:List>
<e:layout>
<e:HorizontalLayout
gap=
"66"
horizontalAlign=
"center"
verticalAlign=
"middle"
/>
</e:layout>
</e:Group>
</e:Group>
</e:Scroller>
</e:Scroller>
</e:Skin>
</e:Skin>
\ No newline at end of file
egret/src/mapScene/MapScene.ts
View file @
7c3f0db5
...
@@ -347,7 +347,12 @@ export default class MapScene extends Scene {
...
@@ -347,7 +347,12 @@ export default class MapScene extends Scene {
PanelCtrl
.
instance
.
show
(
'task'
);
PanelCtrl
.
instance
.
show
(
'task'
);
}
}
onTap_inviteBtn
(){
onTap_inviteBtn
(){
PanelCtrl
.
instance
.
show
(
'invite'
);
NetManager
.
ins
.
getInvateInfo
((
success
,
res
)
=>
{
if
(
!
success
||
!
res
.
data
){
return
;
}
PanelCtrl
.
instance
.
show
(
'invite'
,
res
.
data
);
});
}
}
onTap_friendBtn
(){
onTap_friendBtn
(){
PanelCtrl
.
instance
.
show
(
'friend'
);
PanelCtrl
.
instance
.
show
(
'friend'
);
...
...
egret/src/panels/InvitePanel.ts
View file @
7c3f0db5
import
Panel
from
"../../libs/new_wx/components/Panel"
;
import
Panel
from
"../../libs/new_wx/components/Panel"
;
import
{
callShareApi
,
hideShare
}
from
"../shareCtrl"
;
import
layers
from
"../../libs/new_wx/views/layers"
;
import
ComponentBase
from
"../../libs/new_wx/components/ComponentBase"
;
import
{
iswx
}
from
"../iswx"
;
import
{
iswx
}
from
"../iswx"
;
import
getSkinPath
from
"../../libs/new_wx/utils/getSkinPath"
;
import
getSkinPath
from
"../../libs/new_wx/utils/getSkinPath"
;
import
InviteRulePanel
from
"./InviteRulePanel"
;
import
InviteRulePanel
from
"./InviteRulePanel"
;
import
{
NetManager
}
from
"../../libs/tw/manager/NetManager"
;
export
default
class
InvitePanel
extends
Panel
{
export
default
class
InvitePanel
extends
Panel
{
public
prizeImg
:
eui
.
Image
;
public
prizeImg
:
eui
.
Image
;
...
@@ -13,7 +11,15 @@ export default class InvitePanel extends Panel {
...
@@ -13,7 +11,15 @@ export default class InvitePanel extends Panel {
public
numLabel
:
eui
.
Label
;
public
numLabel
:
eui
.
Label
;
public
cutTimeLabel
:
eui
.
Label
;
public
cutTimeLabel
:
eui
.
Label
;
public
list
:
eui
.
List
;
public
list
:
eui
.
List
;
private
invite_img
:
egret
.
Texture
;
private
invite_img
:
egret
.
Texture
;
private
timer
:
egret
.
Timer
;
private
cutTime
:
number
;
constructor
(
data
)
{
super
();
this
.
data
=
data
;
}
start
(
data
)
{
start
(
data
)
{
super
.
start
();
super
.
start
();
...
@@ -54,20 +60,48 @@ export default class InvitePanel extends Panel {
...
@@ -54,20 +60,48 @@ export default class InvitePanel extends Panel {
}
}
initUI
()
{
initUI
()
{
let
data
=
[
this
.
prizeImg
.
source
=
this
.
data
.
img
;
{
let
dNum
=
this
.
data
.
invitationCount
-
this
.
data
.
invitationUser
.
length
;
img
:
this
.
invite_img
,
this
.
numLabel
.
text
=
`仅差
${
dNum
}
人可获得`
;
},
for
(
let
i
=
0
;
i
<
dNum
;
i
++
)
{
{
this
.
data
.
invitationUser
.
push
({
img
:
this
.
invite_img
,
nickname
:
"nickname"
,
},
avatar
:
this
.
invite_img
,
{
});
img
:
this
.
invite_img
,
}
},
];
this
.
list
.
useVirtualLayout
=
false
;
this
.
list
.
useVirtualLayout
=
false
;
this
.
list
.
itemRenderer
=
InviteItem
;
this
.
list
.
itemRenderer
=
InviteItem
;
this
.
list
.
dataProvider
=
new
eui
.
ArrayCollection
(
data
);
this
.
list
.
dataProvider
=
new
eui
.
ArrayCollection
(
this
.
data
.
invitationUser
);
this
.
cutTime
=
this
.
data
.
endTime
-
this
.
data
.
sysTime
+
1000
;
this
.
timer
=
new
egret
.
Timer
(
1000
,
0
);
this
.
timer
.
addEventListener
(
egret
.
TimerEvent
.
TIMER
,
this
.
cutTimer
,
this
);
this
.
timer
.
start
();
this
.
cutTimer
();
}
private
cutTimer
()
{
let
timer
=
this
.
convertTime
(
this
.
cutTime
-=
1000
);
if
(
timer
.
hour
===
0
&&
timer
.
min
===
0
&&
timer
.
sec
===
0
)
{
this
.
timer
.
stop
();
this
.
hidePanel
();
}
this
.
cutTimeLabel
.
text
=
`将在
${
timer
.
hour
}
:
${
timer
.
min
}
:
${
timer
.
sec
}
后失效`
;
}
private
convertTime
(
time
:
number
)
{
let
hour
=
~~
(
time
/
3600000
);
// 小时
let
min
=
~~
((
time
-
hour
*
3600000
)
/
60000
);
// 分
let
sec
=
~~
((
time
-
hour
*
3600000
-
min
*
60000
)
/
1000
);
// 秒
return
{
hour
:
hour
,
min
:
min
,
sec
:
sec
,
}
}
}
protected
get
closeBtns
():
eui
.
Button
[]
{
protected
get
closeBtns
():
eui
.
Button
[]
{
...
@@ -97,90 +131,90 @@ class InviteItem extends eui.ItemRenderer {
...
@@ -97,90 +131,90 @@ class InviteItem extends eui.ItemRenderer {
}
}
dataChanged
()
{
dataChanged
()
{
this
.
img
.
source
=
this
.
data
.
img
;
this
.
img
.
source
=
this
.
data
.
avatar
;
this
.
img
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
this
.
img
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
showShareTips
(
""
);
NetManager
.
ins
.
getShareCode
((
success
,
res
)
=>
{
},
this
);
if
(
!
success
)
{
}
return
;
}
////////////////////////////////////////////////////////////////////////////////////////////////
class
ShareTips
extends
ComponentBase
{
public
inviteGroup
:
eui
.
Group
;
public
btn1
:
eui
.
Button
;
public
btn2
:
eui
.
Button
;
private
img
:
string
;
setUrl
(
img
:
string
)
{
this
.
img
=
img
;
}
}
let
shareCode
=
res
.
data
;
start
()
{
this
.
once
(
egret
.
TouchEvent
.
ADDED_TO_STAGE
,
()
=>
{
this
.
height
=
this
.
stage
.
stageHeight
;
},
this
);
this
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
hideShare
();
},
this
);
this
.
btn1
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
if
(
iswx
())
{
//微信端
if
(
iswx
())
{
//微信端
}
else
{
//端内
}
else
{
//端内
this
.
getFunc
(
'2'
);
//朋友圈
window
[
"inviteShare"
](
shareCode
);
}
}
});
hideShare
();
},
this
);
},
this
);
this
.
btn2
.
addEventListener
(
egret
.
TouchEvent
.
TOUCH_TAP
,
()
=>
{
if
(
iswx
())
{
//微信端
}
else
{
//端内
this
.
getFunc
(
'1'
);
//好友微信
}
hideShare
();
},
this
);
}
//channel 1 好友 2 朋友圈
getFunc
(
channel
:
string
)
{
// let base64;
// if(this.type==1)
// base64= getPrintScreenData(this['pic' + this.type], 0, 0, 579, 866);
// else
// base64= getPrintScreenData(this['pic' + this.type], 0, 0, 600, 965);
// NetManager.ins.imgUrl((success) => {
// const data = DataManager.ins.getData('imgURL');
// img.src = base64;
// img.src = data.data;
// }, base64);
callShareApi
(
this
.
img
,
channel
);
}
get
skinKey
()
{
return
'ShareTips'
;
}
}
}
}
let
inited
=
false
;
// ////////////////////////////////////////////////////////////////////////////////////////////////
let
_share
:
ShareTips
;
// // 端内分享提示
const
initShare
=
()
=>
{
// class ShareTips extends ComponentBase {
const
layer
=
layers
.
shareLayer
;
// public inviteGroup: eui.Group;
const
share
=
new
ShareTips
();
// public btn1: eui.Button;
share
.
loadSkin
();
// public btn2: eui.Button;
share
.
start
();
//
layer
.
addChild
(
share
);
// private img: string;
_share
=
share
;
//
};
// setUrl(img: string) {
// this.img = img;
const
showShareTips
=
(
url
:
string
)
=>
{
// }
if
(
!
inited
)
{
//
initShare
();
// start() {
inited
=
true
;
// this.once(egret.TouchEvent.ADDED_TO_STAGE, () => {
}
// this.height = this.stage.stageHeight;
_share
.
setUrl
(
url
);
// }, this);
layers
.
shareLayer
.
visible
=
true
;
//
};
// this.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
\ No newline at end of file
// hideShare();
// }, this);
//
// this.btn1.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
// this.getFunc();//朋友圈
// hideShare();
// }, this);
//
// this.btn2.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
// this.getFunc();//朋友圈
// hideShare();
// }, this);
// }
//
// getFunc() {
// NetManager.ins.getShareCode((success, res) => {
// if(!success) {
// return;
// }
// if(iswx()) { //微信端
//
// } else {//端内
// window["inviteShare"](res.data);
// }
// });
// }
//
// get skinKey() {
// return 'ShareTips';
// }
// }
//
// let inited = false;
// let _share: ShareTips;
// const initShare = () => {
// const layer = layers.shareLayer;
// const share = new ShareTips();
// share.loadSkin();
// share.start();
// layer.addChild(share);
// _share = share;
// };
//
// const showShareTips = (url: string) => {
// if(!inited) {
// initShare();
// inited = true;
// }
// _share.setUrl(url);
// layers.shareLayer.visible = true;
// };
\ No newline at end of file
mock/happyclear/getInviteInfo.json
View file @
7c3f0db5
{
{
"success"
:
true
,
"success"
:
true
,
"code"
:
null
,
"code"
:
null
,
"desc"
:
null
,
"desc"
:
null
,
"timestamp"
:
1566199822308
,
"timestamp"
:
1566199822308
,
"data"
:{
"data"
:
{
"invitationId"
:
"活动id"
,
"invitationId"
:
"活动id"
,
"invitationCount"
:
1
,
"invitationCount"
:
3
,
"img"
:
"图片
"
,
"img"
:
"http://yun.duiba.com.cn/db_games/xiaoxiaole.jpg
"
,
"sysTime"
:
1566199822308
,
"sysTime"
:
1570586400000
,
"endTime"
:
1566199822308
,
"endTime"
:
1570672800000
,
"invitationUser"
:[
"invitationUser"
:
[
{
{
"nickname"
:
"nickname"
,
"nickname"
:
"nickname"
,
"avatar"
:
"avatar
"
"avatar"
:
"http://yun.duiba.com.cn/db_games/xiaoxiaole.jpg
"
}
}
],
],
"completeFlag"
:
true
,
"completeFlag"
:
true
,
"openPriz"
:
true
,
"openPriz"
:
true
,
"openPrizMsg"
:
"图片"
"openPrizMsg"
:
"图片"
,
"prizeInfo"
:
[
{
"prizeType"
:
"nickname"
,
"prizeName"
:
"nickname"
,
"prizeImg"
:
"nickname"
,
"facePrice"
:
"avatar"
}
]
}
}
}
}
\ No newline at end of file
mock/happyclear/getShareCode.json
View file @
7c3f0db5
...
@@ -3,5 +3,5 @@
...
@@ -3,5 +3,5 @@
"code"
:
null
,
"code"
:
null
,
"desc"
:
null
,
"desc"
:
null
,
"timestamp"
:
1566199822308
,
"timestamp"
:
1566199822308
,
"data"
:
""
"data"
:
"
666
"
}
}
\ No newline at end of file
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