个人案例
- 跳蚤一下
找工作,面试路线怎么最高效规划,这款小程序帮助你
跳蚤一下扫码体验
- 莓丽世界
云开发小程序,一站式下单,配送,地理位置分配,优惠券,创建商品,编辑商品,删除商品,创建收货地址,删除收货地址,设为默认
莓丽世界-社区团购及配送扫码体验
试过了白瞎
都初始化一天了还这样?[图片]
2023-10-11解决了吗@
小程序camera组件设置闪光灯flash=“auto”无效camera组件,设置相机闪光灯自动flash="auto",在黑暗环境下,闪光灯不会亮 [图片] [图片]
2022-05-20贴入代码前段,更容易分析
首页向下滑动,有时自动刷新到上面,这是啥原因呢?getApp(); const app = getApp(); var communityId1 = "710101"; //默认为空赋值维多利亚湾社区id var t = require("../../A3169927CCD47ACFC570F120B621F1F5.js"), e = require("../../7AB83E42CCD47ACF1CDE5645A701F1F5.js"); var forums = []; var btns = []; Page({ data: { winWidth: 0, winHeight: 0, isHiddenToast: !0, currentTab: 0, reachBottom: !1, hide_btn: !1, page: 1, loaded: !1, hideHeader: !0, pageSize: 20, hasMoreData: !0, contentlist: [], newlist: [], bbslist: [], piclist: [], //首页播放的广告图片展示 btns: [], scrollTop: 1, delid: 0, is_deled: {}, inputKey: !0, //1表示显示站内那个搜索,0时标题栏显示维多利亚湾社区几个字 fid: 0, topheight: 40, subscribe: 0, mp4_type: "video", //wxml判断用 communityTitle: "", }, isShowToast: function() { this.setData({ isHiddenToast: !1 }); }, toastChange: function() { this.setData({ isHiddenToast: !0 }); }, onShow: function() { //这里变量变了会实时更新 t.setBadge(); wx.setNavigationBarTitle({ title: app.globalData.communityTitle }); }, //点击文章标题然后展示文字内容,点击这个直接进去showbbs.js showbbs: function(t) { var e = t.currentTarget.id, a = t.currentTarget.dataset.url, s = t.currentTarget.dataset.current, i = t.currentTarget.dataset.forum; var way = 1; //表示从首页去bbs展示页 if (console.log(a), -1 != e.indexOf("wx")) wx.navigateToMiniProgram({ appId: e, path: a, extraData: { foo: "bar" }, envVersion: "release", success: function(t) { console.log("成功"); } }); else { if (e > 0) { var n = "/pages/bbs/showbbs?id=" + e + "¤t=" + s + "&forum=" + i + "&way=" + way; //点击的bbs主题帖,这个时候对浏览记录加1 wx.cloud.callFunction({ name:'update_bbs_list', data:{ a: 3, authorId: app.globalData.openId, //传入此用户的openId tid: parseInt(e), //此主题的tid传入,还真是这个e不一定是数字 views: 0, //随便给views传个值,这个零不起作用 }, success:res=>{ console.log("success update_bbs_list777"); }, fail: function() { console.log("fail update_bbs_list777"); }, complete: function() {} }); //对浏览记录加1结束 } else n = "/pages/index/webview?url=" + a; if ("" != a && null != a) if ("pages" == a.split("/")[1]) n = a; wx.navigateTo({ url: n }); } }, //扫描方法,此功能暂时未开发 scan: function() { wx.scanCode({ onlyFromCamera: !0, success: function(t) { var e = t.result; if (e.indexOf("hlgnet.mobi/bbs/") > -1) { var a = e.split("hlgnet.mobi/bbs/")[1].split("_"); wx.navigateTo({ url: "/pages/bbs/showbbs?id=" + a[1] }); } if (e.indexOf("bbs.hlgnet.com/info/") > -1) { a = e.split("bbs.hlgnet.com/info/")[1].split("_"); // console.log("s = a.split("/") 8888=", a); wx.navigateTo({ url: "/pages/bbs/showbbs?id=" + a[1] }); } } }); }, search: function() { wx.navigateTo({ url: "/pages/search/index?from=index" }); }, //首页中间图标按钮进入goto,goto进入到bbs/index.js goto: function(t) { var e = t.currentTarget.dataset.url, a = t.currentTarget.dataset.action; if ("module" == a) var s = "/pages/" + e; else if ("plugin" == a) s = e; else if ("login" == a) { // s = "/pages/index/webview?url=" + e; wx.setStorage({ key: "from_url", data: s }), wx.navigateTo({ url: "/pages/index/login" }); } wx.navigateTo({ url: s }); }, selectarea: function(t){ wx.navigateTo({ url: "/pages/index/selectarea" }); }, delbbs: function(t) { var e = this.data.is_deled; e[t] = { key: 2 }, this.setData({ is_deled: e }); }, onLoad: function(t) { //存储首页bbs的列表信息 // console.log(" forums111=", forums);\ var e = this; var communityId2 = app.globalData.communityId; if (communityId2 == "110101" || communityId2 == "110102" || communityId2 == "110103") //如果是校友类社区,首页菜单和图标选择模板2的 { forums = forums2; btns = btns2; } else { forums = forums1; btns = btns1; } wx.setStorage({ key: "forums", data: forums }); wx.setStorage({ //存储首页的几个图标 key: "btns", data: btns }); var a = decodeURIComponent(t.q); // console.log("decodeURIComponent(t.q)r 111=",a); //a输出没有定义,所以下面if逻辑没进去 if (a) { var s = a.split("/"); // console.log("s = a.split("/") 111=",s); // console.log("s = a.split("/") 8888=",s); if ("bbs" == s[4] && wx.navigateTo({ url: "/pages/bbs/showbbs?id=" + s[5] }), "bbs" == s[3] || "info" == s[3]) { var i = s[4].split("_"); wx.navigateTo({ url: "/pages/bbs/showbbs?id=" + i[1] }); } } // console.log("/pages/bbs/showbbs?id==9999991111"); t.current && (e.setData({ currentTab: t.current }), e.getBbsList("正在加载数据")); wx.getSystemInfo({ success: function(t) { e.setData({ winWidth: t.windowWidth, winHeight: t.windowHeight, topheight: t.statusBarHeight }), console.log(e.data.topheight); } }); e.getMsgList("正在加载数据"), wx.showShareMenu({ withShareTicket: !0, menus: [ "shareAppMessage", "shareTimeline" ] }); }, onShareTimeline: function() { var t = wx.getStorageSync("UserInfo"); if (t) { t.nickName; var e = t.usersId; } return { title: app.globalData.communityTitle, path: "/pages/index/index?usersid=" + e, success: function(t) {} }; }, getMsgList: function(t) { //点击推荐展示的首页下面的bbs信息 var a = this; a.setData({ inputKey: !1 //o 推荐页显示标题 }); wx.setNavigationBarTitle({ title: app.globalData.communityTitle }); this.setData({ communityTitle: app.globalData.communityTitle }); var communityId2 = app.globalData.communityId; if (communityId2 == "110101" || communityId2 == "110102" || communityId2 == "110103") //如果是校友类社区,首页菜单和图标选择模板2的 { forums = forums2; btns = btns2; } else { forums = forums1; btns = btns1; } wx.setStorage({ key: "forums", data: forums }); wx.setStorage({ //存储首页的几个图标 key: "btns", data: btns }); var r1 = wx.getStorageSync("forums"), g1 = wx.getStorageSync("btns"); var pic_list = wx.getStorageSync("pic_list"); a.setData({ boardlist: r1, //菜单栏 btns: g1, //图片按钮 }) if(app.globalData.communityId) //判断是否为空 { var communityId = app.globalData.communityId; } else { var communityId = communityId1;//如果为空,赋值维多利亚湾社区id } var state = "0"; wx.cloud.callFunction({ name: 'search_bbs_list', //云函数的名称 data: { a : 8, adversting: 2, //等于2时为首页播放图片的bbs communityId: communityId, state: state, //状态,字符零表示正常,字符1表示删除的帖子 }, success: res => { pic_list = res.result.data; // console.log("pic_list===", pic_list); a.setData({ piclist: pic_list, //播放的图片 }) wx.setStorage({ //存储首页的播放的图片 key: "pic_list", data: pic_list }); }, fail: err => { console.error('search_bbs_list adversting', err) } }); //获取此新帖板块页面信息 if(app.globalData.communityId) //判断是否为空 { var communityId = app.globalData.communityId; } else { var communityId = communityId1;//如果为空,赋值维多利亚湾社区id } var state = "0"; wx.cloud.callFunction({ name: 'search_bbs_list', //云函数的名称 data: { a : 5, parent_id: 0, //0表示没有父id,就是主帖 communityId: communityId, state: state, //状态,字符零表示正常,字符1表示删除的帖子 }, success: res => { var e = a.data.contentlist; if (1 == a.data.page && (e = [])) { var s = res.result.data; 1 == a.data.page && wx.setStorage({ key: "index_list", data: s }), s.length < a.data.pageSize ? a.setData({ contentlist: e.concat(s), piclist: pic_list, //播放的图片 boardlist: r1, //菜单栏 btns: g1, //图片按钮 hasMoreData: !1, loaded: !0, scrollTop: 1 }) : a.setData({ contentlist: e.concat(s), piclist: pic_list, //播放的图片 boardlist: r1, //菜单栏 btns: g1, //图片按钮 hasMoreData: !0, hideHeader: !0, loaded: !0, page: a.data.page + 1 }); } }, fail: err => { console.error('search_bbs_list', err) } }) }, // 将时间戳转换为几分钟前、几小时前 timeago: function (dateTimeStamp) { // dateTimeStamp是一个时间毫秒,注意时间戳是秒的形式,在这个毫秒的基础上除以1000,就是十位数的时间戳。13位数的都是时间毫秒。 var minute = 1000 * 60; //把分,时,天,周,半个月,一个月用毫秒表示 var hour = minute * 60; var day = hour * 24; // var week = day * 7; // var halfamonth = day * 15; // var month = day * 30; var now = new Date().getTime(); //获取当前时间毫秒 var diffValue = now - dateTimeStamp; //时间差 var result = ''; if (diffValue < 0) { console.log("diffValue < 0 diffValue==", diffValue); return result; } var minC = diffValue / minute; //计算时间差的分,时,天,周,月 var hourC = diffValue / hour; var dayC = diffValue / day; // var weekC = diffValue / week; // var monthC = diffValue / month; if (dayC >= 1 && dayC <= 3) { result = "" + parseInt(dayC) + "天前"; } else if (hourC >= 1 && hourC <= 24) { result = "" + parseInt(hourC) + "小时前"; } else if (minC >= 1 && minC <= 60) { // console.log("result = minC",minC); result = "" + parseInt(minC) + "分钟前"; } else if (minC < 1) { // console.log("result = 刚刚"); result = "刚刚"; } return result; }, //首页上面点击各个菜单栏显示的bbs信息(只有贴子标题列) getBbsList: function(t) { var a = this, s = (a.data.currentTab, a.data.currentTab), i = wx.getStorageSync("forums"), o = i[s].fid, r = i[s].name; // var n = wx.getStorageSync("input_key"); wx.setNavigationBarTitle({ title: r }); var g = wx.getStorageSync("bbs_list" + o); g && 1 == a.data.page && a.setData({ bbslist: g }), a.setData({ inputKey: !0 }); // var l = wx.getStorageSync("UserInfo");//这个好像没啥用 // if (l.unionId) var d = l.unionId; else d = ""; //获取此bbs板块页面信息 if(app.globalData.communityId) //判断是否为空 { var communityId = app.globalData.communityId; } else { var communityId = communityId1;//如果为空,赋值维多利亚湾社区id } var state = "0"; wx.cloud.callFunction({ name: 'search_bbs_list', //云函数的名称 data: { a : 1, fid : o, parent_id: 0, //0表示没有父id,就是主帖 communityId: communityId, state: state, //状态,字符零表示正常,字符1表示删除的帖子 }, success: res => { // console.log("res.result.data666fid", o); //res的数据结构如下图 var e = a.data.bbslist; if (1 == a.data.page && (e = [])) { var s = res.result.data, i = !0; //n为inputKey是显示搜索的输入框 // 对s处理,生成lastpost,最后人回帖距离时间,比如45分钟前 for(var j=0;j<s.length;j++) { // var lastpost1 = this.timeago(s[j].dblastpost); s[j].lastpost = this.timeago(s[j].dblastpost); } // console.log("res.result777==", s); // 这个点击下面的bbs信息才走到这 1 == a.data.page && wx.setStorage({ key: "bbs_list" + o, data: s }), s.length < a.data.pageSize ? a.setData({ bbslist: e.concat(s), hasMoreData: !1, inputKey: i, loaded: !0 }) : a.setData({ bbslist: e.concat(s), hasMoreData: !0, hideHeader: !0, loaded: !0, page: a.data.page + 1 }); } }, fail: err => { console.error('search_bbs_list', err) } }) }, getNewList: function(t) { var a = this, s = (a.data.currentTab, a.data.currentTab), i = wx.getStorageSync("forums"), n = wx.getStorageSync("input_key"), r = i[s].name; // var o = i[s].fid; wx.setNavigationBarTitle({ title: r }); var g = wx.getStorageSync("newlist"); g && 1 == a.data.page && a.setData({ newlist: g }), a.setData({ inputKey: !0 //n }); //获取此新帖板块页面信息 if(app.globalData.communityId) //判断是否为空 { var communityId = app.globalData.communityId; } else { var communityId = communityId1;//如果为空,赋值维多利亚湾社区id } var state = "0"; wx.cloud.callFunction({ name: 'search_bbs_list', //云函数的名称 data: { a : 4, parent_id: 0, //0表示没有父id,就是主帖 communityId: communityId, state: state, //状态,字符零表示正常,字符1表示删除的帖子 }, success: res => { var e = a.data.newlist; if (1 == a.data.page && (e = [])) { var s = res.result.data, i = 1; //inputKey是显示搜索的输入框 // 对s处理,生成lastpost,最后人回帖距离时间,比如45分钟前 for(var j=0;j<s.length;j++) { // var lastpost1 = this.timeago(s[j].dblastpost); s[j].lastpost = this.timeago(s[j].dblastpost); } // console.log("res.result777==", s); // 这个点击下面的bbs信息才走到这 1 == a.data.page && wx.setStorage({ key: "newlist", data: s }), s.length < a.data.pageSize ? a.setData({ newlist: e.concat(s), hasMoreData: !1, inputKey: i, loaded: !0 }) : a.setData({ newlist: e.concat(s), hasMoreData: !0, hideHeader: !0, loaded: !0, page: a.data.page + 1 }); } }, fail: err => { console.error('search_bbs_list', err) } }) }, onPullDownRefresh: function() { var t = this; t.data.page = 1, t.setData({ hideHeader: !1 }), setTimeout(function() { 0 == t.data.currentTab ? t.getMsgList("正在刷新数据") : 1 == t.data.currentTab ? t.getNewList("正在刷新数据") : t.getBbsList("正在刷新数据"), wx.stopPullDownRefresh(); }, 400); }, handletouchmove: function(t) {}, bindChange: function(t) { var e = t.detail.current; if (this.data.page = 1, this.setData({ currentTab: e }), 0 == e ? this.getMsgList("正在刷新数据") : 1 == e ? this.getNewList("正在刷新数据") : this.getBbsList("正在刷新数据"), this.setData({ scrollTop: 1 }), e > 7) { var a = e - 8; this.setData({ toview: "f" + a }); } }, swichNav: function(t) { if (this.data.currentTab === t.currentTarget.dataset.current) return !1; // console.log("swichNav: function(t)==",this.data.currentTab); // console.log("swichNav: function(t)==",t.currentTarget.dataset.current); this.setData({ currentTab: t.currentTarget.dataset.current }); }, onReachBottom: function() { this.data.hasMoreData && (this.setData({ reachBottom: !0, hasMoreData: !1 }), 0 == this.data.currentTab ? this.getMsgList("") : 1 == this.data.currentTab ? this.getNewList("") : this.getBbsList("")); }, newbbs: t.throttle(function(t) { var e = this.data.currentTab; if (wx.showToast({ title: "正在加载数据", icon: "loading", duration: 0 }), e > 1) { var a = wx.getStorageSync("forums")[e].fid; wx.navigateTo({ url: "/pages/bbs/NewBbs?fid=" + a + "¤t=" + e }); } else { wx.getStorageSync("UserInfo").unionId ? wx.navigateTo({ url: "/pages/bbs/ListBoard?current=" + e }) : (wx.setStorage({ key: "from_url", data: "/pages/bbs/ListBoard?current=" + e }), wx.navigateTo({ url: "/pages/index/login" })); } }, 1e3), onShareAppMessage: function(t) { var e = wx.getStorageSync("UserInfo"); if (e) var a = e.nickName, s = e.usersId; else a = "观网网友", s = 0; return { title: a + " 分享了一个微信小程序", path: "/pages/index/index?usersid=" + s, success: function(t) { console.log(t.shareTickets[0]), wx.getShareInfo({ shareTicket: t.shareTickets[0], success: function(t) { that.setData({ isShow: !0 }), console.log(that.setData.isShow); }, fail: function(t) { console.log(t); }, complete: function(t) { console.log(t); } }); }, fail: function(t) { console.log(t); } }; } });
2022-04-07加入允许的类目,工具,办公,添加审核图片,一定要放图片或视频
wx.getLocation为啥不能申请?如图所示,我们的小程序是基础电信运营商,符合申请标准,但是申请wx.getLocation的入口是灰的,请管理员给看一下,着急啊[图片] [图片][图片]
2022-04-07可以的
a小程序可以跳到b小程序中分包(子包)的页面吗?如题:a小程序能直接跳到b小程序中某个分包(子包)的页面吗?
2022-04-07使用css变换处理
云开发云存储图片处理样式可否增加转向操作?急需如题
2022-04-07不支持本地测试,请线上测试
php写微信支付报错is not allowed here,哪里错了?[图片][图片]
2022-04-07裁剪图片
如何去掉图片下面的黑色[图片]
2022-04-07按钮使用coverview
ios video如何覆盖?ios video如何覆盖?swiper包裹的video组件,第一次进去可以覆盖,滑动到第二个视频的时候就没有办法覆盖了。 [图片]
2022-04-071添加属性type=2d 2状态栏使用coverView实现 3在弹出层里面使用canvas 4在新页面使用canvas
canvas层级问题?Canvas组件在开发者工具中可以使用z-index设置层级,但是到了手机端,就失效了,canvas组件始终位于页面最顶层,只能用隐藏来控制,请问如何解决这个问题呢?
2022-04-07