list.sort((a, b) => b.status.length - a.status.length)
请教,怎么将下列数据根据字段里元素的个数进行排序?// 怎么将下列数据根据status字段里元素的个数进行排序 list = [ { "_id": { "user":"A" }, "status": [ "success", "checking", "success", "checking", "success", "checking", "checking", "checking", "checking", "checking" ] }, { "_id": { "user": "B" }, "status": [ "success", "success", "success", "success", "fail", "success", "fail", "fail", "fail", "fail", "checking", "checking", "checking", "checking", "checking", "checking", "checking", "checking" ] }, { "_id": { "user": "C" }, "status": [ "fail" ] }, { "_id": { "user": "D" }, "status": [ "fail", "fail" ] } ] // 处理后的数据 list = [ { "_id": { "user": "B" }, "status": [ "success", "success", "success", "success", "fail", "success", "fail", "fail", "fail", "fail", "checking", "checking", "checking", "checking", "checking", "checking", "checking", "checking" ] }, { "_id": { "user":"A" }, "status": [ "success", "checking", "success", "checking", "success", "checking", "checking", "checking", "checking", "checking" ] }, { "_id": { "user": "D" }, "status": [ "fail", "fail" ] }, { "_id": { "user": "C" }, "status": [ "fail" ] } ] // list是聚合函数获取的数据 db.collection('userUpfile') .aggregate() .group({ _id: { user: '$user' }, status: $.push( "$status" ) }) .sort() .limit(1000) .end()
2022-08-23[图片] cover-view 替换为view就可以了
自定义tabbar真机不显示图标和文字,如何解决?[图片][图片] 因小程序分不同角色,不同角色显示不同的tabbar,所以使用了自定义tabbar,开发工具能正常展示,但是使用真机的时候,不展示。请问是哪里出问题了,如何解决,先在这儿谢谢社区大佬。https://developers.weixin.qq.com/s/UdCJdHml7TBp
2022-08-22focus="{{false}}" 试试
原生input iphone机型下自动弹出键盘?。<van-popup custom-style="height: 50%; width:100%" position="bottom" show="{{ isShow }}" bind:close="onClose"> <van-picker show-toolbar columns="{{ columns }}" bind:confirm="onConfirm" bind:cancel="onClose" active-class="active-blue"> <!-- picker修改源码 --> <view slot="after" wx:if="{{schoolshow}}"> <input wx:if="{{schoolshow}}" type="text" style="background: #eee;margin-top: 10px;font-size: 13px;width: 200px;height: 60rpx;border-radius: 5px;padding-left: 5px;border-radius: 35rpx" placeholder="没有我所在的学校,请填写" bindinput="bindCode" focus="false" auto-focus="false" /> </view> </van-picker> </van-popup>
2022-08-221,在公众号菜单中的链接打开,才能正常分享卡片;2,可以通过收藏链接,再打开分享也是卡片;3,把链接换成二维码,扫码后进入分享也是卡片。如果是用微信直接打开链接分享会是链接。
链接分享不显示图文。https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html 微信环境下,H5页面分享到微信(发朋友或朋友圈),只显示链接,不能显示图文——发QQ显示图文。 公众号,接口URI确认设置无误。
2022-08-17审核团队通知你能预上线的时候就能预上线了
二次审核已超七天,如何申请预上线?[图片] 小程序二次审核已超过七天,请问如何申请预上线?
2022-08-17createTime是Date类型的,wxs处理不了,两种方案:1.js中处理,不要用wxs了。2.js中setData的时候转成YYYY/MM/DD HH:mm:ss字符串格式的,再用wxs处理就没问题了
求助,百度了N次,说db.serverDate()创建的时间。无法在WXML中解析?wxs时间格式化页面时间是正常的,格式化服务器的时间就显示NaN,百度上查很多,有的说,db.serverDate()创建的时间,在wxml中无法解析。怎么解决? [图片][图片][图片][图片] wxs代码: var timeFormat = function(time){ console.log(time); var date = getDate(time); console.log(date); var date_seconds = date.getTime() / 1000; var now = getDate(); var now_seconds = now.getTime() / 1000; var timestamp = now_seconds - date_seconds; var timeStr = ""; if(timestamp < 60){ timeStr = "刚刚"; }else if(timestamp >= 60 && timestamp < 60 * 60){ var minutes = parseInt(timestamp / 60); timeStr = minutes + "分钟前"; }else if(timestamp >= 60 * 60 && timestamp < 60 * 60 * 24){ var hours = parseInt(timestamp / 60 / 60); timeStr = hours + "小时前"; }else if(timestamp >= 60 * 60 * 24 && timestamp < 60 * 60 * 24 * 30){ var days = parseInt(timestamp / 60 / 60 / 24); timeStr = days + "天前"; }else{ var year = date.getFullYear(); var month = date.getMonth(); var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); timeStr = year + "/" + month + "/" + day + " " + hour + ":" + minute; } return timeStr; } module.exports={ timeFormat:timeFormat, }
2022-08-05[图片] canvas的方法,不是context
canvas绘制后转base64,】toDataURL is not a function?[图片][图片]
2022-08-04create_time是什么样的,是不是YYYY-MM-DD这种的?ios不能转化带-的,只能转化带/的
获取真实的数据,时间显示NaN/NaN/NaN NaN:NaN,求大师帮忙 ?[图片] console.log(time)显示信息如下 [图片] wxs代码: var timeFormat = function(time){ // console.log(time); var date = getDate(time); console.log(date); var date_seconds = date.getTime() / 1000; var now = getDate(); var now_seconds = now.getTime() / 1000; var timestamp = now_seconds - date_seconds; var timeStr = ""; if(timestamp < 60){ timeStr = "刚刚"; }else if(timestamp >= 60 && timestamp < 60 * 60){ var minutes = parseInt(timestamp / 60); timeStr = minutes + "分钟前"; }else if(timestamp >= 60 * 60 && timestamp < 60 * 60 * 24){ var hours = parseInt(timestamp / 60 / 60); timeStr = hours + "小时前"; }else if(timestamp >= 60 * 60 * 24 && timestamp < 60 * 60 * 24 * 30){ var days = parseInt(timestamp / 60 / 60 / 24); timeStr = days + "天前"; }else{ var year = date.getFullYear(); var month = date.getMonth(); var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); timeStr = year + "/" + month + "/" + day + " " + hour + ":" + minute; } return timeStr; } module.exports={ timeFormat:timeFormat, } wxml代码 <!--index.wxml--> <wxs src="../../utils/util.wxs" module="util"/> <view class="container"> <view class="weibo-group" wx:for="{{weibos}}" wx:key="weibos" wx:for-item="weibo"> <view class="user-group"> <image class="avatar" src="{{weibo.author.avatarUrl}}"></image> <view class="right-info"> <view class="username">{{weibo.author.nickName}}</view> <view class="detail-info"> <view class="time">{{util.timeFormat(weibo.cretae_time)}}</view> <view class="from">来自{{weibo.device}}</view> </view> </view> </view> 云函数代码: return await db.collection("weibo").add({ data:{ content:content, location:location, author:author, images:images, video:video, cretae_time:db.serverDate(), device:device } })
2022-08-01var that = this; 这里应为分号
wx.getStorage让改成wx,getStorage,结果还是用,小白入门,有大佬能给看看吗?[图片]
2022-07-29[图片]
调用wx.chooseImage时好时坏,目前不知道什么原因造成的?[图片][图片]2022-07-25上午十一点左右图片上传不成功,下午五点左右又来测一下发现又可以正常的上传图片了,之前也出现过两三次,后面也是无缘无故的好了,同事们测试的时候说是苹果安卓都不行,不知道大佬们有没有遇见过这种问题,求大佬们帮帮忙!!!
2022-07-25