{"id":85975,"date":"2026-07-28T01:57:41","date_gmt":"2026-07-27T17:57:41","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/85975.html"},"modified":"2026-07-28T01:57:41","modified_gmt":"2026-07-27T17:57:41","slug":"%e3%80%90%e7%ac%94%e4%b8%8b%e7%94%9f%e8%be%89%ef%bd%9c08%e3%80%91harmonyos-arkts-%e6%94%b6%e8%97%8f%e9%a1%b5%e5%ae%9e%e6%88%98%ef%bc%9a%e5%a4%84%e7%90%86%e6%94%b6%e8%97%8f%e5%88%87%e6%8d%a2%e3%80%81","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/85975.html","title":{"rendered":"\u3010\u7b14\u4e0b\u751f\u8f89\uff5c08\u3011HarmonyOS ArkTS \u6536\u85cf\u9875\u5b9e\u6218\uff1a\u5904\u7406\u6536\u85cf\u5207\u6362\u3001\u5217\u8868\u5237\u65b0\u548c\u7a7a\u72b6\u6001"},"content":{"rendered":"<p>\u5b66\u4e60\u7c7b HarmonyOS \u5e94\u7528\u91cc&#xff0c;\u201c\u6536\u85cf\u9875\u201d\u901a\u5e38\u4e0d\u662f\u4e00\u4e2a\u5355\u7eaf\u7684\u5217\u8868\u9875\u3002\u7528\u6237\u5728\u7b54\u9898\u9875\u6536\u85cf\u4e00\u9053\u9898\u3001\u5199\u4e00\u6761\u7b14\u8bb0\u3001\u7b54\u9519\u4e00\u6b21\u9898&#xff0c;\u56de\u5230\u5b66\u4e60\u5939\u65f6\u5e0c\u671b\u9a6c\u4e0a\u770b\u5230\u53d8\u5316&#xff1b;\u5982\u679c\u70b9\u5f00\u6536\u85cf\u9898\u76ee\u7ee7\u7eed\u7ec3\u4e60&#xff0c;\u53c8\u5e0c\u671b\u4ece\u8fd9\u9053\u9898\u9644\u8fd1\u5f00\u59cb&#xff0c;\u800c\u4e0d\u662f\u8df3\u5230\u65e0\u5173\u9898\u76ee\u3002\u8fd9\u4e2a\u9875\u9762\u5982\u679c\u81ea\u5df1\u7ef4\u62a4\u4e00\u4efd\u72ec\u7acb\u526f\u672c&#xff0c;\u5f88\u5bb9\u6613\u51fa\u73b0\u5217\u8868\u6570\u91cf\u4e0d\u5237\u65b0\u3001\u7a7a\u72b6\u6001\u4e0d\u6d88\u5931\u3001\u9898\u5361\u70b9\u51fb\u9519\u4f4d\u7684\u95ee\u9898\u3002<\/p>\n<p>\u7b14\u4e0b\u751f\u8f89\u7684\u6536\u85cf\u9875\u7531 FavoritePage.ets \u627f\u62c5\u3002\u5b83\u6ca1\u6709\u91cd\u65b0\u62c9\u53d6\u8fdc\u7a0b\u6570\u636e&#xff0c;\u4e5f\u6ca1\u6709\u521b\u5efa\u5355\u72ec\u7684\u9875\u9762\u7f13\u5b58&#xff0c;\u800c\u662f\u901a\u8fc7 &#064;StorageLink \u76f4\u63a5\u8ba2\u9605 favoriteRecords\u3001noteRecords\u3001wrongRecords \u548c favoriteTabIndex\u3002\u6536\u85cf\u5207\u6362\u3001\u7b14\u8bb0\u4fdd\u5b58\u3001\u9519\u9898\u6536\u5f55\u4e3b\u8981\u53d1\u751f\u5728 PracticePage.ets \u548c UserDataManager.ets&#xff0c;\u6536\u85cf\u9875\u53ea\u6839\u636e\u5171\u4eab\u72b6\u6001\u6e32\u67d3\u4e09\u7c7b\u5217\u8868\u3001\u4e09\u4e2a\u7a7a\u72b6\u6001\u3001\u7b14\u8bb0\u7f16\u8f91\u5f39\u5c42\u548c\u7ee7\u7eed\u7ec3\u4e60\u5165\u53e3\u3002<\/p>\n<p>\u672c\u6587\u57fa\u4e8e\u672c\u5730\u5de5\u7a0b D:\\\\huawei\\\\one17-11 \u7684\u771f\u5b9e\u6e90\u7801\u7f16\u5199&#xff0c;\u5305\u540d\u6807\u8bb0\u4e3a com.jiaweikang.one17\u3002\u8fd9\u91cc\u9700\u8981\u660e\u786e\u8fb9\u754c&#xff1a;\u5f53\u524d\u6e90\u7801\u6ca1\u6709\u4e91\u540c\u6b65\u3001\u8d26\u53f7\u6536\u85cf\u5939\u3001\u670d\u52a1\u7aef\u6536\u85cf\u63a5\u53e3\u6216\u8de8\u8bbe\u5907\u534f\u540c&#xff1b;\u5b83\u662f\u57fa\u4e8e Preferences &#043; AppStorage \u7684\u672c\u5730\u5b66\u4e60\u8bb0\u5f55\u7ba1\u7406\u3002\u6587\u7ae0\u53ea\u8ba8\u8bba\u6e90\u7801\u53ef\u590d\u6838\u7684\u6536\u85cf\u5207\u6362\u3001\u5217\u8868\u5237\u65b0\u3001\u7a7a\u72b6\u6001\u3001\u7b14\u8bb0\u7f16\u8f91\u3001\u9519\u9898\u6e05\u7a7a\u548c\u9898\u5361\u8df3\u8f6c\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u6536\u85cf\u9875\u5c01\u9762\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260727175738-6a679c12d733c.png\" \/><\/p>\n<p>\u672c\u6587\u91cd\u70b9\u89e3\u51b3\u4e94\u4e2a\u5de5\u7a0b\u95ee\u9898&#xff1a;<\/p>\n<li>\u5982\u4f55\u8ba9\u6536\u85cf\u3001\u7b14\u8bb0\u3001\u9519\u9898\u4e09\u7c7b\u8bb0\u5f55\u5171\u7528 AppStorage \u72b6\u6001\u3002<\/li>\n<li>\u5982\u4f55\u901a\u8fc7 favoriteTabIndex \u8ba9\u5916\u90e8\u9875\u9762\u76f4\u63a5\u5207\u5230\u6307\u5b9a\u5206\u680f\u3002<\/li>\n<li>\u5982\u4f55\u5728\u4e09\u7c7b\u5217\u8868\u4e3a\u7a7a\u65f6\u5c55\u793a\u660e\u786e\u7a7a\u72b6\u6001\u3002<\/li>\n<li>\u5982\u4f55\u7f16\u8f91\u7b14\u8bb0\u5e76\u8ba9\u5217\u8868\u5185\u5bb9\u5373\u65f6\u5237\u65b0\u3002<\/li>\n<li>\u5982\u4f55\u4ece\u6536\u85cf\u9875\u9898\u5361\u56de\u5230\u7ec3\u4e60\u9875&#xff0c;\u5e76\u5c3d\u91cf\u5b9a\u4f4d\u5230\u539f\u9898\u3002<\/li>\n<p><img decoding=\"async\" alt=\"\u6536\u85cf\u9875\u5237\u65b0\u95ed\u73af\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260727175739-6a679c13979da.png\" \/><\/p>\n<p><img decoding=\"async\" alt=\"\u6536\u85cf\u9875\u804c\u8d23\u7ed3\u6784\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260727175740-6a679c142d69e.png\" \/><\/p>\n<h3>\u4e00\u3001\u6536\u85cf\u9875\u4e0d\u662f\u6570\u636e\u6e90&#xff0c;\u800c\u662f\u5171\u4eab\u72b6\u6001\u7684\u89c6\u56fe<\/h3>\n<p>FavoritePage.ets \u5f00\u5934\u5c31\u80fd\u770b\u51fa\u5b83\u7684\u6570\u636e\u6765\u6e90\u3002\u4e09\u4e2a\u8bb0\u5f55\u5217\u8868\u548c\u5f53\u524d\u5206\u680f\u90fd\u6765\u81ea &#064;StorageLink&#xff0c;\u8fd9\u610f\u5473\u7740\u5b83\u4eec\u548c\u5176\u4ed6\u9875\u9762\u5171\u4eab\u540c\u4e00\u4efd AppStorage \u72b6\u6001\u3002<\/p>\n<p>&#064;StorageLink(&#039;favoriteRecords&#039;) favRecords: FavoriteRecord[] &#061; []<br \/>\n&#064;StorageLink(&#039;noteRecords&#039;) noteRecords: NoteRecord[] &#061; []<br \/>\n&#064;StorageLink(&#039;wrongRecords&#039;) wrongRecords: WrongRecord[] &#061; []<br \/>\n&#064;StorageLink(&#039;favoriteTabIndex&#039;) tab: number &#061; 0<br \/>\n&#064;State showEditNote: boolean &#061; false<br \/>\n&#064;State editingQuestionId: string &#061; &#039;&#039;<br \/>\n&#064;State editingBankId: string &#061; &#039;&#039;<br \/>\n&#064;State editingNoteText: string &#061; &#039;&#039;<\/p>\n<p>\u8fd9\u91cc\u53ef\u4ee5\u5206\u6e05\u4e24\u7c7b\u72b6\u6001&#xff1a;<\/p>\n<table>\n<tr>\u72b6\u6001\u7c7b\u578b\u751f\u547d\u5468\u671f<\/tr>\n<tbody>\n<tr>\n<td>favRecords\/noteRecords\/wrongRecords<\/td>\n<td>&#064;StorageLink<\/td>\n<td>\u8de8\u9875\u9762\u5171\u4eab\u548c\u6301\u4e45\u5316\u6062\u590d<\/td>\n<\/tr>\n<tr>\n<td>tab<\/td>\n<td>&#064;StorageLink<\/td>\n<td>\u5916\u90e8\u9875\u9762\u53ef\u5207\u6362\u6536\u85cf\u9875\u5206\u680f<\/td>\n<\/tr>\n<tr>\n<td>showEditNote\/editing*<\/td>\n<td>&#064;State<\/td>\n<td>\u5f53\u524d\u9875\u9762\u4e34\u65f6\u7f16\u8f91\u6001<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8fd9\u79cd\u62c6\u5206\u80fd\u907f\u514d\u6536\u85cf\u9875\u5728 aboutToAppear \u91cc\u53cd\u590d\u624b\u52a8\u5237\u65b0\u3002\u53ea\u8981\u7b54\u9898\u9875\u6216\u8bbe\u7f6e\u9875\u66f4\u65b0\u4e86 AppStorage \u91cc\u7684\u6570\u7ec4&#xff0c;\u6536\u85cf\u9875\u91cd\u65b0\u6e32\u67d3\u65f6\u5c31\u80fd\u4f7f\u7528\u6700\u65b0\u503c\u3002<\/p>\n<h3>\u4e8c\u3001\u6570\u636e\u521d\u59cb\u5316\u53d1\u751f\u5728 EntryAbility&#xff0c;\u4e0d\u7531\u9875\u9762\u5404\u81ea\u5904\u7406<\/h3>\n<p>EntryAbility.ets \u521d\u59cb\u5316\u7528\u6237\u6570\u636e&#xff0c;\u5e76\u521b\u5efa favoriteTabIndex\u3002<\/p>\n<p>UserDataManager.init(this.context);<br \/>\nAppStorage.setOrCreate&lt;number&gt;(&#039;favoriteTabIndex&#039;, 0);<\/p>\n<p>UserDataManager.init \u8bfb\u53d6 Preferences \u5e76\u5199\u5165 AppStorage&#xff1a;<\/p>\n<p>const favStr &#061; UserDataManager.prefs.getSync(UserDataManager.K_FAV, &#039;[]&#039;) as string<br \/>\nconst noteStr &#061; UserDataManager.prefs.getSync(UserDataManager.K_NOTES, &#039;[]&#039;) as string<br \/>\nconst wrongStr &#061; UserDataManager.prefs.getSync(UserDataManager.K_WRONG, &#039;[]&#039;) as string<\/p>\n<p>AppStorage.setOrCreate&lt;FavoriteRecord[]&gt;(&#039;favoriteRecords&#039;, JSON.parse(favStr) as FavoriteRecord[])<br \/>\nAppStorage.setOrCreate&lt;NoteRecord[]&gt;(&#039;noteRecords&#039;, JSON.parse(noteStr) as NoteRecord[])<br \/>\nAppStorage.setOrCreate&lt;WrongRecord[]&gt;(&#039;wrongRecords&#039;, JSON.parse(wrongStr) as WrongRecord[])<\/p>\n<p>\u8fd9\u6761\u94fe\u8def\u5f88\u5173\u952e\u3002\u6536\u85cf\u9875\u4e0d\u5e94\u8be5\u76f4\u63a5\u8bfb\u53d6 Preferences&#xff0c;\u5426\u5219\u7b54\u9898\u9875\u3001\u8bbe\u7f6e\u9875\u3001\u7edf\u8ba1\u9875\u5404\u81ea\u8bfb\u5199\u5b58\u50a8&#xff0c;\u5f88\u5bb9\u6613\u51fa\u73b0\u72b6\u6001\u4e0d\u540c\u6b65\u3002\u5f53\u524d\u6e90\u7801\u628a\u6301\u4e45\u5316\u6062\u590d\u96c6\u4e2d\u5728 UserDataManager&#xff0c;\u9875\u9762\u901a\u8fc7 AppStorage \u6d88\u8d39\u7ed3\u679c\u3002<\/p>\n<h3>\u4e09\u3001\u6536\u85cf\u5207\u6362\u5728\u7b54\u9898\u9875\u53d1\u751f&#xff0c;\u6536\u85cf\u9875\u81ea\u52a8\u63a5\u6536\u7ed3\u679c<\/h3>\n<p>\u6536\u85cf\u6309\u94ae\u4f4d\u4e8e PracticePage.ets\u3002\u5f53\u524d\u9898\u76ee\u5b58\u5728\u65f6&#xff0c;\u70b9\u51fb\u6536\u85cf\u4f1a\u8c03\u7528 UserDataManager.toggleFavorite&#xff0c;\u5e76\u628a\u8fd4\u56de\u7684\u65b0\u6570\u7ec4\u8d4b\u7ed9 favRecords\u3002<\/p>\n<p>this.favRecords &#061; UserDataManager.toggleFavorite(this.favRecords, q.id, q.bankId)<\/p>\n<p>toggleFavorite \u7684\u903b\u8f91\u662f&#xff1a;\u5982\u679c\u5df2\u7ecf\u6536\u85cf&#xff0c;\u5c31\u8fc7\u6ee4\u6389\u8fd9\u6761\u8bb0\u5f55&#xff1b;\u5982\u679c\u672a\u6536\u85cf&#xff0c;\u5c31\u628a\u65b0\u8bb0\u5f55\u63d2\u5230\u6570\u7ec4\u524d\u9762&#xff0c;\u5e76\u6301\u4e45\u5316\u3002<\/p>\n<p>static toggleFavorite(records: FavoriteRecord[], questionId: string, bankId: string): FavoriteRecord[] {<br \/>\n  const exists &#061; records.some((record: FavoriteRecord) &#061;&gt; record.questionId &#061;&#061;&#061; questionId)<br \/>\n  let result: FavoriteRecord[]<br \/>\n  if (exists) {<br \/>\n    result &#061; records.filter((record: FavoriteRecord) &#061;&gt; record.questionId !&#061;&#061; questionId)<br \/>\n  } else {<br \/>\n    result &#061; [{ questionId, bankId, createdAt: nowStr() }, &#8230;records]<br \/>\n  }<br \/>\n  UserDataManager.persist(UserDataManager.K_FAV, result)<br \/>\n  return result<br \/>\n}<\/p>\n<p>\u8fd9\u4e0d\u662f\u539f\u5730\u4fee\u6539\u6570\u7ec4&#xff0c;\u800c\u662f\u8fd4\u56de\u65b0\u6570\u7ec4\u3002\u5bf9 ArkUI \u72b6\u6001\u5237\u65b0\u6765\u8bf4&#xff0c;\u8fd9\u4e00\u70b9\u5f88\u91cd\u8981&#xff1a;\u8d4b\u503c\u7ed9 &#064;StorageLink \u540e&#xff0c;\u4f9d\u8d56\u8be5\u6570\u7ec4\u7684\u9875\u9762\u624d\u66f4\u5bb9\u6613\u89e6\u53d1\u91cd\u65b0\u6e32\u67d3\u3002<\/p>\n<h3>\u56db\u3001Tabs \u7528\u540c\u4e00\u5957\u957f\u5ea6\u663e\u793a\u5b9e\u65f6\u8ba1\u6570<\/h3>\n<p>\u6536\u85cf\u9875\u9876\u90e8\u662f\u4e09\u4e2a\u5206\u680f&#xff1a;\u6536\u85cf\u3001\u7b14\u8bb0\u3001\u9519\u9898\u3002\u6570\u91cf\u901a\u8fc7 countFor(index) \u4ece\u5f53\u524d\u6570\u7ec4\u957f\u5ea6\u8ba1\u7b97\u3002<\/p>\n<p>private countFor(index: number): number {<br \/>\n  if (index &#061;&#061;&#061; 0) return this.favRecords.length<br \/>\n  if (index &#061;&#061;&#061; 1) return this.noteRecords.length<br \/>\n  return this.wrongRecords.length<br \/>\n}<\/p>\n<p>\u6e32\u67d3\u65f6\u6bcf\u4e2a tab \u90fd\u5c55\u793a\u6807\u7b7e\u548c\u6570\u91cf&#xff1a;<\/p>\n<p>ForEach([&#039;\u6536\u85cf&#039;, &#039;\u7b14\u8bb0&#039;, &#039;\u9519\u9898&#039;], (label: string, index: number) &#061;&gt; {<br \/>\n  Row({ space: 5 }) {<br \/>\n    Text(label)<br \/>\n      .fontSize(Sizes.CAPTION_FONT)<br \/>\n      .fontWeight(this.tab &#061;&#061;&#061; index ? FontWeight.Bold : FontWeight.Normal)<br \/>\n      .fontColor(this.tab &#061;&#061;&#061; index ? Color.White : Colors.TEXT_SECONDARY)<br \/>\n    Text(&#096;${this.countFor(index)}&#096;)<br \/>\n      .fontSize(Sizes.SMALL_FONT)<br \/>\n      .fontColor(this.tab &#061;&#061;&#061; index ? Color.White : Colors.TEXT_HINT)<br \/>\n  }<br \/>\n  .layoutWeight(1)<br \/>\n  .height(38)<br \/>\n  .justifyContent(FlexAlign.Center)<br \/>\n  .borderRadius(19)<br \/>\n  .backgroundColor(this.tab &#061;&#061;&#061; index ? Colors.PRIMARY : Colors.SURFACE)<br \/>\n  .onClick(() &#061;&gt; { this.tab &#061; index })<br \/>\n}, (label: string, index: number) &#061;&gt; &#096;ftab_${index}&#096;)<\/p>\n<p>\u8fd9\u91cc\u6ca1\u6709\u5355\u72ec\u7ef4\u62a4 favCount\u3001noteCount\u3001wrongCount\u3002\u8ba1\u6570\u4ece\u6570\u7ec4\u957f\u5ea6\u76f4\u63a5\u6d3e\u751f&#xff0c;\u53ef\u4ee5\u907f\u514d\u201c\u5217\u8868\u5df2\u7ecf\u5220\u7a7a\u4f46\u9876\u90e8\u6570\u5b57\u4ecd\u662f 1\u201d\u7684\u95ee\u9898\u3002<\/p>\n<h3>\u4e94\u3001\u5916\u90e8\u9875\u9762\u53ef\u4ee5\u901a\u8fc7 favoriteTabIndex \u5b9a\u4f4d\u5206\u680f<\/h3>\n<p>favoriteTabIndex \u662f\u5171\u4eab\u72b6\u6001&#xff0c;\u56e0\u6b64\u5176\u4ed6\u9875\u9762\u53ef\u4ee5\u5148\u6539\u5206\u680f&#xff0c;\u518d\u5207\u5230\u6536\u85cf\u9875\u3002\u4f8b\u5982\u9996\u9875\u9519\u9898\u590d\u4e60\u5165\u53e3\u4f1a\u8fd9\u6837\u505a&#xff1a;<\/p>\n<p>this.favoriteTabIndex &#061; 2<br \/>\nthis.currentTabIndex &#061; 3<\/p>\n<p>\u8bbe\u7f6e\u9875\u4e5f\u53ef\u4ee5\u6253\u5f00\u5bf9\u5e94\u5b66\u4e60\u6570\u636e\u9875&#xff1a;<\/p>\n<p>private openFavoriteTab(tabIndex: number): void {<br \/>\n  this.currentTabIndex &#061; 3<br \/>\n  this.favoriteTabIndex &#061; tabIndex<br \/>\n}<\/p>\n<p>\u6536\u85cf\u9875\u53ea\u9700\u8981\u628a tab \u7ed1\u5b9a\u5230 &#064;StorageLink(&#039;favoriteTabIndex&#039;)&#xff0c;\u5c31\u80fd\u627f\u63a5\u5916\u90e8\u5bfc\u822a\u610f\u56fe\u3002\u8fd9\u6bd4\u7ed9\u6536\u85cf\u9875\u7ef4\u62a4\u591a\u4e2a\u8def\u7531\u53c2\u6570\u66f4\u8f7b&#xff0c;\u9002\u5408\u8fd9\u79cd\u5e95\u90e8 Tab \u5185\u90e8\u9875\u9762\u3002<\/p>\n<h3>\u516d\u3001\u4e3b\u4f53\u6e32\u67d3\u6309\u5206\u680f\u62c6\u6210\u4e09\u4e2a\u5217\u8868<\/h3>\n<p>\u6536\u85cf\u9875\u4e3b\u4f53\u6839\u636e tab \u9009\u62e9\u6e32\u67d3\u6536\u85cf\u3001\u7b14\u8bb0\u6216\u9519\u9898\u3002<\/p>\n<p>if (this.tab &#061;&#061;&#061; 0) {<br \/>\n  this.FavList()<br \/>\n} else if (this.tab &#061;&#061;&#061; 1) {<br \/>\n  this.NoteList()<br \/>\n} else {<br \/>\n  this.WrongList()<br \/>\n}<\/p>\n<p>\u8fd9\u4e2a\u5206\u652f\u7684\u4ef7\u503c\u662f\u8ba9\u6bcf\u7c7b\u8bb0\u5f55\u62e5\u6709\u81ea\u5df1\u7684\u7a7a\u72b6\u6001\u548c\u52a8\u4f5c&#xff0c;\u800c\u4e0d\u662f\u628a\u4e09\u7c7b\u8bb0\u5f55\u5f3a\u884c\u585e\u5230\u4e00\u4e2a\u6cdb\u578b\u5217\u8868\u91cc\u3002<\/p>\n<table>\n<tr>\u5206\u680f\u6570\u636e\u6e90\u7279\u6709\u52a8\u4f5c<\/tr>\n<tbody>\n<tr>\n<td>\u6536\u85cf<\/td>\n<td>favRecords<\/td>\n<td>\u70b9\u51fb\u9898\u5361\u7ee7\u7eed\u7ec3\u4e60<\/td>\n<\/tr>\n<tr>\n<td>\u7b14\u8bb0<\/td>\n<td>noteRecords<\/td>\n<td>\u5c55\u793a\u7b14\u8bb0\u5185\u5bb9\u5e76\u652f\u6301\u7f16\u8f91<\/td>\n<\/tr>\n<tr>\n<td>\u9519\u9898<\/td>\n<td>wrongRecords<\/td>\n<td>\u9519\u9898\u7ec3\u4e60\u3001\u6e05\u7a7a\u9519\u9898<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5bf9\u9898\u5e93\u5e94\u7528\u6765\u8bf4&#xff0c;\u6536\u85cf\u3001\u7b14\u8bb0\u3001\u9519\u9898\u4e0d\u662f\u540c\u4e00\u79cd\u4e1a\u52a1\u3002\u6e90\u7801\u4fdd\u6301\u540c\u4e00\u4e2a QuestionCard \u5c55\u793a\u6846\u67b6&#xff0c;\u540c\u65f6\u8ba9\u5217\u8868\u5165\u53e3\u6709\u5dee\u5f02&#xff0c;\u662f\u6bd4\u8f83\u7a33\u7684\u6298\u4e2d\u3002<\/p>\n<h3>\u4e03\u3001\u6536\u85cf\u5217\u8868\u4e3a\u7a7a\u65f6\u663e\u793a\u660e\u786e\u52a8\u4f5c\u63d0\u793a<\/h3>\n<p>\u6536\u85cf\u5217\u8868\u5148\u5224\u65ad\u6570\u7ec4\u957f\u5ea6\u3002\u4e3a\u7a7a\u65f6\u8fdb\u5165 EmptyHint&#xff0c;\u975e\u7a7a\u65f6\u7528 List \u6e32\u67d3\u3002<\/p>\n<p>&#064;Builder<br \/>\nFavList() {<br \/>\n  if (this.favRecords.length &#061;&#061;&#061; 0) {<br \/>\n    this.EmptyHint(&#039;\u8fd8\u6ca1\u6709\u6536\u85cf\u9898\u76ee&#039;, &#039;\u7b54\u9898\u65f6\u70b9\u51fb\u6536\u85cf\u6309\u94ae\u5373\u53ef\u6dfb\u52a0&#039;)<br \/>\n  } else {<br \/>\n    List({ space: 10 }) {<br \/>\n      ForEach(this.favRecords, (record: FavoriteRecord) &#061;&gt; {<br \/>\n        ListItem() {<br \/>\n          this.QuestionCard(record.questionId, record.bankId, record.createdAt, &#039;&#039;)<br \/>\n        }<br \/>\n        .padding({ left: Sizes.PADDING_LARGE, right: Sizes.PADDING_LARGE })<br \/>\n      }, (record: FavoriteRecord) &#061;&gt; record.questionId)<br \/>\n    }<br \/>\n    .layoutWeight(1)<br \/>\n    .scrollBar(BarState.Off)<br \/>\n    .edgeEffect(EdgeEffect.Spring)<br \/>\n    .padding({ bottom: 16 })<br \/>\n  }<br \/>\n}<\/p>\n<p>\u8fd9\u91cc\u7684\u7a7a\u72b6\u6001\u4e0d\u662f\u201c\u6682\u65e0\u6570\u636e\u201d\u56db\u4e2a\u5b57&#xff0c;\u800c\u662f\u544a\u8bc9\u7528\u6237\u201c\u7b54\u9898\u65f6\u70b9\u51fb\u6536\u85cf\u6309\u94ae\u5373\u53ef\u6dfb\u52a0\u201d\u3002\u5bf9\u5b66\u4e60\u5e94\u7528\u6765\u8bf4&#xff0c;\u7a7a\u72b6\u6001\u5e94\u8be5\u6307\u5411\u4e0b\u4e00\u6b65\u52a8\u4f5c&#xff0c;\u907f\u514d\u7528\u6237\u8bef\u4ee5\u4e3a\u529f\u80fd\u4e0d\u53ef\u7528\u3002<\/p>\n<h3>\u516b\u3001\u7b14\u8bb0\u5217\u8868\u590d\u7528\u9898\u5361\u5e76\u9644\u52a0\u7f16\u8f91\u5165\u53e3<\/h3>\n<p>\u7b14\u8bb0\u5217\u8868\u7684\u6570\u636e\u6765\u81ea noteRecords\u3002\u6bcf\u6761\u7b14\u8bb0\u4f20\u5165 QuestionCard \u7684 note.content&#xff0c;\u9898\u5361\u5185\u90e8\u4f1a\u989d\u5916\u6e32\u67d3\u7b14\u8bb0\u6458\u8981\u548c\u7f16\u8f91\u6309\u94ae\u3002<\/p>\n<p>ForEach(this.noteRecords, (note: NoteRecord) &#061;&gt; {<br \/>\n  ListItem() {<br \/>\n    this.QuestionCard(note.questionId, note.bankId, note.updatedAt, note.content)<br \/>\n  }<br \/>\n  .padding({ left: Sizes.PADDING_LARGE, right: Sizes.PADDING_LARGE })<br \/>\n}, (note: NoteRecord) &#061;&gt; note.questionId)<\/p>\n<p>\u9898\u5361\u5185\u90e8\u5224\u65ad\u7b14\u8bb0\u5185\u5bb9\u662f\u5426\u5b58\u5728&#xff1a;<\/p>\n<p>if (noteContent.length &gt; 0) {<br \/>\n  Row({ space: 8 }) {<br \/>\n    Column()<br \/>\n      .width(3)<br \/>\n      .height(32)<br \/>\n      .borderRadius(1.5)<br \/>\n      .backgroundColor(Colors.PRIMARY)<br \/>\n    Text(noteContent)<br \/>\n      .fontSize(Sizes.CAPTION_FONT)<br \/>\n      .fontColor(Colors.TEXT_SECONDARY)<br \/>\n      .lineHeight(18)<br \/>\n      .maxLines(2)<br \/>\n      .textOverflow({ overflow: TextOverflow.Ellipsis })<br \/>\n      .layoutWeight(1)<br \/>\n    Text(&#039;\u7f16\u8f91&#039;)<br \/>\n      .fontSize(Sizes.CAPTION_FONT)<br \/>\n      .fontColor(Colors.PRIMARY)<br \/>\n      .fontWeight(FontWeight.Medium)<br \/>\n      .padding({ left: 10, right: 10, top: 6, bottom: 6 })<br \/>\n      .borderRadius(14)<br \/>\n      .backgroundColor(Colors.PRIMARY_LIGHT)<br \/>\n      .onClick(() &#061;&gt; { this.openEditNote(questionId, bankId, noteContent) })<br \/>\n  }<br \/>\n}<\/p>\n<p>maxLines(2) \u548c\u7701\u7565\u53f7\u80fd\u9632\u6b62\u957f\u7b14\u8bb0\u628a\u5361\u7247\u6491\u5f97\u8fc7\u9ad8\u3002\u79fb\u52a8\u7aef\u5217\u8868\u91cc&#xff0c;\u8fd9\u7c7b\u6587\u672c\u7ea6\u675f\u5f88\u5fc5\u8981\u3002<\/p>\n<h3>\u4e5d\u3001\u7b14\u8bb0\u7f16\u8f91\u5f39\u5c42\u53ea\u7ef4\u62a4\u4e34\u65f6\u7f16\u8f91\u6001<\/h3>\n<p>\u70b9\u51fb\u201c\u7f16\u8f91\u201d\u540e&#xff0c;\u6536\u85cf\u9875\u4f1a\u8bb0\u5f55\u5f53\u524d\u9898\u76ee\u3001\u9898\u5e93\u548c\u7b14\u8bb0\u5185\u5bb9&#xff0c;\u7136\u540e\u6253\u5f00\u5f39\u5c42\u3002<\/p>\n<p>private openEditNote(questionId: string, bankId: string, content: string): void {<br \/>\n  this.editingQuestionId &#061; questionId<br \/>\n  this.editingBankId &#061; bankId<br \/>\n  this.editingNoteText &#061; content<br \/>\n  this.showEditNote &#061; true<br \/>\n}<\/p>\n<p>\u4fdd\u5b58\u65f6\u8c03\u7528 UserDataManager.upsertNote&#xff0c;\u5e76\u628a\u8fd4\u56de\u7684\u65b0\u6570\u7ec4\u8d4b\u7ed9 noteRecords\u3002<\/p>\n<p>this.noteRecords &#061; UserDataManager.upsertNote(<br \/>\n  this.noteRecords, this.editingQuestionId, this.editingBankId, this.editingNoteText)<br \/>\nthis.showEditNote &#061; false<\/p>\n<p>\u8fd9\u4fdd\u8bc1\u4e86\u5f39\u5c42\u7f16\u8f91\u6001\u548c\u771f\u5b9e\u5217\u8868\u6001\u5206\u79bb\u3002\u7528\u6237\u8f93\u5165\u8fc7\u7a0b\u4e2d\u53ea\u6539 editingNoteText&#xff0c;\u70b9\u51fb\u4fdd\u5b58\u540e\u624d\u66f4\u65b0 noteRecords\u3002\u5982\u679c\u7528\u6237\u70b9\u906e\u7f69\u5173\u95ed\u5f39\u5c42&#xff0c;\u5217\u8868\u4e0d\u4f1a\u88ab\u4e2d\u9014\u5199\u5165\u3002<\/p>\n<h3>\u5341\u3001\u9519\u9898\u5217\u8868\u63d0\u4f9b\u6279\u91cf\u7ec3\u4e60\u548c\u6e05\u7a7a<\/h3>\n<p>\u9519\u9898\u5206\u680f\u548c\u6536\u85cf\u3001\u7b14\u8bb0\u4e0d\u540c&#xff0c;\u5b83\u989d\u5916\u63d0\u4f9b\u201c\u7ec3\u4e60\u9519\u9898\u201d\u548c\u201c\u6e05\u7a7a\u201d\u4e24\u4e2a\u52a8\u4f5c\u3002<\/p>\n<p>Text(&#039;\u7ec3\u4e60\u9519\u9898&#039;)<br \/>\n  .fontSize(Sizes.CAPTION_FONT)<br \/>\n  .fontColor(Color.White)<br \/>\n  .fontWeight(FontWeight.Medium)<br \/>\n  .padding({ left: 14, right: 14, top: 7, bottom: 7 })<br \/>\n  .borderRadius(16)<br \/>\n  .backgroundColor(Colors.PRIMARY)<br \/>\n  .onClick(() &#061;&gt; {<br \/>\n    router.pushUrl({ url: &#039;pages\/PracticePage&#039;, params: { bankId: this.wrongRecords[0].bankId, mode: &#039;wrong&#039; } })<br \/>\n  })<br \/>\nText(&#039;\u6e05\u7a7a&#039;)<br \/>\n  .fontSize(Sizes.CAPTION_FONT)<br \/>\n  .fontColor(Colors.ERROR)<br \/>\n  .padding({ left: 12, right: 0, top: 7, bottom: 7 })<br \/>\n  .onClick(() &#061;&gt; { this.wrongRecords &#061; UserDataManager.clearWrong() })<\/p>\n<p>\u8fd9\u91cc\u6709\u4e00\u4e2a\u524d\u7f6e\u5206\u652f\u4fdd\u62a4&#xff1a;\u53ea\u6709 wrongRecords.length &gt; 0 \u65f6\u624d\u6e32\u67d3\u8fd9\u4e24\u4e2a\u6309\u94ae\u3002\u56e0\u6b64 this.wrongRecords[0].bankId \u4e0d\u4f1a\u5728\u7a7a\u6570\u7ec4\u72b6\u6001\u4e0b\u6267\u884c\u3002\u6e05\u7a7a\u9519\u9898\u540e&#xff0c;wrongRecords \u53d8\u6210\u7a7a\u6570\u7ec4&#xff0c;\u9875\u9762\u4e0b\u4e00\u6b21\u6e32\u67d3\u5c31\u8fdb\u5165\u7a7a\u72b6\u6001\u3002<\/p>\n<h3>\u5341\u4e00\u3001\u9898\u5361\u70b9\u51fb\u8981\u5c3d\u91cf\u56de\u5230\u539f\u9898<\/h3>\n<p>\u6536\u85cf\u9875\u7684\u9898\u5361\u6574\u4f53\u53ef\u70b9\u51fb\u3002\u5b83\u4f1a\u5148\u627e\u5230\u5f53\u524d\u9898\u76ee&#xff0c;\u518d\u628a\u9898\u578b\u548c\u8d77\u59cb\u9898\u76ee\u4f20\u7ed9 PracticePage\u3002<\/p>\n<p>private findQuestion(questionId: string, bankId: string): Question | undefined {<br \/>\n  return getQuestions(bankId).find(q &#061;&gt; q.id &#061;&#061;&#061; questionId)<br \/>\n}<\/p>\n<p>private practiceQuestion(questionId: string, bankId: string): void {<br \/>\n  const q &#061; this.findQuestion(questionId, bankId)<br \/>\n  const qType: string &#061; q ? q.type : &#039;&#039;<br \/>\n  try {<br \/>\n    router.pushUrl({<br \/>\n      url: &#039;pages\/PracticePage&#039;,<br \/>\n      params: {<br \/>\n        bankId: bankId,<br \/>\n        mode: &#039;random&#039;,<br \/>\n        questionType: qType,<br \/>\n        startQuestionId: questionId<br \/>\n      }<br \/>\n    })<br \/>\n  } catch (_) {<br \/>\n  }<br \/>\n}<\/p>\n<p>\u8fd9\u91cc\u4e0d\u662f\u53ea\u4f20 bankId\u3002\u5982\u679c\u6536\u85cf\u9898\u8fd8\u5728\u9898\u5e93\u4e2d&#xff0c;\u9644\u5e26 questionType \u53ef\u4ee5\u8ba9\u7ec3\u4e60\u9875\u5148\u8fdb\u5165\u540c\u7c7b\u578b\u9898\u6c60&#xff1b;\u9644\u5e26 startQuestionId \u53ef\u4ee5\u8ba9\u7ec3\u4e60\u9875\u4f18\u5148\u628a\u8fd9\u9053\u9898\u653e\u5230\u524d\u9762\u3002<\/p>\n<p>PracticePage \u5bf9 questionType \u548c startQuestionId \u6709\u5bf9\u5e94\u627f\u63a5&#xff1a;<\/p>\n<p>if (this.mode &#061;&#061;&#061; &#039;random&#039; &amp;&amp; params.questionType &amp;&amp; params.questionType.length &gt; 0) {<br \/>\n  const typedQuestions &#061; this.questions.filter((q: Question) &#061;&gt; q.type &#061;&#061;&#061; params.questionType)<br \/>\n  if (typedQuestions.length &gt; 0) {<br \/>\n    this.questions &#061; typedQuestions<br \/>\n  }<br \/>\n}<br \/>\nthis.questions &#061; this.pickRandomPracticeQuestions(this.questions, 20, params.startQuestionId || &#039;&#039;)<\/p>\n<p>\u8fd9\u6761\u94fe\u8def\u80fd\u964d\u4f4e\u201c\u70b9\u4e86\u6536\u85cf\u9898\u5374\u770b\u5230\u522b\u7684\u9898\u201d\u7684\u6982\u7387\u3002<\/p>\n<h3>\u5341\u4e8c\u3001\u9898\u76ee\u7f3a\u5931\u65f6\u8981\u6709\u515c\u5e95\u6587\u6848<\/h3>\n<p>\u6536\u85cf\u8bb0\u5f55\u91cc\u4fdd\u5b58\u7684\u662f questionId \u548c bankId&#xff0c;\u800c\u4e0d\u662f\u5b8c\u6574\u9898\u5e72\u3002\u6e32\u67d3\u9898\u5361\u65f6\u9700\u8981\u56de\u67e5\u9898\u76ee\u3002<\/p>\n<p>private getStem(questionId: string, bankId: string): string {<br \/>\n  const q &#061; this.findQuestion(questionId, bankId)<br \/>\n  return q ? q.stem : &#096;\u9898\u76ee ${questionId}&#096;<br \/>\n}<\/p>\n<p>\u5982\u679c\u540e\u7eed\u9898\u5e93\u6570\u636e\u8c03\u6574&#xff0c;\u67d0\u6761\u65e7\u6536\u85cf\u627e\u4e0d\u5230\u539f\u9898&#xff0c;\u9875\u9762\u4e0d\u4f1a\u5d29\u6e83&#xff0c;\u800c\u662f\u663e\u793a \u9898\u76ee ${questionId}\u3002\u8fd9\u4e0d\u662f\u6700\u5b8c\u7f8e\u7684\u4e1a\u52a1\u4f53\u9a8c&#xff0c;\u4f46\u5728\u672c\u5730\u9898\u5e93\u8fed\u4ee3\u4e2d\u662f\u5fc5\u8981\u515c\u5e95\u3002<\/p>\n<h3>\u5341\u4e09\u3001\u7a7a\u72b6\u6001\u7ec4\u4ef6\u7edf\u4e00\u4e09\u7c7b\u5217\u8868<\/h3>\n<p>EmptyHint \u662f\u4e09\u7c7b\u5217\u8868\u5171\u540c\u4f7f\u7528\u7684\u7a7a\u72b6\u6001\u7ec4\u4ef6\u3002<\/p>\n<p>&#064;Builder<br \/>\nEmptyHint(msg: string, sub: string) {<br \/>\n  Column({ space: 8 }) {<br \/>\n    Image($r(&#039;app.media.img_empty_default&#039;))<br \/>\n      .width(120)<br \/>\n      .height(120)<br \/>\n      .objectFit(ImageFit.Contain)<br \/>\n      .opacity(0.6)<br \/>\n    Text(msg)<br \/>\n      .fontSize(Sizes.BODY_FONT)<br \/>\n      .fontColor(Colors.TEXT_HINT)<br \/>\n    Text(sub)<br \/>\n      .fontSize(Sizes.CAPTION_FONT)<br \/>\n      .fontColor(Colors.TEXT_HINT)<br \/>\n  }<br \/>\n  .layoutWeight(1)<br \/>\n  .width(&#039;100%&#039;)<br \/>\n  .justifyContent(FlexAlign.Center)<br \/>\n  .alignItems(HorizontalAlign.Center)<br \/>\n}<\/p>\n<p>\u4e09\u7c7b\u6587\u6848\u4e0d\u540c&#xff0c;\u4f46\u89c6\u89c9\u7ed3\u6784\u4e00\u81f4&#xff1a;<\/p>\n<table>\n<tr>\u5206\u680f\u4e3b\u6587\u6848\u526f\u6587\u6848<\/tr>\n<tbody>\n<tr>\n<td>\u6536\u85cf<\/td>\n<td>\u8fd8\u6ca1\u6709\u6536\u85cf\u9898\u76ee<\/td>\n<td>\u7b54\u9898\u65f6\u70b9\u51fb\u6536\u85cf\u6309\u94ae\u5373\u53ef\u6dfb\u52a0<\/td>\n<\/tr>\n<tr>\n<td>\u7b14\u8bb0<\/td>\n<td>\u8fd8\u6ca1\u6709\u5199\u8fc7\u7b14\u8bb0<\/td>\n<td>\u7b54\u9898\u65f6\u70b9\u51fb\u7b14\u8bb0\u6309\u94ae\u8bb0\u5f55\u5fc3\u5f97<\/td>\n<\/tr>\n<tr>\n<td>\u9519\u9898<\/td>\n<td>\u6682\u65e0\u9519\u9898\u8bb0\u5f55<\/td>\n<td>\u7b54\u9519\u7684\u9898\u4f1a\u81ea\u52a8\u6536\u5f55\u5230\u8fd9\u91cc<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u8fd9\u79cd\u7edf\u4e00\u80fd\u8ba9\u5b66\u4e60\u5939\u4fdd\u6301\u4e00\u81f4&#xff0c;\u4e5f\u907f\u514d\u6bcf\u4e2a\u5217\u8868\u5404\u5199\u4e00\u5957\u7a7a\u72b6\u6001\u6837\u5f0f\u3002<\/p>\n<h3>\u5341\u56db\u3001\u672c\u5730\u590d\u6838\u6e05\u5355<\/h3>\n<p>\u53ef\u4ee5\u6309\u4e0b\u9762\u6e05\u5355\u590d\u6838\u6e90\u7801\u4e0e\u6587\u7ae0\u662f\u5426\u4e00\u81f4\u3002<\/p>\n<table>\n<tr>\u590d\u6838\u70b9\u6e90\u7801\u4f4d\u7f6e\u9884\u671f<\/tr>\n<tbody>\n<tr>\n<td>\u4e09\u7c7b\u5217\u8868\u72b6\u6001<\/td>\n<td>FavoritePage.ets \u9876\u90e8<\/td>\n<td>&#064;StorageLink \u7ed1\u5b9a\u4e09\u4e2a\u8bb0\u5f55\u6570\u7ec4<\/td>\n<\/tr>\n<tr>\n<td>\u5206\u680f\u72b6\u6001<\/td>\n<td>favoriteTabIndex<\/td>\n<td>\u5916\u90e8\u9875\u9762\u53ef\u5207\u6362\u6536\u85cf\u9875\u5206\u680f<\/td>\n<\/tr>\n<tr>\n<td>\u6536\u85cf\u5207\u6362<\/td>\n<td>PracticePage.ets<\/td>\n<td>\u8c03\u7528 UserDataManager.toggleFavorite<\/td>\n<\/tr>\n<tr>\n<td>\u5217\u8868\u5237\u65b0<\/td>\n<td>FavList\/NoteList\/WrongList<\/td>\n<td>\u76f4\u63a5\u4f7f\u7528\u5f53\u524d\u6570\u7ec4\u957f\u5ea6\u548c\u6570\u7ec4\u5185\u5bb9<\/td>\n<\/tr>\n<tr>\n<td>\u7b14\u8bb0\u7f16\u8f91<\/td>\n<td>EditNoteDialog<\/td>\n<td>\u4fdd\u5b58\u540e upsertNote \u5e76\u5173\u95ed\u5f39\u5c42<\/td>\n<\/tr>\n<tr>\n<td>\u9519\u9898\u6e05\u7a7a<\/td>\n<td>WrongList<\/td>\n<td>this.wrongRecords &#061; UserDataManager.clearWrong()<\/td>\n<\/tr>\n<tr>\n<td>\u9898\u5361\u8df3\u8f6c<\/td>\n<td>practiceQuestion<\/td>\n<td>\u4f20 bankId\/questionType\/startQuestionId<\/td>\n<\/tr>\n<tr>\n<td>\u7a7a\u72b6\u6001<\/td>\n<td>EmptyHint<\/td>\n<td>\u4e09\u7c7b\u5217\u8868\u7a7a\u65f6\u663e\u793a\u4e0d\u540c\u6587\u6848<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5efa\u8bae\u624b\u5de5\u9a8c\u8bc1\u4e94\u6761\u8def\u5f84&#xff1a;<\/p>\n<li>\u5728\u7b54\u9898\u9875\u6536\u85cf\u4e00\u9053\u9898&#xff0c;\u5207\u5230\u6536\u85cf\u9875&#xff0c;\u6536\u85cf\u6570\u91cf\u548c\u5217\u8868\u5e94\u66f4\u65b0\u3002<\/li>\n<li>\u518d\u6b21\u53d6\u6d88\u6536\u85cf&#xff0c;\u6536\u85cf\u9875\u5e94\u56de\u5230\u7a7a\u72b6\u6001\u6216\u79fb\u9664\u8be5\u9898\u3002<\/li>\n<li>\u7ed9\u4e00\u9053\u9898\u5199\u7b14\u8bb0&#xff0c;\u6253\u5f00\u7b14\u8bb0\u5206\u680f&#xff0c;\u80fd\u770b\u5230\u7b14\u8bb0\u6458\u8981\u5e76\u53ef\u7f16\u8f91\u3002<\/li>\n<li>\u7b54\u9519\u9898\u540e\u8fdb\u5165\u9519\u9898\u5206\u680f&#xff0c;\u80fd\u770b\u5230\u9519\u9898\u6570\u91cf&#xff0c;\u6e05\u7a7a\u540e\u663e\u793a\u7a7a\u72b6\u6001\u3002<\/li>\n<li>\u70b9\u51fb\u6536\u85cf\u9898\u5361&#xff0c;\u5e94\u8fdb\u5165 PracticePage&#xff0c;\u5e76\u5c3d\u91cf\u4ece\u8be5\u9898\u5f00\u59cb\u3002<\/li>\n<h3>\u5341\u4e94\u3001\u5e38\u89c1\u95ee\u9898\u4e0e\u4fee\u590d\u65b9\u5411<\/h3>\n<table>\n<tr>\u95ee\u9898\u53ef\u80fd\u539f\u56e0\u4fee\u590d\u65b9\u5411<\/tr>\n<tbody>\n<tr>\n<td>\u6536\u85cf\u540e\u5217\u8868\u4e0d\u5237\u65b0<\/td>\n<td>\u539f\u5730\u4fee\u6539\u6570\u7ec4&#xff0c;\u6ca1\u6709\u91cd\u65b0\u8d4b\u503c<\/td>\n<td>\u4f7f\u7528 toggleFavorite \u8fd4\u56de\u65b0\u6570\u7ec4\u5e76\u8d4b\u7ed9 favRecords<\/td>\n<\/tr>\n<tr>\n<td>\u9876\u90e8\u6570\u91cf\u548c\u5217\u8868\u4e0d\u4e00\u81f4<\/td>\n<td>\u5355\u72ec\u7ef4\u62a4\u8ba1\u6570\u72b6\u6001<\/td>\n<td>\u4ece\u6570\u7ec4\u957f\u5ea6\u6d3e\u751f\u8ba1\u6570<\/td>\n<\/tr>\n<tr>\n<td>\u70b9\u51fb\u9898\u5361\u8fdb\u5165\u65e0\u5173\u9898<\/td>\n<td>\u53ea\u4f20 bankId<\/td>\n<td>\u540c\u65f6\u4f20 questionType \u548c startQuestionId<\/td>\n<\/tr>\n<tr>\n<td>\u7b14\u8bb0\u7f16\u8f91\u672a\u4fdd\u5b58<\/td>\n<td>\u53ea\u6539\u4e34\u65f6\u7f16\u8f91\u6001<\/td>\n<td>\u4fdd\u5b58\u65f6\u8c03\u7528 upsertNote \u66f4\u65b0 noteRecords<\/td>\n<\/tr>\n<tr>\n<td>\u6e05\u7a7a\u9519\u9898\u540e\u4ecd\u663e\u793a\u65e7\u5217\u8868<\/td>\n<td>\u6ca1\u628a\u8fd4\u56de\u7a7a\u6570\u7ec4\u8d4b\u503c\u7ed9\u72b6\u6001<\/td>\n<td>this.wrongRecords &#061; UserDataManager.clearWrong()<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h3>\u603b\u7ed3<\/h3>\n<p>FavoritePage.ets \u7684\u6838\u5fc3\u4e0d\u662f\u201c\u6536\u85cf\u6309\u94ae\u600e\u4e48\u753b\u201d&#xff0c;\u800c\u662f\u8ba9\u6536\u85cf\u3001\u7b14\u8bb0\u3001\u9519\u9898\u4e09\u7c7b\u5b66\u4e60\u8bb0\u5f55\u56f4\u7ed5 AppStorage \u505a\u72b6\u6001\u95ed\u73af\u3002\u7b54\u9898\u9875\u901a\u8fc7 UserDataManager \u4fee\u6539\u6570\u7ec4\u5e76\u6301\u4e45\u5316&#xff0c;\u6536\u85cf\u9875\u901a\u8fc7 &#064;StorageLink \u63a5\u6536\u6700\u65b0\u6570\u7ec4&#xff0c;\u6839\u636e\u5f53\u524d\u5206\u680f\u6e32\u67d3\u5217\u8868\u6216\u7a7a\u72b6\u6001&#xff0c;\u518d\u901a\u8fc7\u9898\u5361\u70b9\u51fb\u628a\u7528\u6237\u5e26\u56de\u7ec3\u4e60\u9875\u3002<\/p>\n<p>\u8fd9\u5957\u5b9e\u73b0\u9002\u5408\u5f53\u524d\u7b14\u4e0b\u751f\u8f89\u7684\u672c\u5730\u5b66\u4e60\u8bb0\u5f55\u573a\u666f&#xff1a;\u4e0d\u5f15\u5165\u670d\u52a1\u7aef&#xff0c;\u4e0d\u4f2a\u9020\u8de8\u8bbe\u5907\u80fd\u529b&#xff0c;\u53ea\u628a\u672c\u5730\u6536\u85cf\u3001\u7b14\u8bb0\u3001\u9519\u9898\u505a\u6210\u53ef\u6062\u590d\u3001\u53ef\u5237\u65b0\u3001\u53ef\u7ee7\u7eed\u7ec3\u4e60\u7684\u95ed\u73af\u3002\u540e\u7eed\u5982\u679c\u8981\u6269\u5c55\u8d26\u53f7\u540c\u6b65&#xff0c;\u53ef\u4ee5\u5728 UserDataManager \u540e\u9762\u66ff\u6362 Repository \u6216\u540c\u6b65\u670d\u52a1&#xff0c;\u4f46\u6536\u85cf\u9875\u7684\u5206\u680f\u3001\u7a7a\u72b6\u6001\u548c\u9898\u5361\u8df3\u8f6c\u8fb9\u754c\u4ecd\u7136\u53ef\u4ee5\u4fdd\u7559\u3002<\/p>\n<p>\u90e8\u5206\u5185\u5bb9\u7531AI\u8f85\u52a9\u751f\u6210\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b66\u4e60\u7c7b HarmonyOS \u5e94\u7528\u91cc&#xff0c;\u201c\u6536\u85cf\u9875\u201d\u901a\u5e38\u4e0d\u662f\u4e00\u4e2a\u5355\u7eaf\u7684\u5217\u8868\u9875\u3002\u7528\u6237\u5728\u7b54\u9898\u9875\u6536\u85cf\u4e00\u9053\u9898\u3001\u5199\u4e00\u6761\u7b14\u8bb0\u3001\u7b54\u9519\u4e00\u6b21\u9898&#xff0c;\u56de\u5230\u5b66\u4e60\u5939\u65f6\u5e0c\u671b\u9a6c\u4e0a\u770b\u5230\u53d8\u5316&#xff1b;\u5982\u679c\u70b9\u5f00\u6536\u85cf\u9898\u76ee\u7ee7\u7eed\u7ec3\u4e60&#xff0c;\u53c8\u5e0c\u671b\u4ece\u8fd9\u9053\u9898\u9644\u8fd1\u5f00\u59cb&#xff0c;\u800c\u4e0d\u662f\u8df3\u5230\u65e0\u5173\u9898\u76ee\u3002\u8fd9\u4e2a\u9875\u9762\u5982\u679c\u81ea\u5df1\u7ef4\u62a4\u4e00\u4efd\u72ec\u7acb\u526f\u672c&#xff0c;\u5f88\u5bb9\u6613\u51fa\u73b0\u5217\u8868\u6570\u91cf\u4e0d\u5237\u65b0\u3001\u7a7a\u72b6\u6001\u4e0d\u6d88\u5931\u3001\u9898\u5361\u70b9\u51fb\u9519\u4f4d\u7684\u95ee\u9898\u3002\u7b14\u4e0b\u751f\u8f89\u7684\u6536\u85cf\u9875\u7531 FavoritePage.ets \u627f\u62c5\u3002\u5b83\u6ca1\u6709\u91cd\u65b0\u62c9\u53d6\u8fdc\u7a0b\u6570\u636e<\/p>\n","protected":false},"author":2,"featured_media":85972,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[9670,9669,9671,4362,280],"topic":[],"class_list":["post-85975","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-appstorage","tag-9669","tag-9671","tag-arkts","tag-harmonyos"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010\u7b14\u4e0b\u751f\u8f89\uff5c08\u3011HarmonyOS ArkTS \u6536\u85cf\u9875\u5b9e\u6218\uff1a\u5904\u7406\u6536\u85cf\u5207\u6362\u3001\u5217\u8868\u5237\u65b0\u548c\u7a7a\u72b6\u6001 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/85975.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010\u7b14\u4e0b\u751f\u8f89\uff5c08\u3011HarmonyOS ArkTS \u6536\u85cf\u9875\u5b9e\u6218\uff1a\u5904\u7406\u6536\u85cf\u5207\u6362\u3001\u5217\u8868\u5237\u65b0\u548c\u7a7a\u72b6\u6001 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u5b66\u4e60\u7c7b HarmonyOS \u5e94\u7528\u91cc&#xff0c;\u201c\u6536\u85cf\u9875\u201d\u901a\u5e38\u4e0d\u662f\u4e00\u4e2a\u5355\u7eaf\u7684\u5217\u8868\u9875\u3002\u7528\u6237\u5728\u7b54\u9898\u9875\u6536\u85cf\u4e00\u9053\u9898\u3001\u5199\u4e00\u6761\u7b14\u8bb0\u3001\u7b54\u9519\u4e00\u6b21\u9898&#xff0c;\u56de\u5230\u5b66\u4e60\u5939\u65f6\u5e0c\u671b\u9a6c\u4e0a\u770b\u5230\u53d8\u5316&#xff1b;\u5982\u679c\u70b9\u5f00\u6536\u85cf\u9898\u76ee\u7ee7\u7eed\u7ec3\u4e60&#xff0c;\u53c8\u5e0c\u671b\u4ece\u8fd9\u9053\u9898\u9644\u8fd1\u5f00\u59cb&#xff0c;\u800c\u4e0d\u662f\u8df3\u5230\u65e0\u5173\u9898\u76ee\u3002\u8fd9\u4e2a\u9875\u9762\u5982\u679c\u81ea\u5df1\u7ef4\u62a4\u4e00\u4efd\u72ec\u7acb\u526f\u672c&#xff0c;\u5f88\u5bb9\u6613\u51fa\u73b0\u5217\u8868\u6570\u91cf\u4e0d\u5237\u65b0\u3001\u7a7a\u72b6\u6001\u4e0d\u6d88\u5931\u3001\u9898\u5361\u70b9\u51fb\u9519\u4f4d\u7684\u95ee\u9898\u3002\u7b14\u4e0b\u751f\u8f89\u7684\u6536\u85cf\u9875\u7531 FavoritePage.ets \u627f\u62c5\u3002\u5b83\u6ca1\u6709\u91cd\u65b0\u62c9\u53d6\u8fdc\u7a0b\u6570\u636e\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/85975.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-27T17:57:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260727175738-6a679c12d733c.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/85975.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/85975.html\",\"name\":\"\u3010\u7b14\u4e0b\u751f\u8f89\uff5c08\u3011HarmonyOS ArkTS \u6536\u85cf\u9875\u5b9e\u6218\uff1a\u5904\u7406\u6536\u85cf\u5207\u6362\u3001\u5217\u8868\u5237\u65b0\u548c\u7a7a\u72b6\u6001 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-07-27T17:57:41+00:00\",\"dateModified\":\"2026-07-27T17:57:41+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/85975.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/85975.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/85975.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010\u7b14\u4e0b\u751f\u8f89\uff5c08\u3011HarmonyOS ArkTS \u6536\u85cf\u9875\u5b9e\u6218\uff1a\u5904\u7406\u6536\u85cf\u5207\u6362\u3001\u5217\u8868\u5237\u65b0\u548c\u7a7a\u72b6\u6001\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010\u7b14\u4e0b\u751f\u8f89\uff5c08\u3011HarmonyOS ArkTS \u6536\u85cf\u9875\u5b9e\u6218\uff1a\u5904\u7406\u6536\u85cf\u5207\u6362\u3001\u5217\u8868\u5237\u65b0\u548c\u7a7a\u72b6\u6001 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/85975.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010\u7b14\u4e0b\u751f\u8f89\uff5c08\u3011HarmonyOS ArkTS \u6536\u85cf\u9875\u5b9e\u6218\uff1a\u5904\u7406\u6536\u85cf\u5207\u6362\u3001\u5217\u8868\u5237\u65b0\u548c\u7a7a\u72b6\u6001 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u5b66\u4e60\u7c7b HarmonyOS \u5e94\u7528\u91cc&#xff0c;\u201c\u6536\u85cf\u9875\u201d\u901a\u5e38\u4e0d\u662f\u4e00\u4e2a\u5355\u7eaf\u7684\u5217\u8868\u9875\u3002\u7528\u6237\u5728\u7b54\u9898\u9875\u6536\u85cf\u4e00\u9053\u9898\u3001\u5199\u4e00\u6761\u7b14\u8bb0\u3001\u7b54\u9519\u4e00\u6b21\u9898&#xff0c;\u56de\u5230\u5b66\u4e60\u5939\u65f6\u5e0c\u671b\u9a6c\u4e0a\u770b\u5230\u53d8\u5316&#xff1b;\u5982\u679c\u70b9\u5f00\u6536\u85cf\u9898\u76ee\u7ee7\u7eed\u7ec3\u4e60&#xff0c;\u53c8\u5e0c\u671b\u4ece\u8fd9\u9053\u9898\u9644\u8fd1\u5f00\u59cb&#xff0c;\u800c\u4e0d\u662f\u8df3\u5230\u65e0\u5173\u9898\u76ee\u3002\u8fd9\u4e2a\u9875\u9762\u5982\u679c\u81ea\u5df1\u7ef4\u62a4\u4e00\u4efd\u72ec\u7acb\u526f\u672c&#xff0c;\u5f88\u5bb9\u6613\u51fa\u73b0\u5217\u8868\u6570\u91cf\u4e0d\u5237\u65b0\u3001\u7a7a\u72b6\u6001\u4e0d\u6d88\u5931\u3001\u9898\u5361\u70b9\u51fb\u9519\u4f4d\u7684\u95ee\u9898\u3002\u7b14\u4e0b\u751f\u8f89\u7684\u6536\u85cf\u9875\u7531 FavoritePage.ets \u627f\u62c5\u3002\u5b83\u6ca1\u6709\u91cd\u65b0\u62c9\u53d6\u8fdc\u7a0b\u6570\u636e","og_url":"https:\/\/www.wsisp.com\/helps\/85975.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-07-27T17:57:41+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/07\/20260727175738-6a679c12d733c.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"5 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/85975.html","url":"https:\/\/www.wsisp.com\/helps\/85975.html","name":"\u3010\u7b14\u4e0b\u751f\u8f89\uff5c08\u3011HarmonyOS ArkTS \u6536\u85cf\u9875\u5b9e\u6218\uff1a\u5904\u7406\u6536\u85cf\u5207\u6362\u3001\u5217\u8868\u5237\u65b0\u548c\u7a7a\u72b6\u6001 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-07-27T17:57:41+00:00","dateModified":"2026-07-27T17:57:41+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/85975.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/85975.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/85975.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010\u7b14\u4e0b\u751f\u8f89\uff5c08\u3011HarmonyOS ArkTS \u6536\u85cf\u9875\u5b9e\u6218\uff1a\u5904\u7406\u6536\u85cf\u5207\u6362\u3001\u5217\u8868\u5237\u65b0\u548c\u7a7a\u72b6\u6001"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/85975","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=85975"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/85975\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/85972"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=85975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=85975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=85975"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=85975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}