0225263 пре 4 месеци
родитељ
комит
dfd24de092

BIN
asset/img/customer-avatar.jpg


+ 89 - 3
package-lock.json

@@ -23,6 +23,7 @@
         "@capacitor/status-bar": "6.0.0",
         "@ionic/angular": "^8.0.0",
         "ionicons": "^7.0.0",
+        "parse": "^5.2.0",
         "rxjs": "~7.8.0",
         "tslib": "^2.3.0",
         "zone.js": "~0.14.2"
@@ -40,6 +41,7 @@
         "@capacitor/cli": "6.1.0",
         "@ionic/angular-toolkit": "^11.0.1",
         "@types/jasmine": "~5.1.0",
+        "@types/parse": "^3.0.9",
         "@typescript-eslint/eslint-plugin": "^6.0.0",
         "@typescript-eslint/parser": "^6.0.0",
         "eslint": "^8.57.0",
@@ -2522,6 +2524,18 @@
         "node": ">=6.9.0"
       }
     },
+    "node_modules/@babel/runtime-corejs3": {
+      "version": "7.24.6",
+      "resolved": "https://registry.npmmirror.com/@babel/runtime-corejs3/-/runtime-corejs3-7.24.6.tgz",
+      "integrity": "sha512-tbC3o8uHK9xMgMsvUm9qGqxVpbv6yborMBLbDteHIc7JDNHsTV0vDMQ5j1O1NXvO+BDELtL9KgoWYaUVIVGt8w==",
+      "dependencies": {
+        "core-js-pure": "^3.30.2",
+        "regenerator-runtime": "^0.14.0"
+      },
+      "engines": {
+        "node": ">=6.9.0"
+      }
+    },
     "node_modules/@babel/template": {
       "version": "7.24.7",
       "resolved": "https://registry.npmmirror.com/@babel/template/-/template-7.24.7.tgz",
@@ -5287,6 +5301,15 @@
         "@types/node": "*"
       }
     },
+    "node_modules/@types/parse": {
+      "version": "3.0.9",
+      "resolved": "https://registry.npmmirror.com/@types/parse/-/parse-3.0.9.tgz",
+      "integrity": "sha512-DGTHygc7krgmNAK8h42giwmAofCd9uv2++RD+zw6OmWI7AEnlTYZwEuWsx22SA2CSMQrZW8P2INHLpQbnQFUng==",
+      "dev": true,
+      "dependencies": {
+        "@types/node": "*"
+      }
+    },
     "node_modules/@types/qs": {
       "version": "6.9.15",
       "resolved": "https://registry.npmmirror.com/@types/qs/-/qs-6.9.15.tgz",
@@ -7369,6 +7392,16 @@
         "url": "https://opencollective.com/core-js"
       }
     },
+    "node_modules/core-js-pure": {
+      "version": "3.37.1",
+      "resolved": "https://registry.npmmirror.com/core-js-pure/-/core-js-pure-3.37.1.tgz",
+      "integrity": "sha512-J/r5JTHSmzTxbiYYrzXg9w1VpqrYt+gexenBE9pugeyhwPZTAEJddyiReJWsLO6uNQ8xJZFbod6XC7KKwatCiA==",
+      "hasInstallScript": true,
+      "funding": {
+        "type": "opencollective",
+        "url": "https://opencollective.com/core-js"
+      }
+    },
     "node_modules/core-util-is": {
       "version": "1.0.3",
       "resolved": "https://registry.npmmirror.com/core-util-is/-/core-util-is-1.0.3.tgz",
@@ -7513,6 +7546,12 @@
         "node": ">= 8"
       }
     },
+    "node_modules/crypto-js": {
+      "version": "4.2.0",
+      "resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.2.0.tgz",
+      "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==",
+      "optional": true
+    },
     "node_modules/css-loader": {
       "version": "7.1.1",
       "resolved": "https://registry.npmmirror.com/css-loader/-/css-loader-7.1.1.tgz",
@@ -10091,6 +10130,11 @@
         "postcss": "^8.1.0"
       }
     },
+    "node_modules/idb-keyval": {
+      "version": "6.2.1",
+      "resolved": "https://registry.npmmirror.com/idb-keyval/-/idb-keyval-6.2.1.tgz",
+      "integrity": "sha512-8Sb3veuYCyrZL+VBt9LJfZjLUPWVvqn8tG28VqYNFCo43KHcKuq+b4EiXGeuaLAQWL2YmyDgMp2aSpH9JHsEQg=="
+    },
     "node_modules/ieee754": {
       "version": "1.2.1",
       "resolved": "https://registry.npmmirror.com/ieee754/-/ieee754-1.2.1.tgz",
@@ -13382,6 +13426,25 @@
         "node": ">=6"
       }
     },
+    "node_modules/parse": {
+      "version": "5.2.0",
+      "resolved": "https://registry.npmmirror.com/parse/-/parse-5.2.0.tgz",
+      "integrity": "sha512-FoD3kcLAQCw/2J1984sl3GUBzbHE2tA9mUcyw/EBWZ46WVZTzV+kjnA5tttXyzN4uodt21wSluzjbGnyLqreKw==",
+      "dependencies": {
+        "@babel/runtime-corejs3": "7.24.6",
+        "idb-keyval": "6.2.1",
+        "react-native-crypto-js": "1.0.0",
+        "uuid": "10.0.0",
+        "ws": "8.17.1",
+        "xmlhttprequest": "1.8.0"
+      },
+      "engines": {
+        "node": ">=18 <21"
+      },
+      "optionalDependencies": {
+        "crypto-js": "4.2.0"
+      }
+    },
     "node_modules/parse-imports": {
       "version": "2.1.1",
       "resolved": "https://registry.npmmirror.com/parse-imports/-/parse-imports-2.1.1.tgz",
@@ -13434,6 +13497,18 @@
         "node": ">= 0.10"
       }
     },
+    "node_modules/parse/node_modules/uuid": {
+      "version": "10.0.0",
+      "resolved": "https://registry.npmmirror.com/uuid/-/uuid-10.0.0.tgz",
+      "integrity": "sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==",
+      "funding": [
+        "https://github.com/sponsors/broofa",
+        "https://github.com/sponsors/ctavan"
+      ],
+      "bin": {
+        "uuid": "dist/bin/uuid"
+      }
+    },
     "node_modules/parse5": {
       "version": "7.1.2",
       "resolved": "https://registry.npmmirror.com/parse5/-/parse5-7.1.2.tgz",
@@ -14075,6 +14150,11 @@
       "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==",
       "dev": true
     },
+    "node_modules/react-native-crypto-js": {
+      "version": "1.0.0",
+      "resolved": "https://registry.npmmirror.com/react-native-crypto-js/-/react-native-crypto-js-1.0.0.tgz",
+      "integrity": "sha512-FNbLuG/HAdapQoybeZSoes1PWdOj0w242gb+e1R0hicf3Gyj/Mf8M9NaED2AnXVOX01b2FXomwUiw1xP1K+8sA=="
+    },
     "node_modules/readable-stream": {
       "version": "3.6.2",
       "resolved": "https://registry.npmmirror.com/readable-stream/-/readable-stream-3.6.2.tgz",
@@ -14140,8 +14220,7 @@
     "node_modules/regenerator-runtime": {
       "version": "0.14.1",
       "resolved": "https://registry.npmmirror.com/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz",
-      "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==",
-      "dev": true
+      "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw=="
     },
     "node_modules/regenerator-transform": {
       "version": "0.15.2",
@@ -17326,7 +17405,6 @@
       "version": "8.17.1",
       "resolved": "https://registry.npmmirror.com/ws/-/ws-8.17.1.tgz",
       "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
-      "dev": true,
       "engines": {
         "node": ">=10.0.0"
       },
@@ -17374,6 +17452,14 @@
         "node": ">=8.0"
       }
     },
+    "node_modules/xmlhttprequest": {
+      "version": "1.8.0",
+      "resolved": "https://registry.npmmirror.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz",
+      "integrity": "sha512-58Im/U0mlVBLM38NdZjHyhuMtCqa61469k2YP/AaPbvCoV9aQGUpbJBj1QRm2ytRiVQBD/fsw7L2bJGDVQswBA==",
+      "engines": {
+        "node": ">=0.4.0"
+      }
+    },
     "node_modules/y18n": {
       "version": "5.0.8",
       "resolved": "https://registry.npmmirror.com/y18n/-/y18n-5.0.8.tgz",

+ 2 - 0
package.json

@@ -28,6 +28,7 @@
     "@capacitor/status-bar": "6.0.0",
     "@ionic/angular": "^8.0.0",
     "ionicons": "^7.0.0",
+    "parse": "^5.2.0",
     "rxjs": "~7.8.0",
     "tslib": "^2.3.0",
     "zone.js": "~0.14.2"
@@ -45,6 +46,7 @@
     "@capacitor/cli": "6.1.0",
     "@ionic/angular-toolkit": "^11.0.1",
     "@types/jasmine": "~5.1.0",
+    "@types/parse": "^3.0.9",
     "@typescript-eslint/eslint-plugin": "^6.0.0",
     "@typescript-eslint/parser": "^6.0.0",
     "eslint": "^8.57.0",

+ 8 - 7
src/app/feedback/feedback.page.html

@@ -9,13 +9,14 @@
 
 <ion-content>
   <ion-list lines="none">
-  <ion-item *ngFor="let message of chatMessages" [class.sender]="message.sender === 'customer'">
-    <ion-avatar slot="start">
-      <ion-img [src]="'D:\workspace\APPmy\asset\img' + message.avatar"></ion-img>
-    </ion-avatar>
-    <ion-label>{{ message.text }}</ion-label>
-  </ion-item>
-</ion-list>
+    <ion-item *ngFor="let message of chatMessages" [class.sender]="message.sender === 'customer'">
+      <ion-avatar slot="start">
+        <ion-img [src]="message.avatar"></ion-img>
+      </ion-avatar>
+      <ion-label>{{ message.text }}</ion-label>
+    </ion-item>
+  </ion-list>
+  
 
 
   <ion-footer>

+ 3 - 3
src/app/feedback/feedback.page.ts

@@ -15,14 +15,14 @@ export class FeedbackPage implements OnInit {
   ngOnInit() {
     // 模拟一些聊天消息
     this.chatMessages = [
-      { text: '你好,请问有什么可以帮助您的吗?', sender: 'customer', avatar: 'customer-avatar.jpg' },
-      { text: '您好,我想咨询一下关于产品的信息。', sender: 'support', avatar: 'support-avatar.png' }
+      { text: '你好,请问有什么可以帮助您的吗?', sender: 'customer', avatar: 'https://img-bsy.txrpic.com/preview/Element/00/00/89/11/E-891182-2418FE26A.png?imageMogr2/quality/90/thumbnail/320x%3E' },
+      { text: '您好,我想咨询一下关于产品的信息。', sender: 'support', avatar: 'https://tse3-mm.cn.bing.net/th/id/OIP-C.c43kVbudRWN3-pJYtmfugAAAAA?rs=1&pid=ImgDetMain' }
     ];
   }
 
   sendMessage() {
     if (this.newMessage.trim() !== '') {
-      this.chatMessages.push({ text: this.newMessage, sender: 'customer', avatar: 'customer-avatar.jpg' });
+      this.chatMessages.push({ text: this.newMessage, sender: 'customer', avatar: 'https://tse3-mm.cn.bing.net/th/id/OIP-C.c43kVbudRWN3-pJYtmfugAAAAA?rs=1&pid=ImgDetMain' });
       // 在这里可以添加客服回复的逻辑
       this.newMessage = '';
     }

+ 23 - 3
src/app/login/login.page.html

@@ -9,18 +9,38 @@
 
 <ion-content>
   <ion-card>
+    <ion-card-header>
+      注册
+    </ion-card-header>
     <ion-card-content>
       <ion-item>
         <ion-label position="floating">用户名</ion-label>
-        <ion-input type="text"></ion-input>
+        <ion-input type="text" [(ngModel)]="registerUsername"></ion-input>
       </ion-item>
       <ion-item>
         <ion-label position="floating">密码</ion-label>
-        <ion-input type="password"></ion-input>
+        <ion-input type="password" [(ngModel)]="registerPassword"></ion-input>
       </ion-item>
+      <ion-button expand="block" (click)="register()">注册</ion-button>
     </ion-card-content>
   </ion-card>
-</ion-content>
 
+  <ion-card>
+    <ion-card-header>
+      登录
+    </ion-card-header>
+    <ion-card-content>
+      <ion-item>
+        <ion-label position="floating">用户名</ion-label>
+        <ion-input type="text" [(ngModel)]="loginUsername"></ion-input>
+      </ion-item>
+      <ion-item>
+        <ion-label position="floating">密码</ion-label>
+        <ion-input type="password" [(ngModel)]="loginPassword"></ion-input>
+      </ion-item>
+      <ion-button expand="block" (click)="login()">登录</ion-button>
+    </ion-card-content>
+  </ion-card>
+</ion-content>
 
 

+ 27 - 1
src/app/login/login.page.ts

@@ -1,4 +1,5 @@
 import { Component, OnInit } from '@angular/core';
+import { Parse } from 'parse';
 
 @Component({
   selector: 'app-login',
@@ -6,8 +7,33 @@ import { Component, OnInit } from '@angular/core';
   styleUrls: ['./login.page.scss'],
 })
 export class LoginPage implements OnInit {
+  registerUsername: string = '';
+  registerPassword: string = '';
+  loginUsername: string = '';
+  loginPassword: string = '';
 
-  constructor() { }
+  constructor() {private navCtrl: NavController }
+  
+  register() {
+    Parse.User.signUp(this.registerUsername, this.registerPassword).then((user) => {
+      console.log('User signed up', user);
+      // 注册成功后可以自动登录
+      this.login();
+    }).catch((error) => {
+      console.error('Error signing up', error);
+    });
+  }
+
+  login() {
+    Parse.User.logIn(this.loginUsername, this.loginPassword).then((user) => {
+      console.log('User logged in', user);
+      // 登录成功后导航到“我的”页面
+      this.navCtrl.navigateForward('/tabs/tab4');
+    }).catch((error) => {
+      console.error('Error logging in', error);
+    });
+  }
+}
 
   ngOnInit() {
   }

+ 3 - 1
src/app/tab4/tab4.page.ts

@@ -1,5 +1,6 @@
 import { Component, OnInit } from '@angular/core';
 import { NavController } from '@ionic/angular';
+import { Router } from '@angular/router';
 
 @Component({
   selector: 'app-tab4',
@@ -8,7 +9,7 @@ import { NavController } from '@ionic/angular';
 })
 export class Tab4Page implements OnInit {
 
-  constructor(private navCtrl: NavController) {}//this.selectedContent = '发布';
+  constructor(private navCtrl: NavController,private router: Router) {}//this.selectedContent = '发布';
   selectedContent: string = '发布';
 
   publishedWorks: any[] = [
@@ -67,6 +68,7 @@ export class Tab4Page implements OnInit {
 
   openSettingsPage() {
     // 打开设置页面
+    this.router.navigate(['/settings']);
   }
 
   openLoginPage() {

+ 0 - 0
asset/img/support-avatar.png → src/assets/img/support-avatar.png