examTeamApp/unpackage/dist/build/mp-weixin/pages/home/home.js

1 line
13 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/home/home"],{"1d81":function(e,t,i){"use strict";i.r(t);var n=i("f9f5"),o=i.n(n);for(var c in n)["default"].indexOf(c)<0&&function(e){i.d(t,e,(function(){return n[e]}))}(c);t["default"]=o.a},"2c3c":function(e,t,i){"use strict";var n=i("dbe5"),o=i.n(n);o.a},4784:function(e,t,i){"use strict";i.r(t);var n=i("cb0d"),o=i("1d81");for(var c in o)["default"].indexOf(c)<0&&function(e){i.d(t,e,(function(){return o[e]}))}(c);i("2c3c");var s=i("828b"),l=Object(s["a"])(o["default"],n["b"],n["c"],!1,null,"63ea8e36",null,!1,n["a"],void 0);t["default"]=l.exports},6754:function(e,t,i){"use strict";(function(e,t){var n=i("47a9");i("30b7");n(i("3240"));var o=n(i("4784"));e.__webpack_require_UNI_MP_PLUGIN__=i,t(o.default)}).call(this,i("3223")["default"],i("df3c")["createPage"])},cb0d:function(e,t,i){"use strict";i.d(t,"b",(function(){return o})),i.d(t,"c",(function(){return c})),i.d(t,"a",(function(){return n}));var n={uniCollapse:function(){return i.e("uni_modules/uni-collapse/components/uni-collapse/uni-collapse").then(i.bind(null,"f407"))},uniCollapseItem:function(){return i.e("uni_modules/uni-collapse/components/uni-collapse-item/uni-collapse-item").then(i.bind(null,"7ff1"))},uniIcons:function(){return Promise.all([i.e("common/vendor"),i.e("uni_modules/uni-icons/components/uni-icons/uni-icons")]).then(i.bind(null,"bbd6"))}},o=function(){var e=this,t=e.$createElement,i=(e._self._c,e.userList.length),n=e.info&&e.info.top_list.length,o=e.info&&e.info.top_list.length,c=o&&e.infoListTop&&e.infoListTop.list?e.infoListTop.list.length:null,s=o&&e.infoListTop&&e.infoListTop.list?e.__map(e.infoListTop.list,(function(t,i){var n=e.__get_orig(t),o=e.infoListTop.list.length;return{$orig:n,g4:o}})):null,l=e.info&&e.info.bottom_list.length,a=e.info&&e.info.bottom_list.length,r=a?e.__map(e.info.bottom_list,(function(t,i){var n=e.__get_orig(t),o=t.list?t.list.length:null,c=t.list&&"基础代谢"!=t.title?e.__map(t.list,(function(i,n){var o=e.__get_orig(i),c=t.list.length;return{$orig:o,g8:c}})):null,s=t.list&&"基础代谢"==t.title?t.list&&t.list.length:null;return{$orig:n,g7:o,l1:c,g9:s}})):null,u=a?e.info&&e.info.literature.length:null,d=a?e.info&&e.cplist&&(e.cplist.sleeplist.length||e.cplist.nutritionlist.length):null,h=a&&d?1==e.proposalnd&&e.cplist.nutritionlist.length:null,f=a&&d?2==e.proposalnd&&e.cplist.sleeplist.length:null,g=a&&d?3==e.proposalnd&&e.cplist.sportlist.length:null,p=a&&d?4==e.proposalnd&&e.cplist.moodlist.length:null,v=e.user?e.user.card_data_list.length:null,m=e.user?e.__map(e.user.card_data_list,(function(t,i){var n=e.__get_orig(t),o=t.inside_data.length,c=t.inside_data.length;return{$orig:n,g17:o,g18:c}})):null,L=e.userList.length&&1==e.user.measure_model;e._isMounted||(e.e0=function(t){e.proposalnd=1},e.e1=function(t){e.proposalnd=2},e.e2=function(t){e.proposalnd=3},e.e3=function(t){e.proposalnd=4},e.e4=function(t,i){var n=arguments[arguments.length-1].currentTarget.dataset,o=n.eventParams||n["event-params"];i=o.item;return e.$Bluetooth.handleDevicesMac(i.device_determine,i.acd_id)}),e.$mp.data=Object.assign({},{$root:{g0:i,g1:n,g2:o,g3:c,l0:s,g5:l,g6:a,l2:r,g10:u,g11:d,g12:h,g13:f,g14:g,g15:p,g16:v,l3:m,g19:L}})},c=[]},dbe5:function(e,t,i){},f9f5:function(e,t,i){"use strict";(function(e){var n=i("47a9");Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o,c=n(i("7ca3")),s=i("8f59");function l(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function a(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?l(Object(i),!0).forEach((function(t){(0,c.default)(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):l(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}var r={data:function(){return{rtype:0,transition:1.6,isShow:!0,infoListTop:{},activeHeight:0,deviceId:"",serviceId:"",write:"",notify:"",cplist:{moodlist:[],nutritionlist:[],sleeplist:[],sportlist:[]},devicesList:[],islink:0,textLink:"",proposalnd:1,toollist:[{icon:"/static/q2.png",title:"中招估分",path:"/pages/score/score"},{icon:"/static/q4.png",title:"BMI测评",path:"/pageTwo/home/bmi"},{icon:"/static/q6.png",title:"遗传身高",path:"/pageTwo/home/inheritHeighet"},{icon:"/static/q1.png",title:"智能跳绳",path:"/pages/skiping/skip?acd_id=6"},{icon:"/static/q10.png",title:"肺活训练",path:"/pages/lunging/vitalcapacity?acd_id=8"},{icon:"/static/q8.png",title:"历史体重",path:"/pageTwo/history/history?acd_id=2"},{icon:"/static/q3.png",title:"减脂对比",path:"/pageTwo/compk/contrast?acd_id=2"},{icon:"/static/q5.png",title:"曲线/目标",path:"/pages/body/body?acd_id=2"},{icon:"/static/q7.png",title:"手动记录",path:""},{icon:"/static/q9.png",title:"成员管理",path:"/pageTwo/my/manage"}]}},components:{record:function(){i.e("element/manuallyAdd/record").then(function(){return resolve(i("e472"))}.bind(null,i)).catch(i.oe)},headerIndex:function(){i.e("element/headerIndex").then(function(){return resolve(i("c5cc"))}.bind(null,i)).catch(i.oe)}},computed:a(a({},(0,s.mapState)(["user","familayList","MeasureResult","isConnected","isBluetoothTyle"])),{},{userList:function(){return this.familayList},info:function(){return this.cplist=this.MeasureResult?this.MeasureResult.cplist:null,this.infoListTop=this.MeasureResult?this.MeasureResult.top_list[0]:{},this.activeHeight=0,this.MeasureResult}}),onLoad:function(t){var i=this;i.handleoginversion(),e.onBluetoothAdapterStateChange((function(e){i.$store.commit("changeBluetooth",e.available)})),i.onBLEConnectionStateChange()},onPullDownRefresh:function(){this.isShow=!0,this.handleUserList(),this.onBLEConnectionStateChange(),e.stopPullDownRefresh()},watch:{isConnected:function(){this.isConnected||(this.textLink="重新测量",this.islink=-1)},isBluetoothTyle:function(){this.isBluetoothTyle||(this.textLink="请打开手机蓝牙后,开始测量",this.islink=-1)}},onShow:function(){console.log("onShow",e.getStorageSync("isBle")),e.getStorageSync("isBle")&&1==e.getStorageSync("isBle")&&(this.openBluetoothAdapter(),e.setStorageSync("isBle",!1),console.log("首次添加玩用户后初始化蓝牙",e.getStorageSync("isBle")))},methods:{openBluetoothAdapter:function(){var t=this;t.devicesList=[],e.openBluetoothAdapter({success:function(e){t.islink=0,t.textLink="蓝牙搜索中",console.log("蓝牙初始化成功"),t.startBluetoothDeviceDiscovery()},fail:function(i){"openBluetoothAdapter:fail auth denied"==i.errMsg||"openBluetoothAdapter:fail auth deny"===i.errMsg||"openBluetoothAdapter:fail authorize no response"===i.errMsg?e.showModal({title:"提示",content:"需要您授权使用手机蓝牙",showCancel:!1,success:function(i){e.openSetting({success:function(i){i.authSetting["scope.bluetooth"]?e.openBluetoothAdapter({success:function(e){t.islink=-1,t.textLink="蓝牙获取权限成功,重新连接蓝牙",t.$store.commit("changeBluetooth",!0)},fail:function(e){t.islink=-1,t.textLink="请打开手机蓝牙后,开始测量"}}):e.showToast({title:"获取权限失败,将无法使用手机蓝牙进行测量",icon:"none"})}})}}):(t.islink=-1,t.textLink="请打开手机蓝牙后,开始测量")}})},startBluetoothDeviceDiscovery:function(){var t=this;e.startBluetoothDevicesDiscovery({allowDuplicatesKey:!0,success:function(e){t.onBluetoothDeviceFound()},fail:function(e){}})},onBluetoothDeviceFound:function(){var t=this;e.onBluetoothDeviceFound((function(e){e.devices.forEach((function(e){return-1!=e.name.indexOf("G02")||-1!=e.name.toLowerCase().indexOf("pcl")||e.localName&&-1!=e.localName.toLowerCase().indexOf("pcl")?(clearTimeout(o),t.deviceId=e.deviceId,void t.handleDevice(e)):void 0}))})),t.handleMyTime()},handleDevice:function(t){var i=this.devicesList,n=this.$tools.inArray(i,"deviceId",t.deviceId);-1===n&&(-1!=t.name.indexOf("PCL")?(this.devicesList.push(t),e.navigateTo({url:"/pageTwo/devices/PCL?deviceId="+t.deviceId})):(this.devicesList.push(t),this.createBLEConnection(),this.$Bluetooth.stopBluetoothDevicesDiscovery()))},createBLEConnection:function(){var t=this;e.createBLEConnection({deviceId:t.deviceId,success:function(i){setTimeout((function(){e.hideLoading(),t.textLink="蓝牙连接中",t.getBLEDeviceServices()}),1e3)},fail:function(e){t.islink=-1,t.textLink="设备连接失败,重新连接",console.log("设备连接失败,请重新连接",e,t.deviceId)}})},getBLEDeviceServices:function(){var t=[],i=this;e.getBLEDeviceServices({deviceId:i.deviceId,success:function(e){console.log("获取设备的UUID成功",e,i.deviceId),t=e.services;for(var n=0;n<t.length;n++){var o=t[n];if(-1!=o.uuid.indexOf("FFF0")){i.serviceId=o.uuid,i.getBLEDeviceCharacteristics(),console.log("设备的FFE0的serviceId "+i.serviceId);break}}},fail:function(e){i.islink=-1,i.textLink="设备连接失败,重新连接",clearTimeout(o),console.log("获取设备的UUID失败:",e)}})},getBLEDeviceCharacteristics:function(){var t=this;e.getBLEDeviceCharacteristics({deviceId:t.deviceId,serviceId:t.serviceId,success:function(i){for(var n=0;n<i.characteristics.length;n++){var o=i.characteristics[n];-1!=o.uuid.indexOf("0000FFF1")?t.notify=o.uuid:-1!=o.uuid.indexOf("0000FFF2")&&(t.write=o.uuid)}e.notifyBLECharacteristicValueChange({deviceId:t.deviceId,serviceId:t.serviceId,characteristicId:t.notify,state:!0}),e.notifyBLECharacteristicValueChange({deviceId:t.deviceId,serviceId:t.serviceId,characteristicId:t.write,state:!0}),t.notifyBLECharacteristicValue()},fail:function(e){console.log("获取特征值失败:",JSON.stringify(e))}})},notifyBLECharacteristicValue:function(){var t=this;e.notifyBLECharacteristicValueChange({state:!0,deviceId:t.deviceId,serviceId:t.serviceId,characteristicId:t.notify,success:function(i){var n={deviceId:t.deviceId,serviceId:t.serviceId,notify:t.notify,write:t.write};e.navigateTo({url:"/pageTwo/devices/G02?info="+JSON.stringify(n)})},fail:function(e){console.log("测量失败",e.value)}})},handleMyTime:function(){var e=this;o=setTimeout((function(){e.devicesList.length||(e.islink=-1,e.textLink="未搜索到有效设备,重新搜索",clearTimeout(o),e.$Bluetooth.stopBluetoothDevicesDiscovery())}),5e4)},getBlereload:function(){this.islink=-1,this.textLink="重新测量"},handleoginversion:function(){var t=this;t.$model.getloginversion({}).then((function(i){0==i.code?t.handleUserList():(e.setStorageSync("token",null),e.setStorageSync("aan_id",null),e.clearStorageSync(),e.reLaunch({url:"/pageTwo/login/login"}))}))},handleUserList:function(){var t=this;t.$model.getUserList({type:2}).then((function(i){if(t.isShow=!0,console.log("用户列表",i,e.getStorageSync("userid")),0==i.code){if(t.$store.commit("changeFamilay",i.data),i.data.length){var n=e.getStorageSync("userid"),o=i.data.find((function(e){return e.id==n}));void 0!==o?n=o.id:(n=i.data[0].id,e.setStorageSync("userid",i.data[0].id)),console.log("正确userid",n),t.$store.dispatch("getUserInfo",{aud_id:n}),t.$store.dispatch("getResult",{aud_id:n}),t.handleLabelList(n),t.handlePublicRecord(n),t.openBluetoothAdapter()}}else t.$tools.msg(i.msg)})).catch((function(e){}))},handleLabelList:function(e){var t=this;t.$model.getLabelList({aud_id:e}).then((function(e){console.log("公共卡片项目",e),0==e.code&&t.$store.commit("changeLabelList",e.data)}))},handlePublicRecord:function(e){var t=this;t.$model.getPublicRecord({aud_id:e}).then((function(e){console.log("公共手动记录",e),0==e.code&&t.$store.commit("changePublicRecord",e.data)}))},handleCard:function(){e.navigateTo({url:"/pageTwo/cardList/card"})},handleTool:function(e,t){8==e?this.handlerRecord(2):this.navTo(t)},handlerReport:function(t){console.log("item",t);var i=t.device_determine?1:0;e.navigateTo({url:t.page_url_report+"?acd_id="+t.acd_id+"&device="+i})},handlerRecord:function(e){this.rtype=e,this.$store.commit("changeRecord",!0)},handleAddUser:function(){e.navigateTo({url:"/pageTwo/my/userInfo"})},handleToggleTop:function(e,t){this.infoListTop=e,this.activeHeight=t},navTo:function(t){console.log("url",t),e.navigateTo({url:t})},onBLEConnectionStateChange:function(){var t=this;e.onBLEConnectionStateChange((function(e){console.log("监听蓝牙连接状态",e.connected),t.$store.commit("changeConnected",e.connected)}))},closeBluetoothAdapter:function(){e.closeBluetoothAdapter({success:function(e){console.log("蓝牙模块关闭成功")}})},closeBLEConnection:function(){var t=this;e.closeBLEConnection({deviceId:t.deviceId,success:function(e){console.log("断开蓝牙连接成功"),t.$store.commit("changeConnected",!1)}})}}};t.default=r}).call(this,i("df3c")["default"])}},[["6754","common/runtime","common/vendor"]]]);