Răsfoiți Sursa

登录按钮&下拉刷新

panhui 3 ani în urmă
părinte
comite
d18b96bb77
5 a modificat fișierele cu 47 adăugiri și 24 ștergeri
  1. BIN
      src/assets/checked.png
  2. BIN
      src/assets/checked1.png
  3. 9 7
      src/views/Home.vue
  4. 23 14
      src/views/Store.vue
  5. 15 3
      src/views/account/Login.vue

BIN
src/assets/checked.png


BIN
src/assets/checked1.png


+ 9 - 7
src/views/Home.vue

@@ -170,7 +170,7 @@ export default {
             reserve: false,
             saleList: [],
             scheduledStatus: [],
-            scrollTop: 0,
+            scrollTop: 0
         };
     },
     mixins: [product, banner, common],
@@ -200,14 +200,16 @@ export default {
     },
     methods: {
         // 获取藏品列表
-        getList() {
+        getList(loading = true) {
             if (this.page === 0) {
                 this.shopList = [];
             }
-            this.$toast.loading({
-                message: '加载中...',
-                forbidClick: true
-            });
+            if (loading) {
+                this.$toast.loading({
+                    message: '加载中...',
+                    forbidClick: true
+                });
+            }
             this.loading = true;
             this.$http.get('/collection/recommend').then(res => {
                 this.shopList = res.filter(item => {
@@ -256,7 +258,7 @@ export default {
             this.$http.post('user/my').then(res => {});
         },
         onRefresh() {
-            Promise.all([this.getBanner(), this.getList()]).then(res => {
+            Promise.all([this.getBanner(false), this.getList(false)]).then(res => {
                 this.isLoading = false;
             });
         },

+ 23 - 14
src/views/Store.vue

@@ -80,14 +80,14 @@
             </van-sticky>
             <div class="data_display" v-if="active === 0">
                 <!-- 藏品展示 -->
-                <van-list v-model:loading="loading" :finished="finished" @load="getAllCollections">
+                <van-list v-model:loading="loading" :loading-text="' '" :finished="finished" @load="getAllCollections">
                     <div class="data_display_fanter">
                         <template v-for="(item, index) in collections" :key="index">
                             <asset-info :info="item"></asset-info>
                         </template>
                     </div>
                     <van-empty
-                        v-if="collections.length === 0 && !loading"
+                        v-if="empty && !loading"
                         :image="require(`@assets/empty-collection.png`)"
                         :image-size="`172`"
                     >
@@ -182,16 +182,18 @@ export default {
             this.active = 1;
             this.init();
         },
-        init() {
+        init(loading = true) {
             if (!this.isLogin) {
                 this.empty = true;
                 this.loading = false;
                 return Promise.resolve();
             }
-            this.$toast.loading({
-                message: '加载中...',
-                forbidClick: true
-            });
+            if (loading) {
+                this.$toast.loading({
+                    message: '加载中...',
+                    forbidClick: true
+                });
+            }
             this.empty = false;
             this.$http.get('/collection/myLikes').then(res => {
                 this.list = res;
@@ -203,7 +205,7 @@ export default {
             this.$root.$el.scrollTop = 0;
         },
         // 获取全部库存藏品
-        getAllCollections() {
+        getAllCollections(loading = true) {
             if (!this.isLogin) {
                 this.empty = true;
                 this.loading = false;
@@ -212,6 +214,7 @@ export default {
             if (this.page === 0) {
                 this.collections = [];
             }
+            this.loading = true;
             this.finished = false;
             this.empty = false;
             let form = {
@@ -223,10 +226,14 @@ export default {
                     ...this.beforeQuery()
                 }
             };
-            this.$toast.loading({
-                message: '加载中...',
-                forbidClick: true
-            });
+            console.log(loading);
+            if (loading) {
+                this.$toast.loading({
+                    message: '加载中...',
+                    forbidClick: true
+                });
+            }
+
             return this.$http.post('/asset/all', form, { body: 'json' }).then(res => {
                 if (res.first) {
                     this.collections = [];
@@ -276,13 +283,14 @@ export default {
             return form;
         },
         onRefresh() {
+            this.isLoading = true;
             if (this.active === 0) {
                 this.page = 0;
-                this.getAllCollections().then(() => {
+                this.getAllCollections(false).then(() => {
                     this.isLoading = false;
                 });
             } else {
-                Promise.all([this.init()]).then(res => {
+                Promise.all([this.init(false)]).then(res => {
                     this.isLoading = false;
                 });
             }
@@ -401,6 +409,7 @@ export default {
         padding: 0px 15px 16px;
         box-sizing: border-box;
         // background: #0F0F27;
+        min-height: calc(100vh - 100px);
         .data_display_fanter {
             width: 100%;
             display: flex;

+ 15 - 3
src/views/account/Login.vue

@@ -51,6 +51,10 @@
                         <span class="xieyi_con">已阅读并同意</span>
                         <span @click.stop="$router.push('/agreement?page=service')"> 《服务协议》 </span>
                         <span @click.stop="$router.push('/agreement')"> 《用户隐私协议》 </span>
+
+                        <template #icon="props">
+                            <img class="img-icon" :src="props.checked ? activeIcon : inactiveIcon" />
+                        </template>
                     </van-checkbox>
                 </div>
                 <!-- <van-button plain class="forget" @click="$router.replace('/forget')">
@@ -84,6 +88,7 @@
 </template>
 
 <script>
+import { re } from 'mathjs';
 import phone from '../../mixins/phone';
 let fromRoute = null;
 export default {
@@ -98,7 +103,9 @@ export default {
                 code: ''
             },
             checked: localStorage.getItem('agreeTerm') === 'true',
-            protocol: false
+            protocol: false,
+            activeIcon: require('@assets/checked.png'),
+            inactiveIcon: require('@assets/checked1.png')
         };
     },
     computed: {
@@ -423,8 +430,8 @@ export default {
     // height: 14px;
 }
 /deep/ .van-checkbox__icon--round {
-    padding-top: 3px;
-    box-sizing: border-box;
+    // padding-top: 3px;
+    // box-sizing: border-box;
 }
 /deep/ .van-icon-success {
     // width: 14px;
@@ -438,4 +445,9 @@ export default {
 //     width: 14px;
 //     height: 14px;
 // }
+
+.img-icon{
+    width: 14px;
+    height: 14px;
+}
 </style>