上传
12
.gitignore
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/node_modules
|
||||
/oh_modules
|
||||
/local.properties
|
||||
/.idea
|
||||
**/build
|
||||
/.hvigor
|
||||
.cxx
|
||||
/.clangd
|
||||
/.clang-format
|
||||
/.clang-tidy
|
||||
**/.test
|
||||
/.appanalyzer
|
||||
10
AppScope/app.json5
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"app": {
|
||||
"bundleName": "com.example.myapplication",
|
||||
"vendor": "example",
|
||||
"versionCode": 1000000,
|
||||
"versionName": "1.0.0",
|
||||
"icon": "$media:layered_image",
|
||||
"label": "$string:app_name"
|
||||
}
|
||||
}
|
||||
8
AppScope/resources/base/element/string.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "app_name",
|
||||
"value": "MyApplication"
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
AppScope/resources/base/media/background.png
Normal file
|
After Width: | Height: | Size: 90 KiB |
BIN
AppScope/resources/base/media/foreground.png
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
7
AppScope/resources/base/media/layered_image.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"layered-image":
|
||||
{
|
||||
"background" : "$media:background",
|
||||
"foreground" : "$media:foreground"
|
||||
}
|
||||
}
|
||||
41
build-profile.json5
Normal file
@@ -0,0 +1,41 @@
|
||||
{
|
||||
"app": {
|
||||
"signingConfigs": [],
|
||||
"products": [
|
||||
{
|
||||
"name": "default",
|
||||
"signingConfig": "default",
|
||||
"compatibleSdkVersion": "5.0.4(16)",
|
||||
"runtimeOS": "HarmonyOS",
|
||||
"buildOption": {
|
||||
"strictMode": {
|
||||
"caseSensitiveCheck": true,
|
||||
"useNormalizedOHMUrl": true
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"buildModeSet": [
|
||||
{
|
||||
"name": "debug",
|
||||
},
|
||||
{
|
||||
"name": "release"
|
||||
}
|
||||
]
|
||||
},
|
||||
"modules": [
|
||||
{
|
||||
"name": "entry",
|
||||
"srcPath": "./entry",
|
||||
"targets": [
|
||||
{
|
||||
"name": "default",
|
||||
"applyToProducts": [
|
||||
"default"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
32
code-linter.json5
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"files": [
|
||||
"**/*.ets"
|
||||
],
|
||||
"ignore": [
|
||||
"**/src/ohosTest/**/*",
|
||||
"**/src/test/**/*",
|
||||
"**/src/mock/**/*",
|
||||
"**/node_modules/**/*",
|
||||
"**/oh_modules/**/*",
|
||||
"**/build/**/*",
|
||||
"**/.preview/**/*"
|
||||
],
|
||||
"ruleSet": [
|
||||
"plugin:@performance/recommended",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
"rules": {
|
||||
"@security/no-unsafe-aes": "error",
|
||||
"@security/no-unsafe-hash": "error",
|
||||
"@security/no-unsafe-mac": "warn",
|
||||
"@security/no-unsafe-dh": "error",
|
||||
"@security/no-unsafe-dsa": "error",
|
||||
"@security/no-unsafe-ecdsa": "error",
|
||||
"@security/no-unsafe-rsa-encrypt": "error",
|
||||
"@security/no-unsafe-rsa-sign": "error",
|
||||
"@security/no-unsafe-rsa-key": "error",
|
||||
"@security/no-unsafe-dsa-key": "error",
|
||||
"@security/no-unsafe-dh-key": "error",
|
||||
"@security/no-unsafe-3des": "error"
|
||||
}
|
||||
}
|
||||
6
entry/.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
/node_modules
|
||||
/oh_modules
|
||||
/.preview
|
||||
/build
|
||||
/.cxx
|
||||
/.test
|
||||
28
entry/build-profile.json5
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"apiType": "stageMode",
|
||||
"buildOption": {
|
||||
},
|
||||
"buildOptionSet": [
|
||||
{
|
||||
"name": "release",
|
||||
"arkOptions": {
|
||||
"obfuscation": {
|
||||
"ruleOptions": {
|
||||
"enable": false,
|
||||
"files": [
|
||||
"./obfuscation-rules.txt"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
],
|
||||
"targets": [
|
||||
{
|
||||
"name": "default"
|
||||
},
|
||||
{
|
||||
"name": "ohosTest",
|
||||
}
|
||||
]
|
||||
}
|
||||
6
entry/hvigorfile.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { hapTasks } from '@ohos/hvigor-ohos-plugin';
|
||||
|
||||
export default {
|
||||
system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
|
||||
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
|
||||
}
|
||||
23
entry/obfuscation-rules.txt
Normal file
@@ -0,0 +1,23 @@
|
||||
# Define project specific obfuscation rules here.
|
||||
# You can include the obfuscation configuration files in the current module's build-profile.json5.
|
||||
#
|
||||
# For more details, see
|
||||
# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
|
||||
|
||||
# Obfuscation options:
|
||||
# -disable-obfuscation: disable all obfuscations
|
||||
# -enable-property-obfuscation: obfuscate the property names
|
||||
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
|
||||
# -compact: remove unnecessary blank spaces and all line feeds
|
||||
# -remove-log: remove all console.* statements
|
||||
# -print-namecache: print the name cache that contains the mapping from the old names to new names
|
||||
# -apply-namecache: reuse the given cache file
|
||||
|
||||
# Keep options:
|
||||
# -keep-property-name: specifies property names that you want to keep
|
||||
# -keep-global-name: specifies names that you want to keep in the global scope
|
||||
|
||||
-enable-property-obfuscation
|
||||
-enable-toplevel-obfuscation
|
||||
-enable-filename-obfuscation
|
||||
-enable-export-obfuscation
|
||||
10
entry/oh-package.json5
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "entry",
|
||||
"version": "1.0.0",
|
||||
"description": "Please describe the basic information.",
|
||||
"main": "",
|
||||
"author": "",
|
||||
"license": "",
|
||||
"dependencies": {}
|
||||
}
|
||||
|
||||
33
entry/src/main/ets/components/TsBar.ets
Normal file
@@ -0,0 +1,33 @@
|
||||
@Component
|
||||
export struct TsBar {
|
||||
@Prop data: number[]
|
||||
@Prop color: string
|
||||
|
||||
build() {
|
||||
Row() {
|
||||
ForEach(this.data, (item: number, index: number) => {
|
||||
Column() {
|
||||
Column() {
|
||||
Text(item.toString())
|
||||
.fontSize(10)
|
||||
.fontColor('#999999')
|
||||
.margin({ bottom: 4 })
|
||||
}
|
||||
.height('100%')
|
||||
.justifyContent(FlexAlign.End)
|
||||
|
||||
Column() {}
|
||||
.width(4)
|
||||
.height(`${(item / Math.max(...this.data)) * 100}%`)
|
||||
.backgroundColor(this.color)
|
||||
.borderRadius(2)
|
||||
}
|
||||
.height('100%')
|
||||
.layoutWeight(1)
|
||||
.margin({ right: index < this.data.length - 1 ? 8 : 0 })
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
}
|
||||
}
|
||||
44
entry/src/main/ets/entryability/EntryAbility.ets
Normal file
@@ -0,0 +1,44 @@
|
||||
import { AbilityConstant, ConfigurationConstant, UIAbility, Want } from '@kit.AbilityKit';
|
||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
import { window } from '@kit.ArkUI';
|
||||
|
||||
const DOMAIN = 0x0000;
|
||||
|
||||
export default class EntryAbility extends UIAbility {
|
||||
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
|
||||
this.context.getApplicationContext().setColorMode(ConfigurationConstant.ColorMode.COLOR_MODE_NOT_SET);
|
||||
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onCreate');
|
||||
}
|
||||
|
||||
onDestroy(): void {
|
||||
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onDestroy');
|
||||
}
|
||||
|
||||
onWindowStageCreate(windowStage: window.WindowStage): void {
|
||||
// Main window is created, set main page for this ability
|
||||
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
|
||||
|
||||
windowStage.loadContent('pages/Index', (err) => {
|
||||
if (err.code) {
|
||||
hilog.error(DOMAIN, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err));
|
||||
return;
|
||||
}
|
||||
hilog.info(DOMAIN, 'testTag', 'Succeeded in loading the content.');
|
||||
});
|
||||
}
|
||||
|
||||
onWindowStageDestroy(): void {
|
||||
// Main window is destroyed, release UI related resources
|
||||
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
|
||||
}
|
||||
|
||||
onForeground(): void {
|
||||
// Ability has brought to foreground
|
||||
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onForeground');
|
||||
}
|
||||
|
||||
onBackground(): void {
|
||||
// Ability has back to background
|
||||
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onBackground');
|
||||
}
|
||||
}
|
||||
16
entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
Normal file
@@ -0,0 +1,16 @@
|
||||
import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||
import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
|
||||
|
||||
const DOMAIN = 0x0000;
|
||||
|
||||
export default class EntryBackupAbility extends BackupExtensionAbility {
|
||||
async onBackup() {
|
||||
hilog.info(DOMAIN, 'testTag', 'onBackup ok');
|
||||
await Promise.resolve();
|
||||
}
|
||||
|
||||
async onRestore(bundleVersion: BundleVersion) {
|
||||
hilog.info(DOMAIN, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
|
||||
await Promise.resolve();
|
||||
}
|
||||
}
|
||||
82
entry/src/main/ets/pages/Index.ets
Normal file
@@ -0,0 +1,82 @@
|
||||
import router from '@ohos.router';
|
||||
import Home from '../pages/home/Home'
|
||||
import My from './my/My'
|
||||
import Message from '../pages/message/Message'
|
||||
import Profile from '../pages/profile/profile'
|
||||
@Entry
|
||||
@Component
|
||||
struct Index {
|
||||
@State currentIndex: number = 0;
|
||||
|
||||
build() {
|
||||
Stack({ alignContent: Alignment.Bottom }) {
|
||||
Column() {
|
||||
Tabs({ barPosition: BarPosition.End }) {
|
||||
TabContent() {
|
||||
Navigation() {
|
||||
Home()
|
||||
}
|
||||
}
|
||||
.tabBar(this.TabBuilder('首页', 0, $r('app.media.ys'), $r('app.media.s')))
|
||||
|
||||
TabContent() {
|
||||
Navigation() {
|
||||
My()
|
||||
}
|
||||
}
|
||||
.tabBar(this.TabBuilder('生活圈', 1, $r('app.media.y'), $r('app.media.yy')))
|
||||
|
||||
TabContent() {
|
||||
Navigation() {
|
||||
Message()
|
||||
}
|
||||
}
|
||||
.tabBar(this.TabBuilder('消息', 2, $r('app.media.x'), $r('app.media.yx')))
|
||||
|
||||
TabContent() {
|
||||
Navigation() {
|
||||
Profile()
|
||||
}
|
||||
}
|
||||
.tabBar(this.TabBuilder('我的', 3, $r('app.media.w'), $r('app.media.wy')))
|
||||
}
|
||||
.barHeight(56)
|
||||
.backgroundColor('#FFFFFF')
|
||||
.barMode(BarMode.Fixed)
|
||||
.onChange((index: number) => {
|
||||
this.currentIndex = index
|
||||
})
|
||||
}
|
||||
|
||||
Button() {
|
||||
Image($r('app.media.j'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
}
|
||||
.width(48)
|
||||
.height(48)
|
||||
.position({x: '50%', y: '92%'})
|
||||
.translate({x: -24})
|
||||
.backgroundColor('#7B48F8')
|
||||
.borderRadius(24)
|
||||
.onClick(() => {
|
||||
router.pushUrl({url:'pages/dong/Dong'})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@Builder TabBuilder(title: string, index: number, normalImg: Resource, selectedImg: Resource) {
|
||||
Column() {
|
||||
Image(this.currentIndex === index ? selectedImg : normalImg)
|
||||
.width(24)
|
||||
.height(24)
|
||||
Text(title)
|
||||
.fontSize(12)
|
||||
.fontColor(this.currentIndex === index ? '#7B48F8' : '#999999')
|
||||
.margin({ top: 4 })
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.justifyContent(FlexAlign.Center)
|
||||
}
|
||||
}
|
||||
20
entry/src/main/ets/pages/activity/Activity.ets
Normal file
@@ -0,0 +1,20 @@
|
||||
import router from '@ohos.router'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Activity {
|
||||
build() {
|
||||
Column() {
|
||||
Text('老年活动页面')
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ top: 40 })
|
||||
Button('返回')
|
||||
.margin({ top: 20 })
|
||||
.onClick(() => router.back())
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
}
|
||||
}
|
||||
20
entry/src/main/ets/pages/archive/Archive.ets
Normal file
@@ -0,0 +1,20 @@
|
||||
import router from '@ohos.router'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Archive {
|
||||
build() {
|
||||
Column() {
|
||||
Text('健康档案页面')
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ top: 40 })
|
||||
Button('返回')
|
||||
.margin({ top: 20 })
|
||||
.onClick(() => router.back())
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
}
|
||||
}
|
||||
20
entry/src/main/ets/pages/device/Device.ets
Normal file
@@ -0,0 +1,20 @@
|
||||
import router from '@ohos.router'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Device {
|
||||
build() {
|
||||
Column() {
|
||||
Text('设备中心页面')
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ top: 40 })
|
||||
Button('返回')
|
||||
.margin({ top: 20 })
|
||||
.onClick(() => router.back())
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
}
|
||||
}
|
||||
20
entry/src/main/ets/pages/diet/Diet.ets
Normal file
@@ -0,0 +1,20 @@
|
||||
import router from '@ohos.router'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Diet {
|
||||
build() {
|
||||
Column() {
|
||||
Text('健康膳食页面')
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ top: 40 })
|
||||
Button('返回')
|
||||
.margin({ top: 20 })
|
||||
.onClick(() => router.back())
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
}
|
||||
}
|
||||
20
entry/src/main/ets/pages/disease/Disease.ets
Normal file
@@ -0,0 +1,20 @@
|
||||
import router from '@ohos.router'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Disease {
|
||||
build() {
|
||||
Column() {
|
||||
Text('疾病宝典页面')
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ top: 40 })
|
||||
Button('返回')
|
||||
.margin({ top: 20 })
|
||||
.onClick(() => router.back())
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
}
|
||||
}
|
||||
52
entry/src/main/ets/pages/dong/Dong.ets
Normal file
@@ -0,0 +1,52 @@
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct AttrAnimationExample {
|
||||
@State widthSize: number = 250
|
||||
@State heightSize: number = 100
|
||||
@State rotateAngle: number = 0
|
||||
@State flag: boolean = true
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Button('change size')
|
||||
.onClick(() => {
|
||||
if (this.flag) {
|
||||
this.widthSize = 150
|
||||
this.heightSize = 60
|
||||
} else {
|
||||
this.widthSize = 250
|
||||
this.heightSize = 100
|
||||
}
|
||||
this.flag = !this.flag
|
||||
})
|
||||
.margin(30)
|
||||
.width(this.widthSize)
|
||||
.height(this.heightSize)
|
||||
.animation({
|
||||
duration: 2000,
|
||||
curve: Curve.EaseOut,
|
||||
iterations: 3,
|
||||
playMode: PlayMode.Normal
|
||||
})
|
||||
Button('change rotate angle')
|
||||
.onClick(() => {
|
||||
this.rotateAngle = 90
|
||||
})
|
||||
.margin(50)
|
||||
.rotate({ angle: this.rotateAngle })
|
||||
.animation({
|
||||
duration: 1200,
|
||||
curve: Curve.Friction,
|
||||
delay: 500,
|
||||
// iterations: -1, // 设置-1表示动画无限循环
|
||||
playMode: PlayMode.Alternate,
|
||||
expectedFrameRateRange: {
|
||||
min: 20,
|
||||
max: 120,
|
||||
expected: 90,
|
||||
}
|
||||
})
|
||||
}.width('100%').margin({ top: 20 })
|
||||
}
|
||||
}
|
||||
20
entry/src/main/ets/pages/elderly/Elderly.ets
Normal file
@@ -0,0 +1,20 @@
|
||||
import router from '@ohos.router'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Elderly {
|
||||
build() {
|
||||
Column() {
|
||||
Text('养老机构页面')
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ top: 40 })
|
||||
Button('返回')
|
||||
.margin({ top: 20 })
|
||||
.onClick(() => router.back())
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
}
|
||||
}
|
||||
42
entry/src/main/ets/pages/examination/Examination.ets
Normal file
@@ -0,0 +1,42 @@
|
||||
import router from '@ohos.router';
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Examination {
|
||||
build() {
|
||||
Column() {
|
||||
// 顶部导航
|
||||
Row() {
|
||||
Image($r('app.media.back'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
.onClick(() => {
|
||||
router.back()
|
||||
})
|
||||
Text('上门体检')
|
||||
.fontSize(18)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ left: 16 })
|
||||
}
|
||||
.width('100%')
|
||||
.height(56)
|
||||
.padding({ left: 16, right: 16 })
|
||||
.backgroundColor(Color.White)
|
||||
|
||||
// 内容区域
|
||||
Column() {
|
||||
Text('专业上门体检服务')
|
||||
.fontSize(24)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ top: 20, bottom: 16 })
|
||||
|
||||
Text('专业医师团队提供便捷体检服务')
|
||||
.fontSize(16)
|
||||
.fontColor('#666666')
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
}
|
||||
}
|
||||
}
|
||||
451
entry/src/main/ets/pages/health/Health.ets
Normal file
@@ -0,0 +1,451 @@
|
||||
import { TsBar } from '../../components/TsBar'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Health {
|
||||
@State age: number = 65
|
||||
@State userHeight: number = 172
|
||||
@State weight: number = 55.5
|
||||
@State steps: number = 6308
|
||||
@State sleepHours: number = 7
|
||||
@State sleepMinutes: number = 25
|
||||
@State bloodSugar: number = 10.2
|
||||
@State bloodPressureHigh: number = 138
|
||||
@State bloodPressureLow: number = 79
|
||||
@State bloodOxygen: number = 98
|
||||
@State heartRate: number = 138
|
||||
@State pressure: number = 48
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
// 顶部导航栏
|
||||
Row() {
|
||||
Text('健康数据')
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
}
|
||||
.width('100%')
|
||||
.height(56)
|
||||
.padding({ left: 16, right: 16 })
|
||||
|
||||
// 主要内容区域
|
||||
Scroll() {
|
||||
Column() {
|
||||
// 用户信息卡片
|
||||
Row() {
|
||||
Image($r('app.media.background'))
|
||||
.width(60)
|
||||
.height(60)
|
||||
.borderRadius(30)
|
||||
|
||||
Column() {
|
||||
Text('王强')
|
||||
.fontSize(18)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
|
||||
Row() {
|
||||
Text('血压偏高')
|
||||
.fontSize(12)
|
||||
.backgroundColor('#FFE4E4')
|
||||
.padding({ left: 8, right: 8, top: 4, bottom: 4 })
|
||||
.borderRadius(4)
|
||||
.margin({ right: 8 })
|
||||
|
||||
Text('血糖偏高')
|
||||
.fontSize(12)
|
||||
.backgroundColor('#FFE4E4')
|
||||
.padding({ left: 8, right: 8, top: 4, bottom: 4 })
|
||||
.borderRadius(4)
|
||||
}
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.margin({ left: 16 })
|
||||
}
|
||||
.width('100%')
|
||||
.padding(16)
|
||||
.backgroundColor(Color.White)
|
||||
.borderRadius(12)
|
||||
|
||||
// 基本信息
|
||||
Row() {
|
||||
Column() {
|
||||
Text('年龄')
|
||||
.fontSize(14)
|
||||
.opacity(0.6)
|
||||
Text(this.age.toString())
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
}
|
||||
.layoutWeight(1)
|
||||
|
||||
Column() {
|
||||
Text('身高')
|
||||
.fontSize(14)
|
||||
.opacity(0.6)
|
||||
Text(this.userHeight.toString() + 'cm')
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
}
|
||||
.layoutWeight(1)
|
||||
|
||||
Column() {
|
||||
Text('体重')
|
||||
.fontSize(14)
|
||||
.opacity(0.6)
|
||||
Text(this.weight.toString() + 'kg')
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
}
|
||||
.layoutWeight(1)
|
||||
}
|
||||
.width('100%')
|
||||
.padding(16)
|
||||
.backgroundColor(Color.White)
|
||||
.margin({ top: 12 })
|
||||
.borderRadius(12)
|
||||
|
||||
// 已绑定设备
|
||||
Column() {
|
||||
Text('已绑定3个设备')
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
|
||||
Row() {
|
||||
ForEach([1, 2, 3], () => {
|
||||
Image($r('app.media.shoubioa'))
|
||||
.width(60)
|
||||
.height(60)
|
||||
.margin({ right: 16 })
|
||||
})
|
||||
|
||||
Image($r('app.media.jiahao'))
|
||||
.width(60)
|
||||
.height(60)
|
||||
}
|
||||
.margin({ top: 16 })
|
||||
}
|
||||
.width('100%')
|
||||
.padding(16)
|
||||
.backgroundColor(Color.White)
|
||||
.margin({ top: 12 })
|
||||
.borderRadius(12)
|
||||
|
||||
// 健康指标卡片
|
||||
Grid() {
|
||||
// 体重卡片
|
||||
GridItem() {
|
||||
Column() {
|
||||
Row() {
|
||||
Image($r('app.media.tizhong'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
Text('体重')
|
||||
.fontSize(16)
|
||||
.margin({ left: 8 })
|
||||
}
|
||||
.width('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
.padding(12)
|
||||
.borderRadius(8)
|
||||
.shadow({ radius: 4, color: '#0000001A', offsetX: 0, offsetY: 2 })
|
||||
|
||||
Text(this.weight.toString())
|
||||
.fontSize(24)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ top: 16, bottom: 16 })
|
||||
|
||||
// 体重趋势图
|
||||
TsBar({
|
||||
data: [54, 55, 55.5, 55, 55.5],
|
||||
color: '#4CAF50'
|
||||
})
|
||||
.width('100%')
|
||||
.height(60)
|
||||
}
|
||||
.width('100%')
|
||||
.padding(16)
|
||||
.backgroundColor(Color.White)
|
||||
.borderRadius(12)
|
||||
}
|
||||
|
||||
// 步数卡片
|
||||
GridItem() {
|
||||
Column() {
|
||||
Row() {
|
||||
Image($r('app.media.bushu'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
Text('步数')
|
||||
.fontSize(16)
|
||||
.margin({ left: 8 })
|
||||
}
|
||||
.width('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
.padding(12)
|
||||
.borderRadius(8)
|
||||
.shadow({ radius: 4, color: '#0000001A', offsetX: 0, offsetY: 2 })
|
||||
|
||||
Text(this.steps.toString())
|
||||
.fontSize(24)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ top: 16, bottom: 16 })
|
||||
|
||||
// 步数趋势图
|
||||
TsBar({
|
||||
data: [5000, 6000, 6308, 5500, 6000],
|
||||
color: '#FF9800'
|
||||
})
|
||||
.width('100%')
|
||||
.height(60)
|
||||
}
|
||||
.width('100%')
|
||||
.padding(16)
|
||||
.backgroundColor(Color.White)
|
||||
.borderRadius(12)
|
||||
}
|
||||
|
||||
// 睡眠卡片
|
||||
GridItem() {
|
||||
Column() {
|
||||
Row() {
|
||||
Image($r('app.media.shuimain'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
Text('睡眠')
|
||||
.fontSize(16)
|
||||
.margin({ left: 8 })
|
||||
}
|
||||
.width('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
.padding(12)
|
||||
.borderRadius(8)
|
||||
.shadow({ radius: 4, color: '#0000001A', offsetX: 0, offsetY: 2 })
|
||||
|
||||
Row() {
|
||||
Text(this.sleepHours.toString())
|
||||
.fontSize(24)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
Text('小时')
|
||||
.fontSize(12)
|
||||
.opacity(0.6)
|
||||
.margin({ left: 4, right: 8 })
|
||||
Text(this.sleepMinutes.toString())
|
||||
.fontSize(24)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
Text('分钟')
|
||||
.fontSize(12)
|
||||
.opacity(0.6)
|
||||
.margin({ left: 4 })
|
||||
}
|
||||
.margin({ top: 16, bottom: 16 })
|
||||
|
||||
// 睡眠趋势图
|
||||
TsBar({
|
||||
data: [7, 6.5, 7.5, 7, 7.5],
|
||||
color: '#2196F3'
|
||||
})
|
||||
.width('100%')
|
||||
.height(60)
|
||||
}
|
||||
.width('100%')
|
||||
.padding(16)
|
||||
.backgroundColor(Color.White)
|
||||
.borderRadius(12)
|
||||
}
|
||||
|
||||
// 血糖卡片
|
||||
GridItem() {
|
||||
Column() {
|
||||
Row() {
|
||||
Image($r('app.media.xuetang'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
Text('血糖')
|
||||
.fontSize(16)
|
||||
.margin({ left: 8 })
|
||||
}
|
||||
.width('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
.padding(12)
|
||||
.borderRadius(8)
|
||||
.shadow({ radius: 4, color: '#0000001A', offsetX: 0, offsetY: 2 })
|
||||
|
||||
Text(this.bloodSugar.toString() + ' mmol/L')
|
||||
.fontSize(24)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ top: 16, bottom: 16 })
|
||||
|
||||
// 血糖趋势图
|
||||
TsBar({
|
||||
data: [9.8, 10.0, 10.2, 9.9, 10.1],
|
||||
color: '#F44336'
|
||||
})
|
||||
.width('100%')
|
||||
.height(60)
|
||||
}
|
||||
.width('100%')
|
||||
.padding(16)
|
||||
.backgroundColor(Color.White)
|
||||
.borderRadius(12)
|
||||
}
|
||||
|
||||
// 血压卡片
|
||||
GridItem() {
|
||||
Column() {
|
||||
Row() {
|
||||
Image($r('app.media.xueya'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
Text('血压')
|
||||
.fontSize(16)
|
||||
.margin({ left: 8 })
|
||||
}
|
||||
.width('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
.padding(12)
|
||||
.borderRadius(8)
|
||||
.shadow({ radius: 4, color: '#0000001A', offsetX: 0, offsetY: 2 })
|
||||
|
||||
Row() {
|
||||
Text(this.bloodPressureHigh.toString())
|
||||
.fontSize(24)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
Text('/')
|
||||
.fontSize(24)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ left: 8, right: 8 })
|
||||
Text(this.bloodPressureLow.toString())
|
||||
.fontSize(24)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
}
|
||||
.margin({ top: 16, bottom: 16 })
|
||||
|
||||
// 血压趋势图
|
||||
TsBar({
|
||||
data: [135, 138, 136, 137, 138],
|
||||
color: '#E91E63'
|
||||
})
|
||||
.width('100%')
|
||||
.height(60)
|
||||
}
|
||||
.width('100%')
|
||||
.padding(16)
|
||||
.backgroundColor(Color.White)
|
||||
.borderRadius(12)
|
||||
}
|
||||
|
||||
// 血氧饱和度卡片
|
||||
GridItem() {
|
||||
Column() {
|
||||
Row() {
|
||||
Image($r('app.media.baohedu'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
Text('血氧饱和度')
|
||||
.fontSize(16)
|
||||
.margin({ left: 8 })
|
||||
}
|
||||
.width('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
.padding(12)
|
||||
.borderRadius(8)
|
||||
.shadow({ radius: 4, color: '#0000001A', offsetX: 0, offsetY: 2 })
|
||||
|
||||
Text(this.bloodOxygen.toString() + '%')
|
||||
.fontSize(24)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ top: 16, bottom: 16 })
|
||||
|
||||
// 血氧趋势图
|
||||
TsBar({
|
||||
data: [97, 98, 98, 97, 98],
|
||||
color: '#9C27B0'
|
||||
})
|
||||
.width('100%')
|
||||
.height(60)
|
||||
}
|
||||
.width('100%')
|
||||
.padding(16)
|
||||
.backgroundColor(Color.White)
|
||||
.borderRadius(12)
|
||||
}
|
||||
|
||||
// 心率卡片
|
||||
GridItem() {
|
||||
Column() {
|
||||
Row() {
|
||||
Image($r('app.media.xinlv'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
Text('心率')
|
||||
.fontSize(16)
|
||||
.margin({ left: 8 })
|
||||
}
|
||||
.width('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
.padding(12)
|
||||
.borderRadius(8)
|
||||
.shadow({ radius: 4, color: '#0000001A', offsetX: 0, offsetY: 2 })
|
||||
|
||||
Text(this.heartRate.toString() + ' bpm')
|
||||
.fontSize(24)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ top: 16, bottom: 16 })
|
||||
|
||||
// 心率趋势图
|
||||
TsBar({
|
||||
data: [135, 138, 136, 137, 138],
|
||||
color: '#FF5722'
|
||||
})
|
||||
.width('100%')
|
||||
.height(60)
|
||||
}
|
||||
.width('100%')
|
||||
.padding(16)
|
||||
.backgroundColor(Color.White)
|
||||
.borderRadius(12)
|
||||
}
|
||||
|
||||
// 压力卡片
|
||||
GridItem() {
|
||||
Column() { Row() {
|
||||
Image($r('app.media.yali'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
Text('压力')
|
||||
.fontSize(16)
|
||||
.margin({ left: 8 })
|
||||
}
|
||||
|
||||
Text(this.pressure.toString())
|
||||
.fontSize(24)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ top: 16, bottom: 16 })
|
||||
|
||||
// 压力趋势图
|
||||
TsBar({
|
||||
data: [45, 48, 47, 46, 48],
|
||||
color: '#795548'
|
||||
})
|
||||
.width('100%')
|
||||
.height(60)
|
||||
}
|
||||
.width('100%')
|
||||
.padding(16)
|
||||
.backgroundColor(Color.White)
|
||||
.borderRadius(12)
|
||||
}
|
||||
}
|
||||
.columnsTemplate('1fr 1fr')
|
||||
.columnsGap(12)
|
||||
.rowsGap(12)
|
||||
.margin({ top: 12 })
|
||||
}
|
||||
.padding(16)
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
}
|
||||
}
|
||||
523
entry/src/main/ets/pages/home/Home.ets
Normal file
@@ -0,0 +1,523 @@
|
||||
import http from '@ohos.net.http';
|
||||
import router from '@ohos.router'
|
||||
import preferences from '@ohos.data.preferences';
|
||||
|
||||
interface Alll {
|
||||
title:string
|
||||
icon:string
|
||||
}
|
||||
|
||||
interface NewsData {
|
||||
title: string
|
||||
content: string
|
||||
imageUrls: string[]
|
||||
likeCount: number
|
||||
starCount: number
|
||||
commentCount: number
|
||||
}
|
||||
|
||||
interface ResponseData {
|
||||
code: number
|
||||
msg: string
|
||||
data: NewsData[]
|
||||
}
|
||||
|
||||
interface FunctionNavItem extends Alll {
|
||||
url: string
|
||||
}
|
||||
|
||||
@Component
|
||||
export default struct Home {
|
||||
@State isLoading: boolean = true
|
||||
@State newsData: NewsData[] = []
|
||||
@StorageLink('currentCity') currentCity: string = '上海'
|
||||
|
||||
aboutToAppear() {
|
||||
preferences.getPreferences(globalThis.getContext(), 'city_prefs').then(prefs => {
|
||||
prefs.get('currentCity', '上海').then(city => {
|
||||
const cityStr = String(city);
|
||||
AppStorage.SetOrCreate('currentCity', cityStr);
|
||||
this.currentCity = cityStr;
|
||||
});
|
||||
});
|
||||
this.fetchNewsData();
|
||||
}
|
||||
|
||||
fetchNewsData() {
|
||||
this.isLoading = true
|
||||
let httpRequest = http.createHttp()
|
||||
httpRequest.request(
|
||||
"https://mock.presstime.cn/mock/6819c85b5ca065b2e0d4510b/api/shouye",
|
||||
{
|
||||
method: http.RequestMethod.GET,
|
||||
header: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}
|
||||
).then((resp: http.HttpResponse) => {
|
||||
if (resp.responseCode === 200) {
|
||||
const responseData = JSON.parse(resp.result.toString()) as ResponseData
|
||||
console.info('接口返回数据:', JSON.stringify(responseData))
|
||||
if (responseData.code === 400 && Array.isArray(responseData.data)) {
|
||||
console.error('数据格式错误:', responseData)
|
||||
} else {
|
||||
this.newsData = responseData.data
|
||||
console.info('设置后的数据:', JSON.stringify(this.newsData))
|
||||
console.info('数据长度:', this.newsData.length)
|
||||
}
|
||||
this.isLoading = false
|
||||
}
|
||||
}).catch((err: Error) => {
|
||||
console.error('获取数据失败:', err.message)
|
||||
this.isLoading = false
|
||||
}).finally(() => {
|
||||
httpRequest.destroy()
|
||||
})
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
if (this.isLoading) {
|
||||
LoadingProgress()
|
||||
.width(50)
|
||||
.height(50)
|
||||
.margin({ top: 100 })
|
||||
}
|
||||
List({ space: 12 }) {
|
||||
ListItem() {
|
||||
// 顶部区域
|
||||
Row() {
|
||||
Row() {
|
||||
Image($r('app.media.ding'))
|
||||
.width(20)
|
||||
.height(20)
|
||||
Text(this.currentCity)
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ left: 4 })
|
||||
Image($r('app.media.xia'))
|
||||
.width(16)
|
||||
.height(16)
|
||||
.margin({ left: 2 })
|
||||
.onClick(() => {
|
||||
router.pushUrl({ url: 'pages/region/Region' })
|
||||
})
|
||||
}
|
||||
|
||||
Image($r('app.media.er'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
}
|
||||
.width('100%')
|
||||
.justifyContent(FlexAlign.SpaceBetween)
|
||||
.padding({ left: 16, right: 16, top: 12 })
|
||||
}
|
||||
|
||||
ListItem() {
|
||||
// 搜索框
|
||||
Row() {
|
||||
Image($r('app.media.sou'))
|
||||
.width(20)
|
||||
.height(20)
|
||||
Text('搜索')
|
||||
.fontSize(14)
|
||||
.fontColor('#999999')
|
||||
.margin({ left: 8 })
|
||||
}
|
||||
.width('92%')
|
||||
.height(40)
|
||||
.backgroundColor('#F5F5F5')
|
||||
.borderRadius(20)
|
||||
.padding({ left: 16 })
|
||||
.margin({ top: 12 })
|
||||
}
|
||||
|
||||
ListItem() {
|
||||
// 快捷标签
|
||||
Row() {
|
||||
Text('高血压')
|
||||
.fontSize(14)
|
||||
.padding({
|
||||
left: 12,
|
||||
right: 12,
|
||||
top: 6,
|
||||
bottom: 6
|
||||
})
|
||||
.backgroundColor('#F0F0F0')
|
||||
.borderRadius(16)
|
||||
Text('冠心病')
|
||||
.fontSize(14)
|
||||
.padding({
|
||||
left: 12,
|
||||
right: 12,
|
||||
top: 6,
|
||||
bottom: 6
|
||||
})
|
||||
.backgroundColor('#F0F0F0')
|
||||
.borderRadius(16)
|
||||
.margin({ left: 8 })
|
||||
Text('如何控制血糖')
|
||||
.fontSize(14)
|
||||
.padding({
|
||||
left: 12,
|
||||
right: 12,
|
||||
top: 6,
|
||||
bottom: 6
|
||||
})
|
||||
.backgroundColor('#F0F0F0')
|
||||
.borderRadius(16)
|
||||
.margin({ left: 8 })
|
||||
}
|
||||
.width('100%')
|
||||
.margin({ top: 12 })
|
||||
.padding({ left: 16, right: 16 })
|
||||
.justifyContent(FlexAlign.Start)
|
||||
}
|
||||
|
||||
ListItem() {
|
||||
// 服务卡片
|
||||
Grid() {
|
||||
GridItem() {
|
||||
Column() {
|
||||
Image($r('app.media.zhineg'))
|
||||
.width(40)
|
||||
.height(40)
|
||||
.margin({ left: 12 })
|
||||
Text('家政护理')
|
||||
.fontSize(16)
|
||||
.margin({ top: 8 })
|
||||
Text('快速上门服务')
|
||||
.fontSize(12)
|
||||
.fontColor('#999999')
|
||||
.margin({ top: 4 })
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.padding(16)
|
||||
.onClick(() => {
|
||||
router.pushUrl({ url: 'pages/nursing/Nursing' })
|
||||
})
|
||||
}
|
||||
.backgroundColor(Color.White)
|
||||
.borderRadius(12)
|
||||
|
||||
GridItem() {
|
||||
Column() {
|
||||
Image($r('app.media.kang'))
|
||||
.width(40)
|
||||
.height(40)
|
||||
.margin({ left: 12 })
|
||||
Text('康复理疗')
|
||||
.fontSize(16)
|
||||
.margin({ top: 8 })
|
||||
Text('全套护理方案')
|
||||
.fontSize(12)
|
||||
.fontColor('#999999')
|
||||
.margin({ top: 4 })
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.padding(16)
|
||||
.onClick(() => {
|
||||
router.pushUrl({ url: 'pages/rehabilitation/Rehabilitation' })
|
||||
})
|
||||
}
|
||||
.backgroundColor(Color.White)
|
||||
.borderRadius(12)
|
||||
|
||||
GridItem() {
|
||||
Column() {
|
||||
Image($r('app.media.fuwu'))
|
||||
.width(40)
|
||||
.height(40)
|
||||
.margin({ left: 12 })
|
||||
Text('上门体检')
|
||||
.fontSize(16)
|
||||
.margin({ top: 8 })
|
||||
Text('专业医师团队')
|
||||
.fontSize(12)
|
||||
.fontColor('#999999')
|
||||
.margin({ top: 4 })
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.padding(16)
|
||||
.onClick(() => {
|
||||
router.pushUrl({ url: 'pages/examination/Examination' })
|
||||
})
|
||||
}
|
||||
.backgroundColor(Color.White)
|
||||
.borderRadius(12)
|
||||
}
|
||||
.width('92%')
|
||||
.height(120)
|
||||
.columnsTemplate('1fr 1fr 1fr')
|
||||
.rowsTemplate('1fr')
|
||||
.columnsGap(8)
|
||||
.margin({ top: 16, left: 16, right: 16 })
|
||||
}
|
||||
|
||||
ListItem() {
|
||||
// 功能区域
|
||||
Column() {
|
||||
Grid() {
|
||||
ForEach([
|
||||
{ icon: 'shuju', title: '健康数据', url: 'pages/health/Health' },
|
||||
{ icon: 'she', title: '设备中心', url: 'pages/device/Device' },
|
||||
{ icon: 'yao', title: '用药信息', url: 'pages/medicine/Medicine' },
|
||||
{ icon: 'jian', title: '健康膳食', url: 'pages/diet/Diet' },
|
||||
{ icon: 'disease', title: '疾病宝典', url: 'pages/disease/Disease' },
|
||||
{ icon: 'archive', title: '健康档案', url: 'pages/archive/Archive' },
|
||||
{ icon: 'activity', title: '老年活动', url: 'pages/activity/Activity' },
|
||||
{ icon: 'news', title: '健康资讯', url: 'pages/news/News' },
|
||||
{ icon: 'elderly', title: '养老机构', url: 'pages/elderly/Elderly' },
|
||||
{ icon: 'lecture', title: '健康讲座', url: 'pages/lecture/Lecture' }
|
||||
], (item: FunctionNavItem) => {
|
||||
GridItem() {
|
||||
Column() {
|
||||
Image($r(`app.media.${item.icon}`))
|
||||
.width(24)
|
||||
.height(24)
|
||||
Text(item.title)
|
||||
.fontSize(12)
|
||||
.margin({ top: 4 })
|
||||
}
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
.onClick(() => {
|
||||
router.pushUrl({ url: item.url })
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
.width('92%')
|
||||
.height(200)
|
||||
.columnsTemplate('1fr 1fr 1fr 1fr')
|
||||
.rowsTemplate('1fr 1fr 1fr')
|
||||
.columnsGap(8)
|
||||
.rowsGap(12)
|
||||
.backgroundColor(Color.White)
|
||||
.padding(12)
|
||||
.borderRadius(12)
|
||||
}
|
||||
.margin({ top: 12 })
|
||||
.width('100%')
|
||||
}
|
||||
|
||||
ListItem() {
|
||||
// 健康提醒
|
||||
Row() {
|
||||
Row() {
|
||||
Text('健康')
|
||||
.fontSize(16)
|
||||
.fontColor('#00CC66')
|
||||
Text('提醒')
|
||||
.fontSize(16)
|
||||
.fontColor('#00CC66')
|
||||
}
|
||||
|
||||
Row() {
|
||||
Image($r('app.media.lingdan'))
|
||||
.width(16)
|
||||
.height(20)
|
||||
Text('用药提醒')
|
||||
.fontSize(14)
|
||||
.margin({ left: 4 })
|
||||
Text('服药时间:06:30 卡托普利 \n 2片')
|
||||
.fontSize(14)
|
||||
.margin({ left: 8 })
|
||||
}
|
||||
.margin({ left: 12 })
|
||||
}
|
||||
.width('92%')
|
||||
.height(60)
|
||||
.backgroundColor(Color.White)
|
||||
.padding({
|
||||
left: 16,
|
||||
right: 16,
|
||||
top: 12,
|
||||
bottom: 12
|
||||
})
|
||||
.margin({ top: 12,left:20 })
|
||||
.borderRadius(12)
|
||||
}
|
||||
|
||||
ListItem() {
|
||||
// 疾病宝典
|
||||
Column() {
|
||||
Row() {
|
||||
Text('疾病宝典')
|
||||
.fontSize(16)
|
||||
Row() {
|
||||
Text('更多')
|
||||
.fontSize(14)
|
||||
.fontColor('#999999')
|
||||
Image($r('app.media.xiangyou'))
|
||||
.width(16)
|
||||
.height(16)
|
||||
.margin({ left: 4 })
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.justifyContent(FlexAlign.SpaceBetween)
|
||||
.margin({ bottom: 12 })
|
||||
|
||||
Flex({ wrap: FlexWrap.Wrap }) {
|
||||
Text('白内障')
|
||||
.fontSize(14)
|
||||
.backgroundColor('#F5F5F5')
|
||||
.padding({
|
||||
left: 16,
|
||||
right: 16,
|
||||
top: 8,
|
||||
bottom: 8
|
||||
})
|
||||
.borderRadius(20)
|
||||
.margin({ right: 8, bottom: 8 })
|
||||
Text('高血压')
|
||||
.fontSize(14)
|
||||
.backgroundColor('#F5F5F5')
|
||||
.padding({
|
||||
left: 16,
|
||||
right: 16,
|
||||
top: 8,
|
||||
bottom: 8
|
||||
})
|
||||
.borderRadius(20)
|
||||
.margin({ right: 8, bottom: 8 })
|
||||
Text('中风')
|
||||
.fontSize(14)
|
||||
.backgroundColor('#F5F5F5')
|
||||
.padding({
|
||||
left: 16,
|
||||
right: 16,
|
||||
top: 8,
|
||||
bottom: 8
|
||||
})
|
||||
.borderRadius(20)
|
||||
.margin({ right: 8, bottom: 8 })
|
||||
Text('阿尔茨海默症')
|
||||
.fontSize(14)
|
||||
.backgroundColor('#F5F5F5')
|
||||
.padding({
|
||||
left: 16,
|
||||
right: 16,
|
||||
top: 8,
|
||||
bottom: 8
|
||||
})
|
||||
.borderRadius(20)
|
||||
.margin({ right: 8, bottom: 8 })
|
||||
Text('糖尿病')
|
||||
.fontSize(14)
|
||||
.backgroundColor('#F5F5F5')
|
||||
.padding({
|
||||
left: 16,
|
||||
right: 16,
|
||||
top: 8,
|
||||
bottom: 8
|
||||
})
|
||||
.borderRadius(20)
|
||||
.margin({ right: 8, bottom: 8 })
|
||||
Text('心率不齐')
|
||||
.fontSize(14)
|
||||
.backgroundColor('#F5F5F5')
|
||||
.padding({
|
||||
left: 16,
|
||||
right: 16,
|
||||
top: 8,
|
||||
bottom: 8
|
||||
})
|
||||
.borderRadius(20)
|
||||
.margin({ right: 8, bottom: 8 })
|
||||
}
|
||||
}
|
||||
.width('92%')
|
||||
.padding(16)
|
||||
.backgroundColor(Color.White)
|
||||
.margin({ top: 12 ,left:15})
|
||||
.borderRadius(12)
|
||||
}
|
||||
|
||||
ListItem() {
|
||||
Column() {
|
||||
ForEach(this.newsData, (item: NewsData) => {
|
||||
Column() {
|
||||
Text(item.title)
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ bottom: 8 })
|
||||
|
||||
Text(item.content)
|
||||
.fontSize(14)
|
||||
.fontColor('#666666')
|
||||
.margin({ bottom: 12 })
|
||||
|
||||
Row() {
|
||||
ForEach(item.imageUrls, (url: string) => {
|
||||
Image(url)
|
||||
.width(90)
|
||||
.height(80)
|
||||
.borderRadius(8)
|
||||
.margin({ right: 8 })
|
||||
.objectFit(ImageFit.Cover)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Row() {
|
||||
Image($r('app.media.feng'))
|
||||
.width(20)
|
||||
.height(20)
|
||||
|
||||
Row() {
|
||||
Image($r('app.media.xin'))
|
||||
.width(20)
|
||||
.height(20)
|
||||
.margin({ left: 16 })
|
||||
Text(item.likeCount.toString())
|
||||
.fontSize(14)
|
||||
.fontColor('#999999')
|
||||
.margin({ left: 4 })
|
||||
}
|
||||
|
||||
Row() {
|
||||
Image($r('app.media.shou'))
|
||||
.width(20)
|
||||
.height(20)
|
||||
.margin({ left: 16 })
|
||||
Text(item.starCount.toString())
|
||||
.fontSize(14)
|
||||
.fontColor('#999999')
|
||||
.margin({ left: 4 })
|
||||
}
|
||||
|
||||
Row() {
|
||||
Image($r('app.media.xinxi'))
|
||||
.width(20)
|
||||
.height(20)
|
||||
.margin({ left: 16 })
|
||||
Text(item.commentCount.toString())
|
||||
.fontSize(14)
|
||||
.fontColor('#999999')
|
||||
.margin({ left: 4 })
|
||||
}
|
||||
}
|
||||
.margin({ top: 12 })
|
||||
}
|
||||
.width('100%')
|
||||
.padding(16)
|
||||
.backgroundColor(Color.White)
|
||||
.borderRadius(12)
|
||||
.margin({ bottom: 12,left:20 })
|
||||
})
|
||||
}
|
||||
.width('92%')
|
||||
.margin({ top: 12 })
|
||||
}
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.scrollBar(BarState.Auto)
|
||||
.linearGradient({
|
||||
angle: 180,
|
||||
colors: [['#F0F8FF', 0.0], ['#E6F3FF', 1.0]]
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
20
entry/src/main/ets/pages/lecture/Lecture.ets
Normal file
@@ -0,0 +1,20 @@
|
||||
import router from '@ohos.router'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Lecture {
|
||||
build() {
|
||||
Column() {
|
||||
Text('健康讲座页面')
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ top: 40 })
|
||||
Button('返回')
|
||||
.margin({ top: 20 })
|
||||
.onClick(() => router.back())
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
}
|
||||
}
|
||||
20
entry/src/main/ets/pages/medicine/Medicine.ets
Normal file
@@ -0,0 +1,20 @@
|
||||
import router from '@ohos.router'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Medicine {
|
||||
build() {
|
||||
Column() {
|
||||
Text('用药信息页面')
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ top: 40 })
|
||||
Button('返回')
|
||||
.margin({ top: 20 })
|
||||
.onClick(() => router.back())
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
}
|
||||
}
|
||||
13
entry/src/main/ets/pages/message/Message.ets
Normal file
@@ -0,0 +1,13 @@
|
||||
@Component
|
||||
export default struct Message {
|
||||
build() {
|
||||
Column() {
|
||||
Text('消息')
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#F1F3F5')
|
||||
}
|
||||
}
|
||||
13
entry/src/main/ets/pages/my/My.ets
Normal file
@@ -0,0 +1,13 @@
|
||||
@Component
|
||||
export default struct My {
|
||||
build() {
|
||||
Column() {
|
||||
Text('生活圈d的')
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#F1F3F5')
|
||||
}
|
||||
}
|
||||
20
entry/src/main/ets/pages/news/News.ets
Normal file
@@ -0,0 +1,20 @@
|
||||
import router from '@ohos.router'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct News {
|
||||
build() {
|
||||
Column() {
|
||||
Text('健康资讯页面')
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ top: 40 })
|
||||
Button('返回')
|
||||
.margin({ top: 20 })
|
||||
.onClick(() => router.back())
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
}
|
||||
}
|
||||
293
entry/src/main/ets/pages/nursing/CommentList.ets
Normal file
@@ -0,0 +1,293 @@
|
||||
import router from '@ohos.router'
|
||||
|
||||
interface Comment {
|
||||
id: number
|
||||
userName: string
|
||||
avatar: string
|
||||
rating: number
|
||||
location: string
|
||||
content: string
|
||||
time: string
|
||||
likes: number
|
||||
}
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct CommentList {
|
||||
@State currentTab: number = 0
|
||||
@State total_reviews: number = 2000
|
||||
@State positive_reviews: number = 1988
|
||||
@State negative_reviews: number = 12
|
||||
@State tabs: string[] = [`全部(${this.total_reviews})`, `好评(${this.positive_reviews})`, `差评(${this.negative_reviews})`]
|
||||
@State showSortDialog: boolean = false
|
||||
@State sortType: string = '默认排序'
|
||||
@State comments: Comment[] = [
|
||||
{
|
||||
id: 1001,
|
||||
userName: "王强",
|
||||
avatar: "https://picsum.photos/40",
|
||||
rating: 1.0,
|
||||
location: "北京",
|
||||
content: "阿姨打扫的很敷衍,很多地方都没有打扫到位,态度也不好。",
|
||||
time: "2天前",
|
||||
likes: 0
|
||||
},
|
||||
{
|
||||
id: 1002,
|
||||
userName: "李明",
|
||||
avatar: "https://picsum.photos/40",
|
||||
rating: 5.0,
|
||||
location: "上海",
|
||||
content: "服务很专业,阿姨态度很好,打扫得很干净。",
|
||||
time: "3天前",
|
||||
likes: 12
|
||||
},
|
||||
{
|
||||
id: 1003,
|
||||
userName: "张华",
|
||||
avatar: "https://picsum.photos/40",
|
||||
rating: 4.0,
|
||||
location: "广州",
|
||||
content: "整体还不错,就是有些角落没有打扫到。",
|
||||
time: "1周前",
|
||||
likes: 5
|
||||
}
|
||||
]
|
||||
|
||||
build() {
|
||||
Stack() {
|
||||
Column() {
|
||||
// 顶部导航栏
|
||||
Row() {
|
||||
Row() {
|
||||
Image($r('app.media.back'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
.onClick(() => router.back())
|
||||
Text('全部评价')
|
||||
.fontSize(18)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ left: 16 })
|
||||
}
|
||||
Image($r('app.media.background'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
}
|
||||
.width('100%')
|
||||
.height(56)
|
||||
.padding({ left: 16, right: 16 })
|
||||
.backgroundColor('#fff')
|
||||
.justifyContent(FlexAlign.SpaceBetween)
|
||||
|
||||
// 评论分类标签和排序
|
||||
Row() {
|
||||
Row() {
|
||||
ForEach(this.tabs, (item: string, index: number) => {
|
||||
Text(item)
|
||||
.fontSize(14)
|
||||
.fontColor(this.currentTab === index ? '#333' : '#999')
|
||||
.backgroundColor(this.currentTab === index ? '#F5F5F5' : '#fff')
|
||||
.padding({ left: 12, right: 12, top: 6, bottom: 6 })
|
||||
.borderRadius(16)
|
||||
.margin({ right: 8 })
|
||||
.onClick(() => {
|
||||
this.currentTab = index
|
||||
})
|
||||
})
|
||||
}
|
||||
Row() {
|
||||
Text(this.sortType)
|
||||
.fontSize(14)
|
||||
.fontColor('#333')
|
||||
Image($r('app.media.background'))
|
||||
.width(16)
|
||||
.height(16)
|
||||
.margin({ left: 4 })
|
||||
.fillColor('#333')
|
||||
}
|
||||
.height(32)
|
||||
.padding({ left: 12, right: 12 })
|
||||
.backgroundColor('#F5F5F5')
|
||||
.borderRadius(16)
|
||||
.margin({ left: 'auto' })
|
||||
.onClick(() => {
|
||||
this.showSortDialog = true
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
.padding(16)
|
||||
.backgroundColor('#fff')
|
||||
|
||||
// 评论列表
|
||||
List({ space: 8 }) {
|
||||
ForEach(this.comments.filter(item => {
|
||||
if (this.currentTab === 1) return item.rating >= 4
|
||||
if (this.currentTab === 2) return item.rating < 4
|
||||
return true
|
||||
}), (item: Comment) => {
|
||||
ListItem() {
|
||||
Column() {
|
||||
Row() {
|
||||
Image(item.avatar)
|
||||
.width(40)
|
||||
.height(40)
|
||||
.borderRadius(20)
|
||||
Column() {
|
||||
Row() {
|
||||
Text(item.userName)
|
||||
.fontSize(14)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
Text(item.time)
|
||||
.fontSize(12)
|
||||
.fontColor('#999')
|
||||
.margin({ left: 8 })
|
||||
}
|
||||
.margin({ bottom: 4 })
|
||||
Row() {
|
||||
Row() {
|
||||
ForEach([1, 2, 3, 4, 5], (star: number) => {
|
||||
Text('★')
|
||||
.fontColor(star <= item.rating ? '#FFB800' : '#DDD')
|
||||
.fontSize(14)
|
||||
.margin({ right: 2 })
|
||||
})
|
||||
}
|
||||
Text(item.rating.toString())
|
||||
.fontSize(14)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.fontColor('#FFB800')
|
||||
.margin({ left: 8 })
|
||||
Text(item.location)
|
||||
.fontSize(12)
|
||||
.fontColor('#999')
|
||||
.margin({ left: 8 })
|
||||
}
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.margin({ left: 12 })
|
||||
Column() {
|
||||
Image($r('app.media.background'))
|
||||
.width(20)
|
||||
.height(20)
|
||||
.fillColor('#999')
|
||||
Text(item.likes.toString())
|
||||
.fontSize(12)
|
||||
.fontColor('#999')
|
||||
.margin({ top: 4 })
|
||||
}
|
||||
.margin({ left: 'auto' })
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
.onClick(() => {
|
||||
// 点赞功能待实现
|
||||
})
|
||||
}
|
||||
Text(item.content)
|
||||
.fontSize(14)
|
||||
.fontColor('#333')
|
||||
.margin({ top: 8 })
|
||||
}
|
||||
.padding({ top: 16, bottom: 16 })
|
||||
.width('100%')
|
||||
.backgroundColor('#fff')
|
||||
.margin({ bottom: 8 })
|
||||
}
|
||||
})
|
||||
}
|
||||
.margin({ top: 12 })
|
||||
.padding({ left: 16, right: 16 })
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
|
||||
// 排序弹框
|
||||
if (this.showSortDialog) {
|
||||
Column() {
|
||||
Column() {
|
||||
Text('排序')
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ top: 16, bottom: 16 })
|
||||
Column() {
|
||||
Row() {
|
||||
Text('评分:由高到低')
|
||||
.fontSize(14)
|
||||
.fontColor('#333')
|
||||
}
|
||||
.width('100%')
|
||||
.height(48)
|
||||
.padding({ left: 16, right: 16 })
|
||||
.backgroundColor(this.sortType === '评分:由高到低' ? '#F5F5F5' : '#fff')
|
||||
.onClick(() => {
|
||||
this.sortType = '评分:由高到低'
|
||||
this.showSortDialog = false
|
||||
// 实现排序逻辑
|
||||
this.comments.sort((a, b) => b.rating - a.rating)
|
||||
})
|
||||
|
||||
Row() {
|
||||
Text('评分:由低到高')
|
||||
.fontSize(14)
|
||||
.fontColor('#333')
|
||||
}
|
||||
.width('100%')
|
||||
.height(48)
|
||||
.padding({ left: 16, right: 16 })
|
||||
.backgroundColor(this.sortType === '评分:由低到高' ? '#F5F5F5' : '#fff')
|
||||
.onClick(() => {
|
||||
this.sortType = '评分:由低到高'
|
||||
this.showSortDialog = false
|
||||
// 实现排序逻辑
|
||||
this.comments.sort((a, b) => a.rating - b.rating)
|
||||
})
|
||||
|
||||
Row() {
|
||||
Text('评价时间')
|
||||
.fontSize(14)
|
||||
.fontColor('#333')
|
||||
}
|
||||
.width('100%')
|
||||
.height(48)
|
||||
.padding({ left: 16, right: 16 })
|
||||
.backgroundColor(this.sortType === '评价时间' ? '#F5F5F5' : '#fff')
|
||||
.onClick(() => {
|
||||
this.sortType = '评价时间'
|
||||
this.showSortDialog = false
|
||||
// 实现排序逻辑
|
||||
// 这里需要将time转换为可比较的格式
|
||||
})
|
||||
|
||||
Row() {
|
||||
Text('点赞量:由高到低')
|
||||
.fontSize(14)
|
||||
.fontColor('#333')
|
||||
}
|
||||
.width('100%')
|
||||
.height(48)
|
||||
.padding({ left: 16, right: 16 })
|
||||
.backgroundColor(this.sortType === '点赞量:由高到低' ? '#F5F5F5' : '#fff')
|
||||
.onClick(() => {
|
||||
this.sortType = '点赞量:由高到低'
|
||||
this.showSortDialog = false
|
||||
// 实现排序逻辑
|
||||
this.comments.sort((a, b) => b.likes - a.likes)
|
||||
})
|
||||
}
|
||||
.width('100%')
|
||||
.backgroundColor('#fff')
|
||||
}
|
||||
.width('100%')
|
||||
.backgroundColor('#fff')
|
||||
.borderRadius({ topLeft: 16, topRight: 16 })
|
||||
.position({ x: 0, y: '50%' })
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('rgba(0,0,0,0.5)')
|
||||
.onClick(() => {
|
||||
this.showSortDialog = false
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
389
entry/src/main/ets/pages/nursing/Nursing.ets
Normal file
@@ -0,0 +1,389 @@
|
||||
import router from '@ohos.router'
|
||||
import http from '@ohos.net.http'
|
||||
|
||||
interface Xianshi {
|
||||
id:number
|
||||
name: string
|
||||
currentPrice: number,
|
||||
originalPrice: number,
|
||||
image: string
|
||||
}
|
||||
|
||||
interface RehabCareData {
|
||||
rehabCare: Xianshi[]
|
||||
}
|
||||
|
||||
interface ResponseData {
|
||||
code: number,
|
||||
msg: string,
|
||||
data: RehabCareData
|
||||
}
|
||||
|
||||
interface TuiItem {
|
||||
service_name: string
|
||||
service_duration: string
|
||||
service_personnel: string
|
||||
service_type: string
|
||||
after_sales_guarantee: string
|
||||
price: string
|
||||
sold_quantity: number
|
||||
image: string
|
||||
}
|
||||
|
||||
interface TuiResponse {
|
||||
data: TuiItem[]
|
||||
}
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Nursing {
|
||||
@State isLoading: boolean = true
|
||||
@State rehabCare: Xianshi[] = []
|
||||
@State tuiList: TuiItem[] = []
|
||||
|
||||
aboutToAppear() {
|
||||
console.info('开始获取数据...')
|
||||
this.fetchServiceData()
|
||||
this.fetchTuiList()
|
||||
}
|
||||
|
||||
fetchServiceData() {
|
||||
this.isLoading = true
|
||||
let httpRequest = http.createHttp()
|
||||
httpRequest.request(
|
||||
"https://mock.presstime.cn/mock/6819c85b5ca065b2e0d4510b/api/you",
|
||||
{
|
||||
method: http.RequestMethod.GET,
|
||||
header: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}
|
||||
).then((resp: http.HttpResponse) => {
|
||||
if (resp.responseCode === 200) {
|
||||
const responseData = JSON.parse(resp.result.toString()) as ResponseData
|
||||
console.info('接口返回数据:', JSON.stringify(responseData))
|
||||
if (
|
||||
responseData.code === 200 &&
|
||||
responseData.data &&
|
||||
Array.isArray(responseData.data.rehabCare)
|
||||
) {
|
||||
this.rehabCare = responseData.data.rehabCare
|
||||
console.info('设置后的数据:', JSON.stringify(this.rehabCare))
|
||||
console.info('数据长度:', this.rehabCare.length)
|
||||
} else {
|
||||
console.error('数据格式错误:', responseData)
|
||||
this.rehabCare = []
|
||||
}
|
||||
this.isLoading = false
|
||||
}
|
||||
}).catch((err: Error) => {
|
||||
console.error('获取数据失败:', err.message)
|
||||
}).finally(() => {
|
||||
httpRequest.destroy()
|
||||
})
|
||||
}
|
||||
|
||||
fetchTuiList() {
|
||||
let httpRequest = http.createHttp()
|
||||
httpRequest.request(
|
||||
"https://mock.presstime.cn/mock/6819c85b5ca065b2e0d4510b/api/tui",
|
||||
{
|
||||
method: http.RequestMethod.GET,
|
||||
header: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
}
|
||||
).then((resp: http.HttpResponse) => {
|
||||
if (resp.responseCode === 200) {
|
||||
const responseData = JSON.parse(resp.result.toString()) as TuiResponse
|
||||
if (responseData.data && Array.isArray(responseData.data)) {
|
||||
this.tuiList = responseData.data
|
||||
} else {
|
||||
this.tuiList = []
|
||||
}
|
||||
}
|
||||
}).catch((err: Error) => {
|
||||
this.tuiList = []
|
||||
}).finally(() => {
|
||||
httpRequest.destroy()
|
||||
})
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
// 顶部导航
|
||||
Row() {
|
||||
Image($r("app.media.back"))
|
||||
.width(24)
|
||||
.height(24)
|
||||
.onClick(() => {
|
||||
router.back()
|
||||
})
|
||||
Text('家政护理')
|
||||
.fontSize(18)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ left: 16 })
|
||||
}
|
||||
.width('100%')
|
||||
.height(56)
|
||||
.padding({ left: 16, right: 16 })
|
||||
.backgroundColor(Color.White)
|
||||
|
||||
// 主要内容区域
|
||||
Scroll() {
|
||||
Column() {
|
||||
// 搜索框
|
||||
Row() {
|
||||
Image($r('app.media.sou'))
|
||||
.width(20)
|
||||
.height(20)
|
||||
TextInput({ placeholder: '搜索' })
|
||||
.fontSize(14)
|
||||
.backgroundColor('transparent')
|
||||
.placeholderColor('#999999')
|
||||
.margin({ left: 8 })
|
||||
.width('90%')
|
||||
}
|
||||
.width('92%')
|
||||
.height(40)
|
||||
.backgroundColor('#F5F5F5')
|
||||
.borderRadius(20)
|
||||
.padding({ left: 16 })
|
||||
.margin({ top: 12 })
|
||||
|
||||
// 服务分类
|
||||
Grid() {
|
||||
GridItem() {
|
||||
Column() {
|
||||
Image($r("app.media.icon"))
|
||||
.width(40)
|
||||
.height(40)
|
||||
Text('生活照料')
|
||||
.fontSize(14)
|
||||
.margin({ top: 8 })
|
||||
}
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
}
|
||||
|
||||
GridItem() {
|
||||
Column() {
|
||||
Image($r('app.media.lian'))
|
||||
.width(40)
|
||||
.height(40)
|
||||
Text('临床护理')
|
||||
.fontSize(14)
|
||||
.margin({ top: 8 })
|
||||
}
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
}
|
||||
|
||||
GridItem() {
|
||||
Column() {
|
||||
Image($r('app.media.kanghu'))
|
||||
.width(40)
|
||||
.height(40)
|
||||
Text('康复护理')
|
||||
.fontSize(14)
|
||||
.margin({ top: 8 })
|
||||
}
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
}
|
||||
|
||||
GridItem() {
|
||||
Column() {
|
||||
Image($r('app.media.xinliguanhuai'))
|
||||
.width(40)
|
||||
.height(40)
|
||||
Text('心理关怀')
|
||||
.fontSize(14)
|
||||
.margin({ top: 8 })
|
||||
}
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
}
|
||||
|
||||
GridItem() {
|
||||
Column() {
|
||||
Image($r('app.media.shangmenzuofan'))
|
||||
.width(40)
|
||||
.height(40)
|
||||
Text('上门做饭')
|
||||
.fontSize(14)
|
||||
.margin({ top: 8 })
|
||||
}
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
}
|
||||
|
||||
GridItem() {
|
||||
Column() {
|
||||
Image($r('app.media.jiangkangguanli'))
|
||||
.width(40)
|
||||
.height(40)
|
||||
Text('健康管理')
|
||||
.fontSize(14)
|
||||
.margin({ top: 8 })
|
||||
}
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
}
|
||||
|
||||
GridItem() {
|
||||
Column() {
|
||||
Image($r('app.media.peitong'))
|
||||
.width(40)
|
||||
.height(40)
|
||||
Text('陪同就医')
|
||||
.fontSize(14)
|
||||
.margin({ top: 8 })
|
||||
}
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
}
|
||||
|
||||
GridItem() {
|
||||
Column() {
|
||||
Image($r('app.media.richangqingjie'))
|
||||
.width(40)
|
||||
.height(40)
|
||||
Text('日常清洁')
|
||||
.fontSize(14)
|
||||
.margin({ top: 8 })
|
||||
}
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
}
|
||||
}
|
||||
.width('92%')
|
||||
.height(250)
|
||||
.columnsTemplate('1fr 1fr 1fr 1fr')
|
||||
.rowsTemplate('1fr 1fr')
|
||||
.rowsGap(20)
|
||||
.columnsGap(16)
|
||||
.margin({ top: 20 })
|
||||
|
||||
// 限时优惠
|
||||
Column() {
|
||||
// 标题和倒计时
|
||||
Row() {
|
||||
Text('限时优惠')
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.fontColor('#333')
|
||||
Row() {
|
||||
Text('03').fontColor('#FF4D4F').fontSize(15)
|
||||
Text(' : ').fontColor('#FF4D4F').fontSize(15)
|
||||
Text('33').fontColor('#FF4D4F').fontSize(15)
|
||||
Text(' : ').fontColor('#FF4D4F').fontSize(15)
|
||||
Text('33').fontColor('#FF4D4F').fontSize(15)
|
||||
}
|
||||
.margin({ right: 8 })
|
||||
}
|
||||
.width('100%')
|
||||
.justifyContent(FlexAlign.SpaceBetween)
|
||||
.margin({ bottom: 12 })
|
||||
|
||||
// 横向滑动卡片
|
||||
List({ space: 12, initialIndex: 0 }) {
|
||||
ForEach(this.rehabCare, (item: Xianshi) => {
|
||||
ListItem() {
|
||||
Column() {
|
||||
Image(item.image)
|
||||
.width(140)
|
||||
.height(100)
|
||||
.borderRadius(8)
|
||||
.objectFit(ImageFit.Cover)
|
||||
.onClick(() => {
|
||||
router.pushUrl({
|
||||
url: 'pages/nursing/NursingDetail',
|
||||
params: item
|
||||
})
|
||||
})
|
||||
Text(item.name)
|
||||
.fontSize(14)
|
||||
.fontColor('#333')
|
||||
.margin({ top: 8 })
|
||||
.maxLines(2)
|
||||
.textOverflow({ overflow: TextOverflow.Ellipsis })
|
||||
Row() {
|
||||
Text('¥' + item.currentPrice)
|
||||
.fontSize(16)
|
||||
.fontColor('#FF4D4F')
|
||||
Text('¥' + item.originalPrice)
|
||||
.fontSize(12)
|
||||
.fontColor('#999999')
|
||||
.decoration({ type: TextDecorationType.LineThrough })
|
||||
.margin({ left: 8 })
|
||||
}
|
||||
.margin({ top: 4 })
|
||||
}
|
||||
.padding(8)
|
||||
.backgroundColor('#fff')
|
||||
.borderRadius(12)
|
||||
.shadow({ radius: 8, color: '#eee', offsetX: 0, offsetY: 2 })
|
||||
.width(160)
|
||||
}
|
||||
})
|
||||
}
|
||||
.height(180)
|
||||
.listDirection(Axis.Horizontal)
|
||||
.margin({ top: 8 })
|
||||
}
|
||||
.width('100%')
|
||||
.backgroundColor('#EAF3FA')
|
||||
.borderRadius(16)
|
||||
.padding(16)
|
||||
.margin({ top: 16, bottom: 16 })
|
||||
|
||||
// 为您推荐
|
||||
Text('为您推荐')
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.alignSelf(ItemAlign.Start)
|
||||
.margin({ top: 20, left: 16 })
|
||||
|
||||
// 推荐服务列表
|
||||
List() {
|
||||
ForEach(this.tuiList, (item: TuiItem) => {
|
||||
ListItem() {
|
||||
Row() {
|
||||
Image(item.image)
|
||||
.width(120)
|
||||
.height(80)
|
||||
.borderRadius(8)
|
||||
Column() {
|
||||
Text(item.service_name)
|
||||
.fontSize(14)
|
||||
.maxLines(2)
|
||||
Row() {
|
||||
Text(item.price)
|
||||
.fontSize(16)
|
||||
.fontColor('#FF4D4F')
|
||||
Text('已售 ' + item.sold_quantity)
|
||||
.fontSize(12)
|
||||
.fontColor('#999999')
|
||||
.margin({ left: 'auto' })
|
||||
}
|
||||
.width('100%')
|
||||
.margin({ top: 8 })
|
||||
}
|
||||
.layoutWeight(1)
|
||||
.margin({ left: 12 })
|
||||
}
|
||||
.padding(12)
|
||||
.backgroundColor(Color.White)
|
||||
.borderRadius(8)
|
||||
.margin({ bottom: 12 })
|
||||
}
|
||||
})
|
||||
}
|
||||
.width('92%')
|
||||
.margin({ top: 12 })
|
||||
}
|
||||
.width('100%')
|
||||
}
|
||||
.width('100%')
|
||||
.layoutWeight(1)
|
||||
.scrollBar(BarState.Auto)
|
||||
.edgeEffect(EdgeEffect.Spring)
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
}
|
||||
}
|
||||
314
entry/src/main/ets/pages/nursing/NursingDetail.ets
Normal file
@@ -0,0 +1,314 @@
|
||||
import router from '@ohos.router'
|
||||
|
||||
interface Staff {
|
||||
name: string
|
||||
avatar: string
|
||||
tag: string
|
||||
}
|
||||
interface XianshiDetail {
|
||||
id: number
|
||||
name: string
|
||||
currentPrice: number
|
||||
originalPrice: number
|
||||
image: string
|
||||
discount: string
|
||||
rating: number
|
||||
commentCount: number
|
||||
scene: string
|
||||
area: string
|
||||
scope: string
|
||||
overtime: string
|
||||
staffList: Staff[]
|
||||
}
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct NursingDetail {
|
||||
@State detail: XianshiDetail = router.getParams() as XianshiDetail
|
||||
|
||||
build() {
|
||||
Stack({ alignContent: Alignment.Bottom }) {
|
||||
Scroll() {
|
||||
Column() {
|
||||
// 顶部图片
|
||||
Image(this.detail.image)
|
||||
.width('100%')
|
||||
.height(260)
|
||||
.objectFit(ImageFit.Cover)
|
||||
|
||||
// 主要内容区域
|
||||
Column() {
|
||||
// 标题、价格、折扣
|
||||
Text(this.detail.name)
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ bottom: 12 })
|
||||
|
||||
Row() {
|
||||
Text('¥' + this.detail.currentPrice)
|
||||
.fontSize(24)
|
||||
.fontColor('#FF4D4F')
|
||||
.fontWeight(FontWeight.Bold)
|
||||
Text('¥' + this.detail.originalPrice)
|
||||
.fontSize(14)
|
||||
.fontColor('#999')
|
||||
.decoration({ type: TextDecorationType.LineThrough })
|
||||
.margin({ left: 8 })
|
||||
Text(this.detail.discount)
|
||||
.fontSize(12)
|
||||
.fontColor('#FF4D4F')
|
||||
.backgroundColor('#FFF0F0')
|
||||
.padding({ left: 6, right: 6, top: 2, bottom: 2 })
|
||||
.borderRadius(4)
|
||||
.margin({ left: 8 })
|
||||
}
|
||||
.margin({ bottom: 12 })
|
||||
|
||||
// 评分
|
||||
Row() {
|
||||
Text('★★★★★')
|
||||
.fontColor('#FFD700')
|
||||
.fontSize(16)
|
||||
Text(this.detail.rating + '分')
|
||||
.fontSize(14)
|
||||
.fontColor('#333')
|
||||
.margin({ left: 8 })
|
||||
Text('(' + this.detail.commentCount + '人评价)')
|
||||
.fontSize(12)
|
||||
.fontColor('#999')
|
||||
.margin({ left: 8 })
|
||||
}
|
||||
.margin({ bottom: 20 })
|
||||
|
||||
// 服务内容
|
||||
Text('服务内容')
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ bottom: 12 })
|
||||
|
||||
Column({ space: 12 }) {
|
||||
Row() {
|
||||
Text('适用场景').fontColor('#666').fontSize(14)
|
||||
Text(this.detail.scene).fontSize(14)
|
||||
}.width('100%').justifyContent(FlexAlign.SpaceBetween)
|
||||
|
||||
Row() {
|
||||
Text('适用面积').fontColor('#666').fontSize(14)
|
||||
Text(this.detail.area).fontSize(14)
|
||||
}.width('100%').justifyContent(FlexAlign.SpaceBetween)
|
||||
|
||||
Row() {
|
||||
Text('适用范围').fontColor('#666').fontSize(14)
|
||||
Text(this.detail.scope).fontSize(14)
|
||||
}.width('100%').justifyContent(FlexAlign.SpaceBetween)
|
||||
|
||||
Row() {
|
||||
Text('超时费用').fontColor('#666').fontSize(14)
|
||||
Text(this.detail.overtime).fontSize(14)
|
||||
}.width('100%').justifyContent(FlexAlign.SpaceBetween)
|
||||
}
|
||||
.margin({ bottom: 20 })
|
||||
|
||||
// 服务人员
|
||||
Text('服务人员')
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ bottom: 12 })
|
||||
|
||||
List() {
|
||||
ForEach(this.detail.staffList, (staff: Staff) => {
|
||||
ListItem() {
|
||||
Row() {
|
||||
Image(staff.avatar)
|
||||
.width(60)
|
||||
.height(60)
|
||||
.borderRadius(30)
|
||||
Column() {
|
||||
Text(staff.name)
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ bottom: 8 })
|
||||
Text('全屋空调')
|
||||
.fontSize(14)
|
||||
.fontColor('#999')
|
||||
.margin({ bottom: 8 })
|
||||
Text(staff.tag)
|
||||
.fontSize(12)
|
||||
.fontColor('#FF4D4F')
|
||||
.backgroundColor('#FFF0F0')
|
||||
.padding({ left: 8, right: 8, top: 2, bottom: 2 })
|
||||
.borderRadius(12)
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.margin({ left: 16 })
|
||||
}
|
||||
.padding({ top: 16, bottom: 16 })
|
||||
.width('100%')
|
||||
}
|
||||
})
|
||||
}
|
||||
.height(240)
|
||||
.margin({ bottom: 20 })
|
||||
|
||||
// 服务详情
|
||||
Text('服务详情')
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ bottom: 12 })
|
||||
|
||||
Text('运接一家专业的清洁公司或个人人员进行日常保洁服务,可以确保清洁效果和服务质量,让客户安心。')
|
||||
.fontSize(14)
|
||||
.fontColor('#666')
|
||||
.margin({ bottom: 16 })
|
||||
.lineHeight(22)
|
||||
|
||||
Row({ space: 12 }) {
|
||||
Image($r('app.media.background'))
|
||||
.width('48%')
|
||||
.height(120)
|
||||
.borderRadius(8)
|
||||
.objectFit(ImageFit.Cover)
|
||||
Image($r('app.media.background'))
|
||||
.width('48%')
|
||||
.height(120)
|
||||
.borderRadius(8)
|
||||
.objectFit(ImageFit.Cover)
|
||||
}
|
||||
.margin({ bottom: 20 })
|
||||
|
||||
// 购买须知
|
||||
Text('购买须知')
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ bottom: 12 })
|
||||
|
||||
Column({ space: 12 }) {
|
||||
Row() {
|
||||
Text('有效期').fontColor('#666').fontSize(14)
|
||||
Text('购买后60天内有效').fontSize(14)
|
||||
}.width('100%').justifyContent(FlexAlign.SpaceBetween)
|
||||
|
||||
Row() {
|
||||
Text('预约规则').fontColor('#666').fontSize(14)
|
||||
Text('请提前预约,预约后服务2小时内可退').fontSize(14)
|
||||
}.width('100%').justifyContent(FlexAlign.SpaceBetween)
|
||||
}
|
||||
.margin({ bottom: 20 })
|
||||
|
||||
// 用户评价
|
||||
Row() {
|
||||
Text('用户评价')
|
||||
.fontSize(16)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
Text('(2000)')
|
||||
.fontSize(14)
|
||||
.fontColor('#999')
|
||||
.margin({ left: 4 })
|
||||
Text('4.9')
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.fontColor('#FFB800')
|
||||
.margin({ left: 'auto' })
|
||||
}
|
||||
.margin({ bottom: 12 })
|
||||
|
||||
Column({ space: 16 }) {
|
||||
ForEach([1, 2], () => {
|
||||
Column() {
|
||||
Row() {
|
||||
Image('https://picsum.photos/40')
|
||||
.width(40)
|
||||
.height(40)
|
||||
.borderRadius(20)
|
||||
Column() {
|
||||
Row() {
|
||||
Text('王强')
|
||||
.fontSize(14)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
Text('2天前')
|
||||
.fontSize(12)
|
||||
.fontColor('#999')
|
||||
.margin({ left: 8 })
|
||||
}
|
||||
.margin({ bottom: 4 })
|
||||
Row() {
|
||||
Text('★★★★★')
|
||||
.fontColor('#FFB800')
|
||||
.fontSize(14)
|
||||
Text('5.0')
|
||||
.fontSize(14)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.fontColor('#FFB800')
|
||||
.margin({ left: 8 })
|
||||
Text('北京')
|
||||
.fontSize(12)
|
||||
.fontColor('#999')
|
||||
.margin({ left: 8 })
|
||||
}
|
||||
}
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
.margin({ left: 12 })
|
||||
}
|
||||
Text('非常满意日常保洁服务,清洁人员非常专业、认真,服务态度非常好。')
|
||||
.fontSize(14)
|
||||
.fontColor('#333')
|
||||
.margin({ top: 8, bottom: 12 })
|
||||
}
|
||||
})
|
||||
}
|
||||
.margin({ bottom: 12 })
|
||||
|
||||
Row() {
|
||||
Text('查看全部评价')
|
||||
.fontSize(14)
|
||||
.fontColor('#666')
|
||||
.onClick(() => {
|
||||
router.pushUrl({
|
||||
url: 'pages/nursing/CommentList',
|
||||
params: {
|
||||
rating: this.detail.rating,
|
||||
commentCount: this.detail.commentCount
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.width('100%')
|
||||
.height(40)
|
||||
.backgroundColor('#F5F5F5')
|
||||
.borderRadius(20)
|
||||
.margin({ bottom: 80 })
|
||||
|
||||
}
|
||||
.padding(16)
|
||||
.backgroundColor('#fff')
|
||||
.borderRadius({ topLeft: 20, topRight: 20 })
|
||||
.margin({ top: -20 })
|
||||
}
|
||||
}
|
||||
.scrollBar(BarState.Off)
|
||||
|
||||
// 顶部返回按钮
|
||||
Row() {
|
||||
Image($r('app.media.back'))
|
||||
.width(32)
|
||||
.height(32)
|
||||
.fillColor('#fff')
|
||||
.onClick(() => router.back())
|
||||
}
|
||||
.position({ x: 16, y: 16 })
|
||||
|
||||
// 底部购买按钮
|
||||
Button('立即购买', { type: ButtonType.Capsule })
|
||||
.width('90%')
|
||||
.height(48)
|
||||
.fontSize(18)
|
||||
.fontColor('#fff')
|
||||
.backgroundColor('#FF4D4F')
|
||||
.margin({ bottom: 24 })
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
}
|
||||
}
|
||||
13
entry/src/main/ets/pages/profile/profile.ets
Normal file
@@ -0,0 +1,13 @@
|
||||
@Component
|
||||
export default struct Profile {
|
||||
build() {
|
||||
Column() {
|
||||
Text('我的')
|
||||
.fontSize(20)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#F1F3F5')
|
||||
}
|
||||
}
|
||||
186
entry/src/main/ets/pages/region/Region.ets
Normal file
@@ -0,0 +1,186 @@
|
||||
import preferences from '@ohos.data.preferences';
|
||||
import router from '@ohos.router';
|
||||
interface RegionGroup {
|
||||
letter: string;
|
||||
regions: string[];
|
||||
}
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Region {
|
||||
@State currentCity: string = '上海'
|
||||
@State hotCities: string[] = ['北京', '上海', '广州', '深圳', '青岛', '苏州', '重庆', '成都', '杭州']
|
||||
@State allRegions: RegionGroup[] = [
|
||||
{ letter: 'A', regions: ['阿巴嘎旗', '阿拉善左旗', '阿拉善右旗', '阿荣旗'] },
|
||||
{ letter: 'B', regions: ['北京', '保定', '蚌埠', '包头'] },
|
||||
{ letter: 'C', regions: ['成都', '重庆', '长沙', '长春'] },
|
||||
{ letter: 'D', regions: ['大连', '东莞', '大同', '丹东'] },
|
||||
// 可以继续添加更多字母分组
|
||||
]
|
||||
@State letters: string[] = [
|
||||
'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'
|
||||
]
|
||||
@State selectedLetter: string = 'A'
|
||||
@State filterLetter: string | null = null // 新增:筛选字母
|
||||
|
||||
// 新增:生成热门城市行的辅助方法
|
||||
private getHotCityRows(): string[][] {
|
||||
let result: string[][] = []
|
||||
let len = this.hotCities.length
|
||||
for (let i = 0; i < len; i += 3) {
|
||||
result.push(this.hotCities.slice(i, i + 3))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
async aboutToAppear() {
|
||||
// 页面出现时优先读取本地存储的城市名
|
||||
let prefs = await preferences.getPreferences(globalThis.getContext(), 'city_prefs');
|
||||
let city = await prefs.get('currentCity', '上海');
|
||||
if (typeof city !== 'string') {
|
||||
city = String(city);
|
||||
}
|
||||
AppStorage.SetOrCreate('currentCity', city);
|
||||
this.currentCity = city;
|
||||
}
|
||||
build() {
|
||||
Column() {
|
||||
// 顶部导航
|
||||
Row() {
|
||||
Image($r('app.media.back'))
|
||||
.width(24)
|
||||
.height(24)
|
||||
.onClick(() => { router.back() })
|
||||
Text('选择地区')
|
||||
.fontSize(18)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ left: 12 })
|
||||
}
|
||||
.width('100%')
|
||||
.height(48)
|
||||
.padding({ left: 16, right: 16, top: 8 })
|
||||
.alignItems(VerticalAlign.Center)
|
||||
|
||||
// 当前定位城市(动态显示)
|
||||
Row() {
|
||||
Image($r('app.media.ding'))
|
||||
.width(18)
|
||||
.height(18)
|
||||
Text('当前定位城市')
|
||||
.fontSize(14)
|
||||
.fontColor('#888')
|
||||
.margin({ left: 6, right: 8 })
|
||||
Text(this.currentCity) // 动态显示当前城市
|
||||
.fontSize(15)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
Text('重新定位')
|
||||
.fontSize(14)
|
||||
.fontColor('#3B6EFF')
|
||||
.margin({ left: 12 })
|
||||
.onClick(() => { /* 重新定位逻辑 */ })
|
||||
}
|
||||
.padding({ left: 16, top: 8, bottom: 8 })
|
||||
.alignItems(VerticalAlign.Center)
|
||||
|
||||
// 热门地区
|
||||
Column() {
|
||||
Text('热门地区')
|
||||
.fontSize(15)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ bottom: 8 })
|
||||
ForEach(this.getHotCityRows(), (row: string[]) => {
|
||||
Row() {
|
||||
ForEach(row, (city: string) => {
|
||||
Button(city)
|
||||
.fontSize(15)
|
||||
.backgroundColor('#F5F5F5')
|
||||
.fontColor('#222')
|
||||
.borderRadius(8)
|
||||
.padding({ left: 18, right: 18, top: 8, bottom: 8 })
|
||||
.margin({ right: 12, bottom: 12 })
|
||||
.onClick(() => {
|
||||
this.currentCity = city // 点击热门城市,切换定位
|
||||
})
|
||||
})
|
||||
ForEach(Array(3 - row.length).fill(0), (_: number) => {
|
||||
Blank().width(80).margin({ right: 12, bottom: 12 })
|
||||
})
|
||||
}
|
||||
.justifyContent(FlexAlign.Center)
|
||||
})
|
||||
}
|
||||
.padding({ left: 16, right: 16, top: 8, bottom: 8 })
|
||||
|
||||
// 所有地区和字母索引
|
||||
Row() {
|
||||
// 地区列表内容区
|
||||
Scroll() {
|
||||
Column() {
|
||||
ForEach(
|
||||
this.filterLetter === null
|
||||
? this.allRegions
|
||||
: this.allRegions.filter((item: RegionGroup) => item.letter === this.filterLetter),
|
||||
(item: RegionGroup) => {
|
||||
Column() {
|
||||
Text(item.letter)
|
||||
.fontSize(15)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.fontColor('#888')
|
||||
.margin({ top: 12, bottom: 4, left: 8 })
|
||||
ForEach(item.regions, (region: string) => {
|
||||
Text(region)
|
||||
.fontSize(16)
|
||||
.padding({ left: 16, top: 12, bottom: 12 })
|
||||
.backgroundColor(Color.White)
|
||||
.align(Alignment.Start)
|
||||
.onClick(() => {
|
||||
this.currentCity = region // 点击地区城市,切换定位
|
||||
AppStorage.SetOrCreate('currentCity', region);
|
||||
preferences.getPreferences(globalThis.getContext(), 'city_prefs').then(prefs => {
|
||||
prefs.put('currentCity', region);
|
||||
prefs.flush();
|
||||
});
|
||||
})
|
||||
})
|
||||
}
|
||||
.id('region-' + item.letter)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
.layoutWeight(1)
|
||||
.height('100%')
|
||||
.backgroundColor('#FAFAFA')
|
||||
.borderRadius(12)
|
||||
.margin({ left: 0, right: 0, top: 0, bottom: 0 })
|
||||
|
||||
// 右侧字母索引
|
||||
Scroll() {
|
||||
Column() {
|
||||
ForEach(this.letters, (letter: string) => {
|
||||
Text(letter)
|
||||
.fontSize(13)
|
||||
.fontColor(this.selectedLetter === letter ? '#3B6EFF' : '#888')
|
||||
.backgroundColor(this.selectedLetter === letter ? '#E6EEFF' : 'transparent')
|
||||
.borderRadius(8)
|
||||
.padding({ left: 4, right: 4, top: 2, bottom: 2 })
|
||||
.onClick(() => {
|
||||
this.selectedLetter = letter
|
||||
this.filterLetter = (this.filterLetter === letter) ? null : letter
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
.width(32)
|
||||
.height('100%')
|
||||
.margin({ right: 8, top: 0 })
|
||||
}
|
||||
.width('100%')
|
||||
.margin({ top: 8 })
|
||||
.layoutWeight(1)
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#FFF')
|
||||
}
|
||||
}
|
||||
42
entry/src/main/ets/pages/rehabilitation/Rehabilitation.ets
Normal file
@@ -0,0 +1,42 @@
|
||||
import router from '@ohos.router'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct Rehabilitation {
|
||||
build() {
|
||||
Column() {
|
||||
// 顶部导航
|
||||
Row() {
|
||||
Image($r("app.media.back"))
|
||||
.width(24)
|
||||
.height(24)
|
||||
.onClick(() => {
|
||||
router.back()
|
||||
})
|
||||
Text('康复理疗')
|
||||
.fontSize(18)
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.margin({ left: 16 })
|
||||
}
|
||||
.width('100%')
|
||||
.height(56)
|
||||
.padding({ left: 16, right: 16 })
|
||||
.backgroundColor(Color.White)
|
||||
|
||||
// 内容区域
|
||||
Column() {
|
||||
Text('康复理疗服务')
|
||||
.fontSize(24)
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.margin({ top: 20, bottom: 16 })
|
||||
|
||||
Text('专业的康复理疗团队')
|
||||
.fontSize(16)
|
||||
.fontColor('#666666')
|
||||
}
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
.backgroundColor('#F5F5F5')
|
||||
}
|
||||
}
|
||||
}
|
||||
73
entry/src/main/module.json5
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"module": {
|
||||
"name": "entry",
|
||||
"type": "entry",
|
||||
"description": "$string:module_desc",
|
||||
"mainElement": "EntryAbility",
|
||||
"requestPermissions": [
|
||||
{
|
||||
"name": "ohos.permission.INTERNET",
|
||||
"reason": "$string:permission_internet_reason",
|
||||
"usedScene": {
|
||||
"abilities": ["EntryAbility"],
|
||||
"when": "always"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.MICROPHONE",
|
||||
"reason": "$string:permission_microphone_reason",
|
||||
"usedScene": {
|
||||
"abilities": ["EntryAbility"],
|
||||
"when": "always"
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
],
|
||||
"deviceTypes": [
|
||||
"phone",
|
||||
"tablet",
|
||||
"2in1"
|
||||
],
|
||||
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false,
|
||||
"pages": "$profile:main_pages",
|
||||
"abilities": [
|
||||
{
|
||||
"name": "EntryAbility",
|
||||
"srcEntry": "./ets/entryability/EntryAbility.ets",
|
||||
"description": "$string:EntryAbility_desc",
|
||||
"icon": "$media:layered_image",
|
||||
"label": "$string:EntryAbility_label",
|
||||
"startWindowIcon": "$media:startIcon",
|
||||
"startWindowBackground": "$color:start_window_background",
|
||||
"exported": true,
|
||||
"skills": [
|
||||
{
|
||||
"entities": [
|
||||
"entity.system.home"
|
||||
],
|
||||
"actions": [
|
||||
"action.system.home"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"extensionAbilities": [
|
||||
{
|
||||
"name": "EntryBackupAbility",
|
||||
"srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
|
||||
"type": "backup",
|
||||
"exported": false,
|
||||
"metadata": [
|
||||
{
|
||||
"name": "ohos.extension.backup",
|
||||
"resource": "$profile:backup_config"
|
||||
}
|
||||
],
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
8
entry/src/main/resources/base/element/color.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"color": [
|
||||
{
|
||||
"name": "start_window_background",
|
||||
"value": "#FFFFFF"
|
||||
}
|
||||
]
|
||||
}
|
||||
8
entry/src/main/resources/base/element/float.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"float": [
|
||||
{
|
||||
"name": "page_text_font_size",
|
||||
"value": "50fp"
|
||||
}
|
||||
]
|
||||
}
|
||||
33
entry/src/main/resources/base/element/string.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"string": [
|
||||
{
|
||||
"name": "module_desc",
|
||||
"value": "module description"
|
||||
},
|
||||
{
|
||||
"name": "EntryAbility_desc",
|
||||
"value": "description"
|
||||
},
|
||||
{
|
||||
"name": "EntryAbility_label",
|
||||
"value": "label"
|
||||
},
|
||||
{
|
||||
"name": "permission_internet_reason",
|
||||
"value": "需要访问网络以获取和更新应用数据"
|
||||
},
|
||||
{
|
||||
"name": "permission_microphone_reason",
|
||||
"value": "需要使用麦克风进行语音输入"
|
||||
},
|
||||
|
||||
{
|
||||
"name": "permission_media_reason",
|
||||
"value": ""
|
||||
},
|
||||
{
|
||||
"name": "permission_tts_reason",
|
||||
"value": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
BIN
entry/src/main/resources/base/media/activity.png
Normal file
|
After Width: | Height: | Size: 8.3 KiB |
BIN
entry/src/main/resources/base/media/archive.png
Normal file
|
After Width: | Height: | Size: 5.5 KiB |
BIN
entry/src/main/resources/base/media/back.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
entry/src/main/resources/base/media/background.png
Normal file
|
After Width: | Height: | Size: 90 KiB |
BIN
entry/src/main/resources/base/media/baohedu.png
Normal file
|
After Width: | Height: | Size: 8.1 KiB |
BIN
entry/src/main/resources/base/media/bushu.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
entry/src/main/resources/base/media/ding.png
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
entry/src/main/resources/base/media/disease.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
entry/src/main/resources/base/media/elderly.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
entry/src/main/resources/base/media/er.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
entry/src/main/resources/base/media/feng.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
entry/src/main/resources/base/media/foreground.png
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
entry/src/main/resources/base/media/fuwu.png
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
BIN
entry/src/main/resources/base/media/icon.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
entry/src/main/resources/base/media/j.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
entry/src/main/resources/base/media/jiahao.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
entry/src/main/resources/base/media/jian.png
Normal file
|
After Width: | Height: | Size: 9.9 KiB |
BIN
entry/src/main/resources/base/media/jiangkangguanli.png
Normal file
|
After Width: | Height: | Size: 7.5 KiB |
BIN
entry/src/main/resources/base/media/kang.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
entry/src/main/resources/base/media/kanghu.png
Normal file
|
After Width: | Height: | Size: 9.1 KiB |
7
entry/src/main/resources/base/media/layered_image.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"layered-image":
|
||||
{
|
||||
"background" : "$media:background",
|
||||
"foreground" : "$media:foreground"
|
||||
}
|
||||
}
|
||||
BIN
entry/src/main/resources/base/media/lecture.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
entry/src/main/resources/base/media/lian.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
entry/src/main/resources/base/media/lingdan.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
entry/src/main/resources/base/media/news.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
entry/src/main/resources/base/media/peitong.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
entry/src/main/resources/base/media/richangqingjie.png
Normal file
|
After Width: | Height: | Size: 7.4 KiB |
BIN
entry/src/main/resources/base/media/s.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
entry/src/main/resources/base/media/shangmenzuofan.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
entry/src/main/resources/base/media/she.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
entry/src/main/resources/base/media/shou.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
entry/src/main/resources/base/media/shoubioa.png
Normal file
|
After Width: | Height: | Size: 6.1 KiB |
BIN
entry/src/main/resources/base/media/shuimain.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
entry/src/main/resources/base/media/shuju.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
entry/src/main/resources/base/media/sou.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
entry/src/main/resources/base/media/startIcon.png
Normal file
|
After Width: | Height: | Size: 20 KiB |
BIN
entry/src/main/resources/base/media/tizhong.png
Normal file
|
After Width: | Height: | Size: 7.0 KiB |
BIN
entry/src/main/resources/base/media/w.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
entry/src/main/resources/base/media/wy.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
entry/src/main/resources/base/media/x.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
entry/src/main/resources/base/media/xia.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
BIN
entry/src/main/resources/base/media/xiangyou.png
Normal file
|
After Width: | Height: | Size: 3.6 KiB |
BIN
entry/src/main/resources/base/media/xin.png
Normal file
|
After Width: | Height: | Size: 5.7 KiB |
BIN
entry/src/main/resources/base/media/xinliguanhuai.png
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
entry/src/main/resources/base/media/xinlv.png
Normal file
|
After Width: | Height: | Size: 6.5 KiB |
BIN
entry/src/main/resources/base/media/xinxi.png
Normal file
|
After Width: | Height: | Size: 8.0 KiB |
BIN
entry/src/main/resources/base/media/xuetang.png
Normal file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
entry/src/main/resources/base/media/xueya.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
entry/src/main/resources/base/media/y.png
Normal file
|
After Width: | Height: | Size: 5.4 KiB |
BIN
entry/src/main/resources/base/media/yali.png
Normal file
|
After Width: | Height: | Size: 8.5 KiB |
BIN
entry/src/main/resources/base/media/yao.png
Normal file
|
After Width: | Height: | Size: 5.9 KiB |
BIN
entry/src/main/resources/base/media/ys.png
Normal file
|
After Width: | Height: | Size: 5.2 KiB |
BIN
entry/src/main/resources/base/media/yx.png
Normal file
|
After Width: | Height: | Size: 7.4 KiB |
BIN
entry/src/main/resources/base/media/yy.png
Normal file
|
After Width: | Height: | Size: 9.6 KiB |
BIN
entry/src/main/resources/base/media/zhineg.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
3
entry/src/main/resources/base/profile/backup_config.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"allowToBackupRestore": true
|
||||
}
|
||||
22
entry/src/main/resources/base/profile/main_pages.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"src": [
|
||||
"pages/Index",
|
||||
"pages/nursing/Nursing",
|
||||
"pages/rehabilitation/Rehabilitation",
|
||||
"pages/examination/Examination",
|
||||
"pages/dong/Dong",
|
||||
"pages/activity/Activity",
|
||||
"pages/health/Health",
|
||||
"pages/device/Device",
|
||||
"pages/medicine/Medicine",
|
||||
"pages/diet/Diet",
|
||||
"pages/archive/Archive",
|
||||
"pages/news/News",
|
||||
"pages/elderly/Elderly",
|
||||
"pages/lecture/Lecture",
|
||||
"pages/disease/Disease",
|
||||
"pages/nursing/NursingDetail",
|
||||
"pages/nursing/CommentList",
|
||||
"pages/region/Region"
|
||||
]
|
||||
}
|
||||
8
entry/src/main/resources/dark/element/color.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"color": [
|
||||
{
|
||||
"name": "start_window_background",
|
||||
"value": "#000000"
|
||||
}
|
||||
]
|
||||
}
|
||||