123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- <template>
- <view class="content">
- <view class="content_top">
- <view class="icon_box" style="" v-for="(item,index) in images" :key="index">
- <view class="icon" style="" @click='urinometer_click(index)'>
- <img class="image" style="" :src="item.url" alt="" />
- <view class="">领透智能尿检仪</view>
- </view>
- </view>
- </view>
- <view class="content_bottom" style="">
- <view class="button_box" style="">
- <view class="button border" style="" @click='scanCode_click'>扫码添加</view>
- <view class="button" style="flex: 1;">手动添加</view>
- </view>
- </view>
- </view>
- </template>
-
- <script>
- export default{
- data(){
- return{
- images:[{id:1,url:'../../static/urine/4.png'},{id:2,url:'../../static/urine/4.png'},
- {id:3,url:'../../static/urine/4.png'},{id:4,url:'../../static/urine/4.png'}],
- }
- },
- onLoad(){
- const _that = this
- // wx.startWifi({
- // success(res) {
- // console.log('success',res);
- // // _this.getWifiInfo();
- // // _that.getWifilist()
- // _that.authorize()
- // },
- // fail: function (res) {
- // // _that.authorize()
- // console.log('请连接路由器',res);
- // // _this.showPopIs5G();
- // // uni.showToast({
- // // title: "请连接路由器",
- // // duration: 2000,
- // // });
- // },
- // });
- },
- methods:{
- urinometer_click(index){
- console.log('index',index);
- // uni.openBluetoothAdapter({
- // success(res) {
- // console.log('success',res)
- // uni.startBluetoothDevicesDiscovery({
- // success: function(res) {
- // console.log('搜索蓝牙设备success',res)
- // uni.getBluetoothDevices({
- // success: function(res) {
- // // if()
- // console.log('获取蓝牙列表success',res)
- // uni.createBLEConnection({
- // // deviceId: this.deviceId, // 在第 3 步可以拿到蓝牙的 deviceId 的值
- // success: (res) => {
- // console.log("连接成功", res)
- // uni.stopBluetoothDevicesDiscovery({
- // success(res) {
- // console.log('停止搜索蓝牙',res)
- // }
- // })
- // },
- // fail: (error) => {
- // console.log("连接失败", error)
- // }
- // })
- // },
- // fail: function() {
- // console.log("获取蓝牙设备列表失败")
- // }
- // })
- // },
-
- // fail: function() {
- // console.log("获取蓝牙设备列表失败")
- // }
- // })
-
- // },
-
- // })
- wx.navigateTo({
- url:'/pages/Health_monitor/urinometer'
- })
-
- },
- getWifilist(){
- wx.getWifiList({
- success(res) {
- console.log('获取wifi列表',res);
- wx.onGetWifiList({
- success(res){
- console.log('监听wifi列表',res);
- }
- })
- },
- fail(res){
- console.log('获取wifi列表失败',res);
- }
- })
- },
- // 获取用户授权设置
- authorize() {
- let that = this
- wx.getSetting({
- success(res) {
- console.log('setting', res)
- console.log('dingwei',res.authSetting['scope.userLocation'] === undefined);
- if (res.authSetting['scope.userLocation'] === undefined) {
- uni.showModal({
- title: '是否授权当前位置',
- content: '需要获取您的地理位置,请确认授权,否则无法相关功能!',
- success(res){
- if(res.confirm){
- wx.openSetting({
- success: (add => {
- if (dataAu.authSetting['scope.userLocation'] === true){
- wx.getLocation({
- success(res){
- console.log('获取位置',res);
- that.getWifilist()
- }
- })
- }
-
- })
- })
- }
- }
- })
-
- // 申请获取地理位置权限
- // wx.authorize({
- // scope: 'scope.userLocation',
- // success: (res) => {
- // console.log('authorize succ', res)
-
- // },
- // fail: (e) => {
- // console.log('authorize fail', e)
- // }
- // })
- }else{
- // 开始wifi模块使用
- that.getWifilist()
- }
- }
- })
- },
- // 提示用户打开设置页,打开
- openSetting() {
- wx.openSetting({
- success: (res => {
- // res也会返回用户设置的权限,可以把权限判断部分的代码单独抽出来
- this.authorize() // 获取用户授权设置
- })
- })
- },
- scanCode_click(){
- uni.scanCode({
- success: function (res) {
- console.log('条码类型:' + res.scanType);
- console.log('条码内容:' + res.result);
- }
- })
- }
-
- }
- }
- </script>
-
- <style lang="scss" scoped>
- .content{
- .content_top{
- height: 80%;
- .icon_box{
- width: 49%;
- display: inline-block;
- flex-wrap: wrap;
- background: white;
- box-sizing: border-box;
- border: 1px solid #dcdcdc4d;
- .icon{
- width: 100%;
- text-align: center;
- padding: 10px;
- display: inline-block;
- // box-sizing: border-box;
- .image{
- height: 100rpx;
- width: 100rpx;
- }
- }
-
- }
- }
- .content_bottom{
- width: 100%;
- position: fixed;
- bottom: 30rpx;
- .button_box{
- margin: 0 auto;
- width: 80%;
- background:linear-gradient(#4dc691,#66cfa1,#7ad7ae);
- border-radius: 100rpx;
- display: flex;
- .button{
- flex: 1;
- line-height:90rpx;
- color: white;
- text-align: center;
- }
- .border{
- border-right:1px solid white;
- }
- }
- }
- }
- </style>
|