diff --git a/.npmrc b/.npmrc
new file mode 100644
index 00000000..0c65878f
--- /dev/null
+++ b/.npmrc
@@ -0,0 +1,14 @@
+# 启用严格模式,确保依赖版本一致
+strict-peer-dependencies=false
+
+# 配置依赖安装目录(pnpm 特有,节省磁盘空间)
+store-dir=~/.pnpm-store
+
+# 兼容 uniapp 对依赖的查找逻辑
+node-linker=hoisted
+
+# 忽略废弃依赖警告
+ignore-deprecations=all
+
+# 忽略对等依赖警告
+strict-peer-dependencies=false
\ No newline at end of file
diff --git a/src/pages/pointsAndRank/badge.vue b/src/pages/pointsAndRank/badge.vue
index 93dc7138..cc0c9dc0 100644
--- a/src/pages/pointsAndRank/badge.vue
+++ b/src/pages/pointsAndRank/badge.vue
@@ -42,7 +42,7 @@
-
+
-
+
diff --git a/src/pages/sparring/components/talk-speaker.vue b/src/pages/sparring/components/talk-speaker.vue
index 1a6225f4..ecbf7d12 100644
--- a/src/pages/sparring/components/talk-speaker.vue
+++ b/src/pages/sparring/components/talk-speaker.vue
@@ -81,7 +81,7 @@
* 音频路由兼容方案(适配 H5/小程序/不支持 setAudioRoute 的设备)
* @param {string} type - earpiece(听筒)/speaker(扬声器)
*/
-
+
export default {
mounted() {
const _this = this;
diff --git a/src/pages/sparring/talk.vue b/src/pages/sparring/talk.vue
index d2d07257..7e67f9ef 100644
--- a/src/pages/sparring/talk.vue
+++ b/src/pages/sparring/talk.vue
@@ -64,7 +64,7 @@
// 关闭通话
const closeTalking = async () => {
// todo 防抖
- common.show('', '挂断'+(isVideoStyle.value?'视频':'电话')+'将结束训练,是否确认?').then((res) => {
+ common.show('', '挂断' + (isVideoStyle.value ? '视频' : '电话') + '将结束训练,是否确认?').then((res) => {
if (res) {
destroy(); // 走关闭销毁流程
}
@@ -113,7 +113,6 @@
console.log('当前分贝', res);
};
- const targetTimestamp = ref(0);
// 定时器实例
let timer = null;
@@ -127,13 +126,15 @@
return `${minutes}:${seconds.toString().padStart(2, '0')}`; // 秒补零
};
+ const targetTimestamp = ref(0);
// 计算属性:实时格式化剩余时间
- const formattedTime = ref(0);
+ const formattedTime = ref('00:00');
// 3. 更新剩余时间的核心方法
const updateRemaining = () => {
const now = Date.now();
const diff = now - targetTimestamp.value;
- formattedTime.value = formatTime(Math.max(0, Math.floor(diff / 1000)));
+ const seconds = Math.max(0, Math.floor(diff / 1000));
+ formattedTime.value = formatTime(seconds);
};
const onStartRecord = (body) => {
@@ -143,7 +144,8 @@
console.log('连接成功开始' + dataInfo.traInterTypDesc);
isRecording.value = true;
isVideo.value && talkCameraRef.value.startPreview();
- timer = setInterval(updateRemaining, 1000);
+ if (timer) clearInterval(timer); // 清除旧的定时器,避免多个定时器叠加
+ timer = setInterval(updateRemaining, 400);
// 立即执行一次
updateRemaining();
talkMicrophoneRef.value.start({
diff --git a/vue.config.js b/vue.config.js
new file mode 100644
index 00000000..f3ba649f
--- /dev/null
+++ b/vue.config.js
@@ -0,0 +1,81 @@
+const { defineConfig } = require('@vue/cli-service');
+const path = require('path');
+
+module.exports = defineConfig({
+ // 基础路径(根据你的部署环境调整)
+ publicPath: './',
+ // 输出目录
+ outputDir: 'dist',
+ // 静态资源目录
+ assetsDir: 'static',
+ // 关闭 eslint 校验(可选,根据项目需求)
+ lintOnSave: false,
+ // webpack 配置
+ configureWebpack: {
+ // 配置路径别名(和 Vite 的 alias 功能一致)
+ resolve: {
+ alias: {
+ '@': path.resolve(__dirname, 'src'),
+ '@/components': path.resolve(__dirname, 'src/components'),
+ '@/utils': path.resolve(__dirname, 'src/utils')
+ }
+ },
+ // 优化打包(可选)
+ optimization: {
+ minimizer: [
+ // 已安装 terser,可配置压缩
+ require('terser-webpack-plugin')({
+ terserOptions: {
+ compress: {
+ drop_console: process.env.NODE_ENV === 'production', // 生产环境移除 console
+ drop_debugger: true // 移除 debugger
+ }
+ }
+ })
+ ]
+ },
+ // 解决可能的依赖冲突
+ resolve: {
+ extensions: ['.vue', '.js', '.jsx', '.json'],
+ fallback: {
+ "crypto": require.resolve("crypto-js"),
+ "text-encoding": require.resolve("text-encoding")
+ }
+ }
+ },
+ // 链式修改 webpack 配置
+ chainWebpack: config => {
+ // 处理 Vue 文件
+ config.module
+ .rule('vue')
+ .test(/\.vue$/)
+ .use('vue-loader')
+ .loader('vue-loader')
+ .end();
+
+ // 处理 SCSS(项目依赖了 sass,需配置 loader)
+ config.module
+ .rule('scss')
+ .test(/\.scss$/)
+ .use('sass-loader')
+ .loader('sass-loader')
+ .options({
+ implementation: require('sass')
+ })
+ .end();
+ },
+ // 环境变量配置(适配你的多环境脚本)
+ devServer: {
+ // 开发服务器配置(如代理、端口等)
+ port: 8080,
+ open: true,
+ proxy: {
+ // 示例:配置接口代理(根据你的项目需求调整)
+ '/api': {
+ target: 'https://your-api-domain.com',
+ changeOrigin: true,
+ pathRewrite: { '^/api': '' }
+ }
+ }
+ }
+});
\ No newline at end of file