فهرست منبع

Merge branch 'master' of http://git.izouma.com/xiongzhu/raex_front into 留言

panhui 3 سال پیش
والد
کامیت
3dfc1a07a0

+ 2 - 16
.prettierrc.js

@@ -3,19 +3,5 @@ module.exports = {
     singleQuote: true,
     tabWidth: 4,
     arrowParens: 'avoid',
-    trailingComma: 'none',
-    overrides: [
-        {
-            files: '*.html',
-            options: {
-                parser: 'html'
-            }
-        },
-        {
-            files: '*.vue',
-            options: {
-                parser: 'vue'
-            }
-        }
-    ]
-};
+    trailingComma: 'none'
+}

+ 1 - 0
package.json

@@ -45,6 +45,7 @@
         "vuex": "^4.0.0-0"
     },
     "devDependencies": {
+        "@volar-plugins/prettier": "^1.1.4",
         "@vue/cli-plugin-babel": "~4.5.0",
         "@vue/cli-plugin-eslint": "~4.5.0",
         "@vue/cli-plugin-router": "~4.5.0",

BIN
src/assets/icon_zhiding.png


+ 58 - 2
src/components/product/SaleInfo.vue

@@ -1,5 +1,5 @@
 <template>
-    <div class="sale-box">
+    <div class="sale-box" v-if="totalElements > 0">
         <div class="sale-info">
             <div class="text1">当前寄售最低价格</div>
             <div class="text2">
@@ -81,8 +81,14 @@ export default {
             }
         },
         search() {
+            if (this.info.prefixName) {
+                return this.info.prefixName;
+            }
             if (this.info.type === 'BLIND_BOX') {
-                return this.blindBoxItems.length > 0 ? this.blindBoxItems[0].name.split('#')[0] : '';
+                let name = this.blindBoxItems.length > 0 ? this.blindBoxItems[0].name.split('#')[0] : '';
+                name = name.replace(/:/, '·');
+                name = name.replace(/:/, '·');
+                return name.split('·')[0];
             }
             return this.info.name;
         }
@@ -110,6 +116,56 @@ export default {
             } else {
                 return '';
             }
+        },
+        getData(isFirst = false, scrollTop = 0) {
+            if (isFirst) {
+                this.page = 0;
+                this.list = [];
+                this.$root.$el.scrollTop = scrollTop;
+            }
+
+            this.loading = true;
+            this.finished = false;
+            this.empty = false;
+            let data = { page: this.page, size: 20, sort: 'createdAt,desc' };
+            if (this.beforeData) {
+                data = {
+                    ...data,
+                    ...this.beforeData()
+                };
+            }
+
+            if (this.httpType === 'get') {
+                return this.$http.get(this.url, data, { body: 'json' }).then(res => {
+                    if (res.first) {
+                        this.list = [];
+                    }
+                    this.list = [...this.list, ...res.content];
+                    this.empty = res.empty;
+                    this.loading = false;
+                    this.finished = res.last;
+                    if (!this.finished) {
+                        this.page = this.page + 1;
+                    }
+                    this.totalElements = Number(res.totalElements);
+                    return Promise.resolve(Number(res.totalElements));
+                });
+            } else {
+                return this.$http.post(this.url, data, { body: 'json' }).then(res => {
+                    if (res.first) {
+                        this.list = [];
+                    }
+                    this.list = [...this.list, ...res.content];
+                    this.empty = res.empty;
+                    this.loading = false;
+                    this.finished = res.last;
+                    if (!this.finished) {
+                        this.page = this.page + 1;
+                    }
+                    this.totalElements = Number(res.totalElements);
+                    return Promise.resolve(Number(res.totalElements));
+                });
+            }
         }
     }
 };

+ 1 - 3
src/router/index.js

@@ -369,8 +369,7 @@ const routes = [
         component: () => import('../views/product/HopeMarket.vue'),
         meta: {
             pageType: Page.Every,
-            tabColor: '#222426',
-            title: '二手市场'
+            tabColor: '#222426'
         }
     },
     {
@@ -421,7 +420,6 @@ const routes = [
         component: () => import('../views/asset/Detail.vue'),
         meta: {
             pageType: Page.Every,
-
             tabColor: '#181818'
         }
     },

+ 51 - 24
src/views/Discover.vue

@@ -107,22 +107,26 @@
             </van-grid-item> -->
         </van-grid>
 
-        <div class="box">
-            <van-tabs
-                v-model:active="sort"
-                shrink
-                line-width="16"
-                :before-change="beforeChange"
-                line-height="2"
-                @change="getList(true)"
-            >
-                <van-tab
-                    v-for="(item, index) in selectOptions"
-                    :key="index"
-                    :title="item.label"
-                    :name="item.value"
-                ></van-tab>
-            </van-tabs>
+        <div class="box" ref="box">
+            <van-sticky :offset-top="50">
+                <van-tabs
+                    class="box-tabs"
+                    v-model:active="sort"
+                    shrink
+                    line-width="16"
+                    :before-change="beforeChange"
+                    line-height="2"
+                    @change="getList(true)"
+                >
+                    <van-tab
+                        v-for="(item, index) in selectOptions"
+                        :key="index"
+                        :title="item.label"
+                        :name="item.value"
+                    ></van-tab>
+                </van-tabs>
+            </van-sticky>
+
             <van-list
                 style="padding-bottom: 100px"
                 class="box-list"
@@ -141,6 +145,7 @@
         </div>
 
         <div class="tabbar-placeholder"></div>
+        <img src="../assets/icon_zhiding.png" @click="goTop" class="goTop" v-if="bodyScroll.value > 100" alt="" />
     </van-pull-refresh>
 </template>
 
@@ -154,7 +159,7 @@ import ShowInfo from '../components/asset/showInfo.vue';
 
 export default {
     name: 'discover',
-    inject: ['bar', 'setKeeps', 'scrollWrapper', 'changeScroll'],
+    inject: ['bar', 'setKeeps', 'scrollWrapper', 'changeScroll', 'bodyScroll'],
     mixins: [banner, product],
     components: {
         ProductInfo,
@@ -203,7 +208,7 @@ export default {
         this.getInit();
 
         if (window.cordova && StatusBar && StatusBar.isVisible) {
-            StatusBar.backgroundColorByHexString('#222426');
+            StatusBar.backgroundColorByHexString('#272b2e');
             StatusBar.styleLightContent();
         }
     },
@@ -281,6 +286,7 @@ export default {
             if (isFirst) {
                 this.page = 0;
                 this.list = [];
+                this.changeScroll(this.$refs.box.offsetTop - 50);
             }
             this.loading = true;
             this.finished = false;
@@ -356,6 +362,9 @@ export default {
                 this.isLoading = false;
             });
         },
+        goTop() {
+            this.changeScroll(0, true);
+        },
         goHall() {
             this.$http
                 .get('/sysConfig/get/hall_show')
@@ -375,6 +384,10 @@ export default {
         this.$nextTick(() => {
             this.changeScroll(this.scrollTop);
         });
+        if (window.cordova && StatusBar && StatusBar.isVisible) {
+            StatusBar.backgroundColorByHexString('#272b2e');
+            StatusBar.styleLightContent();
+        }
     },
     beforeRouteLeave(to, from, next) {
         if (!to.meta.menuPage || to.path === '/hall') {
@@ -393,7 +406,7 @@ export default {
 .top {
     display: flex;
     padding: 9px 16px;
-    background-color: #222426;
+    background-color: #272b2e;
     display: flex;
     align-items: center;
     .logo {
@@ -502,7 +515,7 @@ export default {
         }
     }
     .menu-left + .menu-right {
-        margin-left: 16px;
+        margin-left: 12px;
     }
     .menu-left {
         align-self: stretch;
@@ -579,6 +592,7 @@ export default {
             border-radius: 12px;
         }
     }
+    min-height: 100vh;
 }
 
 /deep/.van-tabs__nav--line.van-tabs__nav--complete {
@@ -597,14 +611,27 @@ export default {
         color: @prim;
     }
 }
-.box {
-    border-top: 5px solid #373b3e;
-}
 .casting {
     padding-bottom: 10px;
 }
-
+.van-tabs {
+    border-top: 2px solid #373b3e;
+}
 /deep/.van-tab {
     margin-right: 0;
 }
+
+/deep/.van-sticky--fixed {
+    background-color: #272b2e;
+}
+.goTop {
+    position: fixed;
+    right: 16px;
+    bottom: 70px;
+    bottom: calc(env(safe-area-inset-bottom) + 70px);
+    width: 44px;
+    height: 44px;
+    display: block;
+    z-index: 20;
+}
 </style>

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

@@ -44,9 +44,7 @@
             </div>
 
             <div class="button">
-                <!-- <van-button plain class="forget" @click="$router.replace('/forget')">
-          忘记密码?
-        </van-button> -->
+                <!-- <van-button plain class="forget" v-if="$store.state.review" @click="getSim"> 获取手机号码 </van-button> -->
 
                 <van-button block native-type="submit" color="#26F50D" class="sure">现在出发!</van-button>
                 <van-button class="del" block plain @click="$router.replace('/register')"
@@ -201,6 +199,24 @@ export default {
                         return this.$store.dispatch('getUserInfo');
                     });
             }
+        },
+        getSim() {
+            // window.plugins.sim.requestReadPermission(
+            //     function (res) {
+            //         console.log(res);
+            //     },
+            //     function () {
+            //         alert('error');
+            //     }
+            // );
+            window.plugins.sim.getSimInfo(
+                function (res) {
+                    console.log(res);
+                },
+                function () {
+                    alert('error');
+                }
+            );
         }
     },
     watch: {

+ 31 - 27
src/views/creator/Detail.vue

@@ -50,6 +50,10 @@
                             <img @click="copy" src="@assets/svgs/copy_icon.svg" alt="" /> 
                         </div>-->
                     </div>
+                    <div class="collect">
+                        <div class="text1">{{ info.followers }}</div>
+                        <div class="text2">粉丝</div>
+                    </div>
                 </div>
 
                 <div class="sub" :class="{ 'van-multi-ellipsis--l2': !showMore }">
@@ -64,11 +68,7 @@
                         <div class="text1">{{ info.follows }}</div>
                         <div class="text2">关注</div>
                     </div> -->
-                    <div class="collect">
-                        <div class="text1">{{ info.followers }}</div>
-                        <div class="text2">粉丝</div>
-                    </div>
-                    <div class="flex1"></div>
+
                     <van-button
                         class="follow"
                         @click="follow"
@@ -435,13 +435,15 @@ export default {
     .sub {
         font-size: 12px;
         color: @text3;
-        line-height: 22px;
+        line-height: 17px;
         padding: 6px 0 0;
+        text-align: center;
     }
 
     .sub-right {
         .flex();
-        justify-content: flex-end;
+        justify-content: center;
+        margin-top: 3px;
     }
 
     .sub-right > div {
@@ -457,25 +459,7 @@ export default {
         align-items: center;
         // transform: translateY(14px);
         padding: 10px 0 17px;
-        .collect {
-            width: 20%;
-            display: flex;
-            flex-direction: row-reverse;
-            align-items: center;
-            justify-content: flex-end;
-            .text1 {
-                font-size: @font2;
-                color: @text0;
-                line-height: 24px;
-                margin-left: 6px;
-            }
-            .text2 {
-                font-size: @font2;
-                color: @text3;
-                line-height: 24px;
-                white-space: nowrap;
-            }
-        }
+        justify-content: center;
 
         /deep/.van-button {
             width: 70px;
@@ -563,12 +547,32 @@ export default {
             }
         }
     }
+
+    .collect {
+        display: flex;
+        flex-direction: row-reverse;
+        align-items: center;
+        justify-content: flex-end;
+        margin-top: 4px;
+        .text1 {
+            font-size: @font2;
+            color: @text0;
+            line-height: 24px;
+            margin-left: 6px;
+        }
+        .text2 {
+            font-size: @font2;
+            color: @text0;
+            line-height: 24px;
+            white-space: nowrap;
+        }
+    }
 }
 .menu {
     display: flex;
     height: 50px;
     align-items: center;
-    padding: 0 16px;
+    padding: 12px 16px 0;
     // border-bottom: 1px solid #202122;
     background-color: @bg;
     .menu-item {

+ 19 - 13
src/views/product/Detail.vue

@@ -251,7 +251,7 @@
             </div>
         </div>
 
-        <div class="btn van-safe-area-bottom" ref="btn" v-if="canSale">
+        <div class="btn van-safe-area-bottom" ref="btn" v-if="canSale && totalSales > 0">
             <div class="btn-list btn-only">
                 <van-button type="primary" @click="showSale" block round>我想要</van-button>
             </div>
@@ -394,7 +394,7 @@ export default {
     mixins: [product, coupon],
     name: 'productDetail',
     watch: {
-        $route() {
+        '$route.params'() {
             this.getInit();
         }
     },
@@ -416,7 +416,8 @@ export default {
             noPay: false,
             collectionId: 0,
             createrId: 0,
-            type: ''
+            type: '',
+            totalSales: 0
         };
     },
     computed: {
@@ -437,7 +438,7 @@ export default {
             });
         },
         canSale() {
-            return (this.isSolded || !this.info.onShelf || !this.info.salable) && this.type === 'creator';
+            return this.isSolded;
         }
     },
     mounted() {
@@ -602,21 +603,26 @@ export default {
                     }
                     this.$nextTick(() => {
                         if (this.canSale) {
-                            this.$refs.sale.getData(true);
+                            this.$refs.sale.getData(true).then(num => {
+                                this.totalSales = num;
+                                console.log(num);
+                            });
                         }
                     });
                 })
                 .catch(e => {
                     this.$toast.clear();
                     if (e && e.error) {
-                        this.$dialog
-                            .alert({
-                                title: '提示',
-                                message: e.error
-                            })
-                            .then(res => {
-                                this.$router.back();
-                            });
+                        if (this.$route.name == 'productDetail') {
+                            this.$dialog
+                                .alert({
+                                    title: '提示',
+                                    message: e.error
+                                })
+                                .then(res => {
+                                    this.$router.back();
+                                });
+                        }
                     }
                 });
         },

+ 1 - 0
src/views/product/NewsList.vue

@@ -29,6 +29,7 @@ export default {
                 query: {
                     onShelf: true,
                     del: false
+                    // display: true
                 }
             };
         }

+ 14 - 0
volar.config.js

@@ -0,0 +1,14 @@
+/** @type {import('@volar-plugins/prettier')} */
+const { volarPrettierPlugin } = require('@volar-plugins/prettier');
+
+module.exports = {
+    plugins: [
+        volarPrettierPlugin({
+            languages: ['html', 'css', 'scss', 'typescript', 'javascript'],
+            html: {
+                breakContentsFromTags: true
+            },
+            useVscodeIndentation: true
+        })
+    ]
+};

+ 18 - 0
yarn.lock

@@ -1318,6 +1318,14 @@
   resolved "https://registry.npmmirror.com/@vant/use/-/use-1.3.5.tgz#fd2817850e76e3098e29d4c8d864e19207c03ab1"
   integrity sha512-S4rfMQT+71quUbSY9sF7vJTEADVWqHxn8zUbpEl4vzI2CCJx67ri/ZHV911LpXIaZVgSSGPLE5xLV8javmbU0Q==
 
+"@volar-plugins/prettier@^1.1.4":
+  version "1.1.4"
+  resolved "https://registry.npmmirror.com/@volar-plugins/prettier/-/prettier-1.1.4.tgz#9b623067640b5b89d91373d6be3b14f57c98630c"
+  integrity sha512-Gz6aD5Sjo8+j7xGDooxkKJGwMqzqF3PhITo+hrUIuVzMjJNyvYreuT2chHxXGe903/wojf4c3T3xVsxmsfaCBg==
+  dependencies:
+    prettier "^2.6.2"
+    vscode-uri "^3.0.3"
+
 "@vue/babel-helper-vue-jsx-merge-props@^1.2.1":
   version "1.2.1"
   resolved "https://registry.npmmirror.com/@vue/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-1.2.1.tgz#31624a7a505fb14da1d58023725a4c5f270e6a81"
@@ -7545,6 +7553,11 @@ prettier-linter-helpers@^1.0.0:
   resolved "https://registry.npmmirror.com/prettier/-/prettier-2.5.1.tgz#fff75fa9d519c54cf0fce328c1017d94546bc56a"
   integrity sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==
 
+prettier@^2.6.2:
+  version "2.6.2"
+  resolved "https://registry.npmmirror.com/prettier/-/prettier-2.6.2.tgz#e26d71a18a74c3d0f0597f55f01fb6c06c206032"
+  integrity sha512-PkUpF+qoXTqhOeWL9fu7As8LXsIUZ1WYaJiY/a7McAQzxjk82OF0tibkFXVCDImZtWxbvojFjerkiLb0/q8mew==
+
 pretty-error@^2.0.2:
   version "2.1.2"
   resolved "https://registry.npmmirror.com/pretty-error/-/pretty-error-2.1.2.tgz#be89f82d81b1c86ec8fdfbc385045882727f93b6"
@@ -9435,6 +9448,11 @@ vm2@^3.9.3:
     acorn "^8.7.0"
     acorn-walk "^8.2.0"
 
+vscode-uri@^3.0.3:
+  version "3.0.3"
+  resolved "https://registry.npmmirror.com/vscode-uri/-/vscode-uri-3.0.3.tgz#a95c1ce2e6f41b7549f86279d19f47951e4f4d84"
+  integrity sha512-EcswR2S8bpR7fD0YPeS7r2xXExrScVMxg4MedACaWHEtx9ftCF/qHG1xGkolzTPcEmjTavCQgbVzHUIdTMzFGA==
+
 vue-cli-plugin-style-resources-loader@^0.1.5:
   version "0.1.5"
   resolved "https://registry.npmmirror.com/vue-cli-plugin-style-resources-loader/-/vue-cli-plugin-style-resources-loader-0.1.5.tgz#3e95f4df41f5408e1255664690698c0533648109"