Explorar o código

Merge branch 'feature/i18n' into develop

cc12458 hai 4 meses
pai
achega
7f3a912bd7
Modificáronse 55 ficheiros con 430 adicións e 151 borrados
  1. 2 3
      miniprogram/app.config.ts
  2. 3 1
      miniprogram/app.ts
  3. 7 2
      miniprogram/components/tabbar/tabbar.ts
  4. 1 1
      miniprogram/components/tabbar/tabbar.wxml
  5. 24 0
      miniprogram/i18n/behavior.ts
  6. 15 0
      miniprogram/i18n/install.ts
  7. 45 0
      miniprogram/i18n/tool.ts
  8. 3 1
      miniprogram/lib/request/create.ts
  9. 7 2
      miniprogram/module/article/pages/diet-list/diet-list.ts
  10. 5 0
      miniprogram/module/article/pages/science-list/science-list.ts
  11. 1 1
      miniprogram/module/article/pages/science-list/science-list.wxml
  12. 5 0
      miniprogram/module/care/pages/offlineTreatment/offlineTreatment.ts
  13. 3 3
      miniprogram/module/care/pages/offlineTreatment/offlineTreatment.wxml
  14. 10 0
      miniprogram/module/chats/components/guide/guide.ts
  15. 6 5
      miniprogram/module/chats/components/guide/guide.wxml
  16. 16 6
      miniprogram/module/chats/components/message-consult/message-consult.ts
  17. 1 1
      miniprogram/module/chats/components/message-consult/message-consult.wxml
  18. 7 2
      miniprogram/module/chats/components/message-follow/message-follow.ts
  19. 3 3
      miniprogram/module/chats/components/message-follow/message-follow.wxml
  20. 7 1
      miniprogram/module/chats/components/message-report/message-report.ts
  21. 4 4
      miniprogram/module/chats/components/message-report/message-report.wxml
  22. 7 3
      miniprogram/module/chats/components/questionnaire/questionnaire.ts
  23. 5 1
      miniprogram/module/chats/pages/consultation-record/consultation-record.ts
  24. 3 3
      miniprogram/module/chats/pages/consultation-record/consultation-record.wxml
  25. 5 1
      miniprogram/module/chats/pages/index/index.ts
  26. 2 2
      miniprogram/module/chats/pages/index/index.wxml
  27. 17 3
      miniprogram/module/health/components/card-analysis/card-analysis-content.ts
  28. 24 26
      miniprogram/module/health/components/card-analysis/card-analysis-content.wxml
  29. 7 0
      miniprogram/module/health/components/card-analysis/card-analysis-exception.ts
  30. 17 15
      miniprogram/module/health/components/card-analysis/card-analysis-exception.wxml
  31. 3 1
      miniprogram/module/health/components/care-scheme/care-scheme.ts
  32. 1 1
      miniprogram/module/health/components/care-scheme/care-scheme.wxml
  33. 7 0
      miniprogram/module/health/components/report-health-index/report-health-index.ts
  34. 2 2
      miniprogram/module/health/components/report-health-index/report-health-index.wxml
  35. 11 0
      miniprogram/module/health/components/report-health-status/report-health-status.ts
  36. 5 5
      miniprogram/module/health/components/report-health-status/report-health-status.wxml
  37. 3 3
      miniprogram/module/health/model/health.model.ts
  38. 5 0
      miniprogram/module/health/pages/analysis/analysis.ts
  39. 2 2
      miniprogram/module/health/pages/analysis/analysis.wxml
  40. 13 0
      miniprogram/module/health/pages/home/home.ts
  41. 8 8
      miniprogram/module/health/pages/home/home.wxml
  42. 13 1
      miniprogram/module/health/pages/report/report.ts
  43. 23 13
      miniprogram/module/health/pages/report/report.wxml
  44. 6 1
      miniprogram/module/health/pages/scheme/scheme.ts
  45. 3 3
      miniprogram/module/health/pages/scheme/scheme.wxml
  46. 14 0
      miniprogram/module/health/pages/status-record/status-record.ts
  47. 4 2
      miniprogram/module/health/pages/status-record/status-record.wxml
  48. 3 1
      miniprogram/module/health/pages/status/status.ts
  49. 4 3
      miniprogram/module/health/pages/status/status.wxml
  50. 9 1
      miniprogram/pages/home/home.ts
  51. 7 7
      miniprogram/pages/home/home.wxml
  52. 13 0
      miniprogram/pages/mine/mine.ts
  53. 6 6
      miniprogram/pages/mine/mine.wxml
  54. 1 0
      typings/app/request.d.ts
  55. 2 1
      typings/index.d.ts

+ 2 - 3
miniprogram/app.config.ts

@@ -2,18 +2,17 @@ import { getAccountInfoSync } from "./lib/wx/open-api";
 
 const miniProgram = getAccountInfoSync();
 const env = miniProgram.envVersion;
-console.log("env",env)
 let host = "wx2.hzliuzhi.com";
 if (env === "trial") {
   host = "test.hzliuzhi.com";
 } else if (env === "develop") {
-  // host = "wx2.hzliuzhi.com";
   host = "wx.hzliuzhi.com:4433";
-  // host = "test.hzliuzhi.com";
 }
 console.log("host",host)
 export const HOST = host;
 export const Base_URL = `https://${host}/manager/fdhb-mobile`;
 export const Upload_URL = `https://${host}/manager/file`;
+export const Locale_URL = `https://${host}/admin/i18n`
+export const ENV = env;
 
 

+ 3 - 1
miniprogram/app.ts

@@ -1,7 +1,7 @@
 import { login } from "./lib/logic";
 import { appUpdate } from "./lib/wx/update";
 import { useRouteQuery } from "./utils/route-query";
-// import { Get } from "./lib/request/method";
+import i18n from "./i18n/install";
 
 // app.ts
 App<IAppOption>({
@@ -10,7 +10,9 @@ App<IAppOption>({
     patientId: "",
     dictionaries: [],
   },
+  i18n: null,
   onLaunch(options: WechatMiniprogram.App.LaunchShowOption) {
+    i18n().then((value) => this.i18n = value);
     appUpdate(true);
     const scene = options.query.scene;
     const query = useRouteQuery(scene);

+ 7 - 2
miniprogram/components/tabbar/tabbar.ts

@@ -1,7 +1,9 @@
+import I18nBehavior from "../../i18n/behavior";
 import props from "../../miniprogram_npm/tdesign-miniprogram/action-sheet/props";
 import Tabbar from "../../miniprogram_npm/tdesign-miniprogram/tab-bar/tab-bar";
 
 Component({
+  behaviors: [I18nBehavior],
   data: {
     tabbarHeight: 0,
     pageHeight: "100vh",
@@ -15,7 +17,7 @@ Component({
       },
       {
         value: "/module/chats/pages/index/index",
-        label: "健康管家",
+        label: "",
         icon: "app",
         path: "/module/chats/pages/index/index",
       },
@@ -26,6 +28,9 @@ Component({
         path: "/pages/mine/mine",
       },
     ],
+    i18n: {
+      common: { title: '生活助理' }
+    }
   },
   properties: {
     tabbarValue: {
@@ -63,7 +68,7 @@ Component({
       });
       wx.setStorageSync("isAnalysis", 3);
     },
-    onChange(e:any) {
+    onChange(e: any) {
       this.setData({
         value: e.detail.value,
       });

+ 1 - 1
miniprogram/components/tabbar/tabbar.wxml

@@ -1,5 +1,5 @@
 <t-tab-bar t-class="my-tabbar" value="{{value}}" bindchange="onChange" theme="tag" split="{{false}}">
   <t-tab-bar-item wx:for="{{list}}" wx:key="value" value="{{item.value}}" icon="{{item.icon}}" data-id="{{item.id}}">
-    {{item.label}}
+    {{item.label || i18n.common.title}}
   </t-tab-bar-item>
 </t-tab-bar>

+ 24 - 0
miniprogram/i18n/behavior.ts

@@ -0,0 +1,24 @@
+import request from './install';
+import { PREFIX, formatRecord, formatData } from './tool';
+export default Behavior({
+  lifetimes: {
+    created() { this._i18n_init(false); },
+  },
+  pageLifetimes: {
+    created() { this._i18n_init(true); },
+  },
+  methods: {
+    async _i18n_init(page?: boolean) {
+      const [gather, reset] = formatRecord(this.data[PREFIX]);
+      const app = getApp({ allowDefault: true });
+      if (app.i18n == null) {
+        if (reset) this.setData(reset);
+        app.i18n = await request();
+      }
+      if (app.i18n != null) {
+        const i18n = formatData(gather, (key) => app.i18n?.[key]);
+        if (i18n) this.setData(i18n);
+      } else this.setData(formatData(gather));
+    },
+  }
+});

+ 15 - 0
miniprogram/i18n/install.ts

@@ -0,0 +1,15 @@
+import { Locale_URL, ENV } from '../app.config';
+import { Get } from '../lib/request/method';
+
+import { flatRecordKeys } from './tool';
+
+let cache = null;
+
+export default async function request(url?: string) {
+  try {
+    const { locales } = await Get(url ?? `${Locale_URL}/applet.${ENV}.json`, { notTransform: true, shareRequest: true });
+    return cache = flatRecordKeys(locales), cache;
+  } catch (error) {
+    return null;
+  }
+}

+ 45 - 0
miniprogram/i18n/tool.ts

@@ -0,0 +1,45 @@
+export const PREFIX = 'i18n';
+export function flatRecordKeys(
+  record: Record<string, any>,
+  parent: string[] = [],
+  result: Record<string, string> = {}
+) {
+  if (record && typeof record === 'object') {
+    for (const [key, value] of Object.entries(record)) {
+      if (Array.isArray(value)) value.forEach((v, i) => {
+        const keys = [...parent, `${key}[${i}]`];
+        flatRecordKeys(v, keys, result);
+      }); else {
+        const keys = [...parent, key];
+        flatRecordKeys(value, keys, result);
+      }
+    }
+  } else if (['string', 'boolean', 'number'].includes(typeof record)) result[parent.join('.')] = record;
+  return result;
+}
+
+type FormatData = { key: string; value: string; }[];
+
+export function formatRecord(record: Record<string, any> | string[]) {
+  if (Array.isArray(record)) return [record.map(key => ({ key, value: '' })), null] as const;
+
+  let reset: FormatData = [];
+  const gather: FormatData = [];
+
+  const result = flatRecordKeys(record);
+  for (let [key, value] of Object.entries(result)) {
+    if (typeof value === 'string') {
+      value = value?.replace(/^_/, '').replace(/\\_/, '_') ?? ''
+      if (value) reset.push({ key, value });
+    }
+    gather.push({ key, value });
+  }
+  return [gather, formatData(reset)] as const;
+}
+
+export function formatData(data?: FormatData, get?: (key: string) => string) {
+  return data?.reduce((set, { key, value }) => {
+    const _key = PREFIX ? `${PREFIX}.${key}` : key;
+    return (set[_key] = get?.(key) ?? value ?? '', set);
+  }, {} as Record<string, string>) ?? null;
+}

+ 3 - 1
miniprogram/lib/request/create.ts

@@ -4,8 +4,8 @@ import { getAccountInfoSync } from "../wx/open-api";
 
 const shareRequestCache = new Map<string, IRequestData<any>>();
 
-const miniProgram = getAccountInfoSync();
 
+const miniProgram = getAccountInfoSync();
 export function createRequest(option: IRequestCreateConfig) {
   const { baseURL } = option;
 
@@ -16,6 +16,7 @@ export function createRequest(option: IRequestCreateConfig) {
       params,
       header,
       meta,
+      notTransform = false,
       transform = (params: any) => params,
       shareRequest,
       ..._config
@@ -55,6 +56,7 @@ export function createRequest(option: IRequestCreateConfig) {
       ..._config,
     }).then((response) => {
       if (response.statusCode === 200) {
+        if (notTransform) return response.data;
         if (response.data.code === 200 && response.data.success !== false) {
           const data =
             Array.isArray(response.data.rows) && response.data.total != null

+ 7 - 2
miniprogram/module/article/pages/diet-list/diet-list.ts

@@ -1,9 +1,11 @@
 import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
+import I18nBehavior from "../../../../i18n/behavior";
 import tickleBehavior, { getTickleContext } from "../../../../core/behavior/tickle.behavior";
 import { getDietListMethod } from "../../request";
 // module/diet/pages/diet-list/diet-list.ts
 Component({
   behaviors: [
+    I18nBehavior,
     PageContainerBehavior,
     tickleBehavior,
   ],
@@ -17,6 +19,9 @@ Component({
     classify: { type: String, value: '' },
   },
   data: {
+    i18n: {
+      home: { tea: '茶', tonic: "菜谱" }
+    },
     keyword: '',
     searchInputProps: {
       placeholderStyle: 'color: #929292;',
@@ -30,8 +35,8 @@ Component({
     page: 1, size: 20, total: 0, loading: false, isLastPage: false,
   },
   observers: {
-    'classify'(value) {
-      const ref = { tonic: '药膳查询', tea: '中医茶饮' } as any;
+    'classify,i18n.home'(value, i18n) {
+      const ref = { tonic: i18n.tonic, tea: i18n.tea } as any;
       this.setData({ title: ref[value] || '' })
     },
     'page,size,total'(page, size, total) {

+ 5 - 0
miniprogram/module/article/pages/science-list/science-list.ts

@@ -1,9 +1,11 @@
 import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
+import I18nBehavior from "../../../../i18n/behavior";
 import tickleBehavior, { getTickleContext } from "../../../../core/behavior/tickle.behavior";
 import { getScienceListMethod } from "../../request";
 // module/diet/pages/science-list/science-list.ts
 Component({
   behaviors: [
+    I18nBehavior,
     PageContainerBehavior,
     tickleBehavior,
   ],
@@ -17,6 +19,9 @@ Component({
     classify: { type: String, value: '' },
   },
   data: {
+    i18n: {
+      healthTeach: { title: '分享文章' },
+    },
     keyword: '',
     searchInputProps: {
       placeholderStyle: 'color: #929292;',

+ 1 - 1
miniprogram/module/article/pages/science-list/science-list.wxml

@@ -1,5 +1,5 @@
 <!--module/diet/pages/science-list/science-list.wxml-->
-<t-navbar title="健康宣教" left-arrow />
+<t-navbar title="{{i18n.healthTeach.title}}" left-arrow />
 <view class="search-wrapper" bindtap="onTapSearchInput">
   <icon class="search-icon" data-button="focus" type="search" size="14" color="{{searchInputProps.iconColor}}"></icon>
   <input class="search-input" value="{{keyword}}" focus="{{searchInputProps.focus}}" placeholder="{{searchInputProps.placeholder}}" placeholder-style="{{searchInputProps.placeholderStyle}}" cursor-color="{{searchInputProps.cursorColor}}" confirm-type="search" bindconfirm="onConfirmSearchInput" />

+ 5 - 0
miniprogram/module/care/pages/offlineTreatment/offlineTreatment.ts

@@ -1,7 +1,12 @@
+import I18nBehavior from "../../../../i18n/behavior";
 import { getOfflineTreatmentListMethod } from "../../request";
 
 Page({
+  behaviors: [I18nBehavior],
   data: {
+    i18n: {
+      offlineTreatment: { title: '线下', ing: '进行中', finish: '完成' },
+    },
     currentTab: "",
     treatmentList: [],
     isLoading: false,

+ 3 - 3
miniprogram/module/care/pages/offlineTreatment/offlineTreatment.wxml

@@ -1,9 +1,9 @@
-<t-navbar title="线下非药物治疗" left-arrow />
+<t-navbar title="{{i18n.offlineTreatment.title}}" left-arrow />
 <view class="offline-treatment-page">
   <t-tabs value="{{currentTab}}" bind:change="onTabChange">
     <t-tab-panel label="全部" value=""></t-tab-panel>
-    <t-tab-panel label="治疗中" value="0"></t-tab-panel>
-    <t-tab-panel label="治疗完成" value="1"></t-tab-panel>
+    <t-tab-panel label="{{i18n.offlineTreatment.ing}}" value="0"></t-tab-panel>
+    <t-tab-panel label="{{i18n.offlineTreatment.finish}}" value="1"></t-tab-panel>
   </t-tabs>
   <scroll-view class="page-container" scroll-y>
     <view wx:if="{{isLoading}}">

+ 10 - 0
miniprogram/module/chats/components/guide/guide.ts

@@ -2,10 +2,12 @@
 import { getPatients } from "../../../../pages/home/request";
 import { toCertificationPage } from "../../../../pages/home/router";
 import { Post } from "../../../../lib/request/method";
+import I18nBehavior from "../../../../i18n/behavior";
 
 let next: "handleA" | "handleB" | "handleC";
 
 Component({
+  behaviors: [I18nBehavior],
   lifetimes: {
     attached(this: any) {
       const showGuideActive = wx.getStorageSync("showGuideActive");
@@ -36,6 +38,14 @@ Component({
     active: { type: Boolean, value: false },
   },
   data: {
+    i18n: {
+      chats: { 
+        analysis: '测评',
+        healthData: '个人信息管理',
+        healthIndex: '数据信息管理',
+        consult: '',
+      },
+    },
     analysisCount: 0,
     result: [] as string[],
     result2: false,

+ 6 - 5
miniprogram/module/chats/components/guide/guide.wxml

@@ -18,7 +18,7 @@
       t-class="cell-border-gradient {{_.getClassName(active)}}" 
       t-class-hover="custom-cell-hover"
       t-class-title="health-analysis-title"
-      title="1、健康分析(剩余{{analysisCount}}次)" 
+      title="1、{{i18n.chats.analysis}}(剩余{{analysisCount}}次)" 
       hover="{{active}}" 
       bind:tap="handleA"
       style="--td-cell-hover-color: #F5F5F5;"
@@ -29,7 +29,7 @@
       t-class="cell-border-gradient {{_.getClassName(active)}}" 
       t-class-hover="custom-cell-hover"
        t-class-title="health-analysis-title"
-      title="2、指标信息管理" 
+      title="2、{{i18n.chats.healthIndex}}" 
       hover="{{active}}" 
       bind:tap="handleB"
       style="--td-cell-hover-color: #F5F5F5;"
@@ -40,18 +40,19 @@
       t-class="cell-border-gradient {{_.getClassName(active)}}" 
       t-class-hover="custom-cell-hover"
        t-class-title="health-analysis-title"
-      title="3、健康信息管理" 
+      title="3、{{i18n.chats.healthData}}" 
       hover="{{active}}" 
       bind:tap="handleC"
       style="--td-cell-hover-color: #F5F5F5;"
     >
       <t-icon name="chevron-right" color="#CCCCCC" size="40rpx" slot="note" />
     </t-cell>
-      <t-cell 
+    <t-cell 
+      wx:if="{{i18n.chats.consult}}"
       t-class="cell-border-gradient no-border {{_.getClassName(active)}}" 
       t-class-hover="custom-cell-hover"
        t-class-title="health-analysis-title"
-      title="4、在线咨询" 
+      title="4、{{i18n.chats.consult}}" 
       hover="{{active}}" 
       bind:tap="handleE"
       style="--td-cell-hover-color: #F5F5F5;"

+ 16 - 6
miniprogram/module/chats/components/message-consult/message-consult.ts

@@ -7,6 +7,7 @@ interface ConsultMessage {
   messageContent?: string; // 消息内容
   sendTime?: string; // 发送消息的时间
 }
+import I18nBehavior from "../../../../i18n/behavior";
 import { Post } from "../../../../lib/request/method";
 import { upload } from "../../../../lib/request/upload";
 import dayjs from "dayjs";
@@ -57,8 +58,13 @@ function transformMessage(item: AnyObject): ConsultMessage {
 }
 
 Component({
+  behaviors: [I18nBehavior],
   properties: {},
   data: {
+    title: '',
+    i18n: {
+      consultChat: { _: '聊天' }
+    },
     messages: [] as ConsultMessage[],
     inputText: "",
     inputFocus: true,
@@ -71,7 +77,11 @@ Component({
     _pollTimer: 0 as any, // 5秒轮询最新消息定时器
     textareaHeight: 80, // textarea 高度(rpx),初始值与 min-height 一致
   },
-
+  observers: {
+    'i18n.consultChat._'(this: any, title: string) {
+      this.setData({ title });
+    },
+  },
   lifetimes: {
     async attached() {
       const safeBottomRpx = calculateSafeBottomRpx();
@@ -224,8 +234,8 @@ Component({
       this._hideKeyboardAndUpdatePosition();
       wx.showModal({
         title: "",
-        content: "确定要结束本次咨询?",
-        cancelText: "继续咨询",
+        content: `确定要结束本次?${this.data.title}`,
+        cancelText: `继续${this.data.title}`,
         confirmText: "结束",
       }).then((res: any) => {
         if (res.confirm) {
@@ -248,7 +258,7 @@ Component({
         sender: "system",
         sendType: "3",
         messageType: "1",
-        messageContent: "咨询结束",
+        messageContent: `${this.data.title}结束`,
         sendTime: endDate,
       });
 
@@ -258,7 +268,7 @@ Component({
           await Post(`/consultManage/end/${consultId}`);
         } catch (error: any) {
           wx.showToast({
-            title: error?.errMsg || "结束咨询失败",
+            title: error?.errMsg || `结束${this.data.title}失败`,
             icon: "none",
           });
         }
@@ -435,7 +445,7 @@ Component({
     async _sendMessage(messageType: "1" | "2", messageContent: string) {
       const consultId = wx.getStorageSync("consultId");
       if (!consultId) {
-        wx.showToast({ title: "咨询ID不存在", icon: "none" });
+        wx.showToast({ title: `${this.data.title}ID不存在`, icon: "none" });
         return;
       }
       try {

+ 1 - 1
miniprogram/module/chats/components/message-consult/message-consult.wxml

@@ -57,7 +57,7 @@
 
 <view class="input-panel" style="bottom: {{inputBoxBottom}}rpx;" bind:tap="tapPanel" wx:if="{{!consultEnded}}">
   <view class="action-bar">
-    <view class="action-btn danger" bind:tap="endConsult">结束咨询</view>
+    <view class="action-btn danger" bind:tap="endConsult">结束{{i18n.consultChat._}}</view>
   </view>
   <view class="input-row">
     <textarea

+ 7 - 2
miniprogram/module/chats/components/message-follow/message-follow.ts

@@ -1,6 +1,7 @@
 // module/chats/components/message-text/message-text.ts
+import I18nBehavior from "../../../../i18n/behavior";
 Component({
-
+  behaviors: [I18nBehavior],
   /**
    * 组件的属性列表
    */
@@ -13,7 +14,11 @@ Component({
    * 组件的初始数据
    */
   data: {
-
+    i18n: {
+      report: { title: '评估' },
+      analysis: { title: '结果' },
+      follow: { tips: '操作完成' },
+    },
   },
 
   /**

+ 3 - 3
miniprogram/module/chats/components/message-follow/message-follow.wxml

@@ -5,7 +5,7 @@
   </view>
 
   <view class="chat-card__content">
-   <t-cell t-class="cell-border-gradient" title="随访完成,感谢您的配合,祝您早日恢复!"></t-cell>
+   <t-cell t-class="cell-border-gradient" title="{{i18n.follow.tips}}"></t-cell>
   </view>
 </view>
 
@@ -14,11 +14,11 @@
     <image src="../../assets/robot.png" mode="aspectFill" />
   </view>
   <view class="chat-card__content">
-    <t-cell t-class="cell-border-gradient" title="查看舌面象分析报告">
+    <t-cell t-class="cell-border-gradient" title="查看{{i18n.analysis.title}}">
     </t-cell>
     <view class="chat-card__handle">
       <view class="item health-report" bind:tap="seeReport">
-      查看健康分析报告
+        查看{{i18n.report.title}}
         <image src="../../assets/button-report.bg.png" mode="aspectFit" />
       </view>
     </view>

+ 7 - 1
miniprogram/module/chats/components/message-report/message-report.ts

@@ -1,9 +1,15 @@
+import I18nBehavior from "../../../../i18n/behavior";
 // module/chats/components/message-report/message-report.ts
 Component({
+  behaviors: [I18nBehavior],
   properties: {
     payload: { type: Object, value: { title: '', url: '' } }
   },
-  data: {},
+  data: {
+    i18n: {
+      report: { title: '报告' },
+    }
+  },
   methods: {
     handle() {
       wx.navigateTo({ url: this.data.payload.url })

+ 4 - 4
miniprogram/module/chats/components/message-report/message-report.wxml

@@ -8,10 +8,10 @@
     </t-cell>
     <view class="chat-card__handle report-handle">
       <view class="item" bind:tap="handle">
-   <view class="report-box">
-<view><image src="../../../../assets/bg/icon_file@3x.png" class="report-img" /> </view>
-<view class="text-box">健康分析报告</view>
-</view>
+        <view class="report-box">
+          <view><image src="../../../../assets/bg/icon_file@3x.png" class="report-img" /></view>
+          <view class="text-box">{{i18n.report.title}}</view>
+        </view>
       </view>
     </view>
   </view>

+ 7 - 3
miniprogram/module/chats/components/questionnaire/questionnaire.ts

@@ -1,4 +1,5 @@
 import dayjs from "dayjs";
+import I18nBehavior from "../../../../i18n/behavior";
 import { Post } from "../../../../lib/request/method";
 
 // module/chats/components/questionnaire/questionnaire.ts
@@ -30,6 +31,7 @@ interface MessageType {
 }
 
 Component({
+  behaviors: [I18nBehavior],
   lifetimes: {
     attached: function () {
       let isAnalysis: number;
@@ -59,6 +61,9 @@ Component({
    * 组件的初始数据
    */
   data: {
+    i18n: {
+      chats: { report: '' },
+    },
     inputBoxBottom: 0,
     messages: {} as Record<number, Message>,
     lastId: "",
@@ -340,9 +345,8 @@ Component({
                 id: "report",
                 type: "report",
                 payload: {
-                  title: `本次问答已结束,历时${
-                    diff || 1
-                  }分钟,非常感谢您的配合!请查看您本次的健康评估情况。`,
+                  title: `本次问答已结束,历时${diff || 1
+                    }分钟,非常感谢您的配合!${this.data.i18n.chats.report}`,
                   url: `/module/health/pages/report/report?id=${data.healthAnalysisReportId}`,
                 },
               });

+ 5 - 1
miniprogram/module/chats/pages/consultation-record/consultation-record.ts

@@ -1,11 +1,15 @@
 import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
+import I18nBehavior from "../../../../i18n/behavior";
 import { Post } from "../../../../lib/request/method";
 // module/chats/pages/consultation-record/consultation-record.ts
 
 Page({
-  behaviors: [PageContainerBehavior],
+  behaviors: [I18nBehavior, PageContainerBehavior],
   properties: {},
   data: {
+    i18n: {
+      consultChat: { _: '聊天', title: '记录' },
+    },
     //有item传过来不分页
     //是否分页
     isPage: false,

+ 3 - 3
miniprogram/module/chats/pages/consultation-record/consultation-record.wxml

@@ -1,5 +1,5 @@
 <!--module/chats/pages/consultation-record/consultation-record.wxml-->
-<t-navbar title="咨询记录" left-arrow />
+<t-navbar title="{{i18n.consultChat.title}}" left-arrow />
 <scroll-view 
   id="scrollview" 
   class="page-scroll__container" 
@@ -16,7 +16,7 @@
       <!-- 开始咨询 -->
       <view class="consultation-session">
         <view class="timestamp">{{item.startTime}}</view>
-        <view class="status-message">开始咨询</view>
+        <view class="status-message">开始{{i18n.consultChat._}}</view>
         
         <!-- 消息列表 -->
         <view class="messages-list">
@@ -63,7 +63,7 @@
         
         <!-- 咨询结束 -->
         <view class="timestamp">{{item.endTime}}</view>
-        <view class="status-message">咨询结束</view>
+        <view class="status-message">{{i18n.consultChat._}}结束</view>
       </view>
     </block>
     

+ 5 - 1
miniprogram/module/chats/pages/index/index.ts

@@ -1,5 +1,6 @@
 import dayjs from "dayjs";
 import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
+import I18nBehavior from "../../../../i18n/behavior";
 
 // module/chats/pages/index/index.ts
 interface ScrollIntoViewEvent {
@@ -23,7 +24,7 @@ function getScrollcontext(this: any) {
 }
 
 Component({
-  behaviors: [PageContainerBehavior],
+  behaviors: [I18nBehavior, PageContainerBehavior],
   lifetimes: {
     attached() {
       this.setData({
@@ -61,6 +62,9 @@ Component({
     id: { type: Number, value: 0 },
   },
   data: {
+    i18n: {
+      chats: { title: '聊天', analysis: '测评' },
+    },
     date: "",
     messages: {} as Record<number, Message>,
     lastId: "",

+ 2 - 2
miniprogram/module/chats/pages/index/index.wxml

@@ -9,7 +9,7 @@
 
 <!--module/chats/pages/index/index.wxml-->
 <view class="chats-container">
-  <t-navbar title="对话管家" />
+  <t-navbar title="{{i18n.chats.title}}" />
   <scroll-view 
     id="scrollview" 
     class="page-scroll__container" 
@@ -23,7 +23,7 @@
   >
     <view class="system-wrapper">
       <view class="date">{{date}}</view>
-      <view class="title">对话管家 已进入聊天</view>
+      <view class="title">{{i18n.chats.title}} 已进入聊天</view>
     </view>
     
     <block wx:for="{{messages}}" wx:index="{{index}}" wx:key="id">

+ 17 - 3
miniprogram/module/health/components/card-analysis/card-analysis-content.ts

@@ -1,11 +1,12 @@
+import I18nBehavior from "../../../../i18n/behavior";
 import { groupBy } from "../../../../utils/util";
 import { AnalysisException, AnalysisModel } from "../../model/health.model";
-
 // module/health/components/card-analysis/card-analysis-content.ts
 Component({
+  behaviors: [I18nBehavior],
   lifetimes: {
     attached() {
-      if(this.properties.type==='files'){ 
+      if (this.properties.type === 'files') {
         this.setData({ isShowType: true });
       }
     }
@@ -38,6 +39,16 @@ Component({
     tongueException: [],
     faceException: [],
     isShowType: '',
+    i18n: [
+      'analysis._',
+      'analysis.tongue',
+      'analysis.face',
+      'analysis.tongue_1',
+      'analysis.tongue_2',
+      'analysis.face_1',
+      'analysis.__show__',
+      'analysis.__showContent__',
+    ],
   },
   methods: {
     async preview(event: WechatMiniprogram.TouchEvent) {
@@ -46,10 +57,13 @@ Component({
       const data = (this.data as any)[type]?.[operation];
       if (!data) return;
 
+      const t2 = this.data.i18n?.analysis?.[type] ?? '';
+      const t3 = this.data.i18n?.analysis?.['_'] ?? '';
+
       const { eventChannel } = await wx.navigateTo({ url: `/module/health/pages/tongue-analysis/tongue-analysis` });
       eventChannel.emit('load', {
         dataset: this._getException(data, dataType),
-        title: { tongue: '异常舌象分析', face: '异常面象分析' }[type]
+        title: `异常${t2}${t3}`,
       });
     },
 

+ 24 - 26
miniprogram/module/health/components/card-analysis/card-analysis-content.wxml

@@ -1,18 +1,15 @@
 <!--module/health/components/card-analysis/card-analysis-content.wxml-->
-<view class="card-wrapper tongue-container" wx:if="{{tongue.result}}" 
-mark:type="tongue" bind:tap="preview">
-
-<view wx:if="{{isShowType}}">
-<view class="togue-title"> 舌象</view>
-</view>
-
+<view class="card-wrapper tongue-container" wx:if="{{tongue.result && i18n.analysis.__show__}}" mark:type="tongue" bind:tap="preview">
 
+  <view wx:if="{{isShowType}}">
+    <view class="togue-title">{{i18n.analysis.tongue}}</view>
+  </view>
   <view class="card-title" wx:else>
     <view class="tongue-right">
       <view>
         <image src="../../assets/icon/icon_tongue@2x.png" class="icon-title" />
       </view>
-      <view class="text-title">舌象分析</view>
+      <view class="text-title">{{i18n.analysis.tongue}}{{i18n.analysis._}}</view>
     </view>
     <block wx:if="{{exception.tongue === false && tongue.exception.length}}">
       <view class="extra-warapper" slot="right-icon" mark:operation="exception-list">
@@ -27,40 +24,42 @@ mark:type="tongue" bind:tap="preview">
     <view class="picture-container">
       <view style="position: relative;">
         <image src="../../assets/image/pic_tongue@2x.png" class="body-image" mode="widthFix" />
-        <text class="tongue-label tongue-top">舌面</text>
-        <text class="tongue-label tongue-bottom">舌下</text>
+        <text class="tongue-label tongue-top">{{i18n.analysis.tongue_1}}</text>
+        <text class="tongue-label tongue-bottom">{{i18n.analysis.tongue_2}}</text>
       </view>
       <view wx:if="{{tongue.cover.length}}" class="picture-wrapper">
         <image wx:for="{{tongue.cover}}" wx:key="*this" src="{{item}}" mode="aspectFill" />
       </view>
     </view>
 
-    <view wx:if="{{simple.tongue === false}}" class="talbel-wrapper">
-      <view class="tr">
-        <view wx:for="{{tongue.table.columns}}" wx:key="*this" class="th">{{item}}</view>
-      </view>
-      <view wx:for="{{tongue.table.data}}" wx:key="0" wx:for-item="data" class="tr {{data.exception ? 'exception': ''}} {{data.invalid ? 'invalid' : ''}}">
-        <view wx:for="{{tongue.table.columns}}" wx:key="*this" wx:for-index="index" class="td">
-          <rich-text nodes="{{data[index]}}"></rich-text>
+    <block wx:if="{{i18n.analysis.__showContent__}}">
+      <view wx:if="{{simple.tongue === false}}" class="talbel-wrapper">
+        <view class="tr">
+          <view wx:for="{{tongue.table.columns}}" wx:key="*this" class="th">{{item}}</view>
+        </view>
+        <view wx:for="{{tongue.table.data}}" wx:key="0" wx:for-item="data" class="tr {{data.exception ? 'exception': ''}} {{data.invalid ? 'invalid' : ''}}">
+          <view wx:for="{{tongue.table.columns}}" wx:key="*this" wx:for-index="index" class="td">
+            <rich-text nodes="{{data[index]}}"></rich-text>
+          </view>
         </view>
       </view>
-    </view>
-    <view wx:else>&emsp;&emsp;{{tongue.result}}</view>
+      <view wx:else>&emsp;&emsp;{{tongue.result}}</view>
+    </block>
   </view>
 </view>
 
 <exception wx:if="{{tongueException.length}}" dataset="{{tongueException}}"></exception>
 
-<view class="card-wrapper tongue-container" wx:if="{{face.result}}" mark:type="face" bind:tap="preview">
-<view wx:if="{{isShowType}}">
-<view class="togue-title"> 面象</view>
-</view>
+<view class="card-wrapper tongue-container" wx:if="{{face.result && i18n.analysis.__show__}}" mark:type="face" bind:tap="preview">
+  <view wx:if="{{isShowType}}">
+    <view class="togue-title">{{i18n.analysis.face}}</view>
+  </view>
   <view class="card-title" wx:else>
     <view class="tongue-right">
       <view>
         <image src="../../assets/icon/icon_face@2x.png" class="icon-title" />
       </view>
-      <view class="text-title">面象分析</view>
+      <view class="text-title">{{i18n.analysis.face}}{{i18n.analysis._}}</view>
     </view>
     <block wx:if="{{exception.face === false && face.exception.length}}">
       <view class="extra-warapper" slot="right-icon" mark:operation="exception-group">
@@ -70,8 +69,7 @@ mark:type="tongue" bind:tap="preview">
     </block>
   </view>
 
-  <view class="card-body constitution-container">
-  
+  <view wx:if="{{i18n.analysis.__showContent__}}" class="card-body constitution-container">
     <view wx:if="{{simple.face === false}}" class="talbel-wrapper">
       <view class="tr">
         <view wx:for="{{face.table.columns}}" wx:key="*this" class="th">{{item}}</view>

+ 7 - 0
miniprogram/module/health/components/card-analysis/card-analysis-exception.ts

@@ -1,6 +1,13 @@
+import I18nBehavior from "../../../../i18n/behavior";
 // module/health/components/card-analysis/card-analysis-exception.ts
 Component({
+  behaviors: [I18nBehavior],
   properties: {
     dataset: { type: Array, value: [] },
   },
+  data: {
+    i18n: {
+      analysis: { __showException__: false },
+    },
+  },
 })

+ 17 - 15
miniprogram/module/health/components/card-analysis/card-analysis-exception.wxml

@@ -1,21 +1,23 @@
 <!--module/health/components/card-analysis/card-analysis-exception.wxml-->
-<view class="card-wrapper" wx:for="{{dataset}}" wx:key="key">
-  <t-cell wx:if="{{item.title}}" t-class="card-header cell-border-gradient" title="{{item.title}}" />
-  <view class="card-body">
-    <view class="picture-wrapper">
-      <image wx:if="{{item.cover}}" src="{{item.cover}}" mode="aspectFit" class="{{item.tags.length ? 'min' : ''}}" />
-      <view style="display: flex;flex-direction: column;">
-        <t-tag style="margin: 4px 0;" wx:for="{{item.tags}}" wx:key="*this" theme="danger">{{item}}</t-tag>
+<block wx:if="{{i18n.analysis.__showException__}}">
+  <view class="card-wrapper" wx:for="{{dataset}}" wx:key="key">
+    <t-cell wx:if="{{item.title}}" t-class="card-header cell-border-gradient" title="{{item.title}}" />
+    <view class="card-body">
+      <view class="picture-wrapper">
+        <image wx:if="{{item.cover}}" src="{{item.cover}}" mode="aspectFit" class="{{item.tags.length ? 'min' : ''}}" />
+        <view style="display: flex;flex-direction: column;">
+          <t-tag style="margin: 4px 0;" wx:for="{{item.tags}}" wx:key="*this" theme="danger">{{item}}</t-tag>
+        </view>
       </view>
-    </view>
-    <view wx:for="{{item.exception}}" wx:key="key">
-      <t-cell wx:if="{{item.title}}" t-class="card-header cell-border-gradient" title="{{item.title}}" />
-      <view class="card-body">
-        <view class="row" wx:for="{{item.descriptions}}" wx:key="label">
-          <text class="label primary">{{item.label}}</text>
-          <rich-text class="value" nodes="{{item.value}}"></rich-text>
+      <view wx:for="{{item.exception}}" wx:key="key">
+        <t-cell wx:if="{{item.title}}" t-class="card-header cell-border-gradient" title="{{item.title}}" />
+        <view class="card-body">
+          <view class="row" wx:for="{{item.descriptions}}" wx:key="label">
+            <text class="label primary">{{item.label}}</text>
+            <rich-text class="value" nodes="{{item.value}}"></rich-text>
+          </view>
         </view>
       </view>
     </view>
   </view>
-</view>
+</block>

+ 3 - 1
miniprogram/module/health/components/care-scheme/care-scheme.ts

@@ -1,7 +1,8 @@
 // module/health/components/field-ruler/field-ruler.ts
+import I18nBehavior from "../../../../i18n/behavior";
 import {  getCareRecordMethod } from "../../request";
 Component({
-  behaviors: ["wx://form-field-group"],
+  behaviors: ["wx://form-field-group", I18nBehavior],
   lifetimes: {
     attached() {
       this.getCareRecordList();
@@ -11,6 +12,7 @@ Component({
    * 组件的初始数据
    */
    data: {
+    i18n: { health: { condition: '方案' } },
     loading: false,
     careRecordList: [],
   },

+ 1 - 1
miniprogram/module/health/components/care-scheme/care-scheme.wxml

@@ -10,7 +10,7 @@
         <view>
           <image src="../../assets/icon/icon_record@2x.png" class="icon-title" />
         </view>
-        <view class="text-title">我的调养方案</view>
+        <view class="text-title">我的{{i18n.health.condition}}</view>
       </view>
       <slot name="extra"></slot>
     </view>

+ 7 - 0
miniprogram/module/health/components/report-health-index/report-health-index.ts

@@ -1,5 +1,7 @@
 // module/health/components/report-health-index/report-health-index.ts
+import I18nBehavior from "../../../../i18n/behavior";
 Component({
+  behaviors: [I18nBehavior],
   options: {
     multipleSlots: true,
   },
@@ -8,4 +10,9 @@ Component({
     loading: { type: Boolean, value: false },
     message: { type: String, value: '' },
   },
+  data: {
+    i18n: {
+      healthIndex: { title: '', __show__: false },
+    },
+  }
 })

+ 2 - 2
miniprogram/module/health/components/report-health-index/report-health-index.wxml

@@ -1,5 +1,5 @@
 <!--module/health/components/report-health-index/report-health-index.wxml-->
-<view>
+<view wx:if="{{i18n.healthIndex.__show__}}">
   <view class="card-wrapper constitution-container">
     <view class="card-header constitution-box">
       <block slot="title">
@@ -8,7 +8,7 @@
           <view>
             <image src="../../assets/icon/icon_index@2x.png" class="icon-title" />
           </view>
-          <view class="text-title">指标信息</view>
+          <view class="text-title">{{i18n.healthIndex.title}}</view>
         </view>
       </block>
 

+ 11 - 0
miniprogram/module/health/components/report-health-status/report-health-status.ts

@@ -1,4 +1,5 @@
 import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
+import I18nBehavior from "../../../../i18n/behavior";
 import {
   DraggableSheetBehavior,
   getDraggableSheetContext,
@@ -23,6 +24,7 @@ interface PanelProps {
 
 Component({
   behaviors: [
+    I18nBehavior,
     PageContainerBehavior,
     DraggableSheetBehavior(".health-report-list"),
   ],
@@ -37,6 +39,15 @@ Component({
     },
   },
   data: {
+    i18n: {
+      home: { __showRecord__: false },
+      health: {
+        status: '结果概况',
+        statusTable: ['', '', '', '', '', '', ''],
+        statusNext: '概况'
+      },
+      report: { title: '测评结果' },
+    },
     dataset: {},
     tongue: null as unknown as AnalysisModel,
     face: null as unknown as AnalysisModel,

+ 5 - 5
miniprogram/module/health/components/report-health-status/report-health-status.wxml

@@ -5,7 +5,7 @@
       <block slot="title">
         <t-loading wx:if="{{loading}}" theme="spinner" size="20px" class="loading" />
         <image wx:else class="icon" src="../../assets/icon/icon_health@2x.png" mode="heightFix" />
-        <text class="title-box">健康状况</text>
+        <text class="title-box">{{i18n.health.status}}</text>
       </block>
     </view>
 
@@ -25,7 +25,7 @@
     <view class="card-body report-wrapper" mark:id="{{dataset.reportId}}" style="padding-top:0px;border-radius: 0 0 10px 10px;">
       <view class="content-wrapper" style="border-top: 1px solid #E7E7E7;padding-top:10px">
         <span class="row" wx:for="{{dataset.report}}" wx:key="value">
-          <text wx:if="{{item.label}}" style="color:#8C8C8C;font-size:14px">{{item.label}}:</text>
+          <text wx:if="{{item.label}}" style="color:#8C8C8C;font-size:14px">{{i18n.health.statusTable[index]}}</text>
           <text style="font-size:14px"> {{item.value}}</text>
         </span>
       </view>
@@ -34,7 +34,7 @@
   </view>
   <!-- 症状 -->
   <view class="card-container">
-    <view class="status-title">症状</view>
+    <view class="status-title">{{i18n.health.statusNext}}</view>
     <view class="card-body status-data-wrapper" wx:if="{{dataset.condition.length}}" style="border-top: 1px solid #E7E7E7;padding-top:10px">
       <span class="row" wx:for="{{dataset.condition}}" wx:key="value">
 
@@ -78,14 +78,14 @@
   </draggable-sheet>
 </root-portal>
 
-<view class="card-wrapper report-data-wrapper" mark:type="report" bind:tap="toPreviewPage">
+<view wx:if="{{i18n.home.__showRecord__}}" class="card-wrapper report-data-wrapper" mark:type="report" bind:tap="toPreviewPage">
   <view>
     <view class="report-box">
       <view class="health-title">
         <block slot="title">
           <t-loading wx:if="{{loading}}" theme="spinner" size="20px" class="loading" />
           <image wx:else class="icon" src="../../assets/icon/icon_scheme@2x.png" mode="heightFix"></image>
-          <text class="title-box">健康分析报告</text>
+          <text class="title-box">{{i18n.report.title}}</text>
         </block>
       </view>
       <block slot="right-icon">

+ 3 - 3
miniprogram/module/health/model/health.model.ts

@@ -40,9 +40,9 @@ export function healthReportModel(data: AnyObject) {
 
     report: [
       fn('结果显示您是', data?.willillStateName, true),
-      fn('程度', data?.willillDegreeName),
-      fn('类型', data?.willillSocialName),
-      fn('表现', data?.willillFunctionName),
+      fn('程度', data?.willillDegreeName, true),
+      fn('类型', data?.willillSocialName, true),
+      fn('表现', data?.willillFunctionName, true),
       fn('体质', data?.constitutionGroupName, true),
       fn('证素', data?.factorItemSummary, true),
       fn('证型', data?.diagnoseSyndromeSummary, true),

+ 5 - 0
miniprogram/module/health/pages/analysis/analysis.ts

@@ -1,4 +1,5 @@
 import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
+import I18nBehavior from "../../../../i18n/behavior";
 import TickleBehavior, { getTickleContext } from "../../../../core/behavior/tickle.behavior";
 
 // module/health/pages/analysis/analysis.ts
@@ -9,10 +10,14 @@ import { AnalysisModel } from "../../model/health.model";
 
 Page({
   behaviors: [
+    I18nBehavior,
     PageContainerBehavior,
     TickleBehavior
   ],
   data: {
+    i18n: {
+      analysis: { title: '图片结果', date: '' },
+    },
     id: '',
     tongue: null as unknown as AnalysisModel,
     face: null as unknown as AnalysisModel,

+ 2 - 2
miniprogram/module/health/pages/analysis/analysis.wxml

@@ -1,11 +1,11 @@
 <!--module/health/pages/analysis/analysis.wxml-->
 <view class="tongue-container">
-<t-navbar title="舌面分析报告" left-arrow bind:fail="toHomePage" />
+<t-navbar title="{{i18n.analysis.title}}" left-arrow bind:fail="toHomePage" />
 
 <scroll-view class="page-scroll__container" type="list" scroll-y style="{{containerStyle}}">
   <view class="card-wrapper header-box">
     <t-cell t-class="card-header no-body" bordered="{{false}}">
-      <view slot="title" style="display:flex"><text style="color:#8C8C8C">报告日期:</text><text style="color:black">{{dataset.reportTime}}</text></view>
+      <view slot="title" style="display:flex"><text style="color:#8C8C8C">{{i18n.analysis.date}}</text><text style="color:black">{{dataset.reportTime}}</text></view>
     </t-cell>
   </view>
 

+ 13 - 0
miniprogram/module/health/pages/home/home.ts

@@ -1,4 +1,5 @@
 import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
+import I18nBehavior from "../../../../i18n/behavior";
 
 // module/health/pages/home/home.ts
 import { toPatientPage } from "../../router";
@@ -7,6 +8,7 @@ import { healthIndex2Progress } from "../../tools/health-index";
 
 Component({
   behaviors: [
+    I18nBehavior,
     PageContainerBehavior,
   ],
   lifetimes: {
@@ -18,6 +20,17 @@ Component({
   },
   properties: {},
   data: {
+    i18n: {
+      health: { 
+        title: '档案',
+        __showScheme__: false,
+        __showFollowRecord__: false,
+        __showFollowEvaluation__: false,
+        __showRecord__: false,
+        __showNodrugTherapy__: false,
+        __showChatRecord__: false,
+      }
+    },
     // healthId: '',
     healthPatient: { data: null, loading: false, message: '' },
     healthIndex: { data: [], loading: false, message: '' },

+ 8 - 8
miniprogram/module/health/pages/home/home.wxml

@@ -1,6 +1,6 @@
 <!--module/health/pages/home/home.wxml-->
 <view class="health-container">
-  <t-navbar title="健康档案" left-arrow />
+  <t-navbar title="{{i18n.health.title}}" left-arrow />
   <scroll-view class="page-scroll__container" type="list" scroll-y>
     <report-health-patient dataset="{{healthPatient.data}}" loading="{{healthPatient.loading}}" message="{{healthPatient.message}}">
       <view class="extra-warapper" slot="extra" catch:tap="toPatientPage">
@@ -16,17 +16,17 @@
       </view>
     </report-health-index>
     <!--我的调养方案-->
-    <care-scheme></care-scheme>
+    <care-scheme wx:if="{{i18n.health.__showScheme__}}"></care-scheme>
     <!--随访记录-->
-    <follow-record></follow-record>
+    <follow-record wx:if="{{i18n.health.__showFollowRecord__}}"></follow-record>
     <!--随访评估-->
-    <follow-evaluation></follow-evaluation>
+    <follow-evaluation wx:if="{{i18n.health.__showFollowEvaluation__}}"></follow-evaluation>
     <!--调养记录-->
-    <care-record></care-record>
+    <care-record wx:if="{{i18n.health.__showRecord__}}"></care-record>
     <!--线下非药物治疗-->
-    <nodrug-therapy></nodrug-therapy>
-     <!--咨询记录-->
-<chat-record></chat-record>
+    <nodrug-therapy wx:if="{{i18n.health.__showNodrugTherapy__}}"></nodrug-therapy>
+    <!--咨询记录-->
+    <chat-record wx:if="{{i18n.health.__showChatRecord__}}"></chat-record>
   </scroll-view>
 </view>
 <t-message id="{{$messageId}}"></t-message>

+ 13 - 1
miniprogram/module/health/pages/report/report.ts

@@ -1,4 +1,5 @@
 import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
+import I18nBehavior from "../../../../i18n/behavior";
 import TickleBehavior, {
   getTickleContext,
 } from "../../../../core/behavior/tickle.behavior";
@@ -9,8 +10,19 @@ import { healthIndexMethod, healthReportMethod } from "../../request";
 import { healthIndex2Progress } from "../../tools/health-index";
 
 Page({
-  behaviors: [PageContainerBehavior, TickleBehavior],
+  behaviors: [I18nBehavior, PageContainerBehavior, TickleBehavior],
   data: {
+    i18n: {
+      common: { doctor: '', zy: '' },
+      health: { statusTable: ['', '', '', '', '', '', ''] },
+      scheme: { title: '方案' },
+      report: {
+        title: '报告',
+        date: '',
+        physique: '',
+        physiqueTable: ['特征1', '特征2', '特征3', '特征4', '特征5', '特征6'],
+      }
+    },
     id: "",
     dataset: null as unknown as AnyObject,
     showScheme: false,

+ 23 - 13
miniprogram/module/health/pages/report/report.wxml

@@ -1,17 +1,25 @@
 <!--module/health/pages/report/report.wxml-->
+<wxs module="tool">
+module.exports = {
+  replace : function (value) {
+    if (typeof value === 'string') return value.replace(':', '').replace(':', '');
+    return ''
+  },
+}
+</wxs>
 <view class="report-container">
-  <t-navbar title="健康分析报告" left-arrow bind:fail="toHomePage" />
+  <t-navbar title="{{i18n.report.title}}" left-arrow bind:fail="toHomePage" />
 
   <scroll-view class="page-scroll__container" type="list" scroll-y style="{{containerStyle}}">
     <view class="card-wrapper">
       <t-cell t-class="card-header no-body {{schemeId ? '' : 'cell-border-gradient'}}" bordered="{{!schemeId}}" style="background:transparent">
         <view slot="title" class="header-row">
-          <view class="date-text"><text style="color:#8C8C8C">报告日期:</text><text style="color:black">{{dataset.reportTime}}</text></view>
-          <view bind:tap="toSchemePage" class="recuperate-btn" wx:if="{{!!schemeId}}">调理方案</view>
+          <view class="date-text"><text style="color:#8C8C8C">{{i18n.report.date}}</text><text style="color:black">{{dataset.reportTime}}</text></view>
+          <view bind:tap="toSchemePage" class="recuperate-btn" wx:if="{{!!schemeId}}">{{i18n.scheme.title}}</view>
         </view>
       </t-cell>
       <view class="card-body notification-wrapper" wx:if="{{!schemeId && showScheme}}">
-        <text style="padding-right: 10px;font-size:16px">请找医生</text> <text style="font-size:20px">获取中医调理方案</text>
+        <text style="padding-right: 10px;font-size:16px">请找{{i18n.common.doctor}}</text> <text style="font-size:20px">获取{{i18n.common.zy}}{{i18n.report.scheme}}</text>
       </view>
     </view>
 
@@ -19,10 +27,12 @@
       <view class="card-body report-wrapper">
         <view class="content-wrapper">
           <block wx:if="dataset">
-            <span class="row" wx:for="{{dataset.report}}" wx:key="value">
-              <text wx:if="{{item.label}}" class="{{item.label==='结果显示您是'?'label-text':'label-title'}}">{{item.label}}:</text>
-              <text class="{{item.label==='结果显示您是'?'value-text':'value-title'}}">{{item.value}}</text>
-            </span>
+            <block wx:for="{{dataset.report}}" wx:key="value">
+              <span class="row" wx:if="{{item.value}}">
+                <text wx:if="{{item.label}}" class="{{index ? 'label-title' : 'label-text'}}">{{i18n.health.statusTable[index]}}</text>
+                <text class="{{index ? 'value-title' : 'value-text'}}">{{item.value}}</text>
+              </span>
+            </block>
           </block>
         </view>
         <image class="image-wrapper" src="../../assets/image/health-report.png" mode="aspectFill" />
@@ -35,7 +45,7 @@
           <view>
             <image src="../../assets/icon/icon_physique@2x.png" class="icon-title" />
           </view>
-          <view class="text-title">体质</view>
+          <view class="text-title">{{i18n.report.physique}}</view>
         </view>
         <view class="content-wrapper">
           <block wx:if="dataset">
@@ -47,8 +57,8 @@
             </view>
           </block>
           <view class="talbel-wrapper">
-            <view class="talbel-row {{index % 2 === 0 ? 'odd-row' : ''}}" wx:for="{{dataset.physique}}" wx:key="value" wx:for-index="index">
-              <view class="label">{{item.label}}</view>
+            <view class="talbel-row {{index % 2 === 0 ? 'odd-row' : ''}}" wx:for="{{dataset.physique}}" wx:key="value">
+              <view class="label">{{i18n.report.physiqueTable[index]}}</view>
               <view class="value">{{item.value}}</view>
             </view>
           </view>
@@ -65,7 +75,7 @@
           <view> 
             <image src="../../assets/icon/icon_zhengsu@2x.png" class="icon-title" />
           </view>
-          <view class="text-title">中医证素</view>
+          <view class="text-title">{{i18n.common.zy}}{{tool.replace(i18n.health.statusTable[5])}}</view>
         </view>
         <view class="rows" wx:for="{{dataset.factorItems}}" wx:key="*this">
           <view class="primary">{{item.factorItemName}}</view>
@@ -79,7 +89,7 @@
           <view>
             <image src="../../assets/icon/icon_zhengxing@2x.png" class="icon-title" />
           </view>
-          <view class="text-title">中医证型</view>
+          <view class="text-title">{{i18n.common.zy}}{{tool.replace(i18n.health.statusTable[6])}}</view>
         </view>
         <view class="rows" wx:for="{{dataset.diagnoseSyndromes}}" wx:key="*this">
           <view class="primary">{{item.diagnoseSyndromeName}}</view>

+ 6 - 1
miniprogram/module/health/pages/scheme/scheme.ts

@@ -1,4 +1,5 @@
 import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
+import I18nBehavior from "../../../../i18n/behavior";
 import TickleBehavior, {
   getTickleContext,
 } from "../../../../core/behavior/tickle.behavior";
@@ -7,7 +8,7 @@ import TickleBehavior, {
 import { healthSchemeMethod } from "../../request";
 import { toReportPage } from "../../router";
 Component({
-  behaviors: [PageContainerBehavior, TickleBehavior],
+  behaviors: [I18nBehavior, PageContainerBehavior, TickleBehavior],
   lifetimes: {
     attached() {
       this.getHealthScheme(this.data.id);
@@ -17,6 +18,10 @@ Component({
     id: { type: String, value: "" },
   },
   data: {
+    i18n: {
+      report: { title: '报告' },
+      scheme: { title: '方案', date: '' },
+    },
     dataset: null,
     schemeId: "",
     healthIndex: { data: [], loading: false, message: "" },

+ 3 - 3
miniprogram/module/health/pages/scheme/scheme.wxml

@@ -1,13 +1,13 @@
 <!--module/health/pages/scheme/scheme.wxml-->
 <view class="scheme-container">
-  <t-navbar title="调理方案" left-arrow />
+  <t-navbar title="{{i18n.scheme.title}}" left-arrow />
 
   <scroll-view class="page-scroll__container" type="list" scroll-y style="{{containerStyle}}">
     <view class="card-wrapper">
       <view class="card-header no-body" bordered="{{false}}" style="background:transparent;padding-right: 6px;padding-left: 6px;">
         <view slot="title" class="header-row">
-          <view class="date-text"><text style="color:#8C8C8C">方案日期:</text><text style="color:black">{{dataset.reportTime}}</text></view>
-          <view class="recuperate-btn" bind:tap="toReportPage">健康分析报告</view>
+          <view class="date-text"><text style="color:#8C8C8C">{{i18n.scheme.date}}</text><text style="color:black">{{dataset.reportTime}}</text></view>
+          <view class="recuperate-btn" bind:tap="toReportPage">{{i18n.report.title}}</view>
         </view>
       </view>
     </view>

+ 14 - 0
miniprogram/module/health/pages/status-record/status-record.ts

@@ -1,3 +1,4 @@
+import I18nBehavior from "../../../../i18n/behavior";
 import tickleBehavior, { getTickleContext } from "../../../../core/behavior/tickle.behavior";
 // module/health/pages/status-record/status-record.ts
 import { getStatusRecordMethod } from "../../request";
@@ -21,6 +22,7 @@ const defaultColumns: Column[] = [
 
 Component({
   behaviors: [
+    I18nBehavior,
     tickleBehavior,
   ],
   lifetimes: {
@@ -28,6 +30,18 @@ Component({
   },
   properties: {},
   data: {
+    i18n: {
+      health: { 
+        status: '',
+        statusRecord: {
+          "症状": "结果1",
+          "联想症状": "结果2",
+          "舌面": "图片1",
+          "舌底": "图片2",
+          "面部": "图片3"
+        }
+      },
+    },
     orientation: '' as 'portrait' | 'landscape',
     containerStyle: '',
     columns: [] as Column[],

+ 4 - 2
miniprogram/module/health/pages/status-record/status-record.wxml

@@ -5,11 +5,13 @@
   }
 </wxs>
 <!--module/health/pages/status-record/status-record.wxml-->
-<t-navbar title="健康状况更新记录" left-arrow />
+<t-navbar title="{{i18n.health.status}}更新记录" left-arrow />
 <view class="wrapper {{orientation}}" style="{{containerStyle}}">
   <view class="header">
     <block wx:for="{{columns}}" wx:key="value" wx:for-index="i" wx:for-item="r">
-      <view class="row {{i === 0 ? 'title' : i % 2 ? 'odd' : 'even'}}" style="height: {{r.height}}px;">{{r.label}}</view>
+      <view class="row {{i === 0 ? 'title' : i % 2 ? 'odd' : 'even'}}" style="height: {{r.height}}px;">
+        {{i18n.health.statusRecord[r.label] || r.label}}
+      </view>
     </block>
   </view>
   <scroll-view class="scrollable" type="list" scroll-x enable-flex style="flex-direction: row;" bind:scrolltolower="loadMore">

+ 3 - 1
miniprogram/module/health/pages/status/status.ts

@@ -1,3 +1,4 @@
+import I18nBehavior from "../../../../i18n/behavior";
 import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
 import TickleBehavior, { getTickleContext } from "../../../../core/behavior/tickle.behavior";
 
@@ -8,7 +9,7 @@ import { transformHealthIndex2Ruler } from "../../tools/health-index";
 type ResponseData = { id: string, name: string, options: App.Health.Index.Ruler[] }[];
 
 Component({
-  behaviors: [PageContainerBehavior, TickleBehavior],
+  behaviors: [I18nBehavior, PageContainerBehavior, TickleBehavior],
   lifetimes: {
     attached() {
       this.getData()
@@ -16,6 +17,7 @@ Component({
   },
   properties: {},
   data: {
+    i18n: { healthIndex: { title: '数据信息', tips: '', __show__: false } },
     health: [] as ResponseData,
   },
   methods: {

+ 4 - 3
miniprogram/module/health/pages/status/status.wxml

@@ -1,15 +1,16 @@
 <!--module/health/pages/status/status.wxml-->
-<t-navbar title="指标信息" left-arrow />
-<scroll-view class="page-scroll__container" type="list" scroll-y style="{{containerStyle}}">
+<t-navbar title="{{i18n.healthIndex.title}}" left-arrow />
+<scroll-view wx:if="{{i18n.healthIndex.__show__}}" class="page-scroll__container" type="list" scroll-y style="{{containerStyle}}">
   <form bind:submit="onSubmit">
     <t-cell wx:for="{{health}}" wx:key="{{item.id}}" t-class="cell-border-gradient cell-field" t-class-note="cell-field__wrapper" title="{{item.name}}" bind:tap="onPicker">
       <field-ruler class="cell-field__inner full" slot="note" title="{{item.name}}" options="{{item.options}}"></field-ruler>
     </t-cell>
     <block wx:if="{{health.length}}">
-      <view class="tips">温馨提示:指标信息越完善,我们分析的越精确</view>
+      <view class="tips">{{i18n.healthIndex.tips}}</view>
       <form-button block index="1" id="submitBtn"></form-button>
     </block>
   </form>
 </scroll-view>
+<view wx:else style="text-align: center;margin: 100px;">暂无数据</view>
 
 <t-message id="{{$messageId}}"></t-message>

+ 9 - 1
miniprogram/pages/home/home.ts

@@ -1,4 +1,5 @@
 import PageContainerBehavior from "../../core/behavior/page-container.behavior";
+import I18nBehavior from "../../i18n/behavior";
 import {
   DraggableSheetBehavior,
   getDraggableSheetContext,
@@ -30,6 +31,12 @@ import { Post } from "../../lib/request/method";
 
 Page({
   data: {
+    i18n: {
+      common: { title: '生活助理', zy: '' },
+      home: { analysis: '评估', consult: '聊天', __showRecord__: false, __showDisplay__: false },
+      report: { title: '报告' },
+      healthTeach: { title: '' },
+    },
     isShowComplete: true,
     careList: [],
     displayList: [] as {
@@ -83,7 +90,7 @@ Page({
 
     switchType: "",
 
-    carouselLoading: {} as Record<string | number, boolean>, 
+    carouselLoading: {} as Record<string | number, boolean>,
 
     carouselMediaList: [] as Array<{
       type: "image" | "video";
@@ -95,6 +102,7 @@ Page({
     hasNewMessage: false,
   },
   behaviors: [
+    I18nBehavior,
     PageContainerBehavior,
     DraggableSheetBehavior(".draggable-sheet-wrapper"),
   ],

+ 7 - 7
miniprogram/pages/home/home.wxml

@@ -1,7 +1,7 @@
 <!--pages/home/home.wxml-->
 <view class="fullscreen-bg">
 
-  <t-navbar title="中医健康管家" t-class-title="nav-title" />
+  <t-navbar title="{{i18n.common.zy}}{{i18n.common.title}}" t-class-title="nav-title" />
 
   <scroll-view 
     class="page-scroll__container" 
@@ -33,7 +33,7 @@
       <!-- 咨询中的状态-->
       <view class="chat-status" wx:if="{{isConsulting}}" bind:tap="goToConsultation">
         <view class="chat-status__dot" wx:if="{{hasNewMessage}}"></view>
-        <text class="chat-status__text">咨询中...</text>
+        <text class="chat-status__text">{{i18n.home.consult}}中...</text>
       </view>
       <!-- 使用 image 标签确保图片清晰度 -->
       <image class="body-bg-image" src="../../assets/bg/pic_body@2x.png" mode="aspectFit" />
@@ -54,9 +54,9 @@
         <t-loading theme="circular" size="48px" color="#2d92fd" />
       </view>
       <view class="healthyAnalyze" bindtap="goHealthAnalyze" wx:elif="{{isShowComplete}}">
-        请完成健康评估
+        请完成{{i18n.home.analysis}}
       </view>
-      <view class="steps-container" wx:else>
+      <view class="steps-container" wx:elif="{{i18n.home.__showRecord__}}">
         <vertical-steps statusList="{{statusList}}" dataset="{{healthReport.data}}" bind:position="onBodyModel" />
         <view class="warn-box" wx:if="{{healthIndex.data.length>0}}">
           <image src="../../assets/bg/icon_warning@3x.png" class="warn-img" />
@@ -72,7 +72,7 @@
             <image src="../../assets/bg/icon_file@3x.png" class="report-img" />
           </view>
           <view class="text-box" wx:if="{{healthReport.data.reportTime}}">
-            <view class="text-one">健康分析报告</view>
+            <view class="text-one">{{i18n.report.title}}</view>
             <view class="text-two">日期:{{healthReport.data.reportTime}}</view>
           </view>
         </view>
@@ -80,7 +80,7 @@
     </view>
 
 
-    <view class="care-container" wx:if="{{displayList.length>0}}">
+    <view class="care-container" wx:if="{{displayList.length>0 && i18n.home.__showDisplay__}}">
       <view class="care-box">
         <view class="care-header">
           <image src="../../assets/icon/icon_plan@3x.png" class="care-icon" />
@@ -132,7 +132,7 @@
 
     <view class="science-list-wrapper" wx:if="{{scienceList.length}}">
       <view class="list-title" bind:tap="toSciencePage">
-        <view class="missionary">健康宣教</view>
+        <view class="missionary">{{i18n.healthTeach.title}}</view>
         <view class="title-box serch">
           <text>查询</text>
           <t-icon name="chevron-right-double"></t-icon>

+ 13 - 0
miniprogram/pages/mine/mine.ts

@@ -1,8 +1,21 @@
+import I18nBehavior from "../../i18n/behavior";
 import { getPatients, getPatientPhone } from "../home/request";
 import { toCertificationPage } from "../home/router";
 import { getOrderList, getRecordCountMethod } from "../home/request";
 Page({
+  behaviors: [I18nBehavior],
   data: {
+    i18n: {
+      consultChat: { title: '记录' },
+      offlineTreatment: { title: '线下' },
+      healthTeach: { title: '分享文章' },
+      health: { title: '档案' },
+      home: {
+        __showRecord__: false,
+        tea: '茶',
+        tonic: '菜谱',
+      }
+    },
     patients: [] as (App.Patient.Model & { isDefault: "Y" | "N" })[],
     patient: null as App.Patient.Model | null,
     patientDescription: "",

+ 6 - 6
miniprogram/pages/mine/mine.wxml

@@ -11,7 +11,7 @@
         </view>
       </view>
 
-      <view class="image-box" catch:tap="toHealthPage">
+      <view wx:if="{{i18n.home.__showRecord__}}" class="image-box" catch:tap="toHealthPage">
         <image src="../../assets/bg/health-file.bg.png" class="health-img" />
       </view>
     </view>
@@ -30,7 +30,7 @@
     </view>
 
     <view class="knowledge-box" style="margin-top:12px">
-      <view class="title">健康宣教</view>
+      <view class="title">{{i18n.healthTeach.title}}</view>
       <view class="content-container">
         <view class="content-box" catch:tap="toHealthEducationPage">
           <view>
@@ -54,14 +54,14 @@
           <view>
             <image src="../../assets/bg/icon_tea@3x.png" class="icon-img" />
           </view>
-          <view class="content-title">茶饮</view>
+          <view class="content-title">{{i18n.home.tea}}</view>
         </view>
 
         <view class="content-box" catch:tap="toDietTonicPage">
           <view>
             <image src="../../assets/bg/icon_diet@3x.png" class="icon-img" />
           </view>
-          <view class="content-title">药膳</view>
+          <view class="content-title">{{i18n.home.tonic}}</view>
         </view>
       </view>
     </view>
@@ -77,14 +77,14 @@
       <view class="item" catch:tap="onConsultationTap">
         <view class="item-box">
           <t-icon name="earphone" />
-          <text style="margin-left:10px">咨询记录</text>
+          <text style="margin-left:10px">{{i18n.consultChat.title}}</text>
         </view>
         <t-icon name="chevron-right" color="#CCCCCC" size="40rpx" />
       </view>
       <view class="item" catch:tap="onTreatmentTap" style="border-bottom:none">
         <view class="item-box">
           <t-icon name="hospital-1" />
-          <text style="margin-left:10px">线下非药物治疗</text>
+          <text style="margin-left:10px">{{i18n.offlineTreatment.title}}</text>
         </view>
         <t-icon name="chevron-right" color="#CCCCCC" size="40rpx" />
       </view>

+ 1 - 0
typings/app/request.d.ts

@@ -12,6 +12,7 @@ interface IRequestConfig<R, T> {
   timeout?: number;
   meta?: { ignoreToken: boolean };
   shareRequest?: boolean;
+  notTransform?: boolean;
   transform?: ({ data, header }: { data: T, header: Record<string, string> }) => R;
 }
 

+ 2 - 1
typings/index.d.ts

@@ -6,6 +6,7 @@ interface IAppOption {
     dictionaries: App.Dictionary[],
     patientId?: string;
     doctorId?: string;
-  }
+  };
+  i18n: Record<string, string> | null;
 }