123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- var index = 0;
- var request = GetRequest();
- (function($){
- //阻尼系数
- var deceleration = mui.os.ios?0.003:0.0009;
- $('.mui-scroll-wrapper').scroll({
- bounce: false,
- indicators: true, //是否显示滚动条
- deceleration:deceleration
- });
- $.ready(function() {
- //循环初始化所有下拉刷新,上拉加载。
- $.each(document.querySelectorAll('.mui-slider-group .mui-scroll-wrapper'), function(index, pullRefreshEl) {
- $(pullRefreshEl).pullRefresh({
- down: {
- callback: function() {
- var self = this;
- setTimeout(function() {
- if(index == 1){
- fuwujilu.getInfo();
- }
- self.endPulldownToRefresh();
- }, 1000);
- }
- }
- });
- });
- });
- // var tab = localStorage.getItem("signInfo_tab");
- // if(tab){
- // index = tab;
- // clickTab(index, 100);
- // }
- getFirstTabValue();
- bindEvent();
- getWxSign();
-
- //判断前一个页面存储的支付信息
- var payParams = window.localStorage.getItem("payParams");
- if(payParams){
- window.localStorage.removeItem("payParams");
- }
- })(mui);
- function getWxSign(){
- //从后台那边获取签名等信息
- var params = {};
- var url1 = window.location.href;
- params.pageUrl = url1;
- $.ajax(server + "weixin/getSign", {
- data: params,
- dataType: "json",
- type: "post",
- success: function(res){
- if (res.status == 200) {
- var t = res.data.timestamp;
- var noncestr = res.data.noncestr;
- var signature = res.data.signature;
- wx.config({
- appId: appId, // 必填,公众号的唯一标识
- timestamp: t, // 必填,生成签名的时间戳
- nonceStr: noncestr, // 必填,生成签名的随机串
- signature: signature,// 必填,签名,见附录1
- jsApiList: [
- 'chooseImage',
- 'uploadImage',
- 'startRecord',
- 'stopRecord',
- 'onVoiceRecordEnd',
- 'playVoice',
- 'pauseVoice',
- 'stopVoice',
- 'translateVoice',
- 'onVoicePlayEnd',
- 'uploadVoice',
- 'getNetworkType'
- ] // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
- });
-
- // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中。
- wx.ready(function(){
- wx.getNetworkType({
- success: function (res) {
- networkStatus = res.networkType; // 返回网络类型2g,3g,4g,wifi
- }
- });
- });
- }
- }
- });
- }
- function getFirstTabValue(){
- consulting.getInfo();
- consulting.bindEvents();
- }
- function clickTab(index){
- $(".mui-slider .mui-control-item").eq(index).addClass("mui-active");
- var slider = mui('.mui-slider').slider();
- slider.gotoPage(index,100);
- }
- function bindEvent(){
- document.querySelector('.mui-slider').addEventListener('slide', function(event) {
- var index = event.detail.slideNumber;
- localStorage.setItem("signInfo_tab", index);
- var item = "item"+(index+1);
- var activeItem = $(event.target).find(".mui-control-item:eq("+index+")");
- var options = [consulting, fuwujilu];
- if(!activeItem.attr("showed")){
- options[index].getInfo();
- options[index].bindEvents();
- activeItem.attr("showed", "1");
- }
- });
- }
- template.helper('getPhoto', function(str){
- return getImgUrl(str);
- })
|