- 微信开放标签 wx-open-launch-app react config:OK 标签内容消失?去APP看_1_/div>2{text}$/div> /wx-open-launch-app> /GoAppWarpper> [图片]2020-08-14wx-open-launch-app一直报错63002,invalid signature ?
let wxconfig = await this.props.mall.getWXConfigData({url: "http://rzhao.huishenghuo.info/html/index.html"}); alert(`${location.href.split('#')[0]}_appId_${wxconfig.data.appId}_timestamp_${wxconfig.data.timestamp}_nonceStr_${wxconfig.data.nonceStr}_signature_${wxconfig.data.signature}_jsApiList_${wxconfig.data.jsApiList}`); Toast(`${location.href.split('#')[0]}_appId_${wxconfig.data.appId}_timestamp_${wxconfig.data.timestamp}_nonceStr_${wxconfig.data.nonceStr}_signature_${wxconfig.data.signature}_jsApiList_${wxconfig.data.jsApiList}`); this.setState({wxConfigData: wxconfig}); wx.config({ debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印 appId: wxconfig.data.appId, // 必填,公众号的唯一标识 timestamp: wxconfig.data.timestamp, // 必填,生成签名的时间戳 nonceStr: wxconfig.data.nonceStr, // 必填,生成签名的随机串 signature: wxconfig.data.signature,// 必填,签名 jsApiList: wxconfig.data.jsApiList, // 必填,需要使用的JS接口列表 openTagList: ["wx-open-launch-app"] // 选填 }); wx.ready(function (respon:any) { // config信息验证后会执行ready方法,所有接口调用都必须在config接口获得结果之后,config是一个客户端的异步操作,所以如果需要在页面加载时就调用相关接口,则须把相关接口放在ready函数中调用来确保正确执行。对于用户触发时才调用的接口,则可以直接调用,不需要放在ready函数中 alert(`1__${respon}`); }); wx.error(function (responseData: any) { // config信息验证失败会执行error函数,如签名过期导致验证失败,具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,对于SPA可以在这里更新签名 alert(`0__${responseData}`); }); [图片]
2020-08-12上拉加载过多时,停止后出现抖动(scroll-top的值在变化)?[代码]//获取应用实例[代码][代码]var[代码] [代码]app = getApp()[代码][代码]var[代码] [代码]api = require([代码][代码]'../../utils/api.js'[代码][代码])[代码][代码]var[代码] [代码]action = require([代码][代码]'./../../utils/action.js'[代码][代码])[代码][代码]Page({[代码][代码] [代码][代码]// 页面初始数据[代码][代码] [代码][代码]data: {[代码][代码] [代码][代码]articles: [],[代码][代码] [代码][代码]raiTabs: [],[代码][代码] [代码][代码]indexs: 0,[代码][代码] [代码][代码]type: [代码][代码]""[代码][代码],[代码][代码] [代码][代码]alias: [代码][代码]""[代码][代码],[代码][代码] [代码][代码]anShow: [代码][代码]true[代码][代码],[代码][代码] [代码][代码]scrollTop: [],[代码][代码] [代码][代码]scrollHeight:0,[代码][代码] [代码][代码]loading: [],[代码][代码] [代码][代码]noMore: [代码][代码]false[代码][代码],[代码][代码] [代码][代码]pageNum: 0,[代码][代码] [代码][代码]page: 0,[代码][代码] [代码][代码]params: {},[代码][代码] [代码][代码]curScrollTop: 0[代码][代码] [代码][代码]},[代码][代码] [代码][代码]onLoad:[代码][代码]function[代码][代码](){[代码][代码] [代码][代码]let tabsUrl = [代码][代码]'store/strategy/tabs?cityId=310100&addr=1'[代码][代码];[代码][代码] [代码][代码]api.fetchGet(tabsUrl, {[代码][代码]'r'[代码][代码]: [代码][代码]'article'[代码][代码]}).then(res => {[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]raiTabs : res.data.items,[代码][代码] [代码][代码]alias : res.data.items.alias,[代码][代码] [代码][代码]type : res.data.items.type[代码][代码] [代码][代码]})[代码][代码] [代码][代码]that.data.type = res.data.items[0].type[代码][代码] [代码][代码]that.data.alias = res.data.items[0].alias [代码][代码] [代码][代码]let scrollTop = [][代码][代码] [代码][代码]let loading = [][代码][代码] [代码][代码]for[代码] [代码](let i = 0; i < [代码][代码]this[代码][代码].data.raiTabs.length; i++) {[代码][代码] [代码][代码]scrollTop.push(0)[代码][代码] [代码][代码]loading.push([代码][代码]false[代码][代码])[代码][代码] [代码][代码]wx.removeStorage({ [代码][代码] [代码][代码]key:[代码][代码]'strategyData'[代码] [代码]+ i,[代码][代码] [代码][代码]success: [代码][代码]function[代码][代码](res) {[代码][代码] [代码][代码]} [代码][代码] [代码][代码]})[代码][代码] [代码][代码]wx.removeStorage({[代码][代码] [代码][代码]key:[代码][代码]'strategyPage'[代码] [代码]+ i,[代码][代码] [代码][代码]success: [代码][代码]function[代码][代码](resp) {[代码][代码] [代码][代码]} [代码][代码] [代码][代码]}) [代码][代码] [代码][代码]}[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]scrollTop: scrollTop[代码][代码] [代码][代码]})[代码][代码] [代码][代码]this[代码][代码].getData()[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]onShow () {[代码][代码] [代码][代码]wx.getSystemInfo( {[代码][代码] [代码][代码]success: ( res ) => {[代码][代码] [代码][代码]let top = 84 * res.windowWidth / 750[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]scrollHeight: res.windowHeight - top[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]// 请求数据加载[代码][代码] [代码][代码]getData: [代码][代码]function[代码][代码]() {[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码] [代码][代码]var[代码] [代码]num = [代码][代码]this[代码][代码].data.indexs[代码][代码] [代码][代码]//最新的接口数据[代码][代码] [代码][代码]if[代码][代码](that.data.type == [代码][代码]'last'[代码][代码]){[代码][代码] [代码][代码]let lastUrl = [代码][代码]'store/strategy/last?limit=20&addr=1'[代码][代码] [代码][代码]api.fetchGet(lastUrl,{[代码][代码] [代码][代码]alias: that.data.alias,[代码][代码] [代码][代码]type: that.data.type,[代码][代码] [代码][代码]page: that.data.pageNum,[代码][代码] [代码][代码]r: [代码][代码]'article'[代码][代码] [代码][代码]}).then(res => {[代码][代码] [代码][代码]wx.hideToast()[代码][代码] [代码][代码]if[代码] [代码](res.data.items.length === 0) {[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]noMore: [代码][代码]true[代码][代码] [代码][代码]}) [代码][代码] [代码][代码]wx.showToast({[代码][代码] [代码][代码]title: [代码][代码]'已加载全部'[代码][代码],[代码][代码] [代码][代码]icon: [代码][代码]'loading'[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]that.data.pageNum++[代码][代码] [代码][代码]that.data.articles = that.data.articles.concat(res.data.items)[代码][代码] [代码][代码]let lArr = [代码][代码]this[代码][代码].data.loading[代码][代码] [代码][代码]lArr[num] = [代码][代码]false[代码][代码] [代码][代码]this[代码][代码].setData({ [代码][代码] [代码][代码]loading: lArr,[代码][代码] [代码][代码]page: that.data.pageNum,[代码][代码] [代码][代码]articles : that.data.articles[代码][代码] [代码][代码]})[代码][代码] [代码][代码]//缓存数据[代码][代码] [代码][代码]wx.setStorage({[代码][代码] [代码][代码]key:[代码][代码]'strategyData'[代码] [代码]+ that.data.indexs,[代码][代码] [代码][代码]data:that.data.articles[代码][代码] [代码][代码]})[代码][代码] [代码][代码]wx.setStorage({[代码][代码] [代码][代码]key:[代码][代码]'strategyPage'[代码] [代码]+ that.data.indexs,[代码][代码] [代码][代码]data:that.data.pageNum[代码][代码] [代码][代码]})[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码]//标签切换[代码][代码] [代码][代码]switchTab (e) {[代码][代码] [代码][代码]if[代码][代码]([代码][代码]this[代码][代码].data.indexs == e.currentTarget.dataset.index){[代码][代码]return[代码][代码]}[代码][代码] [代码][代码]for[代码] [代码](let key [代码][代码]in[代码] [代码]this[代码][代码].data.loading) {[代码][代码] [代码][代码]this[代码][代码].data.loading[key] = [代码][代码]false[代码][代码] [代码][代码]}[代码][代码] [代码][代码]let arr = [代码][代码]this[代码][代码].data.scrollTop[代码][代码] [代码][代码]let index = [代码][代码]this[代码][代码].data.indexs[代码][代码] [代码][代码]arr[index] = [代码][代码]this[代码][代码].data.curScrollTop[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]scrollTop: arr[代码][代码] [代码][代码]})[代码][代码] [代码][代码]var[代码] [代码]n = e.currentTarget.dataset.index;[代码][代码] [代码][代码]let id = e.currentTarget.dataset.id;[代码][代码] [代码][代码]var[代码] [代码]rName = e.currentTarget.dataset.alias;[代码][代码] [代码][代码]var[代码] [代码]rType = e.currentTarget.dataset.type;[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]pageNum: 0,[代码][代码] [代码][代码]articles: [],[代码][代码] [代码][代码]alias: rName,[代码][代码] [代码][代码]type: rType,[代码][代码] [代码][代码]indexs: n[代码][代码] [代码][代码]})[代码][代码] [代码][代码]let lArr = [代码][代码]this[代码][代码].data.loading[代码][代码] [代码][代码]lArr[n] = [代码][代码]true[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]loading: lArr,[代码][代码] [代码][代码]noMore: [代码][代码]false[代码][代码] [代码][代码]})[代码][代码] [代码][代码]var[代码] [代码]pageValue = wx.getStorageSync([代码][代码]'strategyPage'[代码] [代码]+ [代码][代码]this[代码][代码].data.indexs)[代码][代码] [代码][代码]var[代码] [代码]dataValue = wx.getStorageSync([代码][代码]'strategyData'[代码] [代码]+ [代码][代码]this[代码][代码].data.indexs)[代码][代码] [代码][代码]if[代码][代码](pageValue.length !== 0 || dataValue.length !== 0){[代码][代码] [代码][代码]let lArr = [代码][代码]this[代码][代码].data.loading[代码][代码] [代码][代码]lArr[n] = [代码][代码]false[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]loading: lArr,[代码][代码] [代码][代码]noMore: [代码][代码]false[代码][代码] [代码][代码]})[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]articles: dataValue,[代码][代码] [代码][代码]pageNum: pageValue[代码][代码] [代码][代码]})[代码][代码] [代码][代码]var[代码] [代码]scrollTopNumber = [代码][代码]this[代码][代码].data.scrollTop[n][代码][代码] [代码][代码]setTimeout(() => {[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]curScrollTop: scrollTopNumber[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},10)[代码][代码] [代码][代码]}[代码][代码]else[代码][代码]{[代码][代码] [代码][代码] [代码][代码]this[代码][代码].getData()[代码][代码] [代码][代码]}[代码][代码] [代码][代码]},[代码][代码] [代码][代码]// 滚动事件[代码][代码] [代码][代码]scroll (event) {[代码][代码] [代码][代码]this[代码][代码].setData({[代码] [代码] [代码][代码]curScrollTop: event.detail.scrollTop[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]// 跳转至详情页[代码][代码] [代码][代码]navigateDetail: [代码][代码]function[代码][代码](e){[代码][代码] [代码][代码]let uri = e.currentTarget.dataset.uri[代码][代码] [代码][代码]action.uriAction(uri)[代码][代码] [代码][代码]},[代码][代码] [代码][代码]// 跳转至合集[代码][代码] [代码][代码]clickURI (e) {[代码][代码] [代码][代码]let uri = e.currentTarget.dataset.uri[代码][代码] [代码][代码]action.uriAction(uri)[代码][代码] [代码][代码]},[代码][代码] [代码][代码]// 加载更多[代码][代码] [代码][代码]loadMore: [代码][代码]function[代码] [代码](e) {[代码][代码] [代码][代码]if[代码] [代码]([代码][代码]this[代码][代码].data.noMore||[代码][代码]this[代码][代码].data.loading[[代码][代码]this[代码][代码].data.indexs]) [代码][代码]return[代码][代码] [代码][代码]let lArr = [代码][代码]this[代码][代码].data.loading[代码][代码] [代码][代码]lArr[[代码][代码]this[代码][代码].data.indexs] = [代码][代码]true[代码][代码] [代码][代码]this[代码][代码].setData({[代码][代码] [代码][代码]loading: lArr[代码][代码] [代码][代码]})[代码][代码] [代码][代码]wx.showToast({[代码][代码] [代码][代码]title: [代码][代码]'加载中'[代码][代码],[代码][代码] [代码][代码]icon: [代码][代码]'loading'[代码][代码] [代码][代码]})[代码][代码] [代码][代码]this[代码][代码].getData() [代码] [代码] [代码][代码]}[代码][代码]})[代码] 请问大家有没有遇到上拉加载页面多时,停止下拉后会出现抖动(停止上拉后scroll-top=""的值在变化)?谢谢?
2017-03-30