浏览代码

add loading on button on presentReg and securityVer

StephenArk30 6 年之前
父节点
当前提交
40d66657c3

+ 15 - 2
sourcecode/h5app/vue/src/views/PresentRegister.vue

@@ -51,7 +51,13 @@
 
             <div style="margin-bottom: 10px">
                 <add-photo :photoURL="imgUrl" @onRead="onRead"/>
-                <van-button type="primary" class="submit_button" @click="publishPresent">下一步</van-button>
+                <van-button
+                        type="primary"
+                        class="submit_button"
+                        @click="publishPresent"
+                        :loading="loading"
+                >下一步
+                </van-button>
             </div>
         </div>
 
@@ -99,21 +105,26 @@
                 tag: 0,
                 photo: null,
                 nobr: "float: left; margin-right: 5px",
-                br: ""
+                br: "",
+                loading: false
             }
         },
         methods: {
             publishPresent() {
+                this.loading = true;
                 // 检验输入
                 if (this.presentName.length === 0) {
                     this.pnError = true;
+                    this.loading = false;
                     return;
                 } else if (this.desc.length <= 15) {
                     this.descError = true;
                     Toast.fail('请输入至少15个字的礼物介绍');
+                    this.loading = false;
                     return;
                 } else if (this.photo === null) {
                     Toast.fail('请上传礼物照片');
+                    this.loading = false;
                     return;
                 }
                 // 上传礼物信息
@@ -160,10 +171,12 @@
                                 that.$router.push('index');
                             } else {
                                 Toast.fail("上传失败,请检查网络");
+                                that.loading = false;
                             }
                         }, present);
                     } else {
                         Toast.fail('上传图片失败,请检查网络');
+                        that.loading = false;
                     }
                 }, formData);
 

+ 20 - 3
sourcecode/h5app/vue/src/views/SecurityVerify.vue

@@ -68,7 +68,13 @@
             <p>上传校卡照片</p>
             <div style="margin-bottom: 10px">
                 <add-photo @onRead="onRead"/>
-                <van-button class="submit_button" type="primary" @click="next">下一步</van-button>
+                <van-button
+                        class="submit_button"
+                        type="primary"
+                        @click="next"
+                        :loading="loading"
+                >下一步
+                </van-button>
             </div>
             <p>活动仅允许深大学生参与,请上传正面校卡照片审核~</p>
         </div>
@@ -119,27 +125,34 @@
                     {id: 2, name: '南区'},
                     {id: 3, name: '西丽'}
                 ],
-                photo: null
+                photo: null,
+                loading: false
             };
         },
         methods: {
             next() {
+                this.loading = true;
                 // 检查输入
                 if (this.phone.length !== 11) {
                     this.phoneError = true;
+                    this.loading = false;
                     return;
                 } else if (this.username.length < 1) {
                     this.usernameError = true;
+                    this.loading = false;
                     return;
                 } else if (this.wechat.length < 6) {
                     this.wechatError = true;
                     Toast.fail('请输入正确格式的微信号');
+                    this.loading = false;
                     return;
                 } else if (this.dorId === -1) {
                     Toast.fail('请选择宿舍区');
+                    this.loading = false;
                     return;
                 } else if (this.photo === null) {
                     Toast.fail('请上传校卡正面照片');
+                    this.loading = false;
                     return;
                 }
 
@@ -187,19 +200,23 @@
                                                 Toast.success("注册成功");
                                                 that.$router.push('presentRegister');
                                             } else {
-                                                Toast.fail('注册失败')
+                                                Toast.fail('注册失败');
+                                                that.loading = false;
                                             }
                                         }, [user]);
                                     } else {
                                         Toast.fail('获取用户信息失败');
+                                        that.loading = false;
                                     }
                                 }, {});
                             } else {
                                 Toast.fail("注册失败,请检查网络");
+                                that.loading = false;
                             }
                         }, [useridentity]);
                     } else {
                         Toast.fail('上传图片失败,请检查网络');
+                        that.loading = false;
                     }
                 }, formData);
             },

+ 5 - 4
sourcecode/h5app/vue/src/views/giftDetail.vue

@@ -50,13 +50,14 @@
             <p>交换成功可以开始接收对方发来的感谢信哦</p>
         </div>
         <div
-                v-if="myPresent.status === 0 || myPresent.status === 1"
+                v-if="myPresent.status === 0 || myPresent.status === 1 || myPresent.status === 4"
                 style="position: fixed; bottom: 0; width: 100%"
         >
             <van-button
-                type="default" size="large"
-                style="width: 85%;"
-                @click="editPresent"
+                    type="default" size="large"
+                    style="width: 85%;"
+                    @click="editPresent"
+                    v-if="myPresent.status !== 4"
             >修改礼物</van-button>
             <van-button
                     type="warning" size="large"

+ 4 - 5
sourcecode/h5app/vue/src/views/index.vue

@@ -1,6 +1,6 @@
 <template>
     <div>
-        <guide style="z-index: 3" v-if="hasPresent"/>
+        <guide style="z-index: 3" v-if="hasPresent === false"/>
         <van-swipe :autoplay="3000" style="margin: 10px 10px;">
             <van-swipe-item v-for="(image, index) in images" :key="index">
                 <img v-lazy="image" style="max-width: 100%"/>
@@ -91,15 +91,13 @@
             console.log(userid);
 
             let presentList = [];
+            let that = this;
             BasicFunction.get_data("smartGoods/list?isDel=0&ownerId=" + userid, function (response) {
                 console.log("------ Data Rcvd in Index --------");
                 console.log(response);
                 if (response.ret === "10000") {
                     let list = response.model.list;
-                    if (list !== undefined || list.length === 0) {
-                        console.warn(list);
-
-                    }
+                    if (list.length !== 0) that.hasPresent = true;
                     list.forEach(gift => {
                         let temp = {};
                         temp.id = gift.goodid;
@@ -113,6 +111,7 @@
                         temp.desc_long = gift.description;
                         temp.time = gift.createTime.substring(0, 9);
                         temp.status = gift.sort;
+                        // if(gift.sort && gift.sort !== 4) that.button_active = false;
                         temp.gender = gift.goodFirstKind;
                         temp.tags = gift.goodSecondKind;
                         presentList.push(temp);

+ 1 - 0
sourcecode/h5app/vue/src/views/login.vue

@@ -16,6 +16,7 @@
         created: function () {
             if (localStorage.getItem('frontend-userid')) {
                 this.$router.push('index');
+                return;
             }
             let otp = this.$route.query.o;
             console.log('otp: ');