diff --git a/.env b/.env index f96406d..ae7ac6e 100644 --- a/.env +++ b/.env @@ -1,4 +1,6 @@ -TARO_APP_API=https://shopfix.yaojiankang.top +TARO_APP_API=https://yjx.dev.yaojiankang.top +#TARO_APP_API=https://mooc.yaojiankang.top +#TARO_APP_API=https://shopfix.yaojiankang.top #TARO_APP_API=https://playedu.yaojiankang.top TARO_APP_LGOIN=true diff --git a/src/api/home.ts b/src/api/home.ts new file mode 100644 index 0000000..3b39499 --- /dev/null +++ b/src/api/home.ts @@ -0,0 +1,56 @@ +import {request} from "@/api/request"; + +export interface AdwareParams { + key: string + value: string + + [key: string]: string +} + +export interface AdwareLinkType { + id: number + api_name: string + path: string + param: string +} + +export interface AdwareType { + advert_link: AdwareLinkType + scope_id: number | string + id: number + name: string + status: 0 | 1 // 禁用 + sort: number + image_url: string + image_link: string + start_time: number + end_time?: number +} + +export const HomeApi = { + advert(only_flag: string) { + return request("/home/v1/advert/unique?only_flag=" + only_flag, "GET") + }, + course(page: number, page_size: number) { + return request<{ data: Curriculum[], total: number }>('/home/v1/course/course', "GET", {page, page_size}) + }, + /** 健康管理 */ + healthTop(count: number) { + return request('/home/v1/health/top', "GET", {count}) + }, + health(page: number, page_size: number) { + return request<{ data: Health[], total: number }>('/home/v1/health/index', "GET", {page, page_size}) + }, + /** 增加播放量 */ + healthSetPlay(id) { + return request(`/home/v1/health/set_play/${id}`, "PUT") + }, + /** 品牌 */ + brand(page: number, page_size: number) { + return request<{ data: Brand[], total: number }>('/home/v1/brand/list', "GET", {page, page_size}) + }, + /** 技能 */ + skillTop(count: number) { + return request('/home/v1/skill/top', "GET", {count}) + } +} diff --git a/src/api/index.ts b/src/api/index.ts index c5f843b..e5980b0 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -6,3 +6,5 @@ export * from './public' export * from './manage' export * from './course' export * from './brand' +export * from './home' +export * from './brand' diff --git a/src/app.config.ts b/src/app.config.ts index 301055e..094ed13 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -6,6 +6,7 @@ export default defineAppConfig({ 'pages/login/login', 'pages/check/check', 'pages/my/my', + 'pages/health/health', ], window: { backgroundTextStyle: 'light', @@ -26,8 +27,8 @@ export default defineAppConfig({ { text: '学习', pagePath: 'pages/index/index', - iconPath: "static/tabs/home-unselect.png", - selectedIconPath: "static/tabs/home-selected.png", + iconPath: "static/tabs/study.png", + selectedIconPath: "static/tabs/study-selected.png", }, { text: "我的", @@ -58,6 +59,8 @@ export default defineAppConfig({ 'curHistory/curHistory', 'hourHistory/hourHistory', 'courType/courType', + 'videoFull/videoFull', // 资源id 视频全屏 + 'sort/sort', // 公共二级分类 ] }, { diff --git a/src/components/popPut/popPut.tsx b/src/components/popPut/popPut.tsx index ea557ca..4184ffc 100644 --- a/src/components/popPut/popPut.tsx +++ b/src/components/popPut/popPut.tsx @@ -46,7 +46,7 @@ const PopPut: FC = ({title, chevron, content, image, isProp, children, sh <> - {opt.leftImage && } + {opt.leftImage != null && } {title} diff --git a/src/components/videoCover/videoCover.scss b/src/components/videoCover/videoCover.scss index b9e734b..df662ed 100644 --- a/src/components/videoCover/videoCover.scss +++ b/src/components/videoCover/videoCover.scss @@ -44,7 +44,7 @@ Image { width: 100%; - //height: 100%; + background: #eee; } } diff --git a/src/pages/business/sort/sort.config.ts b/src/pages/business/sort/sort.config.ts new file mode 100644 index 0000000..f54b62b --- /dev/null +++ b/src/pages/business/sort/sort.config.ts @@ -0,0 +1,3 @@ +export default definePageConfig({ + navigationBarTitleText: '分类' +}) diff --git a/src/pages/business/sort/sort.tsx b/src/pages/business/sort/sort.tsx new file mode 100644 index 0000000..f01c221 --- /dev/null +++ b/src/pages/business/sort/sort.tsx @@ -0,0 +1,21 @@ +import {FC} from "react"; +import {View} from "@tarojs/components"; +import {useRouter} from "@tarojs/taro"; + +type SortType = '' + +interface Params { + id: number + type: SortType + jumpUrl: () => void +} + +const Sort: FC = () => { + const params = useRouter().params as unknown as Params + + return ( + ds + ) +} + +export default Sort diff --git a/src/pages/business/videoFull/videoFull.config.ts b/src/pages/business/videoFull/videoFull.config.ts new file mode 100644 index 0000000..82334a5 --- /dev/null +++ b/src/pages/business/videoFull/videoFull.config.ts @@ -0,0 +1,6 @@ +export default definePageConfig({ + navigationBarTitleText: ' ', + backgroundColor:'#000000', + navigationBarTextStyle:'white', + navigationBarBackgroundColor:'#000000' +}) diff --git a/src/pages/business/videoFull/videoFull.tsx b/src/pages/business/videoFull/videoFull.tsx new file mode 100644 index 0000000..c88333b --- /dev/null +++ b/src/pages/business/videoFull/videoFull.tsx @@ -0,0 +1,27 @@ +import {Video} from "@tarojs/components"; +import {FC} from "react"; +import Taro from "@tarojs/taro"; + +interface Props { + url: string +} + +const VideoFull: FC = () => { + const {url} = Taro.useRouter().params + return ( + - + 所属部门 - + {depIds.length ? formatDep() : '选择部门'} diff --git a/src/pages/manage/depAdmin/depAdmin.tsx b/src/pages/manage/depAdmin/depAdmin.tsx index 2956ae4..df6af00 100644 --- a/src/pages/manage/depAdmin/depAdmin.tsx +++ b/src/pages/manage/depAdmin/depAdmin.tsx @@ -159,7 +159,7 @@ const DepAdmin: FC = () => { 添加学员 - showPop(undefined)}>分配部门 + showPop(undefined)}>添加部门 { router.params.id && 更多操作 } diff --git a/src/static/css/module.scss b/src/static/css/module.scss index b440b00..8f57891 100644 --- a/src/static/css/module.scss +++ b/src/static/css/module.scss @@ -84,3 +84,20 @@ taro-button-core::after { color: #fff; font-size: 32rpx; } + +/** 单行文本省略 */ +.text-ellipsis { + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + -o-text-overflow: ellipsis; +} + +/** 多行文本省略 */ +.text-ellipsis-2 { + overflow: hidden; + text-overflow: ellipsis; + -webkit-line-clamp: 2; + display: -webkit-box; + -webkit-box-orient: vertical; +} diff --git a/src/static/img/article.png b/src/static/img/article.png new file mode 100644 index 0000000..2bdac55 Binary files /dev/null and b/src/static/img/article.png differ diff --git a/src/static/img/courseTag.png b/src/static/img/courseTag.png new file mode 100644 index 0000000..257f074 Binary files /dev/null and b/src/static/img/courseTag.png differ diff --git a/src/static/img/first.png b/src/static/img/first.png new file mode 100644 index 0000000..7aa1044 Binary files /dev/null and b/src/static/img/first.png differ diff --git a/src/static/img/health.png b/src/static/img/health.png new file mode 100644 index 0000000..049348e Binary files /dev/null and b/src/static/img/health.png differ diff --git a/src/static/img/illness.png b/src/static/img/illness.png new file mode 100644 index 0000000..d8faaab Binary files /dev/null and b/src/static/img/illness.png differ diff --git a/src/static/img/profession.png b/src/static/img/profession.png new file mode 100644 index 0000000..9be7421 Binary files /dev/null and b/src/static/img/profession.png differ diff --git a/src/static/img/second.png b/src/static/img/second.png new file mode 100644 index 0000000..a225843 Binary files /dev/null and b/src/static/img/second.png differ diff --git a/src/static/img/third.png b/src/static/img/third.png new file mode 100644 index 0000000..8226ada Binary files /dev/null and b/src/static/img/third.png differ diff --git a/src/static/tabs/study-selected.png b/src/static/tabs/study-selected.png new file mode 100644 index 0000000..f0b2de0 Binary files /dev/null and b/src/static/tabs/study-selected.png differ diff --git a/src/static/tabs/study.png b/src/static/tabs/study.png new file mode 100644 index 0000000..05cb70c Binary files /dev/null and b/src/static/tabs/study.png differ diff --git a/src/utils/pathFormt.ts b/src/utils/pathFormt.ts new file mode 100644 index 0000000..95fc525 --- /dev/null +++ b/src/utils/pathFormt.ts @@ -0,0 +1,17 @@ +import {AdwareLinkType, AdwareParams} from "@/api"; +import Taro from "@tarojs/taro"; + +/** 拼接完整路径 */ +export function jumpAdware(advert_link: AdwareLinkType) { + if (advert_link.path && advert_link.param) { + let url = advert_link.path + "?" + const params: AdwareParams[] = JSON.parse(advert_link.param) + params.forEach((d, index) => { + url += d.key + "=" + d.value + if (index !== params.length - 1) { + url += "&" + } + }) + Taro.navigateTo({url}) + } +} diff --git a/types/home.d.ts b/types/home.d.ts new file mode 100644 index 0000000..b9b4c4e --- /dev/null +++ b/types/home.d.ts @@ -0,0 +1,30 @@ +interface Health { + id: number + title: string + introduction: string + url_path: string + resource: Resource + /** 播放量 */ + video_view:number +} + +interface Brand { + id: number + brand_album: string + graphic_introduction: string + name: string + resource: Resource +} + +interface Resource { + id: number + name: string + url: string +} + +interface Kill { + id: number + resource: Resource + title: string + url_path: string +}