1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108 |
- <!doctype html>
- <html class="no-js" lang="">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="x-ua-compatible" content="ie=edge">
- <title>app-angular documentation</title>
- <meta name="description" content="">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="icon" type="image/x-icon" href="../images/favicon.ico">
- <link rel="stylesheet" href="../styles/style.css">
- </head>
- <body>
- <div class="navbar navbar-default navbar-fixed-top visible-xs">
- <a href="../" class="navbar-brand">app-angular documentation</a>
- <button type="button" class="btn btn-default btn-menu fa fa-bars" id="btn-menu"></button>
- </div>
- <div class="xs-menu menu" id="mobile-menu">
- <div id="book-search-input" role="search">
- <input type="text" placeholder="Type to search">
- </div>
- <nav>
-
- <ul class="list">
-
- <li class="title">
- <a href="../">app-angular documentation</a>
- </li>
-
- <li class="divider"></li>
-
-
- <li class="chapter">
- <a data-type="chapter-link" href="../"><span class="fa fa-home"></span>Getting started</a>
- <ul class="links">
- <li class="link">
- <a href="../" ><span class="fa fa-file-text-o"></span>README</a>
- </li>
- <li class="link">
- <a
-
- href="../overview.html"
- href="../overview.html"
- >
- <span class="fa fa-th"></span>Overview
- </a>
- </li>
- </ul>
- </li>
-
- <li class="chapter">
- <a data-type="chapter-link" href="./modules.html" >
- <span class="fa fa-archive"></span>
- <span>Modules</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#xs-modules-links"
- ></span>
- </a>
- <ul class="links collapse in"
- id="xs-modules-links"
- >
- <li class="link">
- <a href="../modules/AppModule.html" >AppModule</a>
- </li>
- <li class="link">
- <a href="../modules/LessonModule.html" >LessonModule</a>
- </li>
- </ul>
- </li>
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-cogs"></span>
- <span>Components</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#xs-components-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="xs-components-links"
- >
- <li class="link">
- <a href="../components/AppComponent.html" >AppComponent</a>
- </li>
- <li class="link">
- <a href="../components/BblComponent.html" >BblComponent</a>
- </li>
- <li class="link">
- <a href="../components/DetailComponent.html" >DetailComponent</a>
- </li>
- <li class="link">
- <a href="../components/EcharsComponent.html" >EcharsComponent</a>
- </li>
- <li class="link">
- <a href="../components/EchartsExempleComponent.html" >EchartsExempleComponent</a>
- </li>
- <li class="link">
- <a href="../components/EditComponent.html" >EditComponent</a>
- </li>
- <li class="link">
- <a href="../components/FlowfatherComponent.html" >FlowfatherComponent</a>
- </li>
- <li class="link">
- <a href="../components/FlowtestComponent.html" >FlowtestComponent</a>
- </li>
- <li class="link">
- <a href="../components/HomeComponent.html" class="active" >HomeComponent</a>
- </li>
- <li class="link">
- <a href="../components/NavTabsComponent.html" >NavTabsComponent</a>
- </li>
- <li class="link">
- <a href="../components/PageMineComponent.html" >PageMineComponent</a>
- </li>
- <li class="link">
- <a href="../components/PageSpotDetailComponent.html" >PageSpotDetailComponent</a>
- </li>
- </ul>
- </li>
-
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-file-code-o"></span>
- <span>Classes</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#xs-classes-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="xs-classes-links"
- >
- <li class="link">
- <a href="../classes/TestChatCompletion.html" >TestChatCompletion</a>
- </li>
- </ul>
- </li>
-
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-long-arrow-down"></span>
- <span>Injectables</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#xs-injectables-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="xs-injectables-links"
- >
- <li class="link">
- <a href="../injectables/DataServiceService.html" >DataServiceService</a>
- </li>
- </ul>
- </li>
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-info"></span>
- <span>Interfaces</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#xs-interfaces-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="xs-interfaces-links"
- >
- <li class="link">
- <a href="../interfaces/TestChatMessage.html" >TestChatMessage</a>
- </li>
- </ul>
- </li>
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-plus"></span>
- <span>Pipes</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#xs-pipes-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="xs-pipes-links"
- >
- <li class="link">
- <a href="../pipes/TokPipe.html" >TokPipe</a>
- </li>
- </ul>
- </li>
-
-
- <li class="chapter">
- <a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
- </li>
-
- <li class="divider"></li>
- <li class="copyright">
- Documentation generated using <a href="https://compodoc.github.io/compodoc/" target="_blank">
- <img src="..//images/compodoc-vectorise.svg" class="img-responsive">
- </a>
- </li>
-
- </ul>
-
- </nav>
- </div>
- <div class="container-fluid main">
- <div class="row main">
- <div class="hidden-xs menu">
- <nav>
-
- <ul class="list">
-
- <li class="title">
- <a href="../">app-angular documentation</a>
- </li>
-
- <li class="divider"></li>
-
- <div id="book-search-input" role="search">
- <input type="text" placeholder="Type to search">
- </div>
-
- <li class="chapter">
- <a data-type="chapter-link" href="../"><span class="fa fa-home"></span>Getting started</a>
- <ul class="links">
- <li class="link">
- <a href="../" ><span class="fa fa-file-text-o"></span>README</a>
- </li>
- <li class="link">
- <a
-
- href="../overview.html"
- href="../overview.html"
- >
- <span class="fa fa-th"></span>Overview
- </a>
- </li>
- </ul>
- </li>
-
- <li class="chapter">
- <a data-type="chapter-link" href="./modules.html" >
- <span class="fa fa-archive"></span>
- <span>Modules</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#modules-links"
- ></span>
- </a>
- <ul class="links collapse in"
- id="modules-links"
- >
- <li class="link">
- <a href="../modules/AppModule.html" >AppModule</a>
- </li>
- <li class="link">
- <a href="../modules/LessonModule.html" >LessonModule</a>
- </li>
- </ul>
- </li>
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-cogs"></span>
- <span>Components</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#components-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="components-links"
- >
- <li class="link">
- <a href="../components/AppComponent.html" >AppComponent</a>
- </li>
- <li class="link">
- <a href="../components/BblComponent.html" >BblComponent</a>
- </li>
- <li class="link">
- <a href="../components/DetailComponent.html" >DetailComponent</a>
- </li>
- <li class="link">
- <a href="../components/EcharsComponent.html" >EcharsComponent</a>
- </li>
- <li class="link">
- <a href="../components/EchartsExempleComponent.html" >EchartsExempleComponent</a>
- </li>
- <li class="link">
- <a href="../components/EditComponent.html" >EditComponent</a>
- </li>
- <li class="link">
- <a href="../components/FlowfatherComponent.html" >FlowfatherComponent</a>
- </li>
- <li class="link">
- <a href="../components/FlowtestComponent.html" >FlowtestComponent</a>
- </li>
- <li class="link">
- <a href="../components/HomeComponent.html" class="active" >HomeComponent</a>
- </li>
- <li class="link">
- <a href="../components/NavTabsComponent.html" >NavTabsComponent</a>
- </li>
- <li class="link">
- <a href="../components/PageMineComponent.html" >PageMineComponent</a>
- </li>
- <li class="link">
- <a href="../components/PageSpotDetailComponent.html" >PageSpotDetailComponent</a>
- </li>
- </ul>
- </li>
-
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-file-code-o"></span>
- <span>Classes</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#classes-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="classes-links"
- >
- <li class="link">
- <a href="../classes/TestChatCompletion.html" >TestChatCompletion</a>
- </li>
- </ul>
- </li>
-
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-long-arrow-down"></span>
- <span>Injectables</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#injectables-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="injectables-links"
- >
- <li class="link">
- <a href="../injectables/DataServiceService.html" >DataServiceService</a>
- </li>
- </ul>
- </li>
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-info"></span>
- <span>Interfaces</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#interfaces-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="interfaces-links"
- >
- <li class="link">
- <a href="../interfaces/TestChatMessage.html" >TestChatMessage</a>
- </li>
- </ul>
- </li>
-
- <li class="chapter">
- <div class="simple">
- <span class="fa fa-plus"></span>
- <span>Pipes</span>
- <span class="menu-toggler fa fa-angle-up" data-toggle="collapse"
- data-target="#pipes-links"
- ></span>
- </div>
- <ul class="links collapse in"
- id="pipes-links"
- >
- <li class="link">
- <a href="../pipes/TokPipe.html" >TokPipe</a>
- </li>
- </ul>
- </li>
-
-
- <li class="chapter">
- <a data-type="chapter-link" href="../coverage.html" ><span class="fa fa-tasks"></span>Documentation coverage</a>
- </li>
-
- <li class="divider"></li>
- <li class="copyright">
- Documentation generated using <a href="https://compodoc.github.io/compodoc/" target="_blank">
- <img src="..//images/compodoc-vectorise.svg" class="img-responsive">
- </a>
- </li>
-
- </ul>
-
- </nav>
- </div>
- <div class="content component">
- <div class="content-data">
- <ol class="breadcrumb">
- <li>Components</li>
- <li>HomeComponent</li>
- </ol>
- <ul class="nav nav-tabs" role="tablist">
- <li class="active">
- <a href="#infos" id="infos-tab" role="tab" data-toggle="tab">Infos</a>
- </li>
- <li>
- <a href="#source" role="tab" id="source-tab" data-toggle="tab">Source</a>
- </li>
- </ul>
- <div class="tab-content">
- <div class="tab-pane fade active in" id="infos"><p class="comment">
- <h3>File</h3>
- </p>
- <p class="comment">
- <code>src/modules/lesson/home/home.component.ts</code>
- </p>
- <section>
- <h3>Metadata</h3>
- <table class="table table-sm table-hover">
- <tbody>
- <tr>
- <td class="col-md-3">selector</td>
- <td class="col-md-9"><code>app-home</code></td>
- </tr>
- <tr>
- <td class="col-md-3">styleUrls</td>
- <td class="col-md-9"><code>home.component.scss</code></td>
- </tr>
- <tr>
- <td class="col-md-3">templateUrl</td>
- <td class="col-md-9"><code>home.component.html</code></td>
- </tr>
- </tbody>
- </table>
- </section>
- <section>
- <h3 id="constructor">Constructor</h3>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <code>constructor(formBuilder: <a href="https://angular.io/docs/ts/latest/api/forms/index/FormBuilder-class.html" target="_blank" >FormBuilder</a>, alertController: AlertController)</code>
- </td>
- </tr>
-
- </tbody>
- </table>
- </section>
- <section>
- <h3 id="methods">Methods</h3>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b><span class="modifier"></span> isNewDay</b>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <span class="modifier-icon method fa fa-play ">
- <span class="fa fa-"></span>
- </span>
- <code>isNewDay()</code>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <div class="io-description">
- <b>Returns: </b> <code>any</code>
-
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b><span class="modifier"></span> getProfilePointer</b>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <span class="modifier-icon method fa fa-play ">
- <span class="fa fa-"></span>
- </span>
- <code>getProfilePointer()</code>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <div class="io-description">
- <b>Returns: </b> <code>void</code>
-
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b><span class="modifier"></span> upload</b>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <span class="modifier-icon method fa fa-play ">
- <span class="fa fa-"></span>
- </span>
- <code>upload()</code>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <div class="io-description">
- <b>Returns: </b> <code>void</code>
-
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b><span class="modifier"></span> Eatupload</b>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <span class="modifier-icon method fa fa-play ">
- <span class="fa fa-"></span>
- </span>
- <code>Eatupload()</code>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <div class="io-description">
- <b>Returns: </b> <code>void</code>
-
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b><span class="modifier"></span> getLastUploadTime</b>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <span class="modifier-icon method fa fa-play ">
- <span class="fa fa-"></span>
- </span>
- <code>getLastUploadTime()</code>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <div class="io-description">
- <b>Returns: </b> <code>any</code>
-
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b><span class="modifier"></span> presentAlert</b>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <span class="modifier-icon method fa fa-play ">
- <span class="fa fa-"></span>
- </span>
- <code>presentAlert()</code>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <div class="io-description">
- <b>Returns: </b> <code>void</code>
-
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b><span class="modifier"></span> initializeHighlightedDates</b>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <span class="modifier-icon method fa fa-play ">
- <span class="fa fa-"></span>
- </span>
- <code>initializeHighlightedDates()</code>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <div class="io-description">
- <b>Returns: </b> <code>void</code>
-
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b><span class="modifier"></span> getDate</b>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <span class="modifier-icon method fa fa-play ">
- <span class="fa fa-"></span>
- </span>
- <code>getDate()</code>
- </td>
- </tr>
-
- <tr>
- <td class="col-md-4">
- <div class="io-description">
- <b>Returns: </b> <code>any</code>
-
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </section>
- <section>
- <h3 id="inputs">Properties</h3>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b> alertButtons</b>
- </td>
- </tr>
- <tr>
- <td class="col-md-4">
- <code>alertButtons: <code>string[]</code>
- </bcode>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b> date</b>
- </td>
- </tr>
- <tr>
- <td class="col-md-4">
- <code>date: <code>any</code>
- </bcode>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b> food</b>
- </td>
- </tr>
- <tr>
- <td class="col-md-4">
- <code>food: <code>string</code>
- </bcode>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b> height</b>
- </td>
- </tr>
- <tr>
- <td class="col-md-4">
- <code>height: <code>number</code>
- </bcode>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b> highlightedDates</b>
- </td>
- </tr>
- <tr>
- <td class="col-md-4">
- <code>highlightedDates: <code>{ date: string; textColor: string; backgroundColor: string; }[]</code>
- </bcode>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b> lastUploadDate</b>
- </td>
- </tr>
- <tr>
- <td class="col-md-4">
- <code>lastUploadDate: <code>any</code>
- </bcode>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b> myForm</b>
- </td>
- </tr>
- <tr>
- <td class="col-md-4">
- <code>myForm: <code>any</code>
- </bcode>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b> title</b>
- </td>
- </tr>
- <tr>
- <td class="col-md-4">
- <code>title: <code>string</code>
- </bcode>
- </td>
- </tr>
- <tr>
- <td class="col-md-4">
- <i>Default value: </i><code>app-angular</code>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b> today</b>
- </td>
- </tr>
- <tr>
- <td class="col-md-4">
- <code>today: <code>Date</code>
- </bcode>
- </td>
- </tr>
- </tbody>
- </table>
- <table class="table table-sm table-bordered">
- <tbody>
- <tr>
- <td class="col-md-4">
- <b> weight</b>
- </td>
- </tr>
- <tr>
- <td class="col-md-4">
- <code>weight: <code>number</code>
- </bcode>
- </td>
- </tr>
- </tbody>
- </table>
- </section>
- </div>
- <div class="tab-pane fade tab-source-code" id="source">
- <pre><code class="hljs javascript">import { Component, OnInit } from '@angular/core';
- import { FormBuilder, FormGroup, Validators } from '@angular/forms';
- import { AlertController } from '@ionic/angular';
- import * as Parse from "parse"
- (Parse as any).serverURL = "http://metapunk.cn:9999/parse"
- Parse.initialize("dev")
- @Component({
- selector: 'app-home',
- templateUrl: './home.component.html',
- styleUrls: ['./home.component.scss']
- })
- export class HomeComponent implements OnInit {
- alertButtons = ['好的'];
- myForm: any;
- ngOnInit() {
- this.myForm = this.formBuilder.group({
- height: ['', Validators.required],
- weight: ['', Validators.required]
- });
- }
- title = 'app-angular';
- height: number | null = null;
- weight: number | null = null;
- food: string | null = null;
- today: Date = new Date();
- lastUploadDate: Promise<Date | null> = this.getLastUploadTime();
- async isNewDay(): Promise<boolean> {
- const currentDate = new Date();
- const lastUploadDate = await this.lastUploadDate;
- return (
- lastUploadDate === null ||
- currentDate.getDate() !== lastUploadDate.getDate() ||
- currentDate.getMonth() !== lastUploadDate.getMonth() ||
- currentDate.getFullYear() !== lastUploadDate.getFullYear()
- );
- }
- async getProfilePointer() {
- // 定义要查询的profileId
- const profileId = "肖宇杰";
- // 创建查询对象
- const Profile = Parse.Object.extend("Profile");
- const query = new Parse.Query(Profile);
- // 设置查询条件
- query.equalTo("name", profileId);
- try {
- // 执行查询
- const result = await query.first();
- if (result) {
- // 查询成功,result为查询到的行对象
- const profilePointer = {
- __type: "Pointer",
- className: "Profile",
- objectId: result.id
- };
- console.log("指向Profile表中name为profileId的行的指针:", profilePointer);
- return profilePointer;
- } else {
- // 没有找到匹配的行
- console.log("找不到匹配的行");
- return null;
- }
- } catch (error) {
- // 查询出错
- console.log("查询出错:", error);
- return null;
- }
- }
- async upload() {
- // await this.isNewDay()
- if (true) {
- if (this.height && this.weight) { // 添加验证条件
- // 在这里编写上传逻辑
- let YourClass = Parse.Object.extend("HealthData");
- let yourObject = new YourClass();
- yourObject.set("profile", await this.getProfilePointer());
- yourObject.set({ "height": this.height, "weight": this.weight });
- yourObject.save().then((result: any) => {
- console.log("数据上传成功", result);
- this.height = null;
- this.weight = null;
- }).catch((error: any) => {
- console.error("数据上传失败", error);
- });
- this.lastUploadDate = Promise.resolve(this.today);
- } else {
- console.log("身高或体重为空");
- }
- } else {
- console.log("今天已经上传过了");
- this.height = null;
- this.weight = null;
- }
- }
- async Eatupload() {
- if (!this.food) {
- // 显示错误消息或执行其他操作
- console.log("请输入食物");
- return;
- }
- let YourClass = Parse.Object.extend("HealthEat");
- let yourObject = new YourClass();
- yourObject.set({ "food": this.food, });
- yourObject.save().then((result: any) => {
- console.log("数据上传成功", result);
- this.food = ""
- }).catch((error: any) => {
- console.error("数据上传失败", error);
- });
- }
- async getLastUploadTime(): Promise<Date | null> {
- const Upload = Parse.Object.extend("HealthData");
- const query = new Parse.Query(Upload);
- query.descending("createdAt");
- try {
- const result = await query.first();
- if (result) {
- const lastUploadTime = result.get("createdAt");
- console.log("最后一次上传时间:", lastUploadTime);
- return lastUploadTime;
- } else {
- return null;
- }
- } catch (error) {
- console.error("Error:", error);
- return null;
- }
- }
- date: Promise<string[] | null> = this.getDate();
- highlightedDates: { date: string | null, textColor: string, backgroundColor: string }[] = [];
- constructor(private formBuilder: FormBuilder, private alertController: AlertController) {
- this.initializeHighlightedDates();
- myForm: FormGroup;
- }
- async presentAlert() {
- const alert = await this.alertController.create({
- message: '上传成功',
- buttons: ['OK'],
- });
- await alert.present();
- }
- async initializeHighlightedDates() {
- const dates = await this.date;
- if (dates && dates.length > 0) {
- this.highlightedDates = dates.map(date => ({
- date,
- textColor: '#09721b',
- backgroundColor: '#c8e5d0',
- }));
- }
- }
- async getDate(): Promise<string[] | null> {
- const Upload = Parse.Object.extend("HealthData");
- const query = new Parse.Query(Upload);
- query.descending("createdAt");
- try {
- const result = await query.find();
- if (result.length > 0) {
- const Dates = result.map((result) => {
- const date = result.get("createdAt");
- return date.toISOString().split('T')[0];
- }).reverse();
- console.log("日期数组", Dates);
- return Dates;
- } else {
- return null;
- }
- } catch (error) {
- console.error("Error:", error);
- return null;
- }
- }
- }
- </code></pre>
- </div>
- </div>
- </div><div class="search-results">
- <div class="has-results">
- <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
- <ul class="search-results-list"></ul>
- </div>
- <div class="no-results">
- <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
- </div>
- </div>
- </div>
- </div>
- </div>
- <script src="../js/libs/bootstrap-native.js"></script>
- <script src="../js/libs/es6-shim.min.js"></script>
- <script src="../js/libs/EventDispatcher.js"></script>
- <script src="../js/libs/promise.min.js"></script>
- <script src="../js/libs/zepto.min.js"></script>
- <script src="../js/compodoc.js"></script>
- <script src="../js/search/search.js"></script>
- <script src="../js/search/lunr.min.js"></script>
- <script src="../js/search/search-lunr.js"></script>
- <script src="../js/menu.js"></script>
- <script src="../js/libs/highlight.pack.js"></script>
- <script src="../js/libs/highlightjs-line-numbers.min.js"></script>
- <script src="../js/search/search_index.js"></script>
- <script>
- document.addEventListener('DOMContentLoaded', function() {
- hljs.initHighlightingOnLoad();
- hljs.initLineNumbersOnLoad();
- });
- </script>
- </body>
- </html>
|