This commit is contained in:
2024-10-16 13:31:04 +08:00
905 changed files with 5055 additions and 64064 deletions

View File

@@ -4,17 +4,20 @@
"version" : "0.0",
"configurations" : [
{
"app-plus" : {
"launchtype" : "local"
},
"default" : {
"launchtype" : "local"
},
"h5" : {
"launchtype" : "local"
},
"provider" : "aliyun",
"type" : "uniCloud"
"app-plus" :
{
"launchtype" : "remote"
},
"default" :
{
"launchtype" : "local"
},
"h5" :
{
"launchtype" : "local"
},
"provider" : "aliyun",
"type" : "uniCloud"
},
{
"playground" : "standard",

196
README.md
View File

@@ -1,129 +1,97 @@
# hello-uniapp
`uni-app`框架示例一套代码同时发行到iOS、Android、H5、小程序等多个平台请使用手机在下方扫码快速体验`uni-app`的强大功能。[官方文档](https://uniapp.dcloud.net.cn/)
## 快速上手
hello-uniapp 示例工程可以通过两种方式创建, 一种是 HBuilderX, 配套 IDE集成开发另一种是 CLI 创建;推荐前者。
### 通过 HBuilderX 可视化界面创建(推荐)
欢迎使用 my-audio 在线音乐播放器 不支持倍速 使用uni.createInnerAudioContext()方法搭建
插件内有my-video支持倍速 使用uni.createVideoContext()方法搭建
可视化的方式比较简单HBuilderX内置相关环境开箱即用无需配置nodejs。
因为uni-notice-bar 默认上下太宽了
我修改了此插件得默认样式
.uni-noticebar {
/* #ifndef APP-NVUE */
display: flex;
width: 100%;
box-sizing: border-box;
/* #endif */
flex-direction: row;
align-items: center;
// padding: 10px 12px; //这里注释了
// margin-bottom: 10px; //这里注释了
}
开始之前,开发者需先下载安装如下工具:
- HBuilderX[官方IDE下载地址](https://www.dcloud.io/hbuilderx.html)
## props (组件属性)
HBuilderX是通用的前端开发工具但为`uni-app`做了特别强化请下载App开发版。
属性 | 类型 | 默认值 | 备注
------------- | ------------- | ---------
autoplay |Boolean| false | 是否自动播放(只支持微信内置浏览器,小程序app)
src |String| '' | 音频地址
title |String| 默认文件名 | 标题
titleFontSize |Number| 35rpx | 标题字体大小
titleColor |String| #303030 | 标题文字颜色
titleBackgroundColor |String| white | 标题背景色
titleScroll |Boolean| false | 标题是否滚动
titleScrollSpeed |Number| 100 | 标题是否滚动
subTitle |String| 默认文件名 | 副标题
subTitleFontSize |Number| 35rpx | 副标题字体大小
subTitleColor |String| #6C7996 | 标题文字颜色
subTitleColor |String| #6C7996 | 标题文字颜色
isCollectBtn |Boolean| false | 显示收藏按钮
isShareBtn |Boolean| false | 显示分享按钮
activeColor |String| #bf41a2 | 滑块左侧已选择部分的线条颜色
backgroundColor |String| #f1c38b | 滑块右侧背景条的颜色
由于截图在 github 不便浏览,参见官方文档 [HBuilderX 可视化界面创建](https://uniapp.dcloud.net.cn/quickstart?id=_1-%e9%80%9a%e8%bf%87-hbuilderx-%e5%8f%af%e8%a7%86%e5%8c%96%e7%95%8c%e9%9d%a2)
### 通过 vue-cli 创建
## 组件事件
```
npm install -g @vue/cli
事件 | 事件内容
------------- | -------------
@audioPlay | 音频播放事件
@audioPause | 音频暂停事件
@audioEnd | 音频自然播放结束事件
@change | 音频播放状态监听返回true/false
@audioCanplay | 音频进入可以播放状态,但不保证后面可以流畅播放
@audioError | 播放器错误
@audioCollec | 点击收藏按钮
@audioShare | 点击分享按钮
## ref 事件
事件 | 事件内容
------------- | -------------
audioPlay() | 播放
audioPause() | 暂停
changePlayProgress() | 跳转到指定位置
handleFastRewind() | 退回15秒
handleFastForward() | 快进15秒
handleLoopPlay() | 开启/关闭循环播放
handleChageSpeed() | 切换倍速播放 按照0.5/0.8/1.0/1.25/1.5/2.0 顺序取值 只有 my-video 支持
audioDestroy() | 销毁innerAudioContext()实例
```html
<my-audio isCountDown ref="audio" src="音频路径" title="标题名称" subTitle="副标题名称" ></my-audio>
<my-video isCountDown ref="audio" src="音频路径" title="标题名称" subTitle="副标题名称" ></my-audio>
//项目为vue2时 调用跳转到音乐15s位置方法如下:
this.$refs.audio.changePlayProgress(15)
//项目为vue3时 请通过value形式调用子组件方法
```
#### 创建uni-app
#### View代码
```html
<my-audio ref="audio" src="音频路径" title="标题名称" subTitle="副标题名称"></sy-audio>
<my-video ref="audio" src="音频路径" title="标题名称" subTitle="副标题名称"></my-video>
**使用正式版**对应HBuilderX最新正式版
//项目为vue2时 src为本地路径时使用require方法如下:
<my-audio :src="require('@/static/audio.mp3')"></sy-audio>
<my-video :src="require('@/static/audio.mp3')"></my-video>
```
vue create -p dcloudio/uni-preset-vue my-project
//项目为vue3时 src为本地路径时使用自定义方法如下:
<my-audio :src="toUrl('../../static/audio.mp3')"></sy-audio>
<my-video :src="toUrl('../../static/audio.mp3')"></my-video>
methods: {
toUrl(src){
return new URL(src, import.meta.url).href
}
}
```
**使用alpha版**对应HBuilderX最新alpha版
```
vue create -p dcloudio/uni-preset-vue#alpha my-alpha-project
```
此时,会提示选择项目模板,选择 `hello uni-app` 项目模板,如下所示:
<div>
<img src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/h5-cli-01.png" width="300">
</div>
创建好后,进入项目目录
```
cd my-project
```
执行该命令运行到 h5 端
```
npm run dev:h5
```
欢迎提 issues推荐到[官方社区](https://ask.dcloud.net.cn/explore/)提问。
## 扫码体验
<div class="quick">
<p>一套代码编到10个平台这不是梦想。眼见为实扫描10个二维码亲自体验最全面的跨平台效果</p>
<div style="display: flex;">
<a href="//m3w.cn/uniapp" target="_blank" class="clear-style barcode-view">
<div class="barcode-img-box">
<img src="https://web-assets.dcloud.net.cn/unidoc/zh/uni-android.png" width="160" />
</div>
<b>Android版</b>
</a>
<a href="https://itunes.apple.com/cn/app/hello-uni-app/id1417078253?mt=8" target="_blank" class="clear-style barcode-view">
<div class="barcode-img-box">
<img src="https://web-assets.dcloud.net.cn/unidoc/zh/uni-h5.png" width="160" />
</div>
<b>iOS版</b>
</a>
<a href="https://hellouniapp.dcloud.net.cn/" target="_blank" class="clear-style barcode-view">
<div class="barcode-img-box">
<img src="https://vkceyugu.cdn.bspapp.com/VKCEYUGU-dc-site/bb3ef7c0-517d-11eb-bdc1-8bd33eb6adaa.png" width="160" />
</div>
<b>H5版</b>
</a>
<a href="//m3w.cn/uniapp" target="_blank" class="clear-style barcode-view">
<div class="barcode-img-box"><img src="//img.cdn.aliyun.dcloud.net.cn/guide/uniapp/gh_33446d7f7a26_430.jpg" width="160" /></div>
<b>微信小程序版</b>
</a>
<a href="//m3w.cn/uniapp" target="_blank" class="clear-style barcode-view">
<div class="barcode-img-box"><img src="https://web-assets.dcloud.net.cn/unidoc/zh/alipay1.png" width="160" /></div>
<b>支付宝小程序版</b>
</a>
</div>
<div class="flex-img-group-view" style="margin-top: 20px;">
<a href="//m3w.cn/uniapp" target="_blank" class="clear-style barcode-view">
<div class="barcode-img-box"><img src="https://web-assets.dcloud.net.cn/unidoc/zh/baidu-uniapp.png" width="160" /></div>
<b>百度小程序版</b>
</a>
<a href="//m3w.cn/uniapp" target="_blank" class="clear-style barcode-view">
<div class="barcode-img-box">
<img src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/mp-toutiao.png" width="160" />
</div>
<b>字节跳动小程序版</b>
</a>
<a href="//m3w.cn/uniapp" target="_blank" class="clear-style barcode-view">
<div class="barcode-img-box">
<img src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/hello-uni-qq.png" width="160" />
</div>
<b>QQ小程序版</b>
</a>
<a href="//m3w.cn/uniapp" target="_blank" class="clear-style barcode-view">
<div class="barcode-img-box">
<img src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/hello-uni-qa-union.png" width="160" />
</div>
<b>快应用</b>
</a>
<a href="https://so.mp.360.cn/mp.html?appid=qh4j181qqtru354st6" target="_blank" class="clear-style barcode-view">
<div class="barcode-img-box">
<img src="https://img.cdn.aliyun.dcloud.net.cn/guide/uniapp/hello-uni-mp-360-qr.png" width="160" />
</div>
<b>360小程序</b>
</a>
</div>
<p>
<em>注某些平台不能提交简单demo故补充了一些其他功能hello uni-app示例代码可从[github](https://github.com/dcloudio/hello-uniapp)获取</em></br>
<em>快应用仅支持 vivo 、oppo、华为</em></br>
<em>360小程序仅 windows平台支持需要在360浏览器中打开</em></br>
</p>
</div>
`uni-app`官网文档详见[https://uniapp.dcloud.io](https://uniapp.dcloud.io)
更多uni-app的模板、示例详见[插件市场](https://ext.dcloud.net.cn/)
> my-audio my-video 将会持续更新,欢迎大家踊跃提出宝贵建议;

View File

@@ -0,0 +1,461 @@
<template>
<view class="audio_container">
<view class="audio-title"
style="width: 100%; text-align: left; font-size: 36rpx;font-weight: bold;padding: 0rpx 0rpx; position: relative;">
<uni-notice-bar single :scrollable="titleScroll" :size="titleFontSize"
:background-color="titleBackgroundColor" :color="titleColor" :speed="titleScrollSpeed" :text="title"
class="uni-noticebar" style="padding: 0px; margin-bottom: 0px;">
</uni-notice-bar>
<uni-icons v-show="isCollectBtn" @click="handleCollec" type="heart" size="20"
style="color:#848484; position: absolute;top: 0rpx;right: 0px;"></uni-icons>
</view>
<view class="audio-subTitle"
:style="'font-size: '+subTitleFontSize+';font-weight: bold;padding: 0rpx 0rpx 4rpx 0rpx;position: relative;'">
<uni-notice-bar single :scrollable="titleScroll" :size="titleFontSize"
:background-color="titleBackgroundColor" :color="subTitleColor" :speed="titleScrollSpeed"
:text="subTitle" class="uni-noticebar">
</uni-notice-bar>
<uni-icons v-show="isShareBtn" @click="handleShare" type="redo" size="20"
style="color:#848484;position: absolute;top: 0rpx;right: 0px;"></uni-icons>
</view>
<view>
<slider :backgroundColor='backgroundColor' :activeColor='activeColor' @change="handleSliderChange"
:value="sliderIndex" :max="maxSliderIndex" block-color="#343434" block-size="16" />
</view>
<view style="padding: 0rpx 15rpx 0rpx 15rpx ; display: block; ">
<view style="float: left; font-size: 20rpx;color:#848484;">
{{currentTimeText}}
</view>
<view style="float: right;font-size: 20rpx;color:#848484;">
{{totalTimeText}}
</view>
</view>
<view style="margin-top: 70rpx;">
<uni-grid :column="4" :showBorder="false" :square="false">
<uni-grid-item>
<view class="uni-grid-icon">
<image @tap="handleFastRewind" src="../../static/images/get-back.svg"
style="width: 48rpx;height: 48rpx;top:6rpx;">
</image>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="uni-grid-icon">
<image @tap="handleChangeAudioState" v-show="!isPlaying" src="../../static/images/play.svg"
style="width: 48rpx;height: 48rpx;top:6rpx;">
</image>
<image @tap="handleChangeAudioState" v-show="isPlaying" src="../../static/images/pause.svg"
style="width: 48rpx;height: 48rpx;top:6rpx;">
</image>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="uni-grid-icon">
<image @tap="handleFastForward" src="../../static/images/fast-forward.svg"
style="width: 48rpx;height: 48rpx;top:6rpx;">
</image>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="uni-grid-icon">
<image @tap="handleLoopPlay" src="../../static/images/Loop.svg"
style="width: 48rpx;height: 48rpx; top:6rpx; ">
</image>
</view>
</uni-grid-item>
</uni-grid>
</view>
</view>
</template>
<script>
export default {
name: 'my-audio',
//audioPlay开始播放
//audioPause停止播放
//audioEnd音频自然播放结束事件
//audioCanplay音频进入可以播放状态但不保证后面可以流畅播放
//change播放状态改变 返回值false停止播放 true开始播放
//audioError 播放器错误
emits: ['audioPlay', 'audioPause', 'audioEnd', 'audioCanplay', 'change', 'audioError'],
props: {
//标题文字
title: {
type: String,
default: '默认文件名'
},
//标题默认字体大小
titleFontSize: {
type: Number,
default: 35
},
//标题文字颜色
titleColor: {
type: String,
default: '#303030'
},
//标题背景色
titleBackgroundColor: {
type: String,
default: 'white'
},
//标题是否滚动
titleScroll: {
type: Boolean,
default: false
},
//标题滚动速度
titleScrollSpeed: {
type: Number,
default: 100
},
subTitle: {
type: String,
default: '默认文件名'
},
subTitleColor: {
type: String,
default: '#6C7996'
},
subTitleFontSize: {
type: String,
default: "30rpx"
},
//是否自动播放
autoplay: {
type: Boolean,
default: false
},
//滑块左侧已选择部分的线条颜色
activeColor: {
type: String,
default: '#7C7C7C'
},
//滑块右侧背景条的颜色
backgroundColor: {
type: String,
default: '#E5E5E5'
},
//音频地址
src: {
type: [String, Array],
default: ''
},
//是否倒计时
isCountDown: {
type: Boolean,
default: false
},
//音乐封面
audioCover: {
type: String,
default: ''
},
//是否显示收藏按钮
isCollectBtn: {
type: Boolean,
default: false
},
//是否显示分享按钮
isShareBtn: {
type: Boolean,
default: false
},
},
data() {
return {
totalTimeText: '00:00', //视频总长度文字
currentTimeText: '00:00:00', //视频已播放长度文字
isPlaying: false, //播放状态
sliderIndex: 0, //滑块当前值
maxSliderIndex: 100, //滑块最大值
IsReadyPlay: false, //是否已经准备好可以播放了
isLoop: false, //是否循环播放
speedValue: [0.5, 0.8, 1.0, 1.25, 1.5, 2.0],
speedValueIndex: 2,
playSpeed: '1.0', //播放倍速 可取值0.5/0.8/1.0/1.25/1.5/2.0
stringObject: (data) => {
return typeof(data)
},
innerAudioContext: uni.createInnerAudioContext()
}
},
async mounted() {
this.innerAudioContext.src = typeof(this.src) == 'string' ? this.src : this.src[0];
if (this.autoplay) {
if (!this.src) return console.error('src cannot be emptyThe target value is string or array')
// #ifdef H5
var ua = window.navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
const jweixin = require('../../utils/jweixin');
jweixin.config({});
jweixin.ready(() => {
WeixinJSBridge.invoke('getNetworkType', {}, (e) => {
this.innerAudioContext.play();
})
})
}
// #endif
// #ifndef H5
this.innerAudioContext.autoplay = true;
// #endif
}
//音频播放事件
this.innerAudioContext.onPlay(() => {
this.isPlaying = true;
this.$emit('audioPlay')
this.$emit('change', {
state: true
});
setTimeout(() => {
this.maxSliderIndex = parseFloat(this.innerAudioContext.duration).toFixed(2);
}, 100)
});
//音频暂停事件
this.innerAudioContext.onPause(() => {
this.$emit('audioPause');
this.$emit('change', {
state: false
});
});
//音频自然播放结束事件
this.innerAudioContext.onEnded(() => {
this.isPlaying = !this.isPlaying;
this.$emit('audioEnd');
if (this.isLoop) {
this.changePlayProgress(0);
this.innerAudioContext.play();
}
});
//音频进入可以播放状态,但不保证后面可以流畅播放
this.innerAudioContext.onCanplay((event) => {
this.IsReadyPlay = true;
this.$emit('audioCanplay');
let duration = this.innerAudioContext.duration;
//console.log('总时长', duration)
//将当前音频长度秒转换为000000格式
this.totalTimeText = this.getFormateTime(duration);
this.maxSliderIndex = parseFloat(duration).toFixed(2);
//console.log(this.getFormateTime(duration))
//console.log('总时长1', this.totalTimeText)
//防止视频无法正确获取时长
setTimeout(() => {
duration = this.innerAudioContext.duration;
//将当前音频长度秒转换为000000格式
this.totalTimeText = this.getFormateTime(duration);
this.maxSliderIndex = parseFloat(duration).toFixed(2);
//console.log('总时长2', this.totalTimeText)
}, 300)
});
//音频播放错误事件
this.innerAudioContext.onTimeUpdate((res) => {
this.sliderIndex = parseFloat(this.innerAudioContext.currentTime).toFixed(2);
this.currentTimeText = this.getFormateTime(this.innerAudioContext.currentTime);
});
//音频播放错误事件
this.innerAudioContext.onError((res) => {
console.log(res.errMsg);
console.log(res.errCode);
this.$emit('change', {
state: false
});
this.audioPause();
this.$emit('audioError', res);
});
},
methods: {
//销毁innerAudioContext()实例
audioDestroy() {
if (this.innerAudioContext) {
this.innerAudioContext.destroy();
this.isPlaying = false;
}
},
//点击变更播放状态
handleChangeAudioState() {
if (this.isPlaying && !this.innerAudioContext.paused) {
this.audioPause();
} else {
this.audioPlay();
}
},
//开始播放
audioPlay() {
this.innerAudioContext.play();
this.isPlaying = true;
},
//暂停播放
audioPause() {
this.innerAudioContext.pause();
this.isPlaying = false;
},
//变更滑块位置
handleSliderChange(e) {
this.changePlayProgress(e.detail ? e.detail.value : e)
},
//更改播放倍速
handleChageSpeed() {
//获取播放倍速列表长度
let speedCount = this.speedValue.length;
//如果当前是最大倍速,从-1开始
if (this.speedValueIndex == (speedCount - 1)) {
this.speedValueIndex = -1;
}
//最新倍速序号
this.speedValueIndex += 1;
//获取最新倍速文字
this.playSpeed = this.speedValue[this.speedValueIndex].toFixed(1);
//暂停播放
this.audioPause();
//变更播放倍速
this.innerAudioContext.playbackRate(this.speedValue[this.speedValueIndex]);
//开始播放
this.audioPlay();
},
//快退15秒
handleFastRewind() {
if (this.IsReadyPlay) {
let value = parseInt(this.sliderIndex) - 15;
this.changePlayProgress(value >= 0 ? value : 0);
}
},
//快进15秒
handleFastForward() {
if (this.IsReadyPlay) {
let value = parseInt(this.sliderIndex) + 15;
this.changePlayProgress(value <= this.innerAudioContext.duration ? value : this.innerAudioContext
.duration);
}
},
//开启循环播放
handleLoopPlay() {
this.isLoop = !this.isLoop;
if (this.isLoop) {
uni.showToast({
title: '已开启循环播放',
duration: 1000
});
} else {
uni.showToast({
title: '取消循环播放',
duration: 1000
});
}
},
//更改播放进度
changePlayProgress(value) {
this.innerAudioContext.seek(value);
this.sliderIndex = value;
this.currentTimeText = this.getFormateTime(value);
},
//秒转换为00:00:00
getFormateTime(time) {
let ms = time * 1000; // 1485000毫秒
let date = new Date(ms);
// 注意这里是使用的getUTCHours()方法转换成UTC(协调世界时)时间的小时
let hour = date.getUTCHours();
// let hour = date.getHours(); 如果直接使用getHours()方法则得到的时分秒格式会多出来8个小时在国内开发基本都是使用的是东八区时间getHours()方法会把当前的时区给加上。
let minute = date.getMinutes();
let second = date.getSeconds();
let formatTime =
`${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}:${second.toString().padStart(2, '0')}`;
return formatTime;
},
handleCollec() {
this.$emit('audioCollec');
},
handleShare() {
this.$emit('audioShare');
},
},
onUnload() {
this.audioDestroy()
},
onHide() {
this.audioDestroy()
},
beforeDestroy() {
this.audioDestroy()
}
}
</script>
<style lang="scss" scoped>
.audio_container {
box-shadow: 0 0 10rpx #c3c3c3;
padding: 30rpx 20rpx 30rpx 20rpx;
.audio-title {
font-size: 28rpx;
}
.uni-noticebar {
padding: 0px;
padding-right: 50rpx;
margin-bottom: 0px;
display: inline-block;
}
.audio-subTitle {
width: 100%;
text-align: left;
font-size: 40rpx;
color: blue;
}
.speed-text {
position: absolute;
top: 0rpx;
left: 30rpx;
right: 0;
color: #475266;
font-size: 16rpx;
font-weight: 600;
}
.uni-grid-icon {
text-align: center;
}
}
</style>

View File

@@ -0,0 +1,422 @@
<template>
<view class="audio_container">
<!-- video标签 -->
<video id="videoPlayer" ref="videoPlayer" :src="src" :autoplay="autoplay" :muted="false"
style="width: 1rpx;height:1rpx;opacity: .1;" class="videoPlay" @loadedmetadata="onCanplay"
@timeupdate="onTimeUpdate" @error="errorFn" ></video>
<view class="audio-title"
style="width: 100%; text-align: left; font-size: 36rpx;font-weight: bold;padding: 0rpx 0rpx;position: relative;">
<uni-notice-bar single :scrollable="titleScroll" :size="titleFontSize"
:background-color="titleBackgroundColor" :color="titleColor" :speed="titleScrollSpeed" :text="title" style="padding-right: 50rpx;">
</uni-notice-bar>
<uni-icons v-show="isCollectBtn" @click="handleCollec" type="heart" size="20" style="color:#848484; position: absolute;top: 0rpx;right: 0px;" ></uni-icons>
</view>
<view class="audio-subTitle"
:style="'font-size: '+subTitleFontSize+';font-weight: bold;padding: 0rpx 0rpx 4rpx 0rpx;position: relative;'">
<uni-notice-bar single :scrollable="titleScroll" :size="titleFontSize"
:background-color="titleBackgroundColor" :color="subTitleColor" :speed="titleScrollSpeed"
:text="subTitle" style="padding-right: 50rpx;">
</uni-notice-bar>
<uni-icons v-show="isShareBtn" @click="handleShare" type="redo" size="20" style="color:#848484;position: absolute;top: 0rpx;right: 0px;" ></uni-icons>
</view>
<view>
<slider :backgroundColor='backgroundColor' :activeColor='activeColor' @change="handleSliderChange"
:value="sliderIndex" :max="maxSliderIndex" block-color="#343434" block-size="16" />
</view>
<view style="padding: 0rpx 15rpx 0rpx 15rpx ; display: block; ">
<view style="float: left; font-size: 20rpx;color:#848484;">
{{currentTimeText}}
</view>
<view style="float: right;font-size: 20rpx;color:#848484;">
{{totalTimeText}}
</view>
</view>
<view style="margin-top: 70rpx;">
<uni-grid :column="5" :showBorder="false" :square="false">
<uni-grid-item>
<view class="uni-grid-icon">
<image @tap="handleChageSpeed" src="../../static/images/multiple.svg"
style="width: 48rpx;height: 48rpx;top:6rpx;">
<text class="speed-text">{{playSpeed}}</text>
</image>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="uni-grid-icon">
<image @tap="handleFastRewind" src="../../static/images/get-back.svg"
style="width: 48rpx;height: 48rpx;top:6rpx;">
</image>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="uni-grid-icon">
<image @tap="handleChangeAudioState" v-show="!isPlaying" src="../../static/images/play.svg"
style="width: 48rpx;height: 48rpx;top:6rpx;">
</image>
<image @tap="handleChangeAudioState" v-show="isPlaying" src="../../static/images/pause.svg"
style="width: 48rpx;height: 48rpx;top:6rpx;">
</image>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="uni-grid-icon">
<image @tap="handleFastForward" src="../../static/images/fast-forward.svg"
style="width: 48rpx;height: 48rpx;top:6rpx;">
</image>
</view>
</uni-grid-item>
<uni-grid-item>
<view class="uni-grid-icon">
<image @tap="handleLoopPlay" src="../../static/images/Loop.svg"
style="width: 48rpx;height: 48rpx; top:6rpx; ">
</image>
</view>
</uni-grid-item>
</uni-grid>
</view>
</view>
</template>
<script>
export default {
name: 'my-video',
//audioPlay开始播放
//audioPause停止播放
//audioEnd音频自然播放结束事件
//audioCanplay音频进入可以播放状态但不保证后面可以流畅播放
//change播放状态改变 返回值false停止播放 true开始播放
emits: ['audioPlay', 'audioPause', 'audioEnd', 'audioCanplay', 'change'],
props: {
//标题文字
title: {
type: String,
default: ''
},
//标题默认字体大小
titleFontSize: {
type: Number,
default: 35
},
//标题文字颜色
titleColor: {
type: String,
default: '#303030'
},
//标题背景色
titleBackgroundColor: {
type: String,
default: 'white'
},
//标题是否滚动
titleScroll: {
type: Boolean,
default: false
},
//标题滚动速度
titleScrollSpeed: {
type: Number,
default: 100
},
subTitle: {
type: String,
default: ''
},
subTitleColor: {
type: String,
default: '#6C7996'
},
subTitleFontSize: {
type: String,
default: "30rpx"
},
autoplay: {
type: Boolean,
default: false
},
//滑块左侧已选择部分的线条颜色
activeColor: {
type: String,
default: '#7C7C7C'
},
//滑块右侧背景条的颜色
backgroundColor: {
type: String,
default: '#E5E5E5'
},
//音频地址
src: {
type: [String, Array],
default: ''
},
//是否倒计时
isCountDown: {
type: Boolean,
default: false
},
//音乐封面
audioCover: {
type: String,
default: ''
},
//是否显示收藏按钮
isCollectBtn: {
type: Boolean,
default: false
},
//是否显示分享按钮
isShareBtn: {
type: Boolean,
default: false
},
},
data() {
return {
totalTimeText: '00:00', //视频总长度文字
currentTimeText: '00:00:00', //视频已播放长度文字
isPlaying: false, //播放状态
sliderIndex: 0, //滑块当前值
maxSliderIndex: 100, //滑块最大值
IsReadyPlay: false, //是否已经准备好可以播放了
isLoop: false, //是否循环播放
speedValue:[0.5,0.8,1.0,1.25,1.5,2.0],
speedValueIndex:2,
playSpeed: '1.0', //播放倍速 可取值0.5/0.8/1.0/1.25/1.5/2.0
stringObject: (data) => {
return typeof(data)
},
innerAudioContext: null,
// 后台音频控制器
backAudio:null,
}
},
created() {
// 获取 video 对象
this.innerAudioContext = uni.createVideoContext("videoPlayer", this);
},
async mounted() {
this.innerAudioContext.src = typeof(this.src) == 'string' ? this.src : this.src[0];
},
methods: {
//音频进入可以播放状态,但不保证后面可以流畅播放
onCanplay(e){
this.IsReadyPlay = true;
let duration=e.detail.duration;
this.$emit('audioCanplay');
//将当前音频长度秒转换为000000格式
this.totalTimeText = this.getFormateTime(duration);
this.maxSliderIndex = parseFloat(duration).toFixed(2);
// #ifdef MP
this.totalTimeText = parseFloat(duration).toFixed(2);
this.maxSliderIndex = parseFloat(duration).toFixed(2);
// #endif
},
// 音频播放事件处理函数 (持续触发) - 获取当前播放时长
onTimeUpdate(e) {
this.sliderIndex = parseFloat(e.detail.currentTime).toFixed(2);
this.currentTimeText = this.getFormateTime(e.detail.currentTime);
//如果已经播放到结尾,回到音频开始
if(this.sliderIndex==this.maxSliderIndex)
{
let prevState=this.isPlaying;
this.sliderIndex=0;
this.changePlayProgress(0);
this.audioPause();
//如果开启循环播放,且结束前还是播放状态
if(this.isLoop && prevState)
{
this.audioPlay();
}
}
},
//销毁innerAudioContext()实例
audioDestroy() {
if (this.innerAudioContext) {
this.innerAudioContext=null;
this.isPlaying = false;
}
},
//点击变更播放状态
handleChangeAudioState() {
if (this.isPlaying && !this.innerAudioContext.paused) {
this.audioPause();
} else {
this.audioPlay();
}
},
//开始播放
audioPlay(){
this.innerAudioContext.play();
this.isPlaying=true;
this.$emit('audioPlay')
this.$emit('change', {
state: true
});
},
//暂停播放
audioPause(){
this.innerAudioContext.pause();
this.isPlaying=false;
this.$emit('audioPause');
this.$emit('change', {
state: false
});
},
//变更滑块位置
handleSliderChange(e) {
this.changePlayProgress(e.detail ? e.detail.value : e)
},
//更改播放倍速
handleChageSpeed(){
//获取播放倍速列表长度
let speedCount=this.speedValue.length;
//如果当前是最大倍速,从-1开始
if(this.speedValueIndex==(speedCount-1))
{
this.speedValueIndex=-1;
}
//最新倍速序号
this.speedValueIndex+=1;
//获取最新倍速文字
this.playSpeed=this.speedValue[this.speedValueIndex].toFixed(1);
//暂停播放
this.audioPause();
//变更播放倍速
this.innerAudioContext.playbackRate(this.speedValue[this.speedValueIndex]);
//开始播放
this.audioPlay();
},
//快退15秒
handleFastRewind() {
if (this.IsReadyPlay) {
let value = parseInt(this.sliderIndex) - 15;
this.changePlayProgress(value >= 0 ? value : 0);
}
},
//快进15秒
handleFastForward() {
if (this.IsReadyPlay) {
let value = parseInt(this.sliderIndex) + 15;
this.changePlayProgress(value <= this.maxSliderIndex ? value : this.maxSliderIndex);
}
},
//开启循环播放
handleLoopPlay() {
this.isLoop = !this.isLoop;
if (this.isLoop) {
uni.showToast({
title: '已开启循环播放',
duration: 1000
});
}
else{
uni.showToast({
title: '取消循环播放',
duration: 1000
});
}
},
//更改播放进度
changePlayProgress(value) {
this.innerAudioContext.seek(value);
this.sliderIndex = value;
this.currentTimeText = this.getFormateTime(value);
},
//秒转换为00:00:00
getFormateTime(time) {
let ms = time * 1000; // 1485000毫秒
let date = new Date(ms);
// 注意这里是使用的getUTCHours()方法转换成UTC(协调世界时)时间的小时
let hour = date.getUTCHours();
// let hour = date.getHours(); 如果直接使用getHours()方法则得到的时分秒格式会多出来8个小时在国内开发基本都是使用的是东八区时间getHours()方法会把当前的时区给加上。
let minute = date.getMinutes();
let second = date.getSeconds();
let formatTime =
`${hour.toString().padStart(2, '0')}:${minute.toString().padStart(2, '0')}:${second.toString().padStart(2, '0')}`;
return formatTime;
},
handleCollec(){
this.$emit('audioCollec');
},
handleShare(){
this.$emit('audioShare');
},
errorFn(){
this.$emit('change', {
state: false
});
this.audioPause();
this.$emit('error');
}
},
onUnload() {
this.audioDestroy()
},
onHide() {
this.audioDestroy()
},
beforeDestroy() {
this.audioDestroy()
}
}
</script>
<style lang="scss" scoped>
.audio_container {
box-shadow: 0 0 10rpx #c3c3c3;
padding: 15rpx 15rpx 40rpx 15rpx;
.audio-title {
font-size: 28rpx;
}
.uni-noticebar {
padding: 0px;
}
.audio-subTitle {
width: 100%;
text-align: left;
font-size: 40rpx;
color: blue;
}
.speed-text {
position: absolute;
top: 0rpx;
left: 30rpx;
right: 0;
color: #475266;
font-size: 16rpx;
font-weight: 600;
}
.uni-grid-icon {
text-align: center;
}
}
</style>

View File

@@ -402,4 +402,4 @@ module.exports = {
checkSystemEnableLocation: checkSystemEnableLocation,
gotoAppPermissionSetting: gotoAppPermissionSetting,
premissionCheck: premissionCheck
}
}

View File

@@ -0,0 +1,272 @@
/**
* 本模块封装了Android、iOS的应用权限判断、打开应用权限设置界面、以及位置系统服务是否开启
*/
var isIos
// #ifdef APP-PLUS
isIos = (plus.os.name == "iOS")
// #endif
// 判断推送权限是否开启
function judgeIosPermissionPush() {
var result = false;
var UIApplication = plus.ios.import("UIApplication");
var app = UIApplication.sharedApplication();
var enabledTypes = 0;
if (app.currentUserNotificationSettings) {
var settings = app.currentUserNotificationSettings();
enabledTypes = settings.plusGetAttribute("types");
console.log("enabledTypes1:" + enabledTypes);
if (enabledTypes == 0) {
console.log("推送权限没有开启");
} else {
result = true;
console.log("已经开启推送功能!")
}
plus.ios.deleteObject(settings);
} else {
enabledTypes = app.enabledRemoteNotificationTypes();
if (enabledTypes == 0) {
console.log("推送权限没有开启!");
} else {
result = true;
console.log("已经开启推送功能!")
}
console.log("enabledTypes2:" + enabledTypes);
}
plus.ios.deleteObject(app);
plus.ios.deleteObject(UIApplication);
return result;
}
// 判断定位权限是否开启
function judgeIosPermissionLocation() {
var result = false;
var cllocationManger = plus.ios.import("CLLocationManager");
var status = cllocationManger.authorizationStatus();
result = (status != 2)
console.log("定位权限开启:" + result);
// 以下代码判断了手机设备的定位是否关闭,推荐另行使用方法 checkSystemEnableLocation
/* var enable = cllocationManger.locationServicesEnabled();
var status = cllocationManger.authorizationStatus();
console.log("enable:" + enable);
console.log("status:" + status);
if (enable && status != 2) {
result = true;
console.log("手机定位服务已开启且已授予定位权限");
} else {
console.log("手机系统的定位没有打开或未给予定位权限");
} */
plus.ios.deleteObject(cllocationManger);
return result;
}
// 判断麦克风权限是否开启
function judgeIosPermissionRecord() {
var result = false;
var avaudiosession = plus.ios.import("AVAudioSession");
var avaudio = avaudiosession.sharedInstance();
var permissionStatus = avaudio.recordPermission();
console.log("permissionStatus:" + permissionStatus);
if (permissionStatus == 1684369017 || permissionStatus == 1970168948) {
console.log("麦克风权限没有开启");
} else {
result = true;
console.log("麦克风权限已经开启");
}
plus.ios.deleteObject(avaudiosession);
return result;
}
// 判断相机权限是否开启
function judgeIosPermissionCamera() {
var result = false;
var AVCaptureDevice = plus.ios.import("AVCaptureDevice");
var authStatus = AVCaptureDevice.authorizationStatusForMediaType('vide');
console.log("authStatus:" + authStatus);
if (authStatus == 3) {
result = true;
console.log("相机权限已经开启");
} else {
console.log("相机权限没有开启");
}
plus.ios.deleteObject(AVCaptureDevice);
return result;
}
// 判断相册权限是否开启
function judgeIosPermissionPhotoLibrary() {
var result = false;
var PHPhotoLibrary = plus.ios.import("PHPhotoLibrary");
var authStatus = PHPhotoLibrary.authorizationStatus();
console.log("authStatus:" + authStatus);
if (authStatus == 3) {
result = true;
console.log("相册权限已经开启");
} else {
console.log("相册权限没有开启");
}
plus.ios.deleteObject(PHPhotoLibrary);
return result;
}
// 判断通讯录权限是否开启
function judgeIosPermissionContact() {
var result = false;
var CNContactStore = plus.ios.import("CNContactStore");
var cnAuthStatus = CNContactStore.authorizationStatusForEntityType(0);
if (cnAuthStatus == 3) {
result = true;
console.log("通讯录权限已经开启");
} else {
console.log("通讯录权限没有开启");
}
plus.ios.deleteObject(CNContactStore);
return result;
}
// 判断日历权限是否开启
function judgeIosPermissionCalendar() {
var result = false;
var EKEventStore = plus.ios.import("EKEventStore");
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(0);
if (ekAuthStatus == 3) {
result = true;
console.log("日历权限已经开启");
} else {
console.log("日历权限没有开启");
}
plus.ios.deleteObject(EKEventStore);
return result;
}
// 判断备忘录权限是否开启
function judgeIosPermissionMemo() {
var result = false;
var EKEventStore = plus.ios.import("EKEventStore");
var ekAuthStatus = EKEventStore.authorizationStatusForEntityType(1);
if (ekAuthStatus == 3) {
result = true;
console.log("备忘录权限已经开启");
} else {
console.log("备忘录权限没有开启");
}
plus.ios.deleteObject(EKEventStore);
return result;
}
// Android权限查询
function requestAndroidPermission(permissionID) {
return new Promise((resolve, reject) => {
plus.android.requestPermissions(
[permissionID], // 理论上支持多个权限同时查询,但实际上本函数封装只处理了一个权限的情况。有需要的可自行扩展封装
function(resultObj) {
var result = 0;
for (var i = 0; i < resultObj.granted.length; i++) {
var grantedPermission = resultObj.granted[i];
console.log('已获取的权限:' + grantedPermission);
result = 1
}
for (var i = 0; i < resultObj.deniedPresent.length; i++) {
var deniedPresentPermission = resultObj.deniedPresent[i];
console.log('拒绝本次申请的权限:' + deniedPresentPermission);
result = 0
}
for (var i = 0; i < resultObj.deniedAlways.length; i++) {
var deniedAlwaysPermission = resultObj.deniedAlways[i];
console.log('永久拒绝申请的权限:' + deniedAlwaysPermission);
result = -1
}
resolve(result);
// 若所需权限被拒绝,则打开APP设置界面,可以在APP设置界面打开相应权限
// if (result != 1) {
// gotoAppPermissionSetting()
// }
},
function(error) {
console.log('申请权限错误:' + error.code + " = " + error.message);
resolve({
code: error.code,
message: error.message
});
}
);
});
}
// 使用一个方法,根据参数判断权限
function judgeIosPermission(permissionID) {
if (permissionID == "location") {
return judgeIosPermissionLocation()
} else if (permissionID == "camera") {
return judgeIosPermissionCamera()
} else if (permissionID == "photoLibrary") {
return judgeIosPermissionPhotoLibrary()
} else if (permissionID == "record") {
return judgeIosPermissionRecord()
} else if (permissionID == "push") {
return judgeIosPermissionPush()
} else if (permissionID == "contact") {
return judgeIosPermissionContact()
} else if (permissionID == "calendar") {
return judgeIosPermissionCalendar()
} else if (permissionID == "memo") {
return judgeIosPermissionMemo()
}
return false;
}
// 跳转到**应用**的权限页面
function gotoAppPermissionSetting() {
if (isIos) {
var UIApplication = plus.ios.import("UIApplication");
var application2 = UIApplication.sharedApplication();
var NSURL2 = plus.ios.import("NSURL");
// var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
var setting2 = NSURL2.URLWithString("app-settings:");
application2.openURL(setting2);
plus.ios.deleteObject(setting2);
plus.ios.deleteObject(NSURL2);
plus.ios.deleteObject(application2);
} else {
// console.log(plus.device.vendor);
var Intent = plus.android.importClass("android.content.Intent");
var Settings = plus.android.importClass("android.provider.Settings");
var Uri = plus.android.importClass("android.net.Uri");
var mainActivity = plus.android.runtimeMainActivity();
var intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
var uri = Uri.fromParts("package", mainActivity.getPackageName(), null);
intent.setData(uri);
mainActivity.startActivity(intent);
}
}
// 检查系统的设备服务是否开启
// var checkSystemEnableLocation = async function () {
function checkSystemEnableLocation() {
if (isIos) {
var result = false;
var cllocationManger = plus.ios.import("CLLocationManager");
var result = cllocationManger.locationServicesEnabled();
console.log("系统定位开启:" + result);
plus.ios.deleteObject(cllocationManger);
return result;
} else {
var context = plus.android.importClass("android.content.Context");
var locationManager = plus.android.importClass("android.location.LocationManager");
var main = plus.android.runtimeMainActivity();
var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
var result = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER);
console.log("系统定位开启:" + result);
return result
}
}
module.exports = {
judgeIosPermission: judgeIosPermission,
requestAndroidPermission: requestAndroidPermission,
checkSystemEnableLocation: checkSystemEnableLocation,
gotoAppPermissionSetting: gotoAppPermissionSetting
}

View File

@@ -49,7 +49,8 @@
font-size: 26rpx;
font-weight: 700;
">
<text style="font-size: 20rpx">免费</text>
<text style="font-size: 20rpx" v-if="slotProps.row.courseCatalogueEntityList[0].type==2">超 V 专享</text>
<text style="font-size: 20rpx" v-else>免费</text>
</view>
</view>
<view class="curriculum_tag_info_box price_box" v-else>

View File

@@ -137,4 +137,4 @@
// margin-bottom: 10rpx;
// }
}
</style>
</style>

View File

@@ -1735,4 +1735,4 @@
.highlight {
color: $uni-color-primary;
}
</style>
</style>

1
static/images/Loop.svg Normal file
View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1703664219110" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7586" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M46.08 272.213333a42.666667 42.666667 0 0 0 8.96 14.08l128 128a42.666667 42.666667 0 0 0 60.586667 0 42.666667 42.666667 0 0 0 0-60.586666L188.16 298.666667H704a192.426667 192.426667 0 0 1 192 192 42.666667 42.666667 0 0 0 85.333333 0A277.76 277.76 0 0 0 704 213.333333H188.16l55.466667-55.04a42.666667 42.666667 0 0 0-60.586667-60.586666l-128 128a42.666667 42.666667 0 0 0-8.96 14.08 42.666667 42.666667 0 0 0 0 32.426666zM977.92 751.786667a42.666667 42.666667 0 0 0-8.96-14.08l-128-128a42.666667 42.666667 0 0 0-60.586667 60.586666l55.466667 55.04H320A192.426667 192.426667 0 0 1 128 533.333333a42.666667 42.666667 0 0 0-85.333333 0A277.76 277.76 0 0 0 320 810.666667h515.84l-55.466667 55.04a42.666667 42.666667 0 0 0 0 60.586666 42.666667 42.666667 0 0 0 60.586667 0l128-128a42.666667 42.666667 0 0 0 8.96-14.08 42.666667 42.666667 0 0 0 0-32.426666z" p-id="7587" fill="#3d3d3d"></path></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.a,.b{fill:none;}.b{stroke:#3d3d3d;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-width:1.5px;}.c{}</style></defs><rect class="a" width="24" height="24"/><path class="b" d="M1515.681,625a8,8,0,1,1,0-8v-4" transform="translate(-1496.22 -609)"/><path class="c" d="M3.17,0V-7.12H1.83L.74-6.27v1.5l1.09-.78V0ZM7.95-2.47a3.4,3.4,0,0,0-.33-1.9,1.206,1.206,0,0,0-1.04-.45,1.135,1.135,0,0,0-.51.13,1.407,1.407,0,0,0-.39.34V-5.92H7.87v-1.2H4.46v4.04H5.74v-.05c0-.33.18-.49.42-.49a.389.389,0,0,1,.36.21,3.037,3.037,0,0,1,.09,1.07,3.166,3.166,0,0,1-.12,1.22.359.359,0,0,1-.33.16c-.24,0-.42-.16-.42-.49v-.49H4.4v.28A1.579,1.579,0,0,0,4.89-.38,1.822,1.822,0,0,0,6.16.08,1.869,1.869,0,0,0,7.43-.38,2.647,2.647,0,0,0,7.95-2.47Z" transform="translate(8.26 15.52)"/><rect class="c" width="5.5" height="1.5" rx="0.75" transform="translate(17.5 11.23)"/><rect class="c" width="5.5" height="1.5" rx="0.75" transform="translate(21 9.23) rotate(90)" /></svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.a,.b{fill:none;}.b{stroke:#475266;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:10;stroke-width:1.5px;}.c{color:'#3d3d3d'}</style></defs><rect class="a" width="24" height="24"/><g transform="translate(-1496.22 -609)"><path class="b" d="M1500.76,625a8,8,0,1,0,0-8v-4"/></g><path class="c" d="M3.17,0V-7.12H1.83L.74-6.27v1.5l1.09-.78V0ZM7.95-2.47a3.4,3.4,0,0,0-.33-1.9,1.206,1.206,0,0,0-1.04-.45,1.135,1.135,0,0,0-.51.13,1.407,1.407,0,0,0-.39.34V-5.92H7.87v-1.2H4.46v4.04H5.74v-.05c0-.33.18-.49.42-.49a.389.389,0,0,1,.36.21,3.037,3.037,0,0,1,.09,1.07,3.166,3.166,0,0,1-.12,1.22.359.359,0,0,1-.33.16c-.24,0-.42-.16-.42-.49v-.49H4.4v.28A1.579,1.579,0,0,0,4.89-.38,1.822,1.822,0,0,0,6.16.08,1.869,1.869,0,0,0,7.43-.38,2.647,2.647,0,0,0,7.95-2.47Z" transform="translate(7 15.5)"/><rect class="c" width="4.5" height="1.5" rx="0.75" transform="translate(2 11.23)"/></svg>

After

Width:  |  Height:  |  Size: 975 B

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><defs><style>.a{fill:none;}.b,.c{fill:#475266;}.c{font-size:8px;font-family:PingFangSC-Semibold, PingFang SC;font-weight:600;letter-spacing:-0.02em;}</style></defs><rect class="a" width="24" height="24"/><path class="b" d="M1530.26,598.75V604a2.5,2.5,0,0,1-2.5,2.5h-16a2.5,2.5,0,0,1-2.5-2.5V594a2.5,2.5,0,0,1,2.5-2.5h7.25a.75.75,0,0,0,.75-.75h0a.75.75,0,0,0-.75-.75h-7.25a4,4,0,0,0-4,4v10a4,4,0,0,0,4,4h16a4,4,0,0,0,4-4v-5.25a.75.75,0,0,0-.75-.75h0A.75.75,0,0,0,1530.26,598.75Z" transform="translate(-1507.76 -587)"/><text class="c" transform="translate(4 15)"><tspan x="0" y="0">倍速</tspan></text></svg>

After

Width:  |  Height:  |  Size: 690 B

1
static/images/pause.svg Normal file
View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1703643608574" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7023" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M256 810.666667h170.666667V213.333333H256v597.333334z m341.333333-597.333334v597.333334h170.666667V213.333333h-170.666667z" p-id="7024"></path></svg>

After

Width:  |  Height:  |  Size: 482 B

1
static/images/play.svg Normal file
View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1703643757308" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8148" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M820.053 473.316l-527.929-327.68c-29.582-18.205-68.266 4.55-68.266 38.684v655.36c0 34.133 38.684 56.889 68.266 38.684l525.654-327.68c31.858-15.928 31.858-61.44 2.275-77.368z" p-id="8149"></path></svg>

After

Width:  |  Height:  |  Size: 533 B

1
static/images/定时.svg Normal file
View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1703642624873" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5229" xmlns:xlink="http://www.w3.org/1999/xlink" width="128" height="128"><path d="M878.885769 568.138291c0 201.397023-163.248995 364.646017-364.646017 364.646017S149.485359 769.535314 149.485359 568.138291c0-192.076766 148.582234-349.076131 336.901997-363.309391 0-0.4335-0.252875-0.903126-0.252875-1.408876V147.353983h-112.168207c-15.497636 0-28.033021-12.535384-28.033021-28.105271 0-15.497636 12.535384-28.033021 28.033021-28.03302h280.51083c15.461511 0 28.105271 12.535384 28.105271 28.03302 0 15.569886-12.643759 28.105271-28.105271 28.105271h-112.168207V203.383899c0 0.541875-0.252875 0.975376-0.252875 1.408876 188.247513 14.269385 336.829747 171.26875 336.829747 363.345516zM514.239752 259.52219c-170.437875 0-308.616101 138.142101-308.616101 308.616101s138.142101 308.616101 308.616101 308.616101c170.365625 0 308.507726-138.142101 308.507726-308.616101s-138.142101-308.616101-308.507726-308.616101z m0 392.787413c-46.529034 0-84.171312-37.714528-84.171312-84.171312 0-36.558527 23.481267-67.445424 56.029916-79.005433V343.693502c0-15.497636 12.535384-28.033021 28.105271-28.033021 15.497636 0 28.033021 12.535384 28.03302 28.033021v145.439356c32.657024 11.560008 56.138291 42.446906 56.138291 79.005433 0 46.456784-37.714528 84.171312-84.135186 84.171312z" p-id="5230"></path></svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -8,7 +8,7 @@ export default function() {
appVersion: plus.runtime.version,
wgtVersion: widgetInfo.version
}
console.log("data: ",data);
console.log("获取当前版本信息data: ",data);
uniCloud.callFunction({
name: 'uni-upgrade-center',
data,

View File

@@ -1,678 +0,0 @@
<!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

@@ -1,284 +0,0 @@
<!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+KpfVPePBmifKqvviZsPait/fS3PtUe/F6mfT8/f7s8P2Xr/bX4PuWrvbI1fqdtPfq7/3t8f3E0vqCn/RRefCzxPjK1vpwkfPP2vtVfPHR2/tDbu+BnvTr8P3G0/qLpvXW3/uOqPXL1/rf5vyht/eDn/Rzk/OPqfWQqfXZ4vuGovX19/67y/nm7Pymuvc+au9hhfKluvfU3vt3lvO3yPlpjPJykvN2lfNQePB7mfSsv/ju8v18mvTO2fvv8/22x/nr7/2cs/aMpvXn7P3D0fp+nPR5mPTE0frj6fyftfdcgfFfhPHN2Prx9P1ihvJ2lvO/zvm9zPl0lPOHo/VsjvKovPeQqvX09v6TrPZ1lfOUrfZnivKVrfbM2PrAzvmuwfi1xvjC0Pri6fzz9v59m/T8d63OAAAAM3RSTlMA7GNUSf4p38bFFC3nN7Id75oI/eI4BIv7B9Kl9fnCQLs1ossSG2sBS/p7rJlYuLmYrcSkuUTkAAAGJElEQVR4XsWbVXvbShBAJbumJE0abp0mbdI23KS9M4YgM0ORmZmZmZkZLjMzMzPDb7m2NvJnx8p6pVjd86J18nA+raSFmVlBNXGRxtyMApvdIqamiha7rSAj1xgZJ+iLOTPPEo8KxFvyMs06SSMMKVFIJSrFEBFu6zBjdA4ykBNtHBZGbfq4IcjMkHHpYdKOGIkqGTkiDNpBNtSAbdAAtYNHoUZGDRa0MzrWhJoxxY7WqM0yiDggREOWFm9MGg6YtBj13mwRw4CYrVKblGzCsGBKTlLjHWPFsGEdw+41J2AYSWCePRJFDCtiIuNYNRzDzHCmcWzsUAw7Q8cy3C/xhtsc8p4T1fbz7TUXmXo7xHM2i6iSb2Hus8iAaKZ+vwmoXgzwYQnLV0X5npOsqEkM9QcdGBJr/2NYMmoUA9zswZAk9zsvmLSJCc+txBCYspW9MSIORAyd7xQjHVFxlsxKQ+1iwrUipJOmtDIw4IDF0PFKNVIxKKyvWDu68vbEQ2+5OnxAAAc2Iw0xeB0Wi0zsnb8f6NyYghRig9axJmSguHkhhGRh8zTKm9131cu0fq6uAAY6tyGFUX3mJGTAXQYMvLkSqQTOUzZk4GsGbdsmDMEjAfsyZGAbEFrbz253FMuUgh/zDjOM2f47Opb9YO1xIqjY3u93vKABGRgp+EhHBnYRQWMx9iN+/EVkI90nzkcG2iTBMw5UFi+85UZG8mXvMJb9/iQi2IHK4s+6kJkhcrTCyD4mlyn//fglVINRIEQjA29L4t1K4o72CaiKaOKNyEEGlkjibQriQ0WokpwIFfNhtyQOnnteXkaZ/umzY4pWsXZSJHHUwxdHeb1mfPhiNHvEmTzEmR7xeB7iPI/YwkNsEYS4eB7i+DghEnmIMVIw8hEbhVw+4lwhg484QyjkIy4UrHzEVsHOR2wXLHzEFkHkIxaFVD7iVG5i5q4u2ujlpfB1tQW5YBHsyAW7YEMu2IQC5EKBkIFcyBBykQu5ghG5YGRZ+qzasmUV+uFYhzJfrrmKmohkWexNAfAPmk17b+kHcns9fIQ+znf2ZSVlsSdY1IonnIP9pUjY4f+vWdCXyZTlrZBHCeQRugC6epuSYOt8gIO4eo6Hza2waI6XvUTcs8FDBVR4L99QxHnULcwmCOIplGiEN1YsB3+mS2Ji6oZulH9StjBmDeInZ3+K12fKuODyzI3E9HyXhytwxXt5gSI2U7epdUWEfQD7eptuDKbLCatVPuMosjFnerkUOLq8mAQp2lAWz3vUgwtc3ku9JKZszA0qxa894WEZ4kaAI5WILa1QTsTsz9ggB19UiWeDh6mIeM8F7xZhObhKVIpzIqjhpi0ze6kCqJLbpxHn7Nx5RhJjz6uwdNkBaEefuPyehzIo814+7lccTQ+wvQ4KnJEU04kYG8oAoH6V2gHESA8p/lwq0Q7QXOrjToAY3XsA7tcgYfJjhLkwt7dVTQ8p0oOoe4jk7NNICBAf7gCAG7XoQ37GNMYxhY3fJ4HTdU54ECSumQ8w9SjADHJnjl4mwkS5SQsb0wPllcdgsdRYBPWfBIpr71YBLK7BcoD7LYhYAsGUUALl9NTAYmidJDUuNkGb21+863MAkPq/GeDmCnbxCJZkyF3w9fAXLliChOLZ0LT1N3B+tU6elafWITom9XICTshNhb62saR/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

@@ -1,149 +0,0 @@
<!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+1ZbVHEQAx9TwE4ABTcOQAknANQAKcAUAAOAAXgAHAACsDCKQiTmbYDzJZtNt2bFrJ/m6+Xl2yyU2LmhzOPH/8PgIjcADirxNyapNoffMwMiMgzgMPBHmyCLySPLCoBwJKtAbJbYaBmD1yRvBwAtBMxl5DF+DZkiwCIyBLAzsgBbki+Wm2WAlCaL6zOMvKnJO+sNksB7ALQbO1ZHfbIv5FUVs2nCIB6EZETALdmj2mFY5I6X8ynGEADQllYmL1+VzBfnV/VvQB0aj45ARyQ/Ci14QLQsOBZLe5JaikWnzEA7AN4L4hgA2Dpyb76dANwsOCq/TZhASAYKGie0a7R1lDPI0ebtF0NUi+4yfdAtxr3PEMnD6BbD0QkNfACQO05EAwMuaBqDrIVycdmTpwDuP4R0OR7QFftVRP0g+49cwOQq4DJMxAAchmofY3m/EcJBQOZbTRKKJeBKKEoIePvpFRJ1VzmciUccyCa+C81cerBkuuB7sGTE/zt+yhN7AnAqxsAvBn06n8CkyPwMZKwm+UAAAAASUVORK5CYII=';
var onImg =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAB4klEQVRoQ+1ZQU7CUBCdaWVBLFETqUtxB7iQG4hH4AZ4AvUE4gnkBuoJ9AbiDXAhZadby4IQICaS9psqJBVLy5/fkhKHbefPzPvzZv6bgLDmP1zz/OH/ARjZpSYAniVSORQXRt5qyviWrsDQLrUQ8FgmyLK2AsRTzrSqy9p7dgxA5raibFdSgSR7QAi4yu11GlFA/d+lKSTjfBW2JAAj+7Cio7MVZ4KO0AeG+dKW9UkCMHwvNxDhUjZYuL17apjdW1mfJACiX9gef2bbgLgvG3CB/bNhdioUXyQAXqCRXawDaDeUoPNnBLonuXy3RfFFBvADouxx9ogSeHaGMjpjm0LDXrGKQntUAaBn3IPsTveN6kOpAl5QNWkh7gzTqlOTJ0mJ+WAf/WLBmWivskkIEIONjKio3H4sAKhVUOX+7MKUKcQAZLk3Z88VWEQhr0kRYCoN/m5wqe8BvzQOkuDpB+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.

Before

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -1,25 +0,0 @@
<!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

@@ -1,22 +0,0 @@
{
"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

@@ -1 +0,0 @@
(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.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -1,88 +0,0 @@
<!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

@@ -1 +0,0 @@
/*! 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

@@ -1 +0,0 @@
/*! 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

@@ -1 +0,0 @@
/*! 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

@@ -1 +0,0 @@
/*! 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

@@ -1 +0,0 @@
/*! 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

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 774 B

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 986 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 398 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 907 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 856 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 797 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 779 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 822 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

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