Jelajahi Sumber

add v-model for addPhoto

Stephen Ark 7 tahun lalu
induk
melakukan
2594497311

File diff ditekan karena terlalu besar
+ 0 - 0
sourcecode/h5app/vue/dist/js/chunk-1e97bc08.bb8a5dc5.js


File diff ditekan karena terlalu besar
+ 0 - 0
sourcecode/h5app/vue/dist/js/chunk-ff2ae40c.01531bfa.js


+ 13 - 0
sourcecode/h5app/vue/src/components/addPhoto.vue

@@ -18,6 +18,16 @@
                 photoURL: require('../assets/camera.png')
             }
         },
+        model: {
+            prop: 'chosen',
+            event: 'onRead'
+        },
+        props: {
+            chosen: {
+                type: Boolean,
+                default: false
+            }
+        },
         methods: {
             onRead: function (e) {
                 let f = e.target.files[0];
@@ -29,6 +39,9 @@
                     console.log(this.result);
                     that.photoURL = this.result;
                 };
+                this.chosen = true;
+                this.$emit('onRead', this.chosen);
+                // console.log(this.chosen);
             }
         }
     }

+ 38 - 38
sourcecode/h5app/vue/src/components/addPresentButton.vue

@@ -1,39 +1,39 @@
-<template>
-    <div class="button_container">
-            <img src="../assets/add_button_active.png"
-                 class="add_button"
-                 v-if="can_add" @click="toAddPresent"
-            />
-            <img src="../assets/add_button_inactive.png"
-                 class="add_button"
-                 v-if="!can_add"
-            />
-    </div>
-</template>
-
-<script>
-    export default {
-        name: "add-present-button",
-        props: ['can_add'],
-        methods: {
-            toAddPresent() {
-                this.$router.push('presentRegister');
-            }
-        }
-    }
-</script>
-
-<style scoped>
-    .add_button {
-        width: 50px;
-        height: 50px;
-        pointer-events: auto;
-    }
-    .button_container {
-        position: fixed;
-        bottom: 20px;
-        z-index: 2;
-        width: 100%;
-        pointer-events: none;
-    }
+<template>
+    <div class="button_container">
+            <img src="../assets/add_button_active.png"
+                 class="add_button"
+                 v-if="can_add" @click="toAddPresent"
+            />
+            <img src="../assets/add_button_inactive.png"
+                 class="add_button"
+                 v-if="!can_add"
+            />
+    </div>
+</template>
+
+<script>
+    export default {
+        name: "add-present-button",
+        props: ['can_add'],
+        methods: {
+            toAddPresent() {
+                this.$router.push('presentRegister');
+            }
+        }
+    }
+</script>
+
+<style scoped>
+    .add_button {
+        width: 50px;
+        height: 50px;
+        pointer-events: auto;
+    }
+    .button_container {
+        position: fixed;
+        bottom: 20px;
+        z-index: 2;
+        width: 100%;
+        pointer-events: none;
+    }
 </style>

+ 33 - 33
sourcecode/h5app/vue/src/components/navBar.vue

@@ -1,34 +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>
-
+<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>

+ 92 - 92
sourcecode/h5app/vue/src/components/schoolCard.vue

@@ -1,93 +1,93 @@
-<template>
-    <div class="card" style="margin-bottom: 20px">
-        <van-row >
-            <van-col span="16">
-                <h3><strong>校卡审核</strong></h3>
-            </van-col>
-            <van-col span="8">
-               <p :style="{ color: statusColor[2] }">{{statusString[2]}}</p>
-            </van-col>
-        </van-row>
-        <add-photo @uploadPhoto="onReadPhoto"/>
-        <p>活动仅允许深大学生参与,请上传正面校卡照片审核~</p>
-
-
-    </div>
-</template>
-
-<script>
-    import {  Row, Col,  } from 'vant';
-    import AddPhoto from "../components/addPhoto";
-    import {BasicFunction} from "../connector/basic-service";
-    export default {
-        name: "schoolCard",
-        components: {
-            AddPhoto,
-            [Row.name]: Row, [Col.name]: Col,
-        },
-        data() {
-            return {
-                statusString: ['审核中', '未上传校卡', '审核通过', '审核失败'],
-                statusColor: ['#f43736', '#00ff00', '#00fa9a', '#ff0000'],
-                photo: null,
-            }
-        },
-        methods: {
-            publishPresent() {
-                // 检验输入
-
-                if (this.photo === null) {
-                    Toast.fail('请上传礼物照片');
-                    return;
-                }
-                // post_present()
-                let present = {
-                    photo: this.photo
-                };
-                console.log(present);
-                //FIXME : wrong address given !
-                BasicFunction.get_data("ajaxpostpresent", function (response) {
-                    console.log("------ Data Rcvd in School Card --------");
-                    console.log(response);
-                    if(response.ret === "10000"){
-                        // 不需要 设置 SessionID, 已经自动保存在jSessionID中
-                        this.$router.push('index');
-                    } else {
-                        // 注册失败的处理
-                        Toast.fail("上传失败,请检查网络");
-                    }
-                }, {});
-                // this.$router.push('index');
-            },
-            onReadPhoto(file) {
-                this.photo = file;
-            }
-        },
-        created: function () {
-            if (!localStorage.getItem('frontend-userid')) {
-                this.$router.push('login');
-                return;
-            }
-        }
-    }
-</script>
-
-<style scoped>
-    p, h3 {
-        color: #fd6740;
-    }
-    h3 {
-        padding: 5px;
-        border-bottom: solid 1px #e4e4e4;
-    }
-    p {
-        padding-top:  3px ;
-    }
-    .card {
-        background-color: white;
-        margin: 20px 20px;
-        border: solid 1px #e4e4e4;
-        padding: 15px;
-        text-align: left;
-    }
+<template>
+    <div class="card" style="margin-bottom: 20px">
+        <van-row >
+            <van-col span="16">
+                <h3><strong>校卡审核</strong></h3>
+            </van-col>
+            <van-col span="8">
+               <p :style="{ color: statusColor[2] }">{{statusString[2]}}</p>
+            </van-col>
+        </van-row>
+        <add-photo @uploadPhoto="onReadPhoto"/>
+        <p>活动仅允许深大学生参与,请上传正面校卡照片审核~</p>
+
+
+    </div>
+</template>
+
+<script>
+    import {  Row, Col,  } from 'vant';
+    import AddPhoto from "../components/addPhoto";
+    import {BasicFunction} from "../connector/basic-service";
+    export default {
+        name: "schoolCard",
+        components: {
+            AddPhoto,
+            [Row.name]: Row, [Col.name]: Col,
+        },
+        data() {
+            return {
+                statusString: ['审核中', '未上传校卡', '审核通过', '审核失败'],
+                statusColor: ['#f43736', '#00ff00', '#00fa9a', '#ff0000'],
+                photo: null,
+            }
+        },
+        methods: {
+            publishPresent() {
+                // 检验输入
+
+                if (this.photo === null) {
+                    Toast.fail('请上传礼物照片');
+                    return;
+                }
+                // post_present()
+                let present = {
+                    photo: this.photo
+                };
+                console.log(present);
+                //FIXME : wrong address given !
+                BasicFunction.get_data("ajaxpostpresent", function (response) {
+                    console.log("------ Data Rcvd in School Card --------");
+                    console.log(response);
+                    if(response.ret === "10000"){
+                        // 不需要 设置 SessionID, 已经自动保存在jSessionID中
+                        this.$router.push('index');
+                    } else {
+                        // 注册失败的处理
+                        Toast.fail("上传失败,请检查网络");
+                    }
+                }, {});
+                // this.$router.push('index');
+            },
+            onReadPhoto(file) {
+                this.photo = file;
+            }
+        },
+        created: function () {
+            if (!localStorage.getItem('frontend-userid')) {
+                this.$router.push('login');
+                return;
+            }
+        }
+    }
+</script>
+
+<style scoped>
+    p, h3 {
+        color: #fd6740;
+    }
+    h3 {
+        padding: 5px;
+        border-bottom: solid 1px #e4e4e4;
+    }
+    p {
+        padding-top:  3px ;
+    }
+    .card {
+        background-color: white;
+        margin: 20px 20px;
+        border: solid 1px #e4e4e4;
+        padding: 15px;
+        text-align: left;
+    }
 </style>

+ 209 - 209
sourcecode/h5app/vue/src/components/schoolidCard.vue

@@ -1,210 +1,210 @@
-<template>
-    <div class="card" style="margin-bottom: 20px">
-        <van-row>
-            <van-col span="14">
-                <h3><strong>个人资料</strong></h3>
-            </van-col>
-            <van-col span="6" style="">
-                <p style="border-bottom: solid 1px #e4e4e4" @click="toggleReadOnly()">{{isReadonly ? "编辑" : "保存"}}</p>
-            </van-col>
-        </van-row>
-        <p>昵称</p>
-        <van-cell-group>
-            <van-field
-                    placeholder="请输入昵称"
-                    v-model="personName"
-                    :error="personError"
-                    @click="personError=false"
-                    required
-                    maxlength="10"
-                    :readonly="isReadonly"
-            />
-        </van-cell-group>
-        <p>性别</p>
-        <van-radio-group v-model="gender">
-            <van-radio name="0" checked-color="#fd6740" style="float: left; margin-right: 20px" :disabled="isReadonly">男</van-radio>
-            <van-radio name="1" checked-color="#fd6740" :disabled="isReadonly">女</van-radio>
-        </van-radio-group>
-        <p>微信号</p>
-        <van-cell-group>
-            <van-field
-                    placeholder=" "
-                    v-model="weixinName"
-                    :error="weixinError"
-                    @click="weixinError=false"
-                    required
-                    maxlength="20"
-                    :readonly="isReadonly"
-            />
-        </van-cell-group>
-        <p>宿舍区</p>
-            <van-radio-group v-model="dormDistrict">
-            <van-radio name="0" checked-color="#fd6740" style="float: left; margin-right: 20px" :disabled="isReadonly">南区</van-radio>
-            <van-radio name="1" checked-color="#fd6740" style="float: left; margin-right: 20px" :disabled="isReadonly">西南</van-radio>
-            <van-radio name="2" checked-color="#fd6740" style="float: left; margin-right: 20px" :disabled="isReadonly">斋区</van-radio>
-            <van-radio name="3" checked-color="#fd6740" style="float: left; margin-right: 20px" :disabled="isReadonly">桂庙</van-radio>
-            <van-radio name="4" checked-color="#fd6740" :disabled="isReadonly">西丽</van-radio>
-        </van-radio-group>
-    </div>
-</template>
-
-<script>
-    import { Row, Col,
-        CellGroup, Field,
-        RadioGroup, Radio,
-        Toast
-    } from 'vant';
-    import {BasicFunction} from "../connector/basic-service";
-
-    export default {
-        name: "schoolidCard",
-        components: {
-
-            [CellGroup.name]: CellGroup, [Field.name]: Field,
-            [RadioGroup.name]: RadioGroup, [Radio.name]: Radio,
-            [Row.name]: Row, [Col.name]: Col,
-
-        },
-        data() {
-            return {
-                gender: '0',
-                dormDistrict: '1',
-                personName: '',
-                personError: false,
-                weixinName: '',
-                weixinError: false,
-                isReadonly: true,
-                userDo: {},
-                reviewDo: {},
-            }
-        },
-        methods: {
-            uploadNameChange: function () {
-                let that = this;
-                BasicFunction.get_data("smartUsers/updateBatch", function (response) {
-                    console.log("------ Data Rcvd in uploadNameChange --------");
-                    console.log(response);
-                    if (response.ret === "10000") {
-                        that.isReadonly = true;
-                        Toast.success("上传成功")
-                    } else {
-                        Toast.fail("上传失败,请检查网络");
-                    }
-                }, [this.userDo]);
-            },
-            uploadReviewChange: function () {
-                let that = this;
-                BasicFunction.get_data("smartIdentity/updateBatch", function (response) {
-                    console.log("------ Data Rcvd in uploadReviewChange --------");
-                    console.log(response);
-                    if (response.ret === "10000") {
-                        //history.go(0);
-                        that.isReadonly = true;
-                        Toast.success("上传成功")
-                    } else {
-                        Toast.fail("上传失败,请检查网络");
-                    }
-                }, [this.reviewDo]);
-            },
-            toggleReadOnly: function () {
-                if (!this.isReadonly){
-                    this.savePage()
-                }
-                this.isReadonly =  !this.isReadonly;
-            },
-            savePage() {
-                // 检验输入
-                // var userId = localStorage.getItem(....
-                if (this.personName.length === 0) {
-                    this.personError = true;
-                    return;
-                } else if (this.weixinName.length >= 20) {
-                    this.weixinError = true;
-                    Toast.fail('最多输入20个字符');
-                    return;
-                }
-                // post_present()
-                this.userDo.name = this.personName;  // changed to personName instead.
-                this.uploadNameChange();
-                this.reviewDo.userSex = parseInt(this.gender); // TODO: 请注意 int <-> string 转换
-                this.reviewDo.dormDistrict = parseInt(this.dormDistrict);
-                this.uploadReviewChange();
-
-            },
-            getIdentityInfo: function (obj) {
-                //this;
-                if (!localStorage.getItem('frontend-userid')) {
-                    this.$router.push('login');
-                    return;
-                }
-                let userId = localStorage.getItem("frontend-userid");
-                let that = this;
-                BasicFunction.get_data("smartUsers/list?uid=" + userId, function (response) {
-                    console.log("------ Data Rcvd in getIdentityInfo --------");
-                    console.log(response);
-                    if (response.ret === "10000") {
-                        var t = response.model.list;
-                        that.personName = t[0].name; // 左侧是vue页面内的变量名字, 右侧是后台数据里的变量名称
-                        that.userDo = t[0];
-                    } else {
-                        // 注册失败的处理
-                        Toast.fail("获取失败,请检查网络");
-                    }
-                }, [{}]);
-            },
-            getReviewInfo:function (obj) {
-                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 --------");
-                    console.log(response);
-                    if (response.ret === "10000") {
-                        var t = response.model.list;
-                        that.gender = ""+t[0].userSex; // 左侧是vue页面内的变量名字, 右侧是后台数据里的变量名称
-                        that.dormDistrict = ""+t[0].dormDistrict; //TODO: 请注意文本数字转换
-                        that.reviewDo = t[0];
-                    } else {
-                        Toast.fail("获取失败,请检查网络");
-                    }
-                }, [{}]);
-            }
-        },
-
-        created: function () {
-            if (!localStorage.getItem('frontend-userid')) {
-                this.$router.push('login');
-                return;
-            }
-            let that = this;
-            this.getIdentityInfo(that);
-            this.getReviewInfo(that);
-        }
-    }
-</script>
-
-<style scoped>
-    p, h3 {
-        color: #fd6740;
-    }
-
-    h3 {
-        padding: 5px;
-        border-bottom: solid 1px #e4e4e4;
-    }
-
-    p {
-        padding-top: 3px;
-    }
-
-    .card {
-        background-color: white;
-        margin: 20px 20px;
-        border: solid 1px #e4e4e4;
-        padding: 15px;
-        text-align: left;
-    }
+<template>
+    <div class="card" style="margin-bottom: 20px">
+        <van-row>
+            <van-col span="14">
+                <h3><strong>个人资料</strong></h3>
+            </van-col>
+            <van-col span="6" style="">
+                <p style="border-bottom: solid 1px #e4e4e4" @click="toggleReadOnly()">{{isReadonly ? "编辑" : "保存"}}</p>
+            </van-col>
+        </van-row>
+        <p>昵称</p>
+        <van-cell-group>
+            <van-field
+                    placeholder="请输入昵称"
+                    v-model="personName"
+                    :error="personError"
+                    @click="personError=false"
+                    required
+                    maxlength="10"
+                    :readonly="isReadonly"
+            />
+        </van-cell-group>
+        <p>性别</p>
+        <van-radio-group v-model="gender">
+            <van-radio name="0" checked-color="#fd6740" style="float: left; margin-right: 20px" :disabled="isReadonly">男</van-radio>
+            <van-radio name="1" checked-color="#fd6740" :disabled="isReadonly">女</van-radio>
+        </van-radio-group>
+        <p>微信号</p>
+        <van-cell-group>
+            <van-field
+                    placeholder=" "
+                    v-model="weixinName"
+                    :error="weixinError"
+                    @click="weixinError=false"
+                    required
+                    maxlength="20"
+                    :readonly="isReadonly"
+            />
+        </van-cell-group>
+        <p>宿舍区</p>
+            <van-radio-group v-model="dormDistrict">
+            <van-radio name="0" checked-color="#fd6740" style="float: left; margin-right: 20px" :disabled="isReadonly">南区</van-radio>
+            <van-radio name="1" checked-color="#fd6740" style="float: left; margin-right: 20px" :disabled="isReadonly">西南</van-radio>
+            <van-radio name="2" checked-color="#fd6740" style="float: left; margin-right: 20px" :disabled="isReadonly">斋区</van-radio>
+            <van-radio name="3" checked-color="#fd6740" style="float: left; margin-right: 20px" :disabled="isReadonly">桂庙</van-radio>
+            <van-radio name="4" checked-color="#fd6740" :disabled="isReadonly">西丽</van-radio>
+        </van-radio-group>
+    </div>
+</template>
+
+<script>
+    import { Row, Col,
+        CellGroup, Field,
+        RadioGroup, Radio,
+        Toast
+    } from 'vant';
+    import {BasicFunction} from "../connector/basic-service";
+
+    export default {
+        name: "schoolidCard",
+        components: {
+
+            [CellGroup.name]: CellGroup, [Field.name]: Field,
+            [RadioGroup.name]: RadioGroup, [Radio.name]: Radio,
+            [Row.name]: Row, [Col.name]: Col,
+
+        },
+        data() {
+            return {
+                gender: '0',
+                dormDistrict: '1',
+                personName: '',
+                personError: false,
+                weixinName: '',
+                weixinError: false,
+                isReadonly: true,
+                userDo: {},
+                reviewDo: {},
+            }
+        },
+        methods: {
+            uploadNameChange: function () {
+                let that = this;
+                BasicFunction.get_data("smartUsers/updateBatch", function (response) {
+                    console.log("------ Data Rcvd in uploadNameChange --------");
+                    console.log(response);
+                    if (response.ret === "10000") {
+                        that.isReadonly = true;
+                        Toast.success("上传成功")
+                    } else {
+                        Toast.fail("上传失败,请检查网络");
+                    }
+                }, [this.userDo]);
+            },
+            uploadReviewChange: function () {
+                let that = this;
+                BasicFunction.get_data("smartIdentity/updateBatch", function (response) {
+                    console.log("------ Data Rcvd in uploadReviewChange --------");
+                    console.log(response);
+                    if (response.ret === "10000") {
+                        //history.go(0);
+                        that.isReadonly = true;
+                        Toast.success("上传成功")
+                    } else {
+                        Toast.fail("上传失败,请检查网络");
+                    }
+                }, [this.reviewDo]);
+            },
+            toggleReadOnly: function () {
+                if (!this.isReadonly){
+                    this.savePage()
+                }
+                this.isReadonly =  !this.isReadonly;
+            },
+            savePage() {
+                // 检验输入
+                // var userId = localStorage.getItem(....
+                if (this.personName.length === 0) {
+                    this.personError = true;
+                    return;
+                } else if (this.weixinName.length >= 20) {
+                    this.weixinError = true;
+                    Toast.fail('最多输入20个字符');
+                    return;
+                }
+                // post_present()
+                this.userDo.name = this.personName;  // changed to personName instead.
+                this.uploadNameChange();
+                this.reviewDo.userSex = parseInt(this.gender); // TODO: 请注意 int <-> string 转换
+                this.reviewDo.dormDistrict = parseInt(this.dormDistrict);
+                this.uploadReviewChange();
+
+            },
+            getIdentityInfo: function (obj) {
+                //this;
+                if (!localStorage.getItem('frontend-userid')) {
+                    this.$router.push('login');
+                    return;
+                }
+                let userId = localStorage.getItem("frontend-userid");
+                let that = this;
+                BasicFunction.get_data("smartUsers/list?uid=" + userId, function (response) {
+                    console.log("------ Data Rcvd in getIdentityInfo --------");
+                    console.log(response);
+                    if (response.ret === "10000") {
+                        var t = response.model.list;
+                        that.personName = t[0].name; // 左侧是vue页面内的变量名字, 右侧是后台数据里的变量名称
+                        that.userDo = t[0];
+                    } else {
+                        // 注册失败的处理
+                        Toast.fail("获取失败,请检查网络");
+                    }
+                }, [{}]);
+            },
+            getReviewInfo:function (obj) {
+                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 --------");
+                    console.log(response);
+                    if (response.ret === "10000") {
+                        var t = response.model.list;
+                        that.gender = ""+t[0].userSex; // 左侧是vue页面内的变量名字, 右侧是后台数据里的变量名称
+                        that.dormDistrict = ""+t[0].dormDistrict; //TODO: 请注意文本数字转换
+                        that.reviewDo = t[0];
+                    } else {
+                        Toast.fail("获取失败,请检查网络");
+                    }
+                }, [{}]);
+            }
+        },
+
+        created: function () {
+            if (!localStorage.getItem('frontend-userid')) {
+                this.$router.push('login');
+                return;
+            }
+            let that = this;
+            this.getIdentityInfo(that);
+            this.getReviewInfo(that);
+        }
+    }
+</script>
+
+<style scoped>
+    p, h3 {
+        color: #fd6740;
+    }
+
+    h3 {
+        padding: 5px;
+        border-bottom: solid 1px #e4e4e4;
+    }
+
+    p {
+        padding-top: 3px;
+    }
+
+    .card {
+        background-color: white;
+        margin: 20px 20px;
+        border: solid 1px #e4e4e4;
+        padding: 15px;
+        text-align: left;
+    }
 </style>

+ 442 - 442
sourcecode/h5app/vue/src/connector/basic-service.js

@@ -1,443 +1,443 @@
-/**
- *
- *  Basic
- *  所有页面的共用基础功能
- *  // TODO: 文件名可能需要修改
- *  // TODO: failing ES-Lint
- *  // TODO: Automated Test
- *
- *  dependency:
- *  jQuery (ajax, selector)
- *
- *  @ jason.lu
- * */
-
-import 'whatwg-fetch';
-
-var BasicFunction = new (function () {
-
-    this.Queue = {
-        THRESHOLD: 1000,
-        IS_LOADED: false,
-        nowuse: 0, SVR_URL: "/server/",
-        groupsCount: 0, groups: [],
-        shouldStop: false,
-        backup: ["/server/",
-            "http://127.0.0.1:8866/server/",
-            "http://south.niimei.com:8866/server/",
-            "https://4.niimei.com/server/"],
-        list: [], temporary: 0, errorCount: 0
-    };
-
-    this.Users = {list: []};
-    this.Sectors = {list: []};
-    this.AlertClosingTimeout = 0;
-
-    this.loglog = function (a) {
-        console.log(a);
-    };
-
-    this.logwarn = function (obj) {
-        console.warn(obj);
-    };
-
-    this.logerror = function (obj) {
-        console.warn(obj);
-    };
-
-    this.logtrace = function () {
-        console.trace();
-    };
-
-    this.logverbose = function () {
-        // Not Echoing
-    };
-
-    this.asserThat = function(cond, why) {
-        console.assert(cond, why);
-    };
-
-
-    this.goajax = function (jqObject) {
-        return fetch(jqObject.url, {
-            method: 'POST',
-            headers: {
-                'Content-Type': 'application/json',
-                //'x-doiby-authenticate' : 'CISICMIEINAOQPMDPWIDNENU'
-            },
-            body: jqObject.data
-        });
-    };
-
-    this.utils_get_param = function (name) {
-        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
-        var r = window.location.search.substr(1).match(reg);
-        if (r != null) return unescape(r[2]);
-        return null;
-    };
-
-    this.reloadPage = function () {
-        location.reload()
-    };
-
-    this.get_server_url = function () {
-        // AJAX
-        this.output = this.goajax({url: this.Queue.SVR_URL + "fcFlow/list", timeout: 1000})
-            .then(this.checkStatus)
-            .then(this.parseJson)
-            .then(this.onReachServer)
-            .catch(this.onCheckFail);
-        // .then(BasicFunction.onCheckFail);
-    };
-
-    this.onReachServer = function () {
-        BasicFunction.Queue.IS_LOADED = true;
-        BasicFunction.logwarn("Using SERVER : ");
-        BasicFunction.logwarn(BasicFunction.Queue.SVR_URL);
-        setTimeout(BasicFunction.parse_queue, 50, BasicFunction);
-    };
-
-    this.onCheckFail = function (errmsg) {
-        if (BasicFunction.Queue.nowuse === BasicFunction.Queue.backup.length - 1) {
-            BasicFunction.logwarn("Backup Failed : " + BasicFunction.Queue.backup[BasicFunction.Queue.nowuse]);
-            BasicFunction.logwarn(this);
-            var out = "";
-            BasicFunction.Queue.backup.forEach(function (val, index) {
-                out += index + ":[" +val +"] \n";
-            });
-            BasicFunction.logerror("抱歉, 服务器连接失败! \n 请确认 "+ out +" 其中之一可用");
-        } else {
-            BasicFunction.loglog(errmsg);
-            BasicFunction.Queue.nowuse++;
-            BasicFunction.Queue.SVR_URL = BasicFunction.Queue.backup[BasicFunction.Queue.nowuse];
-            // AJAX
-            BasicFunction.goajax({url: BasicFunction.Queue.SVR_URL + "fcFlow/list", timeout: 1000})
-                .then(BasicFunction.checkStatus)
-                .then(function (response) {return response.json();} )
-                .then(BasicFunction.onReachServer)
-                .catch(BasicFunction.onCheckFail);
-        }
-    };
-
-    this.get_data = function (url, callback, data, onescope) {
-        console.log('calling get_data()');
-        let jsonData = data;
-        if(typeof data != "string"){
-            jsonData = JSON.stringify(jsonData);
-        }
-        BasicFunction.Queue.list.push({url: url, callback: callback, gid: -1, data: jsonData, scope: onescope});
-    };
-
-    this.new_data_group = function (groupName, callback) {
-        let gid = -1;
-        BasicFunction.Queue.groups.forEach(function (val) {
-            if (val.groupName === groupName) {
-                gid = val.gid;
-            }
-        });
-        if (gid === -1) {
-            gid = BasicFunction.Queue.groupsCount;
-            BasicFunction.Queue.groupsCount++;
-            BasicFunction.Queue.groups.push({
-                gid: gid, groupName: groupName, callme: callback, counter: 0
-            });
-        }
-        return gid;
-    };
-
-    this.group_get_data = function (groupName, url, callback) {
-        let gid = -1;
-        BasicFunction.Queue.groups.forEach(function (val) {
-            if (val.groupName === groupName) {
-                gid = val.gid;
-            }
-        });
-        if (gid === -1) {
-            BasicFunction.send_alert("Group 方法使用错误!!!")
-        }
-        BasicFunction.Queue.list.push({url: url, callback: callback, gid: gid});
-    };
-
-    this.parse_queue = function () {
-        BasicFunction.logverbose("Queue Length : " + BasicFunction.Queue.list.length);
-
-        if (BasicFunction.Queue.temporary > new Date().getTime()) {
-            for (let i = 0; i < BasicFunction.Queue.list.length; i++) {
-                BasicFunction.Queue.list.pop();
-            }
-        }
-
-        BasicFunction.Queue.temporary = 0;
-
-        if (BasicFunction.Queue.list.length > 0) {
-            let one = BasicFunction.Queue.list.pop();
-            if (one.gid === -1) {
-                request_data(one.url, one.callback, one.data, one.scope);
-            } else {
-                g_request_data(one.url, one.callback, one.gid, one.data, one.scope);
-            }
-        }
-        if (BasicFunction.Queue.shouldStop === false) {
-            setTimeout(BasicFunction.parse_queue, 50);
-        }
-    };
-
-    this.parseJSON = function(response) {
-        return response.json();
-    };
-
-    this.checkStatus = function(response) {
-        if (response.status >= 200 && response.status < 300) {
-            return response;
-        }
-
-        const error = new Error(response.statusText);
-        error.response = response;
-        throw error;
-    };
-
-    function request_data(url, callback, data, scope) {
-        BasicFunction.goajax({
-            url: BasicFunction.Queue.SVR_URL + url,
-            apiName: url,
-            data: data,
-            scope: scope,
-            sendTime: new Date()
-        }).then(BasicFunction.checkStatus)
-            .then(BasicFunction.parseJson)
-            .then(function(response){return response.json()})
-            .then(callback)
-            .catch(BasicFunction.on_fail);
-    }
-
-    function g_request_data(url, callback, gid) {
-        BasicFunction.goajax({
-            url: BasicFunction.Queue.SVR_URL + url,
-            apiName: url,
-            sendTime: new Date(),
-            gid: gid,
-            callme: callback
-        }).then(BasicFunction.checkStatus)
-            .then(BasicFunction.parseJson)
-            .then(function(response){return response.json()})
-            .then(BasicFunction.onReqeustDataReceived)
-            .then(callback)
-            .catch(BasicFunction.on_fail);
-    }
-
-    this.on_gp_success = function(response) {
-        let obj = response.json();
-        return obj;
-    };
-
-    this.onReqeustDataReceived = function(responseJson) {
-        console.warn(responseJson);
-        let a = responseJson;
-        if (!BasicFunction.check_if_authfail(a)) {
-            const error = new Error(responseJson.statusText);
-            error.response = responseJson;
-            throw error;
-        }
-        if (!BasicFunction.check_if_success(a)) {
-            const error = new Error(responseJson.statusText);
-            error.response = responseJson;
-            throw error;
-        }
-        return responseJson;
-        //     BasicFunction.setCookieWithTimeout("doibyUser", "", -10);
-        //     location.href = "sign-in1.html?from=entrance-5&msg=server-redirect-detected";
-        //     return;
-    };
-
-    this.check_if_authfail = function (errormsg) {
-        BasicFunction.logerror(errormsg);
-        let a = errormsg;
-        if (a == null || typeof a !== "string") {
-            return false;
-        } else {
-            if (a.indexOf("login?from=") > 0 || a.startsWith("<!DOCTYPE html>") || a.indexOf("<!-- SME::LOGINPAGE -->") > 0) {
-                return true;
-            }
-        }
-        return false;
-    };
-
-    this.check_if_success = function (response) {
-        // this == BasicFunction
-        BasicFunction.loglog("---------------Check-If-Success----------------");
-        let a = response.json();
-        let b = response.status;
-        if (typeof a === "string") {
-            try {
-                a = JSON.parse(a);
-            } catch (e) {
-                BasicFunction.logwarn("=----------   异常   -----------=");
-                BasicFunction.logwarn(a);
-                BasicFunction.logwarn("=----------------------------=");
-                BasicFunction.send_alert("信息失败 : 1 : " + e);
-                return;
-            }
-        } else if (typeof a === "undefined") {
-            BasicFunction.logwarn("=----------   异常   -----------=");
-            BasicFunction.logwarn(a);
-            BasicFunction.logwarn("=------------------------------=");
-            BasicFunction.logwarn(b);
-            BasicFunction.logwarn("=------------------------------=");
-            BasicFunction.send_alert("信息失败 - 2 " );
-            return;
-        }
-        if (a.ret === "10000") {
-            return true;
-        } else {
-            BasicFunction.logtrace();
-            BasicFunction.logerror(b);
-            BasicFunction.logerror(JSON.stringify(a));
-            BasicFunction.send_alert("查询失败 : 请参阅控制台输出! ");
-        }
-
-        return false;
-    };
-
-    this.on_fail = function (msg) {
-        BasicFunction.Queue.errorCount += 1;
-        if (BasicFunction.Queue.errorCount >= 10) {
-            BasicFunction.Queue.errorCount = 0;
-            BasicFunction.Queue.temporary = new Date().getTime() + 30 * 1000;
-            BasicFunction.Queue.shouldStop = true;
-            BasicFunction.logwarn("-----  Too many failure, temporary stop HTTP ------");
-            BasicFunction.send_alert("很抱歉,网络错误数量过多,暂时终止HTTP功能30s");
-        }
-        BasicFunction.send_alert(" 很抱歉,网络错误,请查看 Console");
-        BasicFunction.logwarn("-----   网络请求失败 ---------");
-        BasicFunction.logwarn("-----------msg-------------");
-        BasicFunction.logwarn(JSON.stringify(msg));
-        BasicFunction.logwarn("----------------------------");
-    };
-
-    this.first_parse = function (ajax, obj) {
-        if (typeof obj === "string") {
-            obj = JSON.parse(obj);
-        }
-
-        if (typeof obj !== "object") {
-            BasicFunction.logwarn(ajax);
-            throw "Error ! Parsing JSON failed ." + JSON.stringify(obj);
-        }
-
-        if (obj.ret === "10000") {
-            return obj.model;
-        } else {
-            BasicFunction.logwarn(ajax);
-            throw "Error ! Server returned error." + JSON.stringify(obj);
-        }
-    };
-
-    this.send_alert = function (a, b) {
-        if (BasicFunction.Queue.shouldStop) return;
-        if (BasicFunction.AlertClosingTimeout > 0) {
-            clearTimeout(BasicFunction.AlertClosingTimeout);
-        }
-        BasicFunction.logwarn(a);
-        BasicFunction.logwarn(b);
-        // alert(a +"\n"+ b);
-        BasicFunction.AlertClosingTimeout = setTimeout(function () {
-            //$("#mpAlert").hide();
-        }, 10000);
-
-    };
-
-    this.getUserName = function (uid) {
-        let uname = null;
-        BasicFunction.Users.list.forEach(function (val, aid) {
-            BasicFunction.loglog(aid);
-            if (val.worker.staffId === uid) {
-                uname = val.worker.staffName;
-            }
-        });
-        if (uname == null) {
-            if (uid !== 0) {
-                BasicFunction.get_data("oaStaff/list?staffId=" + uid, BasicFunction.on_username_retn);
-                return "[用户:" + uid + "]";
-            } else return "[用户:" + uid + "]";
-        } else {
-            return uname;
-        }
-    };
-
-    this.on_username_retn = function (obj) {
-        let uid = this.url.substring(this.url.indexOf("staffId=") + 8);
-        let ruid = parseInt(uid);
-        let out = BasicFunction.first_parse(this, obj);
-        if (out.list.length > 0) {
-            BasicFunction.Users.list.push({
-                uid: ruid, worker: out.list[0]
-            });
-        }
-    };
-
-    this.setCookieWithTimeout = function (name, value, liveMinutes) {
-        if (liveMinutes === undefined || liveMinutes == null) {
-            liveMinutes = 60 * 2;
-        }
-        if (typeof (liveMinutes) !== 'number') {
-            liveMinutes = 60 * 2;//默认120分钟
-        }
-        let minutes = liveMinutes * 60 * 1000;
-        let exp = new Date();
-        exp.setTime(exp.getTime() + minutes + 8 * 3600 * 1000);
-        //path=/表示全站有效,而不是当前页
-        document.cookie = name + "=" + value + ";path=/;expires=" + exp.toUTCString();
-    };
-
-    this.setCookie = function (c_name, value, expiredays) {
-        let exdate = new Date();
-        exdate.setDate(exdate.getDate() + expiredays);
-        document.cookie = c_name + "=" + escape(value) +
-            ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString())
-    };
-
-    this.getCookie = function (c_name) {
-        if (document.cookie.length > 0) {
-            let c_start = document.cookie.indexOf(c_name + "=");
-            if (c_start !== -1) {
-                c_start = c_start + c_name.length + 1;
-                let c_end = document.cookie.indexOf(";", c_start);
-                if (c_end === -1) c_end = document.cookie.length;
-                return unescape(document.cookie.substring(c_start, c_end))
-            }
-        }
-        return "";
-    };
-
-    /*this.userId = utils_get_param("userId");
-
-    this.getUserId = function() {
-         BasicFunction.loglog("Original  USERID : " + userId);
-        let use = getCookie("doibyUser");
-        if (use == null || use === undefined || use.length <= 0) {
-            location.href = "sign-in1.html?from=entrance-1&msg=nologin-mustauth";
-            return;
-        }
-         BasicFunction.loglog("Got UID From COOKIE : " + use);
-        try {
-            let mm = parseInt(use);
-            if (mm > 0) {
-                BasicFunction.userId = mm;
-            }
-        } catch (e) {
-            location.href = "sign-in1.html?from=entrance-1&msg=cookie-wrong-format";
-            return;
-        }
-
-         BasicFunction.loglog("Got UserId Eventually : " + userId);
-    };*/
-
-    this.get_server_url();
-    //this.on_document_load();
-})();
-
-window.BasicFunction = BasicFunction;
-
-export {
-    BasicFunction
+/**
+ *
+ *  Basic
+ *  所有页面的共用基础功能
+ *  // TODO: 文件名可能需要修改
+ *  // TODO: failing ES-Lint
+ *  // TODO: Automated Test
+ *
+ *  dependency:
+ *  jQuery (ajax, selector)
+ *
+ *  @ jason.lu
+ * */
+
+import 'whatwg-fetch';
+
+var BasicFunction = new (function () {
+
+    this.Queue = {
+        THRESHOLD: 1000,
+        IS_LOADED: false,
+        nowuse: 0, SVR_URL: "/server/",
+        groupsCount: 0, groups: [],
+        shouldStop: false,
+        backup: ["/server/",
+            "http://127.0.0.1:8866/server/",
+            "http://south.niimei.com:8866/server/",
+            "https://4.niimei.com/server/"],
+        list: [], temporary: 0, errorCount: 0
+    };
+
+    this.Users = {list: []};
+    this.Sectors = {list: []};
+    this.AlertClosingTimeout = 0;
+
+    this.loglog = function (a) {
+        console.log(a);
+    };
+
+    this.logwarn = function (obj) {
+        console.warn(obj);
+    };
+
+    this.logerror = function (obj) {
+        console.warn(obj);
+    };
+
+    this.logtrace = function () {
+        console.trace();
+    };
+
+    this.logverbose = function () {
+        // Not Echoing
+    };
+
+    this.asserThat = function(cond, why) {
+        console.assert(cond, why);
+    };
+
+
+    this.goajax = function (jqObject) {
+        return fetch(jqObject.url, {
+            method: 'POST',
+            headers: {
+                'Content-Type': 'application/json',
+                //'x-doiby-authenticate' : 'CISICMIEINAOQPMDPWIDNENU'
+            },
+            body: jqObject.data
+        });
+    };
+
+    this.utils_get_param = function (name) {
+        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
+        var r = window.location.search.substr(1).match(reg);
+        if (r != null) return unescape(r[2]);
+        return null;
+    };
+
+    this.reloadPage = function () {
+        location.reload()
+    };
+
+    this.get_server_url = function () {
+        // AJAX
+        this.output = this.goajax({url: this.Queue.SVR_URL + "fcFlow/list", timeout: 1000})
+            .then(this.checkStatus)
+            .then(this.parseJson)
+            .then(this.onReachServer)
+            .catch(this.onCheckFail);
+        // .then(BasicFunction.onCheckFail);
+    };
+
+    this.onReachServer = function () {
+        BasicFunction.Queue.IS_LOADED = true;
+        BasicFunction.logwarn("Using SERVER : ");
+        BasicFunction.logwarn(BasicFunction.Queue.SVR_URL);
+        setTimeout(BasicFunction.parse_queue, 50, BasicFunction);
+    };
+
+    this.onCheckFail = function (errmsg) {
+        if (BasicFunction.Queue.nowuse === BasicFunction.Queue.backup.length - 1) {
+            BasicFunction.logwarn("Backup Failed : " + BasicFunction.Queue.backup[BasicFunction.Queue.nowuse]);
+            BasicFunction.logwarn(this);
+            var out = "";
+            BasicFunction.Queue.backup.forEach(function (val, index) {
+                out += index + ":[" +val +"] \n";
+            });
+            BasicFunction.logerror("抱歉, 服务器连接失败! \n 请确认 "+ out +" 其中之一可用");
+        } else {
+            BasicFunction.loglog(errmsg);
+            BasicFunction.Queue.nowuse++;
+            BasicFunction.Queue.SVR_URL = BasicFunction.Queue.backup[BasicFunction.Queue.nowuse];
+            // AJAX
+            BasicFunction.goajax({url: BasicFunction.Queue.SVR_URL + "fcFlow/list", timeout: 1000})
+                .then(BasicFunction.checkStatus)
+                .then(function (response) {return response.json();} )
+                .then(BasicFunction.onReachServer)
+                .catch(BasicFunction.onCheckFail);
+        }
+    };
+
+    this.get_data = function (url, callback, data, onescope) {
+        console.log('calling get_data()');
+        let jsonData = data;
+        if(typeof data != "string"){
+            jsonData = JSON.stringify(jsonData);
+        }
+        BasicFunction.Queue.list.push({url: url, callback: callback, gid: -1, data: jsonData, scope: onescope});
+    };
+
+    this.new_data_group = function (groupName, callback) {
+        let gid = -1;
+        BasicFunction.Queue.groups.forEach(function (val) {
+            if (val.groupName === groupName) {
+                gid = val.gid;
+            }
+        });
+        if (gid === -1) {
+            gid = BasicFunction.Queue.groupsCount;
+            BasicFunction.Queue.groupsCount++;
+            BasicFunction.Queue.groups.push({
+                gid: gid, groupName: groupName, callme: callback, counter: 0
+            });
+        }
+        return gid;
+    };
+
+    this.group_get_data = function (groupName, url, callback) {
+        let gid = -1;
+        BasicFunction.Queue.groups.forEach(function (val) {
+            if (val.groupName === groupName) {
+                gid = val.gid;
+            }
+        });
+        if (gid === -1) {
+            BasicFunction.send_alert("Group 方法使用错误!!!")
+        }
+        BasicFunction.Queue.list.push({url: url, callback: callback, gid: gid});
+    };
+
+    this.parse_queue = function () {
+        BasicFunction.logverbose("Queue Length : " + BasicFunction.Queue.list.length);
+
+        if (BasicFunction.Queue.temporary > new Date().getTime()) {
+            for (let i = 0; i < BasicFunction.Queue.list.length; i++) {
+                BasicFunction.Queue.list.pop();
+            }
+        }
+
+        BasicFunction.Queue.temporary = 0;
+
+        if (BasicFunction.Queue.list.length > 0) {
+            let one = BasicFunction.Queue.list.pop();
+            if (one.gid === -1) {
+                request_data(one.url, one.callback, one.data, one.scope);
+            } else {
+                g_request_data(one.url, one.callback, one.gid, one.data, one.scope);
+            }
+        }
+        if (BasicFunction.Queue.shouldStop === false) {
+            setTimeout(BasicFunction.parse_queue, 50);
+        }
+    };
+
+    this.parseJSON = function(response) {
+        return response.json();
+    };
+
+    this.checkStatus = function(response) {
+        if (response.status >= 200 && response.status < 300) {
+            return response;
+        }
+
+        const error = new Error(response.statusText);
+        error.response = response;
+        throw error;
+    };
+
+    function request_data(url, callback, data, scope) {
+        BasicFunction.goajax({
+            url: BasicFunction.Queue.SVR_URL + url,
+            apiName: url,
+            data: data,
+            scope: scope,
+            sendTime: new Date()
+        }).then(BasicFunction.checkStatus)
+            .then(BasicFunction.parseJson)
+            .then(function(response){return response.json()})
+            .then(callback)
+            .catch(BasicFunction.on_fail);
+    }
+
+    function g_request_data(url, callback, gid) {
+        BasicFunction.goajax({
+            url: BasicFunction.Queue.SVR_URL + url,
+            apiName: url,
+            sendTime: new Date(),
+            gid: gid,
+            callme: callback
+        }).then(BasicFunction.checkStatus)
+            .then(BasicFunction.parseJson)
+            .then(function(response){return response.json()})
+            .then(BasicFunction.onReqeustDataReceived)
+            .then(callback)
+            .catch(BasicFunction.on_fail);
+    }
+
+    this.on_gp_success = function(response) {
+        let obj = response.json();
+        return obj;
+    };
+
+    this.onReqeustDataReceived = function(responseJson) {
+        console.warn(responseJson);
+        let a = responseJson;
+        if (!BasicFunction.check_if_authfail(a)) {
+            const error = new Error(responseJson.statusText);
+            error.response = responseJson;
+            throw error;
+        }
+        if (!BasicFunction.check_if_success(a)) {
+            const error = new Error(responseJson.statusText);
+            error.response = responseJson;
+            throw error;
+        }
+        return responseJson;
+        //     BasicFunction.setCookieWithTimeout("doibyUser", "", -10);
+        //     location.href = "sign-in1.html?from=entrance-5&msg=server-redirect-detected";
+        //     return;
+    };
+
+    this.check_if_authfail = function (errormsg) {
+        BasicFunction.logerror(errormsg);
+        let a = errormsg;
+        if (a == null || typeof a !== "string") {
+            return false;
+        } else {
+            if (a.indexOf("login?from=") > 0 || a.startsWith("<!DOCTYPE html>") || a.indexOf("<!-- SME::LOGINPAGE -->") > 0) {
+                return true;
+            }
+        }
+        return false;
+    };
+
+    this.check_if_success = function (response) {
+        // this == BasicFunction
+        BasicFunction.loglog("---------------Check-If-Success----------------");
+        let a = response.json();
+        let b = response.status;
+        if (typeof a === "string") {
+            try {
+                a = JSON.parse(a);
+            } catch (e) {
+                BasicFunction.logwarn("=----------   异常   -----------=");
+                BasicFunction.logwarn(a);
+                BasicFunction.logwarn("=----------------------------=");
+                BasicFunction.send_alert("信息失败 : 1 : " + e);
+                return;
+            }
+        } else if (typeof a === "undefined") {
+            BasicFunction.logwarn("=----------   异常   -----------=");
+            BasicFunction.logwarn(a);
+            BasicFunction.logwarn("=------------------------------=");
+            BasicFunction.logwarn(b);
+            BasicFunction.logwarn("=------------------------------=");
+            BasicFunction.send_alert("信息失败 - 2 " );
+            return;
+        }
+        if (a.ret === "10000") {
+            return true;
+        } else {
+            BasicFunction.logtrace();
+            BasicFunction.logerror(b);
+            BasicFunction.logerror(JSON.stringify(a));
+            BasicFunction.send_alert("查询失败 : 请参阅控制台输出! ");
+        }
+
+        return false;
+    };
+
+    this.on_fail = function (msg) {
+        BasicFunction.Queue.errorCount += 1;
+        if (BasicFunction.Queue.errorCount >= 10) {
+            BasicFunction.Queue.errorCount = 0;
+            BasicFunction.Queue.temporary = new Date().getTime() + 30 * 1000;
+            BasicFunction.Queue.shouldStop = true;
+            BasicFunction.logwarn("-----  Too many failure, temporary stop HTTP ------");
+            BasicFunction.send_alert("很抱歉,网络错误数量过多,暂时终止HTTP功能30s");
+        }
+        BasicFunction.send_alert(" 很抱歉,网络错误,请查看 Console");
+        BasicFunction.logwarn("-----   网络请求失败 ---------");
+        BasicFunction.logwarn("-----------msg-------------");
+        BasicFunction.logwarn(JSON.stringify(msg));
+        BasicFunction.logwarn("----------------------------");
+    };
+
+    this.first_parse = function (ajax, obj) {
+        if (typeof obj === "string") {
+            obj = JSON.parse(obj);
+        }
+
+        if (typeof obj !== "object") {
+            BasicFunction.logwarn(ajax);
+            throw "Error ! Parsing JSON failed ." + JSON.stringify(obj);
+        }
+
+        if (obj.ret === "10000") {
+            return obj.model;
+        } else {
+            BasicFunction.logwarn(ajax);
+            throw "Error ! Server returned error." + JSON.stringify(obj);
+        }
+    };
+
+    this.send_alert = function (a, b) {
+        if (BasicFunction.Queue.shouldStop) return;
+        if (BasicFunction.AlertClosingTimeout > 0) {
+            clearTimeout(BasicFunction.AlertClosingTimeout);
+        }
+        BasicFunction.logwarn(a);
+        BasicFunction.logwarn(b);
+        // alert(a +"\n"+ b);
+        BasicFunction.AlertClosingTimeout = setTimeout(function () {
+            //$("#mpAlert").hide();
+        }, 10000);
+
+    };
+
+    this.getUserName = function (uid) {
+        let uname = null;
+        BasicFunction.Users.list.forEach(function (val, aid) {
+            BasicFunction.loglog(aid);
+            if (val.worker.staffId === uid) {
+                uname = val.worker.staffName;
+            }
+        });
+        if (uname == null) {
+            if (uid !== 0) {
+                BasicFunction.get_data("oaStaff/list?staffId=" + uid, BasicFunction.on_username_retn);
+                return "[用户:" + uid + "]";
+            } else return "[用户:" + uid + "]";
+        } else {
+            return uname;
+        }
+    };
+
+    this.on_username_retn = function (obj) {
+        let uid = this.url.substring(this.url.indexOf("staffId=") + 8);
+        let ruid = parseInt(uid);
+        let out = BasicFunction.first_parse(this, obj);
+        if (out.list.length > 0) {
+            BasicFunction.Users.list.push({
+                uid: ruid, worker: out.list[0]
+            });
+        }
+    };
+
+    this.setCookieWithTimeout = function (name, value, liveMinutes) {
+        if (liveMinutes === undefined || liveMinutes == null) {
+            liveMinutes = 60 * 2;
+        }
+        if (typeof (liveMinutes) !== 'number') {
+            liveMinutes = 60 * 2;//默认120分钟
+        }
+        let minutes = liveMinutes * 60 * 1000;
+        let exp = new Date();
+        exp.setTime(exp.getTime() + minutes + 8 * 3600 * 1000);
+        //path=/表示全站有效,而不是当前页
+        document.cookie = name + "=" + value + ";path=/;expires=" + exp.toUTCString();
+    };
+
+    this.setCookie = function (c_name, value, expiredays) {
+        let exdate = new Date();
+        exdate.setDate(exdate.getDate() + expiredays);
+        document.cookie = c_name + "=" + escape(value) +
+            ((expiredays == null) ? "" : ";expires=" + exdate.toGMTString())
+    };
+
+    this.getCookie = function (c_name) {
+        if (document.cookie.length > 0) {
+            let c_start = document.cookie.indexOf(c_name + "=");
+            if (c_start !== -1) {
+                c_start = c_start + c_name.length + 1;
+                let c_end = document.cookie.indexOf(";", c_start);
+                if (c_end === -1) c_end = document.cookie.length;
+                return unescape(document.cookie.substring(c_start, c_end))
+            }
+        }
+        return "";
+    };
+
+    /*this.userId = utils_get_param("userId");
+
+    this.getUserId = function() {
+         BasicFunction.loglog("Original  USERID : " + userId);
+        let use = getCookie("doibyUser");
+        if (use == null || use === undefined || use.length <= 0) {
+            location.href = "sign-in1.html?from=entrance-1&msg=nologin-mustauth";
+            return;
+        }
+         BasicFunction.loglog("Got UID From COOKIE : " + use);
+        try {
+            let mm = parseInt(use);
+            if (mm > 0) {
+                BasicFunction.userId = mm;
+            }
+        } catch (e) {
+            location.href = "sign-in1.html?from=entrance-1&msg=cookie-wrong-format";
+            return;
+        }
+
+         BasicFunction.loglog("Got UserId Eventually : " + userId);
+    };*/
+
+    this.get_server_url();
+    //this.on_document_load();
+})();
+
+window.BasicFunction = BasicFunction;
+
+export {
+    BasicFunction
 };

+ 251 - 251
sourcecode/h5app/vue/src/connector/data-object.js

@@ -1,252 +1,252 @@
-/***
- * Data Object Related helper classes (vue applicable)
- * dependency:
- *
- * jQuery (ajax, selector)
- */
-
-const DEFAULT = 2;
-const ONDEMAND = 4;
-const AUTO = 8;
-const FAST = 16;
-const PASSIVE = 32;
-
-
-/***
- * DataObject DO
- * @param cname
- * @param serverJsonObj
- * @constructor
- */
-var DataObject = function(cname, serverJsonObj){
-    this.ctlName = cname;
-    this.jsonObj = serverJsonObj;
-    this.getVal = function (key, obj) {
-        return obj.jsonObj[key];
-    };
-    this.serVal = function (key, val, obj) {
-        obj.jsonObj[key] = val;
-    };
-
-};
-
-/***
- * DataObjectList
- * @param name
- * @constructor
- */
-var DataObjectList = function(name){
-    this.ctlName = name;
-    this.list = null;
-    this.isSorted = false;
-    this.preSort = [];
-    /***
-     * sorting
-     * @param comparator (a,b)  =====>  a - b
-     */
-    this.sortBy = function(comparator){
-        this.preSort = new Array();
-        for (let i = 0; i < this.list.length; i++) this.preSort.push(this.list[i]);
-        this.quickSort(this.preSort, 0, this.preSort.length - 1, comparator);
-    };
-
-    this.clearData = function () {
-        this.isSorted = false;
-        this.preSort = null;
-        this.list = null;
-    }
-
-    this.len = function() {
-        if(this.list == null) return 0;
-        return this.list.length;
-    };
-
-    this.mergeJsonData = function (data) {
-        this.list = new Array();
-        for (let i = 0; i < data.length; i++) this.addObject(data[i]);
-    };
-
-    this.addObject = function (jsonObj) {
-        this.list.push(new DataObject(this.ctlName, jsonObj));
-    };
-
-    this.assignJsonData = function (data) {
-        this.clearData();
-        this.mergeJsonData(data);
-    };
-    this.getRaw = function (index) {
-        if(this.list == null) return null;
-        return this.list[index];
-    };
-    this.getSorted = function (index) {
-        if(this.list == null) return null;
-        if(!this.isSorted) return this.getRaw(index);
-        return this.preSort[index];
-    };
-    this.quickSort = function (a,left,right,comp){
-        if(left>right){ //一定要有这个判断,因为有递归left和i-1,若没有这个判断条件,该函数会进入无限死错位递归
-            return;
-        }
-
-        var i=left,
-            j=right,
-            pivot=a[left]; //基准总是取序列开头的元素
-
-        while(i!=j){
-            while((comp(a[j],pivot) > 0)&&i<j){j--}
-            while((comp(a[j],pivot) <= 0)&&i<j){i++}
-            if(i<j){  //如果i==j跳出外层while
-                var t=a[i];
-                a[i]=a[j];
-                a[j]=t;
-            }
-        }
-
-        a[left]=a[i];//交换基准数和k位置上的数
-        a[i]=pivot;
-
-        this.quicksort(a,left,i-1,comp);
-        this.quicksort(a,i+1,right,comp);
-    };
-};
-
-/***
- * DOService
- * @param controlName
- * @constructor
- */
-var DataObjectService = function(controlName, syncType, extparm){
-    this.ctlName    = controlName;
-    // 2=default 4=on-demand, 8=auto, 16:fast, 32=passive
-    this.syncType   = syncType;
-    this.extParm    = extparm;
-    this.isDefault  =  ((syncType & DEFAULT)  !== 0);
-    this.isOnDemand = ((syncType & ONDEMAND)  !== 0);
-    this.isAuto =     ((syncType & AUTO)  !== 0);
-    this.isFast =     ((syncType & FAST) !== 0);
-    this.isPassive  = ((syncType & PASSIVE) !== 0);
-    this.failedCount= 0;
-    this.list       = new DataObjectList(controlName);
-    this.autoUpdateTimer = 0;
-    this.autoInterval = 1000;
-    this.callerThis = this;
-
-    this.setUpInterval = function() {
-        //URL + exparm
-        if(this.autoUpdateTimer != 0) clearInterval(this.autoUpdateTimer);
-        this.autoUpdateTimer = setInterval(this.selfUpdateTick, this.autoInterval, this);
-        setTimeout(this.selfUpdateTick, 1000, this);
-    }
-
-    this.init = function(){
-        this.appUrl = controlName + "/list" + extparm;
-        if(!this.isFast || this.isOnDemand){
-            this.autoInterval = 300;
-        }
-
-        if(this.isFast) {
-            this.appUrl = controlName + "/get" + extparm;
-        }
-
-        if(this.isAuto){
-            // timer
-            this.setUpInterval();
-        }
-    };
-
-    this.stopTimers = function () {
-        clearInterval(this.autoUpdateTimer);
-        this.autoUpdateTimer = 0;
-    };
-
-    /***
-     * Automatica Update Tick, where obj is a replacement for "this" where "this" might be incorrect
-     * @param obj : DataObjectService
-     */
-    this.selfUpdateTick = function(obj){
-        get_data(obj.appUrl, obj.onDataReceived, obj);
-    };
-
-    this.onDemandUpdate = function(obj){
-        get_data(obj.appUrl, obj.onDataReceived, obj);
-    };
-
-    this.onDataReceived = function(data, sta){
-        let obj = this.callerThis;
-        if(obj == undefined){console.error("Cannot get callerThis in onDataReceived, please check"); console.error(this)}
-        let output = first_parse(this, data);
-        if (output.list == undefined || output.list.length == 0) {
-            obj.failedCount++;
-            if(obj.failedCount > 100){
-                obj.failedCount = 0;
-                obj.stopTimers();
-                console.log("[排行榜返回为空git clone https://github.com/pentaho/mondrian-tck.git次数过多],暂停刷新");
-            }
-            if(obj.failedCount == 2) {
-                send_alert("排行榜多次返回没有数据,请尝试重新加载! [" + obj.appUrl +"]");
-            }
-        }else{
-            obj.list.assignJsonData(output.list);
-        }
-    };
-
-    this.getList = function () {
-        return this.list;
-    };
-
-    this.passiveUpdate = function(data){
-        this.failedCount = 0;
-        this.list.assignJsonData(data);
-    };
-
-    this.init();
-};
-
-var SinglePage = function () {
-    this.modules = [];
-};
-
-var Module = function(chartContainerSelector, dataCtlName){
-    this.selector = chartContainerSelector;
-    this.dataCtl = dataCtlName;
-    this.activeData = null;
-    this.lastActive = 0;
-    this.tickInterval = 1000;
-    /***
-     * bindData to UI
-     * @param data DataObjectList
-     */
-    this.setData = function (data) {
-        if(data.ctlName == this.dataCtl){
-            console.log(`-------- Module ${this.selector} got data ----------- `);
-            this.activeData = data;
-            this.drawData(this.activeData);
-        }else{
-            console.log(`-------- Module ${this.selector} cannot use data of ${data.ctlName} ----------- `);
-        }
-    };
-    this.init = function () {
-        // do init
-        this.setupInterval();
-    };
-    this.tick = function () {
-        // do tick
-    };
-    this.setupInterval = function () {
-        // do tick
-        if(this.tickInterval != 0) clearInterval(this.tickInterval);
-        this.tickInterval = setInterval(this.tick, this.tickInterval);
-    };
-    this.drawData = function () {
-        // do drawData
-    };
-};
-
-
-export {
-    DataObjectService,
-    DataObjectList,
-    DataObject,
-    Module,
-    SinglePage
+/***
+ * Data Object Related helper classes (vue applicable)
+ * dependency:
+ *
+ * jQuery (ajax, selector)
+ */
+
+const DEFAULT = 2;
+const ONDEMAND = 4;
+const AUTO = 8;
+const FAST = 16;
+const PASSIVE = 32;
+
+
+/***
+ * DataObject DO
+ * @param cname
+ * @param serverJsonObj
+ * @constructor
+ */
+var DataObject = function(cname, serverJsonObj){
+    this.ctlName = cname;
+    this.jsonObj = serverJsonObj;
+    this.getVal = function (key, obj) {
+        return obj.jsonObj[key];
+    };
+    this.serVal = function (key, val, obj) {
+        obj.jsonObj[key] = val;
+    };
+
+};
+
+/***
+ * DataObjectList
+ * @param name
+ * @constructor
+ */
+var DataObjectList = function(name){
+    this.ctlName = name;
+    this.list = null;
+    this.isSorted = false;
+    this.preSort = [];
+    /***
+     * sorting
+     * @param comparator (a,b)  =====>  a - b
+     */
+    this.sortBy = function(comparator){
+        this.preSort = new Array();
+        for (let i = 0; i < this.list.length; i++) this.preSort.push(this.list[i]);
+        this.quickSort(this.preSort, 0, this.preSort.length - 1, comparator);
+    };
+
+    this.clearData = function () {
+        this.isSorted = false;
+        this.preSort = null;
+        this.list = null;
+    }
+
+    this.len = function() {
+        if(this.list == null) return 0;
+        return this.list.length;
+    };
+
+    this.mergeJsonData = function (data) {
+        this.list = new Array();
+        for (let i = 0; i < data.length; i++) this.addObject(data[i]);
+    };
+
+    this.addObject = function (jsonObj) {
+        this.list.push(new DataObject(this.ctlName, jsonObj));
+    };
+
+    this.assignJsonData = function (data) {
+        this.clearData();
+        this.mergeJsonData(data);
+    };
+    this.getRaw = function (index) {
+        if(this.list == null) return null;
+        return this.list[index];
+    };
+    this.getSorted = function (index) {
+        if(this.list == null) return null;
+        if(!this.isSorted) return this.getRaw(index);
+        return this.preSort[index];
+    };
+    this.quickSort = function (a,left,right,comp){
+        if(left>right){ //一定要有这个判断,因为有递归left和i-1,若没有这个判断条件,该函数会进入无限死错位递归
+            return;
+        }
+
+        var i=left,
+            j=right,
+            pivot=a[left]; //基准总是取序列开头的元素
+
+        while(i!=j){
+            while((comp(a[j],pivot) > 0)&&i<j){j--}
+            while((comp(a[j],pivot) <= 0)&&i<j){i++}
+            if(i<j){  //如果i==j跳出外层while
+                var t=a[i];
+                a[i]=a[j];
+                a[j]=t;
+            }
+        }
+
+        a[left]=a[i];//交换基准数和k位置上的数
+        a[i]=pivot;
+
+        this.quicksort(a,left,i-1,comp);
+        this.quicksort(a,i+1,right,comp);
+    };
+};
+
+/***
+ * DOService
+ * @param controlName
+ * @constructor
+ */
+var DataObjectService = function(controlName, syncType, extparm){
+    this.ctlName    = controlName;
+    // 2=default 4=on-demand, 8=auto, 16:fast, 32=passive
+    this.syncType   = syncType;
+    this.extParm    = extparm;
+    this.isDefault  =  ((syncType & DEFAULT)  !== 0);
+    this.isOnDemand = ((syncType & ONDEMAND)  !== 0);
+    this.isAuto =     ((syncType & AUTO)  !== 0);
+    this.isFast =     ((syncType & FAST) !== 0);
+    this.isPassive  = ((syncType & PASSIVE) !== 0);
+    this.failedCount= 0;
+    this.list       = new DataObjectList(controlName);
+    this.autoUpdateTimer = 0;
+    this.autoInterval = 1000;
+    this.callerThis = this;
+
+    this.setUpInterval = function() {
+        //URL + exparm
+        if(this.autoUpdateTimer != 0) clearInterval(this.autoUpdateTimer);
+        this.autoUpdateTimer = setInterval(this.selfUpdateTick, this.autoInterval, this);
+        setTimeout(this.selfUpdateTick, 1000, this);
+    }
+
+    this.init = function(){
+        this.appUrl = controlName + "/list" + extparm;
+        if(!this.isFast || this.isOnDemand){
+            this.autoInterval = 300;
+        }
+
+        if(this.isFast) {
+            this.appUrl = controlName + "/get" + extparm;
+        }
+
+        if(this.isAuto){
+            // timer
+            this.setUpInterval();
+        }
+    };
+
+    this.stopTimers = function () {
+        clearInterval(this.autoUpdateTimer);
+        this.autoUpdateTimer = 0;
+    };
+
+    /***
+     * Automatica Update Tick, where obj is a replacement for "this" where "this" might be incorrect
+     * @param obj : DataObjectService
+     */
+    this.selfUpdateTick = function(obj){
+        get_data(obj.appUrl, obj.onDataReceived, obj);
+    };
+
+    this.onDemandUpdate = function(obj){
+        get_data(obj.appUrl, obj.onDataReceived, obj);
+    };
+
+    this.onDataReceived = function(data, sta){
+        let obj = this.callerThis;
+        if(obj == undefined){console.error("Cannot get callerThis in onDataReceived, please check"); console.error(this)}
+        let output = first_parse(this, data);
+        if (output.list == undefined || output.list.length == 0) {
+            obj.failedCount++;
+            if(obj.failedCount > 100){
+                obj.failedCount = 0;
+                obj.stopTimers();
+                console.log("[排行榜返回为空git clone https://github.com/pentaho/mondrian-tck.git次数过多],暂停刷新");
+            }
+            if(obj.failedCount == 2) {
+                send_alert("排行榜多次返回没有数据,请尝试重新加载! [" + obj.appUrl +"]");
+            }
+        }else{
+            obj.list.assignJsonData(output.list);
+        }
+    };
+
+    this.getList = function () {
+        return this.list;
+    };
+
+    this.passiveUpdate = function(data){
+        this.failedCount = 0;
+        this.list.assignJsonData(data);
+    };
+
+    this.init();
+};
+
+var SinglePage = function () {
+    this.modules = [];
+};
+
+var Module = function(chartContainerSelector, dataCtlName){
+    this.selector = chartContainerSelector;
+    this.dataCtl = dataCtlName;
+    this.activeData = null;
+    this.lastActive = 0;
+    this.tickInterval = 1000;
+    /***
+     * bindData to UI
+     * @param data DataObjectList
+     */
+    this.setData = function (data) {
+        if(data.ctlName == this.dataCtl){
+            console.log(`-------- Module ${this.selector} got data ----------- `);
+            this.activeData = data;
+            this.drawData(this.activeData);
+        }else{
+            console.log(`-------- Module ${this.selector} cannot use data of ${data.ctlName} ----------- `);
+        }
+    };
+    this.init = function () {
+        // do init
+        this.setupInterval();
+    };
+    this.tick = function () {
+        // do tick
+    };
+    this.setupInterval = function () {
+        // do tick
+        if(this.tickInterval != 0) clearInterval(this.tickInterval);
+        this.tickInterval = setInterval(this.tick, this.tickInterval);
+    };
+    this.drawData = function () {
+        // do drawData
+    };
+};
+
+
+export {
+    DataObjectService,
+    DataObjectList,
+    DataObject,
+    Module,
+    SinglePage
 }

+ 24 - 24
sourcecode/h5app/vue/src/connector/model.md

@@ -1,25 +1,25 @@
-- api: http://south.niimei.com:8866/server
-
-- 返回所有用户信息:url + /smartUsers/list
-- 返回个别用户信息:url + /smartUsers/list?uid=*
-
-## 用户信息
-- uid: 3
-- usn: "cell_13520583918"
-- pss: "64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107"
-- name: "HelloWorld"
-- title: ""
-- priv: "view, order, deliver, pay"
-- state: 0
-- sess: "iOgxGPkFIV3JxBlBfCv"
-- phone: "13520583918"
-- schoolDistrict: null
-- userExpPts: null
-- userGroup: null
-- userVcoin: null
-- registerTime: null
-- lastLoginTime: null
-- wxUnionid: null
-- wxEngineid: null
-- wxOpenid: null
+- api: http://south.niimei.com:8866/server
+
+- 返回所有用户信息:url + /smartUsers/list
+- 返回个别用户信息:url + /smartUsers/list?uid=*
+
+## 用户信息
+- uid: 3
+- usn: "cell_13520583918"
+- pss: "64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107"
+- name: "HelloWorld"
+- title: ""
+- priv: "view, order, deliver, pay"
+- state: 0
+- sess: "iOgxGPkFIV3JxBlBfCv"
+- phone: "13520583918"
+- schoolDistrict: null
+- userExpPts: null
+- userGroup: null
+- userVcoin: null
+- registerTime: null
+- lastLoginTime: null
+- wxUnionid: null
+- wxEngineid: null
+- wxOpenid: null
 - note: null

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

@@ -1,275 +1,275 @@
-/*****
- *
- * Assuming a HTML like
- *
- * <... id="test-app-1">
- *     <... v-for="oneuser in userlist">
- *         {{oneuser.id}} , name: {{oneuser.name}}
- *     </...>
- *
- * </...>
- *
- */
-var test_vue_app = new Vue({
-    el : "test-app-1",
-    data : {
-        userlist : [{id:1, name:"hello"}]
-    }
-});
-
-/******************************************************************************
- //
- // To load directly from JS(jQuery)
- //
- /*****************************************************************************/
-
-function js_load_something(){
-    var uid = 5; //for test.
-    BasicFunction.get_data("smartUsers/list"+"?userId="+uid,
-        /**
-         * 下面的function是访问网络成功后的结果回调,obj 类似
-         *
-         * http://south.niimei.com:8866/server/smartUsers/list
-         * {
-         *   "ret":"10000","detail":null,"field":null,"model":
-         *   {"page":1,"pageSize":15,"totalPage":1,"totalResult":15,
-         *    "list":
-         *      [
-         *        {
-         *       "uid":3,"usn":"cell_13520583918","pss":"64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107",
-         *       "name":"HelloWorld","title":"","priv":"view,order,deliver,pay","state":0,"sess":"iOgxGPkFIV3JxBlBfCv",
-         *       "phone":"13520583918","schoolDistrict":null,"userExpPts":null,"userGroup":null,"userVcoin":null,"registerTime":null,
-         *       "lastLoginTime":null,"wxUnionid":null,"wxEngineid":null,"wxOpenid":null,"note":null
-         *        },
-         *        {..第二条数据..},
-         *        {..第三条数据..}
-         *      ]
-         *    }
-         * }
-         * @param obj
-         */
-        function (obj) {
-            var parsedObj = first_parse(this, obj);
-            if(parsedObj != null && parsedObj != undefined) {
-                test_vue_app = parsedObj.list;
-            } else {
-                // error
-            }
-        } //end of f (obj, status)
-    ); // end of get_data
-}
-
-
-/******************************************************************************
- //
- // To load using DataObject + DataService + Module stuff
- //
- *****************************************************************************/
-
-//Module means some component (need only to draw);
-var test_vue_module = new Module("nothing", "smartUsers");
-test_vue_module.drawData = function (data) {
-    test_vue_app.data.userlist.pop();
-    for(let i = 0; i < data.len(); i++) {
-        test_vue_app.data.userlist.push(data.getSorted(i));
-    }
-} ;
-
-var loader = new (function(){
-
-    /* this is the main data service that is auto-updating your data*/
-    this.userListServ = new DataObjectService("smartUsers", AUTO, "?ext=1");
-
-    // Optional for setting up self-defined interval
-    // this.userListServ.autoInterval = 300;
-    // this.userListServ.setUpInterval();
-
-    /**
-     * load Once, as is.
-     */
-    this.loadOnce = function(){
-        var list = this.userListServ.list;
-        test_vue_module.setData(list);
-    };
-
-    /***
-     * loadOften : to auto-load some data
-     */
-    this.loadOften = function(){
-        // Binding Intervals to DataService
-        this.userListServ.bind(function (data) {
-            // auto call
-            test_vue_module.setData(data);
-        });
-    };
-})();
-
-//To load once
-loader.loadOnce();
-
-//To auto-refresh
-// loader.loadOften();
-
-
-// 上传货品信息
-
-/*
-
-BasicFunction.get_data("smartIdentity/updateBatch", function (response) {
-                console.log("------ Data Rcvd in PresentReg --------");
-                console.log(response);
-                if(response.ret === "10000"){
-                    this.$router.push('index');
-                } else {
-                    // 注册失败的处理
-                    Toast.fail("上传失败,请检查网络");
-                }
-            }, [{"reviewId":1,"userId":1,"dormDistrict":10,
-                "userSex":1,"userSchoolCard":20123333222,
-                "userReviewStatus":1000,
-                "reviewerId":1,"reviewerNote":"nmo",
-                "reviewerNoteToUser":"noo"}]);
-
-
-基本格式
-
-szuhuanhuan2018
-登录  转义密码 就是 encodeURIComponent("实际密码")
-BasicFunction.get_data("ajaxloginu=手机号&p=(转义密码)", 回调函数, {})
-
-注册
-BasicFunction.get_data("ajaxregister?u=手机号&p=转义密码", 回调函数, {})
-
-发送验证码
-BasicFunction.get_data("ajaxsendotp?u=手机号", 回调函数, {})
-
-新建 (数据列表就是 [{...实际数据...}])
-BasicFunction.get_data("数据接口名称/saveBatch", 回调函数, 数据列表)
-
-修改
-BasicFunction.get_data("数据接口名称/updateBatch", 回调函数, 数据列表)
-
-搜索(获取)
-BasicFunction.get_data("数据接口名称/list?条件1=数据1&条件2=数据2&.....", 回调函数, {})
-
-用户数据:
-smartUsers/list
-[{
-"uid":3, // 用户id
-"usn":"13520583918", // 登录用户名
-"pss":"64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107",
-"name":"HelloWorld", // 昵称
-"title":"",
-"priv":"view,order,deliver,pay",
-"state":0, // 状态
-"sess":"iOgxGPkFIV3JxBlBfCv",
-"phone":"13520583918", // 电话号码
-"schoolDistrict":null, // 宿舍区 0: 斋区, 1: 西南, 2: 南区, 3: 西丽
-"userExpPts":null,
-"userGroup":null,
-"userVcoin":null,
-"registerTime":null, // 注册时间
-"lastLoginTime":null,
-"wxUnionid":null,
-"wxEngineid":null,
-"wxOpenid":null,
-"note":null
-},
-
-新建货品:
-smartGoods/saveBatch
-[{
-"goodid":"", // 货品id
-"name":"萌犬毛绒抱枕", // 货品名
-"goodsNo":"A2",
-"modelId":"1",
-"ownerId":"18", // 货品所有者id
-"goodFirstKind":"1000", // 目标性别 男: 0,女: 1
-"goodSecondKind":"2000", // 标签 0~13
-"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", // 是否被删除,0: 未被删 1: 被删,首页不显示
-"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"
-}]
-
-
-新建货品审核单
-smartGoodReview/saveBatch
-[{"reviewId":"","goodId":"3","applicantId":"19","reviewerId":"0","reviewResult":"0","applyTime":"2018-12-10 01:01:01","reviewTime":"2018-12-10 01:01:01","previousReview":"0","reviewNote":"暂未审核","displayNote":"暂未审核"}]
-
-
-新建货品池内条目(入池)
-smartGoodPool/saveBatch
-[{"poolItemId":"","goodId":"3","goodSenderId":"5","goodQuantity":"1","goodQuality":"100","goodFirstKind":"1000","reviewStatus":"1000","goodTargetRole":"1","goodTargetKind":"2","inpoolStatus":"1000"}]
-
-新建评论
-smartOrderFeedback/saveBatch
-[{
-"feedbackId":"",
-"orderId":"13", // 收到的礼物的id
-"goodId":"3",
-"ratingStatus":"1000",
-"ratingMajor":"5", // 评分
-"ratingMinor":"4500",
-"content":"还不错,5颗星", // 评论内容
-"ratingTime":"2018-12-10 01:01:01"
-}]
-
-
-新建用户身份审核单(校园卡审核)
-smartIdentity/saveBatch
-[{
-"reviewId":"",
-"userId":18, // 用户id
-"dormDistrict":1, // 宿舍区 0: 斋区, 1: 西南, 2: 南区, 3: 西丽
-"userSex":1, // 用户性别
-"userSchoolCard":20123333222,
-"userReviewStatus":1000,
-"reviewerId":1,
-"reviewerNote":"nmo",
-"reviewerNoteToUser":"noo"
-}]
-
-
-新建订单(配对成功)
-*** 前端不用操作 ***
-smartOrder/saveBatch
-[{"id":"","userId":"18","paymentId":"0","deliveryId":"0","merchandise":"{}","status":"1","payStatus":"0","distributionStatus":"0","dueAmount":"0.0","paidAmount":"0.0","taxes":"0","payableFreight":"0","realFreight":"0","payFee":"0","promotions":"0","discount":"1","orderAmount":"0","payTime":"2018-12-10 01:01:01","sendTime":"","createTime":"","completionTime":"","acceptTime":"","invoice":"0","invoiceTitle":"","postscript":"","note":"内部匹配","prop":"{}","exp":"0","point":"0","type":"0"}]
-
-统计用(用户点击信息,页面位置+页面按钮/区域代码=clickEvent)
-
-[{"clickId":"","clickEvent":"100001","clickTime":"1544443423082","clickIdentity":"18"}]
-
-
-
-****************
-***** 查找:*****
-****************
-
-
-查找已经准备接收的礼物
-smartOrder/list
-[{"id":28,"userId":3,"paymentId":0,"deliveryId":0,"merchandise":"[{\"q\":1,\"model\":1,\"id\":\"3\",\"spec\":[{\"v\":\"100\",\"i\":1002}]},{\"q\":1,\"model\":1,\"id\":\"6\",\"spec\":[{\"v\":\"350\",\"i\":1002}]}]","status":2,"payStatus":2,"distributionStatus":0,"dueAmount":25.11,"paidAmount":0.0,"taxes":0.0,"payableFreight":0.0,"realFreight":0.0,"payFee":0.0,"promotions":0.49,"discount":1.0,"orderAmount":25.6,"payTime":"2017-12-23 10:38:20","sendTime":"2017-12-23 10:38:20","createTime":"2017-12-23 10:38:20","completionTime":"2017-12-23 10:38:20","acceptTime":"0","invoice":0,"invoiceTitle":"empty","postscript":"","note":"","prop":"{\"wechat\":1}","exp":0,"point":0,"type":1}]
-
-
- */
-
+/*****
+ *
+ * Assuming a HTML like
+ *
+ * <... id="test-app-1">
+ *     <... v-for="oneuser in userlist">
+ *         {{oneuser.id}} , name: {{oneuser.name}}
+ *     </...>
+ *
+ * </...>
+ *
+ */
+var test_vue_app = new Vue({
+    el : "test-app-1",
+    data : {
+        userlist : [{id:1, name:"hello"}]
+    }
+});
+
+/******************************************************************************
+ //
+ // To load directly from JS(jQuery)
+ //
+ /*****************************************************************************/
+
+function js_load_something(){
+    var uid = 5; //for test.
+    BasicFunction.get_data("smartUsers/list"+"?userId="+uid,
+        /**
+         * 下面的function是访问网络成功后的结果回调,obj 类似
+         *
+         * http://south.niimei.com:8866/server/smartUsers/list
+         * {
+         *   "ret":"10000","detail":null,"field":null,"model":
+         *   {"page":1,"pageSize":15,"totalPage":1,"totalResult":15,
+         *    "list":
+         *      [
+         *        {
+         *       "uid":3,"usn":"cell_13520583918","pss":"64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107",
+         *       "name":"HelloWorld","title":"","priv":"view,order,deliver,pay","state":0,"sess":"iOgxGPkFIV3JxBlBfCv",
+         *       "phone":"13520583918","schoolDistrict":null,"userExpPts":null,"userGroup":null,"userVcoin":null,"registerTime":null,
+         *       "lastLoginTime":null,"wxUnionid":null,"wxEngineid":null,"wxOpenid":null,"note":null
+         *        },
+         *        {..第二条数据..},
+         *        {..第三条数据..}
+         *      ]
+         *    }
+         * }
+         * @param obj
+         */
+        function (obj) {
+            var parsedObj = first_parse(this, obj);
+            if(parsedObj != null && parsedObj != undefined) {
+                test_vue_app = parsedObj.list;
+            } else {
+                // error
+            }
+        } //end of f (obj, status)
+    ); // end of get_data
+}
+
+
+/******************************************************************************
+ //
+ // To load using DataObject + DataService + Module stuff
+ //
+ *****************************************************************************/
+
+//Module means some component (need only to draw);
+var test_vue_module = new Module("nothing", "smartUsers");
+test_vue_module.drawData = function (data) {
+    test_vue_app.data.userlist.pop();
+    for(let i = 0; i < data.len(); i++) {
+        test_vue_app.data.userlist.push(data.getSorted(i));
+    }
+} ;
+
+var loader = new (function(){
+
+    /* this is the main data service that is auto-updating your data*/
+    this.userListServ = new DataObjectService("smartUsers", AUTO, "?ext=1");
+
+    // Optional for setting up self-defined interval
+    // this.userListServ.autoInterval = 300;
+    // this.userListServ.setUpInterval();
+
+    /**
+     * load Once, as is.
+     */
+    this.loadOnce = function(){
+        var list = this.userListServ.list;
+        test_vue_module.setData(list);
+    };
+
+    /***
+     * loadOften : to auto-load some data
+     */
+    this.loadOften = function(){
+        // Binding Intervals to DataService
+        this.userListServ.bind(function (data) {
+            // auto call
+            test_vue_module.setData(data);
+        });
+    };
+})();
+
+//To load once
+loader.loadOnce();
+
+//To auto-refresh
+// loader.loadOften();
+
+
+// 上传货品信息
+
+/*
+
+BasicFunction.get_data("smartIdentity/updateBatch", function (response) {
+                console.log("------ Data Rcvd in PresentReg --------");
+                console.log(response);
+                if(response.ret === "10000"){
+                    this.$router.push('index');
+                } else {
+                    // 注册失败的处理
+                    Toast.fail("上传失败,请检查网络");
+                }
+            }, [{"reviewId":1,"userId":1,"dormDistrict":10,
+                "userSex":1,"userSchoolCard":20123333222,
+                "userReviewStatus":1000,
+                "reviewerId":1,"reviewerNote":"nmo",
+                "reviewerNoteToUser":"noo"}]);
+
+
+基本格式
+
+szuhuanhuan2018
+登录  转义密码 就是 encodeURIComponent("实际密码")
+BasicFunction.get_data("ajaxloginu=手机号&p=(转义密码)", 回调函数, {})
+
+注册
+BasicFunction.get_data("ajaxregister?u=手机号&p=转义密码", 回调函数, {})
+
+发送验证码
+BasicFunction.get_data("ajaxsendotp?u=手机号", 回调函数, {})
+
+新建 (数据列表就是 [{...实际数据...}])
+BasicFunction.get_data("数据接口名称/saveBatch", 回调函数, 数据列表)
+
+修改
+BasicFunction.get_data("数据接口名称/updateBatch", 回调函数, 数据列表)
+
+搜索(获取)
+BasicFunction.get_data("数据接口名称/list?条件1=数据1&条件2=数据2&.....", 回调函数, {})
+
+用户数据:
+smartUsers/list
+[{
+"uid":3, // 用户id
+"usn":"13520583918", // 登录用户名
+"pss":"64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107",
+"name":"HelloWorld", // 昵称
+"title":"",
+"priv":"view,order,deliver,pay",
+"state":0, // 状态
+"sess":"iOgxGPkFIV3JxBlBfCv",
+"phone":"13520583918", // 电话号码
+"schoolDistrict":null, // 宿舍区 0: 斋区, 1: 西南, 2: 南区, 3: 西丽
+"userExpPts":null,
+"userGroup":null,
+"userVcoin":null,
+"registerTime":null, // 注册时间
+"lastLoginTime":null,
+"wxUnionid":null,
+"wxEngineid":null,
+"wxOpenid":null,
+"note":null
+},
+
+新建货品:
+smartGoods/saveBatch
+[{
+"goodid":"", // 货品id
+"name":"萌犬毛绒抱枕", // 货品名
+"goodsNo":"A2",
+"modelId":"1",
+"ownerId":"18", // 货品所有者id
+"goodFirstKind":"1000", // 目标性别 男: 0,女: 1
+"goodSecondKind":"2000", // 标签 0~13
+"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", // 是否被删除,0: 未被删 1: 被删,首页不显示
+"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"
+}]
+
+
+新建货品审核单
+smartGoodReview/saveBatch
+[{"reviewId":"","goodId":"3","applicantId":"19","reviewerId":"0","reviewResult":"0","applyTime":"2018-12-10 01:01:01","reviewTime":"2018-12-10 01:01:01","previousReview":"0","reviewNote":"暂未审核","displayNote":"暂未审核"}]
+
+
+新建货品池内条目(入池)
+smartGoodPool/saveBatch
+[{"poolItemId":"","goodId":"3","goodSenderId":"5","goodQuantity":"1","goodQuality":"100","goodFirstKind":"1000","reviewStatus":"1000","goodTargetRole":"1","goodTargetKind":"2","inpoolStatus":"1000"}]
+
+新建评论
+smartOrderFeedback/saveBatch
+[{
+"feedbackId":"",
+"orderId":"13", // 收到的礼物的id
+"goodId":"3",
+"ratingStatus":"1000",
+"ratingMajor":"5", // 评分
+"ratingMinor":"4500",
+"content":"还不错,5颗星", // 评论内容
+"ratingTime":"2018-12-10 01:01:01"
+}]
+
+
+新建用户身份审核单(校园卡审核)
+smartIdentity/saveBatch
+[{
+"reviewId":"",
+"userId":18, // 用户id
+"dormDistrict":1, // 宿舍区 0: 斋区, 1: 西南, 2: 南区, 3: 西丽
+"userSex":1, // 用户性别
+"userSchoolCard":20123333222,
+"userReviewStatus":1000,
+"reviewerId":1,
+"reviewerNote":"nmo",
+"reviewerNoteToUser":"noo"
+}]
+
+
+新建订单(配对成功)
+*** 前端不用操作 ***
+smartOrder/saveBatch
+[{"id":"","userId":"18","paymentId":"0","deliveryId":"0","merchandise":"{}","status":"1","payStatus":"0","distributionStatus":"0","dueAmount":"0.0","paidAmount":"0.0","taxes":"0","payableFreight":"0","realFreight":"0","payFee":"0","promotions":"0","discount":"1","orderAmount":"0","payTime":"2018-12-10 01:01:01","sendTime":"","createTime":"","completionTime":"","acceptTime":"","invoice":"0","invoiceTitle":"","postscript":"","note":"内部匹配","prop":"{}","exp":"0","point":"0","type":"0"}]
+
+统计用(用户点击信息,页面位置+页面按钮/区域代码=clickEvent)
+
+[{"clickId":"","clickEvent":"100001","clickTime":"1544443423082","clickIdentity":"18"}]
+
+
+
+****************
+***** 查找:*****
+****************
+
+
+查找已经准备接收的礼物
+smartOrder/list
+[{"id":28,"userId":3,"paymentId":0,"deliveryId":0,"merchandise":"[{\"q\":1,\"model\":1,\"id\":\"3\",\"spec\":[{\"v\":\"100\",\"i\":1002}]},{\"q\":1,\"model\":1,\"id\":\"6\",\"spec\":[{\"v\":\"350\",\"i\":1002}]}]","status":2,"payStatus":2,"distributionStatus":0,"dueAmount":25.11,"paidAmount":0.0,"taxes":0.0,"payableFreight":0.0,"realFreight":0.0,"payFee":0.0,"promotions":0.49,"discount":1.0,"orderAmount":25.6,"payTime":"2017-12-23 10:38:20","sendTime":"2017-12-23 10:38:20","createTime":"2017-12-23 10:38:20","completionTime":"2017-12-23 10:38:20","acceptTime":"0","invoice":0,"invoiceTitle":"empty","postscript":"","note":"","prop":"{\"wechat\":1}","exp":0,"point":0,"type":1}]
+
+
+ */
+

+ 84 - 84
sourcecode/h5app/vue/src/resource list.md

@@ -1,85 +1,85 @@
-## login
-
-### post:
-```js
-user: {
-    phone: string,
-    password: string
-}
-```
-## register(security verify)
-
-### post:
-```js
-user: {
-    phone: string,
-    password: string,
-    nickname: string,
-    gender: int, // male: 0; female: 1
-    dormitory: int, // ['斋区', 西南', '南区', '西丽']
-    photo: {
-        content: bse64编码,
-        file: {
-            lastModified: long, // TimeInMills?
-            lastModifiedDate: object, // Time
-            name: string, // image name
-            size: long,
-            type: string, // "image/png"
-            webkitRelativePath: string,
-        }
-    }
-}
-```
-
-## present register
-
-### get(编辑,从detail页面过来) / post:
-```js
-present: {
-    gender: int,
-    desc: string, // present description
-    tags: int[],
-    // [
-    // "情怀","复古", "有趣", "学霸",  "实用",
-    // "同年", "吃货", "佛系",  "土味", "活力",
-    // "洋气", "精致",  "轻奢",  "其它",
-    // ]
-    photo: object
-}
-```
-## index
-
-### get
-```js
-presents: [
-    present: {
-        id: int,
-        photo: object,
-        title: string,
-        desc: string,
-        publish-time: string, // date
-        status: int,
-        // ['审核中', '匹配中', '匹配成功', '交换成功', '审核失败']
-    }
-]
-```
-
-## gift detail
-
-### get?presentId=xx
-```js
-present: {
-    dormitory: int,
-    wechat: string,
-    comment: string,
-    recieved_present_id: int, // 查收到的礼物
-}
-recievedPresent: {
-    photo: object,
-    title: string,
-    desc: string,
-    dormitory: int,
-    wechat: string,
-    comment: string,
-}
+## login
+
+### post:
+```js
+user: {
+    phone: string,
+    password: string
+}
+```
+## register(security verify)
+
+### post:
+```js
+user: {
+    phone: string,
+    password: string,
+    nickname: string,
+    gender: int, // male: 0; female: 1
+    dormitory: int, // ['斋区', 西南', '南区', '西丽']
+    photo: {
+        content: bse64编码,
+        file: {
+            lastModified: long, // TimeInMills?
+            lastModifiedDate: object, // Time
+            name: string, // image name
+            size: long,
+            type: string, // "image/png"
+            webkitRelativePath: string,
+        }
+    }
+}
+```
+
+## present register
+
+### get(编辑,从detail页面过来) / post:
+```js
+present: {
+    gender: int,
+    desc: string, // present description
+    tags: int[],
+    // [
+    // "情怀","复古", "有趣", "学霸",  "实用",
+    // "同年", "吃货", "佛系",  "土味", "活力",
+    // "洋气", "精致",  "轻奢",  "其它",
+    // ]
+    photo: object
+}
+```
+## index
+
+### get
+```js
+presents: [
+    present: {
+        id: int,
+        photo: object,
+        title: string,
+        desc: string,
+        publish-time: string, // date
+        status: int,
+        // ['审核中', '匹配中', '匹配成功', '交换成功', '审核失败']
+    }
+]
+```
+
+## gift detail
+
+### get?presentId=xx
+```js
+present: {
+    dormitory: int,
+    wechat: string,
+    comment: string,
+    recieved_present_id: int, // 查收到的礼物
+}
+recievedPresent: {
+    photo: object,
+    title: string,
+    desc: string,
+    dormitory: int,
+    wechat: string,
+    comment: string,
+}
 ```

+ 146 - 146
sourcecode/h5app/vue/src/views/Assess.vue

@@ -1,147 +1,147 @@
-<template>
-    <div>
-        <div class="card">
-            <h3 > 交换成功!写一封感谢信送给ta吧~
-            </h3>
-            <van-cell-group>
-                <van-field
-                        type="textarea"
-                        placeholder="请输入你想写给ta的感谢信..."
-                        rows="5"
-                        autosize
-                        v-model="assess"
-                        :error="assessError"
-                        @click="assessError=false"
-                        required
-                        maxlength="300"
-                />
-            </van-cell-group>
-            <div>
-                <van-rate
-                        v-model="value"
-                        icon="like"
-                        void-icon="like-o"
-                />
-                <van-button round type="primary" class='assess' @click="Assess">送出感谢信</van-button>
-            </div>
-
-        </div>
-        <div style="position: relative;">
-            <img :src="Assessimage" style="max-width: 100%; position: relative;"/>
-        </div>
-    </div>
-</template>
-
-<script>
-
-    import {
-        CellGroup, Field,
-        Rate,
-        Button,
-        Toast
-    } from 'vant'
-    import {BasicFunction} from "../connector/basic-service";
-
-    export default {
-        name: "Assess",
-        components: {
-            [CellGroup.name]: CellGroup, [Field.name]: Field,
-            [Rate.name]: Rate, [Button.name]: Button,
-        },
-        data() {
-            return {
-                value:0,
-                assess: '',
-                assessError: false,
-                active: 0,
-                Assessimage: require('../assets/thanks.png'),
-
-            }
-        },
-        methods: {
-            assessPresent : function () {
-                // 检验输入
-                let that=this;
-                if (this.assess.length <= 15) {
-                    this.assessError = true;
-                    Toast.fail('请输入至少15个字的礼物评价!');
-                    return;
-                }
-                else if(this.assess.length > 300) {
-                    this.assessError = true;
-                    Toast.fail('最多输入300个字的礼物评价!');
-                    return;
-                }
-                if (!localStorage.getItem('frontend-userid')) {
-                    this.$router.push('login');
-                    return;
-                }
-                let orderId=BasicFunction.utils_get_param("orderId");
-                // assess_present()
-                console.log(present);
-                BasicFunction.get_data("smartOrderFeedback/saveBatch?orderId="+orderId, function (response) {
-                    console.log("------ Data Rcvd in assessPersent --------");
-                    console.log(response);
-                    if(response.ret === "10000"){
-
-
-                    } else {
-                        // 评价失败的处理
-                        Toast.fail("上传失败,请检查网络");
-                    }
-                }, [{"feedbackId":"",
-                    "orderId":"13",
-                    "goodId":"3",
-                    "ratingStatus":"1000",
-                    "ratingMajor":value,
-                    "ratingMinor":"4500",
-                    "content": assess,
-                    "ratingTime":"2018-12-10 01:01:01"}]
-                );
-
-                // this.$router.push('index');
-            },
-            Assess() {
-                this.$router.push('index');
-            },
-        },
-        created: function () {
-            if (!localStorage.getItem('frontend-userid')) {
-                this.$router.push('login');
-                return;
-            }
-            let that=this;
-            let orderId=BasicFunction.utils_get_param("orderId");
-        }
-    }
-</script>
-
-<style scoped>
-    h3 {
-        color: #fd6740;
-        text-align: left;
-        padding: 5px;
-        border-bottom: solid 1px #e4e4e4;
-    }
-    .card {
-        background-color: white;
-        margin: 20px 20px;
-        border: solid 1px #e4e4e4;
-        padding: 15px;
-    }
-
-    .van-button {
-        background-color: red;
-        border-color: red;
-        margin: auto;
-        width: 10%;
-    }
-    .van-rate{
-        margin: auto;
-    }
-    p{
-        margin: auto;
-        size: 5px;
-    }
-
+<template>
+    <div>
+        <div class="card">
+            <h3 > 交换成功!写一封感谢信送给ta吧~
+            </h3>
+            <van-cell-group>
+                <van-field
+                        type="textarea"
+                        placeholder="请输入你想写给ta的感谢信..."
+                        rows="5"
+                        autosize
+                        v-model="assess"
+                        :error="assessError"
+                        @click="assessError=false"
+                        required
+                        maxlength="300"
+                />
+            </van-cell-group>
+            <div>
+                <van-rate
+                        v-model="value"
+                        icon="like"
+                        void-icon="like-o"
+                />
+                <van-button round type="primary" class='assess' @click="Assess">送出感谢信</van-button>
+            </div>
+
+        </div>
+        <div style="position: relative;">
+            <img :src="Assessimage" style="max-width: 100%; position: relative;"/>
+        </div>
+    </div>
+</template>
+
+<script>
+
+    import {
+        CellGroup, Field,
+        Rate,
+        Button,
+        Toast
+    } from 'vant'
+    import {BasicFunction} from "../connector/basic-service";
+
+    export default {
+        name: "Assess",
+        components: {
+            [CellGroup.name]: CellGroup, [Field.name]: Field,
+            [Rate.name]: Rate, [Button.name]: Button,
+        },
+        data() {
+            return {
+                value:0,
+                assess: '',
+                assessError: false,
+                active: 0,
+                Assessimage: require('../assets/thanks.png'),
+
+            }
+        },
+        methods: {
+            assessPresent : function () {
+                // 检验输入
+                let that=this;
+                if (this.assess.length <= 15) {
+                    this.assessError = true;
+                    Toast.fail('请输入至少15个字的礼物评价!');
+                    return;
+                }
+                else if(this.assess.length > 300) {
+                    this.assessError = true;
+                    Toast.fail('最多输入300个字的礼物评价!');
+                    return;
+                }
+                if (!localStorage.getItem('frontend-userid')) {
+                    this.$router.push('login');
+                    return;
+                }
+                let orderId=BasicFunction.utils_get_param("orderId");
+                // assess_present()
+                console.log(present);
+                BasicFunction.get_data("smartOrderFeedback/saveBatch?orderId="+orderId, function (response) {
+                    console.log("------ Data Rcvd in assessPersent --------");
+                    console.log(response);
+                    if(response.ret === "10000"){
+
+
+                    } else {
+                        // 评价失败的处理
+                        Toast.fail("上传失败,请检查网络");
+                    }
+                }, [{"feedbackId":"",
+                    "orderId":"13",
+                    "goodId":"3",
+                    "ratingStatus":"1000",
+                    "ratingMajor":value,
+                    "ratingMinor":"4500",
+                    "content": assess,
+                    "ratingTime":"2018-12-10 01:01:01"}]
+                );
+
+                // this.$router.push('index');
+            },
+            Assess() {
+                this.$router.push('index');
+            },
+        },
+        created: function () {
+            if (!localStorage.getItem('frontend-userid')) {
+                this.$router.push('login');
+                return;
+            }
+            let that=this;
+            let orderId=BasicFunction.utils_get_param("orderId");
+        }
+    }
+</script>
+
+<style scoped>
+    h3 {
+        color: #fd6740;
+        text-align: left;
+        padding: 5px;
+        border-bottom: solid 1px #e4e4e4;
+    }
+    .card {
+        background-color: white;
+        margin: 20px 20px;
+        border: solid 1px #e4e4e4;
+        padding: 15px;
+    }
+
+    .van-button {
+        background-color: red;
+        border-color: red;
+        margin: auto;
+        width: 10%;
+    }
+    .van-rate{
+        margin: auto;
+    }
+    p{
+        margin: auto;
+        size: 5px;
+    }
+
 </style>

+ 3 - 3
sourcecode/h5app/vue/src/views/PresentRegister.vue

@@ -52,7 +52,7 @@
             <div style="margin-bottom: 10px">
                 <form method="POST" enctype="multipart/form-data"
                       action="http://gift-server.niimei.com:8866/fileserver/upload?sign=abcdefg">
-                    <add-photo/>
+                    <add-photo v-model="hasPhoto"/>
                     <button type="submit" value="Upload"
                             class="van-button van-button--primary van-button--large submit_button"
                             @click="publishPresent">下一步
@@ -103,7 +103,7 @@
                     "洋气", "精致",  "轻奢",  "其它",
                 ],
                 tag: 0,
-                photo: null,
+                hasPhoto: false,
                 nobr: "float: left; margin-right: 5px",
                 br: ""
             }
@@ -118,7 +118,7 @@
                     this.descError = true;
                     Toast.fail('请输入至少15个字的礼物介绍');
                     return;
-                } else if (this.photo === null) {
+                } else if (this.hasPhoto === false) {
                     Toast.fail('请上传礼物照片');
                     return;
                 }

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

@@ -89,7 +89,7 @@
             <div style="margin-bottom: 10px">
                 <form method="POST" enctype="multipart/form-data"
                       action="http://gift-server.niimei.com:8866/fileserver/upload?sign=abcdefg">
-                    <add-photo/>
+                    <add-photo v-model="hasPhoto"/>
                     <button type="submit" value="Upload"
                             class="van-button van-button--primary van-button--large submit_button"
                             @click="next">下一步
@@ -147,7 +147,7 @@
                     {id: 2, name: '南区'},
                     {id: 3, name: '西丽'}
                 ],
-                photo: null
+                hasPhoto: false
             };
         },
         methods: {
@@ -172,7 +172,7 @@
                 } else if (this.dorId === -1) {
                     Toast.fail('请选择宿舍区');
                     return;
-                } else if (this.photo === null) {
+                } else if (this.hasPhoto === false) {
                     Toast.fail('请上传校卡正面照片');
                     return;
                 }

+ 151 - 151
sourcecode/h5app/vue/src/views/beTest.vue

@@ -1,152 +1,152 @@
-<template>
-    <div>
-        <!--测试-->
-        <div style="position: relative;">
-            {{testresult}}
-            <div @click="testSaveGoods"> 点击测试货品保存testSaveGoods</div>
-            <div @click="testReadGoods"> 点击测试货品数据读取 testReadGoods</div>
-            <div @click="testSaveReview"> 点击测试货品数据读取testSaveReview</div>
-            <div @click="testSaveWxid"> 点击测试货品数据读取testSaveWxid</div>
-            <div @click="testReadWxid"> 点击测试WxID读取testReadWxid</div>
-            <div @click="testSaveStorage"> 点击写入frontend-userid testSaveStorage</div>
-            <div @click="testReadStorage"> 点击读取frontend-userid testReadStorage</div>
-        </div>
-        <van-button size="large" type="primary" @click="Toindex">返回首页</van-button>
-
-    </div>
-</template>
-
-<script>
-    import {
-        Button
-    } from 'vant'
-    import {BasicFunction} from '../connector/basic-service';
-    export default {
-        name: "share",
-        components: {
-            [Button.name]: Button,
-        },
-        data() {
-            return {
-                testresult : '正在测试,请稍后',
-                active: 0,
-                share: require('../assets/post.png'),
-            }
-        },
-        methods:{
-            testSaveGoods(){
-                window.testvuepage = this;
-                BasicFunction.get_data("smartGoods/save", function(response){
-                    console.log(response);
-                    if(response.ret !== "10000"){
-                        if(response.model.list.length > 0 && response.model === "1"){
-                            this.testSuccess();
-                            return;
-                        }
-                        this.testFailed();
-                    }else{
-                        // Test fail
-                        this.testFailed();
-                    }
-                })
-            },
-            testReadGoods(){
-                window.testvuepage = this;
-                BasicFunction.get_data("smartGoods/list", function(response){
-                    console.log(response);
-                    if(response.ret !== "10000"){
-                        if(response.model.list.length > 0 && response.model.list[0]["goodId"] != undefined){
-                            this.testSuccess();
-                            return;
-                        }
-                        this.testFailed();
-                    }else{
-                        // Test fail
-                        this.testFailed();
-                        return;
-                    }
-                })
-            },
-            testSaveReview(){
-                window.testvuepage = this;
-                BasicFunction.get_data("/list", function(response){
-                    console.log(response);
-                    if(response.ret !== "10000"){
-                        this.testSuccess();
-                        return;
-                    }else{
-                        // Test fail
-                        this.testFailed();
-                        return;
-                    }
-                })
-            },
-            testSaveWxid(){
-                window.testvuepage = this;
-                BasicFunction.get_data("/list", function(response){
-                    console.log(response);
-                    if(response.ret !== "10000"){
-                        this.testSuccess();
-                        return;
-                    }else{
-                        // Test fail
-                        this.testFailed();
-                        return;
-                    }
-                })
-            },
-            testReadWxid(){
-
-                window.testvuepage = this;
-                BasicFunction.get_data("/list", function(response){
-                    console.log(response);
-                    if(response.ret !== "10000"){
-                        this.testSuccess();
-                        return;
-                    }else{
-                        // Test fail
-                        this.testFailed();
-                        return;
-                    }
-                })
-            },
-            testSaveStorage(){
-                localStorage.setItem("xxx", "333");
-                this.testSuccess();
-            },
-            testReadStorage(){
-                window.testvuepage = this;
-                if(localStorage.getItem("xxx") === "333") {
-                    this.testSuccess();
-                }else{
-                    this.testSuccess();
-                }
-            },
-            testSuccess (){
-                Toast.success("测试成功", 4000);
-            },
-            testFail (){
-                Toast.fail("测试失败", 4000);
-            },
-            Toindex(){
-                this.$router.push('index');
-            }
-        }
-    }
-</script>
-
-<style scoped>
-    .van-button {
-        background-color: #fd6740;
-        border-color: #fd6740;
-        margin: 10px 0 10px;
-        width: 55%;
-    }
-
-    div {
-        margin-top: 10px;
-        background-color: white;
-        border: solid 1px;
-        padding: 10px;
-    }
+<template>
+    <div>
+        <!--测试-->
+        <div style="position: relative;">
+            {{testresult}}
+            <div @click="testSaveGoods"> 点击测试货品保存testSaveGoods</div>
+            <div @click="testReadGoods"> 点击测试货品数据读取 testReadGoods</div>
+            <div @click="testSaveReview"> 点击测试货品数据读取testSaveReview</div>
+            <div @click="testSaveWxid"> 点击测试货品数据读取testSaveWxid</div>
+            <div @click="testReadWxid"> 点击测试WxID读取testReadWxid</div>
+            <div @click="testSaveStorage"> 点击写入frontend-userid testSaveStorage</div>
+            <div @click="testReadStorage"> 点击读取frontend-userid testReadStorage</div>
+        </div>
+        <van-button size="large" type="primary" @click="Toindex">返回首页</van-button>
+
+    </div>
+</template>
+
+<script>
+    import {
+        Button
+    } from 'vant'
+    import {BasicFunction} from '../connector/basic-service';
+    export default {
+        name: "share",
+        components: {
+            [Button.name]: Button,
+        },
+        data() {
+            return {
+                testresult : '正在测试,请稍后',
+                active: 0,
+                share: require('../assets/post.png'),
+            }
+        },
+        methods:{
+            testSaveGoods(){
+                window.testvuepage = this;
+                BasicFunction.get_data("smartGoods/save", function(response){
+                    console.log(response);
+                    if(response.ret !== "10000"){
+                        if(response.model.list.length > 0 && response.model === "1"){
+                            this.testSuccess();
+                            return;
+                        }
+                        this.testFailed();
+                    }else{
+                        // Test fail
+                        this.testFailed();
+                    }
+                })
+            },
+            testReadGoods(){
+                window.testvuepage = this;
+                BasicFunction.get_data("smartGoods/list", function(response){
+                    console.log(response);
+                    if(response.ret !== "10000"){
+                        if(response.model.list.length > 0 && response.model.list[0]["goodId"] != undefined){
+                            this.testSuccess();
+                            return;
+                        }
+                        this.testFailed();
+                    }else{
+                        // Test fail
+                        this.testFailed();
+                        return;
+                    }
+                })
+            },
+            testSaveReview(){
+                window.testvuepage = this;
+                BasicFunction.get_data("/list", function(response){
+                    console.log(response);
+                    if(response.ret !== "10000"){
+                        this.testSuccess();
+                        return;
+                    }else{
+                        // Test fail
+                        this.testFailed();
+                        return;
+                    }
+                })
+            },
+            testSaveWxid(){
+                window.testvuepage = this;
+                BasicFunction.get_data("/list", function(response){
+                    console.log(response);
+                    if(response.ret !== "10000"){
+                        this.testSuccess();
+                        return;
+                    }else{
+                        // Test fail
+                        this.testFailed();
+                        return;
+                    }
+                })
+            },
+            testReadWxid(){
+
+                window.testvuepage = this;
+                BasicFunction.get_data("/list", function(response){
+                    console.log(response);
+                    if(response.ret !== "10000"){
+                        this.testSuccess();
+                        return;
+                    }else{
+                        // Test fail
+                        this.testFailed();
+                        return;
+                    }
+                })
+            },
+            testSaveStorage(){
+                localStorage.setItem("xxx", "333");
+                this.testSuccess();
+            },
+            testReadStorage(){
+                window.testvuepage = this;
+                if(localStorage.getItem("xxx") === "333") {
+                    this.testSuccess();
+                }else{
+                    this.testSuccess();
+                }
+            },
+            testSuccess (){
+                Toast.success("测试成功", 4000);
+            },
+            testFail (){
+                Toast.fail("测试失败", 4000);
+            },
+            Toindex(){
+                this.$router.push('index');
+            }
+        }
+    }
+</script>
+
+<style scoped>
+    .van-button {
+        background-color: #fd6740;
+        border-color: #fd6740;
+        margin: 10px 0 10px;
+        width: 55%;
+    }
+
+    div {
+        margin-top: 10px;
+        background-color: white;
+        border: solid 1px;
+        padding: 10px;
+    }
 </style>

+ 140 - 140
sourcecode/h5app/vue/src/views/login.vue

@@ -1,141 +1,141 @@
-<template>
-    <div>
-        <img src="../assets/login_background.png"
-             style="max-width: 100%"
-        />
-        <div class="card">
-            <van-cell-group>
-                <van-field
-                        v-model="phone"
-                        required
-                        clearable
-                        label="手机号"
-                        placeholder="请输入手机号"
-                        :error="phoneError"
-                        @click="phoneError=false"
-                />
-                <van-field
-                        v-model="password"
-                        required
-                        clearable
-                        type="password"
-                        label="密码"
-                        placeholder="请输入密码"
-                        :error="passError"
-                        @click="passError=false"
-                />
-
-                <van-field
-                        v-model="sms"
-                        center
-                        clearable
-                        label="短信验证码"
-                        placeholder="请输入短信验证码(暂时不用)"
-                        required
-                        disabled
-                >
-                    <van-button slot="button" size="small" type="primary" disabled>发送验证码</van-button>
-                </van-field>
-            </van-cell-group>
-        </div>
-
-        <div style="position: fixed; bottom: 5px; width:100%">
-            <van-button type="primary" size="large" class='login' @click="Login">登录</van-button>
-            <van-button type="default" size="large" class='register' @click="Register">注册</van-button>
-        </div>
-    </div>
-</template>
-
-<script>
-    import 'whatwg-fetch';
-    import { BasicFunction } from '../connector/basic-service';
-    import {
-        Field,
-        CellGroup,
-        Button,
-    } from 'vant';
-    export default {
-        components: {
-            [Field.name]: Field,
-            [CellGroup.name]: CellGroup,
-            [Button.name]: Button
-        },
-        data() {
-            return {
-                phone: '',
-                phoneError: false,
-                sms: '',
-                password: '',
-                passError: false
-            }
-        },
-        methods: {
-            Login() {
-                // 检查输入
-                if(this.phone.length !== 11) {
-                    this.phoneError = true;
-                    return;
-                } else if(this.password.length < 8) {
-                    this.passError = true;
-                    return;
-                }
-                window.routerme = this.$router;  //TODO: 考虑 encodeURIComponent(this.password)
-                BasicFunction.get_data("ajaxlogin?u=" + this.phone + "&p=" + this.password, function (response) {
-                    console.log("------ Data Rcvd in Login --------");
-                    console.log(response);
-                    if(response.ret === "10000"){
-                        // userId
-                        localStorage.setItem("frontend-userid", response.model.userId);
-                        window.routerme.push('index');
-                    } else {
-                        // 密码错误的处理
-                        console.warn("登录失败");
-                    }
-                }, {});
-            },
-            Register() {
-                    this.$router.push('verify');
-            },
-            SendOTP() {
-                BasicFunction.get_data("ajaxsendotp?u=" + this.phone, function (response) {
-                    console.log('------ sms Rcvd in Login --------');
-                    console.log(response);
-                }, {})
-            }
-        }
-    }
-
-    /** Post JSON **/
-    /*
-    // 怎么把一段放到另一个文件?
-
-    fetch('/users', {
-        method: 'POST',
-        headers: {
-            'Content-Type': 'application/json'
-        },
-        body: JSON.stringify({
-            name: 'Hubot',
-            login: 'hubot',
-        })
-    })
-
-    */
-</script>
-
-<style scoped>
-    .card {
-        margin: 20px 20px 130px;
-        border: solid 1px #e4e4e4;
-    }
-    .login {
-        margin-bottom: 10px;
-        width: 85%;
-        background-color: #fd6740;
-        border-color: #fd6740;
-    }
-    .register {
-        margin-bottom: 5px;
-        width: 85%;
-    }
+<template>
+    <div>
+        <img src="../assets/login_background.png"
+             style="max-width: 100%"
+        />
+        <div class="card">
+            <van-cell-group>
+                <van-field
+                        v-model="phone"
+                        required
+                        clearable
+                        label="手机号"
+                        placeholder="请输入手机号"
+                        :error="phoneError"
+                        @click="phoneError=false"
+                />
+                <van-field
+                        v-model="password"
+                        required
+                        clearable
+                        type="password"
+                        label="密码"
+                        placeholder="请输入密码"
+                        :error="passError"
+                        @click="passError=false"
+                />
+
+                <van-field
+                        v-model="sms"
+                        center
+                        clearable
+                        label="短信验证码"
+                        placeholder="请输入短信验证码(暂时不用)"
+                        required
+                        disabled
+                >
+                    <van-button slot="button" size="small" type="primary" disabled>发送验证码</van-button>
+                </van-field>
+            </van-cell-group>
+        </div>
+
+        <div style="position: fixed; bottom: 5px; width:100%">
+            <van-button type="primary" size="large" class='login' @click="Login">登录</van-button>
+            <van-button type="default" size="large" class='register' @click="Register">注册</van-button>
+        </div>
+    </div>
+</template>
+
+<script>
+    import 'whatwg-fetch';
+    import { BasicFunction } from '../connector/basic-service';
+    import {
+        Field,
+        CellGroup,
+        Button,
+    } from 'vant';
+    export default {
+        components: {
+            [Field.name]: Field,
+            [CellGroup.name]: CellGroup,
+            [Button.name]: Button
+        },
+        data() {
+            return {
+                phone: '',
+                phoneError: false,
+                sms: '',
+                password: '',
+                passError: false
+            }
+        },
+        methods: {
+            Login() {
+                // 检查输入
+                if(this.phone.length !== 11) {
+                    this.phoneError = true;
+                    return;
+                } else if(this.password.length < 8) {
+                    this.passError = true;
+                    return;
+                }
+                window.routerme = this.$router;  //TODO: 考虑 encodeURIComponent(this.password)
+                BasicFunction.get_data("ajaxlogin?u=" + this.phone + "&p=" + this.password, function (response) {
+                    console.log("------ Data Rcvd in Login --------");
+                    console.log(response);
+                    if(response.ret === "10000"){
+                        // userId
+                        localStorage.setItem("frontend-userid", response.model.userId);
+                        window.routerme.push('index');
+                    } else {
+                        // 密码错误的处理
+                        console.warn("登录失败");
+                    }
+                }, {});
+            },
+            Register() {
+                    this.$router.push('verify');
+            },
+            SendOTP() {
+                BasicFunction.get_data("ajaxsendotp?u=" + this.phone, function (response) {
+                    console.log('------ sms Rcvd in Login --------');
+                    console.log(response);
+                }, {})
+            }
+        }
+    }
+
+    /** Post JSON **/
+    /*
+    // 怎么把一段放到另一个文件?
+
+    fetch('/users', {
+        method: 'POST',
+        headers: {
+            'Content-Type': 'application/json'
+        },
+        body: JSON.stringify({
+            name: 'Hubot',
+            login: 'hubot',
+        })
+    })
+
+    */
+</script>
+
+<style scoped>
+    .card {
+        margin: 20px 20px 130px;
+        border: solid 1px #e4e4e4;
+    }
+    .login {
+        margin-bottom: 10px;
+        width: 85%;
+        background-color: #fd6740;
+        border-color: #fd6740;
+    }
+    .register {
+        margin-bottom: 5px;
+        width: 85%;
+    }
 </style>

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini