//app.js
App( {
onLaunch: function() {
//调用API从本地缓存中获取数据
var logs = wx.getStorageSync( 'logs' ) || []
logs.unshift( Date.now() )
wx.setStorageSync( 'logs', logs )
var currentTimeIn = Date.now();
console.log( currentTimeIn )
var baidu_token = wx.getStorageSync( 'baidu_token' ) || {}
if( baidu_token ) {
if( baidu_token.time - Date.now() <= 300000 ) {
this.sysBaiduOpenApiToken();
}
}
var _this = this;
setTimeout( function() {
console.log('start ........')
wx.setStorageSync( 'baidu_token', baidu_token )
_this.sysBaiduOpenApiToken();
}, 5 )
},
sysBaiduOpenApiToken: function() {
var currentTimeIn = Date.now();
var baidu_token = wx.getStorageSync( 'baidu_token' ) || {}
if( baidu_token ) {
if( baidu_token.time - Date.now() <= 300000 ) {
console.log("request ...")
this.getBaiduOpenApiToken( function( baidu_token ) {
console.log( baidu_token );
baidu_token.time = Date.now() + 7200000
wx.setStorageSync( 'baidu_token', baidu_token )
});
}else{
console.log("have ...")
}
}
},
getUserInfo: function( cb ) {
var that = this
if( this.globalData.userInfo ) {
typeof cb == "function" && cb( this.globalData.userInfo )
} else {
//调用登录接口
wx.login( {
success: function() {
wx.getUserInfo( {
success: function( res ) {
that.globalData.userInfo = res.userInfo
typeof cb == "function" && cb( that.globalData.userInfo )
}
})
}
})
}
},
getBaiduOpenApiToken: function( cb ) {
console.log( 'getBaiduOpenApiToken' );
var url = 'https://openapi.baidu.com/oauth/2.0/token';
wx.request( {
url: url,
data: {
grant_type: 'client_credentials', client_id: 'YgMAXXnP0Lziw0LPVbc6E4zm', client_secret: 'Q1BYOGgl3sMjoXSBAx5bMrIuOHSfoMh9'
},
header: {
'Content-Type': 'application/json'
},
success: function( res ) {
console.log( res )
typeof cb == "function" && cb( res.data );
}, fail: function( e ) {
console.log( e );
}
})
},
getTulingMsg: function( info, cb ) {
var url = 'http://www.tuling123.com/openapi/api?key=eeec171e907553c15aa3131562f75903&info=' + info;
wx.request( {
url: url,
data: {
},
header: {
'Content-Type': 'application/json'
},
success: function( res ) {
console.log( res.data )
typeof cb == "function" && cb( res.data )
}
})
},
globalData: {
userInfo: null
}
})
没有合适的资源?快使用搜索试试~ 我知道了~
微信小程序精选源码亲测可用_智能机器人.zip
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共19个文件
js:5个
wxss:4个
wxml:3个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 20 浏览量
2023-07-09
13:22:39
上传
评论
收藏 19KB ZIP 举报
温馨提示
微信小程序精选源码亲测可用_智能机器人.zip
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/JPG.png)
共 19 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/489b0721fcb547f0b9912b5e99350062_weixin_67336587.jpg!1)
HappyGirl快乐女孩
- 粉丝: 1w+
- 资源: 4154
![benefits](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-1.c8e153b4.png)
下载权益
![privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-2.ec46750a.png)
C知道特权
![article](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-3.fc5e5fb6.png)
VIP文章
![course-privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-4.320a6894.png)
课程特权
![rights](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-icon.fe0226a8.png)
开通VIP
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)