Commit dec8383c by 汪睦雄

修改了搜索

parents a98d0440 34f10d79
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<i-grid-icon i-class="nav-icon"> <i-grid-icon i-class="nav-icon">
<image src="/images/navs/icon_nav_6.png" /> <image src="/images/navs/icon_nav_6.png" />
</i-grid-icon> </i-grid-icon>
<i-grid-label i-class="nav-label">美行攻略</i-grid-label> <i-grid-label i-class="nav-label">转让专区</i-grid-label>
</i-grid-item> </i-grid-item>
<i-grid-item i-class="nav-grid-item" catchtap='catalogClick' data-catalog='8' data-name='儿童教育'> <i-grid-item i-class="nav-grid-item" catchtap='catalogClick' data-catalog='8' data-name='儿童教育'>
<i-grid-icon i-class="nav-icon"> <i-grid-icon i-class="nav-icon">
......
...@@ -11,6 +11,7 @@ Page({ ...@@ -11,6 +11,7 @@ Page({
data: { data: {
guides: [], guides: [],
iptValue: '', iptValue: '',
recover: 'none',
currentPage: 1, currentPage: 1,
loading: true, loading: true,
hasMore: true, hasMore: true,
...@@ -128,9 +129,12 @@ Page({ ...@@ -128,9 +129,12 @@ Page({
}) })
}, },
/* 美行攻略 的 搜索请求*/ /* 美行攻略 的 搜索请求*/
searchFun: function (e) { searchFun: function (e,callback) {
// 显示“取消”按钮
this.setData({ recover: "block"})
// 开始请求
const p = this.data.currentPage const p = this.data.currentPage
var title = e.detail.value let title = e.detail.value
api.guide.list({ api.guide.list({
title, p title, p
}).then(res => { }).then(res => {
...@@ -149,5 +153,30 @@ Page({ ...@@ -149,5 +153,30 @@ Page({
typeof callback == "function" && callback() typeof callback == "function" && callback()
} }
}) })
},
recoverListData: function (callback){
this.setData({ recover: "none" })
// 同时删除搜索框的内容
this.clearContent()
// 开始重新渲染数据
const p = this.data.currentPage
api.guide.list({
p
}).then(res => {
if (res.code) {
this.setData({
hasMore: false,
loading: false
})
} else {
this.setData({
guides: this.data.guides = 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()
}
})
} }
}) })
\ No newline at end of file
<!--pages/guide/index.wxml--> <!--pages/guide/index.wxml-->
<view class='v-page'> <!-- 搜索 -->
<!-- 搜索 --> <form>
<form class="search_out"> <view class="search_out">
<view class='input_box'>
<icon class='icon-search' type='search' size='14'></icon> <icon class='icon-search' type='search' size='14'></icon>
<input <input
class="iptSearch" class="iptSearch"
...@@ -13,8 +14,13 @@ ...@@ -13,8 +14,13 @@
bindinput='getIptValue' bindinput='getIptValue'
/> />
<icon class='icon-clear' type='clear' size='14' bindtap='clearContent'></icon> <icon class='icon-clear' type='clear' size='14' bindtap='clearContent'></icon>
</view>
<button class='recoverBnt' style="display: {{recover}};" bindtap='recoverListData'>取消</button>
</view>
</form> </form>
<view class='v-page'>
<view class='guides-container'> <view class='guides-container'>
<view class="guide-wrapper" wx:for="{{guides}}" wx:for-item="n" wx:key="n.id" catchtap='handleGuideDetail' data-content="{{n.type=='1'?n.id:n.content}}" data-type="{{n.type}}"> <view class="guide-wrapper" wx:for="{{guides}}" wx:for-item="n" wx:key="n.id" catchtap='handleGuideDetail' data-content="{{n.type=='1'?n.id:n.content}}" data-type="{{n.type}}">
<image class='image' src="{{n.poster}}" mode='aspectFill'></image> <image class='image' src="{{n.poster}}" mode='aspectFill'></image>
......
/* pages/guide/index.wxss */ /* pages/guide/index.wxss */
/* 搜索*/ /* 搜索*/
.search_out{ form{
width: 100%; width: 100%;
height: 50px; height: 50px;
display: block; display: block;
}
.search_out{
width: 100%;
height: 50px;
display: flex;
flex-direction: row;
align-items: center;
padding: 20rpx; padding: 20rpx;
box-sizing: border-box; box-sizing: border-box;
position: relative;
background: rgb(207, 207, 207); background: rgb(207, 207, 207);
} }
.search_out .icon-search{ .search_out .input_box{
width: 100%;
height: 100%;
box-sizing: border-box;
display: block;
position: relative;
}
.search_out .input_box .iptSearch{
width: 100%;
height: 30px;
display: block;
box-sizing: border-box;
margin: 0;
padding-left: 35px;
padding-right: 35px;
background: rgb(255, 255, 255);
border-radius: 3px;
font-size: 12px;
}
.search_out .input_box .icon-search{
position: absolute; position: absolute;
left: 20px; left: 25rpx;
top: calc(50% - 9px); top: calc(50% - 9px);
} }
.search_out .icon-clear{ .search_out .input_box .icon-clear{
position: absolute; position: absolute;
right: 20px; right: 25rpx;
top: calc(50% - 9px); top: calc(50% - 9px);
opacity: 0.85; opacity: 0.85;
} }
.search_out .iptSearch{ .search_out .recoverBnt{
width: 100%; width: 50px;
height: 30px; height: 30px;
display: none;
flex-grow: 0;
box-sizing: border-box; box-sizing: border-box;
-ms-box-sizing: border-box; padding: 0;
-webkit-box-sizing: border-box; margin-left: 20rpx;
margin: 0 auto;
padding-left: 32px;
padding-right: 32px;
background: rgb(255, 255, 255);
border-radius: 3px;
font-size: 12px; font-size: 12px;
line-height: 30px;
} }
/* 搜索结束*/ /* 搜索结束*/
......
// pages/me/vip/index.js // pages/me/vip/index.js
import api from '../../../utils/Api.js' import api from '../../../utils/Api.js'
import Wx from '../../../utils/Wx.js'
const app = getApp() const app = getApp()
const {
$Toast
} = require('../../../iview/base/index');
Page({ Page({
/** /**
* 页面的初始数据 * 页面的初始数据
...@@ -13,7 +16,9 @@ Page({ ...@@ -13,7 +16,9 @@ Page({
vip_price: 49.9, vip_price: 49.9,
order: {}, order: {},
user: {} user: {},
visible1: false,
}, },
handleChange1({ handleChange1({
...@@ -44,6 +49,8 @@ Page({ ...@@ -44,6 +49,8 @@ Page({
getUserInfo: function() { getUserInfo: function() {
api.me.info().then(res => { api.me.info().then(res => {
if (!res.code) { if (!res.code) {
//授权手机号
this.dialogPhone(res.data)
app.globalData.userInfo = res.data app.globalData.userInfo = res.data
// 渲染数据 // 渲染数据
this.setData({ this.setData({
...@@ -53,6 +60,56 @@ Page({ ...@@ -53,6 +60,56 @@ Page({
}) })
}, },
/**
* 手机号授权弹窗
*/
dialogPhone: function(data) {
if (!data.phone) {
this.setData({
visible1: true
});
}
},
handlePhoneAuth: function(event) {
Wx.login().then(res => {
let encryptedData = event.detail.encryptedData
let iv = event.detail.iv
this.decodePhoneData(res.code, encryptedData, iv)
})
},
/**
* 解密手机号数据
*/
decodePhoneData: function(code, encryptedData, iv) {
let that = this
api.getPhoneNumber({
code: code,
encryptedData: encryptedData,
iv: iv
}).then(res => {
if (!res.code) {
that.setData({
visible1:false
})
$Toast({
content: '手机号授权成功',
type: 'success'
});
//更新下用户数据
that.getUserInfo()
} else {
$Toast({
content: '手机号授权失败',
type: 'error'
});
}
})
},
// 获取VIP单价 // 获取VIP单价
getVipPrice: function() { getVipPrice: function() {
api.me.vipPrice().then(res => { api.me.vipPrice().then(res => {
......
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
"i-col": "/iview/col/index", "i-col": "/iview/col/index",
"i-input-number": "/iview/input-number/index", "i-input-number": "/iview/input-number/index",
"i-button": "/iview/button/index", "i-button": "/iview/button/index",
"i-input": "/iview/input/index" "i-input": "/iview/input/index",
"i-modal": "/iview/modal/index",
"i-toast": "/iview/toast/index"
} }
} }
\ No newline at end of file
...@@ -21,15 +21,25 @@ ...@@ -21,15 +21,25 @@
</view> </view>
<!-- 用户输入的信息 --> <!-- 用户输入的信息 -->
<i-input i-class="right-align" value="" title="姓名" type="text" placeholder="请输入您的姓名" /> <!-- <i-input i-class="right-align" value="" title="姓名" type="text" placeholder="请输入您的姓名" />
<view class='phoneGive'> <view class='phoneGive'>
<text>手机号</text> <text>手机号</text>
<button>授权</button> <button>授权</button>
</view> </view>
<i-input i-class="right-align right-align-last" type="text" title="地址" placeholder="请输入您的地址" maxlength="50" /> <i-input i-class="right-align right-align-last" type="text" title="地址" placeholder="请输入您的地址" maxlength="50" /> -->
<i-row class='height'> <i-row class='height'>
<i-col span="20" offset='2' i-class="col-class"> <i-col span="20" offset='2' i-class="col-class">
<i-button bind:click="handleClick" type="primary" shape="circle" size="small">立即{{user.is_vip==1?'续费':'购买'}} ¥{{common.numFixed(vip_price*value1, 2)}}</i-button> <i-button bind:click="handleClick" type="primary" shape="circle" size="small">立即{{user.is_vip==1?'续费':'购买'}} ¥{{common.numFixed(vip_price*value1, 2)}}</i-button>
</i-col> </i-col>
</i-row> </i-row>
<!-- 授权弹窗 -->
<i-modal title="请授权手机号" visible="{{ visible1 }}" show-cancel="{{false}}" show-ok="{{false}}" action-mode="{{ vertical }}">
<view class="auth_phone_container">
<i-button i-class="btn_auth_phone" type="info" shape="circle" size="default" bindgetphonenumber="handlePhoneAuth" open-type="getPhoneNumber">授权</i-button>
</view>
</i-modal>
<!-- toast弹窗 -->
<i-toast id="toast" />
\ No newline at end of file
...@@ -96,3 +96,9 @@ page { ...@@ -96,3 +96,9 @@ page {
.color-orange { .color-orange {
color: #ff4200; color: #ff4200;
} }
/* 授权窗口 */
.auth_phone_container{
width: 80%;
margin: auto;
}
\ No newline at end of file
{
"description": "项目配置文件",
"packOptions": {
"ignore": []
},
"setting": {
"urlCheck": false,
"es6": true,
"postcss": true,
"minified": true,
"newFeature": true,
"nodeModules": false,
"autoAudits": false
},
"compileType": "miniprogram",
"libVersion": "2.3.2",
"appid": "wx1b834552a7d49bb3",
"projectname": "%E7%BE%8E%E8%A1%8C%E8%80%85%E4%BA%B2%E5%AD%90%E6%B8%B8(git)",
"debugOptions": {
"hidedInDevtools": []
},
"isGameTourist": false,
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"plugin": {
"current": -1,
"list": []
},
"game": {
"currentL": -1,
"list": []
},
"miniprogram": {
"current": 16,
"list": [
{
"id": 0,
"name": "美行攻略",
"pathName": "pages/guide/index",
"query": ""
},
{
"id": 1,
"name": "我的",
"pathName": "pages/me/index",
"query": ""
},
{
"id": 2,
"name": "下单",
"pathName": "pages/me/order/index",
"query": ""
},
{
"id": 3,
"name": "搜索",
"pathName": "pages/search/index",
"query": ""
},
{
"id": 4,
"name": "授权",
"pathName": "pages/auth/index",
"query": ""
},
{
"id": -1,
"name": "个人信息",
"pathName": "pages/me/profile/index",
"query": ""
},
{
"id": -1,
"name": "vip",
"pathName": "pages/me/vip/index",
"query": ""
},
{
"id": -1,
"name": "资料",
"pathName": "pages/me/profile/index",
"query": ""
},
{
"id": 8,
"name": "活动/商家详情",
"pathName": "pages/detail/index",
"query": "id=127"
},
{
"id": -1,
"name": "预约下次",
"pathName": "pages/detail/appointment/index",
"query": ""
},
{
"id": -1,
"name": "立即报名",
"pathName": "pages/detail/enroll/index",
"query": "id=1"
},
{
"id": 11,
"name": "预约下次",
"pathName": "pages/detail/appoint/index",
"query": "id=173"
},
{
"id": -1,
"name": "我的订单",
"pathName": "pages/me/order/index",
"query": ""
},
{
"id": 13,
"name": "关注关注号",
"pathName": "pages/index/index",
"query": "",
"scene": "1047"
},
{
"id": -1,
"name": "预约下次",
"pathName": "pages/detail/appoint/index",
"query": "id=173"
},
{
"id": -1,
"name": "搜索",
"pathName": "pages/search/index",
"query": ""
},
{
"id": -1,
"name": "搜索列表",
"pathName": "pages/search/list/list",
"query": "catalog=5&ptitle=品牌酒店",
"scene": "1047"
}
]
}
}
}
\ 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