File tree Expand file tree Collapse file tree 3 files changed +32
-12
lines changed
Expand file tree Collapse file tree 3 files changed +32
-12
lines changed Original file line number Diff line number Diff line change 99 <button type =" primary" :disabled =" !isStarted" @click =" stopBeaconDiscovery" >停止搜索附近的iBeacon设备</button >
1010 </view >
1111 </view >
12- <scroll-view class =" uni-scroll_box" scroll-y @touchmove.stop.prevent = " moveHandle " @click.stop = " moveHandle " >
12+ <scroll-view class =" uni-scroll_box" >
1313 <view class =" uni-title" v-if =" isStarted || deviceList.length > 0" >已经发现 {{ deviceList.length }} 台设备:</view >
1414 <view class =" uni-list-box" v-for =" (item, index) in deviceList" :key =" item.uuid" >
1515 <view >
2525 </view >
2626</template >
2727<script >
28- // 必须符合 UUID 格式
29- const DEVICE_UUID = ' A1B85ED2-D76F-4AE4-8F5D-6CCF53E4E228' ;
28+ const DEVICE_UUID_WEICHAT = ' FDA50693-A4E2-4FB1-AFCF-C6EB07647825' ;
3029 export default {
3130 data () {
3231 return {
7372 });
7473 },
7574 onBeaconUpdate () {
76- plus . ibeacon .onBeaconUpdate (res => {
75+ uni .onBeaconUpdate (res => {
7776 if (! this .isPageOpened || ! this .isOpen || ! this .isStarted ) {
7877 return ;
7978 }
80- if (res . code !== 0 ) {
81- console . log (res);
82- return ;
83- }
79+ console . log (res);
80+ // if (res.code !== 0) {
81+ // return;
82+ // }
8483 if (res .beacons && res .beacons .length > 0 ) {
8584 this .getBeacons ();
8685 } else if (! res .connected ) {
8988 });
9089 },
9190 startBeaconDiscovery () {
92- plus . ibeacon .startBeaconDiscovery ({
93- uuids: [] ,
91+ uni .startBeaconDiscovery ({
92+ uuids: this . getUUIDList () ,
9493 success : (res ) => {
9594 this .isStarted = true ;
9695 console .log (res);
125124 }
126125 }
127126 });
127+ },
128+ getUUIDList () {
129+ // #ifdef APP-PLUS
130+ const sysInfo = uni .getSystemInfoSync ();
131+ if (! sysInfo) {
132+ return [];
133+ }
134+ let isIOS = sysInfo .platform ? (sysInfo .platform .toLowerCase () === " ios" ) : false ;
135+ if (isIOS) {
136+ return [DEVICE_UUID_WEICHAT ];
137+ }
138+ return [];
139+ // #endif
140+
141+ // #ifndef APP-PLUS
142+ return [DEVICE_UUID_WEICHAT ];
143+ // #endif
128144 }
129145 },
130146 onUnload () {
Original file line number Diff line number Diff line change 1717 </view >
1818 <!-- #ifdef APP-PLUS || MP-WEIXIN -->
1919 <view class =" uni-title uni-common-mt uni-common-pl" >摄像头位置</view >
20- <view class =" uni-hello-text" >注意:部分 Android 手机下由于系统 ROM 不支持无法生效,打开拍摄界面后可操作切换</view >
20+ <view class =" uni-hello-text camera-tips " >注意:部分 Android 手机下由于系统 ROM 不支持无法生效,打开拍摄界面后可操作切换</view >
2121 <view class =" uni-list" >
2222 <radio-group @change =" radioChange" >
2323 <label class =" uni-list-cell uni-list-cell-pd" v-for =" (item, index) in cameraList" :key =" item.value" >
9494 .video {
9595 width : 100% ;
9696 }
97+
98+ .camera-tips {
99+ padding : 10 upx 30 upx;
100+ }
97101 </style >
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ export default {
103103 name: ' 页面跳转' ,
104104 url: ' navigator'
105105 },
106- // #ifndef MP-ALIPAY || MP- TOUTIAO
106+ // #ifndef MP-TOUTIAO
107107 {
108108 name: ' 设置TabBar' ,
109109 url: ' set-tabbar'
You can’t perform that action at this time.
0 commit comments