Commit e47c15da authored by June's avatar June

iphoex的适配

parent e38a334b
<template> <template>
<uni-popup ref="goodsPopup" type="bottom"> <uni-popup ref="goodsPopup" type="bottom">
<view class="wrap w-100"> <view class="wrap w-100" :style="warpFIt">
<view <view
class="flex j-start a-center" class="flex j-start a-center"
v-if="goods" v-if="goods"
> >
<image <image
class="goods-cover mr-2" class="goods-cover mr-2"
:src="goods.cover" :src="goods.cover"
mode="aspectFit" mode="aspectFit"
...@@ -65,6 +65,10 @@ ...@@ -65,6 +65,10 @@
</view> </view>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
<view class="flex w-100 a-center flex-column font-28 mt-2"> <view class="flex w-100 a-center flex-column font-28 mt-2">
...@@ -75,7 +79,7 @@ ...@@ -75,7 +79,7 @@
</view> </view>
<!-- btn --> <!-- btn -->
<view class="w-100 btn-wrap flex j-between a-center text-center font-32"> <view class="w-100 btn-wrap flex j-between a-center text-center font-32" :style="btnBottom">
<view class="btn-cart flex-1" @click.stop="handleCart">加入购物车</view> <view class="btn-cart flex-1" @click.stop="handleCart">加入购物车</view>
<view class="btn-pay flex-1" @click.stop="handlePay">立即购买</view> <view class="btn-pay flex-1" @click.stop="handlePay">立即购买</view>
</view> </view>
...@@ -89,10 +93,15 @@ import price from '@/components/price/index.vue' ...@@ -89,10 +93,15 @@ import price from '@/components/price/index.vue'
import inputNumber from '@/components/inputNumber/index.vue' import inputNumber from '@/components/inputNumber/index.vue'
import { addCart } from '@/apis/carts.js' import { addCart } from '@/apis/carts.js'
import common from './common.js' import common from './common.js'
import { mapActions } from 'vuex' import { mapActions, mapState } from 'vuex'
export default { export default {
name: 'goods-popup', name: 'goods-popup',
props: {
fitIphoneX: {
type: Boolean,
default: true
}
},
data() { data() {
return { return {
goods: null, goods: null,
...@@ -108,6 +117,26 @@ export default { ...@@ -108,6 +117,26 @@ export default {
price price
}, },
computed: {
...mapState({
isIphoneX: state => state.systemInfo.isIphoneX
}),
btnBottom() {
if(this.fitIphoneX) {
return `bottom: ${this.isIphoneX}px`
} else {
return 'bottom: 0'
}
},
warpFIt() {
if(this.fitIphoneX) {
return `padding-bottom: 186rpx`
} else {
return 'padding-bottom: 118rpx'
}
}
},
methods: { methods: {
...common, ...common,
...mapActions('cart', ['setCount']), ...mapActions('cart', ['setCount']),
...@@ -237,7 +266,7 @@ export default { ...@@ -237,7 +266,7 @@ export default {
.wrap { .wrap {
position: relative; position: relative;
@include borderBox(20rpx, 20rpx); @include borderBox(20rpx, 20rpx);
padding-bottom: 118rpx;// 20 + 98 // padding-bottom: 118rpx;// 20 + 98
background-color: #fff; background-color: #fff;
.goods-cover { .goods-cover {
......
...@@ -5,8 +5,7 @@ const env = { ...@@ -5,8 +5,7 @@ const env = {
} }
// 不考虑其他端小程序直接这样配置 // 不考虑其他端小程序直接这样配置
export const baseUrl = env[__wxConfig.envVersion] // export const baseUrl = env[__wxConfig.envVersion]
// // #ifndef MP-WEIXIN // 因为这个是模板,用上面的方法配置域名意义不大
// export const baseUrl = process.env.NODE_ENV === 'development' ? env.develop : env.release export const baseUrl = process.env.NODE_ENV === 'development' ? env.develop : env.release
// // #endif
...@@ -121,7 +121,7 @@ ...@@ -121,7 +121,7 @@
<!-- 购物弹窗 --> <!-- 购物弹窗 -->
<goods-popup ref="popup" /> <goods-popup ref="popup" :fitIphoneX="false" />
</template> </template>
</view> </view>
</template> </template>
......
<template> <template>
<view <view
class="wrapper w-100" class="wrapper w-100"
:style="{paddingBottom: 98 + isIphoneX + 'px'}"
> >
<c-nav_bar <c-nav_bar
showBack showBack
...@@ -113,7 +114,7 @@ ...@@ -113,7 +114,7 @@
</view> </view>
<!-- buttons --> <!-- buttons -->
<view class="btns w-100 flex j-between a-center"> <view class="btns w-100 flex j-between a-center" :style="{paddingBottom: isIphoneX + 'px'}">
<view class="flex-1 flex j-around a-center"> <view class="flex-1 flex j-around a-center">
<view <view
class="flex-1 left-item flex flex-column j-center a-center" class="flex-1 left-item flex flex-column j-center a-center"
...@@ -195,11 +196,13 @@ export default { ...@@ -195,11 +196,13 @@ export default {
goods_id = options.goods_id goods_id = options.goods_id
this.getDetail() this.getDetail()
this.getSku() this.getSku()
console.log(this.isIphoneX)
}, },
computed: { computed: {
...mapState({ ...mapState({
cart_count: state => state.cart.cart_count cart_count: state => state.cart.cart_count,
isIphoneX: state => state.systemInfo.isIphoneX
}), }),
logisticsTab() { logisticsTab() {
...@@ -348,7 +351,6 @@ export default { ...@@ -348,7 +351,6 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
@import url("/components/parse/parse.css"); @import url("/components/parse/parse.css");
.wrapper { .wrapper {
margin-bottom: 98rpx;
.swiper-wrap { .swiper-wrap {
position: relative; position: relative;
width: 750rpx; width: 750rpx;
...@@ -432,11 +434,11 @@ export default { ...@@ -432,11 +434,11 @@ export default {
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
height: 98rpx;
@include borderBox(12rpx, 30rpx); @include borderBox(12rpx, 30rpx);
border-top: 1rpx solid $line; border-top: 1rpx solid $line;
background-color: $white; background-color: $white;
.left-item { .left-item {
height: 98rpx;
position: relative; position: relative;
font-size: 20rpx; font-size: 20rpx;
.icon { .icon {
...@@ -459,6 +461,7 @@ export default { ...@@ -459,6 +461,7 @@ export default {
} }
} }
.right { .right {
height: 98rpx;
flex: 0 0 360rpx; flex: 0 0 360rpx;
.cart-btn, .pay-btn { .cart-btn, .pay-btn {
display: inline-block; display: inline-block;
......
...@@ -172,7 +172,7 @@ ...@@ -172,7 +172,7 @@
</template> </template>
<!-- 购物弹窗 --> <!-- 购物弹窗 -->
<goods-popup ref="popup" /> <goods-popup ref="popup" :fitIphoneX="false" />
<button type="default" open-type="share" id="share"></button> <button type="default" open-type="share" id="share"></button>
</view> </view>
</template> </template>
...@@ -224,6 +224,7 @@ export default { ...@@ -224,6 +224,7 @@ export default {
mixins: [common_share], mixins: [common_share],
created() { created() {
console.log(this.systemInfo)
// 实例化分页方法 // 实例化分页方法
this.loadmore = new LoadMore() this.loadmore = new LoadMore()
this.getHomeCate() this.getHomeCate()
......
<template> <template>
<view class="wrapper"> <view class="wrapper" :style="{paddingBottom: 118 + isIphoneX + 'px'}">
<view class="tab-wrap w-100 flex j-around a-center text-center"> <view class="tab-wrap w-100 flex j-around a-center text-center">
<view <view
class="tab-item flex-1" class="tab-item flex-1"
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
</view> </view>
</view> </view>
<view class="w-100 flex j-end a-center confirm"> <view class="w-100 flex j-end a-center confirm" :style="{bottom: isIphoneX + 'px'}">
<text class="font-24">不含运费</text> <text class="font-24">不含运费</text>
<text class="total-price mx-4">合计:¥ <text class="total-price mx-4">合计:¥
<template v-if="judge.showTotal(orderDetail.shop.cartList2)"> <template v-if="judge.showTotal(orderDetail.shop.cartList2)">
...@@ -196,7 +196,8 @@ export default { ...@@ -196,7 +196,8 @@ export default {
computed: { computed: {
...mapState({ ...mapState({
openid: state => state.user.openid openid: state => state.user.openid,
isIphoneX: state => state.systemInfo.isIphoneX
}) })
}, },
...@@ -392,7 +393,7 @@ export default { ...@@ -392,7 +393,7 @@ export default {
.wrapper { .wrapper {
box-sizing: border-box; box-sizing: border-box;
padding-top: 110rpx; padding-top: 110rpx;
padding-bottom: 118rpx; // padding-bottom: 118rpx;
.tab-wrap { .tab-wrap {
position: fixed; position: fixed;
left: 0; left: 0;
......
...@@ -137,7 +137,11 @@ ...@@ -137,7 +137,11 @@
</view> </view>
</view> </view>
<view class="btn-wrap mt-2 flex j-end a-center" v-if="!['0', '2', '5'].includes(order_detail.order.order_status)"> <view
class="btn-wrap mt-2 flex j-end a-center"
:style="{bottom: isIphoneX + 'px'}"
v-if="!['0', '2', '5'].includes(order_detail.order.order_status)"
>
<order-btn :item="order_detail.order" :otherData="order_detail" @changeData='changeData'></order-btn> <order-btn :item="order_detail.order" :otherData="order_detail" @changeData='changeData'></order-btn>
</view> </view>
...@@ -147,6 +151,7 @@ ...@@ -147,6 +151,7 @@
<script> <script>
import orderBtn from './components/order-btn.vue' import orderBtn from './components/order-btn.vue'
import countdownT from './components/countdownT.vue' import countdownT from './components/countdownT.vue'
import { mapState } from 'vuex'
import { orderDetail } from '@/apis/order.js' import { orderDetail } from '@/apis/order.js'
import { makePhoneCall } from '@/utils/common.js' import { makePhoneCall } from '@/utils/common.js'
import { baseUrl } from '@/config/index.js' import { baseUrl } from '@/config/index.js'
...@@ -171,7 +176,11 @@ export default { ...@@ -171,7 +176,11 @@ export default {
countdownT, countdownT,
orderBtn orderBtn
}, },
computed: {
...mapState({
isIphoneX: state => state.systemInfo.isIphoneX
})
},
onLoad(ops) { onLoad(ops) {
order_sn = ops.order_sn order_sn = ops.order_sn
this.getDetail() this.getDetail()
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
- 一般层级(普通层级,如展示一些普通信息) zIndex范围 1-98 - 一般层级(普通层级,如展示一些普通信息) zIndex范围 1-98
- 当前页面最高层级,如遮罩 zIndex 99 - 当前页面最高层级,如遮罩 zIndex 99
- 仅次于小程序原生弹窗 zIndex 100 - 仅次于小程序原生弹窗 zIndex 100
+ 小程序线上版本库2.16.0 (后端在授权开通服务的时候会设置)
#### warning #### warning
+ 2021/6/29,本日起的代码可能会引起不适,but all can run(效率和质量不会成正比关系) + 2021/6/29,本日起的代码可能会引起不适,but all can run(效率和质量不会成正比关系)
...@@ -33,4 +34,4 @@ ...@@ -33,4 +34,4 @@
+ 详情有个深拷贝的问题。暂时通过JSON.stringify()处理 + 详情有个深拷贝的问题。暂时通过JSON.stringify()处理
+ 所有的价格都是通过toFixed会可能出现精度问题。一般发现不了 + 所有的价格都是通过toFixed会可能出现精度问题。一般发现不了
+ 确认订单页面要跳到地址列表页面选择 + 确认订单页面要跳到地址列表页面选择
// wx537e892e36fbf79d // wx537e892e36fbf79d // 测试 wxd170058f4ad8fecd
\ No newline at end of file \ No newline at end of file
const state = { const state = {
systemInfo: null, systemInfo: null,
menuButtonInfo: null, menuButtonInfo: null,
menuCalcInfo: null menuCalcInfo: null,
isIphoneX: 0 // 安全距离
} }
const mutations = { const mutations = {
SETMOBILEDATA(state, params) { SETMOBILEDATA(state, params) {
state.systemInfo = params.systemInfo const { systemInfo, menuButtonInfo, menuCalcInfo } = params
state.menuButtonInfo = params.menuButtonInfo state.systemInfo = systemInfo
state.menuCalcInfo = params.menuCalcInfo state.menuButtonInfo = menuButtonInfo
state.menuCalcInfo = menuCalcInfo
state.isIphoneX = systemInfo.screenHeight - systemInfo.safeArea.bottom
} }
} }
......
...@@ -16,4 +16,8 @@ $white: #fff; // 白色 ...@@ -16,4 +16,8 @@ $white: #fff; // 白色
content: " "; content: " ";
clear: both; clear: both;
height: 0; height: 0;
}
.isIphoneX {
padding-bottom: 68rpx!important;
} }
\ No newline at end of file
...@@ -24,11 +24,12 @@ ...@@ -24,11 +24,12 @@
</view> </view>
</block> </block>
<navigator class="addresss-btn" url="/subPages/address/edit">添加地址</navigator> <navigator class="addresss-btn" :style="{bottom: isIphoneX + 'px'}" url="/subPages/address/edit">添加地址</navigator>
</view> </view>
</template> </template>
<script> <script>
import { mapState } from 'vuex'
import { addressList, defaultAddress, delAddress } from '@/apis/address.js' import { addressList, defaultAddress, delAddress } from '@/apis/address.js'
import LoadMore from '@/utils/load-more.js' import LoadMore from '@/utils/load-more.js'
...@@ -54,6 +55,12 @@ export default { ...@@ -54,6 +55,12 @@ export default {
this.init() this.init()
}, },
computed: {
...mapState({
isIphoneX: state => state.systemInfo.isIphoneX
})
},
// 下拉刷新 // 下拉刷新
onPullDownRefresh() { onPullDownRefresh() {
uni.showLoading({ uni.showLoading({
......
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