瀏覽代碼

sending chat to database

alizalang 6 年之前
父節點
當前提交
b6d8ceb973

+ 1
- 1
ZipTeamOrange-ionic-UI/.sourcemaps/main.js.map
文件差異過大導致無法顯示
查看文件


+ 5
- 2
ZipTeamOrange-ionic-UI/src/pages/chat/chat.html 查看文件

@@ -13,6 +13,9 @@
13 13
 </ion-header>
14 14
 
15 15
 
16
-<ion-content padding>
17
-  <ion-textarea  type="text" [(ngModel)]="test" ng-submit="send()"></ion-textarea><button ion-button (click)="send()">send</button>
16
+<ion-content padding >
17
+  <form  #test1="ngForm" ng-submit="send(test1.value)">
18
+    <ion-textarea  type="text" name="message" [(ngModel)]="test" ></ion-textarea>
19
+    <button ion-button (click)="send(test1.value)">send</button>
20
+  </form>
18 21
 </ion-content>

+ 3
- 3
ZipTeamOrange-ionic-UI/src/pages/chat/chat.ts 查看文件

@@ -24,9 +24,9 @@ export class ChatPage {
24 24
     console.log('ionViewDidLoad ChatPage');
25 25
   }
26 26
 
27
-  send(createAccountInfo: any){
27
+  send(createAccountInfo: NgForm){
28 28
     console.log("clicked");
29
-    console.log({test: this.test})
30
-    // this.messageApi.saveMessage(createAccountInfo);
29
+    console.log(createAccountInfo)
30
+    this.messageApi.saveMessage(createAccountInfo).subscribe(console.log);
31 31
   }
32 32
 }

+ 4
- 5
ZipTeamOrange-ionic-UI/www/build/main.js 查看文件

@@ -37,17 +37,16 @@ var ChatPage = /** @class */ (function () {
37 37
     };
38 38
     ChatPage.prototype.send = function (createAccountInfo) {
39 39
         console.log("clicked");
40
-        console.log({ test: this.test });
41
-        // this.messageApi.saveMessage(createAccountInfo);
40
+        console.log(createAccountInfo);
41
+        this.messageApi.saveMessage(createAccountInfo).subscribe(console.log);
42 42
     };
43 43
     ChatPage = __decorate([
44 44
         Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Component */])({
45
-            selector: 'page-chat',template:/*ion-inline-start:"/Users/alizalang/Desktop/ZipTeam/ZipTeamOrange-ionic-UI/src/pages/chat/chat.html"*/'<!--\n  Generated template for the ChatPage page.\n\n  See http://ionicframework.com/docs/components/#navigation for more info on\n  Ionic pages and navigation.\n-->\n<ion-header>\n\n  <ion-navbar>\n    <ion-title>chatPage</ion-title>\n  </ion-navbar>\n\n</ion-header>\n\n\n<ion-content padding>\n  <ion-textarea  type="text" [(ngModel)]="test" ng-submit="send()"></ion-textarea><button ion-button (click)="send()">send</button>\n</ion-content>\n'/*ion-inline-end:"/Users/alizalang/Desktop/ZipTeam/ZipTeamOrange-ionic-UI/src/pages/chat/chat.html"*/,
45
+            selector: 'page-chat',template:/*ion-inline-start:"/Users/alizalang/Desktop/ZipTeam/ZipTeamOrange-ionic-UI/src/pages/chat/chat.html"*/'<!--\n  Generated template for the ChatPage page.\n\n  See http://ionicframework.com/docs/components/#navigation for more info on\n  Ionic pages and navigation.\n-->\n<ion-header>\n\n  <ion-navbar>\n    <ion-title>chatPage</ion-title>\n  </ion-navbar>\n\n</ion-header>\n\n\n<ion-content padding >\n  <form  #test1="ngForm" ng-submit="send(test1.value)">\n    <ion-textarea  type="text" name="message" [(ngModel)]="test" ></ion-textarea>\n    <button ion-button (click)="send(test1.value)">send</button>\n  </form>\n</ion-content>\n'/*ion-inline-end:"/Users/alizalang/Desktop/ZipTeam/ZipTeamOrange-ionic-UI/src/pages/chat/chat.html"*/,
46 46
         }),
47
-        __metadata("design:paramtypes", [typeof (_a = typeof __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["e" /* NavController */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["e" /* NavController */]) === "function" && _a || Object, typeof (_b = typeof __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["f" /* NavParams */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["f" /* NavParams */]) === "function" && _b || Object, typeof (_c = typeof __WEBPACK_IMPORTED_MODULE_2__providers_message_service_message_service__["a" /* MessageServiceProvider */] !== "undefined" && __WEBPACK_IMPORTED_MODULE_2__providers_message_service_message_service__["a" /* MessageServiceProvider */]) === "function" && _c || Object])
47
+        __metadata("design:paramtypes", [__WEBPACK_IMPORTED_MODULE_1_ionic_angular__["e" /* NavController */], __WEBPACK_IMPORTED_MODULE_1_ionic_angular__["f" /* NavParams */], __WEBPACK_IMPORTED_MODULE_2__providers_message_service_message_service__["a" /* MessageServiceProvider */]])
48 48
     ], ChatPage);
49 49
     return ChatPage;
50
-    var _a, _b, _c;
51 50
 }());
52 51
 
53 52
 //# sourceMappingURL=chat.js.map

+ 1
- 1
ZipTeamOrange-ionic-UI/www/build/main.js.map
文件差異過大導致無法顯示
查看文件


+ 1
- 1
ZipTeamOrange-ionic-UI/www/build/vendor.js.map
文件差異過大導致無法顯示
查看文件


+ 4
- 2
ZipTeamOrange-server/src/main/java/ZipTeamOrange/message/Message.java 查看文件

@@ -19,11 +19,13 @@ public class Message {
19 19
     @JoinColumn(name = "chat_id")
20 20
     private Chat chat;
21 21
 
22
-    public Message(String message, User user) {
22
+
23
+    public Message(String message) {
23 24
         this.message = message;
24
-        this.user = user;
25
+        //this.user = user;
25 26
     }
26 27
 
28
+
27 29
     public Message(){}
28 30
 
29 31
     public long getId() {

+ 1
- 1
ZipTeamOrange-server/src/main/java/ZipTeamOrange/message/MessageController.java 查看文件

@@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.*;
7 7
 
8 8
 @RestController
9 9
 @RequestMapping(path = "/message")
10
-@CrossOrigin("http://localhost:8101")
10
+@CrossOrigin("http://localhost:8100")
11 11
 public class MessageController {
12 12
     ObjectMapper ob = new ObjectMapper();
13 13