bluetooth.js 10 KB

12
  1. (global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/bluetooth/bluetooth"],{181:function(t,e,n){"use strict";(function(t,e){var o=n(4);n(26);o(n(25));var a=o(n(182));t.__webpack_require_UNI_MP_PLUGIN__=n,e(a.default)}).call(this,n(1)["default"],n(2)["createPage"])},182:function(t,e,n){"use strict";n.r(e);var o=n(183),a=n(186);for(var r in a)["default"].indexOf(r)<0&&function(t){n.d(e,t,(function(){return a[t]}))}(r);n(188);var s,u=n(36),i=Object(u["default"])(a["default"],o["render"],o["staticRenderFns"],!1,null,null,null,!1,o["components"],s);i.options.__file="pages/bluetooth/bluetooth.vue",e["default"]=i.exports},183:function(t,e,n){"use strict";n.r(e);var o=n(184);n.d(e,"render",(function(){return o["render"]})),n.d(e,"staticRenderFns",(function(){return o["staticRenderFns"]})),n.d(e,"recyclableRender",(function(){return o["recyclableRender"]})),n.d(e,"components",(function(){return o["components"]}))},184:function(t,e,n){"use strict";var o;n.r(e),n.d(e,"render",(function(){return a})),n.d(e,"staticRenderFns",(function(){return s})),n.d(e,"recyclableRender",(function(){return r})),n.d(e,"components",(function(){return o}));try{o={uTabs:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-tabs/u-tabs")]).then(n.bind(null,325))},uSkeleton:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-skeleton/u-skeleton")]).then(n.bind(null,333))},uSwipeAction:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-swipe-action/u-swipe-action")]).then(n.bind(null,341))},uSwipeActionItem:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-swipe-action-item/u-swipe-action-item")]).then(n.bind(null,347))},uIcon:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-icon/u-icon")]).then(n.bind(null,283))},uButton:function(){return Promise.all([n.e("common/vendor"),n.e("uni_modules/uview-ui/components/u-button/u-button")]).then(n.bind(null,292))}}}catch(u){if(-1===u.message.indexOf("Cannot find module")||-1===u.message.indexOf(".vue"))throw u;console.error(u.message),console.error("1. 排查组件名称拼写是否正确"),console.error("2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom"),console.error("3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件")}var a=function(){var t=this,e=t.$createElement,o=(t._self._c,t.__map(t.productList,(function(e,n){var o=t.__get_orig(e),a=t._f("date")(e.testTime);return{$orig:o,f0:a}}))),a=n(185);t.$mp.data=Object.assign({},{$root:{l0:o,m0:a}})},r=!1,s=[];a._withStripped=!0},186:function(t,e,n){"use strict";n.r(e);var o=n(187),a=n.n(o);for(var r in o)["default"].indexOf(r)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(r);e["default"]=a.a},187:function(t,e,n){"use strict";(function(t){var o=n(4);Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var a=o(n(30)),r=o(n(18)),s=o(n(32)),u={data:function(){return{loading_skeleton:!1,gatewayFlag:0,options1:[{text:"删除",style:{backgroundColor:"#f56c6c"}}],wh:"",active:0,tabList:[{name:"未检测",badge:{value:null}},{name:"检测失败",badge:{value:null}},{name:"检测成功",badge:{value:null}}],parameter:{testProjectId:null,pageSize:1e3,pageNo:1,status:2},total:0,productList:[]}},methods:{scrolltolower:function(){if(this.parameter.pageNo*this.parameter.pageSize>=this.total)return t.$showMsg("数据加载完毕");this.parameter.pageNo++,this.getBluetoothList()},toText:function(e){console.log(e),t.showModal({title:"温馨提示",content:"点击确定进入测试阶段",success:function(n){if(n.confirm){var o=JSON.stringify(e);0===e.type?(console.log("猫眼"),console.log(e),t.navigateTo({url:"/pages/cat-eye-test/cat-eye-test?item="+o})):1==e.type&&0==e.subType||null==e.subType?t.navigateTo({url:"/pages/lock-test/lock-test?item="+o}):t.navigateTo({url:"/pages/door-lock-module/door-lock-module?item="+o})}}})},textBtn:function(e){var n=this;return(0,s.default)(a.default.mark((function o(){var r,s,u,i;return a.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:if(t.showLoading({mask:!0,title:"命令执行中"}),0!==e.type){o.next=10;break}return console.log("我是猫眼"),o.next=5,t.$http.post("/api/v1/test/bluetooth/testCam",{deviceId:e.deviceId});case 5:r=o.sent,s=r.data,200===s.code?t.$showMsg("风鸣测试成功"):t.$showMsg("测试失败"),o.next=15;break;case 10:return o.next=12,t.$http.post("/api/v1/test/bluetooth/openDoor",{deviceId:e.deviceId});case 12:u=o.sent,i=u.data,200===i.code?n.$u.toast("开门测试成功"):t.$showMsg("测试失败");case 15:case"end":return o.stop()}}),o)})))()},change:function(t){var e=t.index;0==e?(this.productList=[],this.parameter.pageNo=1,this.parameter.status=2,this.getBluetoothList(),console.log("待检查")):1==e?(this.productList=[],this.parameter.pageNo=1,this.parameter.status=0,this.getBluetoothList()):(this.productList=[],this.parameter.pageNo=1,this.parameter.status=1,this.getBluetoothList())},scan:function(){var e=this;return(0,s.default)(a.default.mark((function n(){var o,r,s,u;return a.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return t.showLoading({title:"正在获取蓝牙设备",icon:"none"}),console.log("扫一扫"),o=[],n.next=5,t.$http.post("/api/v1/test/testResult/queryByCondition",{testProjectId:t.getStorageSync("testProjectId"),pageSize:100,pageNo:1,status:2});case 5:r=n.sent,s=r.data,t.hideLoading(),u=e,200==s.code?(o=s.data.records,console.log(o),t.scanCode({scanType:["barCode","qrCode"],success:function(e){console.log("条码类型:"+e.scanType),console.log("条码内容:"+e.result),console.log(o,"arr的数据");var n=o.find((function(t){return t.deviceId==e.result.toLowerCase()}));console.log(n,"arr1的msg");var a=JSON.stringify(n);if(!n)return u.$u.toast("未获取到设备信息");0==n.type?(console.log("我是猫眼"),t.navigateTo({url:"/pages/cat-eye-test/cat-eye-test?item="+a})):1==n.type&&0==n.subType||null==n.subType?(console.log("我是门锁"),t.navigateTo({url:"/pages/lock-test/lock-test?item="+a})):(console.log("我是模块"),t.navigateTo({url:"/pages/door-lock-module/door-lock-module?item="+a}))}})):e.$u.toast("请重新获取蓝牙设备");case 10:case"end":return n.stop()}}),n)})))()},search:function(){var t=this;this.searchBluetooth().then((function(){t.parameter.pageNo=1,t.productList=[],t.getBluetoothList()}))},click:function(e){var n=this;console.log("click",e),t.showModal({title:"温馨提示",content:"确定要删除吗?",success:function(){var o=(0,s.default)(a.default.mark((function o(r){var s,u;return a.default.wrap((function(o){while(1)switch(o.prev=o.next){case 0:if(!r.confirm){o.next=10;break}return t.showLoading({mask:!0,title:"正在删除中"}),o.next=4,t.$http.delete("/api/v1/test/testResult/".concat(e));case 4:s=o.sent,u=s.data,console.log(u),200==u.code?(n.productList=[],n.getBluetoothList().then((function(){n.getNum()}))):n.$u.toast("删除失败"),o.next=10;break;case 10:case"end":return o.stop()}}),o)})));function r(t){return o.apply(this,arguments)}return r}()})},getBluetoothList:function(){var e=this;return(0,s.default)(a.default.mark((function n(){var o,s;return a.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(t.getStorageSync("testProjectId")){n.next=2;break}return n.abrupt("return",e.$u.toast("未查询到测试项目,请前往后台添加测试项目"));case 2:return e.loading_skeleton=!0,console.log(11),e.gatewayFlag=0,n.next=7,t.$http.post("/api/v1/test/testResult/queryByCondition",e.parameter);case 7:o=n.sent,s=o.data,t.hideLoading(),console.log(s),200===s.code?(t.$showMsg("数据加载成功"),e.loading_skeleton=!1,e.productList=[],e.productList=[].concat((0,r.default)(e.productList),(0,r.default)(s.data.records))):(console.log("数据加载失败"),e.loading_skeleton=!1);case 12:case"end":return n.stop()}}),n)})))()},searchBluetooth:function(){var e=this;return(0,s.default)(a.default.mark((function n(){var o,r;return a.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:return e.productList=[],t.showLoading({mask:!0,title:"网关扫描中",icon:"none"}),console.log(e.parameter.testProjectId),n.next=5,t.$http.post("/api/v1/test/testProject/bluetooth/search",{testProjectId:e.parameter.testProjectId});case 5:o=n.sent,r=o.data,200==r.code?(e.gatewayFlag=1,t.hideLoading()):e.$u.toast("网关失败,点击按钮重新扫描"),console.log(r);case 9:case"end":return n.stop()}}),n)})))()},getNum:function(){var e=this;return(0,s.default)(a.default.mark((function n(){var o,r,s,u,i;return a.default.wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(t.getStorageSync("testProjectId")){n.next=2;break}return n.abrupt("return",e.$u.toast("未查询到测试项目,请前往后台添加测试项目"));case 2:return n.next=4,t.$http.post("/api/v1/test/testResult/queryByCondition",{testProjectId:t.getStorageSync("testProjectId"),pageSize:100,pageNo:1});case 4:o=n.sent,r=o.data,e.gatewayFlag=1,s=r.data.records.filter((function(t){return 2==t.status})),console.log(r.data.total,"sea"),u=r.data.records.filter((function(t){return 1==t.status})),i=r.data.records.filter((function(t){return 0==t.status})),e.tabList[0].badge.value=s.length,e.tabList[1].badge.value=i.length,e.tabList[2].badge.value=u.length;case 14:case"end":return n.stop()}}),n)})))()}},onShow:function(){var e=this;this.parameter.testProjectId=t.getStorageSync("testProjectId"),this.getNum().then((function(){1==e.gatewayFlag&&e.getBluetoothList()}))},onLoad:function(){var e=this,n=t.createSelectorQuery().in(this).select(".btn");n.boundingClientRect((function(t){var n=t.height;console.log(o.windowHeight-n-50),e.wh=o.windowHeight-n-50})).exec();var o=t.getSystemInfoSync();console.log(this.parameter.testProjectId)}};e.default=u}).call(this,n(2)["default"])},188:function(t,e,n){"use strict";n.r(e);var o=n(189),a=n.n(o);for(var r in o)["default"].indexOf(r)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(r);e["default"]=a.a},189:function(t,e,n){}},[[181,"common/runtime","common/vendor"]]]);
  2. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/bluetooth/bluetooth.js.map