From fde8c34902c9e4770b6d9a101cc929467d2547f9 Mon Sep 17 00:00:00 2001 From: lqz <2426350504@qq.com> Date: Fri, 18 Nov 2022 20:52:57 +0800 Subject: [PATCH] 111 --- code11.txt | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 176 insertions(+) create mode 100644 code11.txt diff --git a/code11.txt b/code11.txt new file mode 100644 index 0000000..c5f039b --- /dev/null +++ b/code11.txt @@ -0,0 +1,176 @@ +// 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() { + + } +}) \ No newline at end of file