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
6a287b22
Commit
6a287b22
authored
Feb 03, 2020
by
pengguangpu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加登录页逻辑交互;自测通过
parent
3a05fea7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
61 additions
and
12 deletions
+61
-12
mini-program.json
.tea/configuration/mini-program.json
+1
-1
layout.json
.tea/layout.json
+1
-1
app.js
app.js
+16
-0
login.js
pages/login/login.js
+2
-1
api.js
utils/api.js
+41
-9
No files found.
.tea/configuration/mini-program.json
View file @
6a287b22
{
"tinyType"
:
"alipayiot"
,
"tinyCnName"
:
"支付宝 IoT"
,
"tinyProjectType"
:
"xpaas-mini"
,
"alipayiot:xpaas-mini:tinyIcon"
:
"https://gw.alipayobjects.com/mdn/rms_c763d8/afts/img/A*vNMFT7X_u3sAAAAAAAAAAABkARQnAQ"
,
"alipayiot:xpaas-mini:auditLink"
:
null
,
"alipayiot:xpaas-mini:whiteListLink"
:
null
,
"alipayiot:xpaas-mini:createLink"
:
null
,
"alipayiot:xpaas-mini:component2"
:
false
,
"alipayiot:xpaas-mini:_enableAutoPush"
:
false
,
"alipayiot:xpaas-mini:_appIdList"
:[],
"alipayiot:xpaas-mini:uploadTime"
:
""
,
"alipayiot:xpaas-mini:packageSize"
:
0
,
"alipayiot:xpaas-mini:lastDeviceName"
:
"蜻蜓F4"
,
"isSimulatorOpen"
:
true
,
"isNotFirstToggleSimulator"
:
true
,
"storageVersion"
:
"1.5.7"
}
\ No newline at end of file
{
"tinyType"
:
"alipayiot"
,
"tinyCnName"
:
"支付宝 IoT"
,
"tinyProjectType"
:
"xpaas-mini"
,
"alipayiot:xpaas-mini:tinyIcon"
:
"https://gw.alipayobjects.com/mdn/rms_c763d8/afts/img/A*vNMFT7X_u3sAAAAAAAAAAABkARQnAQ"
,
"alipayiot:xpaas-mini:auditLink"
:
null
,
"alipayiot:xpaas-mini:whiteListLink"
:
null
,
"alipayiot:xpaas-mini:createLink"
:
null
,
"alipayiot:xpaas-mini:component2"
:
false
,
"alipayiot:xpaas-mini:_enableAutoPush"
:
false
,
"alipayiot:xpaas-mini:_appIdList"
:[],
"alipayiot:xpaas-mini:uploadTime"
:
""
,
"alipayiot:xpaas-mini:packageSize"
:
0
,
"alipayiot:xpaas-mini:lastDeviceName"
:
"蜻蜓F4"
,
"isSimulatorOpen"
:
true
,
"isNotFirstToggleSimulator"
:
true
,
"alipayiot:xpaas-mini:MockStore"
:{
"localLoginInfo"
:{
"name"
:
"ywxadmin"
,
"password"
:
"1234567a"
,
"sn"
:
""
},
"localAccountInfo"
:{
"accountId"
:
126
,
"actType"
:
1
,
"agreement"
:
1
,
"isShopCart"
:
0
,
"merchantId"
:
"2088222276054714"
,
"merchantName"
:
"一网鲜(杭州)信息科技有限公司"
,
"realName"
:
"力拔山兮气盖世时不利兮骓不逝"
,
"storeList"
:[{
"address"
:
"杭州市江干区科技园路2号"
,
"hasStoreManager"
:
1
,
"storeId"
:
"001"
,
"storeName"
:
"一网鲜"
}],
"token"
:
"431145114888654848"
,
"userName"
:
"ywxadmin"
,
"userPhone"
:
"13858057743"
}},
"storageVersion"
:
"1.5.7"
}
\ No newline at end of file
.tea/layout.json
View file @
6a287b22
{
"layout"
:{
"left"
:{
"currentId"
:
"scm_container"
,
"size"
:
310
},
"right"
:{
"currentId"
:
""
},
"bottom"
:{
"currentId"
:
""
}},
"storageVersion"
:
"1.5.7"
}
\ No newline at end of file
{
"layout"
:{
"left"
:{
"currentId"
:
"scm_container"
,
"size"
:
310
},
"right"
:{
"currentId"
:
""
},
"bottom"
:{
"currentId"
:
""
,
"size"
:
307
}},
"storageVersion"
:
"1.5.7"
}
\ No newline at end of file
app.js
View file @
6a287b22
App
({
globalData
:
{
version
:
"1.0.0.20200203"
,
//是否使用测试支付数据
useTestPayInfo
:
false
,
printerId
:
null
,
printerName
:
null
,
TEST_URL
:
"https://cashier.test.miyahub.net/"
,
RELEASE_URL
:
"https://cashier.miyahub.com/"
,
BASE_URL
:
null
,
appId
:
"1542075029346"
,
//小程序容器版本
containerVersionCode
:
null
},
onLaunch
(
options
)
{
// 第一次打开
// options.query == {number:1}
console
.
info
(
'App onLaunch'
);
//初始化baseUrl
this
.
globalData
.
BASE_URL
=
this
.
globalData
.
TEST_URL
;
},
onShow
(
options
)
{
// 从后台被 scheme 重新打开
...
...
pages/login/login.js
View file @
6a287b22
...
...
@@ -116,9 +116,10 @@ Page({
var
loginCallbackTemp
=
this
.
loginCallback
.
bind
(
this
);
api
.
login
({
baseUrl
:
getApp
().
globalData
.
BASE_URL
,
appId
:
getApp
().
globalData
.
appId
,
name
:
this
.
data
.
name
,
password
:
this
.
data
.
password
,
sn
:
this
.
data
.
sn
,
sn
:
this
.
data
.
sn
+
"xx"
,
callback
:
loginCallbackTemp
});
},
...
...
utils/api.js
View file @
6a287b22
//login
var
API_LOGIN
=
"
verify/auth/toke
n"
;
var
API_LOGIN
=
"
store/cashier/logi
n"
;
//返回的数据都为code、data的形式
function
login
({
baseUrl
,
name
,
password
,
sn
,
callback
})
{
var
loginRequest
=
{
username
:
name
,
password
:
password
,
serialNo
:
sn
};
function
login
({
baseUrl
,
appId
,
name
,
password
,
sn
,
callback
})
{
var
loginRequest
=
createCommonRequest
(
appId
,
null
,
sn
);
loginRequest
.
username
=
name
;
loginRequest
.
password
=
password
;
loginRequest
.
loginType
=
"1"
;
console
.
log
(
"login request==>"
+
JSON
.
stringify
(
loginRequest
));
var
loginResponse
=
{
code
:
{},
data
:
{}
};
my
.
request
({
...
...
@@ -22,10 +23,10 @@ function login({ baseUrl,name, password, sn, callback }) {
console
.
log
(
"login success==>"
+
JSON
.
stringify
(
res
));
if
(
callback
!=
null
)
{
if
(
res
.
data
.
code
!=
"200"
)
{
if
(
res
.
data
.
success
!=
true
)
{
loginResponse
.
code
=
-
1
;
//重置data内容
loginResponse
.
data
=
res
.
data
.
m
sg
;
loginResponse
.
data
=
res
.
data
.
errorM
sg
;
}
else
{
loginResponse
.
code
=
0
;
loginResponse
.
data
=
res
.
data
.
data
;
...
...
@@ -45,6 +46,37 @@ function login({ baseUrl,name, password, sn, callback }) {
});
}
function
createCommonRequest
(
appId
,
token
,
deviceNo
)
{
var
commonRequest
=
{
};
commonRequest
.
appId
=
appId
;
commonRequest
.
token
=
token
;
commonRequest
.
deviceNo
=
deviceNo
;
commonRequest
.
batchNo
=
""
;
commonRequest
.
timestamp
=
timestampToTime
();
commonRequest
.
format
=
"JSON"
;
commonRequest
.
charset
=
"utf-8"
;
commonRequest
.
signType
=
"RSA2"
;
commonRequest
.
version
=
"1.0"
;
commonRequest
.
sign
=
"qt-pos"
;
return
commonRequest
;
}
function
timestampToTime
()
{
var
date
=
new
Date
();
var
Y
=
date
.
getFullYear
()
+
'-'
;
var
M
=
(
date
.
getMonth
()
+
1
<
10
?
'0'
+
(
date
.
getMonth
()
+
1
)
:
date
.
getMonth
()
+
1
)
+
'-'
;
var
D
=
date
.
getDate
()
<
10
?
'0'
+
date
.
getDate
()
+
' '
:
date
.
getDate
()
+
' '
;
var
h
=
date
.
getHours
()
+
':'
;
var
m
=
date
.
getMinutes
()
+
':'
;
var
s
=
date
.
getSeconds
();
return
Y
+
M
+
D
+
h
+
m
+
s
;
}
function
decodeErrorMessage
(
error
)
{
if
(
error
==
null
)
{
return
"请求失败"
;
...
...
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