소스 검색

fixed conflit

StephenArk30 6 년 전
부모
커밋
583d397d06

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

@@ -90,7 +90,7 @@ var BasicFunction = new (function () {
         // .then(BasicFunction.onCheckFail);
     };
 
-    this.onReachServer = function (checkResponse) {
+    this.onReachServer = function () {
         BasicFunction.Queue.IS_LOADED = true;
         BasicFunction.logwarn("Using SERVER : ");
         BasicFunction.logwarn(BasicFunction.Queue.SVR_URL);
@@ -102,7 +102,7 @@ var BasicFunction = new (function () {
             BasicFunction.logwarn("Backup Failed : " + BasicFunction.Queue.backup[BasicFunction.Queue.nowuse]);
             BasicFunction.logwarn(this);
             var out = "";
-            BasicFunction.Queue.backup.forEach(function (val, index, arr) {
+            BasicFunction.Queue.backup.forEach(function (val, index) {
                 out += index + ":[" +val +"] \n";
             });
             BasicFunction.logerror("抱歉, 服务器连接失败! \n 请确认 "+ out +" 其中之一可用");
@@ -116,12 +116,12 @@ var BasicFunction = new (function () {
                 .then(function (response) {return response.json();} )
                 .then(BasicFunction.onReachServer)
                 .catch(BasicFunction.onCheckFail);
-            //.fail(BasicFunction.onCheckFail).done(BasicFunction.onReachServer);
         }
     };
 
-    this.get_data = function (url, callback, data, scope) {
-        BasicFunction.Queue.list.push({url: url, callback: callback, gid: -1, data:data, scope: scope});
+    this.get_data = function (url, callback, data, onescope) {
+        console.log('calling get_data()');
+        BasicFunction.Queue.list.push({url: url, callback: callback, gid: -1, data: data, scope: onescope});
     };
 
     this.new_data_group = function (groupName, callback) {
@@ -197,6 +197,7 @@ var BasicFunction = new (function () {
             url: BasicFunction.Queue.SVR_URL + url,
             apiName: url,
             data: data,
+            scope: scope,
             sendTime: new Date()
         }).then(BasicFunction.checkStatus)
             .then(BasicFunction.parseJson)

+ 2 - 0
sourcecode/h5app/vue/src/resource list.md

@@ -55,6 +55,7 @@ presents: [
     present: {
         id: int,
         photo: object,
+        title: string,
         desc: string,
         publish-time: string, // date
         status: int,
@@ -75,6 +76,7 @@ present: {
 }
 recievedPresent: {
     photo: object,
+    title: string,
     desc: string,
     dormitory: int,
     wechat: string,

+ 23 - 1
sourcecode/h5app/vue/src/views/index.vue

@@ -34,8 +34,9 @@
 
 <script>
     import IndexPresent from "../components/IndexPresent";
-    import { Button, Row, Col} from "vant"
+    import {Button, Row, Col} from "vant";
     import AddPresentButton from "../components/addPresentButton";
+    import {BasicFunction} from '../connector/basic-service';
 
     export default {
         name: "index",
@@ -55,6 +56,25 @@
         computed: {
             presents: function() {
                 // return get_present_data()
+
+                var userId = localStorage.getItem("frontend-userid");
+                // 判断userId 是不是空的
+
+                BasicFunction.get_data("smartGoods/list?ownerId" + userId, function (response) {
+                    console.log("------ Data Rcvd in Index --------");
+                    console.log(response);
+                    if (response.ret === "10000") {
+                        // response 就是
+                        console.warn(response);
+                        var list = response.model.list;
+                        if (list == undefined || list.length == 0) // ....
+                            console.warn(list);
+                    } else {
+                        // 注册失败的处理
+                        console.warn("注册失败");
+                    }
+                }, {});
+
                 return [
                     {
                         id: 0,
@@ -82,6 +102,8 @@
             }
         }
     }
+
+
 </script>
 
 <style scoped>

+ 21 - 17
sourcecode/h5app/vue/src/views/login.vue

@@ -80,33 +80,25 @@
                     return;
                 }
                 // 检查手机号有无注册
-                // let login_info = {
-                //     phone: this.phone,
-                //     pass: this.password
-                // };
-                // if(get_data(login_info)) {
-                //     this.$router.push('index');
-                // } else {
-                //     this.phoneError = true;
-                //     this.passError = true;
-                // }
-                // 检查手机号有无验证
-                BasicFunction.get_data("ajaxlogin", function(response){
+                window.routerme = this.$router;
+                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"){
                         // 不需要 设置 SessionID, 已经自动保存在jSessionID中
-                        this.$router.push('index');
+                        // userId
+                        localStorage.setItem("frontend-userid", response.model.userId);
+                        window.routerme.push('index');
                     } else {
                         // 密码错误的处理
                         console.warn("登录失败");
                     }
-                }, { u: this.phone, p : this.password });
+                }, {});
                 // this.$router.push('index');
             },
             Register() {
-                BasicFunction.get_data("ajaxlogin", function(response){
-                    console.log("------ Data Rcvd in Login --------");
+                BasicFunction.get_data("ajaxregister", function (response) {
+                    console.log("------ Data Rcvd in Reg --------");
                     console.log(response);
                     if(response.ret === "10000"){
                         // 不需要 设置 SessionID, 已经自动保存在jSessionID中
@@ -115,7 +107,19 @@
                         // 注册失败的处理
                         console.warn("注册失败");
                     }
-                }, { u: this.phone, p : this.password });
+                }, {u: this.phone, p: this.passWord,});
+            },
+            SendOTP() {
+                BasicFunction.get_data("ajaxsendotp", function (response) {
+                    console.log("------ Data Rcvd in OTP --------");
+                    console.log(response);
+                    if (response.ret === "10000") {
+                        // 提示用户已经发送
+                    } else {
+                        // 发送失败
+                        console.warn("发送失败");
+                    }
+                }, {u: this.phone});
             }
         }
     }