- 求助 怎么获取到微信的默认用户名?
现在使用input的属性nickname可以获取 有什么办法可以不需要使用输入框 进入小程序时 可以自动获取到微信设置的微信名呢? getUserInfo这个api也失效了 有什么方法可以拿到呢
星期四 09:36 - onShareTimeline分享朋友圈 部分页面不生效?
已按照官方文档 添加了onShareAppMessage分享好友 再添加 onShareTimeline分享朋友圈 但页面不生效 按钮置灰 其他页面生效了 这是首页的 onShareAppMessage((res) => { console.log("点击分享了"); if (res) { const par = { requestParam: { userid: userInfo.value.id, companyId: userInfo.value.companyId, }, appName: "shop", moduleName: "share", responseParam: res, logMethod: "post", logUri: `/pages/mallHome/mallHome?userId=${userInfo.value.id}&companyId=${userInfo.value.companyId}`, logDesc: "首页分享", logType: 8, remark: "分享小程序", }; paramLog(par); } return { title: "小程序", path: `/pages/mallHome/mallHome?userId=${userInfo.value.id}&companyId=${userInfo.value.companyId}`, }; }); onShareTimeline(() => { return { title: `测试小程序`, query: ``, }; }); 这是其他页面的 onShareAppMessage((res) => { if (res.from === "button") { // 来自页面内分享按钮 console.log(res.target); } const promise = new Promise((resolve, reject) => { setTimeout(() => { resolve({ title: info.value.title, path: `/subpackage/pages/goodDetail/goodDetails?userId=${ userInfo.value.id }&companyId=${userInfo.value.companyId}&id=${JSON.stringify(id.value)}`, }); }, 10); }); isShow.value = false; const par = { requestParam: { userid: userInfo.value.id, companyId: userInfo.value.companyId, id: id.value, }, appName: "shop", moduleName: "share", responseParam: res, logMethod: "post", logUri: `/subpackage/pages/goodDetail/goodDetails?userId=${ userInfo.value.id }&companyId=${userInfo.value.companyId}&id=${JSON.stringify(id.value)}`, logDesc: "商品分享", logType: 8, remark: `${shopObj.value.title.split("-")[0] || shopObj.value.title}`, }; paramLog(par); return { promise, }; }); onShareTimeline(() => { const par = { requestParam: { userid: userInfo.value.id, companyId: userInfo.value.companyId, id: id.value, }, appName: "shop", moduleName: "share", responseParam: "", logMethod: "post", logUri: `/subpackage/pages/goodDetail/goodDetails?userId=${ userInfo.value.id }&companyId=${userInfo.value.companyId}&id=${JSON.stringify(id.value)}`, logDesc: "商品分享朋友圈", logType: 8, remark: `${shopObj.value.title.split("-")[0] || shopObj.value.title}`, }; paramLog(par); return { title: `${shopObj.value.title.split("-")[0] || shopObj.value.title}`, query: ` userId=${userInfo.value.id} &companyId=${userInfo.value.companyId} &id=${JSON.stringify(id.value)} &shareTime=${JSON.stringify(true)} &list=${JSON.stringify(list.value)} &info=${JSON.stringify(info.value)} &shopInfo=${JSON.stringify(shopInfo.value)}`, imageUrl: urlBase.value + mainImg.value, }; });
12-11 - 微信小程序 调试库3.5.0 使用canvas调用drawImage方法无法画图 ? 求解答 无报错
const ctx = uni.createCanvasContext(canvaId, this); const fsm = wx.getFileSystemManager(); let extName = base64.match(/data\:\S+\/(\S+);/); if (extName) { extName = extName[1]; } // const ctx = uni.createCanvasContext(canvaId, this); let fileName = Date.now() + "." + extName; let filePath = wx.env.USER_DATA_PATH + "/" + fileName; fsm.writeFile({ filePath, data: base64.replace(/^data:\S+\/\S+;base64,/, ""), encoding: "base64", success: (res) => { wx.getImageInfo({ src: filePath, success: (res) => { console.log("Image info:", res, res.path); ctx.drawImage(res.path, 0, 0, 300, 300); // 使用获取到的图片路径 ctx.draw(false, () => { console.log("Canvas drawn"); }); // 绘制到画布 }, fail: (error) => { console.error("获取图片信息失败:", error); }, }); }, fail: (error) => { console.error("写入失败", error); }, });
07-30