Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
DoorLock
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
朱建香
DoorLock
Commits
c605af96
Commit
c605af96
authored
Dec 25, 2017
by
朱建香
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
20171225
parent
314b404f
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
177 additions
and
138 deletions
+177
-138
dev/src/public/loop.js
+5
-18
dev/src/public/unotify.js
+36
-49
dev/src/view/device/v_index.js
+15
-7
dev/src/view/doorlockManage/v_editName.js
+8
-8
dev/src/view/doorlockManage/v_index.js
+8
-7
dev/src/view/login/v_index.js
+7
-7
dev/src/view/myInfo/v_index.js
+4
-1
web/lib/js/UIOT.js
+94
-41
No files found.
dev/src/public/loop.js
View file @
c605af96
...
@@ -9,8 +9,9 @@ class Loop{
...
@@ -9,8 +9,9 @@ class Loop{
this
.
handle
=
null
;
this
.
handle
=
null
;
this
.
watcher
=
null
;
this
.
watcher
=
null
;
this
.
time
=
null
;
this
.
time
=
null
;
this
.
url
=
params
.
request
.
url
;
// this.url = params.request.url;
this
.
opts
=
params
.
request
.
opts
;
// this.opts = params.request.opts;
this
.
loopContent
=
params
.
loopContent
;
this
.
timeout
=
params
.
timeout
|
30
;
this
.
timeout
=
params
.
timeout
|
30
;
this
.
fincb
=
params
.
fincb
;
this
.
fincb
=
params
.
fincb
;
this
.
intervalTime
=
params
.
interval
.
delay
;
this
.
intervalTime
=
params
.
interval
.
delay
;
...
@@ -28,7 +29,6 @@ class Loop{
...
@@ -28,7 +29,6 @@ class Loop{
console
.
log
(
"返回时间"
+
this
.
i
+
'-'
+
new
Date
().
getTime
());
console
.
log
(
"返回时间"
+
this
.
i
+
'-'
+
new
Date
().
getTime
());
opts
.
success
(
data
[
this
.
i
]);
opts
.
success
(
data
[
this
.
i
]);
},
100
);
},
100
);
}
}
clearTime
(){
clearTime
(){
...
@@ -39,22 +39,10 @@ class Loop{
...
@@ -39,22 +39,10 @@ class Loop{
async
sendRequest
(){
async
sendRequest
(){
this
.
canSend
=
false
;
this
.
canSend
=
false
;
var
needAuth
=
this
.
opts
.
needAuth
!==
undefined
?
this
.
opts
.
needAuth
:
true
;
var
isDebug
=
this
.
opts
.
isDebug
!==
undefined
?
this
.
opts
.
isDebug
:
false
;
var
withoutUgen
=
this
.
opts
.
withoutUgen
!==
undefined
?
this
.
opts
.
withoutUgen
:
false
;
// iot.business.api.send(this.url, {
// iot.business.api.sendCustom(this.url, {
var
urlParams
=
{
type
:
this
.
opts
.
type
,
data
:
this
.
opts
.
data
};
try
{
try
{
var
response
=
null
;
var
response
=
null
;
if
(
withoutUgen
){
response
=
await
this
.
loopContent
();
response
=
await
iot
.
network
.
send
(
this
.
url
,
urlParams
);
console
.
log
(
response
);
}
else
{
response
=
await
iot
.
business
.
api
.
send
(
this
.
url
,
urlParams
,
needAuth
,
false
,
isDebug
);
}
if
(
await
this
.
stopcondition
(
response
)){
if
(
await
this
.
stopcondition
(
response
)){
if
(
this
.
fincb
!=
null
){
if
(
this
.
fincb
!=
null
){
this
.
fincb
.
success
(
response
);
this
.
fincb
.
success
(
response
);
...
@@ -84,7 +72,6 @@ class Loop{
...
@@ -84,7 +72,6 @@ class Loop{
}
}
}
}
start
(){
start
(){
console
.
log
(
"开始"
);
console
.
log
(
"开始"
);
this
.
time
=
setTimeout
(()
=>
{
this
.
time
=
setTimeout
(()
=>
{
...
...
dev/src/public/unotify.js
View file @
c605af96
...
@@ -5,26 +5,12 @@
...
@@ -5,26 +5,12 @@
class
unotify
{
class
unotify
{
//在一个周期内获取cid
//在一个周期内获取cid
static
async
getCid
(
successCallback
,
errorCallback
){
static
async
getCid
(
successCallback
,
errorCallback
){
var
cid
=
null
;
UpdateCid
((
response
)
=>
{
try
{
successCallback
(
response
);
//利用promise,直到执行完代码再获取cid
},
(
error
)
=>
{
cid
=
await
this
.
getCidPeriotic
(
3
);
errorCallback
(
error
);
//获取后,在缓存中存储cid
if
(
typeof
successCallback
==
'function'
){
iot
.
storage
.
setMap
(
'clientId'
,
cid
,
(
res
)
=>
{
console
.
log
(
"已成功保存cid"
+
cid
);
successCallback
(
cid
);
},
()
=>
{
});
});
}
}
}
catch
(
err
){
console
.
log
(
err
);
if
(
typeof
errorCallback
==
'function'
){
errorCallback
(
a
);
}
}
}
//周期性获取cid,周期可调整
//周期性获取cid,周期可调整
static
getCidPeriotic
(
times
){
static
getCidPeriotic
(
times
){
var
self
=
this
;
var
self
=
this
;
...
@@ -65,36 +51,36 @@ class unotify{
...
@@ -65,36 +51,36 @@ class unotify{
}
}
}
}
//长期不断循环获取cid,并更新cid
//长期不断循环获取cid,并更新cid
// static async get
Cid(successCallback, errorCallback){
static
async
Update
Cid
(
successCallback
,
errorCallback
){
//
var cid = null;
var
cid
=
null
;
//
var oldCid = null;
var
oldCid
=
null
;
//
try{
try
{
//
cid = await this.getCidPeriotic(9);
cid
=
await
this
.
getCidPeriotic
(
9
);
//
if(cid != null && cid != oldCid){
if
(
cid
!=
null
&&
cid
!=
oldCid
){
//
iot.business.api.send('user/updateCid',{
iot
.
business
.
api
.
send
(
'user/updateCid'
,{
//
data: {
data
:
{
//
clienId: cid
clienId
:
cid
//
},
},
//
success: (response) => {
success
:
(
response
)
=>
{
//
if(typeof successCallback == 'function'){
if
(
typeof
successCallback
==
'function'
){
//
successCallback('cid updateSuccess');
successCallback
(
'cid updateSuccess'
);
//
}
}
//
},
},
//
error: (error) => {
error
:
(
error
)
=>
{
//
console.log(error);
console
.
log
(
error
);
//
errorCallback(error);
errorCallback
(
error
);
//
}
}
//
}, true, false);
},
true
,
false
);
//
}else{
}
else
{
//
successCallback('cid not updated');
successCallback
(
'cid not updated'
);
//
}
}
//
}
}
//
catch (err){
catch
(
err
){
//
console.log(err);
console
.
log
(
err
);
//
if(typeof errorCallback == 'function'){
if
(
typeof
errorCallback
==
'function'
){
//
errorCallback(err);
errorCallback
(
err
);
//
}
}
//
}
}
//
}
}
}
}
export
default
unotify
;
export
default
unotify
;
\ No newline at end of file
dev/src/view/device/v_index.js
View file @
c605af96
...
@@ -114,12 +114,13 @@ function init() {
...
@@ -114,12 +114,13 @@ function init() {
registerPushListener
(
this
);
registerPushListener
(
this
);
let
self
=
this
;
let
self
=
this
;
window
.
addEventListener
(
'returnPage'
,
function
(
event
){
window
.
addEventListener
(
'returnPage'
,
function
(
event
){
console
.
log
(
'returnPage'
);
//获取设备信息
//获取设备信息
getDevices
(
self
);
getDevices
(
self
);
//注册监听上报
//注册监听上报
registerPushListener
(
self
);
registerPushListener
(
self
);
iot
.
navigator
.
closeAllBesidesItself
();
});
});
},
},
methods
:{
methods
:{
setValueRemoteOpendoor
(
value
){
setValueRemoteOpendoor
(
value
){
...
@@ -522,7 +523,8 @@ function getLockInfoSuccess(self, data){
...
@@ -522,7 +523,8 @@ function getLockInfoSuccess(self, data){
self
.
setIsFirstGetLockInfo
(
false
);
self
.
setIsFirstGetLockInfo
(
false
);
}
}
//存储最后一条历史记录的ID
//存储最后一条历史记录的ID
let
historyId
=
data
.
info
.
historyId
;
let
historyId
=
null
historyId
=
data
.
info
.
historyId
?
data
.
info
.
historyId
:
null
;
iot
.
storage
.
setMap
(
'historyId'
,
historyId
,
(
res
)
=>
{
iot
.
storage
.
setMap
(
'historyId'
,
historyId
,
(
res
)
=>
{
console
.
log
(
res
);
console
.
log
(
res
);
},
()
=>
{
},
()
=>
{
...
@@ -656,23 +658,29 @@ function initDeviceInfo(self){
...
@@ -656,23 +658,29 @@ function initDeviceInfo(self){
}
}
async
function
loopGetLockInfo
(
self
,
delay
,
timeout
){
async
function
loopGetLockInfo
(
self
,
delay
,
timeout
){
let
oldHistoryId
=
null
;
let
oldHistoryId
=
null
;
try
{
try
{
oldHistoryId
=
await
iot
.
storage
.
getMap
(
'historyId'
);
let
historyId
=
await
iot
.
storage
.
getMap
(
'historyId'
);
if
(
historyId
){
oldHistoryId
=
historyId
;
}
}
}
catch
(
error
){
catch
(
error
){
console
.
log
(
error
);
console
.
log
(
error
);
}
}
console
.
log
(
oldHistoryId
);
new
Loop
({
new
Loop
({
request
:
{
loopContent
:
()
=>
{
url
:
'lock/getNewInfo'
,
var
urlParams
=
{
opts
:
{
type
:
'post'
,
type
:
'post'
,
data
:
{
data
:
{
history_id
:
oldHistoryId
,
history_id
:
oldHistoryId
,
device_id
:
self
.
deviceId
device_id
:
self
.
deviceId
}
}
}
};
return
iot
.
business
.
api
.
send
(
'lock/getNewInfo'
,
urlParams
,
true
,
false
);
// return plus.push.getClientInfo().clientid;
},
},
timeout
:
config
.
getHistoryTime
*
1000
,
timeout
:
config
.
getHistoryTime
*
1000
,
interval
:{
interval
:{
...
...
dev/src/view/doorlockManage/v_editName.js
View file @
c605af96
...
@@ -93,12 +93,12 @@ function backTap(){
...
@@ -93,12 +93,12 @@ function backTap(){
iot
.
navigator
.
back
();
iot
.
navigator
.
back
();
}
}
//重写mui.back
//
//
重写mui.back
mui
.
back
=
function
(){
//
mui.back = function(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
//
iot.navigator.fire(plus.webview.currentWebview().opener(),'returnPage',{});
console
.
log
(
"fire"
);
//
console.log("fire");
iot
.
navigator
.
back
();
//
iot.navigator.back();
}
//
}
//tap 保存
//tap 保存
function
saveTap
(
self
){
function
saveTap
(
self
){
...
@@ -115,10 +115,10 @@ function saveTap(self){
...
@@ -115,10 +115,10 @@ function saveTap(self){
console
.
log
(
response
);
console
.
log
(
response
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
let
data
=
uPublic
.
checkResponseData
(
response
.
data
);
if
(
data
){
if
(
data
){
uComponents
.
openAlert
(
self
,
Vue
.
t
(
'editName.editNameSuccess'
),
{
text
:
Vue
.
t
(
'btn.confirm'
),
callback
:
function
()
{
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
(
'returnPage'
);
console
.
log
(
'returnPage'
);
uComponents
.
openAlert
(
self
,
Vue
.
t
(
'editName.editNameSuccess'
),
{
text
:
Vue
.
t
(
'btn.confirm'
),
callback
:
function
()
{
iot
.
navigator
.
back
();
iot
.
navigator
.
back
();
}
}
});
});
...
...
dev/src/view/doorlockManage/v_index.js
View file @
c605af96
...
@@ -287,6 +287,7 @@ function unbind(self){
...
@@ -287,6 +287,7 @@ function unbind(self){
self
.
setStateShowFlag
(
true
);
self
.
setStateShowFlag
(
true
);
self
.
setShowMsg
(
Vue
.
t
(
'doorlockManage.unbindSuccess'
));
self
.
setShowMsg
(
Vue
.
t
(
'doorlockManage.unbindSuccess'
));
self
.
setUnbindSucceess
(
true
);
self
.
setUnbindSucceess
(
true
);
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
...
@@ -311,12 +312,12 @@ function backTap(){
...
@@ -311,12 +312,12 @@ function backTap(){
iot
.
navigator
.
aback
();
iot
.
navigator
.
aback
();
}
}
//重写mui.back
//
//
重写mui.back
mui
.
back
=
function
(){
//
mui.back = function(){
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
//
iot.navigator.fire(plus.webview.currentWebview().opener(),'returnPage',{});
console
.
log
(
"fire"
);
//
console.log("fire");
iot
.
navigator
.
back
();
//
iot.navigator.back();
}
//
}
// 选择: 是否接收门铃消息推送
// 选择: 是否接收门铃消息推送
function
doorbellSwitchTap
(
self
,
value
){
function
doorbellSwitchTap
(
self
,
value
){
...
@@ -347,6 +348,7 @@ function setOption(self){
...
@@ -347,6 +348,7 @@ function setOption(self){
opt_open
:
self
.
getValueOpendoor
()
opt_open
:
self
.
getValueOpendoor
()
},
},
success
:
(
response
)
=>
{
success
:
(
response
)
=>
{
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
console
.
log
();
console
.
log
();
},
},
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
...
@@ -366,7 +368,6 @@ function cancelTap(self){
...
@@ -366,7 +368,6 @@ function cancelTap(self){
//tap 绑定成功弹框提示-->回到首页
//tap 绑定成功弹框提示-->回到首页
function
unbindStateDialogTap
(
self
){
function
unbindStateDialogTap
(
self
){
self
.
setStateShowFlag
(
false
);
self
.
setStateShowFlag
(
false
);
iot
.
navigator
.
fire
(
plus
.
webview
.
currentWebview
().
opener
(),
'returnPage'
,{});
if
(
self
.
getUnbindSucceess
){
if
(
self
.
getUnbindSucceess
){
iot
.
navigator
.
openWindow
({
iot
.
navigator
.
openWindow
({
url
:
'../device/index.html'
,
url
:
'../device/index.html'
,
...
...
dev/src/view/login/v_index.js
View file @
c605af96
...
@@ -31,9 +31,9 @@ function init() {
...
@@ -31,9 +31,9 @@ function init() {
iotDebug
.
push
(
'start: Debug'
);
iotDebug
.
push
(
'start: Debug'
);
}
}
var
self
=
this
;
var
self
=
this
;
unotify
.
getCid
(
function
(
ret
){
//
unotify.getCid(function(ret){
console
.
log
(
ret
);
//
console.log(ret);
self
.
setClientId
(
ret
);
//
self.setClientId(ret);
if
(
plus
.
os
.
name
==
'Android'
)
{
if
(
plus
.
os
.
name
==
'Android'
)
{
iot
.
permission
.
checkPermission
([
'READ_EXTERNAL_STORAGE'
],
function
(
res
)
{
iot
.
permission
.
checkPermission
([
'READ_EXTERNAL_STORAGE'
],
function
(
res
)
{
console
.
log
(
'success'
,
res
);
console
.
log
(
'success'
,
res
);
...
@@ -44,9 +44,9 @@ function init() {
...
@@ -44,9 +44,9 @@ function init() {
}
else
{
}
else
{
loginButtonTap
(
self
);
loginButtonTap
(
self
);
}
}
},
function
(
err
){
//
},function(err){
console
.
log
(
err
);
//
console.log(err);
})
//
})
console
.
log
(
'innnnnnn'
);
console
.
log
(
'innnnnnn'
);
},
},
methods
:{
methods
:{
...
@@ -212,7 +212,7 @@ function cloudsLogin(self, id){
...
@@ -212,7 +212,7 @@ function cloudsLogin(self, id){
error
:
(
error
)
=>
{
error
:
(
error
)
=>
{
console
.
log
(
error
);
console
.
log
(
error
);
if
(
window
.
iotDebug
){
if
(
window
.
iotDebug
){
iotDebug
.
push
(
'end: 云端登陆失败'
+
JSON
.
stringify
(
error
));
iotDebug
.
push
(
'end: 云端
登陆失败'
+
JSON
.
stringify
(
error
));
}
}
if
(
window
.
iotDebug
)
{
if
(
window
.
iotDebug
)
{
iotDebug
.
upload
(
iot
,
'云端登陆失败'
);
iotDebug
.
upload
(
iot
,
'云端登陆失败'
);
...
...
dev/src/view/myInfo/v_index.js
View file @
c605af96
...
@@ -138,8 +138,11 @@ function logoutButtonTap(self){
...
@@ -138,8 +138,11 @@ function logoutButtonTap(self){
// },
// },
// complete: () => {}
// complete: () => {}
// });
// });
console
.
log
(
"logout"
);
iot
.
business
.
user
.
logout
({
iot
.
business
.
user
.
logout
({
data
:
{},
data
:
{
// sds: false
},
success
:
(
response
)
=>
{
success
:
(
response
)
=>
{
console
.
log
(
"sdsLogout:"
+
response
);
console
.
log
(
"sdsLogout:"
+
response
);
let
sdsResponse
=
response
;
let
sdsResponse
=
response
;
...
...
web/lib/js/UIOT.js
View file @
c605af96
...
@@ -6144,22 +6144,25 @@ var SDSUser = function (_User) {
...
@@ -6144,22 +6144,25 @@ var SDSUser = function (_User) {
var
_this3
=
this
;
var
_this3
=
this
;
var
sds
=
params
.
data
.
sds
===
true
;
var
sds
=
params
.
data
.
sds
===
true
;
var
opts
=
{
success
:
params
.
success
,
error
:
params
.
error
,
complete
:
params
.
complete
};
var
SDSLogout
=
function
SDSLogout
()
{
var
SDSLogout
=
function
SDSLogout
()
{
_this3
.
business
.
sds
.
logout
({
_this3
.
business
.
sds
.
logout
({
success
:
params
.
success
,
success
:
function
success
(
ret
)
{
if
(
sds
===
true
)
{
params
.
success
(
ret
);
}
else
{
_get
(
SDSUser
.
prototype
.
__proto__
||
Object
.
getPrototypeOf
(
SDSUser
.
prototype
),
'logout'
,
_this3
).
call
(
_this3
,
opts
);
}
},
error
:
params
.
error
,
error
:
params
.
error
,
complete
:
params
.
complete
complete
:
params
.
complete
});
});
};
};
if
(
sds
)
{
SDSLogout
();
SDSLogout
();
}
else
{
var
opts
=
{
success
:
SDSLogout
,
error
:
params
.
error
};
_get
(
SDSUser
.
prototype
.
__proto__
||
Object
.
getPrototypeOf
(
SDSUser
.
prototype
),
'logout'
,
this
).
call
(
this
,
opts
);
}
}
}
}]);
}]);
...
@@ -6626,7 +6629,7 @@ var User = function () {
...
@@ -6626,7 +6629,7 @@ var User = function () {
_createClass
(
User
,
[{
_createClass
(
User
,
[{
key
:
'reg'
,
key
:
'reg'
,
value
:
function
reg
(
params
)
{
value
:
function
reg
(
params
)
{
var
_this
=
this
;
var
_this
2
=
this
;
var
data
=
{
var
data
=
{
username
:
params
.
data
.
username
,
username
:
params
.
data
.
username
,
...
@@ -6648,10 +6651,10 @@ var User = function () {
...
@@ -6648,10 +6651,10 @@ var User = function () {
}
}
_context
.
next
=
4
;
_context
.
next
=
4
;
return
_regenerator2
.
default
.
awrap
(
_this
.
business
.
websql
.
setMap
(
keys
.
uToken
,
ret
.
data
.
utoken
));
return
_regenerator2
.
default
.
awrap
(
_this
2
.
business
.
websql
.
setMap
(
keys
.
uToken
,
ret
.
data
.
utoken
));
case
4
:
case
4
:
_this
.
business
.
setToken
(
ret
.
data
.
utoken
);
_this
2
.
business
.
setToken
(
ret
.
data
.
utoken
);
params
.
success
(
ret
);
params
.
success
(
ret
);
_context
.
next
=
9
;
_context
.
next
=
9
;
break
;
break
;
...
@@ -6674,7 +6677,7 @@ var User = function () {
...
@@ -6674,7 +6677,7 @@ var User = function () {
return
_context
.
stop
();
return
_context
.
stop
();
}
}
}
}
},
null
,
_this
,
[[
0
,
11
]]);
},
null
,
_this
2
,
[[
0
,
11
]]);
},
},
error
:
params
.
error
,
error
:
params
.
error
,
complete
:
params
.
complete
complete
:
params
.
complete
...
@@ -6687,7 +6690,7 @@ var User = function () {
...
@@ -6687,7 +6690,7 @@ var User = function () {
},
{
},
{
key
:
'login'
,
key
:
'login'
,
value
:
function
login
(
params
)
{
value
:
function
login
(
params
)
{
var
_this
2
=
this
;
var
_this
3
=
this
;
var
data
=
{
var
data
=
{
username
:
params
.
data
.
username
,
username
:
params
.
data
.
username
,
...
@@ -6696,7 +6699,7 @@ var User = function () {
...
@@ -6696,7 +6699,7 @@ var User = function () {
var
opts
=
{
var
opts
=
{
data
:
data
,
data
:
data
,
success
:
function
success
(
ret
)
{
success
:
function
success
(
ret
)
{
_this
2
.
handleLoginSuccess
(
params
,
ret
);
_this
3
.
handleLoginSuccess
(
params
,
ret
);
},
},
error
:
params
.
error
,
error
:
params
.
error
,
complete
:
params
.
complete
complete
:
params
.
complete
...
@@ -6706,7 +6709,7 @@ var User = function () {
...
@@ -6706,7 +6709,7 @@ var User = function () {
},
{
},
{
key
:
'thirdLogin'
,
key
:
'thirdLogin'
,
value
:
function
thirdLogin
(
params
)
{
value
:
function
thirdLogin
(
params
)
{
var
_this
3
=
this
;
var
_this
4
=
this
;
var
opts
=
{
var
opts
=
{
data
:
params
.
data
,
data
:
params
.
data
,
...
@@ -6715,14 +6718,14 @@ var User = function () {
...
@@ -6715,14 +6718,14 @@ var User = function () {
while
(
1
)
{
while
(
1
)
{
switch
(
_context2
.
prev
=
_context2
.
next
)
{
switch
(
_context2
.
prev
=
_context2
.
next
)
{
case
0
:
case
0
:
_this
3
.
handleLoginSuccess
(
params
,
ret
);
_this
4
.
handleLoginSuccess
(
params
,
ret
);
case
1
:
case
1
:
case
'end'
:
case
'end'
:
return
_context2
.
stop
();
return
_context2
.
stop
();
}
}
}
}
},
null
,
_this
3
);
},
null
,
_this
4
);
},
},
error
:
params
.
error
,
error
:
params
.
error
,
complete
:
params
.
complete
complete
:
params
.
complete
...
@@ -6732,12 +6735,12 @@ var User = function () {
...
@@ -6732,12 +6735,12 @@ var User = function () {
},
{
},
{
key
:
'simpleLogin'
,
key
:
'simpleLogin'
,
value
:
function
simpleLogin
(
params
)
{
value
:
function
simpleLogin
(
params
)
{
var
_this
4
=
this
;
var
_this
5
=
this
;
var
opts
=
{
var
opts
=
{
data
:
params
.
data
,
data
:
params
.
data
,
success
:
function
success
(
ret
)
{
success
:
function
success
(
ret
)
{
_this
4
.
handleLoginSuccess
(
params
,
ret
);
_this
5
.
handleLoginSuccess
(
params
,
ret
);
},
},
error
:
params
.
error
,
error
:
params
.
error
,
complete
:
params
.
complete
complete
:
params
.
complete
...
@@ -6750,7 +6753,7 @@ var User = function () {
...
@@ -6750,7 +6753,7 @@ var User = function () {
},
{
},
{
key
:
'autoLogin'
,
key
:
'autoLogin'
,
value
:
function
autoLogin
(
params
)
{
value
:
function
autoLogin
(
params
)
{
var
_this
5
=
this
;
var
_this
6
=
this
;
var
data
=
{};
var
data
=
{};
var
opts
=
{
var
opts
=
{
...
@@ -6768,10 +6771,10 @@ var User = function () {
...
@@ -6768,10 +6771,10 @@ var User = function () {
}
}
_context3
.
next
=
4
;
_context3
.
next
=
4
;
return
_regenerator2
.
default
.
awrap
(
_this
5
.
business
.
websql
.
setMap
(
keys
.
uToken
,
ret
.
data
.
utoken
));
return
_regenerator2
.
default
.
awrap
(
_this
6
.
business
.
websql
.
setMap
(
keys
.
uToken
,
ret
.
data
.
utoken
));
case
4
:
case
4
:
_this
5
.
business
.
setToken
(
ret
.
data
.
utoken
);
_this
6
.
business
.
setToken
(
ret
.
data
.
utoken
);
params
.
success
(
ret
);
params
.
success
(
ret
);
_context3
.
next
=
9
;
_context3
.
next
=
9
;
break
;
break
;
...
@@ -6794,7 +6797,7 @@ var User = function () {
...
@@ -6794,7 +6797,7 @@ var User = function () {
return
_context3
.
stop
();
return
_context3
.
stop
();
}
}
}
}
},
null
,
_this
5
,
[[
0
,
11
]]);
},
null
,
_this
6
,
[[
0
,
11
]]);
},
},
error
:
params
.
error
,
error
:
params
.
error
,
complete
:
params
.
complete
complete
:
params
.
complete
...
@@ -6877,26 +6880,61 @@ var User = function () {
...
@@ -6877,26 +6880,61 @@ var User = function () {
},
{
},
{
key
:
'logout'
,
key
:
'logout'
,
value
:
function
logout
(
params
)
{
value
:
function
logout
(
params
)
{
this
.
business
.
websql
.
delMaps
([
keys
.
uToken
,
keys
.
USER_INFO
],
function
()
{
var
_this7
=
this
;
params
.
success
();
},
function
(
error
)
{
var
data
=
{};
console
.
log
(
error
);
var
_this
=
this
;
params
.
error
(
'logout error'
);
var
opts
=
{
});
data
:
data
,
success
:
function
success
(
ret
)
{
return
_regenerator2
.
default
.
async
(
function
success$
(
_context4
)
{
while
(
1
)
{
switch
(
_context4
.
prev
=
_context4
.
next
)
{
case
0
:
_context4
.
prev
=
0
;
_context4
.
next
=
3
;
return
_regenerator2
.
default
.
awrap
(
_this7
.
business
.
websql
.
delMaps
([
keys
.
uToken
,
keys
.
USER_INFO
]));
case
3
:
params
.
success
(
ret
);
_context4
.
next
=
9
;
break
;
case
6
:
_context4
.
prev
=
6
;
_context4
.
t0
=
_context4
[
'catch'
](
0
);
params
.
error
(
_context4
.
t0
);
case
9
:
case
'end'
:
return
_context4
.
stop
();
}
}
},
null
,
_this7
,
[[
0
,
6
]]);
},
error
:
function
error
(
err
)
{
params
.
error
(
err
);
},
complete
:
function
complete
()
{
params
.
complete
();
}
};
this
.
business
.
api
.
logout
(
opts
);
}
}
},
{
},
{
key
:
'handleLoginSuccess'
,
key
:
'handleLoginSuccess'
,
value
:
function
handleLoginSuccess
(
params
,
response
)
{
value
:
function
handleLoginSuccess
(
params
,
response
)
{
var
data
,
infoArray
;
var
data
,
infoArray
;
return
_regenerator2
.
default
.
async
(
function
handleLoginSuccess$
(
_context
4
)
{
return
_regenerator2
.
default
.
async
(
function
handleLoginSuccess$
(
_context
5
)
{
while
(
1
)
{
while
(
1
)
{
switch
(
_context
4
.
prev
=
_context4
.
next
)
{
switch
(
_context
5
.
prev
=
_context5
.
next
)
{
case
0
:
case
0
:
_context
4
.
prev
=
0
;
_context
5
.
prev
=
0
;
data
=
response
.
data
;
data
=
response
.
data
;
if
(
!
(
data
.
utoken
.
length
!==
0
))
{
if
(
!
(
data
.
utoken
.
length
!==
0
))
{
_context
4
.
next
=
12
;
_context
5
.
next
=
12
;
break
;
break
;
}
}
...
@@ -6904,31 +6942,31 @@ var User = function () {
...
@@ -6904,31 +6942,31 @@ var User = function () {
infoArray
.
push
([
keys
.
uToken
,
data
.
utoken
]);
infoArray
.
push
([
keys
.
uToken
,
data
.
utoken
]);
infoArray
.
push
([
keys
.
USER_INFO
,
data
]);
infoArray
.
push
([
keys
.
USER_INFO
,
data
]);
_context
4
.
next
=
8
;
_context
5
.
next
=
8
;
return
_regenerator2
.
default
.
awrap
(
this
.
business
.
websql
.
setMaps
(
infoArray
));
return
_regenerator2
.
default
.
awrap
(
this
.
business
.
websql
.
setMaps
(
infoArray
));
case
8
:
case
8
:
this
.
business
.
setToken
(
data
.
utoken
);
this
.
business
.
setToken
(
data
.
utoken
);
params
.
success
(
response
);
params
.
success
(
response
);
_context
4
.
next
=
13
;
_context
5
.
next
=
13
;
break
;
break
;
case
12
:
case
12
:
params
.
error
();
params
.
error
();
case
13
:
case
13
:
_context
4
.
next
=
18
;
_context
5
.
next
=
18
;
break
;
break
;
case
15
:
case
15
:
_context
4
.
prev
=
15
;
_context
5
.
prev
=
15
;
_context
4
.
t0
=
_context4
[
'catch'
](
0
);
_context
5
.
t0
=
_context5
[
'catch'
](
0
);
params
.
error
(
_context
4
.
t0
);
params
.
error
(
_context
5
.
t0
);
case
18
:
case
18
:
case
'end'
:
case
'end'
:
return
_context
4
.
stop
();
return
_context
5
.
stop
();
}
}
}
}
},
null
,
this
,
[[
0
,
15
]]);
},
null
,
this
,
[[
0
,
15
]]);
...
@@ -7060,6 +7098,21 @@ var CloudAPI = function () {
...
@@ -7060,6 +7098,21 @@ var CloudAPI = function () {
};
};
this
.
send
(
'user/login'
,
opts
,
false
);
this
.
send
(
'user/login'
,
opts
,
false
);
}
}
//退出登陆
},
{
key
:
'logout'
,
value
:
function
logout
(
params
)
{
var
opts
=
{
type
:
'post'
,
data
:
params
.
data
,
success
:
params
.
success
,
error
:
params
.
error
,
complete
:
params
.
complete
};
this
.
send
(
'user/logout'
,
opts
);
}
},
{
},
{
key
:
'thirdLogin'
,
key
:
'thirdLogin'
,
value
:
function
thirdLogin
(
params
)
{
value
:
function
thirdLogin
(
params
)
{
...
...
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