panhui 4 سال پیش
والد
کامیت
c8406e71e5
7فایلهای تغییر یافته به همراه204 افزوده شده و 126 حذف شده
  1. 18 9
      src/components/level/Level.vue
  2. 5 0
      src/mixins/level.js
  3. 4 1
      src/styles/app.less
  4. 12 12
      src/views/Mine.vue
  5. 10 0
      src/views/Store.vue
  6. 130 102
      src/views/Submit.vue
  7. 25 2
      src/views/user/Level.vue

+ 18 - 9
src/components/level/Level.vue

@@ -30,13 +30,19 @@
     <div v-if="isLogin && !show && levelInfo.icon" ref="medal" class="medal-info" @click="$router.push('/mineLevel')">
         <div class="medal-icon">
             <van-image :src="levelInfo.icon" width="32" height="32" />
-            <div class="text1" :style="{ color: levelInfo.color }">{{ levelInfo.level }}</div>
+            <div class="text1" :style="{ color: levelInfo.color1 || levelInfo.color }">{{ levelInfo.level }}</div>
         </div>
         <div class="medal-text">
-            <div class="text1" :style="{ color: levelInfo.color, backgroundColor: levelInfo.color + '33' }">
+            <div
+                class="text1"
+                :style="{
+                    color: levelInfo.color1 || levelInfo.color,
+                    backgroundColor: (levelInfo.color1 || levelInfo.color) + '33'
+                }"
+            >
                 {{ levelInfo.title }}
             </div>
-            <div class="text2" :style="{ color: levelInfo.color }">
+            <div class="text2" :style="{ color: levelInfo.color1 || levelInfo.color }">
                 {{ levelInfo.realm }}
             </div>
         </div>
@@ -165,7 +171,7 @@ export default {
     right: 0;
     top: 150px;
     .flex();
-    padding: 2px 0 5px 10px;
+    padding: 2px 0 2px 10px;
     border-radius: 100px 0px 0px 100px;
     z-index: 20;
     background-color: #f5f7fa;
@@ -179,23 +185,26 @@ export default {
 
         .text1 {
             position: absolute;
-            left: 16px;
-            top: 13px;
+            left: 14px;
+            top: 10.6px;
             font-size: 12px;
-            transform: scale(0.6) translate(-50%, -2px);
+            transform: scale(0.8);
             line-height: 12px;
             font-weight: bold;
             text-align: center;
             display: block;
-            min-width: 18px;
+            min-width: 14px;
+            // min-height: 12px;
             text-align: center;
+            font-weight: bold;
+            letter-spacing: -1px;
         }
     }
     .medal-text {
         .flex-col();
         align-items: center;
         justify-content: center;
-        transform: scale(0.8) translateX(-2px);
+        transform: scale(0.83) translateX(-2px);
         .text1 {
             font-size: 12px;
             line-height: 16px;

+ 5 - 0
src/mixins/level.js

@@ -5,6 +5,7 @@ export default {
                 {
                     start: 0,
                     end: 9,
+                    color1: '#717171',
                     color: '#3B445D',
                     vicon: 'https://raex-meta.oss-cn-shenzhen.aliyuncs.com/medals/v.png',
                     icon: 'https://raex-meta.oss-cn-shenzhen.aliyuncs.com/medals/LV0-1-icon.png',
@@ -132,6 +133,10 @@ export default {
                 };
             });
 
+            if (this.setSwiper) {
+                this.setSwiper();
+            }
+
             if (this.isLogin) {
                 this.$http.get('/asset/breakdown').then(res => {
                     this.money = res.buy;

+ 4 - 1
src/styles/app.less

@@ -59,6 +59,9 @@ body {
     font-family: BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Segoe UI, Arial, Roboto, 'PingFang SC', miui,
         'Hiragino Sans GB', 'Microsoft Yahei', sans-serif;
 }
+body {
+    -webkit-text-size-adjust: none;
+}
 html,
 body,
 #app,
@@ -229,5 +232,5 @@ input:-webkit-autofill {
     z-index: 9999;
     object-fit: cover;
     opacity: 1;
-    transition: opacity .8s ease-in-out;
+    transition: opacity 0.8s ease-in-out;
 }

+ 12 - 12
src/views/Mine.vue

@@ -30,18 +30,6 @@
                                 alt=""
                                 class="renzhen-img"
                             />
-
-                            <van-button
-                                color="#F5F7FA"
-                                size="mini"
-                                :icon="require('@assets/renzheng_icon.png')"
-                                round
-                                class="auth"
-                                v-else
-                                @click="goAuth"
-                            >
-                                {{ authStatus === '未认证' ? '去认证' : authStatus }}
-                            </van-button>
                         </div>
                         <div class="text2">
                             <span> 用户ID:{{ userInfo.id }} </span>
@@ -67,6 +55,18 @@
                         <div class="text1">{{ userInfo.followers }}</div>
                     </div>
 
+                    <van-button
+                        color="#F5F7FA"
+                        size="mini"
+                        :icon="require('@assets/renzheng_icon.png')"
+                        round
+                        class="auth"
+                        @click="goAuth"
+                        v-if="authStatus !== '已认证'"
+                    >
+                        {{ authStatus === '未认证' ? '去认证' : authStatus }}
+                    </van-button>
+
                     <van-button class="edit" @click="$router.push('/setting')" color="#F5F7FA" size="mini" round
                         >编辑资料</van-button
                     >

+ 10 - 0
src/views/Store.vue

@@ -226,6 +226,16 @@ export default {
     activated() {
         this.$nextTick(() => {
             this.changeScroll(this.scrollTop);
+            if (window.cordova && StatusBar && StatusBar.isVisible) {
+                StatusBar.backgroundColorByHexString('#181818');
+                StatusBar.styleLightContent();
+            }
+
+            this.$nextTick(() => {
+                this.stiky = this.$refs.top.$el.childNodes[0];
+                this.$el.parentNode.childNodes[1].className =
+                    this.$el.parentNode.childNodes[1].className.replace(/ bgBack/, '') + ' bgBack';
+            });
         });
     },
     methods: {

+ 130 - 102
src/views/Submit.vue

@@ -112,7 +112,8 @@ export default {
             launchName: '',
             launchPath: '',
             createOrderTimer: null,
-            timerNum: 0
+            timerNum: 0,
+            weixinOptions: {}
         };
     },
     computed: {
@@ -352,113 +353,140 @@ export default {
                 });
         },
         pay() {
-            if (this.money) {
-                this.$toast.clear();
-                this.$router.replace({ query: { ...this.$route.query, orderId: this.orderId } });
-                this.$nextTick(() => {
-                    if (this.$store.state.review) {
-                        window.store.order('358');
-                        this.getOrder(true);
-                    } else if (this.payType === 'ALIPAY') {
-                        if (this.inWeixin) {
-                            document.location.replace(
-                                resolveUrl(this.$baseUrl, '/payOrder/alipay_wx?id=' + this.orderId)
-                            );
-                        } else {
-                            this.$http
-                                .get(`/payOrder/${this.inApp ? 'alipay_app' : 'alipay_h5'}?id=${this.orderId}`)
-                                .then(res => {
-                                    this.$toast.clear();
-                                    this.hrefUrl = 'alipays://platformapi/startapp?saId=10000007&qrcode=' + res;
-                                    // window.open(
-                                    //     'alipays://platformapi/startapp?saId=10000007&qrcode=' + res,
-                                    //     '_blank'
-                                    // );
-                                    this.$nextTick(() => {
-                                        document.getElementById('pay').click();
-                                    });
+            this.paySubmit().then(() => {
+                if (this.money) {
+                    this.$nextTick(() => {
+                        if (this.$store.state.review) {
+                            window.store.order('358');
+                            this.getOrder(true);
+                        } else if (this.payType === 'ALIPAY') {
+                            if (this.inWeixin) {
+                                document.location.replace(
+                                    resolveUrl(this.$baseUrl, '/payOrder/alipay_wx?id=' + this.orderId)
+                                );
+                            } else {
+                                this.$nextTick(() => {
+                                    document.getElementById('pay').click();
+                                });
 
-                                    this.$toast.loading({
-                                        message: '加载中...',
-                                        forbidClick: true
-                                    });
-                                    this.getOrder(true);
-                                })
-                                .catch(e => {
-                                    if (e.error) {
-                                        this.$toast(e.error);
+                                this.$toast.loading({
+                                    message: '加载中...',
+                                    forbidClick: true
+                                });
+                                this.getOrder(true);
+                            }
+                        } else if (this.payType === 'WEIXIN') {
+                            this.$toast.loading('加载中');
+                            if ('wx_pub' === this.payChannel) {
+                                wx.chooseWXPay({
+                                    ...this.weixinOptions,
+                                    success(res) {
+                                        this.$toast.success('支付成功');
+                                        setTimeout(() => {
+                                            this.$router.replace('/orders');
+                                        }, 1000);
+                                    },
+                                    fail(e) {
+                                        console.log(e);
+                                        this.$toast('支付失败,请稍后再试');
                                     }
                                 });
+                            } else {
+                                this.$toast.clear();
+                                this.$nextTick(() => {
+                                    document.getElementById('pay').click();
+                                });
+
+                                this.$toast.loading({
+                                    message: '加载中...',
+                                    forbidClick: true
+                                });
+                                this.getOrder(true);
+                            }
                         }
-                    } else if (this.payType === 'WEIXIN') {
-                        this.$toast.loading('加载中');
-                        this.$http
-                            .post('/payOrder/weixin', {
-                                id: this.orderId,
-                                channel: this.payChannel,
-                                openId: localStorage.getItem('openId') || 'oWJG55wLnwdVzXoKka1-DzQKOd_Y'
-                            })
-                            .then(res => {
-                                if ('wx_pub' === this.payChannel) {
-                                    console.log('wxPayParams', res);
-                                    wx.chooseWXPay({
-                                        ...res,
-                                        success(res) {
-                                            this.$toast.success('支付成功');
-                                            setTimeout(() => {
-                                                this.$router.replace('/orders');
-                                            }, 1000);
-                                        },
-                                        fail(e) {
-                                            console.log(e);
-                                            this.$toast('支付失败,请稍后再试');
+                    });
+                } else {
+                    this.$toast.success('支付成功');
+                    setTimeout(() => {
+                        this.$router.replace('/orderDetail?id=' + this.orderId);
+                    }, 1000);
+                }
+            });
+        },
+        paySubmit() {
+            return new Promise((resolve, reject) => {
+                if (this.money) {
+                    this.$toast.clear();
+                    this.$router.replace({ query: { ...this.$route.query, orderId: this.orderId } });
+                    this.$nextTick(() => {
+                        if (this.$store.state.review) {
+                            resolve();
+                        } else if (this.payType === 'ALIPAY') {
+                            if (this.inWeixin) {
+                                resolve();
+                            } else {
+                                this.$http
+                                    .get(`/payOrder/${this.inApp ? 'alipay_app' : 'alipay_h5'}?id=${this.orderId}`)
+                                    .then(res => {
+                                        this.$toast.clear();
+                                        this.hrefUrl = 'alipays://platformapi/startapp?saId=10000007&qrcode=' + res;
+                                        resolve();
+                                    })
+                                    .catch(e => {
+                                        if (e.error) {
+                                            this.$toast(e.error);
+                                            reject();
                                         }
                                     });
-                                } else {
-                                    this.$toast.clear();
-                                    this.hrefUrl = res.scheme_code;
-                                    this.$nextTick(() => {
-                                        document.getElementById('pay').click();
-                                    });
-
-                                    this.$toast.loading({
-                                        message: '加载中...',
-                                        forbidClick: true
-                                    });
-                                    this.getOrder(true);
-                                }
-                                // console.log({
-                                //     ...res,
-                                //     package: res.package || res.packageValue
-                                // });
-                                // let _this = this;
-                                // wx.chooseWXPay({
-                                //     ...res,
-                                //     package: res.package || res.packageValue,
-                                //     timestamp: res.timeStamp,
-                                //     success(res) {
-                                //         _this.$toast.success('支付成功');
-                                //         setTimeout(() => {
-                                //             _this.$router.replace('/orders');
-                                //         }, 1000);
-                                //     },
-                                //     fail(e) {
-                                //         console.log(e);
-                                //         _this.$toast('支付失败,请稍后再试');
-                                //     }
-                                // });
-                            })
-                            .catch(e => {
-                                this.$toast(e.error || '支付失败请稍后再试');
-                            });
-                    }
-                });
-            } else {
-                this.$toast.success('支付成功');
-                setTimeout(() => {
-                    this.$router.replace('/orderDetail?id=' + this.orderId);
-                }, 1000);
-            }
+                            }
+                        } else if (this.payType === 'WEIXIN') {
+                            this.$toast.loading('加载中');
+                            this.$http
+                                .post('/payOrder/weixin', {
+                                    id: this.orderId,
+                                    channel: this.payChannel,
+                                    openId: localStorage.getItem('openId') || 'oWJG55wLnwdVzXoKka1-DzQKOd_Y'
+                                })
+                                .then(res => {
+                                    if ('wx_pub' === this.payChannel) {
+                                        this.weixinOptions = res;
+                                        resolve();
+                                    } else {
+                                        this.$toast.clear();
+                                        this.hrefUrl = res.scheme_code;
+                                        resolve();
+                                    }
+                                    // console.log({
+                                    //     ...res,
+                                    //     package: res.package || res.packageValue
+                                    // });
+                                    // let _this = this;
+                                    // wx.chooseWXPay({
+                                    //     ...res,
+                                    //     package: res.package || res.packageValue,
+                                    //     timestamp: res.timeStamp,
+                                    //     success(res) {
+                                    //         _this.$toast.success('支付成功');
+                                    //         setTimeout(() => {
+                                    //             _this.$router.replace('/orders');
+                                    //         }, 1000);
+                                    //     },
+                                    //     fail(e) {
+                                    //         console.log(e);
+                                    //         _this.$toast('支付失败,请稍后再试');
+                                    //     }
+                                    // });
+                                })
+                                .catch(e => {
+                                    this.$toast(e.error || '支付失败请稍后再试');
+                                    reject();
+                                });
+                        }
+                    });
+                } else {
+                    resolve();
+                }
+            });
         },
         goCoupon() {
             if (!this.orderId) {

+ 25 - 2
src/views/user/Level.vue

@@ -12,7 +12,13 @@
             <div class="text2">10级以上(包含10级)将会获得勋章奖励,最高等级Lv99</div>
         </div>
 
-        <swiper slidesPerView="auto" :spaceBetween="16" class="box-swiper">
+        <swiper
+            :initialSlide="prevIndex"
+            :options="swiperOption"
+            slidesPerView="auto"
+            :spaceBetween="16"
+            class="box-swiper"
+        >
             <template v-for="(item, index) in medals" :key="index">
                 <swiper-slide
                     class="box"
@@ -65,9 +71,26 @@ import 'swiper/swiper.min.css';
 import 'swiper/swiper-bundle.min.css';
 import level from '../../mixins/level';
 import LevelCard from '../../components/level/LevelCard';
+import SwiperCore from 'swiper';
+
+// install Swiper modules
 export default {
     data() {
-        return {};
+        return {
+            swiperOption: {
+                on: {
+                    init: swiper => {
+                        console.log('28222');
+                        console.log(swiper);
+                    }
+                }
+            }
+        };
+    },
+    computed: {
+        prevIndex() {
+            return this.levelInfo.level ? Math.ceil(this.levelInfo.level / 10) : 0;
+        }
     },
     mixins: [level],
     components: {