tremble 4 سال پیش
والد
کامیت
25db20edc7

+ 1 - 1
macaoApplets/components/audio-play/audio-play.wxml

@@ -1,6 +1,6 @@
 <!--components/audio-play.wxml-->
 <view class="audio">
-  <image class="bg-img" src="{{targetUrl}}{{audio.icon}}"></image>
+  <image class="bg-img" mode="aspectFill" src="{{targetUrl}}{{audio.icon}}"></image>
   <image class="icon-img" bindtap="startMusic" src="{{cdn_url}}/project/pause.png"
     style="display:{{isPlay?'none':'block'}}">
   </image>

+ 23 - 22
macaoApplets/components/audio-play/audio-play.wxss

@@ -3,53 +3,54 @@
   position: relative;
   width:45%;
   display:inline-block;
-  margin:1%;
+  margin: 20rpx 0;
 }
 .audio .bg-img {
-  width:100%;
-  height:15vh;
+  width:220rpx;
+  height:220rpx;
   display:inline-block
 }
 .audio .icon-img {
-  width:5vh;
-  height:5vh;
+  width:80rpx;
+  height:80rpx;
   position:absolute;
   top:50%;
   left:50%;
-  margin-left:-2.5vh;
-  margin-top:-2.5vh;
+  transform: translate(-50%,-50%);
 }
 
 .audio .free-MusicProgress {
   position: absolute;
   width: 100%;
   height: 20%;
-  bottom: 6%;
-  background: #000000;
-  opacity: 0.6;
+  background: rgba(0,0,0,0.6);
+  bottom: 0;
+  left: 0;
 }
+
+
 .audio .free-MusicProgress .before-progress {
-  width:80%;
-  height:2px;
+  width: 50%;
+  height:6rpx;
   position: absolute;
   top: 50%;
-  background: rgba(255,255,255,0.3);
-  margin:0 10%;
+  transform: translateY(-50%);
+  background: rgba(255,255,255,0.8);
+  margin-left: 10%;
+  overflow: hidden;
+  border: none;
 }
 .audio .free-MusicProgress .progress {
-  height: 100%;
   background: #38A2D7;
-  
+  height:6rpx;
 }
 
 
 .audio .free-MusicProgress .durationTime {
   position: absolute;
-  top: 22%;
-  right: 6%;
-  font-size: 10px;
-  font-family: Microsoft YaHei;
-  font-weight: 400;
+  top: 20%;
+  right: 5%;
+  display: inline-block;
+  font-size: 20rpx;
   color: #FFFFFF;
-  opacity: 0.67;
 }

+ 1 - 1
macaoApplets/components/big-pic/big-pic.wxml

@@ -2,7 +2,7 @@
   <view class="column" wx:for='{{audioList}}' wx:key="id">
     <view class="title">
       <text class="txt">{{item.title}}</text>
-      <image class="title-img" src="{{cdn_url}}/project/icon-bottom.png"></image>
+      <image class="jiantou" src="{{cdn_url}}/project/icon-bottom.png"></image>
     </view>
     <view class="con-list">
       <audio-play wx:for='{{item.list}}' wx:key="id" audio="{{item}}"></audio-play>

+ 18 - 28
macaoApplets/components/big-pic/big-pic.wxss

@@ -1,46 +1,36 @@
 .content {
   width: 100%;
-  height: 962rpx;
+  height: 80%;
   background: #FFFFFF;
   box-shadow: 0rpx 6rpx 12rpx rgba(0, 0, 0, 0.65);
-  opacity: 1;
   border-radius: 0 0 10rpx;
-  margin: 0 auto;
-  overflow: scroll;
-}
-
-.content {
-  box-sizing: border-box;
-}
-
-.content .main {
-  box-sizing: border-box;
-  width: 100%;
+  overflow: auto;
 }
 
 .content .column {
-  width: 100%;
+  background: linear-gradient(180deg, #D4D4D4 0%, rgba(212, 212, 212, 0) 40%);
+  width: calc(100% - 40rpx);
+  padding: 0 20rpx;
 }
 
 .content .column .title {
   width: 100%;
-  height: 100%;
-  padding: 30rpx 0;
-  font-size: 13px;
-  font-family: Microsoft YaHei;
-  font-weight: 400;
+  font-size: 24rpx;
   color: #38A2D7;
-  background: linear-gradient(180deg, #D4D4D4 0%, rgba(212, 212, 212, 0) 100%);
-  padding: 5% 4%;
-  box-sizing: border-box;
+  padding: 30rpx 0;
+  display: flex;
+  align-items: center;
 }
-.content .column .title .title-img {
-  width:5%;
-  height:2vh;
-  margin-left:2%;
+
+
+.content .column .title .jiantou {
+  display: inline-block;
+  width: 30rpx;
+  height: 24rpx;
+  margin-left:12rpx;
 }
 
 .content .column .con-list {
-  margin: 0 4%;
-  border-top: 1px solid #707070;
+  padding: 0 4%;
+  border-top: 1rpx solid rgba(112, 112, 112, 0.5);
 }

+ 9 - 18
macaoApplets/components/list-audio/list-audio.wxss

@@ -5,24 +5,19 @@
 }
 
 .list .title {
-  font-size: 12px;
-  font-family: Microsoft YaHei;
-  font-weight: 400;
-  line-height: 16px;
+  font-size: 24rpx;
   color: #2F2414;
   padding-left: 5%;
-  opacity: 1;
 }
 
-
 .audio {
   position: relative;
-  margin: 2% 8%;
+  margin: 4% 6%;
 }
 
 .audio .audio-img {
-  width:9%;
-  height:4vh;
+  width: 40rpx;
+  height: 40rpx;
   display:inline-block;
 }
 
@@ -38,11 +33,10 @@
 
 .audio .free-MusicProgress .before-progress {
   width: 100%;
-  height: 0.4vh;
+  height: 6rpx;
   position: absolute;
   top: 50%;
-  background: #2F2414;
-  opacity: 0.5;
+  background: #707070;
 }
 
 .audio .free-MusicProgress .progress {
@@ -53,11 +47,8 @@
 .list .durationTime {
   position: absolute;
   top: 20%;
-  right: -4%;
-  display: inline;
-  font-size: 10px;
-  font-family: Microsoft YaHei;
-  font-weight: 400;
+  right: -3%;
+  display: inline-block;
+  font-size: 20rpx;
   color: #2F2414;
-  opacity: 0.67;
 }

+ 1 - 1
macaoApplets/components/list/list.wxml

@@ -3,7 +3,7 @@
   <view class="column" wx:for='{{audioList}}' wx:key="id">
     <view class="title">
       <text class="txt">{{item.title}}</text>
-      <image class="title-img" src="{{cdn_url}}/project/icon-bottom.png"></image>
+      <image class="jiantou" src="{{cdn_url}}/project/icon-bottom.png"></image>
     </view>
     <view class="con-list">
       <list-audio wx:for='{{item.list}}' wx:key="id" audio="{{item}}"></list-audio>

+ 17 - 27
macaoApplets/components/list/list.wxss

@@ -1,47 +1,37 @@
 /* components/list/list.wxss */
 .content {
   width: 100%;
-  height: 962rpx;
+  height: 80%;
   background: #FFFFFF;
   box-shadow: 0rpx 6rpx 12rpx rgba(0, 0, 0, 0.65);
-  opacity: 1;
   border-radius: 0 0 10rpx;
-  margin: 0 auto;
-  overflow: scroll;
+  overflow: auto;
 }
 
-.content {
-  box-sizing: border-box;
-}
-
-.content .main {
-  box-sizing: border-box;
-  width: 100%;
-}
 
 .content .column {
-  width: 100%;
+  background: linear-gradient(180deg, #D4D4D4 0%, rgba(212, 212, 212, 0) 40%);
+  width: calc(100% - 40rpx);
+  padding: 0 20rpx;
 }
 
 .content .column .title {
   width: 100%;
-  height: 100%;
-  padding: 30rpx 0;
-  font-size: 13px;
-  font-family: Microsoft YaHei;
-  font-weight: 400;
+  font-size: 24rpx;
   color: #38A2D7;
-  background: linear-gradient(180deg, #D4D4D4 0%, rgba(212, 212, 212, 0) 100%);
-  padding: 5% 4%;
-  box-sizing: border-box;
+  padding: 30rpx 0;
+  display: flex;
+  align-items: center;
 }
-.content .column .title .title-img {
-  width:5%;
-  height:2vh;
-  margin-left:2%;
+
+
+.content .column .title .jiantou {
+  display: inline-block;
+  width: 30rpx;
+  height: 24rpx;
+  margin-left:12rpx;
 }
 
 .content .column .con-list {
-  margin: 0 4%;
-  border-top: 1px solid #707070;
+  border-top: 1rpx solid rgba(112, 112, 112, 0.5);
 }

+ 164 - 179
macaoApplets/components/map-sense/map-sense.js

@@ -1,27 +1,34 @@
 // components/map-sense.js
 
-const innerAudioContext = wx.createInnerAudioContext();
-import http from '../../utils/http';
-import {promisify,BeaconUtils} from '../../utils/util';
-let openBluetoothAdapter = promisify(wx.openBluetoothAdapter)
-let startBeaconDiscovery = promisify(wx.startBeaconDiscovery)
+let innerAudioContext = wx.createInnerAudioContext();
+innerAudioContext.autoplay = true;
+innerAudioContext.loop = true;
 
-import { CDN_URL, CONNECT_STATUS, STATUS_TEXT, API_BASE_URL } from '../../config/index';
+import http from "../../utils/http";
+import { promisify, BeaconUtils } from "../../utils/util";
+let openBluetoothAdapter = promisify(wx.openBluetoothAdapter);
+let startBeaconDiscovery = promisify(wx.startBeaconDiscovery);
+
+import {
+  CDN_URL,
+  CONNECT_STATUS,
+  STATUS_TEXT,
+  API_BASE_URL,
+} from "../../config/index";
 const STATUS_PIC = {
-  '0': 'default',
-  '1': 'loading',
-  '2': 'success',
-  '3': 'fail'
+  0: "default",
+  1: "loading",
+  2: "success",
+  3: "fail",
 };
 
-let AveLength = 4
+let AveLength = 4;
 
 Component({
   /**
    * 组件的属性列表
    */
-  properties: {
-  },
+  properties: {},
 
   /**
    * 组件的初始数据
@@ -37,7 +44,7 @@ Component({
     api_base_url: API_BASE_URL,
     // 是否是扫码播放
     isScanPlay: false,
-    cdn_url:CDN_URL
+    cdn_url: CDN_URL,
   },
 
   /**
@@ -45,218 +52,196 @@ Component({
    */
   methods: {
     openBluetooth(cb) {
-      openBluetoothAdapter().then(res=>{
-        cb(res)
-      },()=>{
-        wx.showToast({
-          title: '请打开蓝牙',
-          icon: 'error',
-          duration: 2000
-        })
-      })
+      openBluetoothAdapter().then(
+        (res) => {
+          cb(res);
+        },
+        () => {
+          wx.showToast({
+            title: "请打开蓝牙",
+            icon: "error",
+            duration: 2000,
+          });
+        }
+      );
     },
     toHandle() {
       switch (this.data.status) {
-        case '0':
+        case "0":
           this.openLink();
           break;
-        case '1':
+        case "1":
           this.stopBeaconDiscovery();
           break;
-        case '2':
+        case "2":
           this.stopBeaconDiscovery();
           break;
-        case '3':
+        case "3":
           this.startBeaconDiscovery();
           break;
         default:
-          break
+          break;
       }
-      
     },
 
-    openLink(){
-      let aveArr = []
+    playMusic(url) {
+      innerAudioContext.src =encodeURI(url);
+      innerAudioContext.play();
+    },
+
+    openLink() {
+      let aveArr = [];
       wx.showLoading({
-        mask:true,
-        title: '正在连接,请稍等',
-      })
-      this.openBluetooth(()=>{
-        startBeaconDiscovery({uuids: ['FDA50693-A4E2-4FB1-AFCF-C6EB07647825']}).then(()=>{
-          wx.hideLoading()
-          wx.showToast({
-            title: '连接成功',
-            icon: 'success'
-          })
-          this.setData({
-            status:'2'
-          })
-          wx.onBeaconUpdate(data=>{
-            if (aveArr.length == AveLength) {
-              aveArr[0] = data.beacons
-            }
-            else{
-              aveArr.push(data.beacons)
-            }
-            let all = []
-            aveArr.forEach(item => {
-              all = all.concat(item)
+        mask: true,
+        title: "正在连接,请稍等",
+      });
+      this.openBluetooth(() => {
+        startBeaconDiscovery({
+          uuids: ["FDA50693-A4E2-4FB1-AFCF-C6EB07647825"],
+        })
+          .then(() => {
+            wx.hideLoading();
+            wx.showToast({
+              title: "连接成功",
+              icon: "success",
+            });
+            this.setData({
+              status: "2",
             });
+            wx.onBeaconUpdate((data) => {
+              if (aveArr.length == AveLength) {
+                aveArr[0] = data.beacons;
+              } else {
+                aveArr.push(data.beacons);
+              }
+              let all = [];
+              aveArr.forEach((item) => {
+                all = all.concat(item);
+              });
 
-            let classfiy = BeaconUtils.classification(all,'major')
-            let aveAccuracy = {}
+              let classfiy = BeaconUtils.classification(all, "major");
+              let aveAccuracy = {};
 
-            let min = {
-              id: '10001',
-              val: 10000000
-            } //取最小值
-            Object.keys(classfiy).forEach(key=>{
-              //每个major的AveLength个元素数组
-              let arr = classfiy[key].filter(item=>{
-                return item.accuracy > 0
-              })
-              if (arr.length<=0) {
-                return
-              }
+              let min = {
+                id: "10001",
+                val: 10000000,
+              }; //取最小值
+              Object.keys(classfiy).forEach((key) => {
+                //每个major的AveLength个元素数组
+                let arr = classfiy[key].filter((item) => {
+                  return item.accuracy > 0;
+                });
+                if (arr.length <= 0) {
+                  return;
+                }
 
-              //每个major的平均值
-              let ave = BeaconUtils.arrayAverage(arr.map(sub=>sub.accuracy))
-              classfiy[key].forEach(item=>{
-                 item.accuracy = ave
-              })
-              aveAccuracy[key] = ave
-              min = ave < min.val ? {id:key,val:ave} : min;
-            })
+                //每个major的平均值
+                let ave = BeaconUtils.arrayAverage(
+                  arr.map((sub) => sub.accuracy)
+                );
+                classfiy[key].forEach((item) => {
+                  item.accuracy = ave;
+                });
+                aveAccuracy[key] = ave;
+                min = ave < min.val ? { id: key, val: ave } : min;
+              });
 
-            console.log(min);
+              this.setData({
+                classfiy,
+                targetObj: {
+                  major: min.id,
+                },
+              });
 
-            this.setData({
-              classfiy,
-              targetObj: {
-                major:min.id
-              }
-            })
-          })
-        }).catch(()=>{
-          wx.hideLoading()
-          wx.showToast({
-            title: '连接失败',
-            icon: 'error'
+              this.data.audio_address[min.id] &&
+                this.playMusic(this.data.audio_address[min.id]);
+            });
           })
-        })
-      })
+          .catch(() => {
+            wx.hideLoading();
+            wx.showToast({
+              title: "连接失败",
+              icon: "error",
+            });
+          });
+      });
     },
-    
+
     stopBeaconDiscovery() {
       wx.showLoading({
-        mask:true,
-        title: '正在取消连接,请稍等',
-      })
+        mask: true,
+        title: "正在取消连接,请稍等",
+      });
       wx.stopBeaconDiscovery({
-        success:()=>{
-          wx.hideLoading()
+        success: () => {
+          wx.hideLoading();
           wx.showToast({
-            title: '取消连接成功',
-            icon: 'success'
-          })
+            title: "取消连接成功",
+            icon: "success",
+          });
           innerAudioContext.stop();
           this.setData({
-            status: '0',
-            targetObj: {}
-          })
-        },
-        fail:()=>{
-          
+            status: "0",
+            targetObj: {},
+          });
         },
-        complete:()=>{
-          
-        }
-      })
+        fail: () => {},
+        complete: () => {},
+      });
     },
     // 扫一扫
     toScanCode() {
-      var that = this;
-      that.setData({
-        isScanPlay: true
-      })
+      this.setData({
+        isScanPlay: true,
+      });
       wx.scanCode({
-        success(res) {
-          console.log('success', res)
-          console.log('result', res['result'])
-          console.log('innerAudioContext', innerAudioContext)
-          that.setData({ targetObj: {} })
-          innerAudioContext.autoplay = true;
-          innerAudioContext.src = res['result']
-          innerAudioContext.loop = true;
-          innerAudioContext.play();
+        onlyFromCamera: true,
+        success: (res) => {
+          this.setData({ targetObj: {} });
+          setTimeout(() => {
+            this.playMusic(res["result"])
+          }, 800);
         },
-        fail: function (res) {
-          console.log('fail innerAudioContext', innerAudioContext)
-          that.setData({
-            isScanPlay: false
-          })
-          innerAudioContext.play();
-          return;
+        fail: () => {
+          wx.showToast({
+            title: "二维码识别失败",
+            icon: "error",
+          });
         },
-        complete(){
-          // console.log()
-          that.setData({
-            isScanPlay: false
-          })
-        }
-      })
+        complete: () => {
+          this.setData({
+            isScanPlay: false,
+          });
+        },
+      });
     },
 
     getAudios() {
-      http.get('/api/web/getAudioIndex')
-      .then(res => {
-        let { data } = res,target = {};
-        data.forEach(item => {
-          target['1000'+item.type] = `${this.data.api_base_url}/data/${item.audio}`
-        })
+      http.get("/api/web/getAudioIndex").then((res) => {
+        let { data } = res,
+          target = {};
+        data.forEach((item) => {
+          target[
+            "1000" + item.type
+          ] = `${this.data.api_base_url}/data/${item.audio}`;
+        });
         this.setData({
-          audio_address: target
-        })
-      })
-    }
+          audio_address: target,
+        });
+      });
+    },
   },
-  lifetimes:{
+  lifetimes: {
     attached: function () {
       innerAudioContext.stop();
       //获取语音
       this.getAudios();
-
-      var that = this;
-      // wx.onAccelerometerChange(function (e) {
-      //   console.log('手机咚咚咚给')
-      //   if (Math.abs(e.x) > 1.1 && Math.abs(e.y) > 1.1) {
-      //     //         wx.showToast({ title: "摇一摇" })
-      //   } else if (Math.abs(e.x) > 0.07 && Math.abs(e.y) > 0.02 && that.data.status === '2') {
-      //     // 扫一扫播放的话 移动无效
-      //     if (that.data.isScanPlay) return;
-          
-      //     that.startBeaconDiscovery()
-      //   } else {
-      //     //         wx.showToast({ title: "静止" })
-      //   }
-      // }),
-      innerAudioContext.onEnded(() => {
-        console.log('播放结束了')
-        if (this.data.isScanPlay) {
-          innerAudioContext.stop()
-          this.setData({ isScanPlay: false,targetObj: {}})
-          console.log('innerAudioContext', innerAudioContext)
-          if (this.data.status == 2) {
-            this.startBeaconDiscovery()
-          }
-        }
-      })
     },
     detached: function () {
       innerAudioContext.stop();
       innerAudioContext.destroy();
-      wx.stopBeaconDiscovery({})
-      this.setData({status:"0"})
-    }
-  }
-})
+      wx.stopBeaconDiscovery({});
+      this.setData({ status: "0" });
+    },
+  },
+});

+ 7 - 14
macaoApplets/components/map-sense/map-sense.wxss

@@ -1,20 +1,17 @@
 /* components/map-sense.wxss */
 .content {
   width: 100%;
-  height: 962rpx;
+  height: 80%;
   background: #FFFFFF;
   box-shadow: 0rpx 6rpx 12rpx rgba(0, 0, 0, 0.65);
-  opacity: 1;
-  border-radius: 0 0 10rpx 10rpx;
-  margin: 0 auto;
-  overflow: scroll;
-}
-
-.content {
+  border-radius: 0 0 10rpx;
+  overflow: auto;
+  position: relative;
   box-sizing: border-box;
   padding: 24rpx 22rpx;
 }
 
+
 .content .top {
   width: 100%;
   height: 342rpx;
@@ -133,9 +130,8 @@
 
 .content .center .promptText {
   text-align: center;
-  font-size: 19px;
+  font-size: 36rpx;
   font-weight: 300;
-  line-height: 25px;
   color: rgba(47, 36, 20, 0.8);
 }
 
@@ -156,8 +152,7 @@
   height: 76rpx;
   background: #FFFFFF;
   border: 2rpx solid #38A2D7;
-  opacity: 1;
-  border-radius: 19px;
+  border-radius: 36rpx;
   text-align: center;
   display: inline;
   padding: 2% 10%;
@@ -172,8 +167,6 @@
   font-weight: 300;
   line-height: 76rpx;
   color: #38A2D7;
-  opacity: 1;
-
 }
 
 .content .top .small-sound {

+ 3 - 4
macaoApplets/pages/index/index.wxss

@@ -7,7 +7,7 @@
 
 .con{
   width: 80%;
-  height: 100%;
+  height: 98%;
   position: absolute;
   top: 50%;
   left: 50%;
@@ -27,13 +27,12 @@
 }
 
 .line{
-  width: 1rpx;
+  width: 2rpx;
   height: 100%;
   background: #1C2E4C;
+  opacity: 0.5;
 }
 
-
-
 .list,
 .bigPic,
 .mail {