- h5页面分享,安卓机点链接进入不是到分享的页面,而是总是到首页,ios正常
[图片] 这个页面分享出去在ios可以正常进入此页面,安卓机以前可以进入,最近一段时间安卓机不能进入此页面,而是进入首页, 页面代码如下: <template> <view class="body"> <view class="content"> <!-- 轮播图 --> <view class="proImg"> <swiper indicator-dots autoplay interval="3000" duration="1000"> <swiper-item v-for="(item,idx) in groupdata.img" :key="idx"> <view class="swiper-item"><image :src="item" mode="aspectFill"></image></view> </swiper-item> </swiper> <view class="label flex_row_start_end"> <text>拼团活动结束时间:</text><bbs-countdown :time="timestamp" :now="now" @progress="progress" ref="countdown"></bbs-countdown> </view> </view> <!-- 标题 --> <view class="proInfo"> <view class="proName"> <view class="flex_row_start_between"> <view class="name" style="width: 500rpx;"> {{groupdata.goodsName}} </view> <view class="cleaningimgnum"> <image src="https://zixun.xcxlichao.cn/cbbtt/zyl/houseKeeping/people.png" mode=""></image> <text>{{User.groupUser}}人团</text> </view> </view> <view class="news"> {{groupdata.goodsAbstract}} </view> </view> <view class="Num flex_row_center_between"> <view class="Numwrapper flex_row_center"> <!-- <image src="https://zixun.xcxlichao.cn/cbbtt/zyl/houseKeeping/reduce02.png" mode=""></image> --> <view class="codeNum"> <text style="font-size: 26rpx;">团购价:</text><span>¥</span>{{groupdata.salePrice}} </view> <view class="getNum"> ¥{{groupdata.originalPrice}} </view> </view> <!-- <view class="salesNum"> 库存:111 </view> --> </view> </view> <!-- 服务保障 --> <view class="serving flex_row_center"> <view class="Serviceguarantee"> 服务保障 </view> <view class="service01 flex_row_center"> <image src="https://zixun.xcxlichao.cn/cbbtt/zyl/houseKeeping/servingIcon01.png" mode=""></image> 上门服务 </view> <view class="service01 flex_row_center"> <image src="https://zixun.xcxlichao.cn/cbbtt/zyl/houseKeeping/servingIcon02.png" mode=""></image> 科学打扫 </view> <view class="service01 flex_row_center"> <image src="https://zixun.xcxlichao.cn/cbbtt/zyl/houseKeeping/servingIcon03.png" mode=""></image> 专职保洁师 </view> </view> <!-- 规格 --> <view class="specifications flex_column_center"> <view class="specificationswrapper flex_row_center_between" @click="open"> <view class="specificationsleft"> 规格 </view> <view class="specificationsright flex_row_center"> <view class="Selected"> 已选:{{groupdata.style[switchindex].title}} </view> <image src="https://zixun.xcxlichao.cn/cbbtt/zyl/houseKeeping/rightArrow.png" mode=""></image> </view> </view> </view> <!-- 拼团成员 --> <view class="teammembers flex_column_center"> <view class="teammemberswrapper"> <view class="teammemberslist flex_row_center_between"> <view class="teammembersleft"> 团长 </view> <view class="teammembersright flex_row_center"> <image :src="group.groupImg" mode=""></image> <text>{{group.groupName}}</text> </view> </view> <view class="teammemberslist flex_row_center_between"> <view class="teammembersleft"> 拼团ID </view> <view class="teammembersright flex_row_center"> <text>{{User.id}}</text> </view> </view> <view class="teammemberslist flex_row_center_between"> <view class="teammembersleft"> 拼团成员 </view> <view class="teammembersright01 flex_row_center" v-if="groupUser"> <view class="" v-if="groupUser.length>5"> <image :src="item.avatar" mode="" v-for="(item,idx) in groupUserImg" :key='idx'></image>... </view> <view class="" v-else> <image :src="item.avatar" mode="" v-for="(item,idx) in groupUserImg" :key='idx'></image> </view> <text>{{groupUser.length?groupUser.length:'0'}}人已团</text> </view> </view> </view> </view> <!-- 商品详情 --> <view class="proDetail"> <view class="detailTitle flex_column_center"> <view class="title"> 商品详情 </view> </view> <view class="prodetailImg"> <rich-text :nodes="goodsDetails"></rich-text> <!-- <image src="https://zixun.xcxlichao.cn/cbbtt/zyl/houseKeeping/proDetail.png" mode=""></image> --> </view> </view> <view class="changeBack flex_row_center" v-if="isjoin"> <view :url="'../../order/groupconfirmorder?groupUuid='+groupUuid" class="groupbuy"> 已经参团 </view> </view> <view class="changeBack flex_row_center" v-else> <view class="groupbuy" @tap="full" v-if="notfull"> 该团已拼满 </view> <view class="groupbuy" @tap="open" v-else> 拼团购买 ¥<text>{{groupdata.salePrice}}</text> </view> </view> <!-- 选择规格弹出层 --> <uni-popup ref="popup" type="bottom"> <view class="popup"> <view class="popupwrapper"> <!-- 订单 --> <view class="flex_row_center"> <view class="popuporderleft"> <image :src="groupdata.style[switchindex].img" mode=""></image> </view> <view class="popuporderright"> <view class="popupordertitle"> {{groupdata.goodsName}} </view> <view class="flex_row_end"> <view class="popupprice"> <text>¥</text>{{groupdata.style[switchindex].money}} </view> </view> </view> </view> <!-- 规格 --> <view class="popupSpecifications"> <view class="popupSpecificationsname"> 规格 </view> <view class="popuplists flex_row_center"> <view :class="['popuplist',switchindex==idx?'popupchoosed':'']" v-for="(item,idx) in groupdata.style" :key='idx' @tap="switchtype(idx)"> {{item.title}} </view> </view> </view> <!-- 数量 --> <!-- <view class="popupnum flex_row_center_between"> <view class="popupnumleft"> 购买数量<text>(库存**)</text> </view> <view class="popupnumright flex_row"> <view class="popupicon" @tap="reduce"> - </view> <view class="popupnum01"> {{popupnum}} </view> <view class="popupicon" @tap="add"> + </view> </view> </view> --> <!-- 立即购买 --> <view class="popupbutton" @tap="nobuy" v-if="groupdata.single"> 立即拼团 </view> <navigator :url="'../../order/groupconfirmorder?groupUuid='+groupUuid+'&styleid='+groupdata.style[switchindex].id+'&index='+switchindex" class="popupbutton" v-else> 立即拼团 </navigator> </view> </view> </uni-popup> </view> </view> </template> <script> import uniPopup from '@/components/uni-popup/uni-popup.vue' import bbsCountdown from "@/components/bbs-countdown/bbs-countdown.vue" import api from '../../../static/config/api.js' import util from '../../../static/utils/util.js' import rich from "../../../static/rich-text-parse.js" export default { components: { uniPopup, bbsCountdown }, data() { return { switchindex:'0', groupUuid:'', groupdata:[] ,//拼团商品数据 groupUser:'' ,//拼团成员 groupUserImg:'',//拼团成员头像 group:'',//团长信息 endTime:'' ,//拼团结束时间 User:'', notfull:false, isjoin:'' ,//判断是否加入团 goodsDetails:'' ,//富文本 timestamp:'' } }, onLoad(info) { this.groupUuid = info.groupUuid this.endTime = info.endtime this.timestamp = new Date(info.endtime.replace(/-/g,'/')).getTime()-Date.now() console.log(this.timestamp); var isjoin = info.isjoin if(isjoin){ this.isjoin = true }else{ this.isjoin =false } this.getGroupInformation() }, onShareAppMessage(res) { var groupUuid = this.groupUuid var endTime = this.endTime var title = this.groupdata.goodsName // console.log(groupUuid,endTime); return { title: title, path: '/pages/index/Productdetails/groupdetails02?groupUuid='+groupUuid+'&endtime='+endTime } }, methods: { // 现在的时间戳--必须传入 now() { return Date.now() }, // 倒计时进行中 progress(time) { // console.log(time); }, //查询指定的拼团信息 getGroupInformation(){ var that = this util.request(api.GetGroupInformation,{groupUuid:that.groupUuid},'GET').then(function(res){ console.log('拼团信息',res) if(res.code == 200){ //拼团商品数据 that.groupdata = res.data.goods console.log("aa",that.groupdata) //拼团成员 that.groupUser = res.data.groupUser //根据拼团成员判断显示几个头像 if(that.groupUser&&that.groupUser.length>=5){ that.groupUserImg = that.groupUser.slice(0,5) }else{ that.groupUserImg = that.groupUser } //团长信息 that.group = res.data.group //拼团商品的id和拼团人数信息 that.User = res.data.groupInitiate //判断人数是否已满 if(that.groupUser&&that.User.groupUser==that.groupUser.length){ that.notfull = true } that.goodsDetails = rich.imgParse100Width(res.data.goods.goodsDetails) // console.log(that.groupdata) //分享 // #ifdef H5 that. fenxiang() // #endif } }) }, // 打开弹出层 open(){ if(!this.isjoin&&!this.notfull){ this.$refs.popup.open() } }, // 点击弹出层选择规格 switchtype(idx){ this.switchindex = idx }, //当拼团人数满后点击‘该拼团已满’ full(){ uni.showToast({ title: '该团已拼满,可参与其他团购', icon:'none', duration: 2000 }); }, //不可购买 nobuy(){ uni.showToast({ title:'此服务限购一次~~', icon:'none', duration:2000 }) }, //分享 fenxiang() { let that = this let imgUrl = 'https://zixun.xcxlichao.cn/cbbtt/zyl/houseKeeping/logo03.jpg' let url = window.location.href; util.request(api.getShare, { url: url }, 'GET').then((res) => { if (res.code == 200) { wx.config({ debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。 appId: res.data.appId, // 必填,公众号的唯一标识 timestamp: res.data.timestamp, // 必填,生成签名的时间戳 nonceStr: res.data.nonceStr, // 必填,生成签名的随机串 signature: res.data.signature, // 必填,签名,见附录1 jsApiList: [ "updateAppMessageShareData" ,"onMenuShareQQ" ,"updateTimelineShareData" ,"onMenuShareTimeline" ,"onMenuShareAppMessage"], // 必填,需要使用的JS接口列表,所有JS接口列表见附录2 success: function() { // window.location("http://www.kangkanginhome.com/weixin/IndexHtml/tuan_list") }, }) wx.ready(function() { //需在用户可能点击分享按钮前就先调用 var obj={ title:that.groupdata.goodsName, // 分享标题 desc: that.groupdata.goodsAbstract, // 分享描述 link: url, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 imgUrl: imgUrl, // 分享图标 fail: function (res) { }, success: function () { }, } //朋友圈 wx.onMenuShareTimeline && wx.onMenuShareTimeline(obj) //发送给好友 wx.onMenuShareAppMessage && wx.onMenuShareAppMessage(obj) // 2.1 监听“分享给朋友”,按钮点击、自定义分享内容及分享结果接口 wx.updateAppMessageShareData && wx.updateAppMessageShareData(obj); // 2.2 监听“分享到朋友圈”按钮点击、自定义分享内容及分享结果接口 wx.onMenuShareTimeline(obj); // 2.3 监听“分享到QQ”按钮点击、自定义分享内容及分享结果接口 wx.updateAppMessageShareData && wx.updateAppMessageShareData(obj); }); } }) } } } </script> <style> @import url("../../../static/css/Productdetails.css"); </style> https://m.clmeijia.com/h5/#/pages/index/Productdetails/groupdetails02?groupUuid=87b86003929a4bd5a463c222e32465ca&endtime=2021-12-31%2023%3A59%3A59
2021-12-06 - 公众号h5页面分享接入JS sdk,一直报签名错误?
JS sdk 分享的签名通过校验是一样的, 下图时微信校验工具结果 [图片] 下图时我自己的数据回调结果 [图片] 但是在h5中一直报错 签名失效。 [图片][图片] 求解 源代码: onLoad(option) { uni.request( { url: _this.url + '/user/share', data: { url:_this.fenxianID[0] }, method: 'GET', header: { 'custom-header': 'application/json', //自定义请求头信息 }, success(res) { console.log("回调", res) _this.ercifenxiang(res) } }) }, methods: { //二次分享 ercifenxiang(res){ let _this=this weixin.config({ debug: true, appId: res.data.data.appid, timestamp: res.data.data.timestamp, nonceStr: res.data.data.nonceStr, // signature: res.data.data.signature, signature: 'e8b8c25a1747a87409a23ef4b4951ad6906c1cd7', jsApiList: [ 'checkJsApi', 'onMenuShareTimeline', 'onMenuShareAppMessage', ] }); //配置自定义分享内容 weixin.ready(() => { console.log("设置分享") weixin.onMenuShareAppMessage({ title: _this.title, // 分享标题 desc: _this.title, // 分享描述 link: window.location.href, // 分享链接,当前页面地址 imgUrl: "https://xiaobang.xapoon.com/img/03afed5df43d4f2b9ff9094aef2761db.png", // 分享图标的链接 type: "link", // 分享类型 dataUrl: "", // 默认为空 success: res => { console.log("分享回调", res) uni.showModal({ title: "提示" }) }, fail: function (res) { console.log("分享回调失败", res) uni.showModal({ title: "提示", content:"失败"+res }) } }) }); }, }
2021-09-23 - 在开发时工具模拟器正常,真机测试时,平板上两边有留白问题,没有自适应?
[图片] 在开发小程序时微信工具能适配各种屏幕大小,使用真机测试时发现在android MI PAD3 、7.0/7.9英寸/2048*1536宽不能全屏,两边空白区很多?
2021-05-20 - 如何解决在开发时模拟器正常,真机上两边大量留白问题?
在开发小程序时微信工具能适配各种屏幕大小,使用真机测试时发现在android MI PAD2/7.0/7.9英寸/2048*1536不能全屏?两百年大量留白。
2021-05-19