diff --git a/.local.config.js.example b/.local.config.js.example index 28cf028..6386cb0 100644 --- a/.local.config.js.example +++ b/.local.config.js.example @@ -38,6 +38,10 @@ const localDevConfig = ({ uniacid: 1, domain: 'https://test.aigc-quickapp.com', }, + 'local-2': { // 测试平台 + uniacid: 2, + domain: 'http://localhost:8050/', + }, })['2811']; // 选择要使用的环境配置 export default localDevConfig; \ No newline at end of file diff --git a/common/js/share.js b/common/js/share.js new file mode 100644 index 0000000..65924c9 --- /dev/null +++ b/common/js/share.js @@ -0,0 +1,100 @@ +// 文件分享工具函数 +export default { + /** + * 生成文件预览链接 + * @param {Object} file - 文件对象,包含 name 和 url 属性 + * @returns {string} - 生成的文件预览链接 + */ + generateFilePreviewUrl(file) { + // 推断文件类型 + let fileType = ''; + if (file.name) { + const ext = file.name.split('.').pop().toLowerCase(); + if (['pdf'].includes(ext)) { + fileType = 'pdf'; + } else if (['doc', 'docx'].includes(ext)) { + fileType = 'word'; + } else if (['mp4', 'avi', 'mov', 'wmv', 'flv', 'mkv'].includes(ext)) { + fileType = 'video'; + } + } + + // 构建文件预览链接 + const previewUrl = `/pages_tool/file-preview/file-preview?fileName=${encodeURIComponent(file.name)}&fileUrl=${encodeURIComponent(file.url || '')}&fileType=${encodeURIComponent(fileType)}`; + return previewUrl; + }, + + /** + * 分享文件 + * @param {Object} file - 文件对象,包含 name 和 url 属性 + * @param {string} title - 分享标题,默认使用文件名 + * @param {string} desc - 分享描述,默认使用固定文案 + */ + shareFile(file, title = file.name, desc = '查看企业文件:' + file.name) { + // 生成文件预览链接 + const filePreviewUrl = this.generateFilePreviewUrl(file); + + // #ifdef H5 + // H5 平台分享 + if (navigator.share) { + // 使用 Web Share API + navigator.share({ + title: title, + text: desc, + url: filePreviewUrl + }).catch(err => { + console.error('分享失败:', err); + uni.showToast({ title: '分享失败', icon: 'none' }); + }); + } else { + // 不支持 Web Share API 的浏览器 + uni.setClipboardData({ + data: filePreviewUrl, + success: () => { + uni.showToast({ title: '链接已复制,请粘贴分享', icon: 'success' }); + }, + fail: () => { + uni.showToast({ title: '复制失败', icon: 'none' }); + } + }); + } + // #endif + + // #ifdef MP-WEIXIN + // 微信小程序分享 + uni.showActionSheet({ + itemList: ['发送给朋友', '分享到朋友圈'], + success: (res) => { + if (res.tapIndex === 0) { + // 发送给朋友 + uni.shareAppMessage({ + title: title, + path: filePreviewUrl, + success: () => { + uni.showToast({ title: '分享成功', icon: 'success' }); + }, + fail: () => { + uni.showToast({ title: '分享失败', icon: 'none' }); + } + }); + } else if (res.tapIndex === 1) { + // 分享到朋友圈 + uni.shareTimeline({ + title: desc, + path: filePreviewUrl, + success: () => { + uni.showToast({ title: '分享成功', icon: 'success' }); + }, + fail: () => { + uni.showToast({ title: '分享失败', icon: 'none' }); + } + }); + } + }, + fail: () => { + // 用户取消分享 + } + }); + // #endif + } +}; \ No newline at end of file diff --git a/common/js/util.js b/common/js/util.js index 8fc002c..24036f4 100644 --- a/common/js/util.js +++ b/common/js/util.js @@ -94,7 +94,7 @@ export const checkTabBarActive = (linkUrl, currentPageRoute) => { const currentPageRouteParts = currentPageRoute.split('/'); // console.log('diy-bottom-nav verify:', { linkUrlParts, currentPageRouteParts}); - + try { // 二级页面 if (linkUrlParts[2] === currentPageRouteParts[2]) { @@ -655,7 +655,6 @@ export default { } else if (link.appid) { // 跳转其他小程序 - uni.navigateToMiniProgram({ appId: link.appid, path: link.page @@ -663,7 +662,6 @@ export default { } else if (link.name == 'MOBILE' && !link.wap_url) { // 拨打电话 - uni.makePhoneCall({ phoneNumber: link.mobile, success: (res) => { @@ -1210,7 +1208,7 @@ export default { // 但是会包含uniacid参数,所以这里通过uniacid参数来判断是否为快应用环境 _isQuickApp = ua.indexOf('uniacid=') !== -1; } - } catch (e) {} + } catch (e) { } if (!_isQuickApp) { const systemInfo = this.getDeviceInfo(); @@ -1230,9 +1228,36 @@ export default { // #ifndef QUICKAPP-WEBVIEW-HUAWEI const systemInfo = this.getDeviceInfo(); - return systemInfo.brand === 'HUAWEI' || systemInfo.manufacturer === 'HUAWEI' || - (typeof qh !== 'undefined' && qh.platform === 'huawei'); + return systemInfo.brand === 'HUAWEI' || systemInfo.manufacturer === 'HUAWEI' || + (typeof qh !== 'undefined' && qh.platform === 'huawei'); // #endif return true; + }, + + /** + * 蛇形命名转驼峰命名 + * @param {string} str 蛇形命名字符串 + * @returns {string} 驼峰命名字符串 + */ + snakeToCamel(str) { + return str.replace(/_([a-z])/g, (_, letter) => letter.toUpperCase()); + }, + + /** + * 蛇形命名转驼峰命名(递归处理对象中的所有属性名) + * @param {Object} obj 包含蛇形命名字符串属性的对象 + * @returns {Object} 驼峰命名字符串属性的对象 + */ + snakeToCamelForObj(obj) { + if (typeof obj !== 'object' || obj === null) return obj; + if (Array.isArray(obj)) return obj.map(this.snakeToCamelForObj.bind(this)); + const newObj = {}; + for (const key in obj) { + if (Object.hasOwnProperty.call(obj, key)) { + const newKey = this.snakeToCamel(key); + newObj[newKey] = this.snakeToCamelForObj(obj[key]); + } + } + return newObj; } } \ No newline at end of file diff --git a/components-diy/css/common-channel.scss b/components-diy/css/common-channel.scss new file mode 100644 index 0000000..8a1cad6 --- /dev/null +++ b/components-diy/css/common-channel.scss @@ -0,0 +1,143 @@ +// 公共微信视频号样式 + +// CSS 变量 +:root { + // 尺寸变量 + --channel-play-btn-size: 80rpx; + --channel-play-btn-small-size: 60rpx; + --channel-play-btn-icon-size: 40rpx; + --channel-play-btn-icon-small-size: 30rpx; + --channel-border-radius: 12rpx; + --channel-stats-padding: 10rpx; + --channel-info-wrap-padding: 10rpx 0; + + // 字体变量 + --channel-name-font-size: 28rpx; + --video-title-font-size: 28rpx; + --video-title-small-font-size: 24rpx; + --video-stats-font-size: 24rpx; + --channel-stats-font-size: 20rpx; + + // 颜色变量 + --channel-name-color: #333; + --video-title-color: #333; + --video-title-small-color: #666; + --video-stats-color: #999; + --channel-stats-color: #fff; + --channel-border-color: #f0f0f0; + --channel-play-btn-bg: rgba(0, 0, 0, 0.4); + --channel-stats-bg: linear-gradient(transparent, rgba(0, 0, 0, 0.6)); + + // 间距变量 + --channel-name-margin-bottom: 4rpx; + --video-title-margin-bottom: 8rpx; +} + +// 响应式设计 +@media (max-width: 375px) { + :root { + --channel-play-btn-size: 70rpx; + --channel-play-btn-small-size: 50rpx; + --channel-play-btn-icon-size: 35rpx; + --channel-play-btn-icon-small-size: 25rpx; + --channel-name-font-size: 24rpx; + --video-title-font-size: 24rpx; + } +} + +@media (min-width: 750px) { + :root { + --channel-play-btn-size: 90rpx; + --channel-play-btn-small-size: 70rpx; + --channel-play-btn-icon-size: 45rpx; + --channel-play-btn-icon-small-size: 35rpx; + --channel-name-font-size: 32rpx; + --video-title-font-size: 32rpx; + } +} + +// 播放按钮样式 +.channel-play-btn { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + display: flex; + align-items: center; + justify-content: center; + width: var(--channel-play-btn-size); + height: var(--channel-play-btn-size); + background-color: var(--channel-play-btn-bg); + border-radius: 50%; + + .play-icon { + width: var(--channel-play-btn-icon-size); + height: var(--channel-play-btn-icon-size); + } +} + +// 小尺寸播放按钮(用于列表) +.channel-play-btn.small { + width: var(--channel-play-btn-small-size); + height: var(--channel-play-btn-small-size); + + .play-icon { + width: var(--channel-play-btn-icon-small-size); + height: var(--channel-play-btn-icon-small-size); + } +} + +// 视频统计信息 +.channel-stats { + position: absolute; + bottom: 0; + left: 0; + right: 0; + background: var(--channel-stats-bg); + padding: var(--channel-stats-padding); + color: var(--channel-stats-color); + font-size: var(--channel-stats-font-size); +} + +// 视频信息容器 +.channel-info-wrap { + display: flex; + flex-direction: column; + flex: 1; + padding: var(--channel-info-wrap-padding); + + .channel-name { + margin-bottom: var(--channel-name-margin-bottom); + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + font-size: var(--channel-name-font-size); + font-weight: 500; + color: var(--channel-name-color); + } + + .video-title { + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + font-size: var(--video-title-small-font-size); + color: var(--video-title-small-color); + } +} + +// 视频标题 +.video-title { + font-size: var(--video-title-font-size); + font-weight: 500; + color: var(--video-title-color); + margin-bottom: var(--video-title-margin-bottom); + line-height: 1.4; +} + +// 视频统计信息(非绝对定位版本) +.video-stats { + font-size: var(--video-stats-font-size); + color: var(--video-stats-color); +} + + diff --git a/components-diy/diy-article.vue b/components-diy/diy-article.vue index 5539a1b..2f4097a 100644 --- a/components-diy/diy-article.vue +++ b/components-diy/diy-article.vue @@ -3,7 +3,7 @@ - diff --git a/components-diy/diy-channel-list.vue b/components-diy/diy-channel-list.vue new file mode 100644 index 0000000..a7b582f --- /dev/null +++ b/components-diy/diy-channel-list.vue @@ -0,0 +1,645 @@ + + + + + \ No newline at end of file diff --git a/components-diy/diy-channel-video.vue b/components-diy/diy-channel-video.vue new file mode 100644 index 0000000..66d1061 --- /dev/null +++ b/components-diy/diy-channel-video.vue @@ -0,0 +1,489 @@ + + + + + \ No newline at end of file diff --git a/components-diy/diy-group.vue b/components-diy/diy-group.vue index 16eebc3..6de5241 100644 --- a/components-diy/diy-group.vue +++ b/components-diy/diy-group.vue @@ -251,14 +251,9 @@ - - - + + diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue index 699aa63..6245625 100644 --- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue +++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/time-picker.vue @@ -13,7 +13,7 @@ + :style="[fixNvueBug]"> {{selectTimeText}} diff --git a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue index e844331..53cd13e 100644 --- a/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue +++ b/uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue @@ -28,7 +28,7 @@ - + - + diff --git a/uni_modules/uni-popup/components/uni-popup/uni-popup.vue b/uni_modules/uni-popup/components/uni-popup/uni-popup.vue index f4fa592..7917cf3 100644 --- a/uni_modules/uni-popup/components/uni-popup/uni-popup.vue +++ b/uni_modules/uni-popup/components/uni-popup/uni-popup.vue @@ -1,5 +1,5 @@