Browse Source

[新增] 路由拦截授权用户信息和手机号

[优化] 首页样式
master
邓平艺 4 years ago
parent
commit
0db588f338
  1. 10
      common/http.interceptor.js
  2. 7
      common/mixin.js
  3. 11
      pages/goodsDetail/index.vue
  4. 17
      pages/index/index.vue

10
common/http.interceptor.js

@ -26,6 +26,16 @@ const install = (Vue, vm) => {
} else if(res.code == 201) { } else if(res.code == 201) {
console.log("其他状态:", res.code) console.log("其他状态:", res.code)
return false; return false;
} else if (res.code == 9999) {
uni.navigateTo({
url: '/pages/login/index?type=userinfo'
})
return false;
} else if (res.code == 9998) {
uni.navigateTo({
url: '/pages/login/index?type=phone'
})
return false;
} else { } else {
return false; return false;
} }

7
common/mixin.js

@ -3,16 +3,9 @@ export default{
return { return {
pageScrollTop: 0, // 页面距离顶部的距离 pageScrollTop: 0, // 页面距离顶部的距离
} }
},
onLoad(option){
}, },
onPageScroll(res) { onPageScroll(res) {
this.pageScrollTop = res.scrollTop; this.pageScrollTop = res.scrollTop;
},
// 页面转发分享
async onShareAppMessage(res) {
}, },
methods: { methods: {
$check(str, type) { $check(str, type) {

11
pages/goodsDetail/index.vue

@ -1,5 +1,6 @@
<template> <template>
<view> <view>
<block v-if="isRight(goods_detail)">
<!-- 商品图片轮播 --> <!-- 商品图片轮播 -->
<swiper :current="current" :indicator-dots="true" :circular="true" class="swiper-box"> <swiper :current="current" :indicator-dots="true" :circular="true" class="swiper-box">
<swiper-item v-for="item in goods_detail.banners" :key="item.id"> <swiper-item v-for="item in goods_detail.banners" :key="item.id">
@ -72,6 +73,7 @@
</view> </view>
<button class="btn" @click="toAddOrder">立即抢购</button> <button class="btn" @click="toAddOrder">立即抢购</button>
</view> </view>
</block>
</view> </view>
</template> </template>
@ -85,6 +87,13 @@
is_collect: 0 // 10 is_collect: 0 // 10
} }
}, },
computed: {
isRight(){
return function(val){
return this.$shared.isRight(val);
}
}
},
onLoad(options){ onLoad(options){
this.goods_id = options.id; this.goods_id = options.id;
this.getGoodsDetail(); this.getGoodsDetail();
@ -129,7 +138,7 @@
onShareAppMessage(){ onShareAppMessage(){
let goods = this.goods_detail; let goods = this.goods_detail;
let title = goods.name; let title = goods.name;
let imageUrl = goods.cover;
let imageUrl = goods.share_cover || goods.cover;
let path = '/pages/route/index'; let path = '/pages/route/index';
return { return {

17
pages/index/index.vue

@ -22,7 +22,7 @@
<text class="lf-font-24"></text> <text class="lf-font-24"></text>
<text class="lf-font-42">{{ item.specs[0].selling_price }}</text> <text class="lf-font-42">{{ item.specs[0].selling_price }}</text>
</text> </text>
<text class="lf-font-24">{{ item.specs[0].original_price }}</text>
<text class="lf-font-24 original-price">{{ item.specs[0].original_price }}</text>
<button>立即抢购</button> <button>立即抢购</button>
</view> </view>
</view> </view>
@ -123,10 +123,7 @@
let isPage = res.data.has_more_page; let isPage = res.data.has_more_page;
tab_item.isPage = isPage; tab_item.isPage = isPage;
if(isPage){
tab_item.loadingClass = true;
tab_item.loadingText = '正在加载中';
}else{
if(!isPage){
tab_item.loadingClass = false; tab_item.loadingClass = false;
tab_item.loadingText = '没有更多数据啦~'; tab_item.loadingText = '没有更多数据啦~';
} }
@ -157,7 +154,10 @@
tab_item.loadingText = '正在加载中'; tab_item.loadingText = '正在加载中';
this.getGoodsList(); this.getGoodsList();
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
}
},
// onShareAppMessage(){
// }
} }
</script> </script>
@ -224,7 +224,10 @@
.price{ .price{
overflow: hidden; overflow: hidden;
color:#FF0000; color:#FF0000;
.original-price{
text-decoration: line-through;
color: #777777;
}
// text{ // text{
// font-size: 48rpx; // font-size: 48rpx;
// color:#FF0000; // color:#FF0000;

Loading…
Cancel
Save