首页
统计
壁纸
追番记录
优秀博主
关于
推荐
导航
工具
音乐解锁
Search
1
NAS的简单介绍
707 阅读
2
网站环境一键部署工具推荐
504 阅读
3
tp5-模型数据处理
393 阅读
4
第20200225期-电脑壁纸-P10
350 阅读
5
win10镜像
341 阅读
PHP
闲谈杂料
硬件系统
美图
ThinkPHP
笔记
数据库
Lua
登录
Search
标签搜索
ThinkPHP
MySQL
Laravel
PHP
API
GIT
Windows10
markdown
Web
跨域
ajax
小程序
壁纸
Linux
jsonp
try
异常
Dcat
UEFI
win10
phpfunny
累计撰写
104
篇文章
累计收到
24
条评论
首页
栏目
PHP
闲谈杂料
硬件系统
美图
ThinkPHP
笔记
数据库
Lua
页面
统计
壁纸
追番记录
优秀博主
关于
推荐
导航
工具
音乐解锁
搜索到
2
篇与
的结果
2020-06-17
微信开发流程
JSAPI支付设置支付目录(登录微信支付商户平台(pay.weixin.qq.com)-->产品中心-->开发配置)设置授权域名(网页授权域名,授权回调页面域名)详细情况公众号jsAPI开发填写js安全域名引入js文件通过config接口注入权限验证配置通过ready接口处理成功验证通过error接口处理失败验证微信网页授权填写域名回调地址拉起用户同意界面(OAuth2.0 授权登录接口)获取code用code获取access_token获取用户信息小程序登陆在app.js中onLaunch:function(){}使用wx.logo获取code用code在后台调用登陆凭证校验接口(appid+appsecret+code)获取session_key+openid后台自定义登陆状态与openid,session_key关联,并返回给小程序自定义登陆状态小程序保存登陆状态(wx.storage)使用数据缓存保存openid和session_key返回业务数据
2020年06月17日
121 阅读
0 评论
0 点赞
2020-06-09
小程序搜索防抖处理
小程序在搜索处理时候都会考虑输入防抖和节流。在此记录一下我处理防抖功能代码,如果你有更好方案欢迎同我一起交流qwq。主要思路是使用计时器计算,再加上wx.showLoading和 wx.hideLoading等待效果直接扔代码(/= _ =)/~┴┴demo.wxml<view class="container"> <view class="dept-container"> <view class="section"> <input name="keyword" bindinput="bindKeywordInput" placeholder="请输入关键字" confirm-type="搜索" bindconfirm="search"/> </view> </view> <scroll-view scroll-y bindscrolltoupper="upper" bindscrolltolower="lower" bindscroll="scroll" scroll-into-view="{{toView}}" scroll-top="{{scrollTop}}"> <view class="scroll-view-item" wx:for="{{deptsData}}" wx:key="key"> <navigator url="/pages/card/card?class={{item.class}}" open-type="navigate" hover-class="none"> <text class="dept-name">{{item.class}}</text> <text class="dept-count">{{item.count}}</text> <image class="arrow" mode="aspectFit" src="/image/arrow.png"></image> </navigator> </view> </scroll-view> </view>demo.jsPage({ /** * 页面的初始数据 */ data: { keyword: '', deptsData: [], params: '', //搜索条件 countTime:1800, //延迟搜索 时间 searchWaiting: false, //是否等待搜索倒计时中 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.getCustList(); }, /** * 查数据 */ getCustList: function() { var that=this; wx.showLoading({ title: '加载中', }); wx.request({ url: 'https://weixin.uuppp.top/applet/Depar/index', method:'post', data:{ss:that.data.params}, success:function(e){ console.log('成功的回调结果'); console.log(e); var arr=e.data; //关闭loading wx.hideLoading(); that.setData({deptsData:arr}); } }) }, /** * 输入关键字 */ bindKeywordInput: function (e) { this.setData({ countTime:1800, params:e.detail.value, }) //是否处于搜索倒计时中 if (!this.data.searchWaiting){ //console.log(e.detail.value); this.search(); } }, /** * 搜索 * 延迟搜索 */ search: function (e) { var that=this; this.setData({ searchWaiting: true }) let promise = new Promise((resolve, reject) => { let setTimer = setInterval( () => { console.log('搜索倒计时: ' + that.data.countTime); this.setData({ countTime: this.data.countTime - 1000 }) if (this.data.countTime <= 0) { console.log('开始搜索: ' + that.data.params); this.setData({ countTime: 1800, searchWaiting: false, }) resolve(setTimer) } } , 1000) }) promise.then((setTimer) => { that.getCustList();//获取班级列表 clearInterval(setTimer)//清除计时器 }) } }) demo.php(后台处理) /** * 所有班级+人数查询 */ public function index(){ //接值post是否有值:为空则查所有班级,不为空则接参模糊查询 $request=Request::instance(); $post=$request->post(); $arr=''; if($post['ss']!=''){ //trace($post,'搜索不为空传来的值'); $arr = Db::table('lr_wx_info')->field('class')->whereLike('class','%'.$post['ss'].'%')->group('class')->select(); }else { $arr = Db::table('lr_wx_info')->field('class')->group('class')->select(); } $data = [];//存 班级名+人数 foreach ($arr as $k => $v) { $count = Db::table('lr_wx_info')->where('class', $v['class'])->count(); $data[$k] = [ 'class' => $v['class'], 'count' => $count ]; } echo json_encode($data); }后台处理使用的是thinkphp5.0框架mysql
2020年06月09日
191 阅读
1 评论
0 点赞