@ -0,0 +1,68 @@ | |||
const app = getApp(); | |||
Page({ | |||
data: { | |||
time_type:0, | |||
upperbound:null, | |||
lowerbound:null, | |||
userInfo: {}, | |||
hasUserInfo: false, | |||
detailedmenu:null, | |||
loading:true | |||
}, | |||
onLoad:function(options){ | |||
var time_type | |||
this.setData({ | |||
upperbound:Number(options.upperbound), | |||
lowerbound:Number(options.lowerbound), | |||
}) | |||
if (this.data.upperbound == 30){ | |||
time_type = 0 | |||
} | |||
if (this.data.upperbound == 60){ | |||
time_type = 1 | |||
} | |||
if (this.data.upperbound == 9999){ | |||
time_type = 2 | |||
} | |||
this.setData({ | |||
time_type:time_type, | |||
}) | |||
}, | |||
get_menu(){ | |||
var that = this | |||
wx.cloud.callContainer({ | |||
"config": { | |||
"env": "prod-2g058voqbea31ecb" | |||
}, | |||
"path": "menu/menus/", | |||
"header": { | |||
"X-WX-SERVICE": "django-5198", | |||
'content-type': 'application/x-www-form-urlencoded;charset=utf-8' | |||
}, | |||
"method": "GET", | |||
data:{upper_bound:that.data.upperbound,lower_bound:that.data.lowerbound}, | |||
success(res){ | |||
let arr = app.parse_json(res) | |||
that.setData({ | |||
detailedmenu:arr, | |||
loading:false | |||
}) | |||
} | |||
}) | |||
}, | |||
onShow(){ | |||
this.get_menu() | |||
}, | |||
onTapMenu(e){ | |||
var item = JSON.stringify(e.currentTarget.dataset.product) | |||
wx.navigateTo({ | |||
url: '../menu/menu?item='+item | |||
}) | |||
}, | |||
back(){ | |||
wx.navigateBack({ | |||
delta: 0, | |||
}) | |||
}, | |||
}) | |||
@ -0,0 +1,2 @@ | |||
{ | |||
} |
@ -0,0 +1,37 @@ | |||
<!--dishes.wxml--> | |||
<view class="loading" wx:if="{{loading}}">加载中</view> | |||
<view class="page"> | |||
<view class="profile"> | |||
<view wx:if="{{time_type==0}}"> | |||
<view>随便吃吃(少于30分钟)</view> | |||
</view> | |||
<view wx:elif="{{time_type==1}}"> | |||
<view>吃点好的(30到60分钟)</view> | |||
</view> | |||
<view wx:else="{{time_type==2}}"> | |||
<view>吃个大餐(多于60分钟)</view> | |||
</view> | |||
</view> | |||
<view style="position: fixed;left:4%;top:3%" bindtap="back" hover-class="back"> | |||
<text style="font-size: 60rpx;padding-left: 10rpx;padding-right:20rpx;background-color: rgba(255, 255, 255, 0.5);border-radius: 20%;box-shadow: 0px 0px 20px 0 rgba(136, 134, 118, 0.37);color:peru;" decode="true"><</text> | |||
</view> | |||
<!--菜谱结果陈列--> | |||
<view class="page-body"> | |||
<scroll-view scroll-y="true" style="height: 1190rpx;" > | |||
<view style="padding-bottom: 20rpx;"></view> | |||
<view wx:for="{{detailedmenu}}" bindtap="onTapMenu" class="menu" data-product="{{item}}"> | |||
{{item.name}} {{item.time}}分钟 | |||
</view> | |||
<view style="padding-bottom: 200rpx;"></view> | |||
</scroll-view> | |||
</view> | |||
<view class = "add-something"> | |||
<view>SOMETHING!!</view> | |||
</view> | |||
<view class = "need"> | |||
<view>need to be here...</view> | |||
</view> | |||
</view> |
@ -0,0 +1,79 @@ | |||
/**dishes.wxss**/ | |||
.page{ | |||
/* background: #F0E68C; */ | |||
min-height:100vh; | |||
background-image: linear-gradient(to right, #ffc3a0 0%, #fcd4da 100%); | |||
} | |||
.profile{ | |||
padding: 30rpx; | |||
padding-top: 70rpx; | |||
margin: 0 auto; | |||
text-align: center; | |||
font-weight: bold; | |||
font-size: 120%; | |||
color: #B8860B ; | |||
border-radius: 0rpx 0rpx 40rpx 40rpx; | |||
background-color: rgba(255, 255, 255, 0.75); | |||
} | |||
.page-body{ | |||
margin-top: 20rpx; | |||
/* margin-bottom: 20rpx; */ | |||
margin-left: 20rpx; | |||
margin-right: 20rpx; | |||
/* background-image: linear-gradient(to top, #ace0f9 0%, #fff1eb 100%); */ | |||
border-radius: 20px 20px 20px 20px; | |||
box-shadow: 4px 4px 4px rgba(26, 77, 160, 0.16),inset 3px 3px 3px rgba(255, 255, 255, 0.15); | |||
} | |||
.menu{ | |||
background:rgba(255, 254, 252, 0.733); | |||
width:85%; | |||
height:8%; | |||
margin: auto; | |||
font-weight:normal; | |||
font-size: 17px; | |||
padding-left: 5%; | |||
padding-right: 5%; | |||
padding-top: 5%; | |||
padding-bottom: 5%; | |||
margin-bottom: 20rpx; | |||
box-shadow: 0 0px 5px 0 rgba( 31, 38, 135, 0.37 ); | |||
-webkit-backdrop-filter: blur( 14px ); | |||
border-radius: 10px; | |||
border: 1px solid rgba( 255, 255, 255, 0.18 ); | |||
z-index: 1; | |||
} | |||
.back{ | |||
background-color: rgb(255, 255, 255); | |||
border-radius: 20%; | |||
} | |||
.add-something{ | |||
font-size: xx-large; | |||
font-style: inherit; | |||
font-weight: bolder; | |||
text-align: center; | |||
color:white; | |||
} | |||
.need{ | |||
font-size: large; | |||
font-style: inherit; | |||
font-weight: normal; | |||
text-align: right; | |||
color:lightyellow; | |||
} | |||
.loading{ | |||
text-align: center; | |||
width: 100%; | |||
padding-top:40%; | |||
z-index: 2; | |||
margin: auto; | |||
position: fixed; | |||
font-weight:bold; | |||
font-size: 20px; | |||
color: white; | |||
height: 100%; | |||
} |