一般用Response.Redirect("page.aspx")
或者在前台用脚本
window.location.href='page.aspx'
(说明:appid是小程序的身份z号码,是微信公众平台上的小程序ID,有了它,微信客户端才能确定你的小程序“身份”,并使用微信提供的高级接口。至于appid有什么用,appID就像门牌,AppSecret就像钥匙。AppID可以公开,但是AppSecret必须保密。而且微信官方文档反复强调,AppSecret的安全级别很高,也就是说如果泄露出去安全风险很大,要小心保管。你可以重新生成AppSecret,但是切记重新生成AppSecret前,跟你的程序员或技术外包服务商协调好,程序里如果有用到AppSecret的地方,要同步修改,否则程序会报错。)
(1)需要用户触发跳转,从 2.3.0 版本开始,若用户未点击小程序页面任意位置,则开发者将无法调用此接口自动跳转至其他小程序。
(2)需要用户确认跳转,从 2.3.0 版本开始,在跳转至其他小程序前,将统一增加d窗,询问是否跳转,用户确认后才可以跳转其他小程序。如果用户点击取消,则回调 fail cancel。
(3)无需声明跳转名单,不限跳转数量 (众测中) ,从2020年4月24日起,使用跳转其他小程序功能将无需在全局配置中声明跳转名单,调用此接口时将不再校验所跳转的 AppID 是否在 navigateToMiniProgramAppIdList 中。
从2020年4月24日起,跳转其他小程序将不再受数量限制,使用此功能时请注意遵守运营规范。
3,关于调试
在开发者工具上调用此 API 并不会真实的跳转到另外的小程序,但是开发者工具会校验本次调用跳转是否成功。
开发者工具上支持被跳转的小程序处理接收参数的调试。
4,实例
信息来源微信小程序开发文档
》小程序跳转 wx.navigateToMiniProgram()
》小程序调试支持
推荐你采用JS控制
既然看到送你一个demo吧,自行研究,应该都很详细了
<!doctype html><html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1 user-scalable=0"/>
<link rel="shortcut icon" href="img/logo.png">
<title>html5 audio音频播放</title>
<style>
*{ margin: 0 padding:0}
body{-webkit-tap-highlight-color: rgba(0,0,0,0) font-family: "微软雅黑"}
h1{ width: 100% font-size: 1.5em text-align: center line-height: 3em color:#47c9af }
#audio{ width: 100%}
#control{ width: 150px height: 150px line-height: 150px text-align: center border-radius: 200px border:none color:#fff margin-top: -75px margin-left:-75px left:50% top:50% position: absolute box-shadow: #888 0 0 8px}
.color_gray{ background: #e4e4e4}
.hide{ display: none}
.show{ display: block}
.play{ background: #f06060}
.pause{ background:skyblue}
/*进度条样式*/
.progressBar{ width: 100% height: 10pxmargin: 30px auto 30px auto position:absolute left: 0 bottom: 35px}
.progressBar div{ position: absolute}
.progressBar .progressBac{ width: 100% height: 10px left: 0 top:0 background: #e4e4e4}
.progressBar .speed{width: 100% height: 10px left: -100% background: #f06060 }
.progressBar .drag{ width: 30px height: 30px left: 0 top:-10px background: skyblue opacity: 0.8 border-radius: 50px box-shadow: #fff 0 0 5px}
/*时间样式*/
#time{ width: 100% height: 20pxposition: absolute left: 0 bottom:30px color:#888}
.tiemDetail{ position: absolute right:10px top:0}
#songInfo{overflow: hidden width: 200px height:50px line-height: 50px text-align: center color:#34495e margin-top: -25px margin-left:-100px left:50% top:70% position: absolute}
.shareImg{ position: absolute left: 100000px}
</style>
</head>
<body>
<script>
$(function() {
getSong()
})
//获取歌曲链接并插入dom中
function getSong() {
var audio = document.getElementById("audio")
audio.src = "
audio.loop = true //歌曲循环
playCotrol() //播放控制函数
}
//点击播放/暂停
function clicks() {
var audio = document.getElementById("audio")
$("#control").click(function() {
if ($("#control").hasClass("play")) {
$("#control").addClass("pause").removeClass("play")
audio.play()//开始播放
dragMove()//并且滚动条开始滑动
$("#control").html("暂停播放")
} else {
$("#control").addClass("play").removeClass("pause")
$("#control").html("点击播放")
audio.pause()
}
})
}
//播放时间
function timeChange(time, timePlace) {
var timePlace = document.getElementById(timePlace)
//分钟
var minute = time / 60
var minutes = parseInt(minute)
if (minutes < 10) {
minutes = "0" + minutes
}
//秒
var second = time % 60
seconds = parseInt(second)
if (seconds < 10) {
seconds = "0" + seconds
}
var allTime = "" + minutes + "" + ":" + "" + seconds + ""
timePlace.innerHTML = allTime
}
//播放事件监听
function playCotrol() {
audio.addEventListener("loadeddata",
function() {
$("#control").addClass("play").removeClass("color_gray")
$("#control").html("点击播放")
addListenTouch() //歌曲加载之后才可以拖动进度条
var allTime = audio.duration
timeChange(allTime, "allTime")
setInterval(function() {
var currentTime = audio.currentTime
$("#time .currentTime").html(timeChange(currentTime, "currentTime"))
}, 1000)
clicks()
}, false)
audio.addEventListener("pause",
function() { //监听暂停
$("#control").addClass("play").removeClass("pause")
$("#control").html("点击播放")
if (audio.currentTime == audio.duration) {
audio.stop()
audio.currentTime = 0
}
}, false)
audio.addEventListener("play",
function() { //监听暂停
$("#control").addClass("pause").removeClass("play")
$("#control").html("暂停播放")
dragMove()
}, false)
audio.addEventListener("ended", function() {
alert(0)
}, false)
}
//进度条
var startX, x, aboveX = 0 //触摸时的坐标 //滑动的距离 //设一个全局变量记录上一次内部块滑动的位置
//1拖动监听touch事件
function addListenTouch() {
document.getElementById("drag").addEventListener("touchstart", touchStart, false)
document.getElementById("drag").addEventListener("touchmove", touchMove, false)
document.getElementById("drag").addEventListener("touchend", touchEnd, false)
var drag = document.getElementById("drag")
var speed = document.getElementById("speed")
}
//touchstart,touchmove,touchend事件函数
function touchStart(e) {
e.preventDefault()
var touch = e.touches[0]
startX = touch.pageX
}
function touchMove(e) { //滑动
e.preventDefault()
var touch = e.touches[0]
x = touch.pageX - startX //滑动的距离
//drag.style.webkitTransform = 'translate(' + 0+ 'px, ' + y + 'px)'
drag.style.left = aboveX + x + "px" //
speed.style.left = -((window.innerWidth) - (aboveX + x)) + "px"
}
function touchEnd(e) { //手指离开屏幕
e.preventDefault()
aboveX = parseInt(drag.style.left)
var touch = e.touches[0]
var dragPaddingLeft = drag.style.left
var change = dragPaddingLeft.replace("px", "")
numDragpaddingLeft = parseInt(change)
var currentTime = (numDragpaddingLeft / (window.innerWidth - 30)) * audio.duration
audio.currentTime = currentTime
}
//3拖动的滑动条前进
function dragMove() {
setInterval(function() {
drag.style.left = (audio.currentTime / audio.duration) * (window.innerWidth - 30) + "px"
speed.style.left = -((window.innerWidth) - (audio.currentTime / audio.duration) * (window.innerWidth - 30)) + "px"
}, 500)
}
</script>
<h1>html5 audio 音频播放demo</h1>
<!--audiostart-->
<audio id="audio" src="" loop="loop" autoplay="autoplay" ></audio>
<!--audio End-->
<!--播放控制按钮start-->
<button id="control" class="">loading</button>
<!--播放控制按钮end-->
<!--时间进度条块儿start-->
<section class="progressBar">
<div class="progressBac"></div>
<div class="speed" id="speed"></div>
<div class="drag" id="drag"></div>
</section>
<!--时间进度条块儿end-->
<!--播放时间start-->
<div id="time"><div class="tiemDetail"><span class="currentTime" id="currentTime">00:00</span>/<span class="allTime" id="allTime">00:00</span></div></div>
<!--播放时间end-->
<!--歌曲信息start-->
<div id="songInfo">没时间-Leinov<div class="shareImg"><img src="img/html5audio.jpg" alt=""></div></div>
<!--歌曲信息end-->
<script src="js/zepto.js"></script>
</body>
</html>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)