- 腾讯视频插件 play() 方法在ios(机型苹果X)下首次进入小程序调用没有反应?
//页面部分 <swiper vertical="true" skip-hidden-item-layout="{{true}}" loop="{{true}}" current="{{swiperCurrent}}" circular="{{true}}"> <swiper-item wx:for="{{lists}}" wx:key="{{index}}" wx:if="{{lists.length>0}}"> <txv-video width="{{windowWidth}}px" height="{{windowHeight}}px" vid="{{item.id}}" objectFit="contain" controls="{{false}}" id="video{{item.id}}" playerid="video{{item.id}}" showCenterPlayBtn="{{false}}" wx:if="{{item.id}}" isNeedMutex="{{true}}" isHiddenStop="{{true}}" loop="{{true}}" bindplay="bindplay" bindpause="bindpause" bindtimeupdate="bindtimeupdate"></txv-video> </swiper-item> </swiper> //js部分 const TxvContext = requirePlugin("tencentvideo"); data:{ lists:[], newid:"" }, onload(){ this.getdata() } getdata(){ let taht = this; wx.request({ url: '视频vid请求接口', success(res){ taht.setData({ list:res.list, newid:"video" + res.list[0].id }) 👇 调用play 无效 let txvContext = TxvContext.getTxvContext("video" + res.list[0].id) txvContext.play() } }) } 有大哥知道什么原因吗,安卓没事。
2020-05-09 - getUserInfo获取用户信息并调用登录接口,有个别用户在登陆时瞬间请求后台两次,求解?
<button open-type="getUserInfo" bindgetuserinfo="getUserInfo" >允许</button> 登录授权按钮通过上述按钮进行授权 ---就是这个简单的登录接口 虽然已经通过open-type="getUserInfo" 进行获取授权,但是查看文档发现[代码] [代码][代码]wx.getUserInfo 在没有授权的情况下直接走失败回调,所以我就利用这个特性规避拒绝授权后的继续请求服务器的情况。[代码] [代码] 本次问题出现的特别尴尬,在之前本人测试的时候一直没遇到过,就是查看后台的时候发现个别用户在同一时间同一秒接连请求两次后台。[代码] [代码]所以想请教一下大佬们,我这个登录操作是不是还有什么不妥的地方,为什么会在wx.login api里面请求两次后台。我在登陆时直接开启了遮罩层,按道理讲不可能连点两次的吧。 新人在线跪求大佬解答。[代码] [代码]↓为登录接口代码。[代码] [代码]getUserInfo: [代码][代码]function[代码][代码](e) {[代码][代码] [代码][代码]console.log(e)[代码][代码] [代码][代码]var[代码] [代码]that = [代码][代码]this[代码][代码] [代码][代码]wx.showLoading({[代码][代码] [代码][代码]title: [代码][代码]'登陆中..'[代码][代码],[代码][代码] [代码][代码]mask: [代码][代码]true[代码][代码] [代码][代码]})[代码][代码] [代码][代码]wx.getUserInfo({[代码][代码] [代码][代码]success(res) {[代码][代码] [代码][代码]app.globalData.userInfo = res.userInfo[代码][代码] [代码][代码]wx.setStorage({[代码][代码] [代码][代码]key: [代码][代码]'userInfo'[代码][代码],[代码][代码] [代码][代码]data: res.userInfo,[代码][代码] [代码][代码]})[代码][代码] [代码][代码]var[代码] [代码]datalist = res[代码][代码] [代码][代码]console.log(datalist)[代码][代码] [代码][代码]wx.login({[代码][代码] [代码][代码]success(res) {[代码][代码] [代码][代码]if[代码] [代码](res.code) {[代码][代码] [代码][代码]wx.request({[代码][代码] [代码][代码]url: app.globalData.service + [代码][代码]'登录接口'[代码][代码],[代码][代码] [代码][代码]method: [代码][代码]'post'[代码][代码],[代码][代码] [代码][代码]data: {[代码][代码] [代码][代码]code: res.code, //login返回的code[代码][代码] [代码][代码]nickName: datalist.userInfo.nickName,//login返回的用户名[代码][代码] [代码][代码]avatarUrl: datalist.userInfo.avatarUrl,//login返回的用户头像[代码][代码] [代码][代码]},[代码][代码] [代码][代码]success(res) {[代码] [代码] [代码][代码]},[代码][代码] [代码][代码]})[代码][代码] [代码][代码]} [代码][代码]else[代码] [代码]{[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]login: [代码][代码]false[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail() {[代码][代码] [代码][代码]that.setData({[代码][代码] [代码][代码]login: [代码][代码]false[代码][代码] [代码][代码]})[代码][代码] [代码][代码]wx.hideLoading()[代码][代码] [代码][代码]wx.showToast({[代码][代码] [代码][代码]title: [代码][代码]'登陆失败!请重新授权!!'[代码][代码],[代码][代码] [代码][代码]icon: [代码][代码]'none'[代码][代码],[代码][代码] [代码][代码]duration: 2000,[代码][代码] [代码][代码]mask: [代码][代码]true[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]fail() {[代码][代码] [代码][代码]wx.hideLoading()[代码][代码] [代码][代码]wx.showToast({[代码][代码] [代码][代码]title: [代码][代码]'登陆失败!请授权!!'[代码][代码],[代码][代码] [代码][代码]icon: [代码][代码]'none'[代码][代码],[代码][代码] [代码][代码]duration: 2000,[代码][代码] [代码][代码]mask: [代码][代码]true[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码] 基础库2.8.1 开发者工具 v1.02.1907301
2019-11-13 - wx.getSetting() 在用户点击地理位置授权后,打印授权信息undefined?
[代码]wx.getLocation({[代码][代码] [代码][代码]type: [代码][代码]'wgs84'[代码][代码],[代码][代码] [代码][代码]success(res) {[代码][代码] [代码][代码]//维度[代码][代码] [代码][代码]text[[代码][代码]"latitude"[代码][代码]] = res.latitude[代码][代码] [代码][代码]//经度[代码][代码] [代码][代码]text[[代码][代码]"longitude"[代码][代码]] = res.longitude[代码][代码] [代码][代码]wx.setStorage({[代码][代码] [代码][代码]key: [代码][代码]"Location"[代码][代码],[代码][代码] [代码][代码]data: text[代码][代码] [代码][代码]})[代码][代码] [代码][代码]},[代码][代码] [代码][代码]complete(res) {[代码][代码] [代码][代码]console.log(res)[代码][代码] [代码][代码]wx.getSetting({[代码][代码] [代码][代码]success: (res) => {[代码][代码] [代码][代码]console.log(res.authSetting)[代码][代码] [代码][代码]console.log(res.authSetting[[代码][代码]'scope.userLocation'[代码][代码]])[代码][代码] [代码][代码]console.log(!res.authSetting[[代码][代码]'scope.userLocation'[代码][代码]])[代码][代码] [代码][代码]if[代码] [代码](!res.authSetting[[代码][代码]'scope.userLocation'[代码][代码]]){[代码][代码] [代码][代码]wx.showModal({[代码][代码] [代码][代码]content: [代码][代码]'检测到您没打开定位权限,为了活动体验是否去设置打开?'[代码][代码],[代码][代码] [代码][代码]confirmText: [代码][代码]"确认"[代码][代码],[代码][代码] [代码][代码]cancelText: [代码][代码]"取消"[代码][代码],[代码][代码] [代码][代码]success: [代码][代码]function[代码] [代码](res) {[代码][代码] [代码][代码]console.log(res);[代码][代码] [代码][代码]//点击“确认”时打开设置页面[代码][代码] [代码][代码]if[代码] [代码](res.confirm) {[代码][代码] [代码][代码]console.log([代码][代码]'用户点击确认'[代码][代码])[代码][代码] [代码][代码]wx.openSetting({[代码][代码] [代码][代码]success: (res) => { [代码][代码] [代码][代码]console.log(res)[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]} [代码][代码]else[代码] [代码]{[代码][代码] [代码][代码]console.log([代码][代码]'用户点击取消'[代码][代码])[代码][代码] [代码][代码]}[代码][代码] [代码][代码]},[代码][代码] [代码][代码]complete() {[代码][代码] [代码][代码] [代码][代码]}[代码][代码] [代码][代码]});[代码][代码] [代码][代码]}[代码][代码]else[代码][代码]{[代码][代码] [代码][代码] [代码][代码]}[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码]接口先调用wx.getLocation()后调用wx.getSetting()打印位置授权[代码]res.authSetting[[代码][代码]'scope.userLocation'[代码][代码]] [代码]undefined [图片] [图片] 这是啥情况啊?求解,有时候出来,有时候undefined就很郁闷. 基础库2.8.1 开发者工具 v1.02.1907301
2019-09-19