Commit 2b2f83f2 authored by gengchunlei's avatar gengchunlei

楚雄小程序 隐藏地图

parent ad577f78
......@@ -148,4 +148,27 @@ export function showNav() {
res = true
}
return res
}
\ No newline at end of file
}
// 判断是否是ios
export function isIOSWebKit1() {
const aa = window.navigator.userAgent;
if (!!aa.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) {// ios端
return true;
}
}
// 判断是否安卓
export function isAndroid() {
const aa = window.navigator.userAgent;
if (aa.indexOf('Android') !== -1 || aa.indexOf('Adr') !== -1) {
return true
}
}
// 判断是否在微信中
export function isWeiXin() {
const ua = window.navigator.userAgent.toLowerCase()
return /micromessenger/.test(ua)
}
This diff is collapsed.
<template>
<div>
<van-popup v-model="show" position="right" :style="{ height: '100%',width: '100%' }" >
<video style="display: none" ref="video"></video>
<canvas style="width: 100vw; margin-top: 13vw" id="canvas"></canvas>
<canvas style="display: none" id="2d"></canvas>
</van-popup>
</div>
</template>
<script>
import "@/utils/jsQR.js";
import {jsQR} from "../../utils/jsQR"; // 添加关闭摄像头的函数
export default {
name: 'analyzeQRCode',
props: {
show: {
type: Boolean,
default: false
}
},
data() {
return {
streams: null,
}
},
mounted() {
this.$nextTick(() => {
this.anaQR()
})
},
methods: {
//解析二维码
anaQR() {
// if (this.streams) {
// this.streams.getTracks().forEach((track) => track.stop());
// }
// video.srcObject = null;
var video = document.createElement("video");
var canvasElement = document.getElementById("canvas");
var canvas = canvasElement.getContext("2d");
console.log(navigator.mediaDevices);
// 尝试打开手机上安装后置摄像头
navigator.mediaDevices
.getUserMedia({
video: {facingMode: "environment"},
})
.then(function (stream) {
debugger
this.streams.value = stream;
video.srcObject = stream;
// 阻止IOS视频全屏
video.setAttribute("playsinline", true);
video.play();
requestAnimationFrame(tick);
});
function tick() {
if (video.readyState === video.HAVE_ENOUGH_DATA) {
canvasElement.hidden = false;
canvasElement.height = video.videoHeight;
canvasElement.width = video.videoWidth;
canvas.drawImage(video, 0, 0, canvasElement.width, canvasElement.height);
var imageData = canvas.getImageData(
0,
0,
canvasElement.width,
canvasElement.height
);
// QR码解析
var code = jsQR(
imageData.data, // 图像数据
imageData.width, // 宽度
imageData.height, // 高度
{
inversionAttempts: "dontInvert",
}
);
if (code) {
console.log(code.data);
alert(code.data);
}
}
requestAnimationFrame(tick);
}
}
}
}
</script>
\ No newline at end of file
......@@ -29,6 +29,7 @@
<label>返回首页</label>
</div>
</div>
<!-- <analyze-q-r-code :show="showPop" v-if="showPop"></analyze-q-r-code>-->
</div>
</template>
......@@ -39,14 +40,16 @@
import closeImg from '../assets/img/close.png';
import presonImg from '../assets/img/preson.png';
import sharpImg from '../assets/img/sharp.png';
import {getNetworkInfo, getUserReceiveNum} from '../utils/api';
import {callMobile, getQueryVariable, isIOSWebKit} from "../utils/common";
import {getNetworkInfo} from '../utils/api';
import {callMobile, getQueryVariable} from "../utils/common";
import {Toast} from 'mint-ui';
import {GPS} from "../utils/mapCalculation";
import AnalyzeQRCode from "./component/analyzeQRCode";
export default {
name: "myMap",
inject: ['showNav'],
// components: {AnalyzeQRCode},
inject: ['showNav'],
data() {
return {
recordNum: 0,
......@@ -54,7 +57,8 @@
lngLat: [],
showMap: false,
machines: [],
locationInfo: undefined
locationInfo: undefined,
showPop: false,
}
},
created() {
......@@ -100,6 +104,12 @@
// }
// })
// this.subscanQRCallBack(111)
// if (isWeiXin()){
// this.showPop = true
// } else {
// callMobile("qrcode", {});
// }
},
subscanQRCallBack(val) {
let info = JSON.parse(window.sessionStorage.getItem('mobileTokenIno'))
......
......@@ -17,10 +17,11 @@
<label style="margin-left: 20px;font-size: 15px">类型:{{siteDetail.netTypeName}}</label>
</div>
<div class="ui-flex justify-center center" style="line-height: 29px;margin-top: 5px">
地址:<label @click="clickAddress" class="btns">{{siteDetail.netAddress}}</label>
<div class="cell">
<!-- @click="clickAddress"-->
地址:<label class="btns">{{siteDetail.netAddress}}</label>
<!-- <div class="cell">
<img src="../assets/img/mark.png" style="width: 24px;height: 24px"/>
</div>
</div>-->
</div>
<div class="ui-flex justify-center center" style="margin-top: 5px">
联系电话:<label @click="clickPhone" class="btns">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment