1.报错:java.lang.Exception: No runnable methods
原因:import org.junit.jupiter.api.Test;正确应该导入:import org.junit.Test;
2.Oracle驱动配置
jdbc.driver=oracle.jdbc.driver.OracleDriver
jdbc.url=jdbc:oracle:thin:@127.0.0.1:1521:orcl
jdbc.username=xxxxxxxx
jdbc.password=xxxxxxxx.
3.微信小程序页面跳转问题
访问不成功以为是navigateTo有关和调用的.js文件卡顿有关,百度了很多,后面发现是url的问题最开始url值写的是/pages/addbook/addBook ,后面改成相对值才访问成功了
4.点击提交后如何将前端输入的数据提交到后台
方法:
例:wxml:<input placeholder="姓名" bindblur="name" />
bindblur:输入框失去焦点时触发,event.detail = {value: value}
js:name的值获取:name:function(){
this.setData({
name: e.detail.value
})
}
数据提交后台:
wx.request({
url: 'http://tieqiao.zzzpsj.com/index.php?g=api&m=banana&a=upload_info',
method: 'POST',
data:{
name:this.data.name;
}
})
5.获取小程序的唯一标识(openId)
onLaunch: function () {
// 展示本地存储能力
var logs = wx.getStorageSync('logs') || []
logs.unshift(Date.now())
wx.setStorageSync('logs', logs)
let that = this
const APP_ID = 'wx8xxxxx3b568xx';//输入小程序appid
const APP_SECRET = 'xxxbf9f50416a1fab4a32xx';//输入小程序app_secret
var OPEN_ID = ''//储存获取到openid
var SESSION_KEY = ''//储存获取到session_key
// 登录
wx.login({
success: res => {
// 发送 res.code 到后台换取 openId, sessionKey, unionId
wx.request({ //获取openid接口
url: 'https://api.weixin.qq.com/sns/jscode2session',
data:{
appid:APP_ID,
js_code:res.code,
secret:APP_SECRET,
grant_type:'authorization_code'
},
method:'GET',
success:function(res){
OPEN_ID = res.data.openid;//获取到的openid
SESSION_KEY = res.data.session_key;//获取到session_key
wx.setStorageSync("openid", OPEN_ID.substr(0, 10) + '********' + OPEN_ID.substr(OPEN_ID.length - 8, OPEN_ID.length))
wx.setStorageSync("session_key", SESSION_KEY.substr(0, 8) + '********' + SESSION_KEY.substr(SESSION_KEY.length - 6, SESSION_KEY.length))
}
})
},
})
}
遇到的问题:在success中不可以使用this.setData(),所以用wx.setStorageSync代替