Commit 3604e554 by 朱建香

1024

parent 153ab996
...@@ -12,12 +12,14 @@ const iot = new UIOT({ ...@@ -12,12 +12,14 @@ const iot = new UIOT({
vue: Vue, vue: Vue,
i18n: VueI18n, i18n: VueI18n,
appId: '10004', appId: '10004',
appSecret: '10004',
wx: { wx: {
appId: '' appId: ''
}, },
cloud: { cloud: {
// url: 'http://wx.iotface.com' // url: 'http://wx.iotface.com'
url: 'http://192.168.2.96:20000' // url: 'http://192.168.2.96:20000'
url: 'https://cloud.iot.u-gen.net/test-openapi/'
}, },
plugin: { plugin: {
log: { log: {
......
...@@ -189,3 +189,30 @@ function cloudsLogin(self, id){ ...@@ -189,3 +189,30 @@ function cloudsLogin(self, id){
}); });
// //
} }
//function cloudsLogin(self, id){
// uComponents.showLoading(self);
// iot.business.user.simpleLogin({
// data: {
// username: id
// },
// success: (response) => {
// let data = uPublic.checkResponseData(response.data);
// if(data){
// iot.navigator.openWindow({
// url: '../device/index.html',
// id: 'device'
// });
// }else{
//
// }
// },
// error: (error) => {
// console.log(error);
// uPublic.openRequestErrorAlert(self);
// },
// complete: () => {
// uComponents.hideLoading(self);
// }
// });
//}
\ No newline at end of file
...@@ -1239,7 +1239,7 @@ return Promise; ...@@ -1239,7 +1239,7 @@ return Promise;
}))); })));
//# sourceMappingURL=es6-promise.map //# sourceMappingURL=es6-promise.map
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(4), __webpack_require__(0), __webpack_require__(1))) /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(0), __webpack_require__(1)))
/***/ }), /***/ }),
/* 1 */ /* 1 */
...@@ -1320,46 +1320,6 @@ module.exports = Ready; ...@@ -1320,46 +1320,6 @@ module.exports = Ready;
/***/ }), /***/ }),
/* 3 */ /* 3 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Plugin = function () {
function Plugin() {
_classCallCheck(this, Plugin);
this.readyFn = [];
}
_createClass(Plugin, [{
key: "needReady",
value: function needReady() {
return null;
}
}, {
key: "ready",
value: function ready(fn) {
this.readyFn.push(fn);
}
}, {
key: "getReadyFn",
value: function getReadyFn() {
return this.readyFn;
}
}]);
return Plugin;
}();
module.exports = Plugin;
/***/ }),
/* 4 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
// shim for using process in browser // shim for using process in browser
...@@ -1549,6 +1509,46 @@ process.umask = function() { return 0; }; ...@@ -1549,6 +1509,46 @@ process.umask = function() { return 0; };
/***/ }), /***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Plugin = function () {
function Plugin() {
_classCallCheck(this, Plugin);
this.readyFn = [];
}
_createClass(Plugin, [{
key: "needReady",
value: function needReady() {
return null;
}
}, {
key: "ready",
value: function ready(fn) {
this.readyFn.push(fn);
}
}, {
key: "getReadyFn",
value: function getReadyFn() {
return this.readyFn;
}
}]);
return Plugin;
}();
module.exports = Plugin;
/***/ }),
/* 5 */ /* 5 */
/***/ (function(module, exports) { /***/ (function(module, exports) {
...@@ -1648,6 +1648,133 @@ module.exports = CheckParams; ...@@ -1648,6 +1648,133 @@ module.exports = CheckParams;
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
/* WEBPACK VAR INJECTION */(function(Promise) {
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* Created by Ugen on 16/12/12.
*/
__webpack_require__(14);
var IOTEvents = __webpack_require__(12);
var NetWork = function NetWork() {
_classCallCheck(this, NetWork);
};
/**
* url 请求url
* params:
*
*/
NetWork.send = function (url, params) {
var opts = {
method: 'POST'
};
if (params.data) {
opts.body = params.data;
}
if (params.type) {
opts.method = params.type;
}
if (params.headers) {
opts.headers = params.headers;
if (opts.headers.Accept == 'application/json') {
opts.body = JSON.stringify(opts.body);
}
}
if (params.timeout) {
opts.timeout = params.timeout;
}
IOTEvents.getSendMsgObj(IOTEvents.type.NETWORK).beforeSend();
var fetchPromise = _uFetch(url, opts).then(function (res) {
IOTEvents.getSendMsgObj(IOTEvents.type.NETWORK).complete();
if (params.dataType == 'text') return res.text();
return res.json();
}).catch(function (err) {
IOTEvents.getSendMsgObj(IOTEvents.type.NETWORK).complete();
throw err;
});
if (params.success) {
fetchPromise.then(function (res) {
params.success(res);
if (params.complete) params.complete();
}).catch(function (err) {
IOTEvents.getSendMsgObj(IOTEvents.type.NETWORK).complete();
if (params.error) params.error(err);
if (params.complete) params.complete();
});
} else {
return fetchPromise;
}
};
//超时
var _uFetch = function _uFetch(url, params) {
var abort_fn = null;
var abortPromise = new Promise(function (resolve, reject) {
abort_fn = function abort_fn() {
reject({ code: 'timeout' });
};
});
var fetchPromise = new Promise(function (resolve, reject) {
fetch(url, params).then(checkStatus).then(function (res) {
resolve(res);
}).catch(function (err) {
reject(err);
});
});
var abortable_promise = Promise.race([fetchPromise, abortPromise]);
setTimeout(function () {
abort_fn();
}, (params.timeout || 30) * 1000);
return abortable_promise;
};
//检查请求返回的状态
var checkStatus = function checkStatus(response) {
if (response.status >= 200 && response.status < 300) {
return response;
} else {
var error = new Error(response.statusText);
error.response = response;
throw error;
}
};
module.exports = NetWork;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = {
logConfig: {
type: ['uploadOperationLog', 'uploadSystemLog', 'uploadDebugLog']
},
keys: {
"uToken": "utoken",
"USER_INFO": "userinfo",
"signPerfix": "ugen_iot",
"groupCache": "IOT_GROUP_CACHE"
},
thirdParty: {
appId: 'wxcc1ee78ae256be1f'
}
};
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
...@@ -1674,7 +1801,7 @@ var Utils = function () { ...@@ -1674,7 +1801,7 @@ var Utils = function () {
platform = navigator.platform, platform = navigator.platform,
macPlatform = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'], macPlatform = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'],
windowsPlatform = ['Win32', 'Win64', 'Windows', 'WinCE'], windowsPlatform = ['Win32', 'Win64', 'Windows', 'WinCE'],
iosPlatform = ['iPhone', 'iPad', 'iPod'], iosPlatform = ['iPhone', 'iPad', 'iPod', 'iPod touch'],
os = null, os = null,
match = null; match = null;
...@@ -1790,6 +1917,13 @@ var Utils = function () { ...@@ -1790,6 +1917,13 @@ var Utils = function () {
}; };
scan.setFlash(data.setFlash === true); scan.setFlash(data.setFlash === true);
scan.start(); scan.start();
return scan;
}
}, {
key: 'closeScanBarcode',
value: function closeScanBarcode(barcode) {
barcode.cancel();
barcode.close();
} }
}]); }]);
...@@ -1799,166 +1933,41 @@ var Utils = function () { ...@@ -1799,166 +1933,41 @@ var Utils = function () {
module.exports = Utils; module.exports = Utils;
/***/ }), /***/ }),
/* 9 */ /* 11 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; var __WEBPACK_AMD_DEFINE_RESULT__;/*
/* WEBPACK VAR INJECTION */(function(Promise) { * JavaScript MD5
* https://github.com/blueimp/JavaScript-MD5
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } *
* Copyright 2011, Sebastian Tschan
/** * https://blueimp.net
* Created by Ugen on 16/12/12. *
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
*
* Based on
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for more info.
*/ */
__webpack_require__(14);
var IOTEvents = __webpack_require__(12);
var NetWork = function NetWork() {
_classCallCheck(this, NetWork);
};
/** /* global define */
* url 请求url
* params:
*
*/
;(function ($) {
'use strict'
NetWork.send = function (url, params) { /*
var opts = { * Add integers, wrapping at 2^32. This uses 16-bit operations internally
method: "POST", * to work around bugs in some JS interpreters.
body: params.data */
}; function safeAdd (x, y) {
if (params.type) { var lsw = (x & 0xFFFF) + (y & 0xFFFF)
opts.method = params.type; var msw = (x >> 16) + (y >> 16) + (lsw >> 16)
} return (msw << 16) | (lsw & 0xFFFF)
if (params.headers) {
opts.headers = params.headers;
if (opts.headers.Accept == 'application/json') {
opts.body = JSON.stringify(opts.body);
}
}
if (params.timeout) {
opts.timeout = params.timeout;
}
IOTEvents.getSendMsgObj(IOTEvents.type.NETWORK).beforeSend();
var fetchPromise = _uFetch(url, opts).then(function (res) {
IOTEvents.getSendMsgObj(IOTEvents.type.NETWORK).complete();
if (params.dataType == "text") return res.text();
return res.json();
}).catch(function (err) {
IOTEvents.getSendMsgObj(IOTEvents.type.NETWORK).complete();
throw err;
});
if (params.success) {
fetchPromise.then(function (res) {
params.success(res);
if (params.complete) params.complete();
}).catch(function (err) {
IOTEvents.getSendMsgObj(IOTEvents.type.NETWORK).complete();
if (params.error) params.error(err);
if (params.complete) params.complete();
});
} else {
return fetchPromise;
}
};
//超时
var _uFetch = function _uFetch(url, params) {
var abort_fn = null;
var abortPromise = new Promise(function (resolve, reject) {
abort_fn = function abort_fn() {
reject({ code: 'timeout' });
};
});
var fetchPromise = new Promise(function (resolve, reject) {
fetch(url, params).then(checkStatus).then(function (res) {
resolve(res);
}).catch(function (err) {
reject(err);
});
});
var abortable_promise = Promise.race([fetchPromise, abortPromise]);
setTimeout(function () {
abort_fn();
}, (params.timeout || 30) * 1000);
return abortable_promise;
};
//检查请求返回的状态
var checkStatus = function checkStatus(response) {
if (response.status >= 200 && response.status < 300) {
return response;
} else {
var error = new Error(response.statusText);
error.response = response;
throw error;
}
};
module.exports = NetWork;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = {
logConfig: {
type: ['uploadOperationLog', 'uploadSystemLog', 'uploadDebugLog']
},
keys: {
"uToken": "utoken",
"USER_INFO": "userinfo",
"signPerfix": "ugen_iot",
"groupCache": "IOT_GROUP_CACHE"
},
thirdParty: {
appId: 'wxcc1ee78ae256be1f'
}
};
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;/*
* JavaScript MD5
* https://github.com/blueimp/JavaScript-MD5
*
* Copyright 2011, Sebastian Tschan
* https://blueimp.net
*
* Licensed under the MIT license:
* https://opensource.org/licenses/MIT
*
* Based on
* A JavaScript implementation of the RSA Data Security, Inc. MD5 Message
* Digest Algorithm, as defined in RFC 1321.
* Version 2.2 Copyright (C) Paul Johnston 1999 - 2009
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for more info.
*/
/* global define */
;(function ($) {
'use strict'
/*
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
* to work around bugs in some JS interpreters.
*/
function safeAdd (x, y) {
var lsw = (x & 0xFFFF) + (y & 0xFFFF)
var msw = (x >> 16) + (y >> 16) + (lsw >> 16)
return (msw << 16) | (lsw & 0xFFFF)
} }
/* /*
...@@ -3057,7 +3066,7 @@ var _createClass = function () { function defineProperties(target, props) { for ...@@ -3057,7 +3066,7 @@ var _createClass = function () { function defineProperties(target, props) { for
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Ready = __webpack_require__(2); var Ready = __webpack_require__(2);
var Plugin = __webpack_require__(3); var Plugin = __webpack_require__(4);
var md5 = __webpack_require__(11); var md5 = __webpack_require__(11);
var IOTBase = function () { var IOTBase = function () {
...@@ -3274,213 +3283,6 @@ var _createClass = function () { function defineProperties(target, props) { for ...@@ -3274,213 +3283,6 @@ var _createClass = function () { function defineProperties(target, props) { for
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/** /**
* method.js
* Version: 0.1
* User: shz
* Date: 2017-09-14
* Copyright(c) 2017. U-GEN Tech.Co,Ltd. All Rights Reserved.
* BLEMethod 蓝牙调用bridge方法
*/
var Bridge = __webpack_require__(21);
/**
* @class
* BLE
*/
var BLEMethod = function () {
function BLEMethod() {
_classCallCheck(this, BLEMethod);
this.map = [];
this.bridge = new Bridge();
}
/**
* 开始扫描
* @example iot.ble.startScan(10, (response) => {
* }, (error) => {
* }, []);
* @param {number} seconds 扫描时间(秒)
* @param {function} success 接口调用成功
* @param {function} error - 接口调用失败
* @param {Array} [filter] - 过滤产品型号
*/
_createClass(BLEMethod, [{
key: "startScan",
value: function startScan(seconds, success, error, filter) {
this.setUpdateState();
this.bridge.obj.startScan(seconds, function (ret) {
if (filter instanceof Array) {
for (var i in filter) {
var item = filter[i];
if (ret.name.indexOf(item) > -1) {
success(ret);
}
}
} else success(ret);
}, function (err) {
error(err);
}, filter);
}
}, {
key: "stopScan",
value: function stopScan(success, error) {
this.bridge.obj.stopScan(function (ret) {
success(ret);
}, function (err) {
error(err);
});
}
}, {
key: "connect",
value: function connect(info, seruuid, charuuid, success, error) {
this.bridge.obj.connect(info, seruuid, charuuid, function (ret) {
success(ret);
}, function (err) {
error(err);
});
}
}, {
key: "disconnect",
value: function disconnect(success, error) {
this.bridge.obj.disconnect(function (ret) {
success(ret);
}, function (err) {
error(err);
});
}
}, {
key: "onBtStateChange",
value: function onBtStateChange() {
var _this = this;
this.bridge.obj.onBtStateChange(function (ret) {
var event = {
type: "event",
action: ret.state
};
_this.eventCallback(event);
});
}
}, {
key: "getBtState",
value: function getBtState(success, error) {
this.bridge.obj.getBtState(function (ret) {
success(ret);
}, function (err) {
error(err);
});
}
}, {
key: "isConnected",
value: function isConnected(success, error) {
this.bridge.obj.isConnected(function (ret) {
success(ret);
}, function (err) {
error(err);
});
}
}, {
key: "write",
value: function write(seruuid, charuuid, value, success, error) {
this.bridge.obj.write(seruuid, charuuid, value, function (ret) {
success(ret);
}, function (err) {
error(err);
});
}
}, {
key: "writeWithoutResponse",
value: function writeWithoutResponse(seruuid, charuuid, value, success, error) {
this.bridge.obj.writeWithoutResponse(seruuid, charuuid, value, function (ret) {
success(ret);
}, function (err) {
error(err);
});
}
}, {
key: "getState",
value: function getState(success, error) {
this.bridge.obj.getState(function (ret) {
success(ret);
}, function (err) {
error(err);
});
}
}, {
key: "setUpdateState",
value: function setUpdateState() {
var _this2 = this;
this.onBtStateChange();
this.bridge.obj.setUpdateState(function (ret) {
if (ret.type == "msg") {
if (_this2.modelFunction instanceof Function) {
var size = _this2.modelFunction(ret.data);
var prevMapSize = _this2.map.length;
_this2.map = _this2.map.concat(ret.data);
if (size > 0) {
var data = _this2.map.slice(0, prevMapSize + size);
_this2.map = _this2.map.slice(data.length, _this2.map.length);
_this2.msgCallback(data);
}
} else {
_this2.msgCallback(ret.data);
}
} else {
_this2.eventCallback(ret);
}
});
}
}, {
key: "toSetting",
value: function toSetting(type, success, error) {
this.bridge.obj.toSetting(type, function (ret) {
success(ret);
}, function (err) {
error(err);
});
}
}, {
key: "setModelFunction",
value: function setModelFunction(fn) {
this.setUpdateState();
this.modelFunction = fn;
}
}, {
key: "onEvent",
value: function onEvent(fn) {
this.setUpdateState();
this.eventCallback = fn;
}
}, {
key: "onMsg",
value: function onMsg(fn) {
this.setUpdateState();
this.msgCallback = fn;
}
}]);
return BLEMethod;
}();
module.exports = BLEMethod;
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* Log.js * Log.js
* Version: 0.1 * Version: 0.1
* User: shz * User: shz
...@@ -3488,8 +3290,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons ...@@ -3488,8 +3290,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
* Copyright(c) 2017. U-GEN Tech.Co,Ltd. All Rights Reserved. * Copyright(c) 2017. U-GEN Tech.Co,Ltd. All Rights Reserved.
* Log * Log
*/ */
var config = __webpack_require__(10); var config = __webpack_require__(9);
var NetWork = __webpack_require__(9); var NetWork = __webpack_require__(8);
// const Utils = require('../../utils/Utils'); // const Utils = require('../../utils/Utils');
var Log = function () { var Log = function () {
...@@ -3585,14 +3387,14 @@ var Log = function () { ...@@ -3585,14 +3387,14 @@ var Log = function () {
module.exports = Log; module.exports = Log;
/***/ }), /***/ }),
/* 20 */ /* 19 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(43); module.exports = __webpack_require__(40);
/***/ }), /***/ }),
/* 21 */ /* 20 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
...@@ -3606,249 +3408,21 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen ...@@ -3606,249 +3408,21 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Plugin = __webpack_require__(4);
var Ready = __webpack_require__(2); var Ready = __webpack_require__(2);
var Utils = __webpack_require__(10);
var BLEBridge = function (_Ready) { var Main = function (_Plugin) {
_inherits(BLEBridge, _Ready); _inherits(Main, _Plugin);
function BLEBridge() { function Main(langs, vue, i18n) {
_classCallCheck(this, BLEBridge); var isApp = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
var _this = _possibleConstructorReturn(this, (BLEBridge.__proto__ || Object.getPrototypeOf(BLEBridge)).call(this)); _classCallCheck(this, Main);
document.addEventListener("plusready", function () { var _this = _possibleConstructorReturn(this, (Main.__proto__ || Object.getPrototypeOf(Main)).call(this));
_this.onPlusready();
_this.dispatch(); _this.i18n = new I18NInit(langs, vue, i18n, isApp);
}, false);
return _this;
}
_createClass(BLEBridge, [{
key: 'onPlusready',
value: function onPlusready() {
var _BLECODE = 'Ugen_BLEPlugin',
B = window.plus.bridge,
callbackID = void 0;
var Ugen_BLEPlugin = {
startScan: function startScan(seconds, successCallback, errorCallback, filter) {
// alert('api js function scan init');
var success = typeof successCallback !== 'function' ? null : function (args) {
successCallback(args);
},
fail = typeof errorCallback !== 'function' ? null : function (code) {
errorCallback(code);
};
callbackID = B.callbackId(success, fail);
return B.exec(_BLECODE, "startScan", [callbackID, seconds, filter]);
},
stopScan: function stopScan(successCallback, errorCallback) {
var success = typeof successCallback !== 'function' ? null : function (args) {
successCallback(args);
},
fail = typeof errorCallback !== 'function' ? null : function (code) {
errorCallback(code);
};
callbackID = B.callbackId(success, fail);
return B.exec(_BLECODE, "stopScan", [callbackID]);
},
connect: function connect(info, seruuid, charuuid, successCallback, errorCallback) {
var success = typeof successCallback !== 'function' ? null : function (args) {
successCallback(args);
},
fail = typeof errorCallback !== 'function' ? null : function (code) {
errorCallback(code);
};
callbackID = B.callbackId(success, fail);
return B.exec(_BLECODE, "connect", [callbackID, info, seruuid, charuuid]);
},
disconnect: function disconnect(successCallback, errorCallback) {
var success = typeof successCallback !== 'function' ? null : function (args) {
successCallback(args);
},
fail = typeof errorCallback !== 'function' ? null : function (code) {
errorCallback(code);
};
callbackID = B.callbackId(success, fail);
return B.exec(_BLECODE, "disconnect", [callbackID]);
},
getBtState: function getBtState(successCallback, errorCallback) {
var success = typeof successCallback !== 'function' ? null : function (args) {
successCallback(args);
},
fail = typeof errorCallback !== 'function' ? null : function (code) {
errorCallback(code);
};
callbackID = B.callbackId(success, fail);
return B.exec(_BLECODE, "getBtState", [callbackID]);
},
onBtStateChange: function onBtStateChange(successCallback, errorCallback) {
var success = typeof successCallback !== 'function' ? null : function (args) {
successCallback(args);
},
fail = typeof errorCallback !== 'function' ? null : function (code) {
errorCallback(code);
};
callbackID = B.callbackId(success, fail);
return B.exec(_BLECODE, "onBtStateChange", [callbackID]);
},
isConnected: function isConnected(successCallback, errorCallback) {
var success = typeof successCallback !== 'function' ? null : function (args) {
successCallback(args);
},
fail = typeof errorCallback !== 'function' ? null : function (code) {
errorCallback(code);
};
callbackID = B.callbackId(success, fail);
return B.exec(_BLECODE, "isConnected", [callbackID]);
},
write: function write(seruuid, charuuid, value, successCallback, errorCallback) {
var success = typeof successCallback !== 'function' ? null : function (args) {
successCallback(args);
},
fail = typeof errorCallback !== 'function' ? null : function (code) {
errorCallback(code);
};
callbackID = B.callbackId(success, fail);
return B.exec(_BLECODE, "write", [callbackID, seruuid, charuuid, value]);
},
writeWithoutResponse: function writeWithoutResponse(seruuid, charuuid, value, successCallback, errorCallback) {
var success = typeof successCallback !== 'function' ? null : function (args) {
successCallback(args);
},
fail = typeof errorCallback !== 'function' ? null : function (code) {
errorCallback(code);
};
callbackID = B.callbackId(success, fail);
return B.exec(_BLECODE, "writeWithoutResponse", [callbackID, seruuid, charuuid, value]);
},
getState: function getState(successCallback, errorCallback) {
var success = typeof successCallback !== 'function' ? null : function (args) {
successCallback(args);
},
fail = typeof errorCallback !== 'function' ? null : function (code) {
errorCallback(code);
};
callbackID = B.callbackId(success, fail);
return B.exec(_BLECODE, "getState", [callbackID]);
},
setUpdateState: function setUpdateState(successCallback, errorCallback) {
var success = typeof successCallback !== 'function' ? null : function (args) {
successCallback(args);
},
fail = typeof errorCallback !== 'function' ? null : function (code) {
errorCallback(code);
};
callbackID = B.callbackId(success, fail);
return B.exec(_BLECODE, "setUpdateState", [callbackID]);
},
toSetting: function toSetting(type, successCallback, errorCallback) {
// alert('api js function scan init');
var success = typeof successCallback !== 'function' ? null : function (args) {
successCallback(args);
},
fail = typeof errorCallback !== 'function' ? null : function (code) {
errorCallback(code);
};
callbackID = B.callbackId(success, fail);
return B.exec(_BLECODE, "toSetting", [callbackID, type]);
}
};
this.Ugen_BLEPlugin = Ugen_BLEPlugin;
}
}, {
key: 'onReady',
value: function onReady() {
return this.Ugen_BLEPlugin;
}
}]);
return BLEBridge;
}(Ready);
module.exports = BLEBridge;
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Plugin = __webpack_require__(3);
var BLE = __webpack_require__(18);
var Utils = __webpack_require__(8);
var Main = function (_Plugin) {
_inherits(Main, _Plugin);
function Main() {
_classCallCheck(this, Main);
var _this = _possibleConstructorReturn(this, (Main.__proto__ || Object.getPrototypeOf(Main)).call(this));
_this.ble = new BLE();
return _this;
}
_createClass(Main, [{
key: 'needReady',
value: function needReady() {
if (Utils.getBrowserInfo().mobile != null) {
return [this.ble.bridge];
} else {
return [];
}
}
}]);
return Main;
}(Plugin);
module.exports = Main;
/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Plugin = __webpack_require__(3);
var Ready = __webpack_require__(2);
var Utils = __webpack_require__(8);
var Main = function (_Plugin) {
_inherits(Main, _Plugin);
function Main(langs, vue, i18n) {
var isApp = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
_classCallCheck(this, Main);
var _this = _possibleConstructorReturn(this, (Main.__proto__ || Object.getPrototypeOf(Main)).call(this));
_this.i18n = new I18NInit(langs, vue, i18n, isApp);
return _this; return _this;
} }
...@@ -3955,27 +3529,27 @@ var I18NInit = function (_Ready) { ...@@ -3955,27 +3529,27 @@ var I18NInit = function (_Ready) {
module.exports = Main; module.exports = Main;
/***/ }), /***/ }),
/* 24 */ /* 21 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
if (!__webpack_require__(49)()) { if (!__webpack_require__(46)()) {
Object.defineProperty(__webpack_require__(30), 'Symbol', Object.defineProperty(__webpack_require__(27), 'Symbol',
{ value: __webpack_require__(51), configurable: true, enumerable: false, { value: __webpack_require__(48), configurable: true, enumerable: false,
writable: true }); writable: true });
} }
/***/ }), /***/ }),
/* 25 */ /* 22 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
/* WEBPACK VAR INJECTION */(function(Promise) { /* WEBPACK VAR INJECTION */(function(Promise) {
var _regenerator = __webpack_require__(20); var _regenerator = __webpack_require__(19);
var _regenerator2 = _interopRequireDefault(_regenerator); var _regenerator2 = _interopRequireDefault(_regenerator);
...@@ -3985,7 +3559,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de ...@@ -3985,7 +3559,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var WebSqlTool = __webpack_require__(54); var WebSqlTool = __webpack_require__(51);
var websql = new WebSqlTool('UIOT', '1.0', 'ugen', 1024 * 1024 * 10); var websql = new WebSqlTool('UIOT', '1.0', 'ugen', 1024 * 1024 * 10);
var PublicStore = function () { var PublicStore = function () {
...@@ -3996,7 +3570,8 @@ var PublicStore = function () { ...@@ -3996,7 +3570,8 @@ var PublicStore = function () {
this.tableMap = this.tableName + "_map"; this.tableMap = this.tableName + "_map";
this.tableList = this.tableName + "_list"; this.tableList = this.tableName + "_list";
this.tabelSqlMap = 'CREATE TABLE IF NOT EXISTS ' + this.tableMap + ' (key TEXT unique, value TEXT, type TEXT);'; this.tabelSqlMap = 'CREATE TABLE IF NOT EXISTS ' + this.tableMap + ' (key TEXT unique, value TEXT, type TEXT);';
this.tabelSqlList = 'CREATE TABLE IF NOT EXISTS ' + this.tableList + ' (i TEXT unique, value TEXT, key_group TEXT, type TEXT);'; this.tabelSqlList = 'CREATE TABLE IF NOT EXISTS ' + this.tableList + ' (i TEXT, value TEXT, key_group TEXT, type TEXT, unique(value, key_group));';
// this.createListIndex = `CREATE INDEX IF NOT EXISTS b on ${this.tableList} (value, key_group);`;
} }
_createClass(PublicStore, [{ _createClass(PublicStore, [{
...@@ -4094,7 +3669,7 @@ var PublicStore = function () { ...@@ -4094,7 +3669,7 @@ var PublicStore = function () {
}, { }, {
key: 'addList', key: 'addList',
value: function addList(group, list, success, error) { value: function addList(group, list, success, error) {
var sql, getLastIdSql, getLastId, res, valuse, length, i, item, type, sqlPromise; var sql, getLastId, valuse, length, i, item, type, sqlPromise;
return _regenerator2.default.async(function addList$(_context) { return _regenerator2.default.async(function addList$(_context) {
while (1) { while (1) {
switch (_context.prev = _context.next) { switch (_context.prev = _context.next) {
...@@ -4109,18 +3684,14 @@ var PublicStore = function () { ...@@ -4109,18 +3684,14 @@ var PublicStore = function () {
case 3: case 3:
sql = 'INSERT OR REPLACE INTO ' + this.tableList + ' '; sql = 'INSERT OR REPLACE INTO ' + this.tableList + ' ';
getLastIdSql = 'select i from ' + this.tableList + ' where key_group = \'' + group + '\' order by CAST(i AS INTEGER) desc limit 1';
getLastId = 0; getLastId = 0;
_context.next = 8; /* let getLastIdSql = `select i from ${this.tableList} where key_group = '${group}' order by CAST(i AS INTEGER) desc limit 1`;
return _regenerator2.default.awrap(websql.dbExec(getLastIdSql)); let res = await websql.dbExec(getLastIdSql);
case 8:
res = _context.sent;
if (res.rows.length > 0) { if (res.rows.length > 0) {
getLastId = res.rows.item(0).i; getLastId = res.rows.item(0).i;
getLastId++; getLastId++;
} }*/
valuse = ""; valuse = "";
length = list.length; length = list.length;
...@@ -4132,26 +3703,29 @@ var PublicStore = function () { ...@@ -4132,26 +3703,29 @@ var PublicStore = function () {
type = "Object"; type = "Object";
item = JSON.stringify(item); item = JSON.stringify(item);
} }
if (valuse != "") valuse += " UNION ALL "; if (valuse != "") {
valuse += " UNION ALL ";
}
valuse += 'select \'' + getLastId + '\' AS \'i\',\'' + item + '\' AS \'value\',\'' + group + '\' AS \'key_group\',\'' + type + '\' as \'type\''; valuse += 'select \'' + getLastId + '\' AS \'i\',\'' + item + '\' AS \'value\',\'' + group + '\' AS \'key_group\',\'' + type + '\' as \'type\'';
getLastId++; // getLastId++;
// valuse += `select '${item}' AS 'value','${group}' AS 'key_group','${type}' as 'type'`;
} }
sql += valuse; sql += valuse;
sqlPromise = websql.dbExec(sql); sqlPromise = websql.dbExec(sql);
if (!success) { if (!success) {
_context.next = 19; _context.next = 14;
break; break;
} }
sqlPromise.then(success).catch(error); sqlPromise.then(success).catch(error);
_context.next = 20; _context.next = 15;
break; break;
case 19: case 14:
return _context.abrupt('return', sqlPromise); return _context.abrupt('return', sqlPromise);
case 20: case 15:
case 'end': case 'end':
return _context.stop(); return _context.stop();
} }
...@@ -4161,13 +3735,13 @@ var PublicStore = function () { ...@@ -4161,13 +3735,13 @@ var PublicStore = function () {
}, { }, {
key: 'getList', key: 'getList',
value: function getList(group, success, error) { value: function getList(group, success, error) {
var sql = 'select i,value,type from ' + this.tableList + ' where key_group = ?;'; var sql = 'select rowid,value,type from ' + this.tableList + ' where key_group = ?;';
var params = [group]; var params = [group];
var formatResult = function formatResult(res) { var formatResult = function formatResult(res) {
var resultList = []; var resultList = [];
var length = res.rows.length; var length = res.rows.length;
for (var i = 0; i < length; i++) { for (var i = 0; i < length; i++) {
var index = res.rows.item(i).i; var index = res.rows.item(i).rowid;
var value = res.rows.item(i).value; var value = res.rows.item(i).value;
var type = res.rows.item(i).type; var type = res.rows.item(i).type;
if (type == "Object") { if (type == "Object") {
...@@ -4207,14 +3781,13 @@ var PublicStore = function () { ...@@ -4207,14 +3781,13 @@ var PublicStore = function () {
type = "Object"; type = "Object";
item = JSON.stringify(item); item = JSON.stringify(item);
} }
var sqlPromise = websql.dbExec('update ' + this.tableList + ' set value = ?,type = ? where key_group = ? and i = ?;', [item, type, group, index.toString()]); var sqlPromise = websql.dbExec('update ' + this.tableList + ' set value = ?,type = ? where key_group = ? and rowid = ?;', [item, type, group, index.toString()]);
if (success) sqlPromise.then(success).catch(error);else return sqlPromise; if (success) sqlPromise.then(success).catch(error);else return sqlPromise;
} }
}, { }, {
key: 'delListByIndex', key: 'delListByIndex',
value: function delListByIndex(group, index, success, error) { value: function delListByIndex(group, index, success, error) {
var sqlPromise = websql.dbExec('delete from ' + this.tableList + ' where key_group = ? and i = ?;', [group, index.toString()]); var sqlPromise = websql.dbExec('delete from ' + this.tableList + ' where key_group = ? and rowid = ?;', [group, index.toString()]);
console.log('delete from ' + this.tableList + ' where key_group = \'' + group + '\' and i = ' + index + ';');
if (success) sqlPromise.then(success).catch(error);else return sqlPromise; if (success) sqlPromise.then(success).catch(error);else return sqlPromise;
} }
}, { }, {
...@@ -4246,7 +3819,7 @@ module.exports = PublicStore; ...@@ -4246,7 +3819,7 @@ module.exports = PublicStore;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
/***/ }), /***/ }),
/* 26 */ /* 23 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
...@@ -4256,7 +3829,7 @@ var _createClass = function () { function defineProperties(target, props) { for ...@@ -4256,7 +3829,7 @@ var _createClass = function () { function defineProperties(target, props) { for
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var qs = __webpack_require__(47); var qs = __webpack_require__(44);
var Base = function () { var Base = function () {
function Base() { function Base() {
...@@ -4296,7 +3869,7 @@ var Base = function () { ...@@ -4296,7 +3869,7 @@ var Base = function () {
module.exports = Base; module.exports = Base;
/***/ }), /***/ }),
/* 27 */ /* 24 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
...@@ -4308,11 +3881,10 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen ...@@ -4308,11 +3881,10 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
__webpack_require__(24); __webpack_require__(21);
var IOTMain = __webpack_require__(53); var IOTMain = __webpack_require__(50);
var Business = __webpack_require__(59); var Business = __webpack_require__(60);
var Ble = __webpack_require__(22); var vueI18N = __webpack_require__(20);
var vueI18N = __webpack_require__(23);
var Navigator = __webpack_require__(55); var Navigator = __webpack_require__(55);
var IOT = function (_IOTMain) { var IOT = function (_IOTMain) {
...@@ -4327,10 +3899,6 @@ var IOT = function (_IOTMain) { ...@@ -4327,10 +3899,6 @@ var IOT = function (_IOTMain) {
_this.loadPlugin(businessPlugin); _this.loadPlugin(businessPlugin);
_this.business = businessPlugin.business; _this.business = businessPlugin.business;
var ble = new Ble();
_this.loadPlugin(ble);
_this.ble = ble.ble;
var i18n = new vueI18N(params.lang || ["zh"], params.vue, params.i18n); var i18n = new vueI18N(params.lang || ["zh"], params.vue, params.i18n);
_this.loadPlugin(i18n); _this.loadPlugin(i18n);
...@@ -4345,9 +3913,9 @@ var IOT = function (_IOTMain) { ...@@ -4345,9 +3913,9 @@ var IOT = function (_IOTMain) {
module.exports = IOT; module.exports = IOT;
/***/ }), /***/ }),
/* 28 */, /* 25 */,
/* 29 */, /* 26 */,
/* 30 */ /* 27 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
...@@ -4357,19 +3925,19 @@ module.exports = new Function("return this")(); ...@@ -4357,19 +3925,19 @@ module.exports = new Function("return this")();
/***/ }), /***/ }),
/* 31 */ /* 28 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
module.exports = __webpack_require__(32)() module.exports = __webpack_require__(29)()
? Object.assign ? Object.assign
: __webpack_require__(33); : __webpack_require__(30);
/***/ }), /***/ }),
/* 32 */ /* 29 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
...@@ -4385,14 +3953,14 @@ module.exports = function () { ...@@ -4385,14 +3953,14 @@ module.exports = function () {
/***/ }), /***/ }),
/* 33 */ /* 30 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
var keys = __webpack_require__(35) var keys = __webpack_require__(32)
, value = __webpack_require__(39) , value = __webpack_require__(36)
, max = Math.max; , max = Math.max;
...@@ -4414,7 +3982,7 @@ module.exports = function (dest, src/*, …srcn*/) { ...@@ -4414,7 +3982,7 @@ module.exports = function (dest, src/*, …srcn*/) {
/***/ }), /***/ }),
/* 34 */ /* 31 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
...@@ -4426,19 +3994,19 @@ module.exports = function (obj) { return typeof obj === 'function'; }; ...@@ -4426,19 +3994,19 @@ module.exports = function (obj) { return typeof obj === 'function'; };
/***/ }), /***/ }),
/* 35 */ /* 32 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
module.exports = __webpack_require__(36)() module.exports = __webpack_require__(33)()
? Object.keys ? Object.keys
: __webpack_require__(37); : __webpack_require__(34);
/***/ }), /***/ }),
/* 36 */ /* 33 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
...@@ -4453,7 +4021,7 @@ module.exports = function () { ...@@ -4453,7 +4021,7 @@ module.exports = function () {
/***/ }), /***/ }),
/* 37 */ /* 34 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
...@@ -4467,7 +4035,7 @@ module.exports = function (object) { ...@@ -4467,7 +4035,7 @@ module.exports = function (object) {
/***/ }), /***/ }),
/* 38 */ /* 35 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
...@@ -4491,7 +4059,7 @@ module.exports = function (options/*, …options*/) { ...@@ -4491,7 +4059,7 @@ module.exports = function (options/*, …options*/) {
/***/ }), /***/ }),
/* 39 */ /* 36 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
...@@ -4504,19 +4072,19 @@ module.exports = function (value) { ...@@ -4504,19 +4072,19 @@ module.exports = function (value) {
/***/ }), /***/ }),
/* 40 */ /* 37 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
module.exports = __webpack_require__(41)() module.exports = __webpack_require__(38)()
? String.prototype.contains ? String.prototype.contains
: __webpack_require__(42); : __webpack_require__(39);
/***/ }), /***/ }),
/* 41 */ /* 38 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
...@@ -4531,7 +4099,7 @@ module.exports = function () { ...@@ -4531,7 +4099,7 @@ module.exports = function () {
/***/ }), /***/ }),
/* 42 */ /* 39 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
...@@ -4545,7 +4113,7 @@ module.exports = function (searchString/*, position*/) { ...@@ -4545,7 +4113,7 @@ module.exports = function (searchString/*, position*/) {
/***/ }), /***/ }),
/* 43 */ /* 40 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {// This method of obtaining a reference to the global object needs to be /* WEBPACK VAR INJECTION */(function(global) {// This method of obtaining a reference to the global object needs to be
...@@ -4566,7 +4134,7 @@ var oldRuntime = hadRuntime && g.regeneratorRuntime; ...@@ -4566,7 +4134,7 @@ var oldRuntime = hadRuntime && g.regeneratorRuntime;
// Force reevalutation of runtime.js. // Force reevalutation of runtime.js.
g.regeneratorRuntime = undefined; g.regeneratorRuntime = undefined;
module.exports = __webpack_require__(44); module.exports = __webpack_require__(41);
if (hadRuntime) { if (hadRuntime) {
// Restore the original runtime. // Restore the original runtime.
...@@ -4583,7 +4151,7 @@ if (hadRuntime) { ...@@ -4583,7 +4151,7 @@ if (hadRuntime) {
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1))) /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))
/***/ }), /***/ }),
/* 44 */ /* 41 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global, Promise) {/** /* WEBPACK VAR INJECTION */(function(global, Promise) {/**
...@@ -5326,7 +4894,7 @@ if (hadRuntime) { ...@@ -5326,7 +4894,7 @@ if (hadRuntime) {
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(0))) /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1), __webpack_require__(0)))
/***/ }), /***/ }),
/* 45 */ /* 42 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
...@@ -5417,7 +4985,7 @@ var isArray = Array.isArray || function (xs) { ...@@ -5417,7 +4985,7 @@ var isArray = Array.isArray || function (xs) {
/***/ }), /***/ }),
/* 46 */ /* 43 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
...@@ -5509,27 +5077,27 @@ var objectKeys = Object.keys || function (obj) { ...@@ -5509,27 +5077,27 @@ var objectKeys = Object.keys || function (obj) {
/***/ }), /***/ }),
/* 47 */ /* 44 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
exports.decode = exports.parse = __webpack_require__(45); exports.decode = exports.parse = __webpack_require__(42);
exports.encode = exports.stringify = __webpack_require__(46); exports.encode = exports.stringify = __webpack_require__(43);
/***/ }), /***/ }),
/* 48 */ /* 45 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
var assign = __webpack_require__(31) var assign = __webpack_require__(28)
, normalizeOpts = __webpack_require__(38) , normalizeOpts = __webpack_require__(35)
, isCallable = __webpack_require__(34) , isCallable = __webpack_require__(31)
, contains = __webpack_require__(40) , contains = __webpack_require__(37)
, d; , d;
...@@ -5590,7 +5158,7 @@ d.gs = function (dscr, get, set/*, options*/) { ...@@ -5590,7 +5158,7 @@ d.gs = function (dscr, get, set/*, options*/) {
/***/ }), /***/ }),
/* 49 */ /* 46 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
...@@ -5614,7 +5182,7 @@ module.exports = function () { ...@@ -5614,7 +5182,7 @@ module.exports = function () {
/***/ }), /***/ }),
/* 50 */ /* 47 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
...@@ -5630,7 +5198,7 @@ module.exports = function (x) { ...@@ -5630,7 +5198,7 @@ module.exports = function (x) {
/***/ }), /***/ }),
/* 51 */ /* 48 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
...@@ -5638,8 +5206,8 @@ module.exports = function (x) { ...@@ -5638,8 +5206,8 @@ module.exports = function (x) {
var d = __webpack_require__(48) var d = __webpack_require__(45)
, validateSymbol = __webpack_require__(52) , validateSymbol = __webpack_require__(49)
, create = Object.create, defineProperties = Object.defineProperties , create = Object.create, defineProperties = Object.defineProperties
, defineProperty = Object.defineProperty, objPrototype = Object.prototype , defineProperty = Object.defineProperty, objPrototype = Object.prototype
...@@ -5755,13 +5323,13 @@ defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive, ...@@ -5755,13 +5323,13 @@ defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive,
/***/ }), /***/ }),
/* 52 */ /* 49 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
var isSymbol = __webpack_require__(50); var isSymbol = __webpack_require__(47);
module.exports = function (value) { module.exports = function (value) {
if (!isSymbol(value)) throw new TypeError(value + " is not a symbol"); if (!isSymbol(value)) throw new TypeError(value + " is not a symbol");
...@@ -5770,13 +5338,13 @@ module.exports = function (value) { ...@@ -5770,13 +5338,13 @@ module.exports = function (value) {
/***/ }), /***/ }),
/* 53 */ /* 50 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
var _regenerator = __webpack_require__(20); var _regenerator = __webpack_require__(19);
var _regenerator2 = _interopRequireDefault(_regenerator); var _regenerator2 = _interopRequireDefault(_regenerator);
...@@ -5798,14 +5366,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" ...@@ -5798,14 +5366,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
* Copyright(c) 2017. U-GEN Tech.Co,Ltd. All Rights Reserved. * Copyright(c) 2017. U-GEN Tech.Co,Ltd. All Rights Reserved.
* IOTSuper * IOTSuper
*/ */
__webpack_require__(24); __webpack_require__(21);
var IOTBase = __webpack_require__(15); var IOTBase = __webpack_require__(15);
var IOTEvents = __webpack_require__(12); var IOTEvents = __webpack_require__(12);
var Log = __webpack_require__(19); var Log = __webpack_require__(18);
var network = __webpack_require__(9); var network = __webpack_require__(8);
var PublicStore = __webpack_require__(25); var PublicStore = __webpack_require__(22);
var Utils = __webpack_require__(8); var Utils = __webpack_require__(10);
var config = __webpack_require__(10); var config = __webpack_require__(9);
var keys = config.keys; var keys = config.keys;
var IOTMain = function (_IOTBase) { var IOTMain = function (_IOTBase) {
...@@ -5926,13 +5494,13 @@ var IOTMain = function (_IOTBase) { ...@@ -5926,13 +5494,13 @@ var IOTMain = function (_IOTBase) {
module.exports = IOTMain; module.exports = IOTMain;
/***/ }), /***/ }),
/* 54 */ /* 51 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
"use strict"; "use strict";
/* WEBPACK VAR INJECTION */(function(Promise) { /* WEBPACK VAR INJECTION */(function(Promise) {
var _regenerator = __webpack_require__(20); var _regenerator = __webpack_require__(19);
var _regenerator2 = _interopRequireDefault(_regenerator); var _regenerator2 = _interopRequireDefault(_regenerator);
...@@ -6012,6 +5580,9 @@ module.exports = WebSqlTool; ...@@ -6012,6 +5580,9 @@ module.exports = WebSqlTool;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0))) /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
/***/ }), /***/ }),
/* 52 */,
/* 53 */,
/* 54 */,
/* 55 */ /* 55 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
...@@ -6020,7 +5591,7 @@ module.exports = WebSqlTool; ...@@ -6020,7 +5591,7 @@ module.exports = WebSqlTool;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var Utils = __webpack_require__(8); var Utils = __webpack_require__(10);
var Web = __webpack_require__(57); var Web = __webpack_require__(57);
var App = __webpack_require__(56); var App = __webpack_require__(56);
...@@ -6063,7 +5634,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen ...@@ -6063,7 +5634,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Base = __webpack_require__(26); var Base = __webpack_require__(23);
var App = function (_Base) { var App = function (_Base) {
_inherits(App, _Base); _inherits(App, _Base);
...@@ -6071,26 +5642,80 @@ var App = function (_Base) { ...@@ -6071,26 +5642,80 @@ var App = function (_Base) {
function App() { function App() {
_classCallCheck(this, App); _classCallCheck(this, App);
return _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this)); var _this = _possibleConstructorReturn(this, (App.__proto__ || Object.getPrototypeOf(App)).call(this));
_this.backTime = null;
return _this;
} }
_createClass(App, [{ _createClass(App, [{
key: "openWindow", key: 'openWindow',
value: function openWindow(params) { value: function openWindow(params) {
var w = plus.webview.create(params.url, params.id, {}, { IOTData: params.extras }); var wv = plus.webview.create(params.url, params.id, {}, { IOTData: params.extras });
w.show("slide-in-right"); wv.show('slide-in-right');
} }
}, { }, {
key: "getExtras", key: 'getExtras',
value: function getExtras() { value: function getExtras() {
var view = plus.webview.currentWebview(); var wv = plus.webview.currentWebview();
return view.IOTData || {}; return wv.IOTData || {};
} }
}, { }, {
key: "back", key: 'backButtonEvent',
value: function backButtonEvent() {
var _this2 = this;
var wvs = plus.webview.all();
if (wvs.length > 1) {
this.back();
} else {
var wv = plus.webview.currentWebview();
wv.canBack(function (e) {
if (e.canBack) {
window.history.back();
} else {
if (!_this2.backTime) {
_this2.backTime = new Date().getTime();
plus.nativeUI.toast('再按一次退出应用');
setTimeout(function () {
_this2.backTime = null;
}, 2000);
} else {
if (new Date().getTime() - _this2.backTime < 2000) {
plus.runtime.quit();
}
}
}
});
}
}
}, {
key: 'back',
value: function back() { value: function back() {
var w = plus.webview.currentWebview(); var wv = plus.webview.currentWebview();
w.close(); wv.close();
}
}, {
key: 'closeOthers',
value: function closeOthers() {
var wvs = plus.webview.all();
var currentWv = plus.webview.currentWebview();
for (var i = 0; i < wvs.length; i++) {
if (wvs[i] != currentWv) {
wvs[i].close();
}
}
}
}, {
key: 'backToHomePage',
value: function backToHomePage() {
var wvs = plus.webview.all();
var homepage = plus.webview.getWebviewById('homepage');
for (var i = 0; i < wvs.length; i++) {
if (wvs[i] != homepage) {
wvs[i].close();
}
}
} }
}]); }]);
...@@ -6112,7 +5737,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen ...@@ -6112,7 +5737,7 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Base = __webpack_require__(26); var Base = __webpack_require__(23);
var Web = function (_Base) { var Web = function (_Base) {
_inherits(Web, _Base); _inherits(Web, _Base);
...@@ -6123,10 +5748,6 @@ var Web = function (_Base) { ...@@ -6123,10 +5748,6 @@ var Web = function (_Base) {
return _possibleConstructorReturn(this, (Web.__proto__ || Object.getPrototypeOf(Web)).call(this)); return _possibleConstructorReturn(this, (Web.__proto__ || Object.getPrototypeOf(Web)).call(this));
} }
// openWindow(params){
// console.log("heheda")
// }
return Web; return Web;
}(Base); }(Base);
...@@ -6317,292 +5938,6 @@ var _createClass = function () { function defineProperties(target, props) { for ...@@ -6317,292 +5938,6 @@ var _createClass = function () { function defineProperties(target, props) { for
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Plugin = __webpack_require__(3);
var Bridge = __webpack_require__(66);
var SDS = __webpack_require__(62);
var BLE = __webpack_require__(18);
var User = __webpack_require__(61);
var Device = __webpack_require__(60);
var SDSBLEBusiness = function (_Plugin) {
_inherits(SDSBLEBusiness, _Plugin);
function SDSBLEBusiness(params) {
_classCallCheck(this, SDSBLEBusiness);
var _this = _possibleConstructorReturn(this, (SDSBLEBusiness.__proto__ || Object.getPrototypeOf(SDSBLEBusiness)).call(this));
_this.business = new Bridge(params);
_this.sds = new SDS();
_this.ble = new BLE();
_this.business.user = new User(_this.business);
_this.business.device = new Device(_this.business);
_this.business.sds = _this.sds;
_this.business.ble = _this.ble;
return _this;
}
_createClass(SDSBLEBusiness, [{
key: 'needReady',
value: function needReady() {
return new Array(this.business, this.sds.bridge, this.ble.bridge);
}
}]);
return SDSBLEBusiness;
}(Plugin);
module.exports = SDSBLEBusiness;
/***/ }),
/* 60 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* SDSBLEDevice.js
* Version: 0.1
* User: shz
* Date: 2017-09-07
* Copyright(c) 2017. U-GEN Tech.Co,Ltd. All Rights Reserved.
* SDSBLEDevice
*/
var Device = __webpack_require__(58);
var SDSBLEDevice = function (_Device) {
_inherits(SDSBLEDevice, _Device);
function SDSBLEDevice(business) {
_classCallCheck(this, SDSBLEDevice);
return _possibleConstructorReturn(this, (SDSBLEDevice.__proto__ || Object.getPrototypeOf(SDSBLEDevice)).call(this, business));
}
_createClass(SDSBLEDevice, [{
key: 'getList',
value: function getList(params) {
var sds = params.data.sds === true;
if (sds) {
this.business.sds.getDevicesByUser({
success: params.success,
error: params.error
});
} else {
_get(SDSBLEDevice.prototype.__proto__ || Object.getPrototypeOf(SDSBLEDevice.prototype), 'getList', this).call(this, params);
}
}
}, {
key: 'getInfo',
value: function getInfo(params) {
var sds = params.data.sds === true;
if (sds) {
this.business.sds.getDeviceDetail({
data: {
uuid: params.data.uuid
},
success: params.success,
error: params.error
});
} else {
_get(SDSBLEDevice.prototype.__proto__ || Object.getPrototypeOf(SDSBLEDevice.prototype), 'getInfo', this).call(this, params);
}
}
}, {
key: 'setNickname',
value: function setNickname(params) {
var sds = params.data.sds === true;
if (sds) {
this.business.sds.updateDeviceInfo({
data: {
uuid: params.data.uuid,
nickname: params.data.nickname,
model: params.data.model
},
success: params.success,
error: params.error
});
} else {
_get(SDSBLEDevice.prototype.__proto__ || Object.getPrototypeOf(SDSBLEDevice.prototype), 'setNickname', this).call(this, params);
}
}
/*bind(params) {
let sds = (params.data.sds === true);
if (sds) {
this.business.sds.bindDevice({
data: {
uuid: params.data.uuid
},
success: () => {
super.bind(params);
},
error: params.error
});
} else {
super.bind(params);
}
}*/
}, {
key: 'unbind',
value: function unbind(params) {
var _this2 = this;
var sds = params.data.sds === true;
if (sds) {
this.business.sds.unbindDevice({
data: {
uuid: params.data.uuid
},
success: function success() {
_get(SDSBLEDevice.prototype.__proto__ || Object.getPrototypeOf(SDSBLEDevice.prototype), 'unbind', _this2).call(_this2, params);
},
error: params.error
});
} else {
_get(SDSBLEDevice.prototype.__proto__ || Object.getPrototypeOf(SDSBLEDevice.prototype), 'unbind', this).call(this, params);
}
}
}]);
return SDSBLEDevice;
}(Device);
module.exports = SDSBLEDevice;
/***/ }),
/* 61 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* SDSBLEUser.js
* Version: 0.1
* User: shz
* Date: 2017-08-08
* Copyright(c) 2017. U-GEN Tech.Co,Ltd. All Rights Reserved.
* SDSBLEUser
*/
var User = __webpack_require__(64);
var SDSBLEUser = function (_User) {
_inherits(SDSBLEUser, _User);
function SDSBLEUser(business) {
_classCallCheck(this, SDSBLEUser);
return _possibleConstructorReturn(this, (SDSBLEUser.__proto__ || Object.getPrototypeOf(SDSBLEUser)).call(this, business));
}
_createClass(SDSBLEUser, [{
key: 'login',
value: function login(params) {
var _this2 = this;
var sds = params.data.sds === true;
var SDSLogin = function SDSLogin(userinfo) {
_this2.business.sds.login({
data: {
userinfo: userinfo
},
success: params.success,
error: params.error,
complete: params.complete
});
};
if (sds) {
SDSLogin({
nickname: params.data.nickname,
username: params.data.username,
head: params.data.head,
utoken: params.data.utoken
});
} else {
var data = {
username: params.data.username,
pwd: params.data.pwd
};
var opts = {
data: data,
success: function success(ret) {
console.log(ret.data);
SDSLogin(ret.data);
},
error: params.error,
complete: params.complete
};
_get(SDSBLEUser.prototype.__proto__ || Object.getPrototypeOf(SDSBLEUser.prototype), 'login', this).call(this, opts);
}
}
}, {
key: 'logout',
value: function logout(params) {
var _this3 = this;
var sds = params.data.sds === true;
var SDSLogout = function SDSLogout() {
_this3.business.sds.logout({
success: params.success,
error: params.error,
complete: params.complete
});
};
if (sds) {
SDSLogout();
} else {
var opts = {
success: SDSLogout,
error: params.error
};
_get(SDSBLEUser.prototype.__proto__ || Object.getPrototypeOf(SDSBLEUser.prototype), 'logout', this).call(this, opts);
}
}
}]);
return SDSBLEUser;
}(User);
module.exports = SDSBLEUser;
/***/ }),
/* 62 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/** /**
* SDSPlugin.js * SDSPlugin.js
* Version: 0.1 * Version: 0.1
...@@ -6948,97 +6283,392 @@ var SDS = function () { ...@@ -6948,97 +6283,392 @@ var SDS = function () {
}); });
} }
//TODO //TODO
/*deviceStatusChange(params) { /*deviceStatusChange(params) {
this.checkKeyExists(params.data, 'dataKey'); this.checkKeyExists(params.data, 'dataKey');
this.bridge.obj.deviceStatusChange(params.data.dataKey, (ret) => { this.bridge.obj.deviceStatusChange(params.data.dataKey, (ret) => {
this.handleSuccess(params, ret); this.handleSuccess(params, ret);
}, (err) => { }, (err) => {
params.error(err); params.error(err);
});
}
deviceBindRelChange(params) {
this.checkKeyExists(params.data, 'uuid', 'auid', 'relation');
this.bridge.obj.deviceBindRelChange(params.data.uuid, params.data.auid, params.data.relation, (ret) => {
this.handleSuccess(params, ret);
}, (err) => {
params.error(err);
});
}*/
}, {
key: 'wifiDeviceConfig',
value: function wifiDeviceConfig(params) {
var _this24 = this;
this.bridge.obj.wifiDeviceConfig(function (ret) {
_this24.handleSuccess(params, ret);
}, function (err) {
params.error(err);
});
}
}, {
key: 'getSSId',
value: function getSSId(params) {
var _this25 = this;
this.bridge.obj.getSSId(function (ret) {
_this25.handleSuccess(params, ret);
}, function (err) {
params.error(err);
});
}
}, {
key: 'findDevices',
value: function findDevices(params) {
var _this26 = this;
this.bridge.obj.findDevices(function (ret) {
_this26.handleSuccess(params, ret);
}, function (err) {
params.error(err);
});
}
}, {
key: 'stopFindDevices',
value: function stopFindDevices(params) {
var _this27 = this;
this.bridge.obj.stopFindDevices(function (ret) {
_this27.handleSuccess(params, ret);
}, function (err) {
params.error(err);
});
}
}, {
key: 'findWifi',
value: function findWifi(params) {
var _this28 = this;
this.checkKeyExists(params.data, 'model', 'ssid', 'wifiPwd', 'timeout');
this.bridge.obj.startFindWIFI(params.data.model, params.data.ssid, params.data.wifiPwd, params.data.timeout, function (ret) {
_this28.handleSuccess(params, ret);
}, function (err) {
params.error(err);
});
}
}, {
key: 'stopFindWifi',
value: function stopFindWifi(params) {
var _this29 = this;
this.bridge.obj.stopFindWIFI(function (ret) {
_this29.handleSuccess(params, ret);
}, function (err) {
params.error(err);
});
}
}]);
return SDS;
}();
module.exports = SDS;
/***/ }),
/* 60 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var Plugin = __webpack_require__(4);
var Bridge = __webpack_require__(66);
var SDS = __webpack_require__(59);
var User = __webpack_require__(62);
var Device = __webpack_require__(61);
var SDSBusiness = function (_Plugin) {
_inherits(SDSBusiness, _Plugin);
function SDSBusiness(params) {
_classCallCheck(this, SDSBusiness);
var _this = _possibleConstructorReturn(this, (SDSBusiness.__proto__ || Object.getPrototypeOf(SDSBusiness)).call(this));
_this.business = new Bridge(params);
_this.sds = new SDS();
_this.business.user = new User(_this.business);
_this.business.device = new Device(_this.business);
_this.business.sds = _this.sds;
return _this;
}
_createClass(SDSBusiness, [{
key: 'needReady',
value: function needReady() {
return new Array(this.business, this.sds.bridge);
}
}]);
return SDSBusiness;
}(Plugin);
module.exports = SDSBusiness;
/***/ }),
/* 61 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* SDSDevice.js
* Version: 0.1
* User: shz
* Date: 2017-09-07
* Copyright(c) 2017. U-GEN Tech.Co,Ltd. All Rights Reserved.
* SDSUser
*/
var Device = __webpack_require__(58);
var SDSDevice = function (_Device) {
_inherits(SDSDevice, _Device);
function SDSDevice(business) {
_classCallCheck(this, SDSDevice);
return _possibleConstructorReturn(this, (SDSDevice.__proto__ || Object.getPrototypeOf(SDSDevice)).call(this, business));
}
_createClass(SDSDevice, [{
key: 'getList',
value: function getList(params) {
var sds = params.data.sds === true;
if (sds) {
this.business.sds.getDevicesByUser({
success: params.success,
error: params.error
});
} else {
_get(SDSDevice.prototype.__proto__ || Object.getPrototypeOf(SDSDevice.prototype), 'getList', this).call(this, params);
}
}
}, {
key: 'getInfo',
value: function getInfo(params) {
var sds = params.data.sds === true;
if (sds) {
this.business.sds.getDeviceDetail({
data: {
uuid: params.data.uuid
},
success: params.success,
error: params.error
});
} else {
_get(SDSDevice.prototype.__proto__ || Object.getPrototypeOf(SDSDevice.prototype), 'getInfo', this).call(this, params);
}
}
}, {
key: 'setNickname',
value: function setNickname(params) {
console.log('setNickname', params.data);
var sds = params.data.sds === true;
if (sds) {
this.business.sds.updateDeviceInfo({
data: {
uuid: params.data.uuid,
nickname: params.data.nickname,
model: params.data.model
},
success: params.success,
error: params.error
});
} else {
_get(SDSDevice.prototype.__proto__ || Object.getPrototypeOf(SDSDevice.prototype), 'setNickname', this).call(this, params);
}
}
/*bind(params) {
let sds = (params.data.sds === true);
if (sds) {
this.business.sds.bindDevice({
data: {
uuid: params.data.uuid
},
success: () => {
super.bind(params);
},
error: params.error
}); });
} else {
super.bind(params);
} }
deviceBindRelChange(params) {
this.checkKeyExists(params.data, 'uuid', 'auid', 'relation');
this.bridge.obj.deviceBindRelChange(params.data.uuid, params.data.auid, params.data.relation, (ret) => {
this.handleSuccess(params, ret);
}, (err) => {
params.error(err);
});
}*/ }*/
}, { }, {
key: 'wifiDeviceConfig', key: 'unbind',
value: function wifiDeviceConfig(params) { value: function unbind(params) {
var _this24 = this; var _this2 = this;
this.bridge.obj.wifiDeviceConfig(function (ret) { var sds = params.data.sds === true;
_this24.handleSuccess(params, ret); if (sds) {
}, function (err) { this.business.sds.unbindDevice({
params.error(err); data: {
uuid: params.data.uuid
},
success: function success() {
_get(SDSDevice.prototype.__proto__ || Object.getPrototypeOf(SDSDevice.prototype), 'unbind', _this2).call(_this2, params);
},
error: params.error
}); });
} else {
_get(SDSDevice.prototype.__proto__ || Object.getPrototypeOf(SDSDevice.prototype), 'unbind', this).call(this, params);
} }
}, {
key: 'getSSId',
value: function getSSId(params) {
var _this25 = this;
this.bridge.obj.getSSId(function (ret) {
_this25.handleSuccess(params, ret);
}, function (err) {
params.error(err);
});
} }
}, {
key: 'findDevices',
value: function findDevices(params) {
var _this26 = this;
this.bridge.obj.findDevices(function (ret) { /*send(params) {
_this26.handleSuccess(params, ret); this.business.sds.setDeviceStatus({
}, function (err) { data: {
params.error(err); uuid: params.data.uuid,
setParams: params.data.setParams
},
success: params, success,
error: params.error
}); });
} }*/
}, {
key: 'stopFindDevices',
value: function stopFindDevices(params) {
var _this27 = this;
this.bridge.obj.stopFindDevices(function (ret) { }]);
_this27.handleSuccess(params, ret);
}, function (err) { return SDSDevice;
params.error(err); }(Device);
});
module.exports = SDSDevice;
/***/ }),
/* 62 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* SDSUser.js
* Version: 0.1
* User: shz
* Date: 2017-08-08
* Copyright(c) 2017. U-GEN Tech.Co,Ltd. All Rights Reserved.
* SDSUser
*/
var User = __webpack_require__(64);
var SDSUser = function (_User) {
_inherits(SDSUser, _User);
function SDSUser(business) {
_classCallCheck(this, SDSUser);
return _possibleConstructorReturn(this, (SDSUser.__proto__ || Object.getPrototypeOf(SDSUser)).call(this, business));
} }
}, {
key: 'findWifi',
value: function findWifi(params) {
var _this28 = this;
this.checkKeyExists(params.data, 'model', 'ssid', 'wifiPwd', 'timeout'); _createClass(SDSUser, [{
this.bridge.obj.startFindWIFI(params.data.model, params.data.ssid, params.data.wifiPwd, params.data.timeout, function (ret) { key: 'login',
_this28.handleSuccess(params, ret); value: function login(params) {
}, function (err) { var _this2 = this;
params.error(err);
var sds = params.data.sds === true;
var SDSLogin = function SDSLogin(userinfo) {
_this2.business.sds.login({
data: {
userinfo: userinfo
},
success: params.success,
error: params.error,
complete: params.complete
});
};
if (sds) {
SDSLogin({
nickname: params.data.nickname,
username: params.data.username,
head: params.data.head,
utoken: params.data.utoken
}); });
} else {
var data = {
username: params.data.username,
pwd: params.data.pwd
};
var opts = {
data: data,
success: function success(ret) {
SDSLogin(ret.data);
},
error: params.error,
complete: params.complete
};
_get(SDSUser.prototype.__proto__ || Object.getPrototypeOf(SDSUser.prototype), 'login', this).call(this, opts);
}
} }
}, { }, {
key: 'stopFindWifi', key: 'logout',
value: function stopFindWifi(params) { value: function logout(params) {
var _this29 = this; var _this3 = this;
this.bridge.obj.stopFindWIFI(function (ret) { var sds = params.data.sds === true;
_this29.handleSuccess(params, ret); var SDSLogout = function SDSLogout() {
}, function (err) { _this3.business.sds.logout({
params.error(err); success: params.success,
error: params.error,
complete: params.complete
}); });
};
if (sds) {
SDSLogout();
} else {
var opts = {
success: SDSLogout,
error: params.error
};
_get(SDSUser.prototype.__proto__ || Object.getPrototypeOf(SDSUser.prototype), 'logout', this).call(this, opts);
}
} }
}]); }]);
return SDS; return SDSUser;
}(); }(User);
module.exports = SDS; module.exports = SDSUser;
/***/ }), /***/ }),
/* 63 */ /* 63 */
...@@ -7456,7 +7086,7 @@ var _createClass = function () { function defineProperties(target, props) { for ...@@ -7456,7 +7086,7 @@ var _createClass = function () { function defineProperties(target, props) { for
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var config = __webpack_require__(10); var config = __webpack_require__(9);
var keys = config.keys; var keys = config.keys;
var User = function () { var User = function () {
...@@ -7533,21 +7163,77 @@ var User = function () { ...@@ -7533,21 +7163,77 @@ var User = function () {
}; };
this.business.api.login(opts); this.business.api.login(opts);
} }
}, {
key: 'thirdLogin',
value: function thirdLogin(params) {
var _this3 = this;
var opts = {
data: params.data,
success: function success(ret) {
if (ret.data.utoken.length != 0) {
var infoArray = [];
infoArray.push([keys.uToken, ret.data.utoken]);
var userinfo = ret.data;
infoArray.push([keys.USER_INFO, userinfo]);
_this3.business.websql.setMaps(infoArray, function () {
_this3.business.setToken(ret.data.utoken);
params.success(ret);
}, function () {
params.error('thirdLogin set utoken error');
});
} else {
params.error('thirdLogin get utoken error');
}
},
error: params.error,
complete: params.complete
};
this.business.api.thirdLogin(opts);
}
}, {
key: 'simpleLogin',
value: function simpleLogin(params) {
var _this4 = this;
var opts = {
data: params.data,
success: function success(ret) {
if (ret.data.utoken.length != 0) {
var infoArray = [];
infoArray.push([keys.uToken, ret.data.utoken]);
var userinfo = ret.data;
infoArray.push([keys.USER_INFO, userinfo]);
_this4.business.websql.setMaps(infoArray, function () {
_this4.business.setToken(ret.data.utoken);
params.success(ret);
}, function () {
params.error('simpleLogin set utoken error');
});
} else {
params.error('simpleLogin get utoken error');
}
},
error: params.error,
complete: params.complete
};
this.business.api.simpleLogin(opts);
}
// 3 自动登录 // 3 自动登录
}, { }, {
key: 'autoLogin', key: 'autoLogin',
value: function autoLogin(params) { value: function autoLogin(params) {
var _this3 = this; var _this5 = this;
var data = {}; var data = {};
var opts = { var opts = {
data: data, data: data,
success: function success(ret) { success: function success(ret) {
if (ret.data.utoken.length != 0) { if (ret.data.utoken.length != 0) {
_this3.business.websql.setMap(keys.uToken, ret.data.utoken, function () { _this5.business.websql.setMap(keys.uToken, ret.data.utoken, function () {
_this3.business.setToken(ret.data.utoken); _this5.business.setToken(ret.data.utoken);
params.success(ret); params.success(ret);
}, function () { }, function () {
params.error('autoLogin set utoken error'); params.error('autoLogin set utoken error');
...@@ -7665,9 +7351,9 @@ var _createClass = function () { function defineProperties(target, props) { for ...@@ -7665,9 +7351,9 @@ var _createClass = function () { function defineProperties(target, props) { for
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var md5 = __webpack_require__(11); var md5 = __webpack_require__(11);
var config = __webpack_require__(10); var config = __webpack_require__(9);
var keys = config.keys; var keys = config.keys;
var NetWork = __webpack_require__(9); var NetWork = __webpack_require__(8);
var CloudAPI = function () { var CloudAPI = function () {
function CloudAPI(params) { function CloudAPI(params) {
...@@ -7675,8 +7361,10 @@ var CloudAPI = function () { ...@@ -7675,8 +7361,10 @@ var CloudAPI = function () {
var cloud = params.cloud; var cloud = params.cloud;
this.checkKeyExists(params, 'appId'); this.checkKeyExists(params, 'appId');
this.checkKeyExists(params, 'appSecret');
this.checkKeyExists(cloud, 'url'); this.checkKeyExists(cloud, 'url');
this.appId = params.appId; this.appId = params.appId;
this.appSecret = params.appSecret;
this.baseUrl = cloud.url; this.baseUrl = cloud.url;
} }
...@@ -7728,6 +7416,11 @@ var CloudAPI = function () { ...@@ -7728,6 +7416,11 @@ var CloudAPI = function () {
return md5(value, key + keys.signPerfix); return md5(value, key + keys.signPerfix);
} }
}, {
key: 'createSign',
value: function createSign(time) {
return md5(this.appId + this.appSecret + time);
}
// User // User
// 1 用户注册 // 1 用户注册
...@@ -7763,6 +7456,32 @@ var CloudAPI = function () { ...@@ -7763,6 +7456,32 @@ var CloudAPI = function () {
}; };
this.send('user/login', opts, false); this.send('user/login', opts, false);
} }
}, {
key: 'thirdLogin',
value: function thirdLogin(params) {
this.checkKeyExists(params.data, 'type');
var opts = {
type: 'post',
data: params.data,
success: params.success,
error: params.error,
complete: params.complete
};
this.send('user/thirdLogin', opts, false);
}
}, {
key: 'simpleLogin',
value: function simpleLogin(params) {
this.checkKeyExists(params.data, 'username');
var opts = {
type: 'post',
data: params.data,
success: params.success,
error: params.error,
complete: params.complete
};
this.send('user/login_simple', opts, false);
}
// 3 自动登录 // 3 自动登录
...@@ -8064,8 +7783,9 @@ var CloudAPI = function () { ...@@ -8064,8 +7783,9 @@ var CloudAPI = function () {
key: 'sendCustom', key: 'sendCustom',
value: function sendCustom(url, opts) { value: function sendCustom(url, opts) {
var needAuth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; var needAuth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
var isDebug = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
this.send(url, opts, needAuth, false); this.send(url, opts, needAuth, false, isDebug);
} }
}, { }, {
key: 'sendLoop', key: 'sendLoop',
...@@ -8101,6 +7821,7 @@ var CloudAPI = function () { ...@@ -8101,6 +7821,7 @@ var CloudAPI = function () {
value: function send(url, opts) { value: function send(url, opts) {
var needAuth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; var needAuth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
var isPublic = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; var isPublic = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
var isDebug = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
if (this.token == null && needAuth) { if (this.token == null && needAuth) {
if (opts.error) { if (opts.error) {
...@@ -8127,7 +7848,17 @@ var CloudAPI = function () { ...@@ -8127,7 +7848,17 @@ var CloudAPI = function () {
params.error = opts.error; params.error = opts.error;
params.complete = opts.complete; params.complete = opts.complete;
params.timeout = opts.timeout; params.timeout = opts.timeout;
NetWork.send(this.baseUrl + '/openapi/' + (isPublic ? 'public' : 'custom') + '/' + this.appId + '/' + url, params); var time = Date.now();
var sign = this.createSign(time);
var requestUrl = '';
if (isDebug) {
params.type = 'GET';
params.data = null;
requestUrl = url;
} else {
requestUrl = this.baseUrl + '/openapi/' + (isPublic ? 'public' : 'custom') + '/' + this.appId + '/' + url + '?sign=' + sign + '&time=' + time;
}
NetWork.send(requestUrl, params);
} }
} }
}]); }]);
...@@ -8154,8 +7885,8 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" ...@@ -8154,8 +7885,8 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
var Ready = __webpack_require__(2); var Ready = __webpack_require__(2);
var CloudAPI = __webpack_require__(65); var CloudAPI = __webpack_require__(65);
var PublicStore = __webpack_require__(25); var PublicStore = __webpack_require__(22);
var config = __webpack_require__(10); var config = __webpack_require__(9);
var keys = config.keys; var keys = config.keys;
var BusinessReady = function (_Ready) { var BusinessReady = function (_Ready) {
...@@ -8217,7 +7948,7 @@ module.exports = BusinessReady; ...@@ -8217,7 +7948,7 @@ module.exports = BusinessReady;
/* 68 */ /* 68 */
/***/ (function(module, exports, __webpack_require__) { /***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(27); module.exports = __webpack_require__(24);
/***/ }) /***/ })
......
...@@ -9515,12 +9515,14 @@ var iot = new UIOT({ ...@@ -9515,12 +9515,14 @@ var iot = new UIOT({
vue: Vue, vue: Vue,
i18n: _vueI18n2.default, i18n: _vueI18n2.default,
appId: '10004', appId: '10004',
appSecret: '10004',
wx: { wx: {
appId: '' appId: ''
}, },
cloud: { cloud: {
// url: 'http://wx.iotface.com' // url: 'http://wx.iotface.com'
url: 'http://192.168.2.96:20000' // url: 'http://192.168.2.96:20000'
url: 'https://cloud.iot.u-gen.net/test-openapi/'
}, },
plugin: { plugin: {
log: { log: {
......
...@@ -189,6 +189,33 @@ function cloudsLogin(self, id) { ...@@ -189,6 +189,33 @@ function cloudsLogin(self, id) {
}); });
// //
} }
//function cloudsLogin(self, id){
// uComponents.showLoading(self);
// iot.business.user.simpleLogin({
// data: {
// username: id
// },
// success: (response) => {
// let data = uPublic.checkResponseData(response.data);
// if(data){
// iot.navigator.openWindow({
// url: '../device/index.html',
// id: 'device'
// });
// }else{
//
// }
// },
// error: (error) => {
// console.log(error);
// uPublic.openRequestErrorAlert(self);
// },
// complete: () => {
// uComponents.hideLoading(self);
// }
// });
//}
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)["default"])) /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)["default"]))
/***/ }), /***/ }),
......
...@@ -28,10 +28,10 @@ ...@@ -28,10 +28,10 @@
{{ $t('myInfo.editNickname') }} {{ $t('myInfo.editNickname') }}
<p>{{ nickname }}</p> <p>{{ nickname }}</p>
</v-touch> </v-touch>
<v-touch tag="div" class="editPassword" v-on:tap="onEditPasswordTap"> <!--<v-touch tag="div" class="editPassword" v-on:tap="onEditPasswordTap">
{{ $t('myInfo.editPassword') }} {{ $t('myInfo.editPassword') }}
<p>&#xe63d;&#xe63d;&#xe63d;&#xe63d;&#xe63d;&#xe63d;</p> <p>&#xe63d;&#xe63d;&#xe63d;&#xe63d;&#xe63d;&#xe63d;</p>
</v-touch> </v-touch>-->
</div> </div>
<u-button :init-param="componentsConfig.logoutButton.initParam" v-on:u-button-tap="onLogoutButtonTap"></u-button> <u-button :init-param="componentsConfig.logoutButton.initParam" v-on:u-button-tap="onLogoutButtonTap"></u-button>
<u-dialog ref="udialog" :init-param="componentsConfig.dialog.initParam"></u-dialog> <u-dialog ref="udialog" :init-param="componentsConfig.dialog.initParam"></u-dialog>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment