From 91726b87c5513e8b2d5b14cb4baa2a2ae4e3d471 Mon Sep 17 00:00:00 2001 From: zoujiandong <10130823232@qq.com> Date: Fri, 21 Nov 2025 17:49:39 +0800 Subject: [PATCH] =?UTF-8?q?11.21=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api.js | 3 + pages.json | 21 + pages_app/downLoadVideo/downLoadVideo.vue | 898 ++++++++++++++++++ pages_app/videoDetail/videoDetail.vue | 425 ++++++--- static/down_false.png | Bin 0 -> 1617 bytes static/down_true.png | Bin 0 -> 1652 bytes store/downloadStoreVideo.js | 149 +++ tsconfig.json | 1 + uni_modules/sunny-video/changelog.md | 27 + .../components/sunny-video/index.scss | 189 ++++ .../components/sunny-video/props.ts | 105 ++ .../components/sunny-video/sunny-video.vue | 459 +++++++++ .../components/sunny-video/type.ts | 32 + .../components/sunny-video/utils.ts | 61 ++ .../sunny-video/vue-composition-api.ts | 16 + uni_modules/sunny-video/package.json | 86 ++ uni_modules/sunny-video/readme.md | 130 +++ uni_modules/sunny-video/static/play.png | Bin 0 -> 1357 bytes 18 files changed, 2483 insertions(+), 119 deletions(-) create mode 100644 pages_app/downLoadVideo/downLoadVideo.vue create mode 100644 static/down_false.png create mode 100644 static/down_true.png create mode 100644 store/downloadStoreVideo.js create mode 100644 uni_modules/sunny-video/changelog.md create mode 100644 uni_modules/sunny-video/components/sunny-video/index.scss create mode 100644 uni_modules/sunny-video/components/sunny-video/props.ts create mode 100644 uni_modules/sunny-video/components/sunny-video/sunny-video.vue create mode 100644 uni_modules/sunny-video/components/sunny-video/type.ts create mode 100644 uni_modules/sunny-video/components/sunny-video/utils.ts create mode 100644 uni_modules/sunny-video/components/sunny-video/vue-composition-api.ts create mode 100644 uni_modules/sunny-video/package.json create mode 100644 uni_modules/sunny-video/readme.md create mode 100644 uni_modules/sunny-video/static/play.png diff --git a/api/api.js b/api/api.js index dc68360..6b0956e 100644 --- a/api/api.js +++ b/api/api.js @@ -651,6 +651,9 @@ const api = { patientVideoByJingHuaNew(data){ return request('/expertAPI/patientVideoByJingHuaNew', data, 'post', false); }, + useWelfareNum(data){ + return request('/expertAPI/useWelfareNum', data, 'post', false); + }, } export default api \ No newline at end of file diff --git a/pages.json b/pages.json index dde06f3..48e7bf2 100644 --- a/pages.json +++ b/pages.json @@ -281,6 +281,17 @@ } } }, + { + "path": "reply/reply", + "style": { + "navigationStyle": "custom", + "navigationBarRightButton":{ "hide": true}, + "navigationBarTitleText": "回复", + "app": { + "bounce": "none" + } + } + }, { "path": "video/video", "style": { @@ -292,6 +303,16 @@ } } }, + { + "path": "downLoadVideo/downLoadVideo", + "style": { + "navigationStyle": "custom", + "navigationBarTitleText": "uni-app分页", + "app": { + "bounce": "none" + } + } + }, { "path": "patientVideo/patientVideo", "style": { diff --git a/pages_app/downLoadVideo/downLoadVideo.vue b/pages_app/downLoadVideo/downLoadVideo.vue new file mode 100644 index 0000000..4cdba29 --- /dev/null +++ b/pages_app/downLoadVideo/downLoadVideo.vue @@ -0,0 +1,898 @@ + + + + + + diff --git a/pages_app/videoDetail/videoDetail.vue b/pages_app/videoDetail/videoDetail.vue index a9a1d87..e051a61 100644 --- a/pages_app/videoDetail/videoDetail.vue +++ b/pages_app/videoDetail/videoDetail.vue @@ -10,7 +10,7 @@ backgroundColor="#eeeeee" > + + \ No newline at end of file diff --git a/uni_modules/sunny-video/components/sunny-video/type.ts b/uni_modules/sunny-video/components/sunny-video/type.ts new file mode 100644 index 0000000..afb2dab --- /dev/null +++ b/uni_modules/sunny-video/components/sunny-video/type.ts @@ -0,0 +1,32 @@ +// @ts-nocheck +export interface Props { + +} + +export type rateListData = { + /** 名称 */ + name: string + /** 是否选中 */ + isSelect: boolean +} + +export interface StateData { + /** 视频是否播放过 */ + isPlay: boolean + /** 是否显示原生控件 */ + controls: boolean + /** 是否开启播放手势,即双击切换播放/暂停 */ + enablePlayGesture: boolean + /** 视频播放次数 */ + countPlay: number | string + /** 全屏状态 */ + isFullScreen: boolean + /** 当前倍速 */ + rateText: string + /** 是否显示倍速盒子 */ + isShowRateBox: boolean + /** 控制试看结束内容显示隐藏 */ + visibleTrialEndBox: boolean + /** 控制H5历史播放位置的显示隐藏 */ + showMplayerToast: boolean +} \ No newline at end of file diff --git a/uni_modules/sunny-video/components/sunny-video/utils.ts b/uni_modules/sunny-video/components/sunny-video/utils.ts new file mode 100644 index 0000000..1c79841 --- /dev/null +++ b/uni_modules/sunny-video/components/sunny-video/utils.ts @@ -0,0 +1,61 @@ +// @ts-nocheck + +/** + * @description 用于获取用户传递值的px值 如果用户传递了"xxpx"或者"xxrpx",取出其数值部分,如果是"xxxrpx"还需要用过uni.upx2px进行转换 + * @param {number|string} value 用户传递值的px值 + * @param {boolean} unit + * @returns {number|string} + */ +export const getPx = (value, unit = false)=> { + if (testNumber(value)) { + return unit ? `${value}px` : Number(value) + } + // 如果带有rpx,先取出其数值部分,再转为px值 + if (/(rpx|upx)$/.test(value)) { + return unit ? `${uni.upx2px(parseInt(value))}px` : Number(uni.upx2px(parseInt(value))) + } + return unit ? `${parseInt(value)}px` : parseInt(value) +} +/** + * @description 添加单位,如果有rpx,upx,%,px等单位结尾或者值为auto,直接返回,否则加上px单位结尾 + * @param {string|number} value 需要添加单位的值 + * @param {string} unit 添加的单位名 比如px + */ +export const addUnit =(value = 'auto', unit = 'px')=> { + value = String(value) + // number判断是否为数值 + return testNumber(value) ? `${value}${unit}` : value +} +/** + * 验证十进制数字 + */ +function testNumber(value) { + return /^[\+-]?(\d+\.?\d*|\.\d+|\d\.\d+e\+\d+)$/.test(value) +} +/** + * @description 获取系统信息同步接口 + * @link 获取系统信息同步接口 https://uniapp.dcloud.io/api/system/info?id=getsysteminfosync + */ +export const sys=()=> { + return uni.getSystemInfoSync() +} +/** + * 将秒转时分秒 + * @param {number} 数字 + */ +export const convertSecondsToHMS =(seconds)=> { + const hours = Math.floor(seconds / 3600); + const minutes = Math.floor((seconds % 3600) / 60); + const remainingSeconds = seconds % 60; + + // 在数字小于10时,在前面补零 + const minutesStr = minutes < 10 ? "0" + minutes : minutes; + const secondsStr = remainingSeconds < 10 ? "0" + remainingSeconds : remainingSeconds; + + if (hours === 0) { + return minutesStr + ":" + secondsStr; + } else { + const hoursStr = hours < 10 ? "0" + hours : hours; + return hoursStr + ":" + minutesStr + ":" + secondsStr; + } +} \ No newline at end of file diff --git a/uni_modules/sunny-video/components/sunny-video/vue-composition-api.ts b/uni_modules/sunny-video/components/sunny-video/vue-composition-api.ts new file mode 100644 index 0000000..07f7135 --- /dev/null +++ b/uni_modules/sunny-video/components/sunny-video/vue-composition-api.ts @@ -0,0 +1,16 @@ +// @ts-nocheck + +// #ifdef VUE3 +export * from 'vue'; +// #endif + +// #ifndef VUE3 +export * from '@vue/composition-api'; + +// #ifdef APP-NVUE +import Vue from 'vue' +import VueCompositionAPI from '@vue/composition-api' +Vue.use(VueCompositionAPI) +// #endif + +// #endif diff --git a/uni_modules/sunny-video/package.json b/uni_modules/sunny-video/package.json new file mode 100644 index 0000000..bb09093 --- /dev/null +++ b/uni_modules/sunny-video/package.json @@ -0,0 +1,86 @@ +{ + "id": "sunny-video", + "displayName": "sunny-video视频倍速试看组件", + "version": "2.0.0", + "description": "sunny-video简单的视频倍速播放插件,基于uni video,增加倍速播放、视频试看,兼容APP及微信小程序。", + "keywords": [ + "sunny-video", + "视频播放组件", + "视频倍速", + "video", + "视频试看" + ], + "repository": "", + "engines": { + "HBuilderX": "^4.0" + }, + "dcloudext": { + "type": "component-vue", + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "2304493354" + }, + "declaration": { + "ads": "无", + "data": "无", + "permissions": "无" + }, + "npmurl": "" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "y", + "aliyun": "y", + "alipay": "n" + }, + "client": { + "Vue": { + "vue2": "y", + "vue3": "y" + }, + "App": { + "app-vue": "y", + "app-nvue": "y" + }, + "H5-mobile": { + "Safari": "u", + "Android Browser": "u", + "微信浏览器(Android)": "y", + "QQ浏览器(Android)": "u" + }, + "H5-pc": { + "Chrome": "u", + "IE": "u", + "Edge": "u", + "Firefox": "u", + "Safari": "u" + }, + "小程序": { + "微信": "y", + "阿里": "u", + "百度": "u", + "字节跳动": "u", + "QQ": "u", + "钉钉": "u", + "快手": "u", + "飞书": "u", + "京东": "u" + }, + "快应用": { + "华为": "u", + "联盟": "u" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/sunny-video/readme.md b/uni_modules/sunny-video/readme.md new file mode 100644 index 0000000..007e1ea --- /dev/null +++ b/uni_modules/sunny-video/readme.md @@ -0,0 +1,130 @@ +# sunny-video视频倍速播放器 +> **组件名:sunny-video** + +### 平台差异说明 +- 目前已应用到APP(安卓、iOS)、微信(小程序、H5) +- 其它平台未测试 + +### 安装方式 + +- 本组件符合[easycom](https://uniapp.dcloud.io/collocation/pages?id=easycom)规范,`HBuilderX 2.5.5`起,只需将本组件导入项目,在页面`template`中即可直接使用,无需在页面中`import`和注册`components`。 +- **uni-app插件市场链接** —— [https://ext.dcloud.net.cn/plugin?id=11982](https://ext.dcloud.net.cn/plugin?id=11982) + +### 基本用法 + +- APP端需要配置`manifest.json>App模块配置`勾选`VideoPlay(视频播放)` +- App端:3.6.14 以及 手机系统 iOS16 以上video全屏 需要配置应用支持横屏: 在`manifest.json` 文件内 `app-plus` 节点下新增 `screenOrientation` 配置,设置值为`["portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"]`。如下: +```json + "app-plus" : { + "screenOrientation" : [ + "portrait-primary", + "portrait-secondary", + "landscape-primary", + "landscape-secondary" + ] + } +``` +#### vue2使用必看 +- 自`2.0.0`开始,本组件使用`composition-api`, 如果你希望在vue2中使用,需要在`main.js`中的`vue2`部分中添加如下关键代码块 +```javascript +// vue2 +import Vue from 'vue' +import VueCompositionAPI from '@vue/composition-api' +Vue.use(VueCompositionAPI) +``` +- 更多说明请查看官方教程[vue-composition-api](https://uniapp.dcloud.net.cn/tutorial/vue-composition-api.html) + +### 代码演示 + +```vue + + + + + +``` + +### Props + +|属性名 | 类型 |默认值 | 可选值 | 说明 | +|:-: | :-: |:-: | :-: | :-: | +|src | String | '' | - | 视频播放地址 | +|loop `1.1.3` | Boolean | false | true | 是否循环播放 | +|muted `1.1.3` | Boolean | false | true | 是否静音播放 | +|autoplay | Boolean | false | true | 是否自动播放 | +|title | String | '' | - | 视频标题 | +|poster | String | '' | - | 视频封面 | +|videoHeight | String, Number| 230px | - | 视频高度 | +|videoWidth `1.1.3` | String, Number| 750rpx | - | 视频宽度 | +|playImgHeight | String, Number| 70rpx | - | 播放图标按钮宽高 | +|playImg | String | base64 | - | 播放按钮图标 | +|showMuteBtn | Boolean | false | true | 是否显示静音按钮 | +|isExitFullScreen | Boolean | true | false | 播放完毕是否退出全屏 | +|tipText `1.1.0` | String | '试看已结束,本片是会员专享内容' | - | 试看提示的文字 | +|btnText `1.1.0` | String | '成为会员免费观看' | - | 试看按钮的文字 | +|trialTime `1.1.0` | Number | 0 | - | 视频试看时间(秒), 不需要试看功能则默认为0 | +|speedBoxWidth `1.1.3` | String, Number| 160rpx | - | 倍速盒子宽度 | +|seekTime `1.2.0` | Number | 0 | - | 跳转到历史观看位置(秒), 不需要则默认为0,注:`H5`为被动 | +|videoId `1.2.1` | String | sunnyVideo | - | 视频唯一ID | +|objectFit `2.0.0` | String | contain | - | 当视频大小与 video 容器大小不一致时,视频的表现形式。contain:包含,fill:填充,cover:覆盖 | + +### 事件 Events + +| 事件名 | 说明 | 返回值 | +|:-: | :-: |:-: | +| play | 监听开始播放 | - | +| pause | 监听视频暂停 | - | +| playError | 视频播放出错时触发 | - | +| videoEnded | 视频播放结束触发 | - | +| timeupdate | 播放进度变化时触发 | event.detail={currentTime, duration}。触发频率 250ms 一次 | +| fullscreenchange `1.1.3` | 当视频进入和退出全屏时触发 | event={fullScreen, direction},direction取为vertical或horizontal | +| handleBtn `1.1.0` | 点击试看按钮时触发 | - | +| trialEnd `1.1.0` | 试看结束时触发 | - | +| changeSeek `1.1.7` | 视频跳转到指定位置时触发 | event= 播放位置单位 s | + +### 方法 Methods + +- 需要通过ref获取组件才能调用 + +| 名称 | 参数 | 说明 | 差异 | +|:-: |:-: |:-: |:-: | +| changePlay | | 开始播放视频 | - | +| changePause `1.1.3` | | 暂停播放视频 | - | +| showTrialEnd `1.1.0` | | 控制试看模块显示 | - | +| closeTrialEnd `1.1.0` | | 控制试看模块隐藏 | - | +| seek `1.1.1` | position | 跳转到指定位置,单位 s | - | +| requestFullScreen `1.1.8` | |进入全屏 | - | +| exitFullScreen `1.1.8` | |退出全屏 | - | +| showStatusBar `1.1.8` | |显示状态栏,仅在iOS全屏下有效 |微信小程序、百度小程序、QQ小程序 | +| hideStatusBar `1.1.8` | |隐藏状态栏,仅在iOS全屏下有效 |微信小程序、百度小程序、QQ小程序 | +| handelStop `1.1.8` | |停止视频 |微信小程序 | + +### 注意事项 +- APP全屏需要按照文档[基本用法](#jump1)进行配置, +- APP端如果需要全屏倍速及试看,需要使用`.nvue`文件 +- `vue2`项目中使用,需要按照文档[vue2使用必看](#jump2)进行配置 +- 问题反馈交流群:[122150481](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=2_xYi389jXJRZwPseVEICL_9trE4RrPU&authKey=nsOJ%2BQd%2Fy3Irv4oKaNnxP6XUwTtHUbBVIy3Tw66WX%2FXgVTGWD%2FgBFGVajuQkWPru&noverify=0&group_code=122150481) diff --git a/uni_modules/sunny-video/static/play.png b/uni_modules/sunny-video/static/play.png new file mode 100644 index 0000000000000000000000000000000000000000..004e85388e1bef8657c6246e980e6c1db44c9065 GIT binary patch literal 1357 zcmV-T1+w~yP)Px)2T4RhRCr$Pn|r8dQxwNP-+%bWBN9@k2;~vU$a`{`7?UzFMtMaBHA0O-&B%<$ zP+pmcDN{muj47|dkmpFsl)Rs%JZexFDU9;fn$GXqch5QZ_c-Tw=jz;5zka`dXYcj+ zp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