jason.lu 6 år sedan
förälder
incheckning
887e23bb71

+ 0 - 0
sourcecode/h5app/vue/src/assets/banner.png → sourcecode/h5app/vue/src/assets/banners/banner.png


BIN
sourcecode/h5app/vue/src/assets/banners/banner1.jpg


BIN
sourcecode/h5app/vue/src/assets/banners/banner2.jpg


BIN
sourcecode/h5app/vue/src/assets/banners/banner3.jpg


+ 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>
 

+ 10 - 4
sourcecode/h5app/vue/src/components/schoolidCard.vue

@@ -11,7 +11,7 @@
         <p>昵称</p>
         <van-cell-group>
             <van-field
-                    placeholder=" "
+                    placeholder="请输入昵称"
                     v-model="personName"
                     :error="personError"
                     @click="personError=false"
@@ -88,7 +88,6 @@
                         that.isReadonly = true;
                         Toast.success("上传成功")
                     } else {
-                        // 注册失败的处理
                         Toast.fail("上传失败,请检查网络");
                     }
                 }, [this.userDo]);
@@ -103,7 +102,6 @@
                         that.isReadonly = true;
                         Toast.success("上传成功")
                     } else {
-                        // 注册失败的处理
                         Toast.fail("上传失败,请检查网络");
                     }
                 }, [this.reviewDo]);
@@ -151,7 +149,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 +171,10 @@
         },
 
         created: function () {
+            if (!localStorage.getItem('frontend-userid')) {
+                this.$router.push('login');
+                return;
+            }
             window.schoolIdCard = this;
             this.getIdentityInfo(window.schoolIdCard);
             this.getReviewInfo(window.schoolIdCard);

+ 32 - 1
sourcecode/h5app/vue/src/connector/simple-demo.js

@@ -154,7 +154,38 @@ BasicFunction.get_data("数据接口名称/list?条件1=数据1&条件2=数据2&
 
 新建货品:
 smartGoods/saveBatch
-[{"goodid":"","name":"萌犬毛绒抱枕","goodsNo":"A2","modelId":"1","ownerId":"18","goodFirstKind":"1000","goodSecondKind":"2000","sellPrice":"0.0","marketPrice":"0.0","costPrice":"0.0","upTime":"2018-12-10 01:01:01","downTime":"2018-12-10 01:01:01","createTime":"2018-12-10 01:01:01","storeNums":"1","img":"attachment/simple/acsac089e1nnsaxx72190dm.jpg","isDel":"0","content":"none","keywords":"none","description":"绒毛玩具或填充玩具,中国大陆较常用“毛绒玩具”、香港为“毛公仔”,是以毛绒面料及其他纺织材料包裹各种填充物而制成的,具有软绵绵、毛绒绒可爱造形的填充玩具。通常做成动物的形象,但也有人形的绒毛玩具。 动画、卡通和漫画人物都是受欢迎的题材。泰迪熊可能被视为是一种绒毛玩具,但因制造材质而异并不是所有的泰迪熊都是绒毛玩具","searchWords":"毛绒,玩具","weight":"0.4","point":"4","unit":"10","brandId":"1","visit":"1","favorite":"1","sort":"1","listImg":"attachment/simple/acsac089e1nnsaxx72190dm.jpg","smallImg":"attachment/simple/bicno912nounx7xsg28d1nidx.jpg","specArray":"{}","exp":"0"}]' --compressed
+[{
+"goodid":"", // 货品id
+"name":"萌犬毛绒抱枕", // 货品名
+"goodsNo":"A2",
+"modelId":"1",
+"ownerId":"18", // 货品所有者id
+"goodFirstKind":"1000", // 前14位是tag,15位是性别
+"goodSecondKind":"2000",
+"sellPrice":"0.0",
+"marketPrice":"0.0",
+"costPrice":"0.0",
+"upTime":"2018-12-10 01:01:01",
+"downTime":"2018-12-10 01:01:01",
+"createTime":"2018-12-10 01:01:01",
+"storeNums":"1",
+"img":"attachment/simple/acsac089e1nnsaxx72190dm.jpg",
+"isDel":"0",
+"content":"none",
+"keywords":"none",
+"description":"绒毛玩具或填充玩具,中国大陆较常用“毛绒玩具”、香港为“毛公仔”,是",
+"searchWords":"毛绒,玩具",
+"weight":"0.4",
+"point":"4",
+"unit":"10",
+"brandId":"1",
+"visit":"1",
+"favorite":"1",
+"sort":"1", // 货品状态 0: 审核中, 1: 匹配中, 2: 匹配成功, 3: 交换成功, 4: 审核失败
+"listImg":"attachment/simple/acsac089e1nnsaxx72190dm.jpg",
+"smallImg":"attachment/simple/bicno912nounx7xsg28d1nidx.jpg",
+"specArray":"{}","exp":"0"
+}]
 
 
 新建货品审核单

+ 3 - 1
sourcecode/h5app/vue/src/main.js

@@ -2,11 +2,13 @@ import Vue from 'vue'
 import App from './App.vue'
 import { router } from './router'
 import VueClipboard from 'vue-clipboard2'
-import VueResource from 'vue-resource'
+import VueResource from 'vue-resource';
+import {Lazyload} from 'vant';
 
 Vue.config.productionTip = false;
 Vue.use(VueClipboard);
 Vue.use(VueResource);
+Vue.use(Lazyload);
 
 Vue.http.options.emulateJSON = true;
 Vue.http.options.emulateHTTP = true;

+ 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);

+ 33 - 16
sourcecode/h5app/vue/src/views/SecurityVerify.vue

@@ -94,6 +94,7 @@
 </template>
 
 <script>
+    import {BasicFunction} from "../connector/basic-service";
     import {
         Uploader, Icon,
         CellGroup, Field,
@@ -102,7 +103,7 @@
         Button,
         Actionsheet,
         Toast
-    } from 'vant'
+    } from 'vant';
     import AddPhoto from "../components/addPhoto";
     export default {
         name: "SecurityVerify",
@@ -167,28 +168,44 @@
                     Toast.fail('请上传校卡正面照片');
                     return;
                 }
-                let user = {
-                    phone: this.phone,
-                    password: this.password,
-                    nickname: this.username,
-                    gender: parseInt(this.radio),
-                    dormitory: this.dorId,
-                    photo: this.photo
-                };
-                console.log(user);
-                // BasicFunction.get_data("ajaxregister?u=手机号&p=转义密码", 回调函数, {})
+
+                let success = true;
                 BasicFunction.get_data("ajaxregister?u=" + this.phone + '&p=' + this.password, function (response) {
                     console.log("------ Data Rcvd in Reg --------");
                     console.log(response);
-                    if(response.ret === "10000"){
+                    if (response.ret !== "10000") {
                         // 不需要 设置 SessionID, 已经自动保存在jSessionID中
-                        this.$router.push('presentRegister');
-                    } else {
-                        // 注册失败的处理
                         Toast.fail("注册失败,请检查网络");
+                        success = false;
+                    } else {
+                        localStorage.setItem("frontend-userid", response.model.userId);
                     }
                 }, {});
-                // this.$router.push('presentRegister');
+                if (!success) return;
+
+                let userId = localStorage.getItem('frontend-userid');
+                let useridentity = [{
+                    reviewId: "",
+                    userId: userId,
+                    dormDistrict: this.dorId,
+                    userSex: parseInt(this.radio),
+                    userSchoolCard: 201233222,
+                    userReviewStatus: 0,
+                    reviewerId: 1,
+                    reviewerNote: "nmo",
+                    reviewerNoteToUser: "noo"
+                }];
+                console.log(useridentity);
+                let that = this;
+                BasicFunction.get_data("smartIdentity/saveBatch", function (response) {
+                    console.log(response);
+                    if (response.ret === "10000") {
+                        Toast.success("注册成功");
+                        that.$router.push('presentRegister');
+                    } else {
+                        Toast.fail("注册失败,请检查网络");
+                    }
+                }, useridentity);
             },
             onReadPhoto(file) {
                 this.photo = file;

+ 37 - 4
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"
@@ -38,6 +39,7 @@
             <van-button
                     type="primary" size="large"
                     style="background-color: #fd6740; border-color: #fd6740; width: 85%;"
+                    @click="toWriteComment"
             >确认交换成功</van-button>
             <p>交换成功可以开始接收对方发来的感谢信哦</p>
         </div>
@@ -61,12 +63,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 +97,45 @@
                     // 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
                 });
+            },
+            toWriteComment: function () {
+                this.$router.push('assess');
             }
         },
         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));

+ 22 - 7
sourcecode/h5app/vue/src/views/index.vue

@@ -1,8 +1,11 @@
 <template>
     <div>
-        <div style="position: relative;">
-            <img :src="indexTop" style="max-width: 100%; position: relative;"/>
-        </div>
+        <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%"/>
+            </van-swipe-item>
+        </van-swipe>
+
         <van-row type="flex" justify="space-between" align="center" style="margin: 0 10px 0 15px">
             <van-col>
                 <p><strong>我的礼物</strong></p>
@@ -34,7 +37,10 @@
 
 <script>
     import IndexPresent from "../components/IndexPresent";
-    import {Button, Row, Col} from "vant";
+    import {
+        Button, Row, Col,
+        Swipe, SwipeItem
+    } from "vant";
     import AddPresentButton from "../components/addPresentButton";
     import {BasicFunction} from '../connector/basic-service';
 
@@ -44,12 +50,17 @@
             AddPresentButton,
             IndexPresent,
             [Button.name]: Button,
-            [Row.name]: Row, [Col.name]: Col
+            [Row.name]: Row, [Col.name]: Col,
+            [Swipe.name]: Swipe, [SwipeItem.name]: SwipeItem,
         },
         data() {
             return {
+                images: [
+                    require('../assets/banners/banner1.jpg'),
+                    require('../assets/banners/banner2.jpg'),
+                    require('../assets/banners/banner3.jpg'),
+                ],
                 active: 0,
-                indexTop: require('../assets/banner.png'),
                 button_active: true,
                 presents: {}
             }
@@ -74,6 +85,10 @@
         created: function () {
             // return get_present_data()
 
+            if (!localStorage.getItem('frontend-userid')) {
+                this.$router.push('login');
+                return;
+            }
             let userId = localStorage.getItem("frontend-userid");
             // 判断userId 是不是空的
 
@@ -95,7 +110,7 @@
                         else temp.desc = gift.description;
                         temp.desc_long = gift.description;
                         temp.time = gift.createTime.substring(0, 9);
-                        temp.status = 0;
+                        temp.status = gift.sort;
                         temp.gender_tags = gift.goodFirstKind.toString(2);
                         presentList.push(temp);
                     });

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

@@ -1,6 +1,6 @@
 <template>
     <div>
-        <div>
+        <div style="margin-bottom: 80px">
             <schoolid-card
             />
             <school-card
@@ -16,13 +16,21 @@
     import SchoolCard from "../components/schoolCard";
     export default {
         name: "me",
-        components: {SchoolCard, SchoolidCard, AddPresentButton},
+        components: {
+            SchoolCard,
+            SchoolidCard,
+            AddPresentButton,
+        },
         data() {
             return {
                 button_active: true
             }
         },
         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>