1.2.0部分代码

This commit is contained in:
xiaoxiao
2025-08-27 16:11:20 +08:00
parent ca7d1dd379
commit e89a5f15ce
74 changed files with 2704 additions and 192 deletions
+17
View File
@@ -0,0 +1,17 @@
/**
* Use these variables when you tailor your ArkTS code. They must be of the const type.
*/
export const HAR_VERSION = '1.0.0';
export const BUILD_MODE_NAME = 'debug';
export const DEBUG = true;
export const TARGET_NAME = 'default';
/**
* BuildProfile Class is used only for compatibility purposes.
*/
export default class BuildProfile {
static readonly HAR_VERSION = HAR_VERSION;
static readonly BUILD_MODE_NAME = BUILD_MODE_NAME;
static readonly DEBUG = DEBUG;
static readonly TARGET_NAME = TARGET_NAME;
}
+5
View File
@@ -0,0 +1,5 @@
export { SchoolhouseComp } from './src/main/ets/components/SchoolhouseComp';
export { KeepStudyComp } from './src/main/ets/components/KeepStudyComp';
export { CoursewareComp } from './src/main/ets/components/CoursewareComp';
+6
View File
@@ -0,0 +1,6 @@
import { harTasks } from '@ohos/hvigor-ohos-plugin';
export default {
system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
}
+23
View 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
+25
View File
@@ -0,0 +1,25 @@
{
"meta": {
"stableOrder": true
},
"lockfileVersion": 3,
"ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.",
"specifiers": {
"@itcast/basic@../../commons/basic": "@itcast/basic@../../commons/basic",
"refreshlib@../../RefreshLib": "refreshlib@../../RefreshLib"
},
"packages": {
"@itcast/basic@../../commons/basic": {
"name": "@itcast/basic",
"version": "1.0.0",
"resolved": "../../commons/basic",
"registryType": "local"
},
"refreshlib@../../RefreshLib": {
"name": "refreshlib",
"version": "1.0.0",
"resolved": "../../RefreshLib",
"registryType": "local"
}
}
}
+12
View File
@@ -0,0 +1,12 @@
{
"name": "study",
"version": "1.0.0",
"description": "Please describe the basic information.",
"main": "Index.ets",
"author": "",
"license": "Apache-2.0",
"dependencies": {
"@itcast/basic": "file:../../commons/basic",
"refreshlib": "file:../../RefreshLib"
}
}
@@ -0,0 +1,253 @@
import {
authStore,
BasicConstant,
DefaultHintProWindows,
EmptyViewComp, hdHttp, HdLoadingDialog, HdNav,
HdResponse,
ScreeningView, TagList } from "@itcast/basic"
import { promptAction, router } from "@kit.ArkUI"
import { PullToRefreshLayout, RefreshController } from "refreshlib";
import { HashMap } from "@kit.ArkTS";
import { BusinessError } from "@kit.BasicServicesKit";
import { KeJianModel, KeJianRequest } from "../models/KeJianModel";
import { KeJianItemComp } from "../views/KeJianItemComp";
@Component
export struct CoursewareComp {
@State isHotOrNew:boolean = false
@State isShowSC:boolean = false
@State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量
@State sort:string = '0'
@State pageNumber:number = 1;
@State totalPageNumer:number = 1;
@State selectedTag:TagList[] = []
scroller = new Scroller();
public controller:RefreshController = new RefreshController();
@State keyWordsStr:string = ''
@State data : KeJianModel[] = [];
alertView:CustomDialogController = new CustomDialogController({
builder:DefaultHintProWindows({
title:'提示',
message:'肝胆相照将稍后与您沟通课件分享\n谢谢您的支持',
cancleTitleColor: '#333333',
confirmTitleColor: $r('app.color.main_color'),
selectedButton: (index:number)=>{
if (index === 1) {
this.commitKeJian()
}
this.alertView.close();
}
}),
alignment: DialogAlignment.Center,
cornerRadius:24,
backgroundColor: ('rgba(0,0,0,0.5)'),
})
dialog: CustomDialogController = new CustomDialogController({
builder: HdLoadingDialog({ message: '加载中...' }),
customStyle: true,
alignment: DialogAlignment.Center
})
aboutToAppear() {
this.getApplyList();
}
getApplyList() {
const hashMap: HashMap<string, string> = new HashMap();
hashMap.set('page',this.pageNumber.toString());
hashMap.set("sort", this.sort);
hashMap.set("keywords", String(this.keyWordsStr));
this.dialog.open()
hdHttp.httpReq<string>(BasicConstant.ganDanFileByKeyWords,hashMap).then(async (res: HdResponse<string>) => {
this.dialog.close();
let json:KeJianRequest = JSON.parse(res+'') as KeJianRequest;
if(json.code == '200') {
if(this.pageNumber==1) {
this.data=[]
if(json.data!=null) {
this.data = json.data.list;
}
} else if(this.pageNumber>1) {
this.data.push(...json.data.list)
}
this.totalPageNumer = json.data.totalPage;
if (this.data.length > 0) {
this.isEmptyViewVisible = false;
} else {
this.isEmptyViewVisible = true;
}
} else {
promptAction.showToast({ message: json.message, duration: 1000 })
}
}).catch((err: BusinessError) => {
this.dialog.close();
this.controller.refreshError();
console.info(`Response fails: ${err}`);
})
}
commitKeJian() {
const entity = {
"content":'我要共享课件',
"expertUuid": authStore.getUser().uuid
} as Record<string,string>
this.dialog.open()
hdHttp.post<string>(BasicConstant.feedBack, entity).then(async (res: HdResponse<string>) => {
this.dialog.close();
console.info('Response delConditionRecord'+res);
let json:Record<string,string | Record<string,string> | Array<Record<string,string>>> = JSON.parse(res+'') as Record<string,string | Record<string,string> | Array<Record<string,string>>>;
if(json.code == '1') {
promptAction.showToast({ message:'谢谢您的支持', duration: 1000 })
} else {
console.error('删除病情记录信息失败:'+json.message)
promptAction.showToast({ message: String(json.message), duration: 1000 })
}
}).catch((err: BusinessError) => {
this.dialog.close();
console.error(`Response fails: ${err}`);
promptAction.showToast({ message: String('分享失败,请重试'), duration: 1000 })
})
}
build() {
Column() {
HdNav({ title: '肝胆课件',showRightIcon: true,rightIcon:$r('app.media.selected_hospital_ws') ,showRightText:false,
rightItemAction:()=>{
router.pushUrl({
url:'pages/SearchPage/VideoSearchPage',
params:{'pageName':'视频'}
})
}})
Column(){
Row(){
Row(){
Text(this.isHotOrNew?'最热':'最新')
.fontSize(16)
.fontColor($r('app.color.main_color'))
Image(this.isHotOrNew?$r('app.media.cb_hot'):$r('app.media.cb_new'))
.width(16)
.height(16)
}
.layoutWeight(1)
.justifyContent(FlexAlign.Center)
.onClick(()=>{
this.isHotOrNew = !this.isHotOrNew
if (this.isHotOrNew) {
this.sort = '1'
} else {
this.sort = '0'
}
this.pageNumber = 1;
this.getApplyList();
})
Blank()
.width(1)
.height(20)
.backgroundColor('#f4f4f4')
Row(){
Text('筛选')
.fontSize(16)
.fontColor(this.selectedTag.length>0?$r('app.color.main_color'):Color.Gray)
Image(this.selectedTag.length>0?$r('app.media.cb_screen_yes'):$r('app.media.cb_screen_no'))
.width(16)
.height(16)
}
.layoutWeight(1)
.justifyContent(FlexAlign.Center)
.onClick(()=>{
this.isShowSC = !this.isShowSC
})
}
.width('100%')
.height(45)
.backgroundColor(Color.White)
}
.width('100%')
.height(50)
.backgroundColor('#f4f4f4')
if (this.isEmptyViewVisible){
EmptyViewComp({promptText:'暂无课件',isVisibility:this.isEmptyViewVisible}).layoutWeight(1)
} else {
PullToRefreshLayout({
scroller:this.scroller,
viewKey:"ListPage",
controller:this.controller,
contentView:()=>{
this.contentView()
},
onRefresh:()=>{
this.pageNumber = 1;
this.getApplyList();
setTimeout(() => {
this.controller.refreshSuccess()
}, 1000)
},
onCanPullRefresh:()=>{
if (!this.scroller.currentOffset()) {
/*处理无数据,为空的情况*/
return true
}
//如果列表到顶,返回true,表示可以下拉,返回false,表示无法下拉
return this.scroller.currentOffset().yOffset <= 0
},
onLoad:()=>{
this.pageNumber++;
this.getApplyList();
setTimeout(() => {
this.controller.loadSuccess()
}, 1000)
},
onCanPullLoad: () => {
if (this.pageNumber >= this.totalPageNumer) {
return false;
} else {
return true;
}
}
}).width('100%').layoutWeight(1).clip(true)
}
Image($r('app.media.kejian_list_right_bottom'))
.width(76)
.height(40)
.position({ x: '100%', y: '100%' })
.translate({ x: -76, y: -106 })
.onClick(()=>{this.alertView.open()})
if (this.isShowSC) {
ScreeningView({type:'6',selectedArray:this.selectedTag,isSelectedItem:(value: TagList[])=>{
this.selectedTag = value
this.isShowSC = false
this.keyWordsStr = value.map(tag => tag.NAME).join(",")
this.pageNumber = 1;
this.getApplyList();
}})
.width('100%')
.height('calc(100% - 152vp)')
}
}
.height('100%')
.width('100%')
.backgroundColor('#F1F3F5')
}
@Builder
contentView() {
List({ scroller: this.scroller }) {
ForEach(this.data, (item: KeJianModel) => {
ListItem() {
KeJianItemComp({item:item})
}
})
}
.width('100%')
.height('100%')
.edgeEffect(EdgeEffect.None)
.scrollBar(BarState.Off)
}
}
@@ -0,0 +1,84 @@
import { HdNav } from "@itcast/basic"
import { router } from "@kit.ArkUI"
@Component
export struct KeepStudyComp {
build() {
Column() {
HdNav({title:'继续教育',showLeftIcon:false,showRightIcon:false,showRightText:false})
Row(){
Image($r('app.media.keepStudy_video_icon'))
.width(50)
.height(50)
.margin({left:10})
.objectFit(ImageFit.Fill)
Column(){
Text('肝胆视频')
.fontSize(16)
Text('数千集精彩报告等您来看')
.fontSize(14)
.margin({top:5})
.fontColor($r('app.color.common_gray_02'))
}
.alignItems(HorizontalAlign.Start)
.margin({left:10,right:10})
.layoutWeight(1)
Image($r('app.media.arrow_right'))
.width(12)
.height(15)
.margin({right:10})
}
.width('95%')
.height(90)
.borderRadius(3)
.backgroundColor(Color.White)
.margin({left:10,top:10,right:10})
.onClick(()=>{
router.pushUrl({
url:'pages/VideoPage/VideoGandanPage',
params:{"page":"首页"}
})
})
Row(){
Image($r('app.media.keepStudy_kejian'))
.width(50)
.height(50)
.margin({left:10})
.objectFit(ImageFit.Fill)
Column(){
Text('肝胆课件')
.fontSize(16)
Text('国内专业优质肝胆课件共享平台')
.fontSize(14)
.margin({top:5})
.fontColor($r('app.color.common_gray_02'))
}
.alignItems(HorizontalAlign.Start)
.margin({left:10,right:10})
.layoutWeight(1)
.onClick(()=>{
router.pushUrl({
url:'pages/Courseware/CoursewarePage'
})
})
Image($r('app.media.arrow_right'))
.width(12)
.height(15)
.margin({right:10})
}
.width('95%')
.height(90)
.borderRadius(3)
.backgroundColor(Color.White)
.margin({left:10,top:10,right:10})
}
.width('100%')
.height('100%')
.backgroundColor('#F1F3F5')
}
}
@@ -0,0 +1,290 @@
import {
authStore,
BasicConstant, EmptyViewComp, hdHttp, HdLoadingDialog, HdNav,
HdResponse,
ScreeningView, TagList } from "@itcast/basic"
import { promptAction, router } from "@kit.ArkUI"
import { PullToRefreshLayout, RefreshController } from "refreshlib"
import { PatientTBean, TeachModel } from '@itcast/basic/src/main/ets/models/TeachModel';
import { ItemCompTeach } from "../views/ItemCompTeach";
import { BusinessError } from "@kit.BasicServicesKit";
import { HashMap } from "@kit.ArkTS";
import { it } from "@ohos/hypium";
@Preview
@Component
export struct SchoolhouseComp {
@State isHotOrNew:boolean = false
@State isShowSC:boolean = false
@State selectedTag:TagList[] = []
@State isEmptyViewVisible: boolean = false; // 控制显隐的状态变量
public controller:RefreshController = new RefreshController();
scroller = new Scroller();
@State pageNumber:number = 1;
@State totalPageNumer:number = 1;
@State data:PatientTBean[]=[];
@State sort:string = '1'
@State keyWordsStr:string = ''
dialog: CustomDialogController = new CustomDialogController({
builder: HdLoadingDialog({ message: '加载中...' }),
customStyle: true,
alignment: DialogAlignment.Center
})
aboutToAppear() {
this.getApplyList();
}
getApplyList() {
const hashMap: HashMap<string, string> = new HashMap();
hashMap.set('page',this.pageNumber.toString());
hashMap.set("type", this.sort);
hashMap.set("keywords", String(this.keyWordsStr));
this.dialog.open()
hdHttp.httpReq<string>(BasicConstant.polularScienceArticleListByKeywordsNew,hashMap).then(async (res: HdResponse<string>) => {
this.dialog.close();
let json:TeachModel = JSON.parse(res+'') as TeachModel;
if(json.code == '1') {
if(this.pageNumber==1) {
this.data=[]
if(json.data!=null) {
this.data = json.data;
}
} else if(this.pageNumber>1) {
this.data.push(...json.data)
}
this.totalPageNumer =json.totalPage;
if (this.data.length > 0) {
this.isEmptyViewVisible = false;
} else {
this.isEmptyViewVisible = true;
}
} else {
promptAction.showToast({ message: json.message, duration: 1000 })
}
}).catch((err: BusinessError) => {
this.dialog.close();
this.controller.refreshError();
console.info(`Response fails: ${err}`);
})
}
build() {
Column() {
HdNav({ title: '患教学堂', showLeftIcon:false , showRightIcon: true,rightIcon:$r('app.media.schoolhouse_navigation_right'),showRightText:false,
rightItemAction:()=>{
router.pushUrl({
url: 'pages/WebView/WebPage',
params: {'title':'投稿','url':'http://doc.igandan.com/app/html/news/f771025027f2486493d9daa7eb0d9b11.html'}
})
}})
Column(){
Row(){
Text('患教文库')
.fontSize(18)
.fontColor($r('app.color.main_color'))
.height('100%')
.textAlign(TextAlign.Center)
.layoutWeight(1)
Blank()
.width(1)
.height('100%')
.backgroundColor('#f4f4f4')
Text('患教视频')
.fontSize(18)
.fontColor(Color.Gray)
.height('100%')
.textAlign(TextAlign.Center)
.layoutWeight(1)
.onClick(()=>{
router.pushUrl({
url: 'pages/VideoPage/EducationVideoPage'
})
})
Blank()
.width(1)
.height('100%')
.backgroundColor('#f4f4f4')
Text('常见问题')
.fontSize(18)
.fontColor(Color.Gray)
.height('100%')
.textAlign(TextAlign.Center)
.layoutWeight(1)
.onClick(()=>{
router.pushUrl({
url: 'pages/WebView/WebPage',
params: {'title':'常见问题','url':BasicConstant.wxUrl+'wxPatient/index.htm#/problem?link=share'}
})
})
}
.width('100%')
.height(45)
Blank()
.width('100%')
.height(1)
.backgroundColor('#f4f4f4')
Row(){
Row(){
Image($r('app.media.search_no'))
.width(16)
.height(16)
Text('搜索')
.fontSize(16)
.fontColor(Color.Gray)
}
.layoutWeight(1)
.justifyContent(FlexAlign.Center)
.onClick(()=>{
router.pushUrl({
url:'pages/SearchPage/VideoSearchPage',
params:{'pageName':'视频'}
})
})
Blank()
.width(1)
.height(20)
.backgroundColor('#f4f4f4')
Row(){
Text(this.isHotOrNew?'最热':'最新')
.fontSize(16)
.fontColor($r('app.color.main_color'))
Image(this.isHotOrNew?$r('app.media.cb_hot'):$r('app.media.cb_new'))
.width(16)
.height(16)
}
.layoutWeight(1)
.justifyContent(FlexAlign.Center)
.onClick(()=>{
this.isHotOrNew = !this.isHotOrNew
if (this.isHotOrNew) {
this.sort = '2'
} else {
this.sort = '1'
}
this.pageNumber = 1;
this.getApplyList();
})
Blank()
.width(1)
.height(20)
.backgroundColor('#f4f4f4')
Row(){
Text('筛选')
.fontSize(16)
.fontColor(this.selectedTag.length>0?$r('app.color.main_color'):Color.Gray)
Image(this.selectedTag.length>0?$r('app.media.cb_screen_yes'):$r('app.media.cb_screen_no'))
.width(16)
.height(16)
}
.layoutWeight(1)
.justifyContent(FlexAlign.Center)
.onClick(()=>{
this.isShowSC = !this.isShowSC
})
}
.width('100%')
.height(45)
}
.width('100%')
.height(92)
.backgroundColor(Color.White)
if (this.isEmptyViewVisible){
EmptyViewComp({promptText:'暂无科普内容',isVisibility:this.isEmptyViewVisible}).layoutWeight(1)
} else {
PullToRefreshLayout({
scroller:this.scroller,
viewKey:"ListPage",
controller:this.controller,
contentView:()=>{
this.contentView()
},
onRefresh:()=>{
this.pageNumber = 1;
this.getApplyList();
setTimeout(() => {
this.controller.refreshSuccess()
}, 1000)
},
onCanPullRefresh:()=>{
if (!this.scroller.currentOffset()) {
/*处理无数据,为空的情况*/
return true
}
//如果列表到顶,返回true,表示可以下拉,返回false,表示无法下拉
return this.scroller.currentOffset().yOffset <= 0
},
onLoad:()=>{
this.pageNumber++;
this.getApplyList();
setTimeout(() => {
this.controller.loadSuccess()
}, 1000)
},
onCanPullLoad: () => {
if (this.pageNumber >= this.totalPageNumer) {
return false;
} else {
return true;
}
}
}).width('100%').layoutWeight(1).clip(true)
}
if (this.isShowSC) {
ScreeningView({type:'4',selectedArray:this.selectedTag,isSelectedItem:(value: TagList[])=>{
this.selectedTag = value
this.isShowSC = false
this.keyWordsStr = value.map(tag => tag.NAME).join(",")
this.pageNumber = 1;
this.getApplyList();
}})
.width('100%')
.height('calc(100% - 182vp)')
}
}
.height('100%')
.width('100%')
.backgroundColor('#F1F3F5')
}
@Builder
contentView(){
List({ scroller: this.scroller }) {
ForEach(this.data, (item: PatientTBean, index) => {
ListItem() {
ItemCompTeach({item:item})
.onClick(()=>{this.pushDetailsView(item)})
}
})
}
.width('100%')
.height('100%')
.edgeEffect(EdgeEffect.None)
}
private pushDetailsView(item: PatientTBean) {
const entity = {
"news_article_uuid":item.uuid,
"user_uuid": authStore.getUser().uuid,
"type":'2'
} as Record<string,string>
this.dialog.open()
hdHttp.post<string>(BasicConstant.read, entity).then(async (res: HdResponse<string>) => {
this.dialog.close();
console.info('Response delConditionRecord'+res);
let json:Record<string,string | Record<string,string> | Array<Record<string,string>>> = JSON.parse(res+'') as Record<string,string | Record<string,string> | Array<Record<string,string>>>;
if(json.code == '1') {
router.pushUrl({url:"pages/WebView/EducationDetailsWebPage",params:{"model":item}})
}
}).catch((err: BusinessError) => {
this.dialog.close();
console.error(`Response fails: ${err}`);
promptAction.showToast({ message: String('患教文库数据请求失败!'), duration: 1000 })
})
}
}
@@ -0,0 +1,35 @@
export interface KeJianRequest {
code:string;
data:KeJianList;
message:string;
}
export interface KeJianList {
list:KeJianModel[]
totalPage:number
pageNumber:number
pageSize:number
totalRow:number
}
export interface KeJianModel{
uuid:string;
title:string;
type:string;
price:string;
readnum:string;
providername:string;
hospitalname:string;
discount:string;
preview_path:string;
tags:string;
order_id:string;
downloadername:string;
author:string;
download_path:string;
order_status:string;
create_date:string;
sort:string;
provider:string;
status:string
}
@@ -0,0 +1,68 @@
import { BasicConstant, TimestampUtil } from '@itcast/basic';
import { PatientTBean } from '@itcast/basic/src/main/ets/models/TeachModel';
@Preview
@Component
export struct ItemCompTeach {
@Prop item:PatientTBean;
aboutToAppear(): void {
}
build() {
Column() {
Row() {
Image(BasicConstant.urlHtml+this.item.imgPath).width(114).height(76).alt($r('app.media.home_scroll_default1'))
Column() {
Text(this.item.topic).fontColor($r('app.color.common_gray_01')).fontSize(16) .textOverflow({ overflow: TextOverflow.Ellipsis }).height(40)
.ellipsisMode(EllipsisMode.END).maxLines(2) .textAlign(TextAlign.Start).align(Alignment.TopStart)
.width('100%')
Row() {
Row() {
Text('今日')
.borderRadius(30)
.fontColor(Color.White)
.backgroundColor('#f24d57')
.fontSize(11)
.padding({ left: 5, right: 5,top:2,bottom:2 })
.visibility(TimestampUtil.isToday(this.item.modifyDate) ? Visibility.Visible : Visibility.None)
Text(this.item.modifyDate.length > 10 ? this.item.modifyDate.substring(5, 10) : this.item.modifyDate)
.fontColor($r('app.color.common_gray_03'))
.fontSize(12)
.visibility(!TimestampUtil.isToday(this.item.modifyDate) ? Visibility.Visible : Visibility.None)
}.width(80).align(Alignment.Start)
Row() {
Image($r('app.media.read_commient')).width(10).height(10)
Text(this.item.readnum > 100000 ? this.item.readnum * 1.000 / 10000.00 + '万' : this.item.readnum + '')
.fontColor($r('app.color.common_gray_03')).padding({left:3})
.fontSize(12)
}.width(80).align(Alignment.Start)
Row() {
Image($r('app.media.argee_commient')).width(10).height(10)
Text(this.item.agreenum > 100000 ? this.item.agreenum * 1.000 / 10000.00 + '万' : this.item.agreenum + '')
.fontColor($r('app.color.common_gray_03')).padding({left:3})
.fontSize(12)
}.width(80).align(Alignment.Start)
}
.margin({top:10})
.width('100%')
}.padding({left:10})
.layoutWeight(1)
}.alignSelf(ItemAlign.Start)
.width('100%')
.padding(10)
.onClick(() => {
})
Text().backgroundColor($r('app.color.efefef')).width('100%').height(1)
}
.backgroundColor(Color.White)
}
}
@@ -0,0 +1,139 @@
import { ChangeUtil } from "@itcast/basic";
import { KeJianModel } from "../models/KeJianModel";
@Component
export struct KeJianItemComp {
@Prop item:KeJianModel
build() {
Column() {
Row() {
Image(this.item.type == 'pptx' ? $r('app.media.kejian_type_ppt') :
this.item.type == 'pdf' ? $r('app.media.kejian_type_pdff') :
this.item.type == 'docx' || this.item.type == 'doc' ? $r('app.media.kejian_type_wordd') :
$r('app.media.kejian_type_pdff'))
.margin({ left: 10 })
.size({ width: 60, height: 72 })
Column() {
Text(this.item.title)
.maxLines(2)
.fontSize(16)
Text(this.contentShow(this.item.providername,this.item.hospitalname))
.fontSize(14)
.maxLines(1)
.fontColor('#888888')
.textOverflow({ overflow: TextOverflow.Ellipsis })
.margin({ top: 5, right: 10 })
Row() {
Row() {
Image($r('app.media.read_commient'))
.size({ width: 18, height: 18 })
Text(this.item.readnum + '人阅读')
.margin({ left: 2 })
.fontColor('#999999')
.fontSize(14)
}
.margin({ top: 12 })
if (this.item.price == '0') {
Row() {
Image($r('app.media.kejian_download_icon'))
.size({ width: 15, height: 15 })
Text('免费')
.margin({ left: 2 })
.fontColor('#999999')
.fontSize(14)
}
.margin({ top: 12 ,left: 10 })
} else {
if (Number(this.item.price) > 0) {
if (this.item.discount == '1') {
Row() {
Image($r('app.media.kejian_download_icon'))
.size({ width: 15, height: 15 })
Text('¥')
.margin({ left: 2 })
.fontSize(13)
.fontColor(Color.Red)
Text(this.formatPrice(this.item.price))
.fontColor(Color.Red)
.fontSize(16)
}
.margin({ top: 12 ,left: 10 })
} else if (this.item.discount == '0') {
Row() {
Image($r('app.media.kejian_download_icon'))
.size({ width: 15, height: 15 })
Text('免费')
.margin({ left: 2 })
.fontColor('#999999')
.fontSize(14)
}
.margin({ top: 12 ,left: 10 })
} else if (this.item.discount == '-1') {
} else {
Row() {
Image($r('app.media.kejian_download_icon'))
.size({ width: 15, height: 15 })
Text('¥')
.margin({ left: 2 })
.fontSize(13)
.fontColor(Color.Red)
Text(this.formatPrice2(this.item.price, this.item.discount))
.fontColor(Color.Red)
.fontSize(16)
Text('原价')
.margin({ left: 10 })
.fontSize(12)
.fontColor('#999999')
Text('¥'+this.formatPrice(this.item.price))
.fontSize(12)
.fontColor('#999999')
.decoration({ type: TextDecorationType.LineThrough })
}
.margin({ top: 12 ,left: 10 })
}
}
}
}
.alignItems(VerticalAlign.Bottom)
}
.width('80%')
.margin({ left: 10, right: 10 })
.alignItems(HorizontalAlign.Start)
}
.width('100%')
.padding({top:10,bottom:10})
Blank()
.width('100%')
.height(0.5)
.backgroundColor(Color.Gray)
}
.width('100%')
.backgroundColor(Color.White)
}
private formatPrice(priceStr: string): string {
let priceInFen = parseFloat(priceStr);
let priceInYuan = priceInFen / 100;
return `${priceInYuan.toFixed(2)}`;
}
private formatPrice2(priceStr: string,discount: string): string {
let priceInFen = parseFloat(priceStr);
let priceInYuan = priceInFen / 100 * parseFloat(discount);
return `${priceInYuan.toFixed(2)}`;
}
private contentShow(name:string,hospital:string):string {
let newname:string = ''
let newhospital:string = ''
if (!ChangeUtil.stringIsUndefinedAndNull(name)) {
newname = name
}
if (!ChangeUtil.stringIsUndefinedAndNull(hospital)) {
newhospital = hospital
}
return `${newname} ${newhospital}`
}
}
+11
View File
@@ -0,0 +1,11 @@
{
"module": {
"name": "study",
"type": "har",
"deviceTypes": [
"default",
"tablet",
"2in1"
]
}
}
@@ -0,0 +1,8 @@
{
"float": [
{
"name": "page_text_font_size",
"value": "50fp"
}
]
}
@@ -0,0 +1,8 @@
{
"string": [
{
"name": "page_show",
"value": "page from package"
}
]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

@@ -0,0 +1,5 @@
import abilityTest from './Ability.test';
export default function testsuite() {
abilityTest();
}
+13
View File
@@ -0,0 +1,13 @@
{
"module": {
"name": "study_test",
"type": "feature",
"deviceTypes": [
"default",
"tablet",
"2in1"
],
"deliveryWithInstall": true,
"installationFree": false
}
}
+5
View File
@@ -0,0 +1,5 @@
import localUnitTest from './LocalUnit.test';
export default function testsuite() {
localUnitTest();
}
@@ -0,0 +1,33 @@
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
export default function localUnitTest() {
describe('localUnitTest', () => {
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(() => {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
});
beforeEach(() => {
// Presets an action, which is performed before each unit test case starts.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: preset action function.
});
afterEach(() => {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
});
afterAll(() => {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
});
it('assertContain', 0, () => {
// Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
let a = 'abc';
let b = 'b';
// Defines a variety of assertion methods, which are used to declare expected boolean conditions.
expect(a).assertContain(b);
expect(a).assertEqual(a);
});
});
}