import { Component, OnInit } from '@angular/core';
import { ParseObject } from '../results/results-post';
import Parse from "parse"
Parse.initialize("dev");
Parse.serverURL="http://web2023.fmode.cn:9999/parse";
@Component({
  selector: 'app-case-parse',
  templateUrl: './case-parse.page.html',
  styleUrls: ['./case-parse.page.scss'],
})
export class CaseParsePage implements OnInit {

  constructor() { }

  FaceList: Array<any> = []; // 更改为any类型，因为我们不知道ParseObject的具体结构

  ngOnInit() {
    this.loadFaces();
    
  }

  async loadFaces() {
    let query = new ParseObject("MagicMirror");
    let list = await query.findAll();
    this.FaceList = list;
    // 打印出每个Face对象的image属性
    this.FaceList.forEach(face => {
      face.features= JSON.parse(face.features)
     // 将提取的属性添加到Face对象中
     face.XiaTing = face.features.三庭比例?.下庭;
     face.ZhongTing = face.features.三庭比例?.中庭;
     face.QianTing = face.features.三庭比例?.前庭;
     face.XiaBa = face.features.下巴;
     face.WuYan = face.features.五眼比例;
     face.ChunXing = face.features.唇形;
     face.MeiXing = face.features.眉形;
     face.YanXing = face.features.眼睛形状;
     face.LianXing = face.features.脸型;
     face.LianJia = face.features.脸颊;
     face.ETou = face.features.额头;
     face.QuanGu = face.features.颧骨;
     face.BiXing = face.features.鼻形;
      return face
    });
  }
}
