StephenArk30 6 роки тому
батько
коміт
21fcb70ad8

+ 37 - 2
sourcecode/h5app/vue/src/views/Assess.vue

@@ -22,6 +22,7 @@
                         v-model="value"
                         icon="like"
                         void-icon="like-o"
+                        color="red"
                 />
                 <van-button round type="primary" class='assess' @click="assessPresent">送出感谢信</van-button>
             </div>
@@ -73,9 +74,9 @@
                     Toast.fail('请输入至少15个字的礼物评价!');
                     return;
                 }
-                else if(this.substance.length > 300) {
+                else if (isEmojiCharacter(this.substance)) {
                     this.assessError = true;
-                    Toast.fail('最多输入300个字的礼物评价!');
+                    Toast.fail('不支持表情哦');
                     return;
                 }
                 if (!localStorage.getItem('frontend-userid')) {
@@ -204,6 +205,40 @@
         currentdate = currentdate + ' ' + hour + ':' + minutes + ':' + seconds;
         return currentdate;
     }
+
+    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>

+ 37 - 13
sourcecode/h5app/vue/src/views/giftDetail.vue

@@ -15,9 +15,16 @@
                 :wechat="receivedPresent.wechat"
         />
         <!--我写的感谢信-->
-        <div class="letter" v-if="RcommentDo.length !== 0">
+        <div class="letter" v-if="RcommentDo.content.length !== 0">
             <p style="font-size: 110%"><strong>我送出的感谢信</strong></p>
-            <p>{{RcommentDo}}</p>
+            <van-rate
+                    icon="like"
+                    void-icon="like-o"
+                    readonly
+                    v-model="RcommentDo.rate"
+                    color="red"
+            />
+            <p>{{RcommentDo.content}}</p>
         </div>
         <!--我的礼物信息-->
         <gift-card
@@ -30,9 +37,16 @@
                 :status="myPresent.status"
                 :wechat="myPresent.wechat"
         />
-        <div class="letter" v-if="commentDo.length !== 0">
+        <div class="letter" v-if="commentDo.content.length !== 0">
             <p style="font-size: 110%"><strong>我收到的感谢信</strong></p>
-            <p>{{commentDo}}</p>
+            <van-rate
+                    icon="like"
+                    void-icon="like-o"
+                    readonly
+                    v-model="commentDo.rate"
+                    color="red"
+            />
+            <p>{{commentDo.content}}</p>
         </div>
         <div class="letter" v-if="myPresent.status === 4">
             <p><strong>审核未通过,请前往首页重新发布礼物!</strong></p>
@@ -74,7 +88,7 @@
 
 <script>
     import GiftCard from "../components/giftCard";
-    import {Button, Dialog, Toast} from 'vant'
+    import {Button, Dialog, Toast, Rate} from 'vant'
     import NavBar from "../components/navBar";
     import {BasicFunction} from "../connector/basic-service";
 
@@ -84,6 +98,7 @@
             NavBar,
             GiftCard,
             [Button.name]: Button,
+            [Rate.name]: Rate
         },
         data() {
             return {
@@ -92,10 +107,16 @@
                 receivedPresent: {},
                 giftDo: {},
                 identityDo: {},
-                commentDo: '',
+                commentDo: {
+                    content: '',
+                    rate: 5
+                },
                 RgiftDo: {},
                 RidentityDo: {},
-                RcommentDo: '',
+                RcommentDo: {
+                    content: '',
+                    rate: 5
+                },
                 orderId: -1
             }
         },
@@ -248,7 +269,8 @@
                 } else this.initGifts();
             },
             onloadReceiveGift(myid, status) {
-                let receiverId = this.RgiftDo.goodid;
+                let receiverId = this.RgiftDo.ownerId;
+                let goodid = this.RgiftDo.goodid;
                 let that = this;
                 BasicFunction.get_data('smartIdentity/list?userId=' + receiverId, function (recvRes) {
                     try {
@@ -256,7 +278,7 @@
                         console.log(recvRes);
                         if (recvRes.ret === '10000' && recvRes.model !== undefined && recvRes.model.list.length !== 0) {
                             that.RidentityDo = recvRes.model.list[0];
-                            if (status === 3) that.onloadFeedback(myid, receiverId);
+                            if (status === 3) that.onloadFeedback(myid, goodid);
                             else that.initGifts();
                         } else {
                             Toast.fail('获取数据失败,请重试');
@@ -267,7 +289,7 @@
                     }
                 }, {});
             },
-            onloadFeedback(myid, receiverId) {
+            onloadFeedback(myid, rgoodId) {
                 let that = this;
                 BasicFunction.get_data('smartOrderFeedback/list?goodId=' + myid, function (res) {
                     console.log('----- received feedback -----');
@@ -279,10 +301,11 @@
                             };
                             if (res.model.list !== undefined && res.model.list.length !== 0) {
                                 comment = res.model.list[0];
+                                that.commentDo.rate = comment.ratingMajor;
                             }
-                            that.commentDo = comment.content;
+                            that.commentDo.content = comment.content;
                             // 对方的评价
-                            BasicFunction.get_data('smartOrderFeedback/list?goodId=' + receiverId, function (recvRes) {
+                            BasicFunction.get_data('smartOrderFeedback/list?goodId=' + rgoodId, function (recvRes) {
                                 console.log('----- sent feedback -----');
                                 console.log(res);
                                 try {
@@ -292,8 +315,9 @@
                                         };
                                         if (recvRes.model.list !== undefined && recvRes.model.list.length !== 0) {
                                             comment = recvRes.model.list[0];
+                                            that.RcommentDo.rate = comment.ratingMajor;
                                         }
-                                        that.RcommentDo = comment.content;
+                                        that.RcommentDo.content = comment.content;
                                         that.initGifts();
                                     } else {
                                         Toast.fail('获取信息失败');