console.log(encodeURIComponent("http://www.w3school.com.cn"));
app.ajaxForm("index.php?m=mobile&c=user&a=feedback", savedatebtn);
window.location.href="index.php?m=mobile&c=user&a=degrees";
<script type="text/javascript">
tosubscribe();
function tosubscribe() {
var subscribe = "{$subscribe}";
if (subscribe == "0") {
var img = "<img src='uploadfile/{$app_qrcode}' style='200px;height:200px;'>";
mui.alert(img, '长按识别此二维码关注',
function() {});
$(".mui-popup-buttons").hide();
}
}
//不知道是干啥使的 没找到这个Id
var slider = mui("#slider");
slider.slider({
interval: 1000
});
var btn_vip = document.getElementById('btn_vip');
btn_vip.addEventListener('tap',
function() {
mui.openWindow({
url: this.getAttribute("data-url"),
});
});
var btn_share = document.getElementById('btn_share');
btn_share.addEventListener('tap',
function() {
mui.openWindow({
url: this.getAttribute("data-url"),
});
});
var btn_share2 = document.getElementById('btn_share2');
btn_share2.addEventListener('tap',
function() {
mui.openWindow({
url: this.getAttribute("data-url"),
});
});
var btn_desc = document.getElementById('btn_desc');
btn_desc.addEventListener('tap',
function() {
//打开关于页面
mui.openWindow({
url: this.getAttribute("data-url"),
});
});
var btn_tixian = document.getElementById('btn_tixian');
btn_tixian.addEventListener('tap',
function() {
//打开关于页面
mui.openWindow({
url: this.getAttribute("data-url"),
});
});
var btn_server = document.getElementById('btn_server');
btn_server.addEventListener('tap',
function() {
//打开关于页面
mui.openWindow({
url: this.getAttribute("data-url"),
});
});
var addiconbtn = document.getElementById('addiconbtn');
addiconbtn.addEventListener('tap',
function() {
$("#actionform").submit();
});
wx.config({
debug: false,
appId: '{$attr.appId}',
timestamp: '{$attr.timestamp}',
nonceStr: '{$attr.nonceStr}',
signature: '{$attr.signature}',
jsApiList: ['checkJsApi', 'getLocation']
});
wx.ready(function() {
//获取用户定位信息
wx.getLocation({
type: 'wgs84',
// 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
success: function(res) {
var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
var speed = res.speed; // 速度,以米/每秒计
var accuracy = res.accuracy; // 位置精度
app.ajax("index.php?m=mobile&c=home&a=setlocation&latitude=" + latitude + "&longitude=" + longitude + "&openid={$openid}", locationcallback);
},
cancel: function(res) {
app.ajax("index.php?m=mobile&c=home&a=getlocation&openid={$openid}&tempc=1", locationcallback);
}
});
//推广分享
wx.onMenuShareAppMessage({
title: '{$shareset.title}', // 分享标题
desc: '{$shareset.desc}', // 分享描述
link: "http://www.ernshq.com/index.php?m=mobile&c=home&a=toshare&openid={$openid}", // 分享链接
imgUrl: '{$weburl}/uploadfile/{$shareset.img}', // 分享图标
success: function () {
// 用户确认分享后执行的回调函数
mui.toast("分享成功");
},
cancel: function () {
// 用户取消分享后执行的回调函数
mui.toast("分享失败");
}
});
wx.onMenuShareTimeline({
title: '{$shareset.title}', // 分享标题
link: "http://www.ernshq.com/index.php?m=mobile&c=home&a=toshare&openid={$openid}", // 分享链接
imgUrl: '{$weburl}/uploadfile/{$shareset.img}', // 分享图标
success: function () {
// 用户确认分享后执行的回调函数
mui.toast("分享成功");
},
cancel: function () {
// 用户取消分享后执行的回调函数
mui.toast("分享失败");
}
});
});
function locationcallback(data) {
}
wx.error(function(res) {
mui.alert("网络异常");
});
var gallery = mui('.mui-slider');
gallery.slider({
interval: 4000 //自动轮播周期,若为0则不自动播放,默认为0;
});
</script>
<script>
bindevent();
//加载更多
var morebtn = document.getElementById('morebtn');
morebtn.addEventListener('tap', function() {
mobilelist();
});
function mobilelist(){
var time = $("#data_list").find("li:last").attr("data-order");
$("#createdate").val(time);
app.ajaxForm("index.php?m=mobile&c=page", mobilecallback);
}
function mobilecallback(data) {
if(data.html==""){
mui.toast("没有更多了");
$("#morebtn").html("没有更多了");
}else{
$("#data_list").append(data.html);
bindevent();
}
}
//检索
var searchbtn = document.getElementById('searchbtn');
searchbtn.addEventListener('tap', function() {
$("#createdate").val("");
searchlist();
});
function searchlist(){
$("#morebtn").html("加载更多");
app.ajaxForm("index.php?m=mobile&c=page", searchcallback);
}
function searchcallback(data) {
if(data.html==""){
mui.toast("没有检索到记录");
}
$("#data_list").html(data.html);
bindevent();
}
function bindevent(){
mui(".vconlist.supply").on('tap', 'li', function() {
//打开关于页面
mui.openWindow({
url: this.getAttribute("data-url"),
});
})
}
//分类选择 将传递的数据进行包裹在li中展示的步骤
app.setpopdicker({$type_list},"hserbtn",typecallback);
function typecallback(data){
//打开关于页面
mui.openWindow({
url: "index.php?m=mobile&c=home&a=news&id="+data.value,
});
}
</script>