搜索页
This commit is contained in:
parent
e0efb15e61
commit
0c2b6c096c
@ -53,3 +53,5 @@ export { EditUserDataItem } from './src/main/ets/Views/EditUserDataItem'
|
||||
export { Huanzhelast444Model } from './src/main/ets/models/Huanzhelast444Model'
|
||||
|
||||
export { huanzheDb } from './src/main/ets/utils/HuanzhelasDbHelper'
|
||||
|
||||
export { HdSearchNav } from './src/main/ets/components/HdSearchNav'
|
||||
@ -14,7 +14,7 @@ export struct HdSearchNav {
|
||||
@Prop
|
||||
leftIcon: ResourceStr = $r('app.media.top_back')
|
||||
@Prop
|
||||
showRightIcon: boolean = true
|
||||
showRightIcon: boolean = false
|
||||
@Prop
|
||||
rightIcon: ResourceStr
|
||||
@Prop
|
||||
@ -22,9 +22,11 @@ export struct HdSearchNav {
|
||||
@Prop
|
||||
rightText: string = ''
|
||||
@Prop
|
||||
rightTextColor: ResourceStr
|
||||
rightTextColor: Color
|
||||
@Prop
|
||||
rightbackColor: ResourceStr = $r('app.color.main_color')
|
||||
@Prop
|
||||
isFocus:boolean = false;
|
||||
|
||||
@State textInputContent:string = ''
|
||||
|
||||
@ -35,20 +37,25 @@ export struct HdSearchNav {
|
||||
.size({ width: 24, height: 24 })
|
||||
.onClick(() => router.back())
|
||||
.fillColor($r('app.color.black'))
|
||||
}.size({ width: 50, height: 50 })
|
||||
}.size({ width: 40, height: 50 })
|
||||
|
||||
Row({space:10}){
|
||||
Row(){
|
||||
Image($r('app.media.selected_hospital_ws'))
|
||||
.width(25).height(25)
|
||||
.margin({left:15})
|
||||
TextInput({placeholder:'搜索视频、过往会议'})
|
||||
.fontSize(15)
|
||||
.width(20).height(20)
|
||||
.margin({left:10})
|
||||
TextInput({placeholder:'搜索视频、过往会议'})
|
||||
.defaultFocus(this.isFocus)
|
||||
.fontSize(15)
|
||||
.backgroundColor(this.bgColor)
|
||||
.height('100%').width('calc(100% - 40vp)')
|
||||
.padding({ left: 0 })
|
||||
.margin({left:5})
|
||||
.onChange((value:string)=>{
|
||||
this.textInputContent = value;
|
||||
})
|
||||
}
|
||||
.borderWidth(0.5).borderRadius(3).borderColor($r('app.color.main_color')).justifyContent(FlexAlign.Start)
|
||||
.borderWidth(1).borderRadius(5).borderColor('#999999').justifyContent(FlexAlign.Start)
|
||||
.width('calc(100% - 100vp)').height(40)
|
||||
|
||||
if (this.showRightIcon) {
|
||||
Row() {
|
||||
@ -65,7 +72,7 @@ export struct HdSearchNav {
|
||||
.backgroundColor(this.rightbackColor)
|
||||
.borderRadius(4)
|
||||
.onClick(()=>this.rightItemAction(this.textInputContent))
|
||||
.width(50)
|
||||
.width(50).height(40).margin({left:10})
|
||||
.textAlign(TextAlign.Center)
|
||||
} else {
|
||||
Blank()
|
||||
|
||||
@ -38,6 +38,7 @@ export class BasicConstant {
|
||||
static readonly videoByKeyWordsNew = BasicConstant.urlExpertApp + "videoByKeyWordsNew";
|
||||
static readonly tagList = BasicConstant.urlExpertApp + "tagList";
|
||||
static readonly meetingListBySearch = BasicConstant.urlExpertAPI + "meetingListBySearch";
|
||||
static readonly videoBySearchNew = BasicConstant.urlExpertApp+'videoBySearchNew'//搜索肝胆视频列表
|
||||
|
||||
static readonly province=['全国','北京市','天津市','河北省','山西省'
|
||||
,'内蒙古自治区','辽宁省','吉林省','黑龙江省','上海市','江苏省','浙江省'
|
||||
|
||||
@ -17,3 +17,11 @@ export { VideoGandan } from './src/main/ets/pages/VideoGandan';
|
||||
export { PLVMockMediaResourceData } from './src/main/ets/polyv/PLVMockMediaResourceData'
|
||||
|
||||
export { VideoDetailsComment } from './src/main/ets/components/VideoDetailsComment'
|
||||
|
||||
export { VideoSearchComp } from './src/main/ets/pages/VideoSearchComp'
|
||||
|
||||
export { VideoList,DataModel,VideoData } from './src/main/ets/model/SearchDataModel'
|
||||
|
||||
export { ItemCompPast } from './src/main/ets/components/ItemCompPastk'
|
||||
|
||||
export { MeetingItemModel,MeetingModel,MeetingModels,ItemModel } from './src/main/ets/model/ItemModel'
|
||||
25
features/Home/src/main/ets/model/SearchDataModel.ets
Normal file
25
features/Home/src/main/ets/model/SearchDataModel.ets
Normal file
@ -0,0 +1,25 @@
|
||||
export interface DataModel {
|
||||
code:number,
|
||||
data:VideoData,
|
||||
message:string
|
||||
}
|
||||
|
||||
export interface VideoData {
|
||||
pageSize:number,
|
||||
list:VideoList[],
|
||||
totalRow:number,
|
||||
pageNumber:number,
|
||||
totalPage:number
|
||||
}
|
||||
|
||||
export interface VideoList {
|
||||
name:string,
|
||||
public_name:string,
|
||||
create_date:string,
|
||||
readnum:string,
|
||||
video_type_name:string,
|
||||
path:string,
|
||||
type_uuid:string,
|
||||
imgpath:string,
|
||||
uuid:string
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
import { HdNav, BasicConstant } from '@itcast/basic'
|
||||
import { ListCompPast } from '../components/ListCompPast'
|
||||
import { promptAction } from '@kit.ArkUI'
|
||||
import { promptAction,router } from '@kit.ArkUI'
|
||||
@Entry
|
||||
@Component
|
||||
export struct PastVideo {
|
||||
@ -30,8 +30,11 @@ export struct PastVideo {
|
||||
build() {
|
||||
Column()
|
||||
{
|
||||
HdNav({ title: '过往会议', showRightIcon: false, showLeftIcon: true,showRightText:true,rightIcon:$r('app.media.selected_hospital_ws'),rightItemAction:()=>{
|
||||
|
||||
HdNav({ title: '过往会议', showRightIcon: true, showLeftIcon: true,showRightText:true,rightIcon:$r('app.media.selected_hospital_ws'),rightItemAction:()=>{
|
||||
router.pushUrl({
|
||||
url:'pages/SearchPage/VideoSearchPage',
|
||||
params:{'pageName':'过往会议'}
|
||||
})
|
||||
}})
|
||||
Row() {
|
||||
Row() {
|
||||
|
||||
51
features/Home/src/main/ets/pages/VideoSearchComp.ets
Normal file
51
features/Home/src/main/ets/pages/VideoSearchComp.ets
Normal file
@ -0,0 +1,51 @@
|
||||
import { VideoList } from '../model/SearchDataModel'
|
||||
|
||||
@Component
|
||||
export struct VideoSearchComp {
|
||||
@Prop model:VideoList;
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
Column() {
|
||||
Text(this.model.name)
|
||||
.fontSize(16).fontColor($r('app.color.main_color'))
|
||||
.margin({left:10,top:10,right:10})
|
||||
Text(this.model.public_name)
|
||||
.fontSize(14).fontColor('#666666')
|
||||
.margin({left:10,top:10,right:10})
|
||||
Row(){
|
||||
Text(this.model.create_date.length>10?this.model.create_date.substring(0,10).replace('-','.'):this.model.create_date)
|
||||
.fontSize(12).fontColor('#999999')
|
||||
.textAlign(TextAlign.Center)
|
||||
Blank()
|
||||
Row(){
|
||||
Image($r('app.media.video_look'))
|
||||
.objectFit(ImageFit.Cover)
|
||||
.width(22).height(15)
|
||||
Text(' '+this.model.readnum+'')
|
||||
.fontSize(12).fontColor('#666666')
|
||||
}
|
||||
.justifyContent(FlexAlign.End)
|
||||
.width(150)
|
||||
.margin({right:10})
|
||||
}
|
||||
.justifyContent(FlexAlign.SpaceBetween)
|
||||
.margin({left:10,top:10,right:10}).width('98%')
|
||||
Blank()
|
||||
.backgroundColor('#999999').height(0.5).margin({left:10,top:10,right:5})
|
||||
Text(this.model.video_type_name)
|
||||
.fontSize(12).fontColor('#666666')
|
||||
.margin({left:10,top:10,right:10,bottom:10})
|
||||
}
|
||||
.margin({left:10,right:10,top:10})
|
||||
.backgroundColor(Color.White)
|
||||
.borderRadius(5)
|
||||
.width('calc(100% - 20vp)')
|
||||
.height('auto')
|
||||
.justifyContent(FlexAlign.Start)
|
||||
.alignItems(HorizontalAlign.Start)
|
||||
}
|
||||
.width('100%')
|
||||
.height('auto')
|
||||
}
|
||||
}
|
||||
@ -1,27 +1,229 @@
|
||||
import { HdNav } from '@itcast/basic'
|
||||
import { HdSearchNav,EmptyViewComp,HdList,HdListController,HdLoadingDialog,hdHttp,HdResponse,BasicConstant } from '@itcast/basic'
|
||||
import { router,promptAction } from '@kit.ArkUI';
|
||||
import { VideoSearchComp } from 'home'
|
||||
import { VideoList,DataModel,MeetingItemModel,ItemModel,MeetingModels } from 'home'
|
||||
import HashMap from '@ohos.util.HashMap';
|
||||
import { BusinessError } from '@kit.BasicServicesKit';
|
||||
import inputMethod from '@ohos.inputMethod';
|
||||
import { ItemCompPast } from 'home'
|
||||
|
||||
@Entry
|
||||
@Component
|
||||
struct VideoSearchPage {
|
||||
@State message: string = 'Hello World';
|
||||
@State params:Record<string, string> = router.getParams() as Record<string, string>;
|
||||
@State isSearchData: boolean = true;
|
||||
@State searchVideoList:VideoList[] = [];
|
||||
@State meetinglist: ItemModel[] = []
|
||||
@State uploadTimeStatus:boolean = true;
|
||||
@State clickStatus:boolean = false;
|
||||
@State inputText:string = '';
|
||||
@State sort:string = '2';
|
||||
controller = new HdListController()
|
||||
@State page: number = 1
|
||||
|
||||
dialog: CustomDialogController = new CustomDialogController({
|
||||
builder: HdLoadingDialog({ message: '加载中...' }),
|
||||
customStyle: true,
|
||||
alignment: DialogAlignment.Center
|
||||
})
|
||||
|
||||
onRefresh(){
|
||||
this.page = 1
|
||||
this.initData(0)
|
||||
}
|
||||
|
||||
initData(type:number){
|
||||
if (this.params.pageName === '视频') {
|
||||
this.uploadData(type);
|
||||
} else {
|
||||
this.uploadOldMeetingList(type)
|
||||
}
|
||||
}
|
||||
|
||||
uploadData(type:number) {
|
||||
inputMethod.getController().hideTextInput();//关闭键盘
|
||||
const hashMap: HashMap<string, string> = new HashMap();
|
||||
hashMap.set('page',this.page.toString());
|
||||
hashMap.set('name',this.inputText);
|
||||
hashMap.set('sort',this.sort);
|
||||
hdHttp.httpReq<string>(BasicConstant.videoBySearchNew,hashMap).then(async (res: HdResponse<string>) => {
|
||||
this.dialog.close()
|
||||
let json:DataModel = JSON.parse(res+'') as DataModel;
|
||||
if(type==0) {
|
||||
this.controller.refreshed()
|
||||
} else {
|
||||
this.controller.loaded()
|
||||
}
|
||||
if(this.page == 1) {
|
||||
this.searchVideoList = []
|
||||
if(json.data!=null&&json.data.list!) {
|
||||
this.searchVideoList = json.data.list;
|
||||
}
|
||||
} else if(this.page>1&&json.data!=null&&json.data.list!=null&&json.data.list.length>0) {
|
||||
this.searchVideoList.push(...json.data.list)
|
||||
}
|
||||
if (this.page >= json.data.pageNumber) {
|
||||
this.controller.finished()
|
||||
} else {
|
||||
this.page++
|
||||
}
|
||||
if (this.searchVideoList.length > 0) {
|
||||
this.isSearchData = false;
|
||||
} else {
|
||||
this.isSearchData = true;
|
||||
}
|
||||
}).catch((err: BusinessError) => {
|
||||
this.dialog.close()
|
||||
this.controller.finished()
|
||||
if (this.searchVideoList.length > 0) {
|
||||
this.isSearchData = false;
|
||||
} else {
|
||||
this.isSearchData = true;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
uploadOldMeetingList(type:number) {
|
||||
inputMethod.getController().hideTextInput();//关闭键盘
|
||||
const hashMap: HashMap<string, string> = new HashMap();
|
||||
hashMap.set('page',this.page.toString());
|
||||
hashMap.set('title',this.inputText);
|
||||
hashMap.set('year','');
|
||||
hashMap.set('month','');
|
||||
hdHttp.httpReq<string>(BasicConstant.meetingHistoryList,hashMap).then(async (res: HdResponse<string>) => {
|
||||
this.dialog.close()
|
||||
let json:MeetingModels = JSON.parse(res+'') as MeetingModels;
|
||||
if(type==0) {
|
||||
this.controller.refreshed()
|
||||
} else {
|
||||
this.controller.loaded()
|
||||
}
|
||||
// if(this.page==1&&json.data.list!=null&&json.data.list.length>0)
|
||||
if(this.page==1) {
|
||||
this.meetinglist=[]
|
||||
if(json.data!=null&&json.data.list!) {
|
||||
this.meetinglist = json.data.list
|
||||
}
|
||||
} else if(this.page>1&&json.data!=null&&json.data.list!=null&&json.data.list.length>0) {
|
||||
this.meetinglist.push(...json.data.list)
|
||||
}
|
||||
this.getPosition()
|
||||
if (this.page >= json.data.pages) {
|
||||
this.controller.finished()
|
||||
} else {
|
||||
this.page++
|
||||
}
|
||||
if (this.meetinglist.length > 0) {
|
||||
this.isSearchData = false;
|
||||
} else {
|
||||
this.isSearchData = true;
|
||||
}
|
||||
}).catch((err: BusinessError) => {
|
||||
this.dialog.close()
|
||||
this.controller.finished()
|
||||
if (this.searchVideoList.length > 0) {
|
||||
this.isSearchData = false;
|
||||
} else {
|
||||
this.isSearchData = true;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
getPosition() {
|
||||
let DatasList: string[] = [];
|
||||
let count = 0;
|
||||
for (let i = 0; i < this.meetinglist.length; i++) {
|
||||
if (!DatasList.includes(this.meetinglist[i].begin_date
|
||||
.substring(0, 7))) {
|
||||
DatasList.push(this.meetinglist[i].begin_date.substring(0, 7));
|
||||
count = 0;
|
||||
this.meetinglist[i].count = count;
|
||||
} else {
|
||||
count++;
|
||||
this.meetinglist[i].count = count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
build() {
|
||||
Column() {
|
||||
// HdNav({showLeftIcon:true,showRightText:true,rightText:'搜索'})
|
||||
Text(this.message)
|
||||
.id('VideoSearchPageHelloWorld')
|
||||
.fontSize($r('app.float.page_text_font_size'))
|
||||
.fontWeight(FontWeight.Bold)
|
||||
.alignRules({
|
||||
center: { anchor: '__container__', align: VerticalAlign.Center },
|
||||
middle: { anchor: '__container__', align: HorizontalAlign.Center }
|
||||
})
|
||||
HdSearchNav({showRightText:true,rightText:'搜素',rightTextColor:Color.White,isFocus:true,rightItemAction:(value: string)=>{
|
||||
this.inputText = value;
|
||||
this.onRefresh();
|
||||
}})
|
||||
if (this.isSearchData){
|
||||
EmptyViewComp({promptText:'暂无搜索数据',isVisibility:this.isSearchData})
|
||||
.width('100%')
|
||||
.height('100%')
|
||||
} else {
|
||||
if (this.params.pageName === '视频') {
|
||||
Column() {
|
||||
Row(){
|
||||
Text('上传时间')
|
||||
.fontSize(16)
|
||||
.fontColor(this.uploadTimeStatus?$r('app.color.main_color'):'#666666')
|
||||
.width('50%').textAlign(TextAlign.Center)
|
||||
.onClick(()=>{
|
||||
this.message = 'Welcome';
|
||||
this.sort = '2';
|
||||
this.uploadTimeStatus = true;
|
||||
this.clickStatus = false;
|
||||
this.uploadData(1)
|
||||
})
|
||||
Blank()
|
||||
.backgroundColor('#666666')
|
||||
.width(1)
|
||||
.height('60%')
|
||||
Text('点播量')
|
||||
.fontSize(16)
|
||||
.fontColor(this.clickStatus?$r('app.color.main_color'):'#666666')
|
||||
.width('50%').textAlign(TextAlign.Center)
|
||||
.onClick(()=>{
|
||||
this.sort = '1';
|
||||
this.uploadTimeStatus = false;
|
||||
this.clickStatus = true;
|
||||
this.uploadData(1)
|
||||
})
|
||||
}.width('100%').height(45).backgroundColor(Color.White)
|
||||
HdList({
|
||||
lw: 1,
|
||||
controller: this.controller,
|
||||
onRefresh: () => {
|
||||
this.onRefresh()
|
||||
},
|
||||
onLoad:() => {
|
||||
this.initData(1)
|
||||
}
|
||||
}) {
|
||||
ForEach(this.searchVideoList, (item: VideoList) => {
|
||||
ListItem() {
|
||||
VideoSearchComp({ model: item })
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
.layoutWeight(1)//权重自定义
|
||||
} else {//过往会议的
|
||||
HdList({
|
||||
lw: 1,
|
||||
controller: this.controller,
|
||||
onRefresh: () => {
|
||||
this.onRefresh()
|
||||
},
|
||||
onLoad:() => {
|
||||
this.initData(1)
|
||||
}
|
||||
}) {
|
||||
ForEach(this.meetinglist, (item: MeetingItemModel) => {
|
||||
ListItem() {
|
||||
ItemCompPast({ item })
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.height('100%')
|
||||
.width('100%')
|
||||
.backgroundColor(Color.White)
|
||||
.backgroundColor('#f4f4f4')
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user