验证的时候是用get请求你的接口,验证通过后,后续推送消息是POST请求你的接口
咨询一个关于开发接入指南的问题接入概述echostr 这是我配置的测试公帐号接入地址 [图片] 正常按照文档接入完成后 为什么后期会有这样的请求来请求该接入接口 [图片] "POST /wx/gzh/vaildationGzh?signature=8bc5605a4a42b989f252cc96456d72c86511c23c×tamp=1675175310&nonce=184710219&openid=o8B3q6f49OiCqrLL04esLTZREIWk
2023-02-01额...
为什么我用wx.chooseMessageFile上传的文件只能上传一个?请大神指导我在网上看到别人的代码,但是只能上传一张,搞来搞去不明白,请大神指导。代码如下: <button type="primary" style="margin-top: 105rpx;" bindtap="uploadFileTap" data-type="file">上传文件</button> <button type="primary" style="margin-top: 45rpx;" bindtap="uploadFileTap" data-type="img">上传图片</button> // pages/uploadFile/uploadFile.js Page({ /** * 页面的初始数据 */ data: {}, /** 上传按钮点击监听 */ async uploadFileTap(res) { // 上传类型 const type = res.currentTarget.dataset.type let filePathObj = null let filePathList = [] if (type == 'file') { filePathObj = await this.chooseMessageFile(1, 'file') if (!filePathObj) return filePathList.push(filePathObj.tempFiles[0].path) } else if (type == 'img') { filePathObj = await this.chooseImg(2) if (!filePathObj) return filePathList = filePathObj.tempFilePaths } else { return } console.log("选择文件信息 ====>", filePathObj) let cloudPathList = [] for (let i = 0; i < filePathList.length; i++) { const cloudPathObj = await this.upLoadFile(filePathList[i], 'file') if (!cloudPathObj) { continue } console.log(filePathList[i], "文件上传成功=====>", cloudPathObj) cloudPathList.push(cloudPathObj.fileID) } console.log("最终返回云文件ID列表 =====>", cloudPathList) }, /** * 从聊天记录选择文件 * @param {number} count 可选择数量(1-100) * @param {string} type 可选择文件类型 all:全部类型 video: 仅视频 image: 仅图片 file: 除了视频、图片外的文件类型 */ chooseMessageFile(count, type) { return new Promise((resolve, reject) => { wx.chooseMessageFile({ count: count, type: type, success(res) { resolve(res) }, fail(err) { console.log("选择文件错误 =====>", err) resolve(false) } }) }) }, /** 选择图片封装函数 * @param count 照片数量 * @param sizeType 照片的质量, 默认 ['original', 'compressed'] * @param sourceType 照片来源, 默认 ['album', 'camera'] */ chooseImg(count, sizeType, sourceType) { if (!count) count = 1 if (!sizeType) sizeType = ['original', 'compressed'] if (!sourceType) sourceType = ['album', 'camera'] return new Promise((resolve, reject) => { wx.chooseImage({ count: count, sizeType: sizeType, sourceType: sourceType, success(res) { resolve(res) }, fail(err) { resolve(false) console.error("===== 选取照片失败 =====", err) } }) }) }, /** * 上传文件封装函数, 文件名随机性处理,由17位随机字符+13位时间戳组成 * @param {string} filePath 要上传图片的临时路径 * @param {string} cloudPathPrefix 云数据库存储文件路径前缀 */ upLoadFile(filePath, cloudPathPrefix) { // 取随机名 let str = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; let randomStr = ''; for (let i = 17; i > 0; --i) { randomStr += str[Math.floor(Math.random() * str.length)]; } randomStr += new Date().getTime() return new Promise((resolve, reject) => { let suffix = /\.\w+$/.exec(filePath)[0] //正则表达式返回文件的扩展名 let cloudPath = cloudPathPrefix + '/' + randomStr + suffix wx.cloud.uploadFile({ cloudPath: cloudPath, filePath: filePath, success(res) { resolve(res) }, fail(err) { resolve(false) console.error("===== 上传文件失败 =====", err) }, }) }) }, })
2023-02-01楼上文档已经发出来了,可以跑起来测试一下,看看文档有没有写错
哪能看到applyAnimatedStyle文档,translate应该是transform吧this.applyAnimatedStyle('#moved-box', () => { 'worklet'; return { translate: `translateX(${offset.value}px)` } }) //https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/worklet.html
2023-02-01https://mp.weixin.qq.com/cgi-bin/wx?token=&lang=zh_CN
小程序怎么开通?你好 微信公众号小程序怎么开通
2023-01-31util.request(api.CommentList 前面加上return 试下
wx.request里for循环遍历数组数组显示异常?const util = require('../utils/util.js'); const api = require('../config/api.js'); /** * * @param {number} spuId * @param {number} pageNum * @param {number} pageSize * @param {number} commentsLevel * @param {boolean} hasImage */ let recordsLength = 0; export function getGoodsAllComments(params) { let commentList = { pageNum: 1, pageSize: 10, totalCount: '47', pageList: [], }; console.log("来查询评价信息params", params) const { hasImage, spuId, commentLevel } = params.queryParameter; const { pageNum, pageSize } = params; // 发起远程 网络请求查询每一件商品的评价 let commentTemplate = { spuId: '1722045', skuId: '1697694', specInfo: '很不错', commentContent: '收到货了,第一时间试了一下,很漂亮特别喜欢,大爱大爱,颜色也很好看。棒棒!', // commentImageUrls: null, commentScore: 1, uid: '88881048075', userName: 'Dean', userHeadUrl: 'https://cdn-we-retail.ym.tencent.com/tsr/avatar/avatar1.png', isAnonymity: false, commentTime: '1592224320000', isAutoComment: false, sellerReply: '亲,你好,我们会联系商家和厂商给您一个满意的答复请一定妥善保管好发票', goodsDetailInfo: '颜色:纯净白 尺码:S码', commentResources: [] } return new Promise(function (resolve, reject) { util.request(api.CommentList, { userId: wx.getStorageSync('userId'), prodId: Number(spuId) + 1, pageNum: pageNum, pageSize: pageSize }, 'GET', '').then(res => { if (res.code == 200) { let records = res.data.records; console.log("评价records", records) // 总评论数 recordsLength = records.length console.log("recordsLength", records.length) records.forEach((comment) => { console.log("每一个comment", comment) // 商品ID commentTemplate.spuId = comment.productId // 评价ID // commentTemplate. =comment.evaluateId // 评价内容 commentTemplate.commentContent = comment.evaluationcontent // 评价时间 commentTemplate.commentTime = comment.evaluationtime // 评价星级 commentTemplate.commentScore = comment.stars // 评价用户头像 commentTemplate.userHeadUrl = comment.useravatar // 评价用户昵称 commentTemplate.userName = comment.username // 评价商品尺码颜色 commentTemplate.goodsDetailInfo = comment.prodSpec // 商家回复信息 commentTemplate.sellerReply = comment.sellerReply // 用户ID commentTemplate.uid = comment.userId let aa = commentTemplate console.log("----commentTemplate.", aa) console.log("----comment", comment) // 如果包含评论图片或视频 let imgs = comment.evaluateimgurl; let video = comment.evaluatevediour; if (imgs != null || video != null) { if (video != null) { let picOrVideo = { src: '', type: '', } picOrVideo.type = 'video' picOrVideo.src = api.RESOURCE_COMMON_PATH + video console.log("push。。") commentTemplate.commentResources.push(picOrVideo) } else { let picOrVideo = { src: '', type: '', } picOrVideo.type = 'image' picOrVideo.src = api.RESOURCE_COMMON_PATH + imgs console.log("push。。") commentTemplate.commentResources.push(picOrVideo) } } // push到列表里 commentList.pageList.push(commentTemplate) // console.log("---commentTemplate",commentTemplate) // commentTemplate.commentResources=[] // 判断是否有好评、中评、差评、 if (commentLevel) { if (commentLevel == 3) { // 好评 commentList.pageList = commentList.pageList.filter( (comments) => comments.commentScore > 3, ); } else if (commentLevel == 2) { // 中评 commentList.pageList = commentList.pageList.filter( (comments) => comments.commentScore == 3, ); } else { // 差 commentList.pageList = commentList.pageList.filter( (comments) => comments.commentScore < 3, ); } } }) console.log("评论res", res.data.records) console.log("commentList-----", commentList) resolve(commentList) } }); }).then((res) => { //同步返回 console.log("操作后的返回评价", commentList) return commentList; }) } 部分输入结果 尤其是输出这段预览数组和展开不一致(预览是正常的数据 展开的数据就变成了下一条数据的内容) [图片] 数据展示效果也是异常 [图片] 后台返回两个评价 两个数组一样 而且图片是两个评价的图片合一起的(正常应该是小人图片是第一个评价的图片 小狗是第二个的),网上我查了一下好像是异步 里for循环的问题 请问如何解决? 谢谢啦
2023-01-31把微信的回调信息打印出来
微信小程序支付成功之后,回调数据,只有一个金额,支付0.01就只返回1,没有其他任何数据?什么问题呢
2023-01-31需求有点小众
是否能够考虑开发延时发送或者预约时间发送的功能?或者开发一款小程序作为微信延展功能来实现?是否能够考虑开发延时发送或者预约时间发送的功能?或者开发一款小程序作为微信延展功能来实现? 使用场景:本人习惯早起工作,每天凌晨4点左右起床借助于台式电脑的桌面微信开展工作,头脑清醒、思路敏捷、效率极高,经常想到的工作想及时通过微信或者微信群发布给同事或者合作伙伴,但是凌晨发微信往往会影响到别人的正常睡眠休息,尤其是在群里面发消息,涉及的到人较多,影响面太大,为了不打扰到别人休息,但又不打断自己的工作思路,把工作有逻辑地安排布置出去,我只能先把要发的内容编辑在发送对象的文本框中,但不点击发送,等到7、8点钟差不多发送对象起床了以后再点击发送。但是要发送的对象一多往往会有遗漏,或者因为上班关电脑而忘了发送,从而导致之前的工作全部白费,很多关键要点难以再次回忆起来。还有一个类似场景,别人在召开重要会议的时候,为了不打搅别人,也希望有延时/预约功能。 基于此类场景的需求,强烈希望微信团队能够开发出微信内容延时/预约发送功能,为了区别实时微信和预约微信内容,可以在发送内容前面加注“此条微信于几点几分由谁编辑使用预约功能设定于几点几分发送”的说明。 希望本人强烈的述求能够得到微信开发团队的关注和支持!
2023-01-31哎我最近也碰到这个问题。。。
无法用云函数接收到公众号的菜单点击事件推送?小程序的环境共享已设置,也在公众号调试中的云开发里加入了消息推送,测试接收text和subscribe事件都正常。 如图,event中没有CLICK事件,开发者工具版本号为RC 1.05.2203251 [图片]
2023-01-30建议断点或者直接打印res就能知道问题所在了
wx.chooseMedia示例打印错误?wx.chooseMedia({ count: 9, mediaType: ['image','video'], sourceType: ['album', 'camera'], maxDuration: 30, camera: 'back', success(res) { console.log(res.tempFiles.tempFilePath) // 这个是错误,返回的数组 console.log(res.tempFiles.size) // 这个是错误,返回的数组 } })
2023-01-30床
有奖调研|小程序渲染很难很复杂?告诉我们来优化!听说用户都喜欢流畅的交互体验?但是开发实现很困难 听说产品都想要复杂的交互动画?但是实现效果很一般 听说小程序渲染框架更新新能力?但是不清楚怎么使用 …… 渲染流程是前端开发中的重要环节,如何实现复杂的交互效果、如何实现性能与交互的平衡、如何兼容新旧版本的特性往往困扰着不少前端开发者。 为了进一步优化小程序性能,提供更接近原生的用户体验,小程序团队一直致力于优化 小程序渲染框架,提升开发效率,优化小程序的用户体验。例如利用新版 scroll-view 组件实现 更丝滑的滚动方式、更多元的布局方式 等。 现邀请各位开发者参与「小程序渲染框架有奖调研」,畅所欲言,让我们更了解你的需求和建议。 [图片] 2023 年 2 月 8 日停止收集问卷后,微信团队将从有效问卷中随机抽取 5 位参与者,各送出微信官方周边礼物 1 份,快来分享你的开发体验吧! [图片] * 获奖名单将于「微信开发者」公众号以及本话题下方评论区进行公示
2023-01-30