Commit 83d042ee by 汪睦雄

提交

parent 7f1750ce
......@@ -4,6 +4,6 @@
<i-spin i-class="spin"></i-spin>
</view>
<view class="more-wrapper__line" hidden="{{hasMore || page == 1}}">
<i-divider content="加载已经完成,没有其他数据"></i-divider>
<i-divider content="加载完成,没有更多了"></i-divider>
</view>
</view>
\ No newline at end of file
// components/navs/index.js
import Config from '../../utils/Config.js'
Page({
/**
......@@ -62,5 +63,30 @@ Page({
*/
onShareAppMessage: function () {
},
// 分类点击
catalogClick: function (event) {
let _catalog = event.currentTarget.dataset.catalog
let _ptitle = event.currentTarget.dataset.name
wx.navigateTo({
url: '/pages/search/list/list?catalog=' + _catalog + '&ptitle=' + _ptitle,
})
},
// 美行攻略
gotoGuides: function (event) {
wx.navigateTo({
url: '/pages/guide/index',
})
},
// 商家合作
gotoShopJoin: function (event) {
let _url = ""
wx.navigateTo({
url: '/pages/webview/index?url=' + Config.shopJoinPath,
})
}
})
\ No newline at end of file
<!--components/navs/index.wxml-->
<view class='v-navs'>
<i-grid i-class="nav-grid">
<i-grid-item i-class="nav-grid-item">
<i-grid-item i-class="nav-grid-item" catchtap='catalogClick' data-catalog='5' data-name='品牌酒店'>
<i-grid-icon i-class="nav-icon">
<image src="/images/navs/icon_nav_1.png" />
</i-grid-icon>
<i-grid-label i-class="nav-label">品牌酒店</i-grid-label>
</i-grid-item>
<i-grid-item i-class="nav-grid-item">
<i-grid-item i-class="nav-grid-item" catchtap='catalogClick' data-catalog='4' data-name='精品民宿'>
<i-grid-icon i-class="nav-icon">
<image src="/images/navs/icon_nav_2.png" />
</i-grid-icon>
<i-grid-label i-class="nav-label">精品民宿</i-grid-label>
</i-grid-item>
<i-grid-item i-class="nav-grid-item">
<i-grid-item i-class="nav-grid-item" catchtap='catalogClick' data-catalog='2' data-name='亲子乐园'>
<i-grid-icon i-class="nav-icon">
<image src="/images/navs/icon_nav_3.png" />
</i-grid-icon>
<i-grid-label i-class="nav-label">亲子乐园</i-grid-label>
</i-grid-item>
<i-grid-item i-class="nav-grid-item">
<i-grid-item i-class="nav-grid-item" catchtap='catalogClick' data-catalog='6' data-name='亲子餐厅'>
<i-grid-icon i-class="nav-icon">
<image src="/images/navs/icon_nav_4.png" />
</i-grid-icon>
......@@ -27,25 +27,25 @@
</i-grid-item>
</i-grid>
<i-grid i-class="nav-grid">
<i-grid-item i-class="nav-grid-item">
<i-grid-item i-class="nav-grid-item" catchtap='catalogClick' data-catalog='7' data-name='线下活动'>
<i-grid-icon i-class="nav-icon">
<image src="/images/navs/icon_nav_5.png" />
</i-grid-icon>
<i-grid-label i-class="nav-label">线下活动</i-grid-label>
</i-grid-item>
<i-grid-item i-class="nav-grid-item">
<i-grid-item i-class="nav-grid-item" catchtap='gotoGuides'>
<i-grid-icon i-class="nav-icon">
<image src="/images/navs/icon_nav_6.png" />
</i-grid-icon>
<i-grid-label i-class="nav-label">美行攻略</i-grid-label>
</i-grid-item>
<i-grid-item i-class="nav-grid-item">
<i-grid-item i-class="nav-grid-item" catchtap='catalogClick' data-catalog='8' data-name='儿童教育'>
<i-grid-icon i-class="nav-icon">
<image src="/images/navs/icon_nav_7.png" />
</i-grid-icon>
<i-grid-label i-class="nav-label">儿童教育</i-grid-label>
</i-grid-item>
<i-grid-item i-class="nav-grid-item">
<i-grid-item i-class="nav-grid-item" catchtap='gotoShopJoin'>
<i-grid-icon i-class="nav-icon">
<image src="/images/navs/icon_nav_8.png" />
</i-grid-icon>
......

2.56 KB | W: | H:

2.51 KB | W: | H:

images/tabs/icon_home.png
images/tabs/icon_home.png
images/tabs/icon_home.png
images/tabs/icon_home.png
  • 2-up
  • Swipe
  • Onion skin

2.76 KB | W: | H:

2.71 KB | W: | H:

images/tabs/icon_home_active.png
images/tabs/icon_home_active.png
images/tabs/icon_home_active.png
images/tabs/icon_home_active.png
  • 2-up
  • Swipe
  • Onion skin

2.83 KB | W: | H:

2.75 KB | W: | H:

images/tabs/icon_me.png
images/tabs/icon_me.png
images/tabs/icon_me.png
images/tabs/icon_me.png
  • 2-up
  • Swipe
  • Onion skin

3.07 KB | W: | H:

2.96 KB | W: | H:

images/tabs/icon_me_active.png
images/tabs/icon_me_active.png
images/tabs/icon_me_active.png
images/tabs/icon_me_active.png
  • 2-up
  • Swipe
  • Onion skin

2.79 KB | W: | H:

2.6 KB | W: | H:

images/tabs/icon_search.png
images/tabs/icon_search.png
images/tabs/icon_search.png
images/tabs/icon_search.png
  • 2-up
  • Swipe
  • Onion skin

2.97 KB | W: | H:

2.8 KB | W: | H:

images/tabs/icon_search_active.png
images/tabs/icon_search_active.png
images/tabs/icon_search_active.png
images/tabs/icon_search_active.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -2,7 +2,7 @@
<view class='v-page'>
<view class='container'>
<image class='logo' src='/images/icon_location.png' mode='scaleToFill'></image>
<image class='logo' mode='aspectFit' src='/images/icon_logo.png' mode='aspectFit'></image>
<view class='slogan'>
<view>没行者亲子游</view>
<view>美好的教育,行走在路上</view>
......
......@@ -20,7 +20,7 @@ page {
}
.logo {
width: 68%;
width: 60%;
}
.slogan {
......@@ -28,7 +28,7 @@ page {
width: 100%;
color: #767676;
font-size: 16px;
margin-top: 30px;
margin-top: 20px;
margin-bottom: 40px;
line-height: 24px;
}
......
......@@ -97,5 +97,23 @@ Page({
banners: res.data
})
})
},
// 最新活动,爆款专区 更多项目
gotoMoreProjects: function(event) {
let _type = event.target.dataset.type
let _ptitle = event.target.dataset.name
wx.navigateTo({
url: '/pages/prjlist/list?type=' + _type + '&ptitle=' + _ptitle,
})
},
// 更多:按分类筛选
gotoSearchProjects: function(event) {
let _catalog = event.target.dataset.catalog
let _ptitle = event.target.dataset.name
wx.navigateTo({
url: '/pages/search/list/list?catalog=' + _catalog + '&ptitle=' + _ptitle,
})
}
})
\ No newline at end of file
......@@ -5,7 +5,7 @@
<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>
<text slot="footer" class='text-gray text-small' catchtap='gotoMoreProjects' data-type='1' data-name='最新活动'>更多</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}}">
......@@ -23,7 +23,7 @@
<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>
<text slot="footer" class='text-gray text-small' catchtap='gotoMoreProjects' data-type='2' data-name='爆款专区'>更多</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}}">
......@@ -41,7 +41,7 @@
<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>
<text slot="footer" class='text-gray text-small' catchtap='gotoSearchProjects' data-catalog='5' data-name='酒店预订'>更多</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">
......
// pages/me/index.js
import api from '../../utils/Api.js'
import Config from '../../utils/Config.js'
const app = getApp()
Page({
......@@ -8,7 +9,7 @@ Page({
* 页面的初始数据
*/
data: {
user: {}
},
/**
......@@ -38,11 +39,24 @@ Page({
})
},
// 获取个人资料
getUserInfo: function() {
api.me.info().then(res => {
if (!res.code) {
app.globalData.userInfo = res.data
// 渲染数据
this.setData({
user: res.data
})
}
})
},
// 商家合作
gotoShopJoin: function (event) {
let _url = ""
wx.navigateTo({
url: '/pages/webview/index?url=' + Config.shopJoinPath,
})
}
})
\ No newline at end of file
......@@ -4,11 +4,11 @@
<view class='head-map'>
<image src='/images/personal_center/info_background.png'></image>
<view class='avatar_box'>
<image src='/images/personal_center/avatar.jpg' bindtap="toUrl" data-url='/pages/me/profile/index'></image>
<image src='{{user.avatar}}' bindtap="toUrl" data-url='/pages/me/profile/index'></image>
</view>
<view class='user-info-box' >
<image src='/images/personal_center/vip.png' ></image>
<text>小熊</text>
<image wx-if="{{user.is_vip==1}}" src='/images/personal_center/vip.png' ></image>
<text>{{user.nickname}}</text>
</view>
</view>
......@@ -41,7 +41,7 @@
<i-cell-group i-class='vip'>
<i-cell title="VIP会员" is-link url="/pages/me/vip/index">
<text slot="footer" class='text-gray'>全部</text>
<text slot="footer" class='text-gray'>{{user.vip_endtime==null?'':user.vip_endtime}}</text>
</i-cell>
<i-cell title="我的收藏" is-link url="/pages/collection/index"></i-cell>
</i-cell-group>
......
......@@ -39,6 +39,7 @@ page {
width: 120rpx;
height: 120rpx;
border-radius: 50%;
border: 2px solid white;
}
.user-info-box {
......
// pages/prjlist/list.js
import api from '../../utils/Api.js'
import Wx from '../../utils/Wx.js'
import Schedule from '../../utils/Schedule.js'
const {
$Toast
} = require('../../iview/base/index');
Page({
/**
* 页面的初始数据
*/
data: {
projects: [],
currentPage: 1,
loading: true,
hasMore: true,
type: ''
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
let _type = options.type
let _ptitle = options.ptitle
if (_type != null && _type.length > 0) {
this.setData({
type: _type
})
}
if (_ptitle!=null && _ptitle.length > 0){
wx.setNavigationBarTitle({
title: _ptitle
})
}
this.getListData()
},
/**
* 加载
*/
getListData: function (callback) {
const p = this.data.currentPage
let params = {
p: p
}
if (this.data.type.length > 0) {
params['type'] = this.data.type
}
// 请求数据接口
api.search.bytype(params).then(res => {
if (res.code) {
this.setData({
hasMore: false,
loading: false,
currentPage: 2
})
$Toast({
content: res.msg,
type: 'error'
})
} else {
let _projects = this.data.projects
this.setData({
projects: _projects.concat(res.data),
loading: false,
hasMore: res.data && res.data.length > 0 ? true : false,
currentPage: res.data && res.data.length > 0 ? p : (p - 1)
})
typeof callback == "function" && callback()
}
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
this.setData({
projects: [],
loading: true,
hasMore: true,
currentPage: 1
})
wx.showNavigationBarLoading()
wx.showLoading({
title: '加载中...',
})
new Schedule().task(this.getListData).delay(1600).task(() => {
wx.hideNavigationBarLoading()
wx.stopPullDownRefresh()
wx.hideLoading()
})
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
let that = this
if (that.data.loading || !that.data.hasMore) {
return;
} else {
let page = that.data.currentPage + 1
new Schedule().task(() => {
that.setData({
loading: true,
currentPage: page
})
}).delay(1000).task(that.getListData)
}
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
}
})
\ No newline at end of file
{
"navigationBarTitleText": "项目列表",
"enablePullDownRefresh": true,
"usingComponents": {
"project-item": "/components/project-item/index",
"more": "/components/more/index",
"i-toast": "/iview/toast/index"
}
}
\ No newline at end of file
<!--pages/prjlist/list.wxml-->
<view class="page-wrapper">
<view class="projects-wrapper">
<project-item wx:for="{{projects}}" wx:for-index="idx" wx:for-item="item" wx:key="n.id" project-item="{{item}}" />
</view>
<i-toast id="toast" />
</view>
<more hasMore="{{hasMore}}" loading="{{loading}}" page="{{currentPage}}" />
\ No newline at end of file
/* pages/prjlist/list.wxss */
.page-wrapper{
background: white;
}
\ No newline at end of file
......@@ -17,7 +17,8 @@ Page({
hasMore: true,
title: '',
tags: []
tags: [],
catalog: '0'
},
/**
......@@ -26,6 +27,7 @@ Page({
onLoad: function (options) {
let _title = options.title
let _tags = options.tags
let _catalog = options.catalog
if (_tags!=null && _tags.length>0){
this.setData({
tags: JSON.parse(_tags)
......@@ -36,6 +38,18 @@ Page({
title: _title
})
}
if (_catalog != null && _catalog.length > 0) {
this.setData({
catalog: _catalog
})
}
// 页面title
let _ptitle = options.ptitle
if (_ptitle != null && _ptitle.length > 0) {
wx.setNavigationBarTitle({
title: _ptitle
})
}
this.getListData()
},
......@@ -53,12 +67,16 @@ Page({
if (this.data.title.length > 0) {
params['title'] = this.data.title
}
if (parseInt(this.data.catalog) > 0) {
params['catalog_id'] = this.data.catalog
}
// 请求数据接口
api.search.index(params).then(res => {
if (res.code) {
this.setData({
hasMore: false,
loading: false
loading: false,
currentPage: 2
})
$Toast({
content: res.msg,
......
......@@ -4,6 +4,6 @@
<view class="projects-wrapper">
<project-item wx:for="{{projects}}" wx:for-index="idx" wx:for-item="item" wx:key="n.id" project-item="{{item}}" />
</view>
<more hasMore="{{hasMore}}" loading="{{loading}}" page="{{currentPage}}" />
<i-toast id="toast" />
</view>
\ No newline at end of file
</view>
<more hasMore="{{hasMore}}" loading="{{loading}}" page="{{currentPage}}" />
\ No newline at end of file
......@@ -58,6 +58,9 @@ export const search = {
index: params => {
return req.post('project/index', params).then(res => res.data)
},
bytype: params => {
return req.post('project/newProjects', params).then(res => res.data)
},
filter: params => {
return req.post('project/searchCondition', params).then(res => res.data)
}
......
export const Config = {
apiPath: "http://app.maveler.com/api/"
apiPath: "http://app.maveler.com/api/",
shopJoinPath: "http://app.maveler.com/mob/Index/index"
}
export default Config
\ 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