This commit is contained in:
2024-10-18 14:27:10 +08:00
parent 21b737052b
commit dac8a28465
450 changed files with 40702 additions and 1546 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,620 @@
<template>
<!--音频组件-->
<view
class="boxShadow"
style="
width: 100%;
border-radius: 40rpx;
height: 100%;
padding: 40rpx 0;
box-sizing: border-box;
background-image: linear-gradient(80deg, #959698 0%, #808183 100%);
"
>
<view class="bgfff">
<view>
<slot name="title"></slot>
<view class="audo-video">
<view class="slider-box">
<text class="mm">{{ timer }}</text>
<slider
style="width: 440rpx"
@change="sliderChange"
@changing="sliderChanging"
class="audio-slider"
block-size="16"
:min="0"
:max="duration"
:value="currentTime"
activeColor="#FF8849"
@touchstart="lock = true"
@touchend="lock = false"
/>
<text class="ss" v-if="overTimer != 'NaN:NaN'">{{
overTimer
}}</text>
<text class="ss" v-else>00.00</text>
</view>
<!--音频播放按钮处-->
<view class="audo-top">
<!--上一首-->
<!-- <image
src="./icon/xys.png"
style="width: 40rpx; height: 40rpx; transform: rotate(180deg)"
mode="aspectFill"
@click="upper(1)"
></image> -->
<!--上一首-->
<!--快退-->
<image
src="./icon/kt.png"
style="width: 40rpx; height: 40rpx"
mode="widthFix"
@click="jump('kt')"
></image>
<!--快退-->
<!--播放-->
<image
src="./icon/kt.png"
style="width: 100rpx; height: 100rpx"
mode="widthFix"
@click="plays()"
></image>
<!--播放-->
<!--快进-->
<image
src="./icon/kj.png"
style="width: 40rpx; height: 40rpx"
mode="widthFix"
@click="jump('kj')"
></image>
<!--快进-->
<!--下一首-->
<!-- <image
src="./icon/xys.png"
style="width: 40rpx; height: 40rpx"
mode="aspectFill"
@click="upper(2)"
></image> -->
<!--下一首-->
<view class="audo-a" style="">
<!--进度条-->
<!--进度条-->
<!--倍数-->
<view
class="beishu"
style="border: 1rpx solid #e1dbf2"
@click="beishu"
>{{ BsNav[bsindex].bs }} X
</view>
<view class="absolute" style="right: 0; top: 80rpx" v-if="shows">
<!-- <u-transition :show="show" mode="slide-right" duration="300"> -->
<view
class="beishu-a"
style="border: 1rpx solid #fff"
v-if="show"
>
<view
v-for="(item, index) in BsNav"
:key="index"
@click="setRate(index, item)"
class="title beishuItem"
:style="{ color: bsid == item.id ? '#9461EB' : '' }"
>
{{ item.bs }} X
</view>
</view>
<!-- </u-transition> -->
</view>
<!--倍数-->
</view>
</view>
<!--音频播放按钮处-->
<!--音频api处[视频代替音频-实现倍数功能]-->
<video
id="myVideo"
ref="myVideo"
:src="recorPath"
preload="metadata"
@timeupdate="timeupdate"
:autoplay="autoplays"
@loadedmetadata="loadedmetadata"
@ended="next"
controls
style="width: 400rpx; height: 80rpx"
></video>
<!--音频api处[视频代替音频-实现倍数功能]-->
</view>
</view>
</view>
<!--占位-->
</view>
<!--音频组件 wx:cxalq8-24 Author:chenxin-->
</template>
<script>
/*
list -- 音频数据: 数组格式/不传无法播放
Seconds -- 快进快退秒数: 默认15秒
autoNext -- 是否自动播放下一首
autoplays -- 进入页面是否自动播放 - 默认false
slideYes -- 滑动进度条时是否开启播放 - 默认false
switAud -- 切换上下音频是否开启播放 - 默认true
BsNav -- 倍数数据传入/数组形式
图片功能样式,如想改动请在组件内部修改,页面中已注释 -- 逻辑根据自己需求改
目前只测试 微信小程序和H5和APP -- 其他平台未知
[Author:chenxin 交流vx:cxalq8-24]
*/
export default {
name: "cx-audio-play",
props: {
list: {
//音频数据
Type: Array,
default: () => [],
},
Seconds: {
//快进快退 - 秒数
Type: Number,
default: 15,
},
firstTime: {
//快进快退 - 秒数
Type: Number,
default: 0,
},
autoNext: {
//是否自动播放下一首
Type: Boolean,
default: false,
},
autoplays: {
//是否开启自动播放
Type: Boolean,
default: false,
},
slideYes: {
//滑动进度条 - 是否开启播放
Type: Boolean,
default: false,
},
switAud: {
Type: Boolean, //切换上下音频 - 是否开启播放
default: true,
},
BsNav: {
//倍数-传入
Type: Array,
default: () => [
{
id: 1.0,
bs: "1.0",
},
{
id: 1.5,
bs: "1.5",
},
{
id: 2.0,
bs: "2.0",
},
],
},
},
data() {
return {
shows: false, //倍数弹框
show: true, //倍数弹框动画默认开启
succes: false, //播放按钮
bsid: "", //倍数默认显示第一个
bsindex: 0, //倍数默认显示第一个
num: 0,
current: 0, //当前选中的索引
recorPath: "", //音频播放地址
lock: false, // 锁
currentTime: 0, //当前进度
duration: 0, // 总进度
videoContext: null,
loading: true, //锁 加载
curTime: null, //锁 加载
};
},
onReady() {},
onShow() {},
mounted() {
//初始化音频api
},
updated() {},
onLoad() {},
onHide() {
//监听页面离开 - 销毁音频
this.stop_();
this.$emit("curTime", this.curTime);
},
onUnload() {
//监听页面卸载 - 销毁音频
this.stop_();
this.$emit("curTime", this.curTime);
},
destroyed() {
// this.innerAudioContext.stop();
},
computed: {
timer() {
this.curTime = this.currentTime.toFixed(0);
return calcTimer(this.currentTime);
},
overTimer() {
return calcTimer(this.duration);
},
},
methods: {
init() {
this.currentTime = this.firstTime;
this.videoContext = uni.createVideoContext("myVideo", this);
//默认播放第一个
if (this.list.length != 0) {
this.recorPath = this.list[0];
if (this.autoplays) {
this.succes = true;
}
} else {
this.duration = 0;
}
//倍数默认选择第一个
if (this.BsNav.length != 0) {
this.bsid = this.BsNav[0].id;
this.playbackRate(); //倍数
}
},
//没有音频数据
noUrl() {
if (this.list.length == 0) {
uni.showToast({
title: "请先传入音频数据哦~",
icon: "none",
});
return false;
}
return true;
},
//播放暂停
plays() {
if (!this.noUrl()) {
return;
}
this.playLoading();
this.succes = !this.succes;
this.succes ? this.play_() : this.pause_();
},
//上下首切换
upper(num) {
if (!this.noUrl()) {
return;
}
let that = this;
if (num == 1) {
//上一首
if (this.num == 0) {
this.upperToast(num); //提示
return;
}
this.num -= 1;
} else {
//下一首
if (this.num + 1 == this.list.length) {
this.upperToast(num); //提示
return;
}
this.num += 1;
}
this.recorPath = this.list[this.num];
if (this.switAud) {
// 切换时是否开启播放
this.succes = true;
this.play_();
} else {
this.succes = false;
}
this.playbackRate(); //倍数
console.log("当前音频:", this.recorPath);
},
//快进快退
jump(e) {
if (!this.noUrl()) {
return;
}
var num;
if (e == "kt") {
num = (this.currentTime - Math.floor(this.Seconds % 60)).toFixed(0); //当前时间-15秒
} else {
num = (this.currentTime + Math.floor(this.Seconds % 60)).toFixed(0); //当前时间+15秒
}
this.seek(num);
},
seek(num) {
this.$nextTick(() => {
//#ifdef H5
this.$refs.myVideo.seek(num);
//#endif
//#ifndef H5
this.videoContext.seek(num);
//#endif
});
},
//倍速弹框
beishu() {
this.shows = !this.shows;
},
// 倍速
setRate(index, item) {
this.bsid = item.id;
this.bsindex = index;
this.shows = false;
this.playbackRate();
},
// 更新进度条
timeupdate(event) {
if (this.lock) return; // 锁
var currentTime, duration;
if (event.detail.detail) {
currentTime = event.detail.detail.currentTime;
duration = event.detail.detail.duration;
} else {
currentTime = event.detail.currentTime;
duration = event.detail.duration;
}
this.currentTime = currentTime;
console.log("this.currentTime at line 當前386:", this.currentTime);
this.duration = duration;
console.log("this.duration at line 總時長388:", this.duration);
},
// 拖动进度条
sliderChange(data) {
if (!this.noUrl()) {
return;
}
//此处滑动进度条--开始播放
if (this.slideYes && !this.succes) {
this.play_();
this.succes = true;
}
//#ifdef H5
this.$refs.myVideo.seek(data.detail.value); //获取秒数
//#endif
//#ifndef H5
this.videoContext.seek(data.detail.value); //获取秒数
//#endif
},
//拖动中
sliderChanging(data) {
if (data.detail.value == 0) {
this.succes = false;
this.pause_();
}
this.currentTime = data.detail.value;
},
// 视频加载完成
loadedmetadata(data) {
console.log("data at line zh:", data);
this.duration = data.detail.duration;
// this.seek(this.firstTime);
// this.curTime = this.currentTime
},
//音频结束触发
next(data) {
this.succes = false;
if (this.autoNext) {
//自动播放下一首
this.upper(2);
}
},
// 各平台播放_暂停
play_() {
this.$nextTick(() => {
//#ifdef H5
this.$refs.myVideo.play();
//#endif
//#ifndef H5
this.videoContext.play();
//#endif
});
},
pause_() {
this.$nextTick(() => {
//#ifdef H5
this.$refs.myVideo.pause();
//#endif
//#ifndef H5
this.videoContext.pause();
//#endif
});
},
//离开页面暂停播放
stop_() {
this.$nextTick(() => {
//#ifdef H5
this.$refs.myVideo.stop();
//#endif
//#ifndef H5
this.videoContext.stop();
//#endif
});
},
//提示
upperToast(num) {
num == 1
? uni.showToast({
title: "到头了~",
icon: "none",
})
: uni.showToast({
title: "没有更多了~",
icon: "none",
});
},
//音频倍数
playbackRate() {
this.$nextTick(() => {
//#ifdef H5
this.$refs.myVideo.playbackRate(this.bsid);
//#endif
//#ifndef H5
this.videoContext.playbackRate(this.bsid);
//#endif
});
},
//加载框--封
playLoading() {
if (this.loading && !this.succes) {
uni.showLoading({
title: "音频加载中...",
});
this.loading = false;
}
setTimeout(() => {
uni.hideLoading();
}, 1500);
},
},
watch: {
//播放器当前播放进度
curTime(val) {
if (this.curTime !== null) {
console.log("timer at line 495:", this.curTime);
this.$emit("curTime", this.curTime);
}
},
},
};
//时间换算
function calcTimer(timer) {
if (timer === 0 || typeof timer !== "number") {
return "00:00";
}
let mm = Math.floor(timer / 60);
let ss = Math.floor(timer % 60);
if (mm < 10) {
mm = "0" + mm;
}
if (ss < 10) {
ss = "0" + ss;
}
return mm + ":" + ss;
}
</script>
<style lang="scss" scoped>
page {
background-color: #f8f8f8;
}
/* #video {
width: 100%;
} */
.audo-video {
margin-top: 0rpx;
color: #fff;
.beishuItem {
color: #999;
}
}
.slider-box {
display: flex;
align-items: center;
justify-content: center;
font-size: 27rpx;
// color: #fff;
}
button {
display: inline-block;
width: 100rpx;
background-color: #fff;
font-size: 24rpx;
color: #000;
padding: 0;
}
.hidden {
position: fixed;
top: 0;
left: -10rpx;
z-index: -1;
width: 1rpx;
height: 1rpx;
}
.audo-top {
padding: 20rpx 0;
display: flex;
justify-content: space-around;
align-items: center;
image {
width: 45rpx;
height: 45rpx;
}
}
.audo-a {
display: flex;
justify-content: space-between;
align-items: center;
width: auto;
position: relative;
z-index: 9;
margin-right: -20rpx;
}
.beishu {
position: relative;
width: 100rpx;
padding-top: 5rpx;
padding-bottom: 5rpx;
text-align: center;
border-radius: 25rpx;
font-size: 28rpx;
}
.absolute {
position: absolute;
.beishu-a {
width: 200rpx;
border-radius: 20rpx;
text-align: center;
line-height: 90rpx;
background: #fff;
.title {
pdding-left: 30rpx;
}
}
}
</style>

View File

@@ -17,8 +17,9 @@
<view class="audo-video">
<view class="slider-box">
<text class="mm">{{ timer }}</text>
<slider
style="width: calc(100% - 280rpx)"
style="width: 440rpx"
@change="sliderChange"
@changing="sliderChanging"
class="audio-slider"
@@ -222,7 +223,7 @@ export default {
recorPath: "", //音频播放地址
lock: false, // 锁
currentTime: 0, //当前进度
duration: 100, // 总进度
duration: 0, // 总进度
videoContext: null,
loading: true, //锁 加载
curTime: null, //锁 加载
@@ -238,30 +239,29 @@ export default {
onHide() {
//监听页面离开 - 销毁音频
this.stop_();
this.$emit("curTime", this.curTime);
this.$emit("curTime", this.curTime);
},
onUnload() {
//监听页面卸载 - 销毁音频
this.stop_();this.$emit("curTime", this.curTime);
this.stop_();
this.$emit("curTime", this.curTime);
},
destroyed() {
// this.innerAudioContext.stop();
},
computed: {
timer() {
this.curTime = this.currentTime;
this.curTime = this.currentTime;
return calcTimer(this.currentTime);
},
overTimer() {
this.curTime = this.duration;
return calcTimer(this.duration);
},
},
methods: {
init() {
this.currentTime=this.firstTime;
this.currentTime = this.firstTime;
this.videoContext = uni.createVideoContext("myVideo", this);
//默认播放第一个
if (this.list.length != 0) {
@@ -277,9 +277,6 @@ export default {
this.bsid = this.BsNav[0].id;
this.playbackRate(); //倍数
}
this.seek(this.firstTime);
this.curTime = this.currentTime
},
//没有音频数据
noUrl() {
@@ -384,7 +381,9 @@ export default {
duration = event.detail.duration;
}
this.currentTime = currentTime;
console.log("this.currentTime at line 當前386:", this.currentTime);
this.duration = duration;
console.log("this.duration at line 總時長388:", this.duration);
},
// 拖动进度条
@@ -416,7 +415,11 @@ export default {
// 视频加载完成
loadedmetadata(data) {
console.log("data at line zh:", data);
this.duration = data.detail.duration;
// this.seek(this.firstTime);
// this.curTime = this.currentTime
},
//音频结束触发
@@ -512,8 +515,7 @@ export default {
};
//时间换算
function calcTimer(timer) {
console.log('timer at line 514:', timer)
console.log("timer at line 514:", timer);
if (timer === 0 || typeof timer !== "number") {
return "00:00";

Binary file not shown.

After

Width:  |  Height:  |  Size: 816 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 B

View File

@@ -2,7 +2,7 @@
<view
class="container"
id="Aliyun"
style="background-color: #000; position: relative; padding: 0"
:style="`background-color:# 000; position: relative; padding: 0`"
>
<div
:videoData="videoData"

View File

@@ -25,7 +25,7 @@
ref="commonVideo"
:currentVideoId="currentVideoId"
:currentVideoIndex="currentVideoIndex"
:curriculumData="curriculumData"
:curriculumData="{...curriculumData,curriculumImgUrl:options.curriculumImgUrl}"
>
</common-video>
<view style="color: #fff"></view>

View File

@@ -662,6 +662,7 @@
},
//课程详情
async gotoDetail(v, index) {
console.log('v at line 664:', v)
console.log(
this.cateList[this.currentCateIndex],
8888888888888888888888888
@@ -685,7 +686,7 @@
) {
uni.navigateTo({
// url: '../bookShop/commodityDetail?id=' + item.id
url: `/pages/curriculum/order/curriculum/detail?navTitle=${this.options.navTitle}&title=${v.title}&id=${v.id}&conditions=${v.conditions}&detailOid=${v.detailOid}`,
url: `/pages/curriculum/order/curriculum/detail?navTitle=${this.options.navTitle}&title=${v.title}&id=${v.id}&conditions=${v.conditions}&detailOid=${v.detailOid}&curriculumImgUrl=${this.curriculumData.image}`,
});
} else {
this.$commonJS.showToast("请先购买课程");

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -0,0 +1,678 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<style>
html,
body {
margin: 0;
padding: 0;
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: #ffffff;
}
* {
margin: 0;
padding: 0;
}
button,
input,
input[type=button],
input[type=reset],
input[type=search],
input[type=submit],
select {
outline: none;
-webkit-tap-highlight-color: transparent;
-webkit-appearance: none;
font-family: inherit;
border: none;
}
.hide {
display: none;
}
.search-wrap {
position: absolute;
left: 0;
right: 0;
top: 0;
padding: 8px 60px 8px 15px;
background-color: #fff;
border-bottom: 1px solid #d3d3d3;
z-index: 100;
}
.search-wrap.init-status {
padding-right: 15px;
}
.search-wrap .search-bar {
display: block;
height: 30px;
background-color: #ebebeb;
padding-left: 10px;
padding-right: 10px;
color: #b4b4b4;
font-size: 15px;
line-height: 31px;
border-radius: 5px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.search-wrap .cancel,
.search-wrap .submit {
position: absolute;
top: 0;
right: 0;
width: 55px;
height: 46px;
line-height: 46px;
text-align: center;
font-size: 16px;
color: #0079ff;
background-color: #fff;
}
.search-wrap .clear-input {
top: 11px;
right: 60px;
width: 34px;
height: 26px;
line-height: 26px;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAPFBMVEUAAACZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZlr8OySAAAAE3RSTlMANO/H574Jw5g/soF2LxKbQCgmvcJ4rgAAAKFJREFUOMu9k1sSgyAMRcNLwbfe/e+1HZLa0DKTP8+PztwTDRDoWa4lRSCm5erGZcTNWP7iIaMhD22+BfwQtqae89bQ39jRYVf9ocu3U+5/cp4D7yZeCwkrKo7Y8O8XVFYRZilkgx+VWYQEZagcSYQIZagcUQRAGZwLpmD+wmzSXKa5UdZWW4d10E1Gh2wPjD1y9tBqSlDlB/U4PxfnpEd5AeZAIGebfob2AAAAAElFTkSuQmCC) no-repeat center center;
background-color: #ededed;
background-size: 18px 18px;
position: absolute;
padding: 0;
border: 0;
font-size: 14px;
border-radius: 4px;
text-align: center;
z-index: 2;
}
.search-wrap.init-status .cancel,
.search-wrap.init-status .clear-input,
.search-wrap.init-status .submit {
display: none;
}
.search-wrap .search-bar .keyword {
display: block;
width: 100%;
padding-top: 6px;
padding-bottom: 6px;
border: 0;
font-size: 14px;
line-height: 18px;
background: 0 0;
}
.search-wrap.init-status .search-bar .keyword {
text-align: left;
}
.search-wrap .search-bar .keyword::-webkit-input-placeholder {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAAAgCAMAAACioYPHAAAAaVBMVEUAAACAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICxWbJ4AAAAInRSTlMAv39AEB/f758wYFDQj3CvDPflh9qpJBYEyEc3sn1om1t4LqRQpwAABAhJREFUWMPtlumS0zAQhD26TzvXsiwsC/T7PySK5Fi+Q2Cpoij6R2w5lvSpPTNS86+Jc1kbLbfrb7WxXT4U44Y1jK/1tI3cmPnwzYTT6dK1chcQCLVB2ABk8GtdXW1IKLHWk9Ct452PuOlJ7gLexk1shGYLcGFPfbujLs0Aut+z6vMJuJw/2Q+8JeD4tg0YyizCE0gQGs+TvCjIRIZlEW43RAvAmJx8ENAfofwQBQScNwEJZQ4gdDI1kNXHJ6AoSyFQFoAFYGLYAzTspki29++I10NT9QVo9wEZ2r4h82XPh0cBAw3qRzkovH6cJiFg7wDy2vgtQPsTPc9Qh9mjJ7yswUXGFBgzloEvHYyR3USjD2XcNWn7lLJyBCi8UbgPeNDLmvB8XLMARKRBpDhDEl2npBqDBLpJ0aAAluftxQZARYDSPwH4DZcly1d8vRODnPtrw3LOw/xLO7Ba2fM9d9fXeLpcO7MYAN21dtSnMzPvzS1IzVrOfoJ6IAZngBHKiTFg7So86xSArgVNF0WYqu4IL2tV/wAcfhFQ0A3JRzEHtABULgFLwEVA9TdqNWM15CZgmzwKVAKyXIpxlKm04gU0Ako2kvExQvR5dX8SUBJc7NhVCv12MbzLCZ0ocahB/m6ZIboPGPBpyfEREBuAWrdbg0qNKkoY7wL4hO8rmzNOq3xOwyRyMR1UDL7TtRZ6pqFcalr/HoBva0X5jKflQ9kqACspx6ZHRsp4+TX3DoDPwOe94l35rigB2UimFe/loEfRIJzKeKUR4OaAYgwoQJtlpv5l8PJxYeBleFQVOjks1NfqUddiXQdow3nLskwA3ATQEauAjnQ1P4BPVSuxPOI8L9Np0qXEtBqXV1qYuoFUBUrqGNPaVsCogbYCCmgzmE803/QSex34y4TvuIzAZahQntohDHNIYi3ndrKj8v5oL/yVrnOi/zMbZJsdCTY5AL7KevoHcPpwF1AE7ZrY81Wx7sZgcyw6eUVXAEIrapJIxqYVIBdNx/NWFEvkmTrq2xFH458THT9rwIRKuASshAhzPkmA6Rm8wlDBg4py/cBCUZSYprSkkjkKmTOMj82WkHTUSLr45jkTbgPWmHPTk66GkQODYEMFkmOPx50kIPocyb+2hEVm0pOVfI4XJJ2efMrfQrgP6Agwk/3MKSg+MclWE6ssgpc9nlMwJdW6UcYZuOKqFtP9TcrDcGS9rBIKjTywT2ggmZ1X0dsCgyhmX1EQ9CIVIkYikZkLioQuF9XUMNyQvEDNFs+INFQOkiRTGFwAyjix2Cc6otHHMWZlbM+yPOclxYd9QYGXTrIsTza7hGFmH6BMqSKdq+bbGMo0ohqUUvkR8VtJ8fKBXvJly2Cx3882//UX6QfMclqph21gcgAAAABJRU5ErkJggg==);
background-repeat: no-repeat;
background-position: left center;
background-size: 80px 16px;
color: gray
}
.search-wrap.init-status .search-bar .keyword::-webkit-input-placeholder {
background-position: center center;
}
.suggestion-wrap {
position: absolute;
top: 46px;
bottom: 0;
z-index: 7;
width: 100%;
background: #f6f6f6;
overflow: scroll;
-webkit-overflow-scrolling: touch;
}
.map-wrap {
height: 220px;
position: relative;
top: 46px;
width: 100%;
}
.list-wrap {
width: 100%;
position: absolute;
background-color: #fff;
z-index: 1;
bottom: 0;
left: 0;
overflow: hidden;
border-top: 1px solid #d3d3d3;
overflow-y: scroll;
padding-bottom: 0;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
-webkit-overflow-scrolling: touch;
}
.poi-list ul {
list-style: none;
width: 100%;
text-align: left;
padding: 0 0 65px;
}
.suggestion-wrap li,
.active-pos,
.poi-list li {
position: relative;
display: block;
padding-left: 15px;
border: none;
height: 58px;
padding-top: 6px;
margin: 0;
}
.poi-list li * {
pointer-events: none;
}
.poi-list li p,
.active-pos div p {
padding-bottom: 10px;
border-bottom: 1px solid #d3d3d3;
}
.poi-title {
font-size: 14px;
line-height: 27px;
color: #333;
font-weight: 400;
display: block;
width: 92%;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.poi-address {
font-size: 12px;
color: gray;
height: 20px;
line-height: 20px;
margin: 0;
width: 92%;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
display: block;
}
.poi-city,
.poi-latlng {
line-height: 22px;
display: none;
}
.no-more-results,
.no-results {
color: gray;
padding: 20px 0;
line-height: 24px;
text-align: center;
}
.no-more-results p,
.no-results p {
padding: 0;
margin: 0;
}
.list-wrap i {
width: 16px;
height: 16px;
display: none;
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAaVBMVEUAAAAAef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef8Aef84EEEWAAAAInRSTlMA+QQY6izG8NO6TphC3JReWSMoDLOfgXajf29lZEs7Hcep1l5DEAAAAPxJREFUOMuFU9cSgyAQBDSUgCVgSS/8/0cGc8E5FQdeOGaXud0rBB9mzdFYRtKnGDkVkktB+VgkYE27poCw6aheUxpxPqHn6SyaRe66NKsfpqyRll6+Njlfsp/jS1WkRFeXf/QUh6Stg3iCAHndMX6VPxltlaiMNdPXqp1iftviR+qHcN34ZJm6FO4/4XY0FOeuknhpp0jdCamHJA7GhjqQ2n2ctCpofPw8K+22OHm8I+HjvXIYj4SYYvSBwTAeU0SROjA6hnEQCTYjg2McbEKhZgbGoVC41HqJQ6lxs1iP8blZuN3WrdudG5jcyGWHNj/2+cXJr15+ebPr/wWbNBG/n/A0GgAAAABJRU5ErkJggg==) no-repeat right center;
background-size: 16px 16px;
position: absolute;
right: 15px;
top: 50%;
margin-top: -8px;
}
.list-wrap i.active {
right: 30px;
display: inline-block;
}
</style>
</head>
<body>
<div class="search-wrap init-status">
<div class="search-bar">
<form name="poi-search" id="poiSearch" onsubmit="return false;">
<input type="search" class="keyword" id="searchword" placeholder=" ">
<button type="reset" class="clear-input hide"></button>
<button type="submit" class="submit hide">搜索</button>
</form>
<a class="cancel">取消</a>
</div>
</div>
<div class="suggestion-wrap hide">
<div class="poi-list">
<ul>
</ul>
</div>
<div class="no-results hide">
<p>对不起,没有搜索到相关数据!</p>
</div>
<div class="no-more-results hide">
<p>亲,没有更多了~</p>
</div>
</div>
<div id="map" class="map-wrap"></div>
<div class="list-wrap">
<div class="active-pos">
</div>
<div class="poi-list">
<ul>
</ul>
<div class="no-results hide">
<p>对不起,没有搜索到相关数据!</p>
</div>
</div>
</div>
<script>
var loc;
var serviceWebview;
var back = function (cancel) {
if (cancel) {
plus.webview.postMessageToUniNView({
type: 'chooseLocation',
args: {
errMsg: 'cancel'
}
}, '__uniapp__service');
}
var webview = plus.webview.currentWebview()
if (webview.__uniapp_statusbar_style === 'dark') {
plus.navigator.setStatusBarStyle('dark')
}
webview.close('auto');
};
window.__chooseLocationConfirm__ = function () {
if (!loc) {
plus.nativeUI.alert('您尚未选择位置!');
return;
}
plus.webview.postMessageToUniNView({
type: 'chooseLocation',
args: loc
}, '__uniapp__service');
back();
}
var searchWrapElem = document.querySelector('.search-wrap');
var searchWordElem = document.getElementById('searchword');
var resetElem = document.querySelector('[type="reset"]');
var cancelElem = document.querySelector('.cancel');
var suggestionWrapElem = document.querySelector('.suggestion-wrap');
var mapElem = document.getElementById('map');
var listWrapElem = document.querySelector('.list-wrap');
var suggestionPoiListElem = suggestionWrapElem.querySelector('.poi-list ul');
var suggestionPoiNoResultsElem = suggestionWrapElem.querySelector('.no-results');
var suggestionPoiNoMoreResultsElem = suggestionWrapElem.querySelector(
'.no-more-results');
var activePosElem = document.querySelector('.active-pos');
var nearbyPoiListElem = listWrapElem.querySelector('.poi-list ul');
var nearbyPoiNoResultsElem = listWrapElem.querySelector('.no-results');
listWrapElem.style.top = mapElem.offsetHeight + 47 + 'px';
var debounce = function (func, wait, immediate) {
var timeout, result;
return function () {
var context = this,
args = arguments,
later, callNow;
later = function () {
timeout = null;
if (!immediate) {
result = func.apply(context, args);
}
};
callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) {
result = func.apply(context, args);
}
return result;
};
};
var plusReady = function (callback) {
if (window.plus) {
callback()
} else {
document.addEventListener('plusready', callback)
}
}
var ZOOM = 13
window.__chooseLocation__ = function (params) {
if (params && params.keyword) {
searchWordElem.value = params.keyword;
}
plusReady(function () {
serviceWebview = plus.webview.getWebviewById('__W2A_CONTEXT_') ||
plus.webview
.getLaunchWebview();
plus.key.addEventListener('backbutton', function () {
back(true);
});
var nativeMarker = false;
var nativeMap = new plus.maps.Map('map', {
zoom: ZOOM
});
var centerPoint = false
var reverseGeocode = debounce(function (point) {
plus.maps.Map.reverseGeocode(point, {}, function (res) {
activePosElem.innerHTML =
'<div data-name="' + (res.address || '') +
'" data-address="' + (res.address || '') +
'" data-lat="' + res.coord.getLat() +
'" data-lng="' + res.coord.getLng() +
'"><h2 class="poi-title">地图位置</h2><p><span class="poi-address">' +
(res.address ||
'') +
'</span><span class="poi-latlng">' +
res.coord
.getLat() +
',' + res.coord.getLng() +
'</span><i></i></p></div>';
}, function (err) {
console.log(err);
});
searchNearbyPoi.poiSearchNearBy(searchWordElem.value || '', point, 1000);
}, 10)
nativeMap.getUserLocation(function (state, point) { //获取当前用户坐标
if (state === 0) {
nativeMarker = new plus.maps.Marker(point);
nativeMarker.setIcon('__uniappmarker@3x.png');
nativeMap.addOverlay(nativeMarker);
//centerPoint = point;
nativeMap.showUserLocation(true);
if (plus.os.name !== 'Android') {
nativeMap.setCenter(point);
}
// reverseGeocode(centerPoint);
} else {
console.log('获取用户坐标失败');
}
});
nativeMap.onstatuschanged = function (evt) { //切换坐标中心
// if (!centerPoint) {
// return;
// }
if (centerPoint && evt.center) {
if (centerPoint.latitude === evt.center.latitude &&
centerPoint.longitude === evt.center.longitude) {
return;
}
}
centerPoint = evt.center
if (nativeMarker) {
nativeMarker.setPoint(centerPoint);
}
reverseGeocode(centerPoint);
};
var searchPoi = new plus.maps.Search(nativeMap);
var searchNearbyPoi = new plus.maps.Search(nativeMap);
var showMap = function (centerPoint) {
nativeMap.show();
if (centerPoint) {
if (nativeMarker) {
nativeMarker.setPoint(centerPoint);
}
nativeMap.setCenter(centerPoint);
// setTimeout(function() {
// nativeMap.setZoom(ZOOM);
// }, 150);
// reverseGeocode(centerPoint);
}
searchWordElem.value = '';
cancelElem.className = 'cancel hide';
searchWrapElem.className = 'search-wrap init-status';
suggestionWrapElem.className = 'suggestion-wrap hide';
resetSuggestionPoiList();
}
var resetSuggestionPoiList = function () {
suggestionPoiListElem.innerHTML = '';
suggestionPoiNoResultsElem.className = 'no-results hide';
suggestionPoiNoMoreResultsElem.className =
'no-more-results hide';
}
var showSuggestionPoiList = function () {
nativeMap.hide();
resetSuggestionPoiList();
}
var showSuggestionPoiNoResults = function () {
suggestionPoiListElem.innerHTML = '';
suggestionPoiNoResultsElem.className = 'no-results';
suggestionPoiNoMoreResultsElem.className =
'no-more-results hide';
}
var renderPoiResults = function (poiList) {
var html = [];
for (var i = 0; i < poiList.length; i++) {
var poi = poiList[i];
if (poi.point) {
html.push('<li data-name="' + (poi.name || '') +
'" data-address="' + (poi.address || '') +
'" data-lat="' + poi.point.getLat() +
'" data-lng="' + poi.point.getLng() +
'"><p><span class="poi-title">' + poi.name +
'</span><span class="poi-address">' + (poi.address ||
'') +
'</span><span class="poi-latlng">' + poi.point
.getLat() +
',' + poi.point.getLng() +
'</span><span class="poi-city">' + poi.city +
'</span></p><i></i></li>');
}
}
return html.join('');
}
var showNearbyPoiNoResults = function () {
nearbyPoiListElem.innerHTML = '';
nearbyPoiNoResultsElem.className = 'no-results';
}
var showNearbyPoiResults = function (poiList) {
var html = renderPoiResults(poiList);
if (html) {
nearbyPoiListElem.innerHTML = html;
nearbyPoiNoResultsElem.className = 'no-results hide';
} else {
showNearbyPoiNoResults();
}
}
var showSuggestionPoiResults = function (poiList) {
var html = renderPoiResults(poiList);
if (html) {
suggestionPoiListElem.innerHTML = html;
suggestionPoiNoResultsElem.className =
'no-results hide';
suggestionPoiNoMoreResultsElem.className =
'no-more-results';
} else {
showSuggestionPoiNoResults();
}
}
searchPoi.onPoiSearchComplete = function (state, res) {
if (state === 0) {
if (res.poiList.length) {
showSuggestionPoiResults(res.poiList);
} else {
showSuggestionPoiNoResults();
}
} else {
showSuggestionPoiNoResults();
}
};
searchNearbyPoi.onPoiSearchComplete = function (state, res) {
if (state === 0) {
if (res.poiList.length) {
showNearbyPoiResults(res.poiList);
} else {
showNearbyPoiNoResults();
}
} else {
showNearbyPoiNoResults();
}
};
var getSuggestion = debounce(function (q) {
if (q.trim()) {
searchPoi.poiSearchNearBy(q, centerPoint, 50000)
} else { }
}, 10);
suggestionPoiListElem.addEventListener('click', function (evt) {
var target = evt.target;
for (; target && target !== suggestionPoiListElem; target =
target.parentNode) {
if (target && target.tagName === 'LI') {
var laglng = target.querySelector('.poi-latlng')
.innerText
.split(',');
centerPoint = new plus.maps.Point(Number(laglng[1]), Number(laglng[
0]));
showMap(centerPoint);
reverseGeocode(centerPoint);
break;
}
}
});
searchWordElem.addEventListener('click', function () {
searchWrapElem.className = 'search-wrap';
suggestionWrapElem.className = 'suggestion-wrap';
cancelElem.className = 'cancel';
showSuggestionPoiList();
});
var oldHasValue = false;
var setInputState = function (hasValue) {
if (hasValue !== oldHasValue) {
if (hasValue) {
resetElem.className = 'clear-input'
} else {
resetElem.className = 'clear-input hide'
}
oldHasValue = hasValue;
}
}
searchWordElem.addEventListener('input', function () {
var value = this.value.replace(/^\s+|\s+$/g, '');
setInputState(!!value);
getSuggestion(value);
});
resetElem.addEventListener('click', function (e) {
setInputState(false);
setTimeout(function () {
searchWordElem.focus();
}, 0);
});
cancelElem.addEventListener('click', function () {
showMap();
});
listWrapElem.addEventListener('click', function (e) {
var target = e.target;
for (; target && target !== listWrapElem; target =
target.parentNode) {
if (target.className === 'active-pos' || target.tagName ===
'LI') {
var lastActiveElem = listWrapElem.querySelector(
'i.active');
if (lastActiveElem) {
lastActiveElem.className = '';
}
if (target.className === 'active-pos') {
target = target.children[0]
}
target.querySelector('i').className = 'active';
loc = {
poiname: target.getAttribute('data-name'),
poiaddress: target.getAttribute(
'data-address'),
latlng: {
lat: target.getAttribute(
'data-lat'),
lng: target.getAttribute(
'data-lng'),
}
}
if (nativeMarker) {
nativeMarker.setPoint(new plus.maps.Point(
loc.latlng.lng, loc.latlng.lat));
}
break;
}
}
})
});
};
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,284 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<style>
html,
body,
.container {
margin: 0;
padding: 0;
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: #ffffff;
}
#map {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 80px;
bottom: calc(80px + constant(safe-area-inset-bottom));
bottom: calc(80px + env(safe-area-inset-bottom));
}
#poi {
position: absolute;
left: 0;
right: 0;
bottom: 0;
bottom: constant(safe-area-inset-bottom);
bottom: env(safe-area-inset-bottom);
height: 80px;
background: #FFFFFF;
}
.poi-info {
width: 100%;
padding: 23px 16px 23px 18px;
box-sizing: border-box;
background: #FFFFFF;
}
.poi-name {
font-size: 17px;
line-height: 17px;
color: #111111;
display: block;
margin-right: 70px;
word-wrap: break-word;
}
.poi-addr {
font-size: 13px;
line-height: 13px;
color: #666666;
display: block;
margin-top: 4px;
margin-right: 70px;
word-wrap: break-word;
}
.poi-nav {
display: block;
position: absolute;
top: 10px;
right: 16px;
width: 60px;
height: 60px;
border-radius: 60px;
overflow: hidden;
}
.poi-nav i,
.poi-nav span {
position: absolute;
top: 0;
width: 100%;
height: 100%;
display: inline-block;
border-radius: 60px;
}
.poi-nav i {
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAMAAAAOusbgAAACnVBMVEUAAAA9avA+avA9avA/bPE8afA+avM9afA9avA9au9Ac/I+bPQ9avA8a/E8au8+avY9avA9avBAgP88avA9au9AbfFAgP89avA9avBJbf89au88afA8ae88afA8ae9AbO88afA/avE9ae88avBHcfFCcfY+a/H///89afE8afA8avA9afA8afA9a/E9afA9avA8avA8avA9ae////88ae8/a+/+/v77/P5Cbu9jh/I9au9Te/CIo/XY4fuasfbH1PpJc/Dl6/xHce9Cbe9Eb+9FcO/3+f5SevC0xfjh6PygtvdLdPD4+f7e5fytwPj9/f7y9f1agPG6yvlsjvNIcvC8y/lXfvFNdvBZf/HR3PtBbe+DoPTT3fvg5/xWffGyxPh/nPTo7f32+P65yfnBz/n6+/6xw/i+zfmwwvj5+v6Np/WetPdPd/BMdfBOd/BdgvGkufdGce9ghfKnu/deg/F4l/NqjPKAnfS3x/lAbO+KpfVPePBmifKqvviZs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hb62saR/TjrhNBIcpxrB+R1pLgCAc5O/X40yP9Sxv1yDQie8HGuc8OPVn3YvWnChqRO8NEk5tFuwtLwKqn75taFyba17Wk1ddcupLqy8RyADiMxa5YQXPcW3AvyY9/i1iv2wHBF7OuABVl6AAI7hFFDifFCKjyWpeeT3PxrXl18/eaeoQXqv/oS/EHHD5QrvlHzp73/+dYJMN5bMUGI7JanJnsZt+Y8MjbNQZqu7du0ELzXIhDiakrjWEwMlVa8naVmU4gQdEWMo5Rg6YsqmFKDoSTKt5EZHrEnUIiPdSBjDUFalA6KZoZBMB4Yn8iqd41UsyKs8kldBKK8SWF5Fv7zKnHkVdvMvZedfvM//uAL/Axr8j6TwP4RDSM9Xc+woP53TQStOR8v0wZw5XvfDdPTjg4VW+figtVDb8cH/AZ+Eg+9jqX0NAAAAAElFTkSuQmCC) no-repeat;
background-size: 100%;
}
</style>
</head>
<body>
<div id="container" class="container">
<div id="map"></div>
<div id="poi">
<div class="poi-info">
<span class="poi-name"></span>
<span class="poi-addr"></span>
<div class="poi-nav">
<i></i>
<span></span>
</div>
</div>
</div>
</div>
<script>
var loc;
var serviceWebview;
var back = function() {
var webview = plus.webview.currentWebview()
if (webview.__uniapp_statusbar_style === 'light') {
plus.navigator.setStatusBarStyle('light')
}
webview.close('auto');
};
var isIos = !!navigator.userAgent.match(/iPhone|iPad|iPod/i);
document.addEventListener('plusready', function() {
serviceWebview = plus.webview.getWebviewById('__W2A_CONTEXT_') || plus.webview.getLaunchWebview();
plus.key.addEventListener('backbutton', back);
})
/**
* 调用系统第三方程序进行导航
*/
function openSysMap(lat, lng, title) {
/**
* 网页版地图源
*/
var mapsSourceWeb = [
{
title: '腾讯地图网页版',
getUrl: function() {
var url
url = 'https://apis.map.qq.com/uri/v1/routeplan?type=drive' + '&to=' +
encodeURIComponent(title) + '&tocoord=' + encodeURIComponent(lat + ',' + lng) +
'&referer=APP'
return url
}
}
]
/**
* APP版地图源
*/
var mapsSource = [
{
title: '高德地图',
pname: 'com.autonavi.minimap',
action: !isIos ? 'amapuri://' : 'iosamap://',
getUrl: function() {
var url
if (!isIos) {
url = 'amapuri://route/plan/'
} else {
url = 'iosamap://path'
}
url += '?sourceApplication=APP&dname=' + encodeURIComponent(title) + '&dlat=' + lat +
'&dlon=' + lng + '&dev=0'
return url
}
},
{
title: '百度地图',
pname: 'com.baidu.BaiduMap',
action: 'baidumap://',
getUrl: function() {
var url = 'baidumap://map/direction?destination=' + encodeURIComponent('latlng:' + lat +
',' + lng + '|name:' + title) + '&mode=driving&src=APP&coord_type=gcj02'
return url
}
},
{
title: '腾讯地图',
pname: 'com.tencent.map',
action: 'qqmap://',
getUrl: function() {
var url
url = 'qqmap://map/routeplan?type=drive' + (isIos ? ('&from=' + encodeURIComponent(
'我的位置')) : '') + '&to=' + encodeURIComponent(title) + '&tocoord=' +
encodeURIComponent(lat + ',' + lng) + '&referer=APP'
return url
}
}
]
var maps = []
mapsSource.forEach(function(mapsSource) {
var installed = plus.runtime.isApplicationExist({
pname: mapsSource.pname,
action: mapsSource.action,
})
if (installed) {
maps.push(mapsSource)
}
})
if (isIos) {
maps.unshift({
title: 'Apple 地图',
getUrl: function() {
var url
url = 'https://maps.apple.com/?daddr=' + encodeURIComponent(title) + '&sll=' +
encodeURIComponent(lat + ',' + lng)
return url
}
})
}
if (maps.length === 0) {
maps = maps.concat(mapsSourceWeb)
}
plus.nativeUI.actionSheet({
title: '导航方式',
cancel: '取消',
buttons: maps,
}, function(res) {
var index = res.index
var map
if (index > 0) {
map = maps[index - 1]
plus.runtime.openURL(map.getUrl(), function() { }, map.pname)
}
})
}
var ZOOM = 13
window.__openLocation__ = function(params) {
var mapElem = document.getElementById('map');
var poiNameElem = document.querySelector('.poi-name');
var poiAddrElem = document.querySelector('.poi-addr');
var poiNavElem = document.querySelector('.poi-nav');
var latitude = params.latitude;
var longitude = params.longitude;
var scale = params.scale;
var name = params.name;
var address = params.address;
var point = new plus.maps.Point(longitude, latitude);
var map = plus.maps.create('map', {
center: point,
zoom: scale || ZOOM,
top: 0,
left: 0,
width: mapElem.offsetWidth,
height: mapElem.offsetHeight
});
var marker = new plus.maps.Marker(point);
marker.setIcon('__uniappmarker@3x.png');
if (name) {
poiNameElem.innerText = name;
// marker.setLabel(name);
}
if (address) {
poiAddrElem.innerText = address;
// var bubble = new plus.maps.Bubble(address);
// marker.setBubble(bubble);
}
map.addOverlay(marker);
plus.webview.currentWebview().append(map);
var userPoint = false
map.getUserLocation(function(state, point) {
if (state) {
plus.nativeUI.toast('定位失败!');
} else {
userPoint = point;
}
})
poiNavElem.addEventListener('click', function() {
openSysMap(latitude, longitude, name)
});
}
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,149 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports(
'top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title>Scan code</title>
<style>
html,
body,
.container {
margin: 0;
padding: 0;
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
background: #000000;
}
</style>
</head>
<body>
<div id="scan" class="container">
</div>
<script>
var scan;
var lightImg;
var lightView;
var back = function(cancel) {
if (cancel) {
plus.webview.postMessageToUniNView({
type: 'scanCode',
args: {
errMsg: 'cancel'
}
}, '__uniapp__service');
}
lightImg && lightImg.clear();
lightView && lightView.clear();
scan && scan.close();
var webview = plus.webview.currentWebview();
if (webview.__uniapp_dark) {
plus.navigator.setStatusBarStyle('dark');
}
webview.close('auto');
}
/**
* 绘制照亮开关
*/
function drawLight() {
var offImg =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAABjklEQVRoQ+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vzQOkuDpB+CTB0EPHgOYNnNiTewXaFyBkFGbWAVQE7XNXevhW7X2Sucg8NqfR+p7AADaesateUk7E+0eAH4tLOsAIPSNZQBJT6EoicMV4Ar4OEJZK5lCTCGmkPy/MUGjOTEtxO9A1A1wE3MTp6iJgxaWKAr7F54o27DvsUwhlQRUzzIA1RtUPf8FRKRYQOI+9hQAAAAASUVORK5CYII=';
var webview = plus.webview.currentWebview();
var en = webview.__uniapp_locale && webview.__uniapp_locale.indexOf('zh') < 0
var onText = en ? '' : '轻触照亮';
var offText = en ? '' : '轻触关闭';
var on = false;
var viewWidth = 48;
var fontSize = 10;
var imgWidth = 26;
function changeType() {
lightView.reset();
lightImg.loadBase64Data(on ? onImg : offImg, function() {
lightView.drawBitmap(lightImg, {}, {
top: 0,
left: (viewWidth - imgWidth) / 2 + 'px',
width: imgWidth + 'px',
height: imgWidth + 'px'
});
});
lightView.drawText(on ? offText : onText, {
top: imgWidth + 'px',
left: '0px',
width: '100%',
height: (fontSize + 2) + 'px'
}, {
color: '#ffffff',
size: fontSize + 'px'
});
scan.setFlash(on);
on = !on;
}
lightImg = new plus.nativeObj.Bitmap('lightImg');
lightView = new plus.nativeObj.View('lightView', {
width: viewWidth + 'px',
height: viewWidth + 'px',
top: window.innerHeight / 2 + 50 + 'px',
left: (window.innerWidth - viewWidth) / 2 + 'px',
position: 'static'
});
lightView.addEventListener('click', function() {
changeType();
});
plus.webview.currentWebview().append(lightView);
changeType();
}
document.addEventListener('plusready', function() {
var serviceWebview = plus.webview.getWebviewById('__W2A_CONTEXT_') || plus.webview.getLaunchWebview();
plus.key.addEventListener('backbutton', function() {
back(true);
});
setTimeout(function() {
var webview = plus.webview.currentWebview();
scan = new plus.barcode.Barcode('scan', webview.__uniapp_scan_type, {
frameColor: '#118CE9',
scanbarColor: '#118CE9'
}, webview.__uniapp_auto_decode_char_set);
scan.onmarked = function(type, code, file, charSet) {
var res = {
type: type,
code: code,
charSet: charSet
};
back()
plus.webview.postMessageToUniNView({
type: 'scanCode',
args: res
}, '__uniapp__service');
};
scan.onerror = function(error) {
back()
plus.webview.postMessageToUniNView({
type: 'scanCode',
args: {
errMsg: error.message + ' error code:' + error.code
}
}, '__uniapp__service');
};
scan.start();
drawLight();
}, 500)
})
</script>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -0,0 +1,25 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<script>
var __UniViewStartTime__ = Date.now();
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title>View</title>
<link rel="stylesheet" href="view.css" />
</head>
<body>
<div id="app"></div>
<script src="__uniappes6.js"></script>
<script src="view.umd.min.js"></script>
<script src="app-view.js"></script>
</body>
</html>

View File

@@ -0,0 +1,22 @@
{
"version" : "1",
"prompt" : "template",
"title" : "服务协议和隐私政策",
"message" : "尊敬的用户,感谢您信任并使用众妙之门!<br/> <br/> 众妙之门非常重视您的隐私保护和个人信息保护,在您使用众妙之门提供的产品或服务前,请您务必审慎阅读、充分理解“用户协议”和“隐私政策”各条款,包括但不限于:为了更好的向您提供服务,我们需要收集您的设备标识、操作日志等信息用于分析、优化应用性能。<br/>  您可阅读<a href='https://zmzm.taihumed.com/agreement.html'> 《用户协议》 </a>和<a href='https://zmzm.taihumed.com/privacy.html'>《隐私政策》 </a> 的全部条款,众妙之门可能会收集您的相关使用信息、个人信息。未经授权,众妙之门不会向任何第三方提供您的信息。如果您同意,请点击下面按钮开始接受我们的服务。",
"buttonAccept" : "同意并接受",
"buttonRefuse" : "暂不同意",
"hrefLoader" : "system",
"backToExit" : "false",
"second" : {
"title" : "确认提示",
"message" : "进入应用前,您需先同意<a href='https://zmzm.taihumed.com/agreement.html'> 《用户协议》 </a>和 <a href='https://zmzm.taihumed.com/privacy.html'>《隐私政策》 </a>,否则将退出应用。 ",
"buttonAccept" : "同意并继续",
"buttonRefuse" : "退出应用"
},
"disagreeMode" : {
"support" : false,
"loadNativePlugins" : false,
"visitorEntry" : false,
"showAlways" : false
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
(function(e){function r(r){for(var n,l,i=r[0],p=r[1],a=r[2],c=0,s=[];c<i.length;c++)l=i[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in p)Object.prototype.hasOwnProperty.call(p,n)&&(e[n]=p[n]);f&&f(r);while(s.length)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,i=1;i<t.length;i++){var p=t[i];0!==o[p]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={"app-config":0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"===typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e["default"]}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="/";var i=this["webpackJsonp"]=this["webpackJsonp"]||[],p=i.push.bind(i);i.push=r,i=i.slice();for(var a=0;a<i.length;a++)r(i[a]);var f=p;t()})([]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@@ -0,0 +1,88 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>本地网页</title>
<style type="text/css">
.btn {
display: block;
margin: 20px auto;
padding: 5px;
background-color: #007aff;
border: 0;
color: #ffffff;
height: 40px;
width: 200px;
}
.btn-red {
background-color: #dd524d;
}
.btn-yellow {
background-color: #f0ad4e;
}
.desc {
padding: 10px;
color: #999999;
}
</style>
</head>
<body>
<p class="desc">web-view 组件加载本地 html 示例,仅在 App 环境下生效。点击下列按钮,跳转至其它页面。</p>
<div class="btn-list">
<button class="btn" type="button" data-action="navigateTo">navigateTo</button>
<button class="btn" type="button" data-action="redirectTo">redirectTo</button>
<button class="btn" type="button" data-action="navigateBack">navigateBack</button>
<button class="btn" type="button" data-action="reLaunch">reLaunch</button>
<button class="btn" type="button" data-action="switchTab">switchTab</button>
</div>
<p class="desc">网页向应用发送消息。注意:小程序端应用会在此页面后退时接收到消息。</p>
<div class="btn-list">
<button class="btn btn-red" type="button" id="postMessage">postMessage</button>
</div>
<!-- uni 的 SDK -->
<script type="text/javascript" src="https://unpkg.com/@dcloudio/uni-webview-js@0.0.1/index.js"></script>
<script type="text/javascript">
document.addEventListener('UniAppJSBridgeReady', function() {
document.querySelector('.btn-list').addEventListener('click', function(evt) {
var target = evt.target;
if (target.tagName === 'BUTTON') {
var action = target.getAttribute('data-action');
switch (action) {
case 'switchTab':
uni.switchTab({
url: '/pages/tabBar/API/API'
});
break;
case 'reLaunch':
uni.reLaunch({
url: '/pages/tabBar/API/API'
});
break;
case 'navigateBack':
uni.navigateBack({
delta: 1
});
break;
default:
uni[action]({
url: '/pages/component/button/button'
});
break;
}
}
});
document.querySelector("#postMessage").addEventListener('click', function() {
uni.postMessage({
data: {
action: 'message'
}
});
})
});
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */

Binary file not shown.

After

Width:  |  Height:  |  Size: 774 B

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 986 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 907 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 856 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 797 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Some files were not shown because too many files have changed in this diff Show More