From 85e6bfc46e3bff48df8ad2d49d36afb9e8b24030 Mon Sep 17 00:00:00 2001 From: douzhuo <17611323298@163.com> Date: Sat, 2 Apr 2022 15:08:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 26 +- components/uniapp-zaudio/dist/util.d.ts | 10 + components/uniapp-zaudio/dist/util.js | 73 + components/uniapp-zaudio/dist/zaudio.d.ts | 213 ++ components/uniapp-zaudio/dist/zaudio.js | 630 +++++ components/uniapp-zaudio/index.js | 2 + components/uniapp-zaudio/index.scss | 356 +++ components/uniapp-zaudio/static/go.png | Bin 0 -> 333 bytes components/uniapp-zaudio/static/loading.png | Bin 0 -> 331 bytes components/uniapp-zaudio/static/loading2.png | Bin 0 -> 333 bytes components/uniapp-zaudio/static/next.png | Bin 0 -> 535 bytes components/uniapp-zaudio/static/pausebtn.png | Bin 0 -> 189 bytes components/uniapp-zaudio/static/pausebtn2.png | Bin 0 -> 137 bytes components/uniapp-zaudio/static/playbtn.png | Bin 0 -> 274 bytes components/uniapp-zaudio/static/playbtn2.png | Bin 0 -> 181 bytes components/uniapp-zaudio/static/prev.png | Bin 0 -> 508 bytes components/uniapp-zaudio/zaudio.vue | 416 +++ main.js | 10 + manifest.json | 4 +- .../Customerportrait/Detailsofthesearch.vue | 170 +- .../Customerportrait/Receivedetailabout.vue | 2337 ++++++++--------- pages/learning/Equinoctial/index.vue | 289 +- pages/learning/Equinoctial/index2.vue | 2 +- pages/learning/Keywordsearch.vue | 5 +- pages/learning/Thefulltext/index.vue | 2 +- pages/learning/Thefulltext/index2.vue | 306 +-- pages/learning/Thefulltext/search.vue | 8 +- pages/mine/details.vue | 151 +- pages/mine/details2.vue | 333 ++- utils/domain.js | 4 +- utils/util.js | 1048 ++++---- 31 files changed, 4000 insertions(+), 2395 deletions(-) create mode 100644 components/uniapp-zaudio/dist/util.d.ts create mode 100644 components/uniapp-zaudio/dist/util.js create mode 100644 components/uniapp-zaudio/dist/zaudio.d.ts create mode 100644 components/uniapp-zaudio/dist/zaudio.js create mode 100644 components/uniapp-zaudio/index.js create mode 100644 components/uniapp-zaudio/index.scss create mode 100644 components/uniapp-zaudio/static/go.png create mode 100644 components/uniapp-zaudio/static/loading.png create mode 100644 components/uniapp-zaudio/static/loading2.png create mode 100644 components/uniapp-zaudio/static/next.png create mode 100644 components/uniapp-zaudio/static/pausebtn.png create mode 100644 components/uniapp-zaudio/static/pausebtn2.png create mode 100644 components/uniapp-zaudio/static/playbtn.png create mode 100644 components/uniapp-zaudio/static/playbtn2.png create mode 100644 components/uniapp-zaudio/static/prev.png create mode 100644 components/uniapp-zaudio/zaudio.vue diff --git a/App.vue b/App.vue index b11624a..17b4ae9 100644 --- a/App.vue +++ b/App.vue @@ -25,6 +25,28 @@ }, methods: { + + // 时分秒转换为秒 + TIMEEVENT(e) { + var time = e; + var len = time.split(':') + if (len.length == 3) { + var hour = time.split(':')[0]; + var min = time.split(':')[1]; + var sec = time.split(':')[2]; + return Number(hour * 3600) + Number(min * 60) + Number(sec); + } + if (len.length == 2) { + var min = time.split(':')[0]; + var sec = time.split(':')[1]; + return Number(min * 60) + Number(sec); + } + if (len.length == 1) { + var sec = time.split(':')[0]; + return Number(sec); + } + + }, // 目前使用页面为录音页面 SPEAKERSTYLE(index) { let obj = { @@ -138,8 +160,8 @@ let pushon = uni.getStorageSync('weapp_session_userInfo_data').loginName uni.connectSocket({ url: 'wss://hfju.com/ws?uid=' + pushon + '_applets', - header: { - "content-type": "application/json", + header: { + "content-type": "application/json", 'Access-Token': uni.getStorageSync('weapp_session_login_data').token } }); diff --git a/components/uniapp-zaudio/dist/util.d.ts b/components/uniapp-zaudio/dist/util.d.ts new file mode 100644 index 0000000..fe935a1 --- /dev/null +++ b/components/uniapp-zaudio/dist/util.d.ts @@ -0,0 +1,10 @@ +export declare function formatSeconds(seconds: number | string): string; +export declare function throttle(fn: Function, wait: number): Function; +export declare class EventBus { + private _events; + constructor(); + protected on(event: any, action: any, fn: () => {}): void; + private has; + protected emit(event: any, data?: any): void; + protected off(event: any, action: any): void; +} diff --git a/components/uniapp-zaudio/dist/util.js b/components/uniapp-zaudio/dist/util.js new file mode 100644 index 0000000..d55954b --- /dev/null +++ b/components/uniapp-zaudio/dist/util.js @@ -0,0 +1,73 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.EventBus = exports.throttle = exports.formatSeconds = void 0; + +function formatSeconds(seconds) { + var result = typeof seconds === "string" ? parseFloat(seconds) : seconds; + if (isNaN(result)) return ""; + let h = Math.floor(result / 3600) < 10 ? "0" + Math.floor(result / 3600) : Math.floor(result / 3600); + let m = Math.floor((result / 60) % 60) < 10 ? "0" + Math.floor((result / 60) % 60) : Math.floor((result / 60) % 60); + let s = Math.floor(result % 60) < 10 ? "0" + Math.floor(result % 60) : Math.floor(result % 60); + + return `${h}:${m}:${s}`; + //time为毫秒数 +} +exports.formatSeconds = formatSeconds; + +function throttle(fn, wait) { + let previous = 0; + return function(...arg) { + let context = this; + let now = Date.now(); + //每隔一段时间执行一次; + if (now - previous > wait) { + fn.apply(context, arg); + previous = now; + } + }; +} +exports.throttle = throttle; +class EventBus { + constructor() { + this._events = new Map(); + } + on(event, action, fn) { + let arr = this._events.get(event); + let hasAction = arr ? + arr.findIndex((i) => i.action == action) : + -1; + if (hasAction > -1) { + return; + } + this._events.set(event, [ + ...(this._events.get(event) || []), + { + action, + fn, + }, + ]); + } + has(event) { + return this._events.has(event); + } + emit(event, data) { + if (!this.has(event)) { + return; + } + let arr = this._events.get(event); + arr.forEach((i) => { + i.fn(data); + }); + } + off(event, action) { + if (!this.has(event)) { + return; + } + let arr = this._events.get(event); + let newdata = arr.filter((i) => i.action !== action); + this._events.set(event, [...newdata]); + } +} +exports.EventBus = EventBus; diff --git a/components/uniapp-zaudio/dist/zaudio.d.ts b/components/uniapp-zaudio/dist/zaudio.d.ts new file mode 100644 index 0000000..d59f679 --- /dev/null +++ b/components/uniapp-zaudio/dist/zaudio.d.ts @@ -0,0 +1,213 @@ +interface audio { + src: string; + title: string; + singer: string; + coverImgUrl: string; +} +interface audioInfo extends audio { + current: string; + duration: string; + duration_value: number; + current_value: number; +} +declare enum zaudioCbName { + onWaiting = "waiting", + onError = "error", + onTimeUpdate = "playing", + onCanplay = "canPlay", + onPause = "pause", + onEnded = "ended", + setAudio = "setAudio", + updateAudio = "updateAudio", + seek = "seek", + onStop = "stop", + syncStateOn = "syncStateOn" +} +import { EventBus } from "./util"; +/** + * ZAudio类 + * @class ZAudio + * @constructor + * @param {String} defaultCover 音频默认封面 + * @param {Boolean} continuePlay 继续播放,错误播放或结束播放后执行 + * @param {Boolean} autoPlay 自动播放,部分浏览器不支持 + * @property {Number} renderIndex 当前渲染索引 + * @property {} renderinfo 当前渲染数据 + * @property {Array