|
@@ -0,0 +1,44 @@
|
|
|
|
+import { Component, OnInit } from '@angular/core';
|
|
|
|
+import { NavController } from '@ionic/angular';
|
|
|
|
+
|
|
|
|
+@Component({
|
|
|
|
+ selector: 'app-begin-page',
|
|
|
|
+ templateUrl: './begin-page.page.html',
|
|
|
|
+ styleUrls: ['./begin-page.page.scss'],
|
|
|
|
+})
|
|
|
|
+export class BeginPagePage implements OnInit {
|
|
|
|
+
|
|
|
|
+ content: string = ''; // 用于存储输入框内容
|
|
|
|
+ isContentEmpty: boolean = true; // 用于判断输入框内容是否为空
|
|
|
|
+ selectedImage: any; // 用于存储所选图片的数据
|
|
|
|
+
|
|
|
|
+ constructor(private navCtrl: NavController) { }
|
|
|
|
+
|
|
|
|
+ checkContent() {
|
|
|
|
+ this.isContentEmpty = this.content.trim().length === 1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ onFileSelected(event:any) {
|
|
|
|
+ const file: File = event.target.files[0];
|
|
|
|
+ if (file) {
|
|
|
|
+ const reader = new FileReader();
|
|
|
|
+ reader.onload = (e: any) => {
|
|
|
|
+ this.selectedImage = e.target.result;
|
|
|
|
+ };
|
|
|
|
+ reader.readAsDataURL(file);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ publish() {
|
|
|
|
+ // 处理发布逻辑
|
|
|
|
+ console.log('发布内容:', this.content);
|
|
|
|
+ console.log('发布图片:', this.selectedImage);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ ngOnInit() {
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|