Przeglądaj źródła

未登录检查

panhui 4 lat temu
rodzic
commit
c770ab484c

+ 1 - 1
src/components/CardCase.vue

@@ -145,7 +145,7 @@ export default {
 <style lang="less" scoped>
 /deep/ .van-cell {
     --cell-horizontal-padding: 0px;
-    --cell-vertical-padding: 22px;
+    --cell-vertical-padding: 20px;
 
     .van-cell__title {
         font-size: 16px;

+ 19 - 15
src/mixins/collection.js

@@ -9,21 +9,25 @@ export default {
     },
     methods: {
         collect() {
-            let data = {};
-            if (this.isCollection) {
-                data.cartId = this.cartId;
-            } else {
-                data.caseId = this.caseId;
-            }
-            this.animate = true;
-            setTimeout(() => {
-                this.animate = false;
-            }, 1000);
-            return this.$http.post(this.isCollection ? '/cart/remove' : '/cart/add', data).then(res => {
-                this.toast(this.isCollection ? '取消成功' : '关注成功', 'success');
-                this.checkCollect();
-                return Promise.resolve();
-            });
+            return this.checkLogin()
+                .then(() => {
+                    let data = {};
+                    if (this.isCollection) {
+                        data.cartId = this.cartId;
+                    } else {
+                        data.caseId = this.caseId;
+                    }
+                    this.animate = true;
+                    setTimeout(() => {
+                        this.animate = false;
+                    }, 1000);
+                    return this.$http.post(this.isCollection ? '/cart/remove' : '/cart/add', data);
+                })
+                .then(res => {
+                    this.toast(this.isCollection ? '取消成功' : '关注成功', 'success');
+                    this.checkCollect();
+                    return Promise.resolve();
+                });
         },
         checkCollect() {
             this.$http

+ 27 - 7
src/mixins/common.js

@@ -11,20 +11,37 @@ export default {
             }
         }
     },
+    computed: {
+        isLogin() {
+            return !!this.$store.state.userInfo;
+        }
+    },
     methods: {
         navigateTo(url, checkLogin = true) {
-            if (checkLogin && !this.$store.state.userInfo) {
-                wx.navigateTo({
-                    url: '/pages/authorized'
+            if (checkLogin) {
+                this.checkLogin().then(() => {
+                    if (url) {
+                        wx.navigateTo({
+                            url: url
+                        });
+                    }
                 });
-                return;
+            } else {
+                if (url) {
+                    wx.navigateTo({
+                        url: url
+                    });
+                }
             }
-
-            if (url) {
+        },
+        checkLogin() {
+            if (!this.isLogin) {
                 wx.navigateTo({
-                    url: url
+                    url: '/pages/authorized'
                 });
+                return Promise.reject('未登录');
             }
+            return Promise.resolve();
         },
         navigateBack(num = 1) {
             wx.navigateBack({
@@ -100,6 +117,9 @@ export default {
         },
         hideLoading() {
             wx.hideLoading();
+        },
+        wait() {
+            this.toast('敬请期待');
         }
     }
 };

+ 25 - 16
src/pages/details.vue

@@ -46,7 +46,7 @@
                         <span>浙江 杭州</span>
                     </div>
                 </div>
-                <div class="logo-btn">进入店铺</div>
+                <div class="logo-btn" @click="wait">进入店铺</div>
             </div>
         </div>
         <h3>拼箱详情</h3>
@@ -125,8 +125,9 @@ export default {
     },
     methods: {
         details() {
-            this.$http.get('/cardCase/showInfoMA?caseId=' + this.$mp.query.id).then(res => {
-                console.log(res);
+            this.showLoading();
+            this.$http.get('/cardCase/showInfoMA?caseId=' + this.$mp.options.id).then(res => {
+                this.hideLoading();
                 this.detailsList = res.groupBoxMap;
                 this.cardCaseInfo = res.cardCaseInfo || {};
             });
@@ -146,11 +147,13 @@ export default {
             );
         },
         loginMethods() {
-            this.caseId = this.$mp.options.id;
-            this.checkCollect();
+            if (this.isLogin) {
+                this.caseId = this.$mp.options.id;
+                this.checkCollect();
+            }
         }
     },
-    created() {
+    onLoad() {
         this.details();
     }
 };
@@ -167,6 +170,7 @@ export default {
         color: #ffffff;
     }
     padding: 15px 20px 150px 20px;
+    .bottom(150px);
     img {
         width: 335px;
         height: 335px;
@@ -225,14 +229,13 @@ export default {
         .box-con-left {
             width: 160px;
             height: 80px;
-            background: #ff6c00;
+            background: #ff6c0020;
             border-radius: 8px;
-            opacity: 0.5;
             p {
                 height: 22px;
                 font-size: 13px;
                 font-weight: 400;
-                color: #000;
+                color: #00000040;
                 line-height: 22px;
                 text-align: center;
                 margin-top: 15px;
@@ -240,24 +243,30 @@ export default {
             .val {
                 height: 26px;
                 font-size: 16px;
-                font-weight: 500;
-                color: #000000;
+                font-weight: bold;
+                color: @prim;
                 line-height: 26px;
                 text-align: center;
                 display: inherit;
+
+                /deep/ .van-count-down {
+                    --count-down-text-color: @prim;
+                    --count-down-font-size: 16px;
+                    --count-down-line-height: 26px;
+                    font-weight: bold;
+                }
             }
         }
         .box-con-right {
             width: 160px;
             height: 80px;
-            background: #ff6c00;
+            background: #ff6c0020;
             border-radius: 8px;
-            opacity: 0.5;
             p {
                 height: 22px;
                 font-size: 13px;
                 font-weight: 400;
-                color: #000;
+                color: #00000040;
                 line-height: 22px;
                 text-align: center;
                 margin-top: 15px;
@@ -265,8 +274,8 @@ export default {
             span {
                 height: 26px;
                 font-size: 16px;
-                font-weight: 500;
-                color: #000000;
+                font-weight: bold;
+                color: @prim;
                 line-height: 26px;
                 text-align: center;
                 display: inherit;

+ 4 - 3
src/pages/mine.vue

@@ -34,6 +34,7 @@
                 height="86"
                 src="/native/imgs/info_img_renzhengdianjia.png"
                 fit="contain"
+                @click="wait"
             />
         </div>
 
@@ -50,13 +51,13 @@
         </van-grid>
 
         <van-grid class="menu menu-l" column-num="3" :border="false" clickable>
-            <van-grid-item text="我的钱包" url="/pages/wallet">
+            <van-grid-item text="我的钱包" @click="navigateTo('/pages/wallet')">
                 <img class="gird-icon" src="/native/svgs/info_icon_qianbao.svg" slot="icon" alt="" />
             </van-grid-item>
-            <van-grid-item text="我的关注" url="/pages/mineFollow">
+            <van-grid-item text="我的关注" @click="navigateTo('/pages/mineFollow')">
                 <img class="gird-icon" src="/native/svgs/info_icon_guanzu.svg" slot="icon" alt="" />
             </van-grid-item>
-            <van-grid-item text="个人设置" url="/pages/setting">
+            <van-grid-item text="个人设置" @click="navigateTo('/pages/setting')">
                 <img class="gird-icon" src="/native/svgs/info_icon_shezhi.svg" slot="icon" alt="" />
             </van-grid-item>
             <van-grid-item text="常见问题" url="/pages/questions">

+ 4 - 6
src/pages/news.vue

@@ -6,13 +6,11 @@
 </config>
 <template>
     <div>
-        <news-info></news-info>
+        <!-- <news-info></news-info>
         <news-info :dot="1"></news-info>
-        <news-info></news-info>
+        <news-info></news-info> -->
 
-        <van-empty image="/native/imgs/kong_png_xiaoxiliebiao.png" description="你还没有任何消息哦~">
-            <van-button type="primary" block>去逛逛</van-button>
-        </van-empty>
+        <van-empty image="/native/imgs/kong_png_xiaoxiliebiao.png" description="你还没有任何消息哦~"> </van-empty>
     </div>
 </template>
 
@@ -21,7 +19,7 @@ import NewsInfo from '../components/NewsInfo.vue';
 export default {
     name: 'News',
     components: {
-        NewsInfo
+        // NewsInfo
     },
     data() {
         return {};

+ 5 - 5
src/styles/common.less

@@ -7,7 +7,7 @@
 @text2: #606266;
 @text3: #939599;
 @text4: #c6c8cc;
-@border1: #F5F7FA;
+@border1: #f5f7fa;
 @border2: #f2f3f5;
 @border3: #dfe1e6;
 @border4: #f2f6fc;
@@ -37,10 +37,10 @@
     overflow: hidden;
 }
 
-.bottom() {
-    padding-bottom: 0;
-    padding-bottom: constant(safe-area-inset-bottom); // 兼容 IOS<11.2
-    padding-bottom: env(safe-area-inset-bottom); // 兼容 IOS>=11.2
+.bottom( @bottom:0.5px ) {
+    padding-bottom: @bottom;
+    padding-bottom: calc(@bottom + constant(safe-area-inset-bottom)); // 兼容 IOS<11.2
+    padding-bottom: calc(@bottom + env(safe-area-inset-bottom)); // 兼容 IOS>=11.2
 }
 
 @keyframes iconAnimate {