diff --git a/pages/home/jl/index.js b/pages/home/jl/index.js index 035f0e7..24956ef 100644 --- a/pages/home/jl/index.js +++ b/pages/home/jl/index.js @@ -1,6 +1,7 @@ // pages/home/jl/index.js const app = getApp();//新建页面时 默认引入 const req = app.xzjlReq();//初始化一个的request() 实例 +import Toast from 'tdesign-miniprogram/toast/index'; Page({ /** @@ -12,7 +13,13 @@ Page({ xingxiangtu:{}, userInfo:{}, loverInfo:{}, + hours:0, + minute:0, + minutes:0, + pickerValue: [0, 0], + prayerContent:'', //祈祷内容 showSexLogo:false,//不展示形象修改按钮 + showPray:false //显示祈祷弹层 }, ShowOrNotLogoS(){ this.setData({singleShow:!this.data.singleShow}) @@ -79,12 +86,53 @@ Page({ console.log(err); }) }, + getTextValue(e){ + console.log(e.detail.value); + this.setData({ + prayerContent:e.detail.value + }) + console.log(this.data.prayerContent); + }, + openPray(){ + this.setData({ + showPray:!this.data.showPray, + prayerContent:'' + }) + }, + onPickerChange(e){ + if(e.detail.value[0] === this.data.hours){ + this.setData({ + minutes:this.data.minute + }) + }else{ + this.setData({ + minutes:59 + }) + } + this.setData({ + pickerValue: e.detail.value + }) + }, getUserInfo(){ req.getRequest('/api/user/curt',{}).then((res)=>{ if(res.data.code==200){ - this.setData({userInfo:res.data.data}) + console.log(res.data.data); + const pendantEnergy = res.data.data.pendantEnergy + const minute = pendantEnergy * 6 + const hours = Math.floor(pendantEnergy / 60); // 计算小时数 + if(hours>0){ + this.setData({ + minutes:59 + }) + } + this.setData({ + userInfo:res.data.data, + hours:hours, + minute:minute, + pendantEnergy:pendantEnergy + }) + console.log(this.data.userInfo); } - console.log(this.userInfo); }).catch((err)=>{ console.log(err); }) @@ -93,7 +141,39 @@ Page({ wx.navigateTo({ url: '/pages/home/jl/jlai/jlai' }) - + }, + btnOK(){ + const prayerEnergy = (this.data.pickerValue[0]*60 + this.data.pickerValue[1])/6 + if(prayerEnergy < 1){ + return Toast({ + context: this, + selector: '#t-toast', + message: '能量不足', + }); + } + console.log(prayerEnergy); + req.patchRequest('/api/user/curt/prayer',{ + prayerContent:this.data.prayerContent, + prayerEnergy:prayerEnergy + }).then((res) => { + console.log(res); + if(res.data.code === 200){ + Toast({ + context: this, + selector: '#t-toast', + message: '祈祷成功', + }); + }else{ + Toast({ + context: this, + selector: '#t-toast', + message: res.data.msg, + }); + } + this.openPray() + }).catch((err) => { + console.log('祈祷失败',err); + }) }, /** diff --git a/pages/home/jl/index.json b/pages/home/jl/index.json index ebd120c..b55c785 100644 --- a/pages/home/jl/index.json +++ b/pages/home/jl/index.json @@ -3,6 +3,8 @@ "t-progress": "tdesign-miniprogram/progress/progress", "t-popup": "tdesign-miniprogram/popup/popup", "t-rate": "tdesign-miniprogram/rate/rate", - "t-image": "tdesign-miniprogram/image/image" + "t-image": "tdesign-miniprogram/image/image", + "t-icon": "tdesign-miniprogram/icon/icon", + "t-toast": "tdesign-miniprogram/toast/toast" } } \ No newline at end of file diff --git a/pages/home/jl/index.wxml b/pages/home/jl/index.wxml index a6f6741..511c223 100644 --- a/pages/home/jl/index.wxml +++ b/pages/home/jl/index.wxml @@ -35,8 +35,6 @@ 能量注入 - -    {{userInfo.nick}} @@ -76,7 +74,7 @@ - 祈祷 + 祈祷 @@ -122,6 +120,39 @@ + + + + + 祈祷内容 + + + + 祈祷时长 + 选择祈祷时长 + + + + + + + + 你还有{{pendantEnergy}}%水晶能量,可为对方祈祷{{hours}}小时{{minute}}分 + + + + + {{ item }} + + + {{ item }} + + + + + + +
精灵 AI
diff --git a/pages/home/jl/index.wxss b/pages/home/jl/index.wxss index 4453e2b..8aa2b25 100644 --- a/pages/home/jl/index.wxss +++ b/pages/home/jl/index.wxss @@ -31,7 +31,6 @@ position:absolute; } - .t-progress__canvas--circle{ width:125.67rpx!important; height:125.67rpx !important; @@ -109,7 +108,6 @@ background-image: url(https://xzjl-1257436036.cos.ap-nanjing.myqcloud.com/jl/bs.png); } - .gh{ position:absolute; width:750rpx; @@ -120,7 +118,6 @@ background-image: url(https://xzjl-1257436036.cos.ap-nanjing.myqcloud.com/jl/gh.png); } - .call{ margin: 0; padding: 0; @@ -184,7 +181,6 @@ font-size: 27rpx; } - .txl{ position:absolute; width:72rpx; @@ -618,7 +614,7 @@ font-size: 16px; .jltxt{ position: absolute; - left: 300px; + right: 0; top: 504px; width: 75px; height: 35px; @@ -656,3 +652,128 @@ background-repeat: no-repeat; background-size:100% 100%; background-image: url(https://xzjl-1257436036.cos.ap-nanjing.myqcloud.com/jl/ysfgx.png); } + +/* 弹层 */ +.pray { + display: flex; + justify-content: center; +} + +.dialog { + position: absolute; + bottom: 500rpx; + width: 648rpx; + height: 484rpx; + padding: 50rpx; + z-index: 999; + box-sizing: border-box; + line-height: 20px; + border-radius: 15px; + background-color: rgba(255, 255, 255, 1); + text-align: center; + box-shadow: 1px 2px 6px 0px rgba(0, 0, 0, 0.4); +} + +.dialog-item { + display: flex; + justify-content: space-between; + margin-bottom: 38rpx; +} + +.dialog-item textarea { + width: 400rpx; + height: 142rpx; + padding: 20rpx; + line-height: 40rpx; + box-sizing: border-box; + border-radius: 10px; + background-color: rgba(255, 255, 255, 1); + color: #9A9A9A; + font-size: 14px; + text-align: right; + border: 1px solid rgba(236, 236, 236, 1); +} + +.dialog-item text { + padding-top: 16rpx; + color: #6C6C6C; + font-size: 16px; + text-align: center; +} + +.dialog-item .duration { + width: 400rpx; + height: 80rpx; + display: flex; + justify-content: flex-end; + align-items: center; + padding-right: 20rpx; + box-sizing: border-box; + border-radius: 10px; + color: rgba(154, 154, 154, 1); + font-size: 14px; + border: 1px solid rgba(236, 236, 236, 1); +} + +.dialog-btn { + display: flex; + justify-content: center; + align-items: center; +} + +.dialog-btn button { + width: 210rpx; + height: 70rpx; + border-radius: 10px; + background: linear-gradient(233.49deg, rgba(248,99,42,1) 10.48%,rgba(249,135,89,1) 89.2%); + text-align: center; + box-shadow: 0px 2px 6px 0px rgba(0, 0, 0, 0.4); + border: 3px solid rgba(255, 255, 255, 1); + display: flex; + justify-content: center; + align-items: center; + color: #fff; + font-size: 14px; +} + +.timing { + position: absolute; + bottom: 0; + width: 100%; + height: 434rpx; + padding: 0 28px; + z-index: 999; + line-height: 20px; + background-color: rgba(255, 255, 255, 1); + text-align: center; +} + +.timing .picker{ + padding: 0 28px; + box-sizing: border-box; +} + +.timing .timing-title { + height: 70rpx; + display: flex; + justify-content: center; + align-items: center; + color: #9A9A9A; + font-size: 14px; + border: 1px solid #F1F1F1; +} + +.active { + background-color: #F1F1F1; + z-index: 0; +} + +.picker-item { + display: flex; + align-items: center; + justify-content: center; +} + +picker-view-column { + height: 364rpx; +} \ No newline at end of file diff --git a/project.private.config.json b/project.private.config.json index 086d650..10f451f 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -21,6 +21,13 @@ "query": "", "launchMode": "default", "scene": null + }, + { + "name": "", + "pathName": "pages/home/jl/index", + "query": "", + "launchMode": "default", + "scene": null } ] }