You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
campus_leader/code11.txt

176 lines
2.8 KiB

2 years ago
// pages/123/123.js
Page({
/**
* 页面的初始数据
*/
data: {
},
quit1() {
wx.navigateTo({
url: '/pages/index/index',
})
},
test11(){
const db=wx.cloud.database()
const test1=db.collection('student')
test1.add({
data:{
s:this.data.s
}
}).then(res=>{
console.log(res)
}).catch(err=>{
console.log(err)
})
},
Undreaming_Inquire()
{
if(this.Undreaming_CheckData())
{
console.log(this.data.searchKey);
this.Undreaming_GetData();
wx.showLoading({
pingjia: '正在查询中',
mask: true
})
setTimeout(() => {
wx.hideLoading({
complete: (res) => {
this.Undreaming_Results_ShowModal();
},
})
}, 1000);
}
else{
console.log("输入框为空");
}
},
Undreaming_CheckData() {
const key = this.data.searchKey
if (key == '') {
wx.showModal({
content: '输入框不能为空',
contentColor:'#FF556A',
showCancel: false,
confirmText: '确定',
confirmColor: '#FF556A'
})
return false;
}
return true;
},
Undreaming_ChangeSearchKey(e) {
const val = e.detail.value
this.setData({
searchKey: val
})
},
Undreaming_GetData()
{
wx:wx.request({
url: 'http://v.juhe.cn/dream/query',
data:{
key:'4705f6c7303d8753788b53243715455d',
q:this.data.searchKey
},
header: {},
method: 'GET',
dataType: 'json',
responseType: 'text',
success:(res)=>{
console.log(res);
this.setData(
{
Undreaming_Results:res.data.result[0].des
}
)
console.log(this.data.Undreaming_Results);
},
})
},
Undreaming_Results_ShowModal()
{
wx.showModal({
content: this.data.Undreaming_Results,
contentColor:'#dbdbdb',
showCancel: false,
confirmText: '确定',
confirmColor: '#FF556A',
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})