Browse Source

solve me bug

StephenArk30 6 years ago
parent
commit
1d7c4b704a

+ 36 - 14
sourcecode/h5app/vue/src/components/schoolCard.vue

@@ -10,10 +10,11 @@
         </van-row>
         <div v-if="status===30 || status === 500">
             <add-photo @onRead="onRead"/>
-            <p>活动仅允许深大学生参与,请上传正面校卡照片审核~</p>
+            <p>{{note}}</p>
             <van-button
                     type="primary"
                     @click="schoolPresent"
+                    style="width: 100%"
                     :loading="loading"
             >保存
             </van-button>
@@ -27,7 +28,7 @@
 </template>
 
 <script>
-    import {Row, Col, Toast} from 'vant';
+    import {Row, Col, Toast, Button} from 'vant';
     import AddPhoto from "../components/addPhoto";
     import {BasicFunction} from "../connector/basic-service";
     export default {
@@ -35,6 +36,7 @@
         components: {
             AddPhoto,
             [Row.name]: Row, [Col.name]: Col,
+            [Button.name]: Button
         },
         data() {
             return {
@@ -46,8 +48,8 @@
                 imgage: null,
                 imgDo:{},
                 schoolpic:"",
-                IMGPREFIX:"http://gift.fogice.com"
-
+                IMGPREFIX: "http://gift.fogice.com",
+                note: ""
             }
         },
         methods: {
@@ -60,21 +62,40 @@
                     return;
                 }
                 let that=this;
-                // console.log('------- photo -------');
-                // console.log(this.photo);
+                console.log('------- photo -------');
+                console.log(this.photo);
                 let formData = new FormData();
                 formData.append('file', this.photo);
-                BasicFunction.get_data("smartIdentity/updateBatch", function (response) {
-                    // console.log("------ Data Rcvd in uploadphotoChange --------");
-                    // console.log(response);
-                    if (response.ret === "10000") {
-                        Toast.success("上传成功");
-                        this.$router.push('index');
+                BasicFunction.get_data("http://gift.fogice.com/server/fileserver/upload?sign=abcdefg", function (res) {
+                    if (res.model === undefined || res.model.length === 0) {
+                        Toast.fail('上传失败,请重试');
+                        return;
+                    }
+                    if (res.ret === '10000') {
+                        let photoURL = res.model;
+                        let userid = localStorage.getItem('frontend-userid');
+                        BasicFunction.get_data('smartIdentity/list?userId=' + userid, function (res) {
+                            // console.log('----- User Identity -----');
+                            // console.log(res);
+                            if (res.ret === '10000') {
+                                let t = res.model.list[0];
+                                t.userSchoolCardPic = photoURL;
+                                t.userReviewStatus = 100;
+                                t.reviewerNote = "未审核";
+                                t.reviewerNoteToUser = "未审核";
+                                BasicFunction.get_data('smartIdentity/updateBatch', function (res) {
+                                    if (res.ret === '10000') {
+                                        Toast.success('上传成功');
+                                        location.reload();
+                                    }
+                                    else Toast.fail('上传失败,请重试');
+                                }, [t]);
+                            } else Toast.fail('访问失败,请重试');
+                        }, {});
                     } else {
-                        Toast.fail("上传失败,请检查网络");
+                        Toast.fail('上传失败');
                     }
                 }, formData);
-
             },
             onRead: function (e) {
                 this.photo = e;
@@ -94,6 +115,7 @@
                     var t=res.model.list;
                     that.status=t[0].userReviewStatus;
                     that.imgDo=t[0];
+                    that.note = t[0].reviewerNoteToUser;
                     // console.log(that);
                     if (res.model.list.length === 0 || that.status === 30) {
                         that.statusColor='#c5c5c5';

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

@@ -119,10 +119,22 @@
             publishPresent() {
                 this.loading = true;
                 // 检验输入
-                if (this.presentName.length === 0) {
+                if (isEmojiCharacter(this.presentName)) {
+                    Toast.fail('不支持表情哦');
                     this.pnError = true;
                     this.loading = false;
                     return;
+                }
+                else if (this.presentName.length === 0) {
+                    this.pnError = true;
+                    this.loading = false;
+                    return;
+                }
+                else if (isEmojiCharacter(this.desc)) {
+                    Toast.fail('不支持表情哦');
+                    this.descError = true;
+                    this.loading = false;
+                    return;
                 } else if (this.desc.length <= 15) {
                     this.descError = true;
                     Toast.fail('请输入至少15个字的礼物介绍');
@@ -185,7 +197,7 @@
                     BasicFunction.get_data("fileserver/upload?sign=abcdefg", function (res) {
                         // console.log('----- upload photo result -----');
                         // console.log(res);
-                        if (res.model.length === 0) {
+                        if (res.model === undefined || res.model.length === 0) {
                             Toast.fail('上传失败,请重试');
                             return;
                         }
@@ -297,6 +309,41 @@
         currentdate = currentdate + ' ' + hour + ':' + minutes + ':' + seconds;
         return currentdate;
     }
+
+    // 判断是否有emoji
+    function isEmojiCharacter(substring) {
+        for (var i = 0; i < substring.length; i++) {
+            var hs = substring.charCodeAt(i);
+            if (0xd800 <= hs && hs <= 0xdbff) {
+                if (substring.length > 1) {
+                    var ls = substring.charCodeAt(i + 1);
+                    var uc = ((hs - 0xd800) * 0x400) + (ls - 0xdc00) + 0x10000;
+                    if (0x1d000 <= uc && uc <= 0x1f77f) {
+                        return true;
+                    }
+                }
+            } else if (substring.length > 1) {
+                var ls = substring.charCodeAt(i + 1);
+                if (ls == 0x20e3) {
+                    return true;
+                }
+            } else {
+                if (0x2100 <= hs && hs <= 0x27ff) {
+                    return true;
+                } else if (0x2B05 <= hs && hs <= 0x2b07) {
+                    return true;
+                } else if (0x2934 <= hs && hs <= 0x2935) {
+                    return true;
+                } else if (0x3297 <= hs && hs <= 0x3299) {
+                    return true;
+                } else if (hs == 0xa9 || hs == 0xae || hs == 0x303d || hs == 0x3030
+                    || hs == 0x2b55 || hs == 0x2b1c || hs == 0x2b1b
+                    || hs == 0x2b50) {
+                    return true;
+                }
+            }
+        }
+    }
 </script>
 
 <style scoped>

+ 3 - 2
sourcecode/h5app/vue/src/views/index.vue

@@ -46,7 +46,8 @@
             </div>
         </div>
         <div style="margin: 20px 10px 80px; font-size: 15px">
-            <p>如果您发现礼物图片不正确或无法加载,请点击礼物-修改礼物重新上传图片</p>
+            <p style="margin-bottom: 0">如果您发现礼物图片不正确或无法加载,请点击礼物-修改礼物重新上传图片</p>
+            <p style="margin-top: 5px">Bug反馈请加负责人微信: 17788752557</p>
         </div>
         <add-present-button :can_add="button_active"/>
     </div>
@@ -137,7 +138,7 @@
                         });
                         if (this.button_active) this.$router.push('verify');
                         else Dialog.alert({
-                            message: '只能上传一礼物哦'
+                            message: '只能上传一礼物哦'
                         }).then(() => {
                         });
                         break;

+ 2 - 1
sourcecode/h5app/vue/src/views/me.vue

@@ -25,7 +25,8 @@
         },
         data() {
             return {
-                button_active: false
+                button_active: false,
+                photoURL: ''
             }
         },
         created: function () {