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
e826d161
Commit
e826d161
authored
Jul 02, 2020
by
jiangjiantao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加错误监控&打印机问题处理
parent
3232eae9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
44 deletions
+67
-44
app.js
app.js
+28
-8
login.js
pages/login/login.js
+1
-0
printer.js
utils/printer.js
+38
-36
No files found.
app.js
View file @
e826d161
var
fundebug
=
require
(
'./utils/fundebug.0.2.0.min.js'
);
import
monitor
from
'/utils/alipayLogger'
;
import
monitor
from
'/utils/alipayLogger'
;
fundebug
.
init
(
{
apikey
:
'c0c5937571f82aecab3f7578bea5d8163455cd2407863f94829bee12324f57b4'
})
App
(
monitor
.
hookApp
({
App
(
monitor
.
hookApp
({
globalData
:
{
globalData
:
{
version
:
"1.0.1.20200311"
,
version
:
"1.0.1.20200311"
,
...
@@ -15,6 +10,7 @@ App(monitor.hookApp({
...
@@ -15,6 +10,7 @@ App(monitor.hookApp({
TEST_URL
:
"https://cashier.test.miyahub.net/"
,
TEST_URL
:
"https://cashier.test.miyahub.net/"
,
RELEASE_URL
:
"https://cashier.miyahub.com/"
,
RELEASE_URL
:
"https://cashier.miyahub.com/"
,
BASE_URL
:
"https://cashier.miyahub.com/"
,
BASE_URL
:
"https://cashier.miyahub.com/"
,
LOG_URL
:
"https://log.test.miyahub.net/log"
,
appId
:
"2021001107603212"
,
appId
:
"2021001107603212"
,
backScreenAppId
:
"2021001107617164"
,
backScreenAppId
:
"2021001107617164"
,
//小程序容器版本
//小程序容器版本
...
@@ -23,7 +19,7 @@ App(monitor.hookApp({
...
@@ -23,7 +19,7 @@ App(monitor.hookApp({
//模拟器上需要sn有值
//模拟器上需要sn有值
sn
:
"xx"
,
sn
:
"xx"
,
//是否登录完成
//是否登录完成
isLoginOk
:
false
userName
:
""
},
},
...
@@ -136,8 +132,32 @@ App(monitor.hookApp({
...
@@ -136,8 +132,32 @@ App(monitor.hookApp({
});
});
},
},
//错误上报
onError
(
err
)
{
onError
(
err
)
{
fundebug
.
onError
(
err
);
try
{
},
var
commonRequest
=
{
appId
:
this
.
globalData
.
appId
,
account
:
this
.
globalData
.
userName
,
version
:
this
.
globalData
.
version
,
extra_data
:
err
};
my
.
request
({
url
:
this
.
globalData
.
LOG_URL
,
method
:
'POST'
,
dataType
:
'json'
,
timeout
:
30000
,
data
:
commonRequest
,
success
:
(
res
)
=>
{
console
.
log
(
"upload log success"
);
},
fail
:
(
res
)
=>
{
console
.
log
(
"upload log fail"
);
}
});
}
catch
(
e
)
{
console
.
log
(
"upload log exp"
,
e
);
}
}
}));
}));
pages/login/login.js
View file @
e826d161
...
@@ -178,6 +178,7 @@ Page({
...
@@ -178,6 +178,7 @@ Page({
});
});
//登陆信息设置到全局变量
//登陆信息设置到全局变量
getApp
().
globalData
.
localAccountInfo
=
res
.
data
;
getApp
().
globalData
.
localAccountInfo
=
res
.
data
;
getApp
().
globalData
.
userName
=
res
.
data
.
userName
console
.
info
(
`localAccountInfo:
${
JSON
.
stringify
(
getApp
().
globalData
.
localAccountInfo
)}
`
);
console
.
info
(
`localAccountInfo:
${
JSON
.
stringify
(
getApp
().
globalData
.
localAccountInfo
)}
`
);
//通知后屏登录成功
//通知后屏登录成功
this
.
sendLoginOkToBackScreen
();
this
.
sendLoginOkToBackScreen
();
...
...
utils/printer.js
View file @
e826d161
...
@@ -18,41 +18,7 @@ function print({ isCheckStatus, cmds, callback }) {
...
@@ -18,41 +18,7 @@ function print({ isCheckStatus, cmds, callback }) {
console
.
log
(
"查询打印机成功:"
+
JSON
.
stringify
(
res
));
console
.
log
(
"查询打印机成功:"
+
JSON
.
stringify
(
res
));
if
(
res
.
usb
!=
null
&&
res
.
usb
.
length
!=
0
)
{
if
(
res
.
usb
!=
null
&&
res
.
usb
.
length
!=
0
)
{
targetId
=
res
.
usb
[
0
].
id
;
targetId
=
res
.
usb
[
0
].
id
;
if
(
isCheckStatus
==
true
)
{
//滚去打印
//先检测下状态
my
.
ix
.
printerStatus
({
success
:
(
r
)
=>
{
console
.
log
(
"printStatus success==>"
+
JSON
.
stringify
(
r
));
//滚去打印
my
.
ix
.
printer
({
target
:
targetId
,
cmds
:
cmds
,
success
:
(
res
)
=>
{
console
.
log
(
"打印成功:"
+
JSON
.
stringify
(
res
));
if
(
callback
!=
null
)
{
var
result
=
{
code
:
0
,
data
:
"打印成功"
};
callback
(
result
);
}
},
fail
:
(
res
)
=>
{
console
.
log
(
"打印失败:"
+
JSON
.
stringify
(
res
));
if
(
callback
!=
null
)
{
var
result
=
{
code
:
-
1
,
data
:
""
+
res
.
errorMessage
};
callback
(
result
);
}
}
});
},
fail
:
(
r
)
=>
{
console
.
log
(
"printStatus fail==>"
+
JSON
.
stringify
(
r
));
if
(
callback
!=
null
)
{
var
result
=
{
code
:
-
1
,
data
:
""
+
r
.
errorMessage
};
callback
(
result
);
}
}
});
}
else
{
//滚去打印
my
.
ix
.
printer
({
my
.
ix
.
printer
({
target
:
targetId
,
target
:
targetId
,
cmds
:
cmds
,
cmds
:
cmds
,
...
@@ -71,7 +37,43 @@ function print({ isCheckStatus, cmds, callback }) {
...
@@ -71,7 +37,43 @@ function print({ isCheckStatus, cmds, callback }) {
}
}
}
}
});
});
}
// if (isCheckStatus == true) {
// //先检测下状态
// my.ix.printerStatus({
// success: (r) => {
// console.log("printStatus success==>" + JSON.stringify(r));
// //滚去打印
// my.ix.printer({
// target: targetId,
// cmds: cmds,
// success: (res) => {
// console.log("打印成功:" + JSON.stringify(res));
// if (callback != null) {
// var result = { code: 0, data: "打印成功" };
// callback(result);
// }
// },
// fail: (res) => {
// console.log("打印失败:" + JSON.stringify(res));
// if (callback != null) {
// var result = { code: -1, data: "" + res.errorMessage };
// callback(result);
// }
// }
// });
// },
// fail: (r) => {
// console.log("printStatus fail==>" + JSON.stringify(r));
// if (callback != null) {
// var result = { code: -1, data: "" + r.errorMessage };
// callback(result);
// }
// }
// });
// } else {
// }
}
else
{
}
else
{
if
(
callback
!=
null
)
{
if
(
callback
!=
null
)
{
...
...
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