企业微信相关问题请到企业微信社区咨询 https://developer.work.weixin.qq.com/community/question
调用企业微信发送会话消息接口分享小程序,进了成功回调,但没有发送成功,IOS版企微会闪退?wx.qy.sendChatMessage({ msgtype: 'miniprogram', //消息类型,必填 enterChat: true, //为true时表示发送完成之后顺便进入会话,仅移动端3.1.10及以上版本支持该字段 miniprogram: { appid: 'wx48517433eeecxxxx', //小程序的appid title: productInfo.value.prodname, //小程序消息的title imgUrl: productInfo.value?.images, //小程序消息的封面图 page: `/pageProduct/product/product.html?id=${prodid.value}`, //小程序消息打开后的路径,注意要以.html作为后缀,否则在微信端打开会提示找不到页面 }, success: function (res: any) { console.log('🚀 ~ sendMsg ~ res:', res) }, fail: (err: any) => { console.log('🚀 ~ sendMsg ~ err:企微接口sendChatMessage调用失败', err) }, }) 进了success回调,但是没有发送成功,ios版企业微信还会闪退
2024-09-12具体指什么投诉呢,之前的投诉消息推送截图有吗
小程序的投诉怎么不给运营者微信推消息了?现在没推,收到投诉了,超时了都不知道?小程序的投诉怎么不给运营者微信推消息了吗?现在没推,收到投诉了,超时了都不知道?这是什么反向升级
2024-09-12请具体描述问题出现的流程,并提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。
安卓后台挂起后wx.onLocationChange不执行<template> <view> <custom-tab-bar> <view class="container"> <map id="map" :longitude="longitude" :latitude="latitude" :scale="17" :style="{ width: '100%', height: mapHeight + 'px' }" show-location :polyline="polyline" :markers="markers" @regionchange="regionChange"></map> <view class="toggle-info" @click="toggleInfo"> <image v-if="showInfo" src="@/static/collapse.png" /> <image v-else src="@/static/expand.png" /> </view> <view class="banner"> <view class="info"> <text>轨迹距离: {{ (distance / 1000).toFixed(2) }} 公里</text> <text>海拔高度: {{ altitude }} 米</text> </view> <view class="controls" v-show="showInfo"> <image v-if="!tracking && !paused" src="@/static/start.png" @click="startTracking" /> <image v-if="paused" src="@/static/continue.png" @click="resumeTracking" /> <image v-if="tracking" src="@/static/stop.png" @click="stopTracking" /> <image v-if="paused" src="@/static/pause.png" @click="confirmTerminateTracking" /> </view> <!-- <text v-if="elapsedTime">经过时间: {{ Math.floor(elapsedTime / 60) }} 分 {{ elapsedTime % 60 }} 秒</text> --> </view> </view> </custom-tab-bar> </view> </template> <script> import { startInspection, endInspection } from '@/api/track.js' import { getFormattedDate, } from '@/utils/common.js' import CustomTabBar from '@/pages/components/customTabbar.vue'; export default { components: { CustomTabBar }, data() { return { longitude: 0, latitude: 0, altitude: 0, distance: 0, tracking: false, paused: false, path: [], // 存储移动轨迹 polyline: [], // 生成移动轨迹 lastLocation: null, // 存储上一个有效位置 isStart: false, // 是否满足调用开始接口 isEnd: false, // 是否满足调用结束接口 startId: null, // ID获取 startTime: 0, // 记录开始时间 // elapsedTime: 0, // 添加经过时间字段,以秒为单位 // timerId: null // 定时器ID locationChangeHandler: null, inspectionSortKey: 0, showInfo: true, mapHeight: 520, systemInfo: null, markers: [], }; }, mounted() { this.systemInfo = uni.getSystemInfoSync(); this.mapHeight = this.systemInfo.platform === 'ios' ? 520 : 480; // 根据需要调整高度 }, onLoad() { this.restoreState(); this.requestLocationPermission(); }, onUnload() { // this.saveState(); }, onHide() { this.saveState(); }, methods: { requestLocationPermission() { uni.authorize({ scope: 'scope.userLocationBackground', success: () => { this.getCurrentLocation(); }, fail: () => { uni.showModal({ title: '提示', content: '请授权获取位置信息,否则无法使用该功能', showCancel: false }); } }); }, getCurrentLocation() { uni.getLocation({ type: 'gcj02', altitude: true, success: (res) => { if (res && res.longitude !== undefined && res.latitude !== undefined) { this.longitude = res.longitude; this.latitude = res.latitude; this.altitude = (res.altitude || 0).toFixed(2); this.lastLocation = { longitude: res.longitude, latitude: res.latitude }; } else { console.error("获取位置返回值不正确", res); } }, fail: (err) => { console.error("获取位置失败", err); } }); }, startTracking() { wx.startLocationUpdateBackground({ type: 'wgs84', success: (res) => { // console.log(res, 'startLocationUpdateBackgroundstartLocationUpdateBackground') if (this.tracking) return; this.isStart = true; this.tracking = true; this.paused = false; this.path = []; this.polyline = []; this.getLocationAndUpdate(); // this.timerId = setInterval(() => { // this.elapsedTime++; // }, 1000); }, fail: (err) => { console.error('开始后台定位失败', err); } }); }, getLocationAndUpdate() { this.locationChangeHandler = async (res) => { const { longitude, latitude, altitude, accuracy, } = res; console.log(res, 'resresresres') this.altitude = (altitude || 0).toFixed(2); if (this.isSignificantChange(longitude, latitude) && this.startId !== null && accuracy < 40) { this.inspectionSortKey++ this.path.push({ longitude, latitude, height: (altitude || 0).toFixed(2), inspectionSortKey: this.inspectionSortKey }); this.updatePolyline(); this.calculateDistance(); this.longitude = longitude; this.latitude = latitude; this.lastLocation = { longitude, latitude }; // 更新上一个位置 } else if (this.startId === null) { if (this.isStart) { await this.reverseGeocode(longitude, latitude, res); } } }; wx.onLocationChange(this.locationChangeHandler); }, async stopTracking() { if (!this.tracking) return; this.tracking = false; this.paused = true; // if (this.timerId !== null) { // clearInterval(this.timerId); // this.timerId = null; // } await this.getLocationAndUpdate(); if (this.locationChangeHandler) { wx.offLocationChange(this.locationChangeHandler); this.locationChangeHandler = null; // 清空引用 } }, resumeTracking() { wx.startLocationUpdateBackground({ type: 'wgs84', success: (res) => { if (this.tracking) return; this.tracking = true; this.paused = false; this.getLocationAndUpdate(); }, fail: (err) => { console.error('开始后台定位失败', err); } }); // this.timerId = setInterval(() => { // this.elapsedTime++; // }, 1000); }, confirmTerminateTracking() { uni.showModal({ title: '确认终止', content: '请确认本次轨迹定位是否结束', success: (res) => { if (res.confirm) { this.isEnd = true; this.isStart = false; uni.getLocation({ type: 'gcj02', altitude: true, success: async (res) => { const { longitude, latitude, altitude } = res; await this.reverseGeocode(longitude, latitude, res); this.markers.push({ id: 2, latitude, longitude, iconPath: '/static/road-stop.png', // 开始图标路径 width: 60, height: 60, }); setTimeout(() => { this.markers = []; }, 2000) }, fail: (err) => { console.error("获取位置失败", err) } }); } } }); }, updatePolyline() { this.polyline = [{ points: this.path, color: "#FF0000DD", width: 5, dottedLine: false }]; }, calculateDistance() { if (this.path.length < 2) return; const lastPoint = this.path[this.path.length - 2]; const currentPoint = this.path[this.path.length - 1]; const distance = this.getDistance(lastPoint, currentPoint); this.distance += distance; }, getDistance(point1, point2) { const radLat1 = (point1.latitude * Math.PI) / 180.0; const radLat2 = (point2.latitude * Math.PI) / 180.0; const a = radLat1 - radLat2; const b = (point1.longitude * Math.PI) / 180.0 - (point2.longitude * Math.PI) / 180.0; let s = 2 * Math.asin( Math.sqrt( Math.pow(Math.sin(a / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2) ) ); s = s * 6378137.0; // 地球半径 s = Math.round(s * 10000) / 10000.0; return s; }, isSignificantChange(longitude, latitude) { if (!this.lastLocation) return true; const deltaLongitude = Math.abs(longitude - this.lastLocation.longitude); const deltaLatitude = Math.abs(latitude - this.lastLocation.latitude); return deltaLongitude > 0 || deltaLatitude > 0; }, regionChange(e) { // console.log('region change', e); }, async reverseGeocode(longitude, latitude, data) { // const key = '6b7fd0d3e900c4be1279cb705e103953'; const key = '2f2f22f5109d0b452c754da47fd45f6d'; const url = `https://restapi.amap.com/v3/geocode/regeo?location=${longitude},${latitude}&key=${key}`; // const url = `https://restapi.amap.com/v3/geocode/regeo?location=119.146617,33.618107&key=${key}`; try { let params; const res = await new Promise((resolve, reject) => { uni.request({ url: url, success: (res) => { resolve(res); }, fail: (err) => { reject(err); } }); }); if (this.isStart) { const formattedDate = getFormattedDate(); if (!this.startId) this.startTime = formattedDate; const { city, province, district, township } = res.data.regeocode.addressComponent; params = { id: this.startId, longitude, latitude, city: Array.isArray(city) ? null : city, province, district, township, address: res.data.regeocode.formatted_address, height: (data.altitude || 0).toFixed(2), inspectionSortKey: this.inspectionSortKey, inspectionStartTime: formattedDate }; const startRes = await startInspection(params); this.startId = startRes.data; this.markers.push({ id: 1, latitude, longitude, iconPath: '/static/road-start.png', // 开始图标路径 width: 60, height: 60, }); if (this.path.length === 0) { this.inspectionSortKey++; this.path.push({ longitude, latitude, height: (data.altitude || 0).toFixed(2), inspectionSortKey: this.inspectionSortKey }); } this.isStart = false; } if (this.isEnd) { params = { id: this.startId, userInspectionDtoList: this.path, totalDistance: this.distance.toFixed(2), } await endInspection(params); this.paused = false; this.tracking = false; this.isEnd = false; this.distance = 0; this.altitude = 0; this.startId = null; this.path = []; this.polyline = []; this.inspectionSortKey = 0; uni.removeStorageSync('trackingState'); wx.stopLocationUpdate({ success: () => { console.log('成功停止后台定位'); if (this.locationChangeHandler) { wx.offLocationChange(this.locationChangeHandler); this.locationChangeHandler = null; // 清空引用 } }, fail: (err) => { console.error('停止后台定位失败', err); } }); } } catch (e) { console.error("反向地理编码请求失败", e); } }, saveState() { const state = { startId: this.startId, // 开始运动ID startTime: this.startTime, // 开始日期 isStart: this.isStart, // 开始状态 tracking: this.tracking, // 按钮显示状态 paused: this.paused, // 按钮显示状态 isEnd: this.isEnd, // 是否满足结束状态 lastLocation: this.lastLocation, // 存储上一个有效位置 path: this.path, hideTime: getFormattedDate(), inspectionSortKey: this.inspectionSortKey, // distance: this.distance, // polyline: this.polyline, }; uni.setStorageSync('trackingState', state); }, restoreState() { this.constructor(); const state = uni.getStorageSync('trackingState'); if (state) { if (state.startId) { const currentDate = new Date(); const pastDateObj = new Date(state.hideTime); const timeDifference = currentDate - pastDateObj; if (timeDifference > 240000) { uni.showModal({ title: '提示', content: '检测到您上次的跑步还没有结束,是否继续?', success: (res) => { if (res.confirm) { const { startId, startTime, isStart, tracking, paused, isEnd, lastLocation, path, inspectionSortKey } = state; this.startId = startId; // 开始运动ID this.startTime = startTime; // 开始日期 this.isStart = isStart; // 开始状态 this.tracking = tracking; // 按钮显示状态 this.paused = paused; // 按钮显示状态 this.isEnd = isEnd; // 是否满足结束状态 this.lastLocation = lastLocation; // 存储上一个有效位置 this.path = path; this.inspectionSortKey = inspectionSortKey; // if (tracking) { // const pastDate = new Date(startTime); // 过去的日期 // const currentDate = new Date(); // 当前日期 // // 计算时间差(以秒为单位) // this.elapsedTime = Math.floor((currentDate - pastDate) / // 1000); // 转换为秒 // } // this.timerId = setInterval(() => { // this.elapsedTime++; // }, 1000); } else if (res.cancel) { this.confirmTerminateTracking() } } }); } } } }, constructor() { this.longitude = 0; this.latitude = 0; this.altitude = 0; this.distance = 0; this.tracking = false; this.paused = false; this.path = []; // 存储移动轨迹 this.polyline = []; // 生成移动轨迹 this.lastLocation = null; // 存储上一个有效位置 this.isStart = false; // 是否满足调用开始接口 this.isEnd = false; // 是否满足调用结束接口 this.startId = null; // ID获取 this.startTime = 0; // 记录开始时间 this.inspectionSortKey = 0; // this.elapsedTime = 0; // 添加经过时间字段,以秒为单位 // this.timerId = null; // 定时器ID }, toggleInfo() { this.showInfo = !this.showInfo; // 切换信息的显示状态 if (this.showInfo) { this.mapHeight = this.systemInfo.platform === 'ios' ? 520 : 480; // 根据需要调整高度 } else { this.mapHeight = this.systemInfo.platform === 'ios' ? 600 : 550; // 根据需要调整高度 } }, } }; </script> <style> .container { display: flex; flex-direction: column; align-items: center; justify-content: center; } .controls { margin-top: 20px; display: flex; flex-direction: row; justify-content: center; gap: 15px; } .controls image { width: 50px; height: 50px; cursor: pointer; } .toggle-info { width: 100%; padding-bottom: 10px; text-align: center; } .toggle-info image { width: 25px; height: 25px; } .banner { width: 100%; } .info { display: flex; align-items: center; justify-content: center; padding: 0 30px; } .info text { flex: 1 } .info text:last-child { text-align: right; } </style>
2024-09-12https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/getPhoneNumber.html [图片]
手机号快捷登录 微信开发者平台需要开启什么功能呢?<button v-if="isAgreement" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber" size="lg" 用大哥微信扫码就可以 我的需要开通什么功能呢 具体是哪里呢 现在是{errMsg: "login:ok", code: "0a3kNOll2rRm7e4vXwol2D9s1E3kNOle"} 可以获取到这个 调用getPhoneNumber(phone) errMsg: "getPhoneNumber:fail no permission"
2024-09-12企业微信相关问题请到企业微信社区咨询 https://developer.work.weixin.qq.com/community/question
wx.previewimage在企业微信中不显示上面的数字?[图片]({ urls: [ 'https://static.bottegaveneta.cn/media/upload/D_B15_2000x2000.jpg', 'https://static.bottegaveneta.cn/media/upload/D_B15_2000x2000.jpg', ], current: e.detail.current, })
2024-09-11你好,麻烦在手机微信那里上传下日志: 我->设置->帮助与反馈右上角有个上报日志的入口,麻烦提供一下微信号,时间点
微信小程序中接入百度定位偶现无响应?一旦出现问题,必须等10~20分钟才会好转。微信小程序中调用定位接口,偶尔有人会出现十到二十分钟内定位接口无返回情况,长时间定位不了,关机,开关飞行模式以及定位均无用 当我小程序静置一段时间之后,调用百度定位接口就会没有响应了,像是微信拿不到定位信息,网络请求就是pending状态 一开始以为是百度接口的问题,跟百度提工单反馈,他们回复是微信定位失败了,还未走到他们接口
2024-09-11购物订单这个功能已经不开放申请了
小程序申请开通购物订单功能半年了都没有任何回应?根据开通的提示在2月4日发邮件申请开通,目前都没有任何回应 [图片] [图片] [图片]
2024-09-11fail报错什么
微信小程序wx.getLocation之前好好的,突然今天就都失败了?onLoad: function(options) { console.log(options) this.setData({ realName: options.realName, carrierName: options.carrierName, toCompany: options.toCompany, id: options.id, companyCode: options.companyCode, alreadySign: options.driverCheckIn == 'Y' ? true : false, }) let that = this wx.getSetting({ success(res0) { console.log('查看是否吊起过授权', res0) // 查看是否吊起过授权 if (!Object.keys(res0.authSetting).includes('scope.userLocation')) { that.getAddress() return } // 已经吊起过授权并且拒绝授权 if (!res0.authSetting['scope.userLocation']) { wx.showModal({ title: '您未开启地理位置授权', content: '为了给您提供更好的服务,请您授权地理位置,谢谢', success: res2 => { if (res2.confirm) { wx.openSetting({ success(res3) { console.log('吊起过授权---并且拒绝--重新设置授权',res3) // 成功授权地理位置 if (res3.authSetting['scope.userLocation']) { that.getAddress() } else { // 未授权地理位置,默认显示 console.log('重新授权---未允许,默认显示') that.getAddress() } } }) } else { console.log('拒绝授权地理位置,默认显示') that.getAddress() } } }) } else { that.getAddress() } } }) }, rad(d) { return d * Math.PI / 180.00 }, getAddress(){ let that = this; wx.getLocation({ type: 'wgs84', success(res) { let x = that.rad(res.longitude) let y = that.rad(res.latitude) that.setData({ longitude: res.longitude, latitude: res.latitude }) // 苏宝化坐标 let x1 = that.rad(120.474476) let y1 = that.rad(31.410634) let w = x - x1 let h = y - y1 let s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(w / 2), 2) + Math.cos(x) * Math .cos(x1) * Math.pow(Math.sin(h / 2), 2))) s = s * 6378137.0 s = Math.round(s * 10000) / 10000 console.log(s) if (s > 5000) { that.setData({ canSign: false, signAddressRange: s, }) }else{ that.setData({ canSign: true, signAddressRange: s, }) } that.driverCheckInDataHandler(); }, fail(res) { that.setData({ canSign: false, signAddressRange: 'ssss', }) console.log(res) wx.showModal({ title: '提示', content: '获取定位失败', showCancel: false }) }, complete(res) {} }) }, 今天开始,进来页面wx.getLocation都会走到fail中
2024-09-11短剧类目要用小游戏框架开发
上传代码的时候报错,这是什么原因,是小程序没有game.json.文件啊?appid:wx1456460eec897829[图片]
2024-09-11对应文档发下呢
小程序返回authorization_info里面的confirm_info对象参数说明?API获取授权方的帐号基本信息 ,小程序返回示例中authorization_info里面的confirm_info对象参数代表什么意思? "authorization_info""authorizer_appid""wxf24d2dfc1a974128""authorizer_refresh_token""xxxxxx""func_info""funcscope_category""id"17"funcscope_category""id"18"confirm_info""need_confirm"0"already_confirm"0"can_confirm"0"funcscope_category""id"19"funcscope_category""id"25"confirm_info""need_confirm"0"already_confirm"0"can_confirm"0"funcscope_category""id"30"confirm_info""need_confirm"0"already_confirm"0"can_confirm"0"funcscope_category""id"31"confirm_info""need_confirm"0"already_confirm"0"can_confirm"0"funcscope_category""id"36"funcscope_category""id"37"funcscope_category""id"40}}, ]}
2024-09-11