我也遇到这样问题了,请问你后来怎么解决?
ios上面字体大小显示混乱先上个代码 这是wxml代码 [代码]<[代码][代码]scroll-view[代码] [代码]class[代码][代码]=[代码][代码]"scrollview"[代码] [代码]scroll-x[代码][代码]=[代码][代码]"{{true}}"[代码] [代码]scroll-with-animation[代码][代码]=[代码][代码]"{{true}}"[代码][代码] [代码][代码]scroll-left[代码][代码]=[代码][代码]"{{deviceScrollLeft}}"[代码] [代码]lower-threshold[代码][代码]=[代码][代码]"20"[代码] [代码]upper-threshold[代码][代码]=[代码][代码]"20"[代码][代码] [代码][代码]bindscrolltoupper[代码][代码]=[代码][代码]"onScrolltoupper"[代码] [代码]bindscroll[代码][代码]=[代码][代码]"onScroll"[代码] [代码]data-e-onScroll-so[代码][代码]=[代码][代码]"this"[代码][代码] [代码][代码]data-e-onScroll-a-a[代码][代码]=[代码][代码]"device"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"scroll-wrapper"[代码] [代码]style[代码][代码]=[代码][代码]"{{anonymousState__temp2}}"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]wx:key[代码][代码]=[代码][代码]"{{v.$$original.id}}"[代码] [代码]class[代码][代码]=[代码][代码]"scroll-item"[代码] [代码]style[代码][代码]=[代码][代码]"{{v.$loopState__temp4}}"[代码][代码] [代码][代码]bindtap[代码][代码]=[代码][代码]"onDeviceChange"[代码] [代码]wx:for[代码][代码]=[代码][代码]"{{loopArray0}}"[代码] [代码]wx:for-item[代码][代码]=[代码][代码]"v"[代码] [代码]wx:for-index[代码][代码]=[代码][代码]"i"[代码][代码] [代码][代码]data-e-onDeviceChange-so[代码][代码]=[代码][代码]"this"[代码] [代码]data-e-onDeviceChange-a-a[代码][代码]=[代码][代码]"{{i}}"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"item-title"[代码][代码]>{{v.$$original.deviceUuid}}</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"prop-row"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"prop-cell"[代码][代码]>主题:{{v.$$original.groupName}}</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"prop-cell"[代码][代码]>模块:{{v.$$original.moduleName}}</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"prop-row"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"prop-cell"[代码][代码]>备注:{{v.$$original.remark}}</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]view[代码] [代码]class[代码][代码]=[代码][代码]"icon-wrapper"[代码][代码]>[代码][代码] [代码][代码]<[代码][代码]image[代码] [代码]class[代码][代码]=[代码][代码]"icon"[代码] [代码]src[代码][代码]=[代码][代码]"{{v.$loopState__temp6}}"[代码] [代码]/>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]view[代码][代码]>[代码][代码] [代码][代码]</[代码][代码]scroll-view[代码][代码]>[代码]scrollview要横向滚动,scroll-wrapper是flex横向布局,在渲染出多个scroll-item之后,每个item里面的字体大小显示的都有问题,不同item内的相同位置的文字大小显示不同,inspector查看,应用到元素上的样式都是相同的。如果我吧scroll-wrapper的布局改成纵向的,字体大小就显示正常了。发点图看看,有没有哪位大神遇到过这种情况,有没有解决掉的,给指点指点啊,下面上图 [图片] [图片] [图片] [图片] 真是每一个都不一样啊
2018-12-29axios获取到的数据格式是多层的,session_key是包在data层下,let session_key = res.session_key 写成 let session_key = res.data.session_key就可以了。
云函数用户数据解密代码片段 [代码]exports.main = async (event, context) => {[代码][代码] [代码][代码]return[代码] [代码]new[代码] [代码]Promise((resolve, reject) => {[代码][代码] [代码][代码]let code = event.code;[代码][代码] [代码][代码]let iv = event.iv;[代码][代码] [代码][代码]let encryptedData = event.encryptedData;[代码][代码] [代码][代码]console.log([代码][代码]typeof[代码][代码](encryptedData),[代码][代码]'encryptedData'[代码][代码])[代码][代码] [代码][代码]axios.get([代码][代码]'https://api.weixin.qq.com/sns/jscode2session?appid=wx374aa024a19a8946&secret=2ad8f6e664e66dbecd9fe3116911f633&js_code='[代码] [代码]+ code + [代码][代码]'&grant_type=authorization_code'[代码][代码])[代码][代码] [代码][代码].then(res => {[代码][代码] [代码][代码]let session_key = res.session_key;[代码][代码] [代码][代码]let openid = res.openid[代码][代码] [代码][代码]let pc = [代码][代码]new[代码] [代码]WXBizDataCrypt([代码][代码]'wx374aa024a19a8946'[代码][代码], session_key)[代码][代码] [代码][代码]let data = pc.decryptData(encryptedData, iv)//就是这句报错[代码][代码] [代码][代码]resolve(data)[代码][代码] [代码][代码]})[代码][代码] [代码][代码].[代码][代码]catch[代码][代码](err => {[代码][代码] [代码][代码]console.log(err, [代码][代码]'err'[代码][代码])[代码][代码] [代码][代码]reject(err)[代码][代码] [代码][代码]})[代码][代码] [代码][代码]}) [代码][代码]}[代码] - 当前 Bug 的表现(可附上截图) [图片] 执行到这里的时候总是报错,提示参数必须时字符串,数组,Buffer,因为这个加密数据本身就是一个字符串,解密用到的构造函数也是官方提供的,不知道为啥还会报错 - 预期表现 希望知道这里为啥会报错或者有其他的解密方法告知也可以 - 复现路径 - 提供一个最简复现 Demo
2018-12-19https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/union-id.html官方文档有说,用你的方法必须是用户已关注公众号
云函数获取UnionID失败用wx.login + code2Session的方式在云函数中获取UnionID失败 云控制台打印出来的解密之后的data[图片] 这是我云函数的代码,WXBizDataCrypt用的是官方的Node解密demo的文件 [代码]// 云函数入口文件[代码][代码]const cloud = require([代码][代码]'wx-server-sdk'[代码][代码])[代码][代码]const request = require([代码][代码]'request'[代码][代码]);[代码][代码]const WXBizDataCrypt = require([代码][代码]'./WXBizDataCrypt'[代码][代码])[代码] [代码]cloud.init()[代码] [代码]const db = cloud.database();[代码] [代码]// 云函数入口函数[代码][代码]exports.main = async (event, context) => {[代码][代码] [代码] [代码] [代码][代码]let url = [代码][代码]'https://api.weixin.qq.com/sns/jscode2session?appid=wx80729b3c71a89b47&secret=d7425e5d465a3ee7e6f3a0aca3ab8ab2&js_code='[代码] [代码]+[代码][代码] [代码][代码]event.code +[代码][代码] [代码][代码]'&grant_type=authorization_code'[代码][代码];[代码] [代码] [代码][代码]return[代码] [代码]new[代码] [代码]Promise((resolve, reject) => {[代码][代码] [代码][代码]new[代码] [代码]Promise((resolve, reject) => {[代码][代码] [代码][代码]try[代码] [代码]{[代码][代码] [代码][代码]request(url, [代码][代码]function[代码] [代码](error, response, body) {[代码][代码] [代码][代码]if[代码] [代码](!error && response.statusCode == 200) {[代码][代码] [代码][代码]return[代码] [代码]resolve(body)[代码][代码] [代码][代码]} [代码][代码]else[代码] [代码]{[代码][代码] [代码][代码]return[代码] [代码]reject(err)[代码][代码] [代码][代码]}[代码][代码] [代码][代码]})[代码][代码] [代码][代码]} [代码][代码]catch[代码] [代码](err) {[代码][代码] [代码][代码]return[代码] [代码]reject(err)[代码][代码] [代码][代码]}[代码][代码] [代码][代码]}).then(res => {[代码][代码] [代码][代码]console.log(res)[代码][代码] [代码][代码]console.log(JSON.parse(res))[代码][代码] [代码][代码]let result = JSON.parse(res);[代码][代码] [代码][代码]let appId = event.userInfo.appId;[代码][代码] [代码][代码]let sessionKey = result.session_key;[代码][代码] [代码][代码]console.log(sessionKey)[代码][代码] [代码][代码]let encryptedData = event.encryptedData;[代码][代码] [代码][代码]let iv = event.iv;[代码][代码] [代码][代码]let pc = [代码][代码]new[代码] [代码]WXBizDataCrypt(appId, sessionKey);[代码][代码] [代码][代码]let data = pc.decryptData(encryptedData, iv);[代码][代码] [代码][代码]console.log([代码][代码]"----data--------:"[代码][代码], data)[代码][代码] [代码][代码]console.log([代码][代码]"-------UnionID--------:"[代码][代码], data.unionId)[代码][代码] [代码][代码]return[代码] [代码]resolve([代码][代码]"ok"[代码][代码])[代码][代码] [代码][代码]});[代码][代码] [代码][代码]});[代码][代码] [代码] [代码]}[代码]
2018-12-19