Browse Source

上传文件至 'hangout-master/Pages/HGBot/Rd'

master
曹天怡 2 years ago
parent
commit
efabffc312
4 changed files with 244 additions and 0 deletions
  1. +119
    -0
      hangout-master/Pages/HGBot/Rd/Rd.js
  2. +3
    -0
      hangout-master/Pages/HGBot/Rd/Rd.json
  3. +44
    -0
      hangout-master/Pages/HGBot/Rd/Rd.wxml
  4. +78
    -0
      hangout-master/Pages/HGBot/Rd/Rd.wxss

+ 119
- 0
hangout-master/Pages/HGBot/Rd/Rd.js View File

@ -0,0 +1,119 @@
// Pages/HGBot/Rd/Rd.js
Page({
/**
* 页面的初始数据
*/
data: {
id:"洗后提",
a:0,
b:0,
rd:0,
display:'none'
},
onOK: function(){
wx.redirectTo({
url: '/Pages/HGBot/Home/Home',
})
},
onChange: function(){
if(this.data.cnt.size != this.data.b - this.data.a + 1){
this.getRd()
}
else {
console.log("范围太小")
}
},
getStart:function(e){
this.data.cnt.clear()
this.setData({
a:e.detail.value
})
},
getEnd:function(e){
this.data.cnt.clear()
this.setData({
b:e.detail.value
})
},
getRd:function(){
const min = parseInt(this.data.a), max = parseInt(this.data.b)
var t = function(min, max){
return Number(Math.floor(Math.random()*(max - min + 1)))
}
var r = parseInt(t(min,max)) + parseInt(min)
while(this.data.cnt.has(r)){
r = parseInt(t(min,max))+parseInt(min)
}
this.setData({
rd: r,
display: 'block'
})
this.data.cnt.add(r)
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
this.setData({
cnt:new Set()
})
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})

+ 3
- 0
hangout-master/Pages/HGBot/Rd/Rd.json View File

@ -0,0 +1,3 @@
{
"usingComponents": {}
}

+ 44
- 0
hangout-master/Pages/HGBot/Rd/Rd.wxml View File

@ -0,0 +1,44 @@
<!--Pages/HGBot/Rd/Rd.wxml-->
<view class="body">
<view>
<view class="ques">
<view>
({{id}})想在我这里得到什么呢?
</view>
<view style="padding: 0;margin: 0;height: 25px;"></view>
<view>
幸运数字吗?
</view>
</view>
<view class="button1" bindtap="onOK">
</view>
<view>
<text class="OK" bindtap="onOK">好的</text>
</view>
<view class="button2" bindtap="onChange">
</view>
<view>
<text class="change" bindtap="onChange">换一个</text>
</view>
<view class="choose">
憨憨,从
<input id="start" type="text" style="height: 28px;width: 50px;" confirm-type="next" placeholder="?" bindinput="getStart"/>
<input id="end" type="text" style="height: 28px;width: 50px;" confirm-type="done" placeholder="?" bindinput="getEnd" bindconfirm="getRd"/>
中选吗?
</view>
<view class="result" style="display: {{display}};">
{{rd}} 怎么样!
</view>
<view>
<image src="../../../asset/img/hangou1.png" mode="heightFix" class="hg"></image>
</view>
</view>
</view>

+ 78
- 0
hangout-master/Pages/HGBot/Rd/Rd.wxss View File

@ -0,0 +1,78 @@
/* Pages/HGBot/Rd/Rd.wxss */
.ques{
position: absolute;
margin: 10px;
padding: 10px;
left: 11px;
top: 90px;
font-size: 22px;
text-align: center;
color: #000;
font-size: 22px;
}
.choose{
position: absolute;
padding: 15px;
margin: 5px;
left: 31px;
top: 217px;
font-size: 22px;
text-align: center;
color: #000;
display: flex;
}
.result{
position: absolute;
padding:15px;
margin:10px;
left: 30%;
top: 276px;
font-size: 22px;
text-align: center;
color: #000;
}
.button1{
width: 102px;
height: 42px;
position: absolute;
left: 49px;
top: 350px;
background: #d8caaf;
}
.OK{
position: absolute;
left: 79px;
top: 357px;
font-size: 20px;
text-align: center;
color: #000;
}
.button2{
width: 102px;
height: 42px;
position: absolute;
left: 222px;
top: 350px;
background: #d8caaf;
}
.change{
position: absolute;
left: 248px;
top: 357px;
font-size: 20px;
text-align: center;
color: #000;
}
.hg{
position:absolute;
left: 100px;
top: 430px;
}

Loading…
Cancel
Save