Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
doublescreen-front
Project
Project
Details
Activity
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pengguangpu
doublescreen-front
Commits
d404843d
Commit
d404843d
authored
Feb 26, 2020
by
gaodapeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加系统设置事件的处理
parent
672554e8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
38 deletions
+76
-38
actioncmd.js
const/actioncmd.js
+4
-4
home.js
pages/home/home.js
+41
-23
login.js
pages/login/login.js
+20
-8
paysuccess.js
pages/paysuccess/paysuccess.js
+11
-3
No files found.
const/actioncmd.js
View file @
d404843d
...
...
@@ -31,9 +31,6 @@ export const ACTION_ON_PAY_FAILED = "ACTION_ON_PAY_FAILED";
//去首页
export
const
ACTION_GO_HOME
=
"ACTION_GO_HOME"
;
//获取账户信息
export
const
ACTION_GET_ACCOUNT
=
"ACTION_GET_ACCOUNT"
;
//直接收款
export
const
ACTION_DIRECT_PAYMENT
=
"ACTION_DIRECT_PAYMENT"
;
...
...
@@ -62,4 +59,7 @@ export const ACTION_USE_COUPON = "ACTION_USE_COUPON";
export
const
ACTION_GET_CUR_AD
=
"ACTION_GET_CUR_AD"
;
//发送选中的广告url给前屏
export
const
ACTION_SEND_SEL_AD
=
"ACTION_SEND_SEL_AD"
;
\ No newline at end of file
export
const
ACTION_SEND_SEL_AD
=
"ACTION_SEND_SEL_AD"
;
//系统设置
export
const
ACTION_SYSTEM_SETTING
=
"ACTION_SYSTEM_SETTING"
;
\ No newline at end of file
pages/home/home.js
View file @
d404843d
...
...
@@ -6,9 +6,10 @@ import { API_REFUND } from '../../const/apiurl'
//ACTION
import
{
ACTION_GO_SCAN
,
ACTION_GET_CUR_AD
,
ACTION_SEND_SEL_AD
,
ACTION_
GET_ACCOUNT
,
ACTION_
DIRECT_PAYMENT
,
ACTION_CONVERT_COUPON
,
ACTION_DIRECT_PAYMENT
,
ACTION_CONVERT_COUPON
,
ACTION_GO_HOME
,
ACTION_REFUND
,
ACTION_REFUND_FAILED
,
ACTION_REFUND_SUCCESS
,
ACTION_PRINT_LAST_ORDER
ACTION_REFUND_SUCCESS
,
ACTION_PRINT_LAST_ORDER
,
ACTION_SYSTEM_SETTING
,
}
from
'../../const/actioncmd'
...
...
@@ -23,7 +24,8 @@ Page({
dialogResultSuccessText
:
"恭喜您!兑换成功"
,
dialogResultFailureRemind
:
"兑换码未识别"
,
dialogResultFailureText
:
"兑换失败,请稍后重试!"
,
adUrl
:
"/images/img_ad1.png"
adUrl
:
"/images/img_ad1.png"
,
toSetting
:
false
,
},
onLoad
()
{
...
...
@@ -36,6 +38,13 @@ Page({
success
:
(
res
)
=>
{
console
.
info
(
`onBuddyMessage success:
${
JSON
.
stringify
(
res
)}
`
);
if
(
res
.
action
==
ACTION_GO_SCAN
)
{
if
(
res
.
data
.
printEnabled
!=
null
)
{
my
.
setStorageSync
({
key
:
'printEnabled'
,
data
:
{
enabled
:
res
.
data
.
printEnabled
}
})
}
my
.
ix
.
sendBuddyMessage
({
// 填入目标小程序的 AppID
target
:
getApp
().
globalData
.
backScreenAppId
,
...
...
@@ -54,26 +63,6 @@ Page({
console
.
info
(
`sendBuddyMessage failed:
${
JSON
.
stringify
(
res
)}
`
);
}
});
}
else
if
(
res
.
action
==
ACTION_GET_ACCOUNT
)
{
var
message
=
{
data
:
getApp
().
globalData
.
localAccountInfo
,
action
:
ACTION_GET_ACCOUNT
}
my
.
ix
.
sendBuddyMessage
({
// 填入目标小程序的 AppID
target
:
getApp
().
globalData
.
backScreenAppId
,
data
:
{
action
:
ACTION_GET_ACCOUNT
,
data
:
message
},
success
:
(
res
)
=>
{
console
.
info
(
`sendBuddyMessage success:
${
JSON
.
stringify
(
res
)}
`
);
},
fail
:
(
res
)
=>
{
console
.
info
(
`sendBuddyMessage failed:
${
JSON
.
stringify
(
res
)}
`
);
}
});
}
else
if
(
res
.
action
==
ACTION_DIRECT_PAYMENT
)
{
//直接收款
my
.
ix
.
sendBuddyMessage
({
...
...
@@ -176,9 +165,38 @@ Page({
context
.
setData
({
adUrl
:
selectAdUrl
});
}
else
if
(
res
.
action
==
ACTION_SYSTEM_SETTING
)
{
console
.
log
(
"启动系统设置"
);
my
.
ix
.
startApp
({
appName
:
'settings'
,
});
context
.
setData
({
toSetting
:
true
,
})
}
}
});
if
(
context
.
data
.
toSetting
==
true
)
{
context
.
setData
({
toSetting
:
false
,
});
//让后屏回到首页上
my
.
ix
.
sendBuddyMessage
({
// 填入目标小程序的 AppID
target
:
getApp
().
globalData
.
backScreenAppId
,
data
:
{
action
:
ACTION_GO_HOME
,
data
:
null
},
success
:
(
res
)
=>
{
console
.
info
(
`sendBuddyMessage success:
${
JSON
.
stringify
(
res
)}
`
);
},
fail
:
(
res
)
=>
{
console
.
info
(
`sendBuddyMessage failed:
${
JSON
.
stringify
(
res
)}
`
);
}
});
}
},
/**返回当前选中广告 */
...
...
pages/login/login.js
View file @
d404843d
...
...
@@ -4,6 +4,7 @@ Page({
name
:
""
,
password
:
""
,
sn
:
""
,
containerVersion
:
""
,
//按钮是否可点击
loginDisabled
:
true
,
//错误提示是否可见
...
...
@@ -28,6 +29,13 @@ Page({
getApp
().
globalData
.
sn
=
serialno
.
value
;
}
var
r
=
my
.
ix
.
getVersionSync
();
if
(
r
)
{
this
.
setData
({
containerVersion
:
r
.
versionName
//r.versionCode
})
}
//获取下本地登录数据
var
localLoginInfo
=
my
.
getStorageSync
({
key
:
'localLoginInfo'
,
// 缓存数据的key
...
...
@@ -158,7 +166,7 @@ Page({
content
:
'登录成功'
,
duration
:
3000
});
//通知后屏登录成功
this
.
sendLoginOkToBackScreen
();
...
...
@@ -182,25 +190,29 @@ Page({
},
// 登录完成通知后屏
sendLoginOkToBackScreen
()
{
sendLoginOkToBackScreen
()
{
let
context
=
this
;
var
commonRequest
=
{
action
:
ACTION_LOGIN_OK
,
data
:
getApp
().
globalData
.
localAccountInfo
.
storeName
action
:
ACTION_LOGIN_OK
,
data
:
{
account
:
getApp
().
globalData
.
localAccountInfo
,
sn
:
context
.
data
.
sn
,
containerVersion
:
context
.
data
.
containerVersion
}
};
console
.
log
(
"登录成功,发送数据:"
+
commonRequest
);
my
.
ix
.
sendBuddyMessage
({
target
:
getApp
().
globalData
.
backScreenAppId
,
data
:
commonRequest
,
success
:
(
res
)
=>
{
console
.
log
(
"登录成功通知后屏 成功 ===》"
+
JSON
.
stringify
(
res
));
console
.
log
(
"登录成功通知后屏 成功 ===》"
+
JSON
.
stringify
(
res
));
},
fail
:
(
res
)
=>
{
console
.
log
(
"登录成功通知后屏 失败 ===》 "
+
JSON
.
stringify
(
res
));
console
.
log
(
"登录成功通知后屏 失败 ===》 "
+
JSON
.
stringify
(
res
));
//发送失败重试
context
.
sendLoginOkToBackScreen
();
}
})
}
}
});
pages/paysuccess/paysuccess.js
View file @
d404843d
...
...
@@ -119,14 +119,20 @@ Page({
},
onShow
()
{
var
printEnabledLocal
=
my
.
getStorageSync
({
key
:
'printEnabled'
}).
data
.
enabled
;
if
(
printEnabledLocal
==
null
)
{
printEnabledLocal
=
true
;
}
//开启后屏监听
my
.
ix
.
onBuddyMessage
({
success
:
(
res
)
=>
{
console
.
info
(
`onBuddyMessage success:
${
JSON
.
stringify
(
res
)}
`
);
if
(
res
.
action
==
ACTION_REPRINT
)
{
//重新打印
this
.
print
();
}
else
if
(
res
.
action
==
ACTION_GO_HOME
)
{
if
(
printEnabledLocal
==
true
)
{
this
.
print
();
}
}
else
if
(
res
.
action
==
ACTION_GO_HOME
)
{
//去首页
my
.
reLaunch
({
url
:
"/pages/home/home"
,
...
...
@@ -134,7 +140,9 @@ Page({
}
}
});
this
.
print
();
if
(
printEnabledLocal
==
true
)
{
this
.
print
();
}
},
onHide
()
{
...
...
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