| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- <script>
- import ws from '@/common/js/ws.js'
- export default {
- onLaunch: function() {
- console.warn('当前组件仅支持 uni_modules 目录结构 ,请升级 HBuilderX 到 3.1.0 版本以上!')
- console.log('App Launch')
- let that = this;
- let macAddress = that.api.getMacAddress()
- that.api.setSn(macAddress)
- // 获取设备信息
- // that.api.setSn("864629045684215,864629045684215")
- // plus.device.getInfo({
- // success:function(e){
- // console.log('getDeviceInfo success: '+JSON.stringify(e));
- // console.log('imei: '+e.imei);
- // that.api.setSn(e.imei)
- // // that.api.setSn("864629045684215,864629045684215")
- // // let sn = that.api.getSn();
- // // let url = that.api.wsHost() + sn;
- // // console.log('准备链接websocket:'+url);
- // // ws.connect(url, function(frame) {
- // // console.log('连接成功:' + frame);
- // // ws.subscribe('/topic/order/push', function(response) {
- // // console.log('收到消息:' + response.body);
- // // var json = JSON.parse(response.body);
- // // if (json.type == 'order_push' && json.sendType == 'all') {
- // // let orderId = json.data,
- // // dIds = json.msg;
- // // let user = that.api.getUser();
- // // if (user) {
- // // console.log(dIds);
- // // let userId = user.userId;
- // // console.log(userId);
- // // console.log(dIds.indexOf(',' + userId + ','));
- // // if (dIds.indexOf(',' + userId + ',') >= 0) {
- // // console.log("匹配到订单:" + orderId);
- // // uni.navigateTo({
- // // url: '/pages/order/accept?orderId=' + orderId
- // // })
- // // }
- // // }
-
- // // }
- // // })
- // // ws.subscribe('/topic/order/assign', function(response) {
- // // console.log('收到消息assign:' + response.body);
- // // var json = JSON.parse(response.body);
- // // if (json.type == 'order_assign' && json.sendType == 'all') {
- // // let orderId = json.data,
- // // dIds = json.msg;
- // // let user = that.api.getUser();
- // // if (user) {
- // // console.log(dIds);
- // // let userId = user.userId;
- // // console.log(userId);
- // // if (userId==dIds) {
- // // console.log("匹配到订单:" + orderId);
- // // let voice = uni.createInnerAudioContext()
- // // voice.src = that.api.mp3Url()
- // // // voice.src = 'http://tts.baidu.com/text2audio?lan=zh&ie=UTF-8&spd=5&text=有新订单来了'
- // // voice.play()
- // // voice.onPlay(() => {
- // // console.log('开始播放');
- // // });
- // // voice.onEnded(() => {
- // // console.log('停止播放');
- // // voice.destroy();
- // // });
- // // voice.onError((res) => {
- // // console.log(res.errMsg);
- // // console.log(res.errCode);
- // // });
- // // uni.navigateTo({
- // // url: '/pages/accountInformation/information/information'
- // // })
- // // }
- // // }
-
- // // }
- // // })
- // // }, function(error) {
- // // console.log('连接失败:' + error);
- // // });
- // },
- // fail:function(e){
- // console.log('getDeviceInfo failed: '+JSON.stringify(e));
- // }
- // });
- },
- onShow: function() {
- console.log('App Show')
- },
- onHide: function() {
- console.log('App Hide')
- }
- }
- </script>
- <style lang="scss">
- /*每个页面公共css */
- @import '@/uni_modules/uni-scss/index.scss';
- /* #ifndef APP-NVUE */
- @import '@/static/customicons.css';
- // 设置整个项目的背景色
- page {
- background-color: #f5f5f5;
- }
- /* #endif */
- .example-info {
- font-size: 14px;
- color: #333;
- padding: 10px;
- }
- </style>
|