Commit 8812f050 by ArronYR

add api

parent fdd4d6cd
......@@ -5,7 +5,7 @@ App({
onLaunch: function(options) {
this.options = options
// 用户登录
this.checkUserLogin()
// this.checkUserLogin()
},
onShow: function(options) {
......
......@@ -37,6 +37,26 @@ button.form-button::after {
background-color: transparent;
}
.text-gray{
.text-gray {
color: rgb(191, 191, 191);
}
.text-red {
color: rgb(255, 68, 0);
}
.text-hint {
color: rgb(153, 153, 153);
}
.text-small {
font-size: 12px;
}
.margin-right-2 {
margin-right: 2px;
}
.margin-top-10 {
motion-path: 20px;
}
......@@ -27,7 +27,7 @@ Component({
data: {
banners: [],
indicatorDots: true,
autoplay: true,
autoplay: false,
interval: 5000,
duration: 1000
},
......
/* components/banners/index.wxss */
@import "/styles/form.wxss";
.banners-wrapper {
width: 100%;
position: relative;
box-shadow: 0px 0px 15px #c6c6c6;
border-radius: 0px;
}
.banners-swipper {
......
......@@ -53,7 +53,11 @@ Page({
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function() {
wx.showNavigationBarLoading()
this.getHomeData(() => {
wx.hideNavigationBarLoading()
wx.stopPullDownRefresh()
})
},
/**
......@@ -70,7 +74,7 @@ Page({
},
getHomeData: function() {
getHomeData: function(callback) {
api.home.all({
token: app.globalData.token
}).then(res => {
......@@ -80,6 +84,7 @@ Page({
businesses: res.data.businessProjects,
guides: res.data.guides
})
typeof callback == "function" && callback()
})
}
})
\ No newline at end of file
......@@ -4,6 +4,10 @@
"enablePullDownRefresh": true,
"usingComponents": {
"banner": "/components/banners/index",
"navs": "/components/navs/index"
"navs": "/components/navs/index",
"i-cell-group": "/iview/cell-group/index",
"i-cell": "/iview/cell/index",
"i-row": "/iview/row/index",
"i-col": "/iview/col/index"
}
}
\ No newline at end of file
......@@ -2,4 +2,75 @@
<view class='v-page'>
<banner />
<navs />
<i-cell-group i-class="section-wrapper">
<i-cell title="最新活动" is-link url="/pages/dashboard/index">
<text slot="footer" class='text-gray text-small'>更多</text>
</i-cell>
<i-row i-class="col-wrapper">
<i-col span="8" i-class="col-class" wx:for="{{news}}" wx:for-index="idx" wx:for-item="n" wx:key="n.id" wx:if="{{idx < 3}}">
<view class='col-item'>
<image class='image' src="{{n.poster}}" mode='aspectFill'></image>
<view class='title'>{{n.title}}</view>
<view class='info'>
<text class='text-red text-small mergin-right-2'>¥ {{n.price}}</text>
<text>元/{{n.night_num}}晚</text>
</view>
</view>
</i-col>
</i-row>
</i-cell-group>
<i-cell-group i-class="section-wrapper">
<i-cell title="爆款专区" is-link url="/pages/dashboard/index">
<text slot="footer" class='text-gray text-small'>更多</text>
</i-cell>
<i-row i-class="col-wrapper">
<i-col span="8" i-class="col-class" wx:for="{{heats}}" wx:for-index="idx" wx:for-item="n" wx:key="n.id" wx:if="{{idx < 3}}">
<view class='col-item'>
<image class='image' src="{{n.poster}}" mode='aspectFill'></image>
<view class='title'>{{n.title}}</view>
<view class='info'>
<text class='text-red text-small mergin-right-2'>¥ {{n.price}}</text>
<text>元/{{n.night_num}}晚</text>
</view>
</view>
</i-col>
</i-row>
</i-cell-group>
<i-cell-group i-class="section-wrapper">
<i-cell title="酒店预订" is-link url="/pages/dashboard/index">
<text slot="footer" class='text-gray text-small'>更多</text>
</i-cell>
<i-row i-class="col-wrapper">
<i-col span="12" i-class="col-class" wx:for="{{businesses}}" wx:for-index="idx" wx:for-item="n" wx:key="n.id">
<view class='col-item'>
<image class='image' src="{{n.poster}}" mode='aspectFill'></image>
<view class='title'>{{n.title}}</view>
<view class='info'>
<text class='text-red text-small mergin-right-2'>¥ {{n.price}}</text>
<text>元/{{n.night_num}}晚</text>
</view>
</view>
</i-col>
</i-row>
</i-cell-group>
<i-cell-group i-class="section-wrapper">
<i-cell title="美行攻略" is-link url="/pages/guide/index">
<text slot="footer" class='text-gray text-small'>更多</text>
</i-cell>
<view class="guides-wrapper">
<view class='guide-item' wx:for="{{guides}}" wx:for-index="idx" wx:for-item="n" wx:key="n.id">
<image class='image' src="{{n.poster}}" mode='aspectFill'></image>
<view class='info'>
<view class='text-small intro'>{{n.intro ? n.intro : ''}}</view>
<view class='text-small text-hint'>
<text wx:for="{{n.tags}}" wx:for-index="idx" wx:key="idx" wx:for-item="t">{{t}}</text>
</view>
</view>
</view>
</view>
</i-cell-group>
</view>
\ No newline at end of file
/* pages/index.wxss */
.v-page{
page {
background-color: #f5f5f5;
height: 100%;
}
.v-page {
position: relative;
}
.section-wrapper {
margin-top: 10px;
background-color: #fff;
}
.col-wrapper {
padding: 0 7px;
position: relative;
}
.col-class {
padding: 0 7px;
position: relative;
margin-bottom: 7px;
}
.col-item {
position: relative;
border: 1px solid #eee;
padding-bottom: 10px;
}
.col-item .image {
width: 100%;
height: 110px;
}
.col-item .title {
text-align: center;
font-size: 12px;
color: rgb(51, 51, 51);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
padding: 2px 2px;
}
.col-item .info {
text-align: center;
font-size: 12px;
color: rgb(153, 153, 153);
margin-top: 2px;
}
.guides-wrapper {
position: relative;
padding: 0 15px;
}
.guide-item {
position: relative;
border-bottom: 1px solid #eee;
padding: 10px 0;
display: flex;
flex-direction: row;
justify-content: space-between;
}
.guide-item image {
display: inline-block;
width: 130px;
height: 95px;
}
.guide-item .info {
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 5px 10px;
color: rgb(51, 51, 51);
}
/* pages/me/index.wxss */
page{
page {
background-color: #f5f5f5;
height: 100%;
}
.v-page {
background-color: #f5f5f5;
height: 100%;
......@@ -60,6 +62,7 @@ page{
}
/* 我的订单 */
.order-status-box {
background-color: #fff;
height: 182rpx;
......@@ -81,7 +84,7 @@ page{
flex-direction: column;
font-size: 24rpx;
justify-content: space-between;
align-items:center ;
align-items: center;
height: 85rpx;
color: rgb(191, 191, 191);
}
......@@ -91,7 +94,6 @@ page{
height: 44rpx;
}
.vip{
.vip {
margin-bottom: 20rpx;
}
......@@ -37,12 +37,12 @@
"list": []
},
"miniprogram": {
"current": 2,
"current": 0,
"list": [
{
"id": -1,
"name": "logs",
"pathName": "pages/logs/logs",
"id": 0,
"name": "美行攻略",
"pathName": "pages/guide/index",
"query": ""
},
{
......
/* 用于收集 formid 的 button 样式 */
button.form-button {
background-color: transparent;
padding: 0;
margin: 0;
display: inline;
position: static;
border: 0;
padding-left: 0;
padding-right: 0;
border-radius: 0;
font-size: 0;
text-align: left;
line-height: normal;
}
button.form-button::after {
content: '';
width: 0;
height: 0;
-webkit-transform: scale(1);
transform: scale(1);
display: none;
background-color: transparent;
}
......@@ -23,8 +23,36 @@ export const home = {
}
}
export const guide = {
list: (params) => {
return req.post('project/guides', params).then(res => res.data)
},
detail: (params) => {
return req.post('guide/detail', params).then(res => res.data)
}
}
export const me = {
info: params => {
return req.post('user/index', params).then(res => res.data)
},
update: params => {
return req.post('user/update', params).then(res => res.data)
},
collections: params => {
return req.post('user/userCollections', params).then(res => res.data)
},
vipPrice: params => {
return req.post('order/getVipPrice', params).then(res => res.data)
},
vipOrder: params => {
return req.post('order/vipOrder', params).then(res => res.data)
}
}
export default {
login,
shareTicket,
home
home,
guide
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment