瀏覽代碼

can delete present now

StephenArk30 6 年之前
父節點
當前提交
a506500090

+ 34 - 0
sourcecode/h5app/vue/src/components/navBar.vue

@@ -0,0 +1,34 @@
+<template>
+    <div>
+        <van-nav-bar
+                title="礼品卡"
+                style="background-color: #fff6e3"
+                :border="false">
+            style="max-width: 30px;"
+            />
+            <van-icon name="arrow-left" slot="left" @click="onClickLeft" color="black"/>
+        </van-nav-bar>
+    </div>
+</template>
+
+<script>
+    import {NavBar, Icon} from 'vant';
+
+    export default {
+        name: "navBar",
+        components: {
+            [NavBar.name]: NavBar,
+            [Icon.name]: Icon
+        },
+        props: ['path'],
+        methods: {
+            onClickLeft: function () {
+                this.$router.push(this.path);
+            }
+        }
+    }
+</script>
+
+<style scoped>
+
+</style>

+ 7 - 1
sourcecode/h5app/vue/src/components/schoolCard.vue

@@ -18,6 +18,7 @@
 <script>
     import {  Row, Col,  } from 'vant';
     import AddPhoto from "../components/addPhoto";
+    import {BasicFunction} from "../connector/basic-service";
     export default {
         name: "schoolCard",
         components: {
@@ -62,7 +63,12 @@
                 this.photo = file;
             }
         },
-
+        created: function () {
+            if (!localStorage.getItem('frontend-userid')) {
+                this.$router.push('login');
+                return;
+            }
+        }
     }
 </script>
 

+ 9 - 1
sourcecode/h5app/vue/src/components/schoolidCard.vue

@@ -151,7 +151,11 @@
                 }, [{}]);
             },
             getReviewInfo:function (obj) {
-                var userId = localStorage.getItem("frontend-userid");
+                if (!localStorage.getItem('frontend-userid')) {
+                    this.$router.push('login');
+                    return;
+                }
+                let userId = localStorage.getItem("frontend-userid");
                 let that = this;
                 BasicFunction.get_data("smartIdentity/list?userId=" + userId, function (response) {
                     console.log("------ Data Rcvd in getReviewInfo --------");
@@ -169,6 +173,10 @@
         },
 
         created: function () {
+            if (!localStorage.getItem('frontend-userid')) {
+                this.$router.push('login');
+                return;
+            }
             window.schoolIdCard = this;
             this.getIdentityInfo(window.schoolIdCard);
             this.getReviewInfo(window.schoolIdCard);

+ 4 - 0
sourcecode/h5app/vue/src/views/Assess.vue

@@ -91,6 +91,10 @@
             },
         },
         created: function () {
+            if (!localStorage.getItem('frontend-userid')) {
+                this.$router.push('login');
+                return;
+            }
             if(this.$route.query.present) {
                 let present = this.$route.query.present;
                 console.log(present);

+ 21 - 14
sourcecode/h5app/vue/src/views/PresentRegister.vue

@@ -1,5 +1,6 @@
 <template>
     <div>
+        <nav-bar path="index"/>
         <div class='card'>
             <h3><strong>礼物匹配</strong></h3>
             <p>希望对方的性别是</p>
@@ -65,9 +66,11 @@
     } from 'vant';
     import {BasicFunction} from "../connector/basic-service";
     import AddPhoto from "../components/addPhoto";
+    import NavBar from "../components/navBar";
     export default {
         name: "PresentRegister",
         components: {
+            NavBar,
             AddPhoto,
             [Uploader.name]: Uploader, [Icon.name]: Icon,
             [CellGroup.name]: CellGroup, [Field.name]: Field,
@@ -133,20 +136,20 @@
                 console.log(this.photo);
 
                 let present = [{
-                    "goodid": this.presentId,
-                    "name": this.presentName,
-                    "goodsNo": "A2", "modelId": "1",
-                    "ownerId": userId.toString(),
-                    "goodFirstKind": gender_tags.toString(),
-                    "goodSecondKind": "2000", "sellPrice": "0.0", "marketPrice": "0.0", "costPrice": "0.0",
-                    "upTime": getNowFormatDate(), "downTime": getNowFormatDate(), "createTime": getNowFormatDate(),
-                    "storeNums": "1",
-                    "img": this.photo.file.name,
-                    "isDel": "0", "content": "none", "keywords": "none",
-                    "description": this.desc,
-                    "searchWords": "", "weight": "0.4", "point": "4", "unit": "10", "brandId": "1",
-                    "visit": "1", "favorite": "1", "sort": "1", "listImg": "xx.jpg",
-                    "smallImg": "xx.jpg", "specArray": "{}", "exp": "0"
+                    goodid: this.presentId,
+                    name: this.presentName,
+                    goodsNo: "0", modelId: "0",
+                    ownerId: userId.toString(),
+                    goodFirstKind: gender_tags.toString(),
+                    goodSecondKind: "2000", sellPrice: "0.0", marketPrice: "0.0", costPrice: "0.0",
+                    upTime: getNowFormatDate(), downTime: getNowFormatDate(), createTime: getNowFormatDate(),
+                    storeNums: "0",
+                    img: this.photo.file.name,
+                    isDel: "0", content: "none", keywords: "none",
+                    description: this.desc,
+                    searchWords: "", weight: "0.0", point: "0", unit: "0", brandId: "0",
+                    visit: "0", favorite: "0", sort: "0", listImg: "xx.jpg",
+                    smallImg: "xx.jpg", specArray: "{}", exp: "0"
                 }];
                 console.log(present);
                 let that = this;
@@ -167,6 +170,10 @@
             }
         },
         created: function () {
+            if (!localStorage.getItem('frontend-userid')) {
+                this.$router.push('login');
+                return;
+            }
             if(this.$route.query.present) {
                 let present = this.$route.query.present;
                 console.log(present);

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

@@ -1,5 +1,6 @@
 <template>
     <div>
+        <nav-bar path="index"/>
         <gift-card
                 v-if="myPresent.status===2"
                 :present-name="recievedPresent.presentName"
@@ -61,12 +62,15 @@
 
 <script>
     import GiftCard from "../components/giftCard";
-    import { Button, Dialog } from 'vant'
+    import {Button, Dialog, Toast} from 'vant'
+    import NavBar from "../components/navBar";
+    import {BasicFunction} from "../connector/basic-service";
     export default {
         name: "giftDetail",
         components: {
+            NavBar,
             GiftCard,
-            [Button.name]: Button
+            [Button.name]: Button,
         },
         data() {
             return {
@@ -92,17 +96,42 @@
                     // on confirm
                     // delete_present(this.presentId())
                     // TODO: 考虑 updateBatch, 就是需要 将isDel设为1, 配合首页查找进行过滤
-                    this.$router.push('index')
+                    let that = this;
+                    BasicFunction.get_data("smartGoods/list?goodid=" + this.myPresent.id, function (response) {
+                        console.log("------ Data Rcvd in detail --------");
+                        console.log(response);
+                        if (response.ret === "10000") {
+                            let list = response.model.list;
+                            if (list !== undefined || list.length > 0) console.warn(list);
+                            list[0].isDel = 1;
+                            console.log(list);
+                            BasicFunction.get_data("smartGoods/updateBatch", function (response) {
+                                console.log(response);
+                                if (response.ret === '10000') {
+                                    Toast.success('删除成功');
+                                    that.$router.push('index');
+                                } else {
+                                    Toast.fail('删除失败,请检查网络');
+                                }
+                            }, list)
+                        } else {
+                            console.warn("获取资源失败");
+                        }
+                    }, {});
                 }).catch(() => {
                     // on cancel
                 });
-            }
+            },
         },
         created: function () {
+            if (!localStorage.getItem('frontend-userid')) {
+                this.$router.push('login');
+                return;
+            }
             this.myPresent.id = this.$route.query.presentId;
             this.myPresent.presentName = this.$route.query.name;
             this.myPresent.presentDesc = this.$route.query.desc;
-            this.myPresent.status = this.$route.query.status;
+            this.myPresent.status = parseInt(this.$route.query.status);
             let gender_tags = this.$route.query.gender_tags;
             console.log(gender_tags);
             this.myPresent.gender = parseInt(gender_tags.charAt(gender_tags.length - 1));

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

@@ -74,6 +74,10 @@
         created: function () {
             // return get_present_data()
 
+            if (!localStorage.getItem('frontend-userid')) {
+                this.$router.push('login');
+                return;
+            }
             let userId = localStorage.getItem("frontend-userid");
             // 判断userId 是不是空的
 

+ 4 - 0
sourcecode/h5app/vue/src/views/me.vue

@@ -23,6 +23,10 @@
             }
         },
         created: function () {
+            if (!localStorage.getItem('frontend-userid')) {
+                this.$router.push('login');
+                return;
+            }
             this.button_active = false;
             var userId = localStorage.getItem("frontend-userid");
         }

+ 6 - 0
sourcecode/h5app/vue/src/views/share.vue

@@ -28,6 +28,12 @@
             Toindex(){
                 this.$router.push('index');
             }
+        },
+        created: function () {
+            if (!localStorage.getItem('frontend-userid')) {
+                this.$router.push('login');
+                return;
+            }
         }
     }
 </script>