Compare commits

..

No commits in common. "master" and "v2.0.2" have entirely different histories.

7485 changed files with 329822 additions and 435164 deletions

13
.gitignore vendored
View File

@ -17,15 +17,6 @@ bin-release/
# should NOT be excluded as they contain compiler settings and other important # should NOT be excluded as they contain compiler settings and other important
# information for Eclipse / Flash Builder. # information for Eclipse / Flash Builder.
/.idea
/upgrade
niucloud/public/.htaccess
niucloud/addon/**/dist
niucloud/app/map
.codebuddy
.workbuddy
docs/
/design
# 小程序 DIY 动态桥接组件(构建期由 uni-app/scripts/generate-diy-dynamic-bridge-mp.cjs 生成,勿手工编辑) /.idea
uni-app/src/components/diy-dynamic-bridge-*/ niucloud/public/.htaccess

36
README.en.md Normal file
View File

@ -0,0 +1,36 @@
# niucloud-admin
#### Description
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
#### Software Architecture
Software architecture description
#### Installation
1. xxxx
2. xxxx
3. xxxx
#### Instructions
1. xxxx
2. xxxx
3. xxxx
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

119
README.md
View File

@ -1,56 +1,97 @@
### NIUCLOUD-ADMIN 是什么?
niucloud-admin-saas是一款快速开发通用管理后台框架,整体功能架构全部精心设计!代码干净整洁!低耦合,高质量!!!前后端API接口完全分离!!!前端采用最新技术**Vite+TypeScript+Vue3+ElementPlus**,后台采用PHP8、MYSQL8、THINKPHP8 全部最新技术栈,内置Workman高性能消息队列,计划任务处理,完全兼容容器路由运行技术。 采用多租户多站点多应用多插件任意组合使用的SAAS架构设计,内置代码生成器,插件生成器,一键云编译、一键云部署,集成用户权限、表单设计、云存储、短信发送、素材中心、微信及公众号、Api模块一系列开箱即用功能,是一款快速搭建开发企业级应用的软件系统。源码100%开源无加密!框架采用MIT协议,终身免费,商用免费!
### niucloud saas PHP开发框架 是什么? 目前NIUCLOUD生态开发者入驻近千人,各行业应用插件正在陆续上线中...
niucloud saas PHP开发框架是一款快速开发通用管理后台框架,前端采用最新的技术栈Vite+TypeScript+Vue3+ElementPlus最流行技术架构,后台结合PHP8、Java SDK、Python等主流后端语言搭建,内置集成用户权限、代码生成器、表单设计、云存储、短信发送、素材中心、微信及公众号、Api模块一系列开箱即用功能,是一款快速可以开发企业级应用的软件系统。
### niucloud saas PHP开发框架 采用的技术亮点 请到官方网站了解更多[http://www.niucloud.com](https://gitee.com/link?target=http%3A%2F%2Fwww.niucloud.com)
- 后台php采用thinkphp8+php8+mysql,支持composer快速安装扩展,支持redis缓存以及消息队列,支持多语言设计开发,同时开发采用严格的restful的api设计开发。 ### NIUCLOUD-ADMIN 技术特点
前端(**Vite+TypeScript+Vue3+ElementPlus**)+**API**接口完全分离 + 后端(**PHP8+THINKPHP8**\) + 数据库(**MYSQL8.0+**)
```
- 支持composer快速安装扩展,支持redis缓存以及消息队列,支持多语言设计开发,采用严格的restful的api设计开发。
- 后台前后端分离采用element-plus、vue3.0、typescript、vite、pina等前端技术,同时使用i18n支持国际化多语言开发。 - 后台前后端分离采用element-plus、vue3.0、typescript、vite、pina等前端技术,同时使用i18n支持国际化多语言开发。
- 手机端采用uniapp前后端分离,使用uview、vue3.0、typescript、vite、pina前端技术,支持h5,微信小程序,支付宝小程序,抖音小程序等使用场景。
- 手机端采用uniapp前后端分离,同时使用uview、vue3.0、typescript、vite、pina等前端技术,同时使用i18n支持国际化多语言开发,可以灵活编译成h5,微信小程序,支付宝小程序,抖音小程序等使用场景。 - niucloud-admin采用多租户的saas系统设计,支持多站点多商户多门店多应用多插件组合使用。
- niucloud-admin前端以及后端采用严格的多语言开发规范,包括前端展示,api接口返回,数据验证,错误返回等全部使用多语言设计规范,使开发者能够真生意义上实现多语言的开发需求。
- niucloud saas PHP开发框架采用多租户的saas系统设计,能够提供企业级软件服务运营 ,同时满足用户多站点,多商户,多门店等系统开发需求。 - niucloud-admin已经搭建好常规系统的开发底层,具体的底层功能包括:管理员管理,权限管理,网站设置,计划任务管理,素材管理,会员管理,会员账户管理,微信公众号以及小程序管理,
支付管理,第三方登录管理,消息管理,短信管理,文章管理,前端装修等全面的基础功能,这样开发者不需要开发基础的结构而专心开发业务。
- niucloud saas PHP开发框架结合当前市面上很多框架结构不规范,导致基础结构不稳定等情况,严格定义了分层设计的开发规范,同时api接口严格采用restful的开发规范,能够满足大型业务系统或者微服务的开发需求。 - niucloud-admin系统内置支持微信/支付宝支付,微信公众号/小程序/短信消息管理,阿里云/腾讯云短信,七牛云/阿里云存储等基础的功能扩展,后续会根据实际业务不断扩展基础组件。
- niucloud-admin结合系统结构特点专门开发了代码生成器,这样开发者根据数据表就可以一键生成基础的业务代码,包括:后台php业务代码以及对应的前端vue代码。
- niucloud saas PHP开发框架前端以及后端采用严格的多语言开发规范,包括前端展示,api接口返回,数据验证,错误返回等全部使用多语言设计规范,使开发者能够真生意义上实现多语言的开发需求。
- niucloud saas PHP开发框架已经搭建好常规系统的开发底层,具体的底层功能包括:管理员管理,权限管理,网站设置,计划任务管理,素材管理,会员管理,会员账户管理,微信公众号以及小程序管理,支付管理,第三方登录管理,消息管理,短信管理,文章管理,前端装修等全面的基础功能,这样开发者不需要开发基础的结构而专心开发业务。
- niucloud saas PHP开发框架系统内置支持微信/支付宝支付,微信公众号/小程序/短信消息管理,阿里云/腾讯云短信,七牛云/阿里云存储等基础的功能扩展,后续会根据实际业务不断扩展基础组件。
- niucloud saas PHP开发框架结合系统结构特点专门开发了代码生成器,这样开发者根据数据表就可以一键生成基础的业务代码,包括:后台php业务代码以及对应的前端vue代码。
- 前端采用标准的element-plus,开发者不需要详细了解前端,只需要用标准的element组件就可以。
- 手机端设计开发了自定义装修,同时提供了基础的开发组件,方便开发者设计开发手机自定义页面装修的开发需求。 - 手机端设计开发了自定义装修,同时提供了基础的开发组件,方便开发者设计开发手机自定义页面装修的开发需求。
- 手机端使用uniapp ,同时使用uview页面展示,可以开发出丰富的手机样式,同时不需要专门学习小程序,app等开发语言,只需要通过uniapp编译就可以。 ```
### V2.* 稳定版说明: ### NIUCLOUD 框架截图
V1版本中,插件安装后采用动态组合源码方式,需要进行一次编译后才能正常访问。由于插件的差异化可能导致编译失败,影响稳定性。 ![](https://doc.press.niucloud.com/assets/%E9%A6%96%E9%A1%B5.DTs6CwoX.png)
![](https://doc.press.niucloud.com/assets/%E5%BA%94%E7%94%A8.DTjKnokp.png)
![](https://doc.press.niucloud.com/assets/%E5%BC%80%E5%8F%91.D-EIbu1a.png)
### 商城插件SHOP
![](https://doc.press.niucloud.com/assets/%E5%95%86%E5%9F%8E%E7%B3%BB%E7%BB%9F.Ocyd9U5x.png)
<table>
<tbody>
<tr>
<td><img src="https://doc.press.niucloud.com/assets/%E5%95%86%E5%9F%8E%E7%95%8C%E9%9D%A27.Bll5k5Oi.jpg"></td>
<td><img src="https://doc.press.niucloud.com/assets/%E5%95%86%E5%9F%8E%E7%95%8C%E9%9D%A28.CWYJfJc4.jpg"></td>
<td><img src="https://doc.press.niucloud.com/assets/%E5%95%86%E5%9F%8E%E7%95%8C%E9%9D%A24.BL9nyNIW.jpg"></td>
<td><img src="https://doc.press.niucloud.com/assets/%E5%95%86%E5%9F%8E%E7%95%8C%E9%9D%A26.D_LsTXAd.jpg"></td>
</tr>
<tr>
<td><img src="https://doc.press.niucloud.com/assets/%E5%95%86%E5%9F%8E%E7%95%8C%E9%9D%A21.DG4KeG7m.jpg"></td>
<td><img src="https://doc.press.niucloud.com/assets/%E5%95%86%E5%9F%8E%E7%95%8C%E9%9D%A22.DUOosIBy.jpg"></td>
<td><img src="https://doc.press.niucloud.com/assets/%E5%95%86%E5%9F%8E%E7%95%8C%E9%9D%A23.DqUGqBi6.jpg"></td>
<td><img src="https://doc.press.niucloud.com/assets/%E5%95%86%E5%9F%8E%E7%95%8C%E9%9D%A25.kD9xOpcL.jpg"></td>
</tr>
</tbody></table>
V2版本引入了分离构建机制,大幅提升插件安装的稳定性和便捷性:
### V2.* 稳定版编译
[编译说明 https://gitee.com/niucloud-team/niucloud/blob/master/v2.0-compile.md](https://gitee.com/niucloud-team/niucloud/blob/master/v2.0-compile.md)
### 操作指南 ### 操作指南
[官网地址](https://www.niucloud.com)
| [服务市场](https://www.niucloud.com) * [官网地址](https://www.niucloud.com)
| [使用手册](https://doc.press.niucloud.com/php/saas-framework/use/)
| [二开手册](https://doc.press.niucloud.com/php/saas-framework/dev/) * [服务市场](https://www.niucloud.com)
| [API接口手册](https://api.niucloud.com/apidoc.html?target_id=001) * [使用手册](https://www.niucloud.com/doc)
| [论坛地址](https://www.niucloud.com/bbs) * [二开手册](https://www.niucloud.com/doc)
* [开发视频](https://www.niucloud.com/doc)
* [API接口手册](https://api.niucloud.com/apidoc.html?target_id=001)
* [论坛地址](https://niucloud.com/bbs)
### 演示地址 ### 演示地址
- 站点后台演示网址:[<a href='http://demo-saas.site.niucloud.com/site' target="_blank"> 查看 </a>]
<a href='http://demo-saas.site.niucloud.com/site' target="_blank">http://demo-saas.site.niucloud.com/site 账号:admin 密码:123456
- 平台后台演示网址:[<a href='http://demo-saas.site.niucloud.com/admin' target="_blank"> 查看 </a>] - 平台后台演示网址:[<a href='http://demo-saas.site.niucloud.com/admin' target="_blank"> 查看 </a>]
<a href='http://demo-saas.site.niucloud.com/admin' target="_blank">http://demo-saas.site.niucloud.com/admin 账号:admin 密码:123456 <a href='http://demo-saas.site.niucloud.com/admin' target="_blank">http://demo-saas.site.niucloud.com/admin</a><br>
账号:admin 密码:123456
- 商城后台演示网址:[<a href='https://demo-saas.site.niucloud.com/site/shop/index' target="_blank"> 查看 </a>]
<a href='https://demo-saas.site.niucloud.com/site/shop/index' target="_blank">http://demo-saas.site.niucloud.com/site/shop/index</a><br>
商城系统账号:admin 密码:123456
- 旅游后台演示网址:[<a href='https://demo-saas.site.niucloud.com/site/tourism/index' target="_blank"> 查看 </a>]
<a href='https://demo-saas.site.niucloud.com/site/tourism/index/' target="_blank">https://demo-saas.site.niucloud.com/site/tourism/index</a><br>
旅游系统账号:admin 密码:123456
- 会员卡后台演示网址:[<a href='https://demo-saas.site.niucloud.com/site/vipcard/index' target="_blank"> 查看 </a>]
<a href='https://demo-saas.site.niucloud.com/site/vipcard/index' target="_blank">https://demo-saas.site.niucloud.com/site/vipcard/index</a><br>
会员卡系统账号:admin 密码:123456
### 加入NIUCLOUD开发者生态,一起助力成就程序员创业梦想!!!
加入企业微信群技术交流,请扫描下面二维码:
<img src="https://doc.press.niucloud.com/assets/%E4%BC%81%E4%B8%9A%E5%BE%AE%E4%BF%A1%E4%BA%8C%E7%BB%B4%E7%A0%81.2X1GoZf1.jpg" alt="企业微信二维码" style="max-width: 200px; border: 1px solid #eee; padding: 10px;">
### 产品LOGO
<img src="https://doc.press.niucloud.com/assets/%E4%BA%A7%E5%93%81logo.BSKlM-Op.png" alt="产品logo" style="max-width: 200px; display: block; margin-bottom: 20px;">
<img src="https://doc.press.niucloud.com/assets/%E4%BA%A7%E5%93%81logo2.Cm3hxmfq.png" style="max-width: 200px; display: block;">
### 开源使用须知 ### 开源使用须知
@ -66,14 +107,10 @@ V2版本引入了分离构建机制,大幅提升插件安装的稳定性和便
6.一切事物有个人喜好的标准,本开源代码意在分享,不喜勿喷。 6.一切事物有个人喜好的标准,本开源代码意在分享,不喜勿喷。
### 版权信息 ### 版权信息
版权所有Copyright © 2015-2030 niucloud 版权所有 版权所有Copyright © 2015-2026 niucloud-admin 版权所有
All rights reserved。
杭州数字云动科技有限公司 杭州数字云动科技有限公司
杭州牛之云科技有限公司 杭州牛之云科技有限公司
提供技术支持 提供技术支持

View File

@ -1,5 +1,6 @@
// Generated by 'unplugin-auto-import' // Generated by 'unplugin-auto-import'
export {} export {}
declare global { declare global {
const ElMessageBox: typeof import('element-plus/es')['ElMessageBox']
const ElNotification: typeof import('element-plus/es')['ElNotification'] const ElNotification: typeof import('element-plus/es')['ElNotification']
} }

39
admin/components.d.ts vendored
View File

@ -7,20 +7,27 @@ export {}
declare module '@vue/runtime-core' { declare module '@vue/runtime-core' {
export interface GlobalComponents { export interface GlobalComponents {
AddUser: typeof import('./src/components/add-user/index.vue')['default']
Attachment: typeof import('./src/components/upload-attachment/attachment.vue')['default'] Attachment: typeof import('./src/components/upload-attachment/attachment.vue')['default']
DiyLink: typeof import('./src/components/diy-link/index.vue')['default'] DiyLink: typeof import('./src/components/diy-link/index.vue')['default']
DiyPage: typeof import('./src/components/diy-page/index.vue')['default'] DiyPage: typeof import('./src/components/diy-page/index.vue')['default']
Editor: typeof import('./src/components/editor/index.vue')['default'] Editor: typeof import('./src/components/editor/index.vue')['default']
ElAlert: typeof import('element-plus/es')['ElAlert']
ElAside: typeof import('element-plus/es')['ElAside']
ElAvatar: typeof import('element-plus/es')['ElAvatar'] ElAvatar: typeof import('element-plus/es')['ElAvatar']
ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb'] ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem'] ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
ElButton: typeof import('element-plus/es')['ElButton'] ElButton: typeof import('element-plus/es')['ElButton']
ElCalendar: typeof import('element-plus/es')['ElCalendar']
ElCard: typeof import('element-plus/es')['ElCard'] ElCard: typeof import('element-plus/es')['ElCard']
ElCarousel: typeof import('element-plus/es')['ElCarousel'] ElCarousel: typeof import('element-plus/es')['ElCarousel']
ElCarouselItem: typeof import('element-plus/es')['ElCarouselItem'] ElCarouselItem: typeof import('element-plus/es')['ElCarouselItem']
ElCascader: typeof import('element-plus/es')['ElCascader']
ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup']
ElCheckTag: typeof import('element-plus/es')['ElCheckTag']
ElCol: typeof import('element-plus/es')['ElCol'] ElCol: typeof import('element-plus/es')['ElCol']
ElCollapse: typeof import('element-plus/es')['ElCollapse']
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
ElColorPicker: typeof import('element-plus/es')['ElColorPicker'] ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider'] ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
ElContainer: typeof import('element-plus/es')['ElContainer'] ElContainer: typeof import('element-plus/es')['ElContainer']
@ -28,10 +35,12 @@ declare module '@vue/runtime-core' {
ElDescriptions: typeof import('element-plus/es')['ElDescriptions'] ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem'] ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
ElDialog: typeof import('element-plus/es')['ElDialog'] ElDialog: typeof import('element-plus/es')['ElDialog']
ElDivider: typeof import('element-plus/es')['ElDivider']
ElDrawer: typeof import('element-plus/es')['ElDrawer'] ElDrawer: typeof import('element-plus/es')['ElDrawer']
ElDropdown: typeof import('element-plus/es')['ElDropdown'] ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem'] ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu'] ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
ElEmpty: typeof import('element-plus/es')['ElEmpty']
ElForm: typeof import('element-plus/es')['ElForm'] ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem'] ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElHeader: typeof import('element-plus/es')['ElHeader'] ElHeader: typeof import('element-plus/es')['ElHeader']
@ -39,16 +48,31 @@ declare module '@vue/runtime-core' {
ElImage: typeof import('element-plus/es')['ElImage'] ElImage: typeof import('element-plus/es')['ElImage']
ElImageViewer: typeof import('element-plus/es')['ElImageViewer'] ElImageViewer: typeof import('element-plus/es')['ElImageViewer']
ElInput: typeof import('element-plus/es')['ElInput'] ElInput: typeof import('element-plus/es')['ElInput']
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
ElLink: typeof import('element-plus/es')['ElLink']
ElMain: typeof import('element-plus/es')['ElMain'] ElMain: typeof import('element-plus/es')['ElMain']
ElMenu: typeof import('element-plus/es')['ElMenu'] ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem'] ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
ElOption: typeof import('element-plus/es')['ElOption'] ElOption: typeof import('element-plus/es')['ElOption']
ElOptionGroup: typeof import('element-plus/es')['ElOptionGroup']
ElPageHeader: typeof import('element-plus/es')['ElPageHeader']
ElPagination: typeof import('element-plus/es')['ElPagination'] ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopover: typeof import('element-plus/es')['ElPopover'] ElPopover: typeof import('element-plus/es')['ElPopover']
ElProgress: typeof import('element-plus/es')['ElProgress'] ElProgress: typeof import('element-plus/es')['ElProgress']
ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElRate: typeof import('element-plus/es')['ElRate']
ElResult: typeof import('element-plus/es')['ElResult']
ElRow: typeof import('element-plus/es')['ElRow'] ElRow: typeof import('element-plus/es')['ElRow']
ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
ElSelect: typeof import('element-plus/es')['ElSelect'] ElSelect: typeof import('element-plus/es')['ElSelect']
ElSkeleton: typeof import('element-plus/es')['ElSkeleton']
ElSkeletonItem: typeof import('element-plus/es')['ElSkeletonItem']
ElSlider: typeof import('element-plus/es')['ElSlider']
ElStatistic: typeof import('element-plus/es')['ElStatistic']
ElStep: typeof import('element-plus/es')['ElStep']
ElSteps: typeof import('element-plus/es')['ElSteps']
ElSubMenu: typeof import('element-plus/es')['ElSubMenu'] ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable'] ElTable: typeof import('element-plus/es')['ElTable']
@ -56,10 +80,15 @@ declare module '@vue/runtime-core' {
ElTabPane: typeof import('element-plus/es')['ElTabPane'] ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs'] ElTabs: typeof import('element-plus/es')['ElTabs']
ElTag: typeof import('element-plus/es')['ElTag'] ElTag: typeof import('element-plus/es')['ElTag']
ElTimeline: typeof import('element-plus/es')['ElTimeline']
ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
ElTimePicker: typeof import('element-plus/es')['ElTimePicker']
ElTimeSelect: typeof import('element-plus/es')['ElTimeSelect']
ElTooltip: typeof import('element-plus/es')['ElTooltip'] ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElTree: typeof import('element-plus/es')['ElTree']
ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
ElUpload: typeof import('element-plus/es')['ElUpload'] ElUpload: typeof import('element-plus/es')['ElUpload']
ExportSure: typeof import('./src/components/export-sure/index.vue')['default'] ExportSure: typeof import('./src/components/export-sure/index.vue')['default']
FileDiff: typeof import('./src/components/file-diff/index.vue')['default']
HeatMap: typeof import('./src/components/heat-map/index.vue')['default'] HeatMap: typeof import('./src/components/heat-map/index.vue')['default']
Icon: typeof import('./src/components/icon/index.vue')['default'] Icon: typeof import('./src/components/icon/index.vue')['default']
MapSelector: typeof import('./src/components/map-selector/index.vue')['default'] MapSelector: typeof import('./src/components/map-selector/index.vue')['default']
@ -71,11 +100,6 @@ declare module '@vue/runtime-core' {
SelectArea: typeof import('./src/components/select-area/index.vue')['default'] SelectArea: typeof import('./src/components/select-area/index.vue')['default']
SelectIcon: typeof import('./src/components/select-icon/index.vue')['default'] SelectIcon: typeof import('./src/components/select-icon/index.vue')['default']
SpreadPopup: typeof import('./src/components/spread-popup/index.vue')['default'] SpreadPopup: typeof import('./src/components/spread-popup/index.vue')['default']
TabBar: typeof import('./src/components/tab-bar/index.vue')['default']
TableActions: typeof import('./src/components/table-actions/index.vue')['default']
TablePagination: typeof import('./src/components/table-pagination/index.vue')['default']
TableToolbar: typeof import('./src/components/table-toolbar/index.vue')['default']
TipNotice: typeof import('./src/components/tip-notice/index.vue')['default']
UploadAttachment: typeof import('./src/components/upload-attachment/index.vue')['default'] UploadAttachment: typeof import('./src/components/upload-attachment/index.vue')['default']
UploadAudio: typeof import('./src/components/upload-audio/index.vue')['default'] UploadAudio: typeof import('./src/components/upload-audio/index.vue')['default']
UploadFile: typeof import('./src/components/upload-file/index.vue')['default'] UploadFile: typeof import('./src/components/upload-file/index.vue')['default']
@ -85,7 +109,6 @@ declare module '@vue/runtime-core' {
VerifyPoints: typeof import('./src/components/verifition/Verify/VerifyPoints.vue')['default'] VerifyPoints: typeof import('./src/components/verifition/Verify/VerifyPoints.vue')['default']
VerifySlide: typeof import('./src/components/verifition/Verify/VerifySlide.vue')['default'] VerifySlide: typeof import('./src/components/verifition/Verify/VerifySlide.vue')['default']
VideoPlayer: typeof import('./src/components/video-player/index.vue')['default'] VideoPlayer: typeof import('./src/components/video-player/index.vue')['default']
VisitChannel: typeof import('./src/components/visit-channel/index.vue')['default']
} }
export interface ComponentCustomProperties { export interface ComponentCustomProperties {
vLoading: typeof import('element-plus/es')['ElLoadingDirective'] vLoading: typeof import('element-plus/es')['ElLoadingDirective']

302
admin/package-lock.json generated
View File

@ -23,7 +23,7 @@
"date-fns": "^4.1.0", "date-fns": "^4.1.0",
"day": "^0.0.2", "day": "^0.0.2",
"echarts": "5.4.1", "echarts": "5.4.1",
"element-plus": "^2.7.4", "element-plus": "2.7.4",
"esbuild": "^0.16.17", "esbuild": "^0.16.17",
"highlight.js": "11.0.1", "highlight.js": "11.0.1",
"lodash-es": "4.17.21", "lodash-es": "4.17.21",
@ -32,9 +32,8 @@
"qrcode": "1.5.1", "qrcode": "1.5.1",
"sass": "1.58.0", "sass": "1.58.0",
"sortablejs": "1.15.0", "sortablejs": "1.15.0",
"v-code-diff": "^1.16.0",
"vditor": "^3.10.9", "vditor": "^3.10.9",
"vue": "3.2.45", "vue": "3.3.7",
"vue-i18n": "9.2.2", "vue-i18n": "9.2.2",
"vue-jsonp": "2.0.0", "vue-jsonp": "2.0.0",
"vue-router": "4.1.6", "vue-router": "4.1.6",
@ -1119,9 +1118,9 @@
} }
}, },
"node_modules/@jridgewell/sourcemap-codec": { "node_modules/@jridgewell/sourcemap-codec": {
"version": "1.6.0", "version": "1.5.5",
"resolved": "https://registry.npmmirror.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", "resolved": "https://registry.npmmirror.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
"integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==" "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="
}, },
"node_modules/@jridgewell/trace-mapping": { "node_modules/@jridgewell/trace-mapping": {
"version": "0.3.20", "version": "0.3.20",
@ -1854,7 +1853,6 @@
"version": "3.3.7", "version": "3.3.7",
"resolved": "https://registry.npmmirror.com/@vue/compiler-core/-/compiler-core-3.3.7.tgz", "resolved": "https://registry.npmmirror.com/@vue/compiler-core/-/compiler-core-3.3.7.tgz",
"integrity": "sha512-pACdY6YnTNVLXsB86YD8OF9ihwpolzhhtdLVHhBL6do/ykr6kKXNYABRtNMGrsQXpEXXyAdwvWWkuTbs4MFtPQ==", "integrity": "sha512-pACdY6YnTNVLXsB86YD8OF9ihwpolzhhtdLVHhBL6do/ykr6kKXNYABRtNMGrsQXpEXXyAdwvWWkuTbs4MFtPQ==",
"dev": true,
"dependencies": { "dependencies": {
"@babel/parser": "^7.23.0", "@babel/parser": "^7.23.0",
"@vue/shared": "3.3.7", "@vue/shared": "3.3.7",
@ -1866,7 +1864,6 @@
"version": "3.3.7", "version": "3.3.7",
"resolved": "https://registry.npmmirror.com/@vue/compiler-dom/-/compiler-dom-3.3.7.tgz", "resolved": "https://registry.npmmirror.com/@vue/compiler-dom/-/compiler-dom-3.3.7.tgz",
"integrity": "sha512-0LwkyJjnUPssXv/d1vNJ0PKfBlDoQs7n81CbO6Q0zdL7H1EzqYRrTVXDqdBVqro0aJjo/FOa1qBAPVI4PGSHBw==", "integrity": "sha512-0LwkyJjnUPssXv/d1vNJ0PKfBlDoQs7n81CbO6Q0zdL7H1EzqYRrTVXDqdBVqro0aJjo/FOa1qBAPVI4PGSHBw==",
"dev": true,
"dependencies": { "dependencies": {
"@vue/compiler-core": "3.3.7", "@vue/compiler-core": "3.3.7",
"@vue/shared": "3.3.7" "@vue/shared": "3.3.7"
@ -1876,7 +1873,6 @@
"version": "3.3.7", "version": "3.3.7",
"resolved": "https://registry.npmmirror.com/@vue/compiler-sfc/-/compiler-sfc-3.3.7.tgz", "resolved": "https://registry.npmmirror.com/@vue/compiler-sfc/-/compiler-sfc-3.3.7.tgz",
"integrity": "sha512-7pfldWy/J75U/ZyYIXRVqvLRw3vmfxDo2YLMwVtWVNew8Sm8d6wodM+OYFq4ll/UxfqVr0XKiVwti32PCrruAw==", "integrity": "sha512-7pfldWy/J75U/ZyYIXRVqvLRw3vmfxDo2YLMwVtWVNew8Sm8d6wodM+OYFq4ll/UxfqVr0XKiVwti32PCrruAw==",
"dev": true,
"dependencies": { "dependencies": {
"@babel/parser": "^7.23.0", "@babel/parser": "^7.23.0",
"@vue/compiler-core": "3.3.7", "@vue/compiler-core": "3.3.7",
@ -1894,16 +1890,14 @@
"version": "0.30.21", "version": "0.30.21",
"resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-0.30.21.tgz", "resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-0.30.21.tgz",
"integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==",
"dev": true,
"dependencies": { "dependencies": {
"@jridgewell/sourcemap-codec": "^1.5.5" "@jridgewell/sourcemap-codec": "^1.5.5"
} }
}, },
"node_modules/@vue/compiler-sfc/node_modules/postcss": { "node_modules/@vue/compiler-sfc/node_modules/postcss": {
"version": "8.5.28", "version": "8.5.19",
"resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.5.28.tgz", "resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.5.19.tgz",
"integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==", "integrity": "sha512-Mz8SaolMd8nB+G13WkORcxQKHZ/NE4xXevtkJHVuG+guo9/wYKlIMTKAqGdEmYOXR2ijPjTYNHssizdaVSUNdQ==",
"dev": true,
"funding": [ "funding": [
{ {
"type": "opencollective", "type": "opencollective",
@ -1919,7 +1913,7 @@
} }
], ],
"dependencies": { "dependencies": {
"nanoid": "^3.3.18", "nanoid": "^3.3.12",
"picocolors": "^1.1.1", "picocolors": "^1.1.1",
"source-map-js": "^1.2.1" "source-map-js": "^1.2.1"
}, },
@ -1931,7 +1925,6 @@
"version": "3.3.7", "version": "3.3.7",
"resolved": "https://registry.npmmirror.com/@vue/compiler-ssr/-/compiler-ssr-3.3.7.tgz", "resolved": "https://registry.npmmirror.com/@vue/compiler-ssr/-/compiler-ssr-3.3.7.tgz",
"integrity": "sha512-TxOfNVVeH3zgBc82kcUv+emNHo+vKnlRrkv8YvQU5+Y5LJGJwSNzcmLUoxD/dNzv0bhQ/F0s+InlgV0NrApJZg==", "integrity": "sha512-TxOfNVVeH3zgBc82kcUv+emNHo+vKnlRrkv8YvQU5+Y5LJGJwSNzcmLUoxD/dNzv0bhQ/F0s+InlgV0NrApJZg==",
"dev": true,
"dependencies": { "dependencies": {
"@vue/compiler-dom": "3.3.7", "@vue/compiler-dom": "3.3.7",
"@vue/shared": "3.3.7" "@vue/shared": "3.3.7"
@ -1946,7 +1939,6 @@
"version": "3.3.7", "version": "3.3.7",
"resolved": "https://registry.npmmirror.com/@vue/reactivity/-/reactivity-3.3.7.tgz", "resolved": "https://registry.npmmirror.com/@vue/reactivity/-/reactivity-3.3.7.tgz",
"integrity": "sha512-cZNVjWiw00708WqT0zRpyAgduG79dScKEPYJXq2xj/aMtk3SKvL3FBt2QKUlh6EHBJ1m8RhBY+ikBUzwc7/khg==", "integrity": "sha512-cZNVjWiw00708WqT0zRpyAgduG79dScKEPYJXq2xj/aMtk3SKvL3FBt2QKUlh6EHBJ1m8RhBY+ikBUzwc7/khg==",
"dev": true,
"dependencies": { "dependencies": {
"@vue/shared": "3.3.7" "@vue/shared": "3.3.7"
} }
@ -1955,7 +1947,6 @@
"version": "3.3.7", "version": "3.3.7",
"resolved": "https://registry.npmmirror.com/@vue/reactivity-transform/-/reactivity-transform-3.3.7.tgz", "resolved": "https://registry.npmmirror.com/@vue/reactivity-transform/-/reactivity-transform-3.3.7.tgz",
"integrity": "sha512-APhRmLVbgE1VPGtoLQoWBJEaQk4V8JUsqrQihImVqKT+8U6Qi3t5ATcg4Y9wGAPb3kIhetpufyZ1RhwbZCIdDA==", "integrity": "sha512-APhRmLVbgE1VPGtoLQoWBJEaQk4V8JUsqrQihImVqKT+8U6Qi3t5ATcg4Y9wGAPb3kIhetpufyZ1RhwbZCIdDA==",
"dev": true,
"dependencies": { "dependencies": {
"@babel/parser": "^7.23.0", "@babel/parser": "^7.23.0",
"@vue/compiler-core": "3.3.7", "@vue/compiler-core": "3.3.7",
@ -1968,104 +1959,45 @@
"version": "0.30.21", "version": "0.30.21",
"resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-0.30.21.tgz", "resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-0.30.21.tgz",
"integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==",
"dev": true,
"dependencies": { "dependencies": {
"@jridgewell/sourcemap-codec": "^1.5.5" "@jridgewell/sourcemap-codec": "^1.5.5"
} }
}, },
"node_modules/@vue/runtime-core": { "node_modules/@vue/runtime-core": {
"version": "3.2.45", "version": "3.3.7",
"resolved": "https://registry.npmmirror.com/@vue/runtime-core/-/runtime-core-3.2.45.tgz", "resolved": "https://registry.npmmirror.com/@vue/runtime-core/-/runtime-core-3.3.7.tgz",
"integrity": "sha512-gzJiTA3f74cgARptqzYswmoQx0fIA+gGYBfokYVhF8YSXjWTUA2SngRzZRku2HbGbjzB6LBYSbKGIaK8IW+s0A==", "integrity": "sha512-LHq9du3ubLZFdK/BP0Ysy3zhHqRfBn80Uc+T5Hz3maFJBGhci1MafccnL3rpd5/3wVfRHAe6c+PnlO2PAavPTQ==",
"dependencies": { "dependencies": {
"@vue/reactivity": "3.2.45", "@vue/reactivity": "3.3.7",
"@vue/shared": "3.2.45" "@vue/shared": "3.3.7"
} }
}, },
"node_modules/@vue/runtime-core/node_modules/@vue/reactivity": {
"version": "3.2.45",
"resolved": "https://registry.npmmirror.com/@vue/reactivity/-/reactivity-3.2.45.tgz",
"integrity": "sha512-PRvhCcQcyEVohW0P8iQ7HDcIOXRjZfAsOds3N99X/Dzewy8TVhTCT4uXpAHfoKjVTJRA0O0K+6QNkDIZAxNi3A==",
"dependencies": {
"@vue/shared": "3.2.45"
}
},
"node_modules/@vue/runtime-core/node_modules/@vue/shared": {
"version": "3.2.45",
"resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.2.45.tgz",
"integrity": "sha512-Ewzq5Yhimg7pSztDV+RH1UDKBzmtqieXQlpTVm2AwraoRL/Rks96mvd8Vgi7Lj+h+TH8dv7mXD3FRZR3TUvbSg=="
},
"node_modules/@vue/runtime-dom": { "node_modules/@vue/runtime-dom": {
"version": "3.2.45", "version": "3.3.7",
"resolved": "https://registry.npmmirror.com/@vue/runtime-dom/-/runtime-dom-3.2.45.tgz", "resolved": "https://registry.npmmirror.com/@vue/runtime-dom/-/runtime-dom-3.3.7.tgz",
"integrity": "sha512-cy88YpfP5Ue2bDBbj75Cb4bIEZUMM/mAkDMfqDTpUYVgTf/kuQ2VQ8LebuZ8k6EudgH8pYhsGWHlY0lcxlvTwA==", "integrity": "sha512-PFQU1oeJxikdDmrfoNQay5nD4tcPNYixUBruZzVX/l0eyZvFKElZUjW4KctCcs52nnpMGO6UDK+jF5oV4GT5Lw==",
"dependencies": { "dependencies": {
"@vue/runtime-core": "3.2.45", "@vue/runtime-core": "3.3.7",
"@vue/shared": "3.2.45", "@vue/shared": "3.3.7",
"csstype": "^2.6.8" "csstype": "^3.1.2"
} }
}, },
"node_modules/@vue/runtime-dom/node_modules/@vue/shared": {
"version": "3.2.45",
"resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.2.45.tgz",
"integrity": "sha512-Ewzq5Yhimg7pSztDV+RH1UDKBzmtqieXQlpTVm2AwraoRL/Rks96mvd8Vgi7Lj+h+TH8dv7mXD3FRZR3TUvbSg=="
},
"node_modules/@vue/runtime-dom/node_modules/csstype": {
"version": "2.6.21",
"resolved": "https://registry.npmmirror.com/csstype/-/csstype-2.6.21.tgz",
"integrity": "sha512-Z1PhmomIfypOpoMjRQB70jfvy/wxT50qW08YXO5lMIJkrdq4yOTR+AW7FqutScmB9NkLwxo+jU+kZLbofZZq/w=="
},
"node_modules/@vue/server-renderer": { "node_modules/@vue/server-renderer": {
"version": "3.2.45", "version": "3.3.7",
"resolved": "https://registry.npmmirror.com/@vue/server-renderer/-/server-renderer-3.2.45.tgz", "resolved": "https://registry.npmmirror.com/@vue/server-renderer/-/server-renderer-3.3.7.tgz",
"integrity": "sha512-ebiMq7q24WBU1D6uhPK//2OTR1iRIyxjF5iVq/1a5I1SDMDyDu4Ts6fJaMnjrvD3MqnaiFkKQj+LKAgz5WIK3g==", "integrity": "sha512-UlpKDInd1hIZiNuVVVvLgxpfnSouxKQOSE2bOfQpBuGwxRV/JqqTCyyjXUWiwtVMyeRaZhOYYqntxElk8FhBhw==",
"dependencies": { "dependencies": {
"@vue/compiler-ssr": "3.2.45", "@vue/compiler-ssr": "3.3.7",
"@vue/shared": "3.2.45" "@vue/shared": "3.3.7"
}, },
"peerDependencies": { "peerDependencies": {
"vue": "3.2.45" "vue": "3.3.7"
} }
}, },
"node_modules/@vue/server-renderer/node_modules/@vue/compiler-core": {
"version": "3.2.45",
"resolved": "https://registry.npmmirror.com/@vue/compiler-core/-/compiler-core-3.2.45.tgz",
"integrity": "sha512-rcMj7H+PYe5wBV3iYeUgbCglC+pbpN8hBLTJvRiK2eKQiWqu+fG9F+8sW99JdL4LQi7Re178UOxn09puSXvn4A==",
"dependencies": {
"@babel/parser": "^7.16.4",
"@vue/shared": "3.2.45",
"estree-walker": "^2.0.2",
"source-map": "^0.6.1"
}
},
"node_modules/@vue/server-renderer/node_modules/@vue/compiler-dom": {
"version": "3.2.45",
"resolved": "https://registry.npmmirror.com/@vue/compiler-dom/-/compiler-dom-3.2.45.tgz",
"integrity": "sha512-tyYeUEuKqqZO137WrZkpwfPCdiiIeXYCcJ8L4gWz9vqaxzIQRccTSwSWZ/Axx5YR2z+LvpUbmPNXxuBU45lyRw==",
"dependencies": {
"@vue/compiler-core": "3.2.45",
"@vue/shared": "3.2.45"
}
},
"node_modules/@vue/server-renderer/node_modules/@vue/compiler-ssr": {
"version": "3.2.45",
"resolved": "https://registry.npmmirror.com/@vue/compiler-ssr/-/compiler-ssr-3.2.45.tgz",
"integrity": "sha512-6BRaggEGqhWht3lt24CrIbQSRD5O07MTmd+LjAn5fJj568+R9eUD2F7wMQJjX859seSlrYog7sUtrZSd7feqrQ==",
"dependencies": {
"@vue/compiler-dom": "3.2.45",
"@vue/shared": "3.2.45"
}
},
"node_modules/@vue/server-renderer/node_modules/@vue/shared": {
"version": "3.2.45",
"resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.2.45.tgz",
"integrity": "sha512-Ewzq5Yhimg7pSztDV+RH1UDKBzmtqieXQlpTVm2AwraoRL/Rks96mvd8Vgi7Lj+h+TH8dv7mXD3FRZR3TUvbSg=="
},
"node_modules/@vue/shared": { "node_modules/@vue/shared": {
"version": "3.3.7", "version": "3.3.7",
"resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.3.7.tgz", "resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.3.7.tgz",
"integrity": "sha512-N/tbkINRUDExgcPTBvxNkvHGu504k8lzlNQRITVnm6YjOjwa4r0nnbd4Jb01sNpur5hAllyRJzSK5PvB9PPwRg==", "integrity": "sha512-N/tbkINRUDExgcPTBvxNkvHGu504k8lzlNQRITVnm6YjOjwa4r0nnbd4Jb01sNpur5hAllyRJzSK5PvB9PPwRg=="
"dev": true
}, },
"node_modules/@vueuse/core": { "node_modules/@vueuse/core": {
"version": "9.12.0", "version": "9.12.0",
@ -2759,6 +2691,11 @@
"node": ">=4" "node": ">=4"
} }
}, },
"node_modules/csstype": {
"version": "3.2.3",
"resolved": "https://registry.npmmirror.com/csstype/-/csstype-3.2.3.tgz",
"integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ=="
},
"node_modules/date-fns": { "node_modules/date-fns": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmmirror.com/date-fns/-/date-fns-4.1.0.tgz", "resolved": "https://registry.npmmirror.com/date-fns/-/date-fns-4.1.0.tgz",
@ -2900,14 +2837,6 @@
"integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==",
"dev": true "dev": true
}, },
"node_modules/diff": {
"version": "5.2.2",
"resolved": "https://registry.npmmirror.com/diff/-/diff-5.2.2.tgz",
"integrity": "sha512-vtcDfH3TOjP8UekytvnHH1o1P4FcUdt4eQ1Y+Abap1tk/OB2MWQvcwS2ClCd1zuIhc3JKOx6p3kod8Vfys3E+A==",
"engines": {
"node": ">=0.3.1"
}
},
"node_modules/diff-match-patch": { "node_modules/diff-match-patch": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmmirror.com/diff-match-patch/-/diff-match-patch-1.0.5.tgz", "resolved": "https://registry.npmmirror.com/diff-match-patch/-/diff-match-patch-1.0.5.tgz",
@ -4713,9 +4642,9 @@
"dev": true "dev": true
}, },
"node_modules/nanoid": { "node_modules/nanoid": {
"version": "3.3.19", "version": "3.3.16",
"resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.19.tgz", "resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.16.tgz",
"integrity": "sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug==", "integrity": "sha512-bzlKTyNJ7+LdGIIwy8ijFpIqEQIvafahV7eYykJ8Cvh42EdJeODoJ6gUJXpQJvej1BddH8OqTXZNE/KfbWAu8Q==",
"funding": [ "funding": [
{ {
"type": "github", "type": "github",
@ -5060,6 +4989,7 @@
"version": "8.4.21", "version": "8.4.21",
"resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.4.21.tgz", "resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.4.21.tgz",
"integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==", "integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==",
"dev": true,
"dependencies": { "dependencies": {
"nanoid": "^3.3.4", "nanoid": "^3.3.4",
"picocolors": "^1.0.0", "picocolors": "^1.0.0",
@ -5538,12 +5468,6 @@
"node": ">=0.10.0" "node": ">=0.10.0"
} }
}, },
"node_modules/sourcemap-codec": {
"version": "1.4.8",
"resolved": "https://registry.npmmirror.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
"integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==",
"deprecated": "Please use @jridgewell/sourcemap-codec instead"
},
"node_modules/std-env": { "node_modules/std-env": {
"version": "3.6.0", "version": "3.6.0",
"resolved": "https://registry.npmmirror.com/std-env/-/std-env-3.6.0.tgz", "resolved": "https://registry.npmmirror.com/std-env/-/std-env-3.6.0.tgz",
@ -6127,60 +6051,6 @@
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"dev": true "dev": true
}, },
"node_modules/v-code-diff": {
"version": "1.16.0",
"resolved": "https://registry.npmmirror.com/v-code-diff/-/v-code-diff-1.16.0.tgz",
"integrity": "sha512-xNhzfK/OHgVs86T1Wnjb1YqSAYHXhmwAAYm8G7yVWuc96j9QWyIhG1xirWMjrzlkJr3KRGR+TUKqG23P5bl8Pg==",
"hasInstallScript": true,
"dependencies": {
"diff": "^5.2.2",
"diff-match-patch": "^1.0.5",
"highlight.js": "^11.12.0",
"vue-demi": "^0.14.10"
},
"peerDependencies": {
"@vue/composition-api": "^1.4.9",
"vue": "^2.6.0 || >=3.0.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
},
"node_modules/v-code-diff/node_modules/highlight.js": {
"version": "11.12.0",
"resolved": "https://registry.npmmirror.com/highlight.js/-/highlight.js-11.12.0.tgz",
"integrity": "sha512-nbfWpyRMcMrPMmDwJB+dhX/eiaPKtc2RB+0QZskqJ3WjRA/FDS0e9hZrx8EC/lbEv8gXy98FcDbNa/dspAaJMg==",
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/v-code-diff/node_modules/vue-demi": {
"version": "0.14.10",
"resolved": "https://registry.npmmirror.com/vue-demi/-/vue-demi-0.14.10.tgz",
"integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==",
"hasInstallScript": true,
"bin": {
"vue-demi-fix": "bin/vue-demi-fix.js",
"vue-demi-switch": "bin/vue-demi-switch.js"
},
"engines": {
"node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/antfu"
},
"peerDependencies": {
"@vue/composition-api": "^1.0.0-rc.1",
"vue": "^3.0.0-0 || ^2.6.0"
},
"peerDependenciesMeta": {
"@vue/composition-api": {
"optional": true
}
}
},
"node_modules/vditor": { "node_modules/vditor": {
"version": "3.10.9", "version": "3.10.9",
"resolved": "https://registry.npmmirror.com/vditor/-/vditor-3.10.9.tgz", "resolved": "https://registry.npmmirror.com/vditor/-/vditor-3.10.9.tgz",
@ -6242,15 +6112,23 @@
} }
}, },
"node_modules/vue": { "node_modules/vue": {
"version": "3.2.45", "version": "3.3.7",
"resolved": "https://registry.npmmirror.com/vue/-/vue-3.2.45.tgz", "resolved": "https://registry.npmmirror.com/vue/-/vue-3.3.7.tgz",
"integrity": "sha512-9Nx/Mg2b2xWlXykmCwiTUCWHbWIj53bnkizBxKai1g61f2Xit700A1ljowpTIM11e3uipOeiPcSqnmBg6gyiaA==", "integrity": "sha512-YEMDia1ZTv1TeBbnu6VybatmSteGOS3A3YgfINOfraCbf85wdKHzscD6HSS/vB4GAtI7sa1XPX7HcQaJ1l24zA==",
"dependencies": { "dependencies": {
"@vue/compiler-dom": "3.2.45", "@vue/compiler-dom": "3.3.7",
"@vue/compiler-sfc": "3.2.45", "@vue/compiler-sfc": "3.3.7",
"@vue/runtime-dom": "3.2.45", "@vue/runtime-dom": "3.3.7",
"@vue/server-renderer": "3.2.45", "@vue/server-renderer": "3.3.7",
"@vue/shared": "3.2.45" "@vue/shared": "3.3.7"
},
"peerDependencies": {
"typescript": "*"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
} }
}, },
"node_modules/vue-eslint-parser": { "node_modules/vue-eslint-parser": {
@ -6488,11 +6366,6 @@
"resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.3.13.tgz", "resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.3.13.tgz",
"integrity": "sha512-/zYUwiHD8j7gKx2argXEMCUXVST6q/21DFU0sTfNX0URJroCe3b1UF6vLJ3lQDfLNIiiRl2ONp7Nh5UVWS6QnA==" "integrity": "sha512-/zYUwiHD8j7gKx2argXEMCUXVST6q/21DFU0sTfNX0URJroCe3b1UF6vLJ3lQDfLNIiiRl2ONp7Nh5UVWS6QnA=="
}, },
"node_modules/vue-web-terminal/node_modules/csstype": {
"version": "3.1.3",
"resolved": "https://registry.npmmirror.com/csstype/-/csstype-3.1.3.tgz",
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="
},
"node_modules/vue-web-terminal/node_modules/magic-string": { "node_modules/vue-web-terminal/node_modules/magic-string": {
"version": "0.30.5", "version": "0.30.5",
"resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-0.30.5.tgz", "resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-0.30.5.tgz",
@ -6537,77 +6410,6 @@
} }
} }
}, },
"node_modules/vue/node_modules/@vue/compiler-core": {
"version": "3.2.45",
"resolved": "https://registry.npmmirror.com/@vue/compiler-core/-/compiler-core-3.2.45.tgz",
"integrity": "sha512-rcMj7H+PYe5wBV3iYeUgbCglC+pbpN8hBLTJvRiK2eKQiWqu+fG9F+8sW99JdL4LQi7Re178UOxn09puSXvn4A==",
"dependencies": {
"@babel/parser": "^7.16.4",
"@vue/shared": "3.2.45",
"estree-walker": "^2.0.2",
"source-map": "^0.6.1"
}
},
"node_modules/vue/node_modules/@vue/compiler-dom": {
"version": "3.2.45",
"resolved": "https://registry.npmmirror.com/@vue/compiler-dom/-/compiler-dom-3.2.45.tgz",
"integrity": "sha512-tyYeUEuKqqZO137WrZkpwfPCdiiIeXYCcJ8L4gWz9vqaxzIQRccTSwSWZ/Axx5YR2z+LvpUbmPNXxuBU45lyRw==",
"dependencies": {
"@vue/compiler-core": "3.2.45",
"@vue/shared": "3.2.45"
}
},
"node_modules/vue/node_modules/@vue/compiler-sfc": {
"version": "3.2.45",
"resolved": "https://registry.npmmirror.com/@vue/compiler-sfc/-/compiler-sfc-3.2.45.tgz",
"integrity": "sha512-1jXDuWah1ggsnSAOGsec8cFjT/K6TMZ0sPL3o3d84Ft2AYZi2jWJgRMjw4iaK0rBfA89L5gw427H4n1RZQBu6Q==",
"dependencies": {
"@babel/parser": "^7.16.4",
"@vue/compiler-core": "3.2.45",
"@vue/compiler-dom": "3.2.45",
"@vue/compiler-ssr": "3.2.45",
"@vue/reactivity-transform": "3.2.45",
"@vue/shared": "3.2.45",
"estree-walker": "^2.0.2",
"magic-string": "^0.25.7",
"postcss": "^8.1.10",
"source-map": "^0.6.1"
}
},
"node_modules/vue/node_modules/@vue/compiler-ssr": {
"version": "3.2.45",
"resolved": "https://registry.npmmirror.com/@vue/compiler-ssr/-/compiler-ssr-3.2.45.tgz",
"integrity": "sha512-6BRaggEGqhWht3lt24CrIbQSRD5O07MTmd+LjAn5fJj568+R9eUD2F7wMQJjX859seSlrYog7sUtrZSd7feqrQ==",
"dependencies": {
"@vue/compiler-dom": "3.2.45",
"@vue/shared": "3.2.45"
}
},
"node_modules/vue/node_modules/@vue/reactivity-transform": {
"version": "3.2.45",
"resolved": "https://registry.npmmirror.com/@vue/reactivity-transform/-/reactivity-transform-3.2.45.tgz",
"integrity": "sha512-BHVmzYAvM7vcU5WmuYqXpwaBHjsS8T63jlKGWVtHxAHIoMIlmaMyurUSEs1Zcg46M4AYT5MtB1U274/2aNzjJQ==",
"dependencies": {
"@babel/parser": "^7.16.4",
"@vue/compiler-core": "3.2.45",
"@vue/shared": "3.2.45",
"estree-walker": "^2.0.2",
"magic-string": "^0.25.7"
}
},
"node_modules/vue/node_modules/@vue/shared": {
"version": "3.2.45",
"resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.2.45.tgz",
"integrity": "sha512-Ewzq5Yhimg7pSztDV+RH1UDKBzmtqieXQlpTVm2AwraoRL/Rks96mvd8Vgi7Lj+h+TH8dv7mXD3FRZR3TUvbSg=="
},
"node_modules/vue/node_modules/magic-string": {
"version": "0.25.9",
"resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-0.25.9.tgz",
"integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==",
"dependencies": {
"sourcemap-codec": "^1.4.8"
}
},
"node_modules/vue3-video-play": { "node_modules/vue3-video-play": {
"version": "1.3.1-beta.6", "version": "1.3.1-beta.6",
"resolved": "https://registry.npmmirror.com/vue3-video-play/-/vue3-video-play-1.3.1-beta.6.tgz", "resolved": "https://registry.npmmirror.com/vue3-video-play/-/vue3-video-play-1.3.1-beta.6.tgz",

View File

@ -6,7 +6,7 @@
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "cross-env NODE_OPTIONS=--max-old-space-size=4096 node scripts/build-all.cjs", "build": "cross-env NODE_OPTIONS=--max-old-space-size=4096 node scripts/build-all.cjs",
"build:core": "node scripts/build-shared.cjs && node scripts/clean-core.cjs && node node_modules/vite/bin/vite.js build --config vite.config.core.ts --force && node scripts/verify-core-lang.cjs && cross-env SKIP_ADDONS=1 node scripts/assemble-admin.cjs", "build:core": "node scripts/build-shared.cjs && node scripts/clean-core.cjs && node node_modules/vite/bin/vite.js build --config vite.config.core.ts --force && node scripts/verify-core-lang.cjs && node scripts/assemble-admin.cjs",
"build:shared": "node scripts/build-shared.cjs", "build:shared": "node scripts/build-shared.cjs",
"build:addon": "node scripts/build-addon.cjs", "build:addon": "node scripts/build-addon.cjs",
"build:assemble": "node scripts/assemble-admin.cjs", "build:assemble": "node scripts/assemble-admin.cjs",
@ -28,7 +28,7 @@
"date-fns": "^4.1.0", "date-fns": "^4.1.0",
"day": "^0.0.2", "day": "^0.0.2",
"echarts": "5.4.1", "echarts": "5.4.1",
"element-plus": "^2.7.4", "element-plus": "2.7.4",
"esbuild": "^0.16.17", "esbuild": "^0.16.17",
"highlight.js": "11.0.1", "highlight.js": "11.0.1",
"lodash-es": "4.17.21", "lodash-es": "4.17.21",
@ -37,9 +37,8 @@
"qrcode": "1.5.1", "qrcode": "1.5.1",
"sass": "1.58.0", "sass": "1.58.0",
"sortablejs": "1.15.0", "sortablejs": "1.15.0",
"v-code-diff": "^1.16.0",
"vditor": "^3.10.9", "vditor": "^3.10.9",
"vue": "3.2.45", "vue": "3.3.7",
"vue-i18n": "9.2.2", "vue-i18n": "9.2.2",
"vue-jsonp": "2.0.0", "vue-jsonp": "2.0.0",
"vue-router": "4.1.6", "vue-router": "4.1.6",

View File

@ -144,9 +144,7 @@ div.edui-box {
border: 1px solid var(--el-border-color); border: 1px solid var(--el-border-color);
background-color: white; background-color: white;
position: relative; position: relative;
/* 圆角需裁剪内部工具栏与 iframe,弹出层挂载在 body 的 #edui_fixedlayer,不受影响 */ overflow: visible;
overflow: hidden;
border-radius: var(--cmp-control-radius, 8px);
z-index: 1 !important; z-index: 1 !important;
} }
/* 全屏状态 */ /* 全屏状态 */
@ -164,8 +162,8 @@ div.edui-box {
/*-webkit-box-shadow:0 1px 4px rgba(204, 204, 204, 0.6);*/ /*-webkit-box-shadow:0 1px 4px rgba(204, 204, 204, 0.6);*/
/*-moz-box-shadow:0 1px 4px rgba(204, 204, 204, 0.6);*/ /*-moz-box-shadow:0 1px 4px rgba(204, 204, 204, 0.6);*/
/*box-shadow:0 1px 4px rgba(204, 204, 204, 0.6);*/ /*box-shadow:0 1px 4px rgba(204, 204, 204, 0.6);*/
border-top-left-radius: var(--cmp-control-radius, 8px); border-top-left-radius: 2px;
border-top-right-radius: var(--cmp-control-radius, 8px); border-top-right-radius: 2px;
} }
.edui-default .edui-editor-toolbarboxouter { .edui-default .edui-editor-toolbarboxouter {
@ -178,9 +176,9 @@ div.edui-box {
/*background-image: linear-gradient(to bottom, #ffffff, #f2f2f2);*/ /*background-image: linear-gradient(to bottom, #ffffff, #f2f2f2);*/
/*background-repeat: repeat-x;*/ /*background-repeat: repeat-x;*/
/*border: 1px solid #d4d4d4;*/ /*border: 1px solid #d4d4d4;*/
-webkit-border-radius: var(--cmp-control-radius, 8px) var(--cmp-control-radius, 8px) 0 0; -webkit-border-radius: 4px 4px 0 0;
-moz-border-radius: var(--cmp-control-radius, 8px) var(--cmp-control-radius, 8px) 0 0; -moz-border-radius: 4px 4px 0 0;
border-radius: var(--cmp-control-radius, 8px) var(--cmp-control-radius, 8px) 0 0; border-radius: 4px 4px 0 0;
/*filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff2f2f2', GradientType=0);*/ /*filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff2f2f2', GradientType=0);*/
/**zoom: 1;*/ /**zoom: 1;*/
/*-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);*/ /*-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.065);*/

View File

@ -66,23 +66,4 @@ function scanAddonLang(key) {
return out return out
} }
module.exports = { ROOT, ADDON_DIR, listAddonKeys, walkFiles, scanAddonViews, scanAddonLang, resolveAddonEntry } module.exports = { ROOT, ADDON_DIR, listAddonKeys, walkFiles, scanAddonViews, scanAddonLang }
/**
* 解析 addon 入口文件名:默认 index.js;启用内容哈希后为 index-[hash].js
* @param {string} addonDir addon 产物目录(含入口脚本)
* @returns {string} 形如 ./index.js 或 ./index-[hash].js 的相对路径
*/
function resolveAddonEntry(addonDir) {
// 入口文件名来自构建期写入的 manifest.json(generateBundle 按 chunk.isEntry 精确记录 entry 字段),
// 直接读取即可,无需扫描目录:shop 等大插件的懒加载 chunk(components/xxx/index.vue)
// basename 也叫 index,目录里会同时存在多个 index-[hash].js,扫描文件名无法区分入口。
// 兼容未生成 manifest.json 的旧产物(入口固定为 index.js)
try {
const m = JSON.parse(fs.readFileSync(path.join(addonDir, 'manifest.json'), 'utf-8'))
if (m && typeof m.entry === 'string' && m.entry) {
return './' + m.entry.replace(/\\/g, '/')
}
} catch { /* 无 manifest.json(旧构建):入口固定为 index.js */ }
return './index.js'
}

View File

@ -12,7 +12,7 @@
*/ */
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
const { ROOT, listAddonKeys, resolveAddonEntry } = require('./addon-utils.cjs') const { ROOT, listAddonKeys } = require('./addon-utils.cjs')
const { IMPORT_MAP } = require('./shared-external.cjs') const { IMPORT_MAP } = require('./shared-external.cjs')
const { stripBuiltAssets } = require('./strip-style-imports.cjs') const { stripBuiltAssets } = require('./strip-style-imports.cjs')
@ -148,9 +148,7 @@ function writeAddonManifest(key, destAddonDir) {
key, key,
version: '1.0.0', version: '1.0.0',
sharedVersion: 'admin-core-1.0.0', sharedVersion: 'admin-core-1.0.0',
// entry 保持相对路径(./index-[hash].js),与旧插件 ./index.js 兼容; entry: './index.js',
// 真正拼带 key 的 URL 由运行时 loader 用 addon key 重建,避免 adminUrl 丢 key
entry: resolveAddonEntry(destAddonDir),
langBase: './lang/' langBase: './lang/'
} }
fs.writeFileSync(path.join(destAddonDir, 'manifest.json'), JSON.stringify(manifest, null, 2) + '\n', 'utf-8') fs.writeFileSync(path.join(destAddonDir, 'manifest.json'), JSON.stringify(manifest, null, 2) + '\n', 'utf-8')
@ -226,9 +224,6 @@ function runAssemble() {
? JSON.parse(fs.readFileSync(REPORT_PATH, 'utf-8')) ? JSON.parse(fs.readFileSync(REPORT_PATH, 'utf-8'))
: { success: listAddonKeys(), failed: [] } : { success: listAddonKeys(), failed: [] }
// build:core 场景:不承担插件打包,dist/assets/addons 留空,也不生成 index.json
const skipAddons = process.env.SKIP_ADDONS === '1'
cleanAssembledOutput() cleanAssembledOutput()
if (!fs.existsSync(CORE_DIR)) { if (!fs.existsSync(CORE_DIR)) {
@ -240,11 +235,6 @@ function runAssemble() {
const installedKeys = [] const installedKeys = []
// 先同步 addon,避免后续 core 合并耗时过长时 assets/addons 仍为空 // 先同步 addon,避免后续 core 合并耗时过长时 assets/addons 仍为空
if (skipAddons) {
// build:core 场景:不打包插件,dist/assets/addons 留空,也不生成 index.json
rmDir(path.join(OUT_DIR, 'assets', 'addons'))
console.log('[assemble] SKIP_ADDONS: dist/assets/addons left empty')
} else {
for (const key of successKeys) { for (const key of successKeys) {
const src = path.join(ADDONS_STAGING, key) const src = path.join(ADDONS_STAGING, key)
if (!fs.existsSync(src)) continue if (!fs.existsSync(src)) continue
@ -253,41 +243,22 @@ function runAssemble() {
copyTree(src, dest) copyTree(src, dest)
copyLang(key, dest) copyLang(key, dest)
writeAddonManifest(key, dest) writeAddonManifest(key, dest)
const entryRel = resolveAddonEntry(dest) const entryFile = path.join(dest, 'index.js')
const entryFile = path.join(dest, entryRel.replace(/^\.\//, ''))
if (!fs.existsSync(entryFile)) { if (!fs.existsSync(entryFile)) {
console.error(`[assemble] missing ${key}/${entryRel} — run: node scripts/build-addon.cjs ${key}`) console.error(`[assemble] missing ${key}/index.js — run: node scripts/build-addon.cjs ${key}`)
process.exit(1) process.exit(1)
} }
installedKeys.push(key) installedKeys.push(key)
console.log(`[assemble] addon "${key}" -> assets/addons/${key}/`) console.log(`[assemble] addon "${key}" -> assets/addons/${key}/`)
} }
}
// 合并各插件 manifest.json 到 index.json.manifests,减少前端 N 次 HTTP 请求 const indexJson = { keys: installedKeys, sharedVersion: 'admin-core-1.0.0' }
// (与后端 rebuildPublicAdminAddonIndexJson 行为一致)
const manifests = {}
for (const key of installedKeys) {
const manifestFile = path.join(OUT_DIR, 'assets', 'addons', key, 'manifest.json')
if (fs.existsSync(manifestFile)) {
try {
const data = JSON.parse(fs.readFileSync(manifestFile, 'utf-8'))
if (data && Object.keys(data).length) manifests[key] = data
} catch { /* 忽略损坏的 manifest,保持构建不中断 */ }
}
}
// buildTime 作为插件包运行时缓存版本:addon-lang 用它拼 ?v= 参数,
// 同一构建内插件包 URL 稳定可被浏览器长期缓存,重新部署后自动失效
const indexJson = { keys: installedKeys, sharedVersion: 'admin-core-1.0.0', buildTime: Date.now(), manifests }
if (!skipAddons) {
fs.mkdirSync(path.join(OUT_DIR, 'assets', 'addons'), { recursive: true }) fs.mkdirSync(path.join(OUT_DIR, 'assets', 'addons'), { recursive: true })
fs.writeFileSync( fs.writeFileSync(
path.join(OUT_DIR, 'assets', 'addons', 'index.json'), path.join(OUT_DIR, 'assets', 'addons', 'index.json'),
JSON.stringify(indexJson, null, 2) + '\n', JSON.stringify(indexJson, null, 2) + '\n',
'utf-8' 'utf-8'
) )
}
cleanCoreAssetsOutput() cleanCoreAssetsOutput()
mergeCoreOutput() mergeCoreOutput()
@ -320,14 +291,12 @@ function runAssemble() {
} }
copySharedLocales() copySharedLocales()
// core 合并可能覆盖 addons/index.json,需再次写入(仅 build/build:addon 产出) // core 合并可能覆盖 addons/index.json,需再次写入
if (!skipAddons) {
fs.writeFileSync( fs.writeFileSync(
path.join(OUT_DIR, 'assets', 'addons', 'index.json'), path.join(OUT_DIR, 'assets', 'addons', 'index.json'),
JSON.stringify(indexJson, null, 2) + '\n', JSON.stringify(indexJson, null, 2) + '\n',
'utf-8' 'utf-8'
) )
}
for (const key of installedKeys) { for (const key of installedKeys) {
writeAddonManifest(key, path.join(OUT_DIR, 'assets', 'addons', key)) writeAddonManifest(key, path.join(OUT_DIR, 'assets', 'addons', key))
} }
@ -338,16 +307,6 @@ function runAssemble() {
if (cleaned.length) { if (cleaned.length) {
console.log(`[assemble] stripped element-plus style imports from ${cleaned.length} js files`) console.log(`[assemble] stripped element-plus style imports from ${cleaned.length} js files`)
} }
// 组装完成,移除中间 staging 目录(已合并进 dist,发布时也不会拷贝)
for (const staging of ['.core', '.shared']) {
const dir = path.join(OUT_DIR, staging)
if (fs.existsSync(dir)) {
rmDir(dir)
console.log(`[assemble] removed staging ${staging}`)
}
}
console.log(`[assemble] done: core + ${installedKeys.length} addons`) console.log(`[assemble] done: core + ${installedKeys.length} addons`)
if (report.failed?.length) { if (report.failed?.length) {
console.warn('[assemble] skipped failed addons:', report.failed.map((f) => f.key).join(', ')) console.warn('[assemble] skipped failed addons:', report.failed.map((f) => f.key).join(', '))

View File

@ -1,41 +1,27 @@
/** /**
* 编译一个或多个 addon * 编译单个 addon
* *
* 流程(每个插件):generate-addon-entry → vite lib build → sync-addon * 流程:generate-addon-entry → vite lib build → sync-addon
* 输出 staging:dist/.addons/{key}/ * 输出 staging:dist/.addons/{key}/
* 同步部署目录:dist/assets/addons/{key}/ * 同步部署目录:dist/assets/addons/{key}/
* *
* 用法: * 用法:
* node scripts/build-addon.cjs shop * node scripts/build-addon.cjs shop
* node scripts/build-addon.cjs shop cms pintuan
* ADDON_KEY=shop node scripts/build-addon.cjs * ADDON_KEY=shop node scripts/build-addon.cjs
*/ */
const { spawnSync } = require('child_process') const { spawnSync } = require('child_process')
const fs = require('fs')
const path = require('path') const path = require('path')
const { ROOT } = require('./addon-utils.cjs') const { ROOT } = require('./addon-utils.cjs')
// 支持一次编译多个插件:node scripts/build-addon.cjs shop cms const key = process.argv[2] || process.env.ADDON_KEY
const argvKeys = process.argv.slice(2).filter(Boolean) if (!key) {
const keys = [...new Set(argvKeys.length ? argvKeys : process.env.ADDON_KEY ? [process.env.ADDON_KEY] : [])] console.error('Usage: node build-addon.cjs <addon-key>')
if (!keys.length) {
console.error('Usage: node build-addon.cjs <addon-key> [addon-key ...]')
process.exit(1) process.exit(1)
} }
function buildOne(key) { // 生成 .build/addons/{key}/entry.ts
console.log(`\n========== [build-addon] "${key}" ==========`) require('./generate-addon-entry.cjs')
// 生成 .build/addons/{key}/entry.ts(子进程调用,避免 require 模块缓存)
const entry = spawnSync('node', [path.join(__dirname, 'generate-addon-entry.cjs'), key], {
cwd: ROOT,
stdio: 'inherit',
shell: process.platform === 'win32'
})
if (entry.status !== 0) {
console.error(`[build-addon] generate entry FAILED: ${key}`)
process.exit(entry.status ?? 1)
}
const env = { const env = {
...process.env, ...process.env,
@ -50,6 +36,7 @@ function buildOne(key) {
stdio: 'inherit', stdio: 'inherit',
shell: process.platform === 'win32' shell: process.platform === 'win32'
}) })
if (r.status !== 0) { if (r.status !== 0) {
console.error(`[build-addon] FAILED: ${key}`) console.error(`[build-addon] FAILED: ${key}`)
process.exit(r.status ?? 1) process.exit(r.status ?? 1)
@ -66,7 +53,4 @@ function buildOne(key) {
} }
console.log(`[build-addon] OK: ${key}`) console.log(`[build-addon] OK: ${key}`)
} process.exit(0)
keys.forEach(buildOne)
console.log(`\n[build-addon] ALL DONE: ${keys.join(', ')}`)

View File

@ -27,7 +27,7 @@ const ENTRY_CONTENT = {
'icons-vue': "export * from '@element-plus/icons-vue'\n", 'icons-vue': "export * from '@element-plus/icons-vue'\n",
axios: "export { default } from 'axios'\nexport * from 'axios'\n", axios: "export { default } from 'axios'\nexport * from 'axios'\n",
'vue-i18n': "export * from 'vue-i18n/dist/vue-i18n.esm-bundler.js'\n", 'vue-i18n': "export * from 'vue-i18n/dist/vue-i18n.esm-bundler.js'\n",
'admin-lang': "export { language, t, i18n, default } from '../../src/lang/index.ts'\n", 'admin-lang': "export { language, t, default } from '../../src/lang/index.ts'\n",
'core-shared': '' // 动态生成,从 API 目录扫描 'core-shared': '' // 动态生成,从 API 目录扫描
} }

View File

@ -0,0 +1,97 @@
/**
* 部署目录健康检查
*
* 校验 public/admin 是否具备 split 架构所需文件:
* - index.html 入口、shared、admin-lang.js
* - addons/index.json、shop 等插件
* - 无错误 admin-lang 相对路径、无重复 createI18n
*
* 用法:node scripts/check-deploy.cjs [deploy-dir]
*/
const fs = require('fs')
const path = require('path')
const DEPLOY = process.argv[2] || 'D:/AppData/phpstudy_pro/WWW/test/niucloud/public/admin'
const issues = []
const ok = []
function check(name, pass, detail) {
if (pass) ok.push(`[OK] ${name}${detail ? ': ' + detail : ''}`)
else issues.push(`[FAIL] ${name}${detail ? ': ' + detail : ''}`)
}
if (!fs.existsSync(DEPLOY)) {
console.error('deploy dir not found:', DEPLOY)
process.exit(1)
}
const html = fs.readFileSync(path.join(DEPLOY, 'index.html'), 'utf-8')
const entryMatch = html.match(/\/admin\/assets\/(index-[a-f0-9]+\.js)/)
const entry = entryMatch ? entryMatch[1] : null
check('index.html entry', !!entry, entry || 'no index-*.js in script src')
if (entry) {
const entryPath = path.join(DEPLOY, 'assets', entry)
check('entry file exists', fs.existsSync(entryPath))
if (fs.existsSync(entryPath)) {
const code = fs.readFileSync(entryPath, 'utf-8')
check('core not stale', !code.includes('loadAddonCommonLocales'), 'must not contain loadAddonCommonLocales')
check('core has addon loader', code.includes('assets/addons') || code.includes('/admin/assets/addons'))
const oldPreload = /async function \w+\(\w+,t=\["zh-cn","en"\]\)/.test(code)
check('core preload not old-only-common', !oldPreload)
}
}
// CSS hash 随构建变化;若 core 重建后此处失败,需同步更新此文件名
const css = 'index-c72b4d30.css'
check('entry css', fs.existsSync(path.join(DEPLOY, 'assets', css)), css)
for (const f of ['vue.js', 'element-plus.js', 'vue-i18n.js', 'admin-lang.js']) {
check('shared/' + f, fs.existsSync(path.join(DEPLOY, 'assets', 'shared', f)))
}
// 抽样检查 shop 列表页是否走共享 admin-lang
const shopList = fs.existsSync(path.join(DEPLOY, 'assets', 'addons', 'shop'))
? fs.readdirSync(path.join(DEPLOY, 'assets', 'addons', 'shop')).find((n) => n.startsWith('list-') && n.endsWith('.js'))
: null
if (shopList) {
const code = fs.readFileSync(path.join(DEPLOY, 'assets', 'addons', 'shop', shopList), 'utf-8')
check('shop list uses shared t()', code.includes('/admin/assets/shared/admin-lang.js'))
check('shop list not duplicate i18n', !code.includes('createI18n'))
}
const addonsIndex = path.join(DEPLOY, 'assets', 'addons', 'index.json')
check('addons/index.json', fs.existsSync(addonsIndex))
if (fs.existsSync(addonsIndex)) {
const data = JSON.parse(fs.readFileSync(addonsIndex, 'utf-8'))
check('addons keys', Array.isArray(data.keys) && data.keys.length > 0, data.keys?.join(', '))
}
const shopIndex = path.join(DEPLOY, 'assets', 'addons', 'shop', 'index.js')
check('shop/index.js', fs.existsSync(shopIndex))
if (fs.existsSync(shopIndex)) {
const shop = fs.readFileSync(shopIndex, 'utf-8')
check('shop exports langs', shop.includes('langs'))
}
const { hasBadImport } = require('./admin-lang-import-utils.cjs')
let badLangImports = 0
const assetsDir = path.join(DEPLOY, 'assets')
if (fs.existsSync(assetsDir)) {
for (const name of fs.readdirSync(assetsDir)) {
if (!name.endsWith('.js')) continue
if (hasBadImport(fs.readFileSync(path.join(assetsDir, name), 'utf-8'))) badLangImports++
}
}
check('no bad admin-lang import paths', badLangImports === 0, badLangImports ? `${badLangImports} core chunk(s)` : '')
const staleEntry = path.join(DEPLOY, 'assets', 'index-d2fee835.js')
if (fs.existsSync(staleEntry)) {
issues.push('[WARN] old bundle still present: index-d2fee835.js (harmless if index.html points to new entry)')
}
console.log('\n=== Deploy check:', DEPLOY, '===\n')
ok.forEach((l) => console.log(l))
issues.forEach((l) => console.log(l))
console.log('\nSummary:', ok.length, 'ok,', issues.length, 'issue(s)')
process.exit(issues.some((l) => l.startsWith('[FAIL]')) ? 1 : 0)

View File

@ -7,7 +7,7 @@
*/ */
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
const { ROOT, resolveAddonEntry } = require('./addon-utils.cjs') const { ROOT } = require('./addon-utils.cjs')
const { fixDir } = require('./admin-lang-import-utils.cjs') const { fixDir } = require('./admin-lang-import-utils.cjs')
const src = path.join(ROOT, 'dist') const src = path.join(ROOT, 'dist')
@ -47,8 +47,7 @@ function listDropInKeys(addonsDir) {
if (!fs.existsSync(addonsDir)) return [] if (!fs.existsSync(addonsDir)) return []
return fs.readdirSync(addonsDir).filter((name) => { return fs.readdirSync(addonsDir).filter((name) => {
if (name === 'index.json' || name.startsWith('.')) return false if (name === 'index.json' || name.startsWith('.')) return false
const entry = resolveAddonEntry(path.join(addonsDir, name)).replace(/^\.\//, '') return fs.existsSync(path.join(addonsDir, name, 'index.js'))
return fs.existsSync(path.join(addonsDir, name, entry))
}) })
} }
@ -104,10 +103,8 @@ function main() {
for (const key of preserveKeys) { for (const key of preserveKeys) {
const from = path.join(backup, key) const from = path.join(backup, key)
const to = path.join(mergedAddons, key) const to = path.join(mergedAddons, key)
const fromEntry = resolveAddonEntry(from).replace(/^\.\//, '') if (!fs.existsSync(path.join(from, 'index.js'))) continue
const toEntry = resolveAddonEntry(to).replace(/^\.\//, '') if (fs.existsSync(path.join(to, 'index.js'))) continue
if (!fs.existsSync(path.join(from, fromEntry))) continue
if (fs.existsSync(path.join(to, toEntry))) continue
copyTree(from, to) copyTree(from, to)
console.log(`[deploy] preserved drop-in addon "${key}"`) console.log(`[deploy] preserved drop-in addon "${key}"`)
} }

View File

@ -12,7 +12,7 @@
*/ */
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
const { ROOT, resolveAddonEntry } = require('./addon-utils.cjs') const { ROOT } = require('./addon-utils.cjs')
const key = process.argv[2] const key = process.argv[2]
const deployDir = process.argv[3] ? path.resolve(process.argv[3]) : path.join(ROOT, 'dist') const deployDir = process.argv[3] ? path.resolve(process.argv[3]) : path.join(ROOT, 'dist')
@ -24,8 +24,7 @@ if (!key) {
const addonDir = path.join(deployDir, 'assets', 'addons', key) const addonDir = path.join(deployDir, 'assets', 'addons', key)
const indexPath = path.join(deployDir, 'assets', 'addons', 'index.json') const indexPath = path.join(deployDir, 'assets', 'addons', 'index.json')
const entryRel = resolveAddonEntry(addonDir) const entryPath = path.join(addonDir, 'index.js')
const entryPath = path.join(addonDir, entryRel.replace(/^\.\//, ''))
const manifestPath = path.join(addonDir, 'manifest.json') const manifestPath = path.join(addonDir, 'manifest.json')
if (!fs.existsSync(entryPath)) { if (!fs.existsSync(entryPath)) {
@ -39,7 +38,7 @@ if (!fs.existsSync(manifestPath)) {
key, key,
version: '1.0.0', version: '1.0.0',
sharedVersion: 'admin-core-1.0.0', sharedVersion: 'admin-core-1.0.0',
entry: entryRel, entry: './index.js',
langBase: './lang/' langBase: './lang/'
} }
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n', 'utf-8') fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2) + '\n', 'utf-8')

View File

@ -7,37 +7,16 @@ const path = require('path')
const DEFAULT_EXTENSIONS = ['.ts', '.js', '.tsx', '.jsx'] const DEFAULT_EXTENSIONS = ['.ts', '.js', '.tsx', '.jsx']
/** /** 从源码中提取所有命名导出名称 */
* 去掉注释
*
* 本扫描器是按正则匹配源码文本、不做语法解析的。若注释里出现形如
* 「export { xxx }」的示例写法,会被误判成一个真实导出并写进生成的 barrel,
* 而那个名字在运行时并不存在,最终 Rollup 报 "xxx is not exported by ..."。
* 因此匹配前先剥离注释。
* @param {string} src
* @return {string}
*/
function stripComments(src) {
return src
.replace(/\/\*[\s\S]*?\*\//g, ' ')
// 排除 :// (如 http://)避免误伤 URL
.replace(/(^|[^:])\/\/[^\n]*/g, '$1')
}
/** 从源码中提取所有命名导出名称(仅运行时存在的值导出) */
function scanExports(src) { function scanExports(src) {
const code = stripComments(src)
const names = [] const names = []
// export const|let|var|function|class|enum NAME // export const|let|var|function|class|type|interface|enum NAME
// ★ 不含 type / interface:类型导出编译后并不存在于运行时, const declRe = /export\s+(?:const|let|var|function|class|type|interface|enum)\s+(\w+)/g
// 而生成的 barrel 是按值重导出,收进去会报 "not exported by" for (const m of src.matchAll(declRe)) names.push(m[1])
const declRe = /export\s+(?:const|let|var|function|class|enum)\s+(\w+)/g // export { a, b, c as d }
for (const m of code.matchAll(declRe)) names.push(m[1]) const braceRe = /export\s*(?:type\s*)?\{([^}]+)\}/g
// export { a, b, c as d }(export type { ... } 为纯类型导出,跳过) for (const m of src.matchAll(braceRe)) {
const braceRe = /export\s*(type\s*)?\{([^}]+)\}/g for (const item of m[1].split(',').map(s => s.trim()).filter(Boolean)) {
for (const m of code.matchAll(braceRe)) {
if (m[1]) continue
for (const item of m[2].split(',').map(s => s.trim()).filter(Boolean)) {
const parts = item.split(/\s+(?:as|:)\s+/) const parts = item.split(/\s+(?:as|:)\s+/)
names.push(parts.length > 1 ? parts[parts.length - 1].trim() : parts[0].trim()) names.push(parts.length > 1 ? parts[parts.length - 1].trim() : parts[0].trim())
} }

View File

@ -8,7 +8,7 @@
*/ */
const fs = require('fs') const fs = require('fs')
const path = require('path') const path = require('path')
const { ROOT, resolveAddonEntry } = require('./addon-utils.cjs') const { ROOT } = require('./addon-utils.cjs')
/** Vite addon 构建 staging */ /** Vite addon 构建 staging */
const ADDONS_STAGING = path.join(ROOT, 'dist', '.addons') const ADDONS_STAGING = path.join(ROOT, 'dist', '.addons')
@ -44,9 +44,7 @@ function writeAddonManifest(key, destAddonDir) {
key, key,
version: '1.0.0', version: '1.0.0',
sharedVersion: 'admin-core-1.0.0', sharedVersion: 'admin-core-1.0.0',
// entry 保持相对路径(./index-[hash].js),与旧插件 ./index.js 兼容; entry: './index.js',
// 真正拼带 key 的 URL 由运行时 loader 用 addon key 重建,避免 adminUrl 丢 key
entry: resolveAddonEntry(destAddonDir),
langBase: './lang/' langBase: './lang/'
} }
fs.writeFileSync( fs.writeFileSync(
@ -79,21 +77,9 @@ function markSuccess(key) {
function writeAddonsIndex(keys) { function writeAddonsIndex(keys) {
const addonsDir = path.join(OUT_DIR, 'assets', 'addons') const addonsDir = path.join(OUT_DIR, 'assets', 'addons')
fs.mkdirSync(addonsDir, { recursive: true }) fs.mkdirSync(addonsDir, { recursive: true })
// 合并各插件 manifest.json 到 index.json.manifests,减少前端 N 次 HTTP 请求
// (与后端 rebuildPublicAdminAddonIndexJson 行为一致)
const manifests = {}
for (const key of keys) {
const manifestFile = path.join(addonsDir, key, 'manifest.json')
if (fs.existsSync(manifestFile)) {
try {
const data = JSON.parse(fs.readFileSync(manifestFile, 'utf-8'))
if (data && Object.keys(data).length) manifests[key] = data
} catch { /* 忽略损坏的 manifest,保持构建不中断 */ }
}
}
fs.writeFileSync( fs.writeFileSync(
path.join(addonsDir, 'index.json'), path.join(addonsDir, 'index.json'),
JSON.stringify({ keys, sharedVersion: 'admin-core-1.0.0', buildTime: Date.now(), manifests }, null, 2) + '\n', JSON.stringify({ keys, sharedVersion: 'admin-core-1.0.0' }, null, 2) + '\n',
'utf-8' 'utf-8'
) )
} }
@ -104,10 +90,9 @@ function syncAddon(key) {
console.error(`[sync-addon] missing staging: ${src}`) console.error(`[sync-addon] missing staging: ${src}`)
process.exit(1) process.exit(1)
} }
const entryRel = resolveAddonEntry(src) const entry = path.join(src, 'index.js')
const entry = path.join(src, entryRel.replace(/^\.\//, ''))
if (!fs.existsSync(entry)) { if (!fs.existsSync(entry)) {
console.error(`[sync-addon] missing ${key}/${entryRel} — rebuild addon first`) console.error(`[sync-addon] missing ${key}/index.js — rebuild addon first`)
process.exit(1) process.exit(1)
} }

View File

@ -1,190 +0,0 @@
/**
* 统一排除插件源码的 Vite 插件(core / addon 构建共用)
*
* 背景:
* 插件加载大量使用 import.meta.glob('@/addon/**') / ('../addon/**'),
* 部分页面甚至用 import.meta.glob('@/**') 扫描整个 src。
* vite:import-glob 会在编译期把 glob 展开成一组真实的 import 语句,其说明符
* 可能是相对路径(../addon/shop/views/x.vue)或 root 相对路径(/src/addon/...),
* 仅按 '@/' 前缀做文本匹配无法拦截,于是插件源码被打进了不该出现的产物:
* - build:core → dist/assets 里出现插件的 .vue / .css / 图片
* - build:addon → 单个插件包里混入其他全部插件的源码与整个 core 的副本
* (参考 scripts/generate-addon-entry.cjs 中关于「数百个核心 .vue 打进插件包」的说明)
*
* 两层处理:
* 1) transform(pre,早于 vite:import-glob):把「全量扫描 src」的 glob 收窄成
* 「自身插件 + 白名单 core 目录」,使 glob 既不会展开出其他插件/core 的代码,
* 也不会残留取不到内容的 key(取值不到的 key 只会让业务走 delete 分支,安全降级)。
* 2) resolveId:把 source 结合 importer 解析成绝对路径后判定,命中则返回空模块。
* 静态 import 与 glob 展开出的 import 在此被同等处理。
*
* @param {object} options
* @param {'core'|'addon'} options.mode core=排除全部插件;addon=排除自身以外的插件
* @param {string} [options.addonKey] addon 模式下正在构建的插件 key(自身保留)
* @param {string} options.root 项目根目录(admin/)
* @param {boolean} [options.allowMetaJson] core 模式下是否放行插件的语言包与布局注册 json
* @param {string[]} [options.coreGlobAllow] addon 模式下全量 glob 收窄时保留的 core 目录
*/
const path = require('path')
const VIRTUAL_PREFIX = '\0addon-external:'
const VIRTUAL_JSON_SUFFIX = '|json'
/** 插件语言包 json */
const ADDON_LANG_JSON_RE = /\/src\/addon\/[^/]+\/lang\/.+\.json$/
/** 插件向系统注册的布局选项,core 需要它才能列出可切换布局 */
const ADDON_LAYOUT_JSON_RE = /\/src\/addon\/[^/]+\/layout\/layout\.json$/
/**
* src/lang/i18n.ts 用 globEager 把插件 common.json 合并进主字典:
* eager 是内联进主 bundle,不会产生独立 chunk 文件,保留它没有产物代价。
* 而 src/utils/addon-lang.ts / addon_panel 用的是 lazy 或全量 glob,会为每个
* json 生成独立 chunk(dist/assets 下的 _giftcard.edit-xxx.js 之类),必须排除。
* 排除后语言包仍可用:loadAddonLang 依次回退到插件产物内联 langs、
* 以及 /admin/assets/addons/{key}/lang/ 静态资源(assemble 的 copyLang 会拷贝)。
*/
const I18N_ENTRY_RE = /\/src\/lang\/i18n\.[jt]s$/
/** 全量扫描 src 的 glob pattern(会命中所有插件 + 整个 core) */
const FULL_SCAN_PATTERN_RE = /^(\*\*\/|@\/\*\*|\.\.\/\*\*|\.\/\*\*|\/\*\*)/
/** addon 模式下,全量 glob 收窄后仍保留的 core 目录(后端下发的详情展示组件所在处) */
const DEFAULT_CORE_GLOB_ALLOW = ['/src/app/views/diy_form/components/*.vue']
function toPosix(p) {
return p.replace(/\\/g, '/')
}
/** 把 import 说明符解析为绝对路径,无法解析(裸模块名)时返回 null */
function resolveAbsolute(source, importer, root) {
const clean = source.split('?')[0].split('#')[0]
if (!clean || clean.startsWith('\0')) return null
if (clean.startsWith('@/')) return path.join(root, 'src', clean.slice(2))
if (clean.startsWith('./') || clean.startsWith('../')) {
if (!importer) return null
const importerPath = importer.split('?')[0]
if (!importerPath || importerPath.startsWith('\0')) return null
return path.resolve(path.dirname(importerPath), clean)
}
// vite root 相对路径(/src/...)
if (clean.startsWith('/')) return path.join(root, clean.slice(1))
if (path.isAbsolute(clean)) return clean
return null
}
/** 被排除模块的内容:json 给空对象,组件给渲染 null 的合法组件(避免 Vue 报缺少 render) */
function emptyModuleCode(isJson) {
return isJson ? 'export default {}' : 'export default { render() { return null } }'
}
/**
* core(框架)源码目录:命中它们的 glob 会把整个框架打进插件包。
* 注意末尾用 (\/|$):path.resolve('../app/') 返回的路径不带尾部斜杠。
*/
const CORE_SRC_DIR_RE = /\/src\/(app|components|layout)(\/|$)/
/** glob pattern 是否命中 core 目录(取首个 * 之前的目录前缀解析后判定) */
function isCoreGlobPattern(pattern, importer, root) {
const prefix = pattern.split('*')[0]
if (!prefix) return false
const abs = resolveAbsolute(prefix, importer, root)
if (!abs) return false
return CORE_SRC_DIR_RE.test(toPosix(abs))
}
function replaceGlob(eager, patterns, rest) {
const list = patterns.map((p) => JSON.stringify(p)).join(', ')
return `import.meta.glob${eager || ''}([${list}]${rest})`
}
function createExcludeAddonPlugin(options) {
const {
mode,
addonKey = '',
root,
allowMetaJson = false,
coreGlobAllow = DEFAULT_CORE_GLOB_ALLOW
} = options
return {
name: 'exclude-addon-source',
enforce: 'pre',
// 早于 vite:import-glob:收窄全量 glob,避免展开出其他插件 / core 副本
transform(code, id) {
if (mode !== 'addon' || !addonKey) return null
if (!code.includes('import.meta.glob')) return null
const replaced = code.replace(
/import\.meta\.glob(Eager)?\s*\(\s*([\s\S]*?)\)/g,
(full, eager, args) => {
const matched = args.match(/^(['"])([^'"]*)\1([\s\S]*)$/)
if (!matched) return full
const pattern = matched[2]
const rest = matched[3] || ''
// 命中 core 目录:典型是 src/utils/addon-loader 的 coreVueModules
// (../app/**、../components/**、../layout/**)。addon-loader 会被打进插件包,
// 这些 glob 展开后把整个框架的 vue 都变成插件 chunk(cash_out.vue 之类),
// 因此收窄为白名单;插件对 core 组件的静态 import 不受影响。
if (isCoreGlobPattern(pattern, id, root)) {
return replaceGlob(eager, coreGlobAllow, rest)
}
if (!FULL_SCAN_PATTERN_RE.test(pattern)) return full
const extMatched = pattern.match(/\*\.[A-Za-z0-9]+$/)
const ext = extMatched ? extMatched[0] : '*'
const patterns = [`/src/addon/${addonKey}/views/**/${ext}`, ...coreGlobAllow]
return replaceGlob(eager, patterns, rest)
}
)
if (replaced === code) return null
return { code: replaced, map: null }
},
resolveId(source, importer) {
if (!source || source.includes('*')) return null
const importerNorm = importer ? toPosix(importer.split('?')[0]) : ''
const importerAddon = importerNorm.match(/\/src\/addon\/([^/]+)\//)
// 插件源码内部的互相引用:仅放行「自身插件」(addon 模式)
if (importerAddon && mode === 'addon' && importerAddon[1] === addonKey) return null
const abs = resolveAbsolute(source, importer, root)
if (!abs) return null
const norm = toPosix(abs)
const matched = norm.match(/\/src\/addon\/([^/]+)\//)
if (!matched) return null
const key = matched[1]
// addon 模式:正在构建的插件自身保留
if (mode === 'addon' && key === addonKey) return null
// core 模式:仅放行布局注册 json 与 i18n.ts 内联的 common 语言包
if (mode === 'core' && allowMetaJson) {
if (ADDON_LAYOUT_JSON_RE.test(norm)) return null
if (ADDON_LANG_JSON_RE.test(norm) && I18N_ENTRY_RE.test(importerNorm)) return null
}
// 所有被排除模块共用一个虚拟 id:
// 若按原路径生成唯一 id,rollup 会为每个插件文件单独产出一个空 chunk
//(dist/assets 下就会出现 giftcard-xxx.js 这类只有 export default {} 的文件),
// 共用 id 后最多只产出 json / 非 json 两个空模块,不会污染产物目录。
const isJson = /\.json$/i.test(norm)
return VIRTUAL_PREFIX + 'empty' + (isJson ? VIRTUAL_JSON_SUFFIX : '')
},
load(id) {
if (!id.startsWith(VIRTUAL_PREFIX)) return null
return {
code: emptyModuleCode(id.endsWith(VIRTUAL_JSON_SUFFIX)),
moduleSideEffects: false,
map: null
}
}
}
}
module.exports = { createExcludeAddonPlugin, VIRTUAL_PREFIX }

View File

@ -1,62 +0,0 @@
import request from '@/utils/request'
/**
* 获取官网内嵌页地址(登录页 / 授权页)
* @param params mode: login | authorize | switch; origin: 父页面 origin
*/
export function getEmbedUrl(params: Record<string, any>) {
return request.get('niucloud/account/embed_url', params, { showErrorMessage: false })
}
/**
* 获取官网账号与当前授权信息
*/
export function getAccountInfo() {
return request.get('niucloud/account/info', {}, { showErrorMessage: false })
}
/**
* 选用授权(选中即写入系统授权配置 NIUCLOUD_CONFIG 并生效)
* 成功提示由页面统一给出,这里关掉请求层的提示,避免弹两次
*/
export function selectAuthorization(params: Record<string, any>) {
return request.post('niucloud/account/select', params, { showSuccessMessage: false })
}
/**
* 取消选用授权(清空系统已选授权,回到未授权状态)
* 幂等:系统本就无授权时同样返回成功
* 成功提示由页面统一给出,这里关掉请求层的提示,避免弹两次
*/
export function cancelAuthorization(params: Record<string, any> = {}) {
return request.post('niucloud/account/cancel', params, { showSuccessMessage: false })
}
/**
* 绑定授权(与选用授权等价,保留接口兼容;同样复用现有授权校验链路)
*/
export function bindAuthorization(params: Record<string, any>) {
return request.post('niucloud/account/bind', params, { showSuccessMessage: true })
}
/**
* 保存官网账号登录态(内嵌页登录/会话回传,用于下次进入免登录)
* 令牌只落到服务端配置,前端不再持有
*/
export function saveAccountToken(params: Record<string, any>) {
return request.post('niucloud/account/token', params, { showSuccessMessage: false })
}
/**
* 退出官网账号会话(不解除本地授权)
*/
export function logoutAccount() {
return request.post('niucloud/account/logout', {}, { showSuccessMessage: true })
}
/**
* 同步当前授权状态
*/
export function syncAccountState() {
return request.get('niucloud/account/sync_state', {}, { showSuccessMessage: true })
}

View File

@ -43,7 +43,14 @@ export function uninstallAddon(params: Record<string, any>) {
return request.post(`addon/uninstall/${ params.addon }`, params, { showSuccessMessage: true }) return request.post(`addon/uninstall/${ params.addon }`, params, { showSuccessMessage: true })
} }
// 插件安装前检测已统一到通用校验(sys/check?scene=addon_install) /**
* 插件安装前检测
* @param addon
* @returns
*/
export function preInstallCheck(addon: string) {
return request.get(`addon/install/check/${ addon }`)
}
/** /**
* 获取正在安装的插件 * 获取正在安装的插件
@ -62,7 +69,14 @@ export function getAddonCloudInstallLog(addon: string) {
return request.get(`addon/cloudinstall/${ addon }`) return request.get(`addon/cloudinstall/${ addon }`)
} }
// 插件卸载前检测已统一到通用校验(sys/check?scene=addon_uninstall) /**
* 插件卸载前检测
* @param addon
* @returns
*/
export function preUninstallCheck(addon: string) {
return request.get(`addon/uninstall/check/${ addon }`)
}
/** /**
* 取消插件安装 * 取消插件安装

View File

@ -1,92 +0,0 @@
import request from '@/utils/request'
import storage from '@/utils/storage'
import envConfig from '@/utils/config'
/**
* 校验场景
* - cloud_build:云编译(发版 / 编译前)
* - upgrade :系统升级(升级前)
*
* 注意:这里不能加 export。
* .build/shared/core-shared.ts 是由脚本聚合各 api 模块导出生成的 barrel。
* 该脚本按值重导出成员,而类型别名编译后并不存在于运行时,
* 被收进去会在 Rollup 阶段报「成员未导出」的错误。
* 保持模块内可见即可,函数签名里使用它不受影响。
*
* ★ 另外:该脚本是扫源码文本匹配的(不做语法解析),本文件注释里
* 不要写出导出语句的字面示例,否则会被误当成真实导出写进 barrel。
*/
type CheckScene = 'cloud_build' | 'upgrade' | string
/**
* 场景校验清单(不执行检测)
*
* 前端先拿到清单渲染出完整的待校验列表,再连接 SSE 逐项点亮结果,
* 避免「等待首帧时空白 / 清单到达时突然出现」的观感。
* @param scene 场景
*/
export function getCheckMeta(scene: CheckScene) {
return request.get('sys/check/meta', {
params: { scene },
showErrorMessage: false
})
}
/**
* 清单缓存:同一场景的校验项由后端字典固定,缓存后再次打开弹窗可立即渲染,
* 省掉一次请求(注意:这里是模块级变量,跨组件实例共享)
*/
const sceneMetaCache = new Map<string, { title: string, tip: string, items: any[] }>()
export function getCachedSceneMeta(scene: CheckScene): { title: string, tip: string, items: any[] } | null {
return sceneMetaCache.get(String(scene)) ?? null
}
export function setCachedSceneMeta(scene: CheckScene, meta: { title: string, tip: string, items: any[] }) {
if (!scene) return
sceneMetaCache.set(String(scene), meta)
}
/**
* 一次性校验(SSE 不可用时的降级通道)
* @param scene 场景
* @param params 业务参数(如升级的 addon)
*/
export function runCheck(scene: CheckScene, params: Record<string, any> = {}) {
return request.get('sys/check/run', {
params: { scene, params: JSON.stringify(params) },
showErrorMessage: false
})
}
/**
* 构造流式校验的 SSE 地址
*
* EventSource 不支持自定义请求头,token 与 site-id 只能通过 query 传递
* (后端 Request::adminToken() / Request::adminSiteId() 已支持 query 回退)。
* 拼接口径与站内信推送、代码完整性检测保持一致。
*
* ★ 返回**绝对地址**:EventSource 是浏览器原生请求,不经过 request 封装,
* 没有 baseURL 兜底,相对地址在子路径部署时会连到错误位置。
*
* @param scene 场景
* @param params 业务参数(会被序列化为 JSON 字符串,避免 URL 参数结构限制)
*/
export function getCheckStreamUrl(scene: CheckScene, params: Record<string, any> = {}): string {
const token = storage.get('token') || ''
const siteId = storage.get('siteId') || 0
const base = envConfig.VITE_APP_BASE_URL || '/adminapi/'
const prefix = base.startsWith('http') ? base : `${ location.origin }${ base.startsWith('/') ? '' : '/' }${ base }`
const path = `${ prefix }${ prefix.endsWith('/') ? '' : '/' }sys/check/stream`
const tokenKey = envConfig.VITE_REQUEST_HEADER_TOKEN_KEY || 'token'
const siteIdKey = envConfig.VITE_REQUEST_HEADER_SITEID_KEY || 'site-id'
const query = new URLSearchParams({
[ tokenKey ]: String(token),
[ siteIdKey ]: String(siteId),
scene: String(scene),
params: JSON.stringify(params ?? {})
})
return `${ path }?${ query.toString() }`
}

View File

@ -40,8 +40,8 @@ function createCloudCompileRequest() {
const cloudCompileRequest = createCloudCompileRequest() const cloudCompileRequest = createCloudCompileRequest()
export function cloudBuild(data = {}) { export function cloudBuild() {
return request.post('niucloud/build', data) return request.post('niucloud/build')
} }
export function getCloudBuildTask() { export function getCloudBuildTask() {
@ -52,14 +52,12 @@ export function getCloudBuildLog() {
return request.get('niucloud/build/log') return request.get('niucloud/build/log')
} }
export function clearCloudBuildTask(type: 'finish' | 'cancel' = 'cancel') { export function clearCloudBuildTask() {
return request.post('niucloud/build/clear', { type }, { showErrorMessage: false, showSuccessMessage: false }) return request.post('niucloud/build/clear', {}, { showErrorMessage: false, showSuccessMessage: false })
} }
// 编译前检测已统一到通用校验(sys/check?scene=cloud_build) export function preBuildCheck() {
return request.get('niucloud/build/check')
export function getBuildCommand() {
return request.get('niucloud/build/command')
} }
export function getCloudBuildQueuePosition(taskId: string) { export function getCloudBuildQueuePosition(taskId: string) {
@ -78,35 +76,15 @@ export function setCloudCompileLocalUrl(url: string) {
return request.post('niucloud/build/set_local_url', { url }) return request.post('niucloud/build/set_local_url', { url })
} }
/** export function startServerDownload(taskId: string, downloadUrl: string, authorizeCode: string, timestamp: string) {
* 编译端口列表(含端口说明与最近一次发版记录) return request.post('niucloud/build/start_server_download', {
*/ task_id: taskId,
export function getBuildPorts() { download_url: downloadUrl,
return request.get('niucloud/build/ports') authorize_code: authorizeCode,
} timestamp
/**
* 发版记录分页
*/
export function getBuildVersionList(params: Record<string, any>) {
return request.get('niucloud/build/version', { params })
}
/**
* 发布 / 取消发布
* @param id 版本记录 id
* @param releaseStatus 0未发布 / 1已发布
*/
export function setBuildVersionRelease(id: number | string, releaseStatus: number) {
return request.post('niucloud/build/version/release', { id, release_status: releaseStatus }, { showSuccessMessage: true })
}
/**
* 删除发版记录
*/
export function delBuildVersions(ids: string | number[]) {
return request.delete('niucloud/build/version', {
params: { ids: Array.isArray(ids) ? ids.join(',') : ids },
showSuccessMessage: true
}) })
} }
export function getSseBuildLog(taskId: string) {
return request.get('niucloud/build/get_sse_build_log', { params: { task_id: taskId } })
}

View File

@ -1,116 +0,0 @@
import request from '@/utils/request'
import storage from '@/utils/storage'
import envConfig from '@/utils/config'
/**
* 目标列表(含各自版本与清单状态)
* @param params { algorithm, is_bom, is_crlf_lf } 可选,用于让状态反映当前规则
*/
export function getIntegrityTargets(params?: Record<string, any>) {
return request.get(`sys/integrity/targets`, { params })
}
/**
* 可选算法
*/
export function getIntegrityAlgorithms() {
return request.get(`sys/integrity/algorithms`)
}
/**
* 页面配置(默认算法 / 分片大小 / 产品 / 版本 / 清单根目录 / 当前规则)
*/
export function getIntegrityConfig() {
return request.get(`sys/integrity/config`)
}
/**
* 单个目标的清单状态
* @param params { target, algorithm, is_bom, is_crlf_lf }
*/
export function getIntegrityBaselineStatus(params: Record<string, any>) {
return request.get(`sys/integrity/baseline_status`, { params })
}
/**
* 分片检测
* @param params { target, path, algorithm, is_bom, is_crlf_lf, cursor }
*/
export function checkIntegrity(params: Record<string, any>) {
return request.post(`sys/integrity/check`, params)
}
/**
* 单个文件的文本比对(官方 vs 本地)
* @param params { target, file, algorithm, is_bom, is_crlf_lf }
*/
export function getIntegrityFileDiff(params: Record<string, any>) {
return request.get(`sys/integrity/file_diff`, { params })
}
/**
* 用官方内容写回本地文件(覆盖前逐文件备份)
* @param data { target, files: string[], algorithm, is_bom, is_crlf_lf }
*/
export function restoreIntegrityFiles(data: Record<string, any>) {
return request.post(`sys/integrity/restore`, data)
}
/**
* 备份列表(写回前留下的备份,供查看与恢复)
*/
export function getIntegrityBackupList() {
return request.get(`sys/integrity/backup_list`)
}
/**
* 从备份恢复:把备份里的文件拷回本地原位置(覆盖前再备份一次当前内容)
* @param data { stamp, target, files?: string[] } files 不传 = 恢复整批
*/
export function restoreIntegrityBackup(data: Record<string, any>) {
return request.post(`sys/integrity/backup_restore`, data)
}
/**
* 删除备份:整批删除(files 不传)或只删批内选中的文件
* @param data { stamp, target, files?: string[] }
*/
export function deleteIntegrityBackup(data: Record<string, any>) {
return request.post(`sys/integrity/backup_delete`, data)
}
/**
* 构造流式检测的 SSE 地址
*
* EventSource 不支持自定义请求头,token 与 site-id 只能通过 query 传递
* (后端 Request::adminToken() / Request::adminSiteId() 已支持 query 回退)。
* 拼接口径与站内信推送的 getMessageStreamUrl() 保持一致,避免两处各写一套。
*
* ★ 返回的是**绝对地址**:EventSource 用的是浏览器原生请求,不经过项目的 request 封装,
* 也就没有 baseURL 兜底,相对地址在子路径部署时会连到错误的位置。
*
* @param params { target, path, algorithm, is_bom, is_crlf_lf }
*/
export function getIntegrityStreamUrl(params: Record<string, any> = {}) {
const token = storage.get('token') || ''
const siteId = storage.get('siteId') || 0
const base = envConfig.VITE_APP_BASE_URL || '/adminapi/'
const prefix = base.startsWith('http') ? base : `${location.origin}${base.startsWith('/') ? '' : '/'}${base}`
const path = `${prefix}${prefix.endsWith('/') ? '' : '/'}sys/integrity/stream`
const tokenKey = envConfig.VITE_REQUEST_HEADER_TOKEN_KEY || 'token'
const siteIdKey = envConfig.VITE_REQUEST_HEADER_SITEID_KEY || 'site-id'
const query = new URLSearchParams({
[tokenKey]: String(token),
[siteIdKey]: String(siteId)
})
Object.keys(params).forEach(key => {
const value = params[key]
if (value !== undefined && value !== null && value !== '') {
query.set(key, String(value))
}
})
return `${path}?${query.toString()}`
}

View File

@ -1,6 +1,4 @@
import request from '@/utils/request' import request from '@/utils/request'
import storage from '@/utils/storage'
import envConfig from '@/utils/config'
/***************************************************** 消息管理 ****************************************************/ /***************************************************** 消息管理 ****************************************************/
@ -374,86 +372,3 @@ export function resetPassword(username: string, params: Record<string, any>) {
export function clearTemplate(username: string,template_id: string) { export function clearTemplate(username: string,template_id: string) {
return request.delete(`notice/niusms/template/${username}/${template_id}`) return request.delete(`notice/niusms/template/${username}/${template_id}`)
} }
/***************************************************** 站内信(消息中心) ****************************************************/
/**
* 消息分类树
*/
export function getMessageCategory() {
return request.get('notice/message/category')
}
/**
* 消息列表
* @param params
*/
export function getMessageList(params: Record<string, any>) {
return request.get('notice/message/list', { params })
}
/**
* 消息详情
* @param id
*/
export function getMessageInfo(id: number) {
return request.get(`notice/message/info/${id}`)
}
/**
* 各分类未读数量
*/
export function getMessageUnreadCount() {
return request.get('notice/message/unread_count')
}
/**
* 标记已读(ids 为空表示全部已读)
* @param ids
*/
export function markMessageRead(ids: number[]) {
return request.put('notice/message/mark_read', { ids })
}
/**
* 删除消息
* @param ids
*/
export function deleteMessage(ids: number[]) {
return request.delete('notice/message/del', { data: { ids } })
}
/**
* 构造 SSE 连接地址
*
* EventSource 不支持自定义请求头,token 与 site-id 只能通过 query 传递,
* 后端 Request::adminToken() / Request::adminSiteId() 已支持 query 回退。
*/
export function getMessageStreamUrl(): string {
const token = storage.get('token') || ''
const siteId = storage.get('siteId') || 0
const base = envConfig.VITE_APP_BASE_URL || '/adminapi/'
const prefix = base.startsWith('http') ? base : `${location.origin}${base.startsWith('/') ? '' : '/'}${base}`
const path = `${prefix}${prefix.endsWith('/') ? '' : '/'}notice/message/stream`
const tokenKey = envConfig.VITE_REQUEST_HEADER_TOKEN_KEY || 'token'
const siteIdKey = envConfig.VITE_REQUEST_HEADER_SITEID_KEY || 'site-id'
return `${path}?${tokenKey}=${encodeURIComponent(token)}&${siteIdKey}=${encodeURIComponent(String(siteId))}`
}
/**
* 长轮询监听消息变化(SSE 不可用时的降级通道)
*
* 服务端最多挂起 25 秒,因此超时必须大于该值,否则每次都会在前端被掐断。
* showErrorMessage 置为 false:轮询是后台静默请求,网络抖动不应弹全局错误提示。
*
* @param version 上次返回的版本号,首次传空字符串
* @param signal 用于页面隐藏 / 切换站点时中止在途请求
*/
export function getMessageListen(version: string, signal?: AbortSignal) {
return request.get('notice/message/listen', {
params: { version },
timeout: 35000,
showErrorMessage: false,
signal
})
}

View File

@ -1,134 +0,0 @@
import request from '@/utils/request'
/**
* 开放平台设置 - 获取(总开关)
*/
export function getOpenapiConfig() {
return request.get('openapi/config')
}
/**
* 开放平台设置 - 保存(总开关,仅平台端可修改)
*/
export function setOpenapiConfig(data: Record<string, any>) {
return request.post('openapi/config', data)
}
/**
* 开放平台设置 - 刷新数据加密密钥(仅平台端)
*/
export function refreshOpenapiSecret() {
return request.post('openapi/config/secret')
}
/**
* 开放账号列表
*/
export function getOpenapiAppPage(params: Record<string, any>) {
return request.get('openapi/app/pages', { params })
}
/**
* 开放账号详情
*/
export function getOpenapiAppInfo(id: number) {
return request.get(`openapi/app/${ id }`)
}
/**
* 查看密钥明文
*/
export function getOpenapiAppSecret(id: number) {
return request.get(`openapi/app/secret/${ id }`)
}
/**
* 新增开放账号
*/
export function addOpenapiApp(data: Record<string, any>) {
return request.post('openapi/app', data)
}
/**
* 编辑开放账号
*/
export function editOpenapiApp(id: number, data: Record<string, any>) {
return request.put(`openapi/app/${ id }`, data)
}
/**
* 启用 / 禁用开放账号
*/
export function setOpenapiAppStatus(id: number, status: number) {
return request.put(`openapi/app/status/${ id }`, { status })
}
/**
* 重置密钥
*/
export function resetOpenapiAppSecret(id: number) {
return request.put(`openapi/app/reset-secret/${ id }`)
}
/**
* 批量重置密钥
*/
export function batchResetOpenapiSecret(ids: number[]) {
return request.put('openapi/app/batch/reset-secret', { ids })
}
/**
* 删除开放账号
*/
export function deleteOpenapiApp(id: number) {
return request.delete(`openapi/app/${ id }`)
}
/**
* 可授权接口清单
*/
export function getOpenapiApiTree() {
return request.get('openapi/app/api-tree')
}
/**
* 调用日志列表
*/
export function getOpenapiLogPage(params: Record<string, any>) {
return request.get('openapi/log/pages', { params })
}
/**
* 接口文档 - 接口清单树(按端过滤:admin 平台端 / site 站点端)
*/
export function getOpenapiDocTree(appType?: string) {
return request.get('openapi/doc/tree', { params: { app_type: appType || '' } })
}
/**
* 接口文档 - 接口详情
*/
export function getOpenapiDocDetail(apiKey: string) {
return request.get('openapi/doc/detail', { params: { api_key: apiKey } })
}
/**
* 接口文档 - 调试基础信息
*/
export function getOpenapiDocBase() {
return request.get('openapi/doc/base')
}
/**
* 接口文档 - 可调试的开放账号列表
*/
export function getOpenapiDocApps() {
return request.get('openapi/doc/apps')
}
/**
* 接口文档 - 调试账号密钥
*/
export function getOpenapiDocSecret(id: number) {
return request.get(`openapi/doc/secret/${ id }`)
}

View File

@ -301,11 +301,3 @@ export function getShowApp() {
export function getShowSpecialMenu() { export function getShowSpecialMenu() {
return request.get('site/special_menu') return request.get('site/special_menu')
} }
/**
* 获取站点创建流程(主流程 + 子流程)
* @param params
*/
export function getSiteCreateFlow(params: Record<string, any> = {}) {
return request.get('site/create_flow', { params })
}

View File

@ -14,28 +14,3 @@ export function getStatInfo() {
export function getSiteStatInfo() { export function getSiteStatInfo() {
return request.get(`stat/siteindex`) return request.get(`stat/siteindex`)
} }
/***************************************************** 插件运营面板 **************************************************/
/**
* 插件运营面板-卡片列表
*/
export function getAddonPanelList() {
return request.get(`stat/addon_panel`)
}
/**
* 插件运营面板-插件统计详情
* @param key 插件标识
* @param params 查询参数(days: 7 / 30)
*/
export function getAddonPanelDetail(key: string, params?: Record<string, any>) {
return request.get(`stat/addon_panel/${ key }`, { params })
}
/**
* 插件运营面板-插件关联站点(即将到期 / 会员数排行)
* @param key 插件标识
*/
export function getAddonPanelSites(key: string) {
return request.get(`stat/addon_panel/${ key }/sites`)
}

View File

@ -18,13 +18,6 @@ export function getUrl() {
return request.get('sys/url') return request.get('sys/url')
} }
/**
* 当前站点已开启渠道及访问地址
*/
export function getChannel() {
return request.get('sys/visit_channel')
}
/***************************************************** 用户组 ****************************************************/ /***************************************************** 用户组 ****************************************************/
/** /**
@ -129,41 +122,6 @@ export function deleteMenu(app_type: string, menu_key: string) {
return request.delete(`sys/menu/${ app_type }/${ menu_key }`, { showSuccessMessage: true }) return request.delete(`sys/menu/${ app_type }/${ menu_key }`, { showSuccessMessage: true })
} }
/**
* 导出菜单(平台/站点)
* @param app_type admin | site
* @param addons 导出范围:空数组=全部;[''] 表示仅系统菜单;['', 'shop'] 表示系统菜单+商城
* @returns
*/
export function exportMenu(app_type: string, addons: string[] = []) {
return request.get(`sys/menu/export/${ app_type }`, {
params: { addons: JSON.stringify(addons) },
responseType: 'blob',
showErrorMessage: false
})
}
/**
* 导入菜单(平台/站点)
* @param app_type admin | site
* @param data FormData,包含 file 菜单文件与 overwrite 是否覆盖同名菜单
* @returns
*/
export function importMenu(app_type: string, data: FormData) {
// 必须覆盖默认的 application/json,否则 axios 会把 FormData 转成 JSON 导致文件上传失败
return request.post(`sys/menu/import/${ app_type }`, data, {
headers: { 'Content-Type': 'multipart/form-data' }
})
}
/**
* 获取菜单导入的PHP上传限制配置
* @returns
*/
export function getMenuImportConfig() {
return request.get('sys/menu/import/config', { showErrorMessage: false })
}
/** /**
* 获取系统菜单 * 获取系统菜单
* *
@ -249,23 +207,6 @@ export function getService() {
return request.get('sys/config/service') return request.get('sys/config/service')
} }
/**
* 获取渠道设置
* @returns
*/
export function getChannelSetting() {
return request.get('sys/config/channel')
}
/**
* 设置渠道设置
* @param params
* @returns
*/
export function setChannelSetting(params: Record<string, any>) {
return request.put('sys/config/channel', params)
}
/** /**
* 更新版权设置 * 更新版权设置
* @param params * @param params
@ -418,50 +359,6 @@ export function editStorage(params: Record<string, any>) {
return request.put(`sys/storage/${ params.storage_type }`, params, { showSuccessMessage: true }) return request.put(`sys/storage/${ params.storage_type }`, params, { showSuccessMessage: true })
} }
/**
* 获取存储配置列表(多套配置)
*/
export function getStorageConfigList() {
return request.get(`sys/storage/config/list`)
}
/**
* 新增存储配置
* @param params
* @returns
*/
export function addStorageConfig(params: Record<string, any>) {
return request.post(`sys/storage/config`, params, { showSuccessMessage: true })
}
/**
* 编辑存储配置
* @param id
* @param params
* @returns
*/
export function editStorageConfig(id: number | string, params: Record<string, any>) {
return request.put(`sys/storage/config/${ id }`, params, { showSuccessMessage: true })
}
/**
* 启用存储配置
* @param id
* @returns
*/
export function useStorageConfig(id: number | string) {
return request.put(`sys/storage/config/use/${ id }`, {}, { showSuccessMessage: true })
}
/**
* 删除存储配置
* @param id
* @returns
*/
export function deleteStorageConfig(id: number | string) {
return request.delete(`sys/storage/config/${ id }`, { showSuccessMessage: true })
}
/***************************************************** 支付设置 ****************************************************/ /***************************************************** 支付设置 ****************************************************/
/** /**
@ -695,7 +592,7 @@ export function setPatConfig(params: Record<string, any>) {
* 刷新菜单 * 刷新菜单
*/ */
export function menuRefresh() { export function menuRefresh() {
return request.post(`sys/menu/refresh`, {}, { showSuccessMessage: true }) return request.post(`sys/menu/refresh`, {})
} }
/** /**
@ -905,13 +802,3 @@ export function getQrcode(params: Record<string, any>) {
export function checkJobStatus() { export function checkJobStatus() {
return request.get(`sys/job`) return request.get(`sys/job`)
} }
/**
* 平台端队列检测提醒
* 平台端后台访问时调用:后端检测队列未运行会发送站内信,恢复后发送「已恢复」
* 站点端不调用(后端也会按 site_id 二次拦截)
* @returns
*/
export function checkQueueNotice() {
return request.get(`sys/queue_notice`, { showErrorMessage: false })
}

View File

@ -1,120 +0,0 @@
import request from '@/utils/request'
/**
* 获取当前进行中的任务(按站点隔离:互斥任务与非互斥任务可并行)
* 返回:list(全部进行中任务)、queue_alive(队列是否可用)与优先展示的任务字段(互斥任务优先)
*/
export function getTaskActive() {
return request.get('task/active', { showErrorMessage: false })
}
/**
* 任务筛选配置(类型 / 状态选项,由后端字典统一维护)
* @returns { types: [{label,value}], status: [{label,value}] }
*/
export function getTaskConfig() {
return request.get('task/config')
}
/**
* 创建统一任务
* @param taskType cloud_build / upgrade
* @param params 业务入参(云编译:scope/port/addon;升级:addon/data)
*/
export function createTask(taskType: string, params: Record<string, any> = {}) {
return request.post(`task/create/${ taskType }`, { params }, { showSuccessMessage: false })
}
/**
* 任务详情
*/
export function getTaskDetail(taskKey: string) {
return request.get(`task/${ taskKey }`, { showErrorMessage: false })
}
/**
* 驱动任务推进一片/一步
* 队列可用时后端只回显状态不推进(driven_by=queue);
* 前端判定队列假死(状态长时间无变化)时传 force=true 强制接管驱动
*/
export function runTask(taskKey: string, cursor: string = '', force: boolean = false) {
return request.post(`task/${ taskKey }/run`, { cursor, force: force ? 1 : 0 }, { showErrorMessage: false, showSuccessMessage: false })
}
/**
* 用户决策(仅 waiting_input 状态生效)
* @param code retry / cancel / rollback / continue
*/
export function operateTask(taskKey: string, code: string) {
return request.post(`task/${ taskKey }/operate`, { code }, { showSuccessMessage: false })
}
/**
* 取消任务
*/
export function cancelTask(taskKey: string) {
return request.post(`task/${ taskKey }/cancel`)
}
/**
* 终端输出事件(增量 / 全量回放)
* @param taskKey
* @param afterSeq 增量起点(0 表示全量)
* @param limit 0 不限
*/
export function getTaskEvents(taskKey: string, afterSeq: number = 0, limit: number = 0) {
return request.get(`task/${ taskKey }/events`, {
params: { after_seq: afterSeq, limit },
showErrorMessage: false
})
}
/**
* 节点审计记录
*/
export function getTaskSteps(taskKey: string) {
return request.get(`task/${ taskKey }/steps`, { showErrorMessage: false })
}
/**
* 任务记录分页列表
*/
export function getTaskRecords(params: Record<string, any>) {
return request.get('task/records', { params })
}
/**
* 任务产物(云编译:download.zip + 产物目录;备份:归档目录等)
* @param taskKey 任务标识
* @param depth 目录展开层数,默认 2 层
*/
export function getTaskArtifacts(taskKey: string, depth: number = 2, taskType: string = '') {
return request.get(`task/${ taskKey }/artifact`, {
params: { depth, type: taskType },
showErrorMessage: false
})
}
/**
* 下载任务产物(二进制流)
* @param taskKey 任务标识
* @param path 产物内相对路径;不传表示下载产物压缩包
*/
export function downloadTaskArtifact(taskKey: string, path: string = '', taskType: string = '') {
return request.get(`task/${ taskKey }/artifact/download`, {
params: { path, type: taskType },
responseType: 'blob',
showErrorMessage: false
})
}
/**
* 删除任务记录(同步清理任务目录)
* @param ids 逗号分隔字符串或 id 数组
*/
export function delTaskRecords(ids: string | number[]) {
return request.delete('task/records', {
params: { ids: Array.isArray(ids) ? ids.join(',') : ids },
showSuccessMessage: true
})
}

View File

@ -178,25 +178,6 @@ export function getGeneratorTableColumn(params: any) {
return request.get(`generator/table_column`, { params }) return request.get(`generator/table_column`, { params })
} }
/***************************************************** 数据库修复 ****************************************************/
/**
* 数据库结构检测
* @returns
*/
export function getDatabaseRepairCheck() {
return request.get(`sys/database_repair/check`)
}
/**
* 数据库结构一键修复
* @param params {source: 来源, type: 差异类型}
* @returns
*/
export function repairDatabase(params: Record<string, any> = {}) {
return request.post(`sys/database_repair/repair`, params, { showSuccessMessage: true })
}
/** /**
* 同步校验 * 同步校验
*/ */

View File

@ -32,7 +32,12 @@ export function executeUpgrade() {
return request.post('upgrade/execute', {}, { showErrorMessage: false }) return request.post('upgrade/execute', {}, { showErrorMessage: false })
} }
// 升级前检测已统一到通用校验(sys/check?scene=upgrade) /**
* 升级前检测
*/
export function preUpgradeCheck(addon: string = '') {
return request.get(addon ? `upgrade/check/${ addon }` : 'upgrade/check')
}
/** /**
* 清除 * 清除
@ -66,15 +71,6 @@ export function delUpgradeRecords(params: Record<string, any>) {
return request.delete(`upgrade/records`, { params }) return request.delete(`upgrade/records`, { params })
} }
/**
* 删除升级记录对应的备份(备份记录 + 归档目录),升级记录本身保留
* @param upgradeKeys upgrade_key 数组或逗号分隔字符串
*/
export function delUpgradeBackup(upgradeKeys: string | string[]) {
const upgrade_key = Array.isArray(upgradeKeys) ? upgradeKeys.join(',') : upgradeKeys
return request.post('upgrade/backup/delete', { upgrade_key }, { showSuccessMessage: true })
}
/** /**
* 获取备份记录分页列表 * 获取备份记录分页列表
* @param params * @param params
@ -99,7 +95,12 @@ export function checkDirExist(params: Record<string, any>) {
return request.post('backup/check_dir', params) return request.post('backup/check_dir', params)
} }
// 备份目录权限检测已统一到通用校验(sys/check?scene=backup) /**
* 备份功能 检测目录权限
*/
export function checkPermission(params: Record<string, any>) {
return request.post('backup/check_permission', params)
}
/** /**
* 备份功能 恢复升级备份 * 备份功能 恢复升级备份
@ -159,35 +160,3 @@ export function setLocalUrl(params: Record<string, any>) {
export function getLocalUrl(params: Record<string, any>) { export function getLocalUrl(params: Record<string, any>) {
return request.get("niucloud/build/get_local_url", params) return request.get("niucloud/build/get_local_url", params)
} }
/**
* 框架补丁分页列表
* @param params title / is_resolved
*/
export function getFrameworkPatchList(params: Record<string, any>) {
return request.get('framework_patch', { params })
}
/**
* 框架补丁详情(抽屉展示)
* @param id
*/
export function getFrameworkPatchInfo(id: number) {
return request.get(`framework_patch/${ id }`)
}
/**
* 立即同步云端补丁(入库 + 新补丁推送消息)
*/
export function syncFrameworkPatch() {
return request.post('framework_patch/sync', {})
}
/**
* 标记 / 取消标记补丁已解决
* @param id
* @param is_resolved 1 已解决 / 0 未解决
*/
export function resolveFrameworkPatch(id: number, is_resolved: number) {
return request.put(`framework_patch/resolve/${ id }`, { is_resolved }, { showSuccessMessage: true })
}

View File

@ -67,14 +67,6 @@ export function delVersion(id: number) {
return request.delete(`wxoplatform/weapp/version/${id}`) return request.delete(`wxoplatform/weapp/version/${id}`)
} }
/**
* 直接同步模板库(已上传成功、无模板ID 的记录补跑,不创建任务)
* @param id 小程序版本记录 id
*/
export function syncTemplate(id: number) {
return request.post('wxoplatform/weapp/version/syncTemplate', { id }, { showSuccessMessage: true })
}
/** /**
* 小程序代码提交 * 小程序代码提交
* @returns * @returns

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

View File

@ -0,0 +1,859 @@
<template>
<el-dialog v-model="showDialog" :title="t('cloudbuild.title')" width="850px" :close-on-click-modal="false" :close-on-press-escape="false" :before-close="dialogClose">
<div v-show="active == 'build'" class="h-[50vh]" v-loading="loading">
<div class="h-[50vh] flex flex-col" v-if="cloudBuildCheck && !cloudBuildTask">
<!-- <el-scrollbar> -->
<div class="bg-[#fff] my-3" v-if="cloudBuildCheck.dir">
<div>
<p class="pl-[20px] ">{{ t('cloudbuild.dirPermission') }}</p>
<div class="mt-[10px] mx-[20px] text-[14px] cursor-pointer text-primary flex items-center justify-between bg-[#EFF6FF] rounded-[4px] p-[10px]" @click="cloudBuildCheckDirFn">
<div class="flex items-center">
<el-icon :size="17"><QuestionFilled /></el-icon>
<span class="ml-[5px] leading-[20px]">编译权限错误,查看解决方案</span></div>
<div class="border-[1px] border-primary rounded-[3px] w-[72px] h-[26px] leading-[25px] text-center">立即查看</div>
</div>
</div>
<div class="px-[20px] pt-[10px] text-[14px] el-table">
<el-row class="py-[10px] items table-head-bg pl-[15px] mb-[10px]">
<el-col :span="18">
<span>{{ t('cloudbuild.path') }}</span>
</el-col>
<el-col :span="3">
<span>{{ t('cloudbuild.demand') }}</span>
</el-col>
<el-col :span="3">
<span>{{ t('status') }}</span>
</el-col>
</el-row>
<el-scrollbar style="height: calc(300px); overflow: auto">
<el-row class="pb-[10px] items pl-[15px]" v-for="item in cloudBuildCheck.dir.is_readable">
<el-col :span="18">
<span>{{ item.dir }}</span>
</el-col>
<el-col :span="3">
<span>{{ t('cloudbuild.readable') }}</span>
</el-col>
<el-col :span="3">
<span v-if="item.status"><el-icon color="green"><Select /></el-icon></span>
<span v-else>
<el-icon color="red">
<CloseBold />
</el-icon>
</span>
</el-col>
</el-row>
<el-row class="pb-[10px] items pl-[15px]" v-for="item in cloudBuildCheck.dir.is_write">
<el-col :span="18">
<span>{{ item.dir }}</span>
</el-col>
<el-col :span="3">
<span>{{ t('cloudbuild.write') }}</span>
</el-col>
<el-col :span="3" >
<span v-if="item.status"><el-icon color="green"><Select /></el-icon></span>
<span v-else>
<el-icon color="red">
<CloseBold />
</el-icon>
</span>
</el-col>
</el-row>
</el-scrollbar>
</div>
</div>
<!-- </el-scrollbar> -->
</div>
<div class="h-[45vh]" v-show="cloudBuildTask">
<terminal ref="terminalRef" :name="`cloud-build-${terminalId}`" context="" :init-log="null" :show-header="false" :show-log-time="true" @exec-cmd="onExecCmd"/>
</div>
<div class="flex justify-end mt-[20px]" v-show="cloudBuildTask">
<el-button @click="dialogCancel()" class="!w-[90px]">取消</el-button>
<el-button type="primary" :loading="timeloading" class="!w-[140px]" v-if="!errorInfo">已用时 {{ formattedDuration }}</el-button>
<el-button type="primary" @click="active = 'error'" v-if="errorInfo">下一步</el-button>
</div>
</div>
<div v-show="active == 'error'">
<div class="h-[50vh] flex flex-col">
<div class="flex-1 h-0 flex justify-center items-center flex-col">
<el-result icon="error" :title="t('编译失败')">
<template #icon>
<img src="@/app/assets/images/error_icon.png" alt="">
</template>
<template #extra>
<el-scrollbar class="max-h-[150px] !overflow-auto text-[15px] text-[#4F516D] mb-[15px] mt-[-15px]" v-if="errorInfo">
{{errorInfo}}
</el-scrollbar>
<el-alert :closable="false" class="!mb-[15px] !w-full" v-if="errorAnalysis.analysis" type="warning">
<template #default>
<div class="text-left">
错误分析:{{ errorAnalysis.analysis }}
</div>
</template>
</el-alert>
<el-button @click="handleReturn" class="!w-[90px]">错误信息</el-button>
<el-button @click="againBuild" type="primary" plain class="!w-[90px]" v-if="errorAnalysis.error_addon">重新编译</el-button>
<el-button @click="showDialog=false" type="primary" class="!w-[90px]">完成</el-button>
</template>
</el-result>
</div>
</div>
</div>
<div v-show="active == 'complete'">
<div class="h-[50vh] flex flex-col">
<div class="flex-1 h-0 flex justify-center items-center flex-col">
<el-result icon="success" :title="t('cloudbuild.cloudbuildSuccess')" :sub-title="`编译耗时${formattedDuration},成功编译完成。`">
<template #icon>
<img src="@/app/assets/images/success_icon.png" alt="">
</template>
<template #extra>
<el-button @click="handleReturn" class="!w-[90px]">返回</el-button>
<el-button @click="showDialog=false" type="primary" class="!w-[90px]">完成</el-button>
</template>
</el-result>
</div>
</div>
</div>
<div v-show="active == 'again_build'">
<div class="h-[50vh] flex flex-col">
<div class="flex-1 h-0 flex items-center flex-col">
<el-table
ref="tableRef"
:data="installedAddonList"
row-key="key"
size="large"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" />
<el-table-column label="应用信息" align="left" width="300">
<template #default="{ row }">
<div class="flex items-center cursor-pointer relative left-[-10px]">
<el-image class="w-[54px] h-[54px] rounded-[5px]" :src="row.icon" fit="contain">
<template #error>
<div class="flex items-center w-full h-full rounded-[5px]">
<img class="max-w-full max-h-full" src="@/app/assets/images/icon-addon-one.png" alt="" />
</div>
</template>
</el-image>
<div class="flex-1 w-0 flex flex-col justify-center pl-[20px] font-500 text-[13px]">
<div class="w-[236px] truncate leading-[18px]">{{ row.title }}</div>
</div>
</div>
</template>
</el-table-column>
<el-table-column label="编译结果" align="left">
<template #default="{ row }">
<div class="flex items-center" v-if="errorAnalysis.error_addon && errorAnalysis.error_addon != row.key">
<el-icon class="text-success mr-1"><SuccessFilled /></el-icon> 编译成功
</div>
<div v-else class="flex items-center">
<el-icon class="text-error mr-1"><WarningFilled /></el-icon> 编译失败,请排除该插件后重新进行编译
</div>
</template>
</el-table-column>
</el-table>
</div>
<div class="flex justify-end mt-[20px]">
<el-button @click="dialogCancel()" class="!w-[90px]">取消</el-button>
<el-button @click="active = 'error'" plain type="primary" class="!w-[90px]">上一步</el-button>
<el-button type="primary" @click="againBuild" :loading="loading" class="!w-[100px]">开始编译</el-button>
</div>
</div>
</div>
</el-dialog>
</template>
<script lang="ts" setup>
import { ref, watch, computed } from 'vue'
import { t } from '@/lang'
import { getCloudBuildLog, getCloudBuildTask, cloudBuild, clearCloudBuildTask, preBuildCheck, getCloudBuildQueuePosition, getCloudBuildSseUrl, CLOUD_COMPILE_BASE_URL, startServerDownload, getSseBuildLog } from '@/app/api/cloud'
import { getInstalledAddonList } from '@/app/api/addon'
import { Terminal, TerminalFlash } from 'vue-web-terminal'
import 'vue-web-terminal/lib/theme/dark.css'
import { AnyObject } from '@/types/global'
import {ElNotification, ElMessageBox, ElMessage} from 'element-plus'
const showDialog = ref<boolean>(false)
const terminalId = ref(Date.now())
const cloudBuildTask = ref<null | AnyObject>(null)
const active = ref('build')
const cloudBuildCheck = ref<null | AnyObject>(null)
const loading = ref(false)
const terminalRef = ref(null)
const selectAddon = ref([])
const installedAddonList = ref([])
const tableRef = ref(null)
getInstalledAddonList().then(({ data }) => {
installedAddonList.value = Object.values(data)
})
const handleSelectionChange = (rows) => {
selectAddon.value = rows.map(row => {
return row.key
})
}
let cloudBuildLog = []
let eventSource: EventSource | null = null
interface SSEMessage {
type: string
task_id?: string
percent?: number
action?: string
msg?: string
code?: string
time?: string
download_url?: string
download_percent?: number
downloaded_bytes?: number
total_bytes?: number
authorize_code?: string
timestamp?: string
}
const connectSSE = (taskId: string) => {
if (eventSource) {
eventSource.close()
}
const url = getCloudBuildSseUrl(taskId)
eventSource = new EventSource(url)
eventSource.onopen = () => {
console.log('SSE connected')
}
eventSource.onmessage = (event) => {
try {
const data: SSEMessage = JSON.parse(event.data)
handleSSEMessage(data)
} catch (e) {
console.error('SSE parse error:', e)
}
}
eventSource.addEventListener('progress', (event) => {
try {
const data: SSEMessage = JSON.parse((event as MessageEvent).data)
handleSSEMessage(data)
} catch (e) {
console.error('SSE progress parse error:', e)
}
})
eventSource.addEventListener('complete', (event) => {
try {
const data: SSEMessage = JSON.parse((event as MessageEvent).data)
handleSSEMessage(data)
} catch (e) {
console.error('SSE complete parse error:', e)
}
})
eventSource.addEventListener('failed', (event) => {
try {
const data: SSEMessage = JSON.parse((event as MessageEvent).data)
handleSSEMessage(data)
} catch (e) {
console.error('SSE failed parse error:', e)
}
})
eventSource.addEventListener('heartbeat', () => {
console.log('SSE heartbeat')
})
eventSource.addEventListener('download_start', (event) => {
try {
const data: SSEMessage = JSON.parse((event as MessageEvent).data)
handleSSEMessage(data)
} catch (e) {
console.error('SSE download_start parse error:', e)
}
})
eventSource.addEventListener('download_progress', (event) => {
try {
const data: SSEMessage = JSON.parse((event as MessageEvent).data)
handleSSEMessage(data)
} catch (e) {
console.error('SSE download_progress parse error:', e)
}
})
eventSource.addEventListener('download_complete', (event) => {
try {
const data: SSEMessage = JSON.parse((event as MessageEvent).data)
handleSSEMessage(data)
} catch (e) {
console.error('SSE download_complete parse error:', e)
}
})
eventSource.onerror = (error) => {
console.error('SSE error:', error)
setTimeout(() => {
if (showDialog.value && cloudBuildTask.value) {
getCloudBuildLogFn()
}
}, 5000)
}
}
const handleSSEMessage = (data: SSEMessage) => {
if (!showDialog.value) return
if (data.type === 'progress' && data.action) {
if (!cloudBuildLog.includes(data.action)) {
if (cloudBuildLog.length === 0) {
const storedTime = localStorage.getItem('cloud_build_start_time')
if (storedTime) {
buildStartTime.value = Number(storedTime)
} else {
const now = Date.now()
buildStartTime.value = now
localStorage.setItem('cloud_build_start_time', String(now))
}
buildDuration.value = Math.floor((Date.now() - buildStartTime.value) / 1000)
buildTimer && clearInterval(buildTimer)
buildTimer = setInterval(() => {
if (buildStartTime.value) {
buildDuration.value = Math.floor((Date.now() - buildStartTime.value) / 1000)
}
}, 1000)
terminalRef.value.execute('clear')
terminalRef.value.execute('开始编译')
}
if (data.action.indexOf('云编译任务正在排队') != -1) {
cloudQueue = data.action
cloudBuildLog.push(data.action)
return
} else {
cloudQueue = null
}
terminalRef.value.pushMessage({ content: `${data.action}` })
cloudBuildLog.push(data.action)
if (data.code === '0' && data.msg) {
errorAnalysis.value = {}
errorInfo.value = data.msg
terminalRef.value.pushMessage({ content: data.msg, class: 'error' })
timeloading.value = false
active.value = 'error'
terminalRef.value.execute('clear')
clearCloudBuildTask()
buildTimer && clearInterval(buildTimer)
buildTimer = null
localStorage.removeItem('cloud_build_start_time')
localStorage.removeItem('cloud_build_task')
closeSSE()
}
}
} else if (data.type === 'complete') {
terminalRef.value.pushMessage({ content: '编译完成' })
} else if (data.type === 'failed') {
errorInfo.value = data.msg || '编译失败'
active.value = 'error'
terminalRef.value.execute('clear')
clearCloudBuildTask()
buildTimer && clearInterval(buildTimer)
buildTimer = null
localStorage.removeItem('cloud_build_start_time')
localStorage.removeItem('cloud_build_task')
closeSSE()
} else if (data.type === 'download_start') {
if (data.action && !cloudBuildLog.includes(data.action)) {
terminalRef.value.pushMessage({ content: data.action })
cloudBuildLog.push(data.action)
}
} else if (data.type === 'download_progress') {
const percent = data.download_percent || 0
const downloaded = data.downloaded_bytes || 0
const total = data.total_bytes || 0
const downloadedMB = (downloaded / 1024 / 1024).toFixed(2)
const totalMB = (total / 1024 / 1024).toFixed(2)
terminalRef.value.pushMessage({ content: `下载进度: ${percent}% (${downloadedMB}MB / ${totalMB}MB)` })
} else if (data.type === 'download_complete') {
if (data.action && !cloudBuildLog.includes(data.action)) {
terminalRef.value.pushMessage({ content: data.action })
cloudBuildLog.push(data.action)
}
if (data.download_url && data.task_id) {
startServerDownloadFn(data.task_id, data.download_url, data.authorize_code, data.timestamp)
}
}
}
let downloadPollingTimer: number | null = null
const startServerDownloadFn = async (taskId: string, downloadUrl: string, authorizeCode: string, timestamp: string) => {
try {
terminalRef.value.pushMessage({ content: '正在启动后台下载...' })
const parseUrl = new URL(downloadUrl, CLOUD_COMPILE_BASE_URL)
const authorize_code = parseUrl.searchParams.get('authorize_code') || authorizeCode || ''
const ts = parseUrl.searchParams.get('timestamp') || timestamp || ''
await startServerDownload(taskId, downloadUrl, authorize_code, ts)
downloadPollingTimer = setInterval(async () => {
if (!downloadPollingTimer) return
try {
const res = await getSseBuildLog(taskId)
if (res.code === 1) {
const { status, percent, msg } = res.data
if (status === 'downloading') {
terminalRef.value.pushMessage({ content: `下载进度: ${percent}% - ${msg}` })
} else if (status === 'unzipping') {
terminalRef.value.pushMessage({ content: msg })
} else if (status === 'completed') {
terminalRef.value.pushMessage({ content: '部署完成!' })
downloadPollingTimer && clearInterval(downloadPollingTimer)
downloadPollingTimer = null
active.value = 'complete'
timeloading.value = false
terminalRef.value.execute('clear')
clearCloudBuildTask()
buildTimer && clearInterval(buildTimer)
buildTimer = null
localStorage.removeItem('cloud_build_start_time')
localStorage.removeItem('cloud_build_task')
closeSSE()
ElMessage.success('编译部署完成')
} else if (status === 'error') {
terminalRef.value.pushMessage({ content: `错误: ${msg}`, class: 'error' })
downloadPollingTimer && clearInterval(downloadPollingTimer)
downloadPollingTimer = null
errorInfo.value = msg
active.value = 'error'
timeloading.value = false
clearCloudBuildTask()
closeSSE()
}
} else {
terminalRef.value.pushMessage({ content: '获取下载进度失败', class: 'error' })
downloadPollingTimer && clearInterval(downloadPollingTimer)
downloadPollingTimer = null
}
} catch (e) {
console.error('Polling error:', e)
}
}, 5000)
} catch (error) {
console.error('启动后台下载失败:', error)
terminalRef.value.pushMessage({ content: '启动后台下载失败', class: 'error' })
errorInfo.value = '启动后台下载失败'
active.value = 'error'
}
}
const closeSSE = () => {
if (eventSource) {
eventSource.close()
eventSource = null
}
if (downloadPollingTimer) {
clearInterval(downloadPollingTimer)
downloadPollingTimer = null
}
}
const buildStartTime = ref<number | null>(null)
const buildDuration = ref<number>(0)
let buildTimer: number | null = null
const formattedDuration = computed(() => {
const seconds = buildDuration.value
const mins = Math.floor(seconds / 60)
const secs = seconds % 60
return mins > 0 ? `${mins}分${secs}秒` : `${secs}秒`
})
/**
* 查询升级任务
*/
const getCloudBuildTaskFn = () => {
getCloudBuildTask().then(({ data }) => {
if (!data) return
cloudBuildTask.value = data
if (!showDialog.value) {
// showElNotification()
localStorage.setItem('cloud_build_task', 'true')
}
}).catch()
}
getCloudBuildTaskFn()
const errorInfo = ref('')
const timeloading = ref(false)
const errorAnalysis = ref({})
const getCloudBuildLogFn = () => {
timeloading.value = true
getCloudBuildLog().then(res => {
if (!res.data) {
if (showDialog.value && cloudBuildLog.length) {
active.value = 'complete'
timeloading.value = false
terminalRef.value.execute('clear')
clearCloudBuildTask()
buildTimer && clearInterval(buildTimer) // 清除计时器
localStorage.removeItem('cloud_build_start_time')
localStorage.removeItem('cloud_build_task')
}
notificationEl && notificationEl.close()
// cloudBuildTask.value = null
return
}
const data = res.data.data ?? []
let error = ''
if (data[0] && data[0].length && showDialog.value) {
if (cloudBuildLog.length == 0) {
const storedTime = localStorage.getItem('cloud_build_start_time')
if (storedTime) {
buildStartTime.value = Number(storedTime)
} else {
const now = Date.now()
buildStartTime.value = now
localStorage.setItem('cloud_build_start_time', String(now))
}
buildDuration.value = Math.floor((Date.now() - buildStartTime.value) / 1000)
buildTimer && clearInterval(buildTimer)
buildTimer = setInterval(() => {
if (buildStartTime.value) {
buildDuration.value = Math.floor((Date.now() - buildStartTime.value) / 1000)
}
}, 1000)
terminalRef.value.execute('clear')
terminalRef.value.execute('开始编译')
}
data[0].forEach(item => {
if (!cloudBuildLog.includes(item.action)) {
if (item.action.indexOf('云编译任务正在排队') != -1) {
cloudQueue = item.action
cloudBuildLog.push(item.action)
return
} else {
cloudQueue = null
}
terminalRef.value.pushMessage({ content: `${item.action}` })
cloudBuildLog.push(item.action)
if (item.code === '0') {
errorAnalysis.value = res.data.error_analysis || {}
error = item.msg
terminalRef.value.pushMessage({ content: item.msg, class: 'error' })
timeloading.value = false
active.value = 'error'
terminalRef.value.execute('clear')
clearCloudBuildTask()
errorInfo.value = item.msg
// 停止计时器
if (buildTimer) {
clearInterval(buildTimer)
buildTimer = null
}
// 保证 duration 也被最后更新一次
if (buildStartTime.value) {
buildDuration.value = Math.floor((Date.now() - buildStartTime.value) / 1000)
}
localStorage.removeItem('cloud_build_start_time')
localStorage.removeItem('cloud_build_task')
}
}
})
}
if (error) return
setTimeout(() => {
getCloudBuildLogFn()
}, 5000)
}).catch()
}
const closeType = ref('normal')
const handleReturn = () => {
active.value = 'build'
closeType.value = 'success'
}
const notificationEl : any = null
/**
* 升级中任务提示
*/
// const showElNotification = () => {
// notificationEl = ElNotification.success({
// title: t('warning'),
// dangerouslyUseHTMLString: true,
// message: h('div', {}, [
// t('cloudbuild.executingTips'),
// h('span', { class: 'text-primary cursor-pointer', onClick: elNotificationClick }, [t('cloudbuild.clickView')])
// ]),
// duration: 0,
// showClose: false
// })
// }
const elNotificationClick = () => {
showDialog.value = true
active.value = 'build'
getCloudBuildLogFn()
}
const open = async () => {
loading.value = true
active.value = 'build'
closeType.value = 'normal'
cloudBuildLog = []
if (cloudBuildTask.value) {
showDialog.value = true
loading.value = false
const taskId = (cloudBuildTask.value as any).task_id
if (taskId) {
connectSSE(taskId)
} else {
getCloudBuildLogFn()
}
return
}
preBuildCheck().then(async ({ data }) => {
if (data.is_pass) {
cloudBuild().then(({ data }) => {
loading.value = false
cloudBuildTask.value = data
showDialog.value = true
const taskId = data.task_id
if (taskId) {
connectSSE(taskId)
} else {
getCloudBuildLogFn()
}
}).catch(() => {
showDialog.value = false
loading.value = false
})
} else {
loading.value = false
cloudBuildCheck.value = data
showDialog.value = true
}
}).catch((e) => {
loading.value = false
showDialog.value = false
if (e.code && e.code == 601) {
ElMessageBox.confirm(
'云编译服务未启动,必须在启动后进行云编译!',
'提示',
{
distinguishCancelAndClose: true,
confirmButtonText: '重新检测',
cancelButtonText: '查看操作手册',
type: 'warning'
}
).then(() => {
open()
}).catch((action) => {
action == 'cancel' && window.open('https://doc.press.niucloud.com/php/saas-framework/use/other/third-party-cloud-compilation.html', '_blank')
})
} else {
ElMessage({ message: e.msg, type: 'error' })
}
})
}
const againBuild = () => {
if (active.value != 'again_build') {
active.value = 'again_build'
selectAddon.value = installedAddonList.value.map((item) => {
tableRef.value.toggleRowSelection(item, true)
return item.key
})
return
}
loading.value = true
cloudBuildLog = []
cloudBuild().then(({ data }) => {
active.value = 'build'
loading.value = false
cloudBuildTask.value = data
showDialog.value = true
localStorage.removeItem('cloud_build_start_time')
const taskId = data.task_id
if (taskId) {
connectSSE(taskId)
} else {
getCloudBuildLogFn()
}
}).catch(() => {
showDialog.value = false
loading.value = false
})
}
const selectable = (row: any) => {
return selectAddon.value.includes(row.key)
}
/**
* 升级进度动画
*/
let flashInterval: null | number = null
let terminalFlash = null
let cloudQueue = null
const onExecCmd = (key, command, success, failed, name) => {
if (command == '开始编译') {
terminalFlash = new TerminalFlash()
success(terminalFlash)
const frames = makeIterator(['/', '——', '\\', '|'])
flashInterval = setInterval(() => {
if (cloudQueue) {
terminalFlash.flush(cloudQueue + '<br>> ' + frames.next().value)
} else {
terminalFlash.flush('> ' + frames.next().value)
}
}, 150)
}
}
const makeIterator = (array: string[]) => {
let nextIndex = 0
return {
next () {
if ((nextIndex + 1) == array.length) {
nextIndex = 0
}
return { value: array[nextIndex++] }
}
}
}
const dialogClose = (done: () => {}) => {
closeSSE()
if (active.value == 'build' && cloudBuildTask.value && closeType.value == 'normal') {
ElMessageBox.confirm(
t('cloudbuild.showDialogCloseTips'),
t('warning'),
{
confirmButtonText: t('confirm'),
cancelButtonText: t('cancel'),
type: 'warning'
}
).then(() => {
terminalRef.value.execute('clear')
localStorage.removeItem('cloud_build_start_time')
localStorage.removeItem('cloud_build_task')
done()
buildTimer && clearInterval(buildTimer)
buildTimer = null
buildStartTime.value = null
buildDuration.value = 0
}).catch(() => { })
} else {
done()
}
}
const dialogCancel = () => {
closeSSE()
if (active.value == 'build' && cloudBuildTask.value && closeType.value == 'normal') {
ElMessageBox.confirm(
t('cloudbuild.showDialogCloseTips'),
t('warning'),
{
confirmButtonText: t('confirm'),
cancelButtonText: t('cancel'),
type: 'warning'
}
).then(() => {
terminalRef.value.execute('clear')
localStorage.removeItem('cloud_build_start_time')
localStorage.removeItem('cloud_build_task')
buildTimer && clearInterval(buildTimer)
buildTimer = null
buildStartTime.value = null
buildDuration.value = 0
showDialog.value = false
}).catch(() => { })
} else {
showDialog.value = false
}
}
const cloudBuildCheckDirFn = () => {
window.open('https://doc.press.niucloud.com/php/v6-shop/use/chang-jian-wen-ti-chu-li/er-shi-wu-3001-sheng-7ea7-yun-bian-yi-mu-lu-du-xie-quan-xian-zhuang-tai-bu-tong-guo-ru-he-chu-li.html')
}
watch(() => showDialog.value, () => {
if (!showDialog.value) {
closeSSE()
cloudBuildTask.value = null
active.value = 'build'
cloudBuildLog = []
flashInterval && clearInterval(flashInterval)
terminalFlash && terminalFlash.finish()
buildTimer && clearInterval(buildTimer)
buildStartTime.value = null
buildDuration.value = 0
clearCloudBuildTask()
}
})
defineExpose({
open,
cloudBuildTask,
loading,
elNotificationClick,
getCloudBuildTaskFn
})
</script>
<style lang="scss" scoped>
.table-head-bg {
background-color: var(--el-table-header-bg-color);
}
:deep(.terminal .t-log-box span) {
white-space: pre-wrap;
}
:deep(.el-result__icon) {
color: unset !important; // 清除默认颜色
}
:deep(.el-dialog__title){
font-size: 20px;
font-weight: bold;
}
:deep(.el-result__title p){
font-size: 25px;
color: #1D1F3A;
font-weight: 500;
}
:deep(.el-result__subtitle p){
font-size: 15px;
color: #4F516D;
font-weight: 500;
word-break: break-all;
text-overflow: ellipsis;
overflow: hidden;
display: -webkit-box;
-webkit-line-clamp: 5;
-webkit-box-orient: vertical;
}
:deep(.el-result){
margin-top: -80px !important;
}
</style>

View File

@ -1,987 +0,0 @@
<template>
<!-- 仅渲染终端输出区:头部(状态/清屏)与底部(进度/操作)由使用方页面组装,保证视觉整体性 -->
<!-- 上传 / 下载进度作为终端内的一行消息,复用推入的消息对象引用原地刷新 content,实现终端内单行更新 -->
<div class="task-terminal flex min-h-0 h-full flex-1 flex-col overflow-hidden">
<div class="tt-titlebar">
<!-- 单状态点:运行中绿色 / 等待决策黄色 / 已结束红色(不再用三圆点装饰) -->
<span class="tt-dot" :class="dotClass"></span>
<span class="tt-title">{{ titleText }}</span>
</div>
<terminal
ref="terminalRef"
:name="terminalName"
context=""
context-suffix=""
:input-filter="blockInput"
:command-formatter="formatCommand"
:show-header="false"
:init-log="null"
:auto-help="false"
:enable-example-hint="false"
class="flex-1 min-h-0 h-wull tt-body"
@exec-cmd="onExecCmd"
/>
</div>
</template>
<script lang="ts" setup>
import { ref, computed, reactive, watch, onMounted, onBeforeUnmount, nextTick } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Terminal, TerminalFlash, TerminalAsk } from 'vue-web-terminal'
import 'vue-web-terminal/lib/theme/dark.css'
import { getTaskConfig, getTaskEvents } from '@/app/api/task'
import useTaskRunnerStore from '@/stores/modules/taskRunner'
const props = defineProps({
/** 任务标识 */
taskKey: { type: String, required: true },
/**
* 实时 SSE 地址(可选的多源实时通道)
* - 云编译可传第三方 SSE 地址;留空则由全局执行器轮询驱动
* - 仅用于「额外渲染」,不参与任务推进(推进统一由 taskRunner store 负责)
*/
sseUrl: { type: String, default: '' },
/** 挂载后是否自动开始(加载状态并渲染) */
autoStart: { type: Boolean, default: true },
/**
* 等待决策时是否在终端内询问(TerminalAsk)
* - true(默认):终端内用输入框让用户选操作
* - false:不在终端内询问,仅输出提示,操作按钮由使用方页面(如任务详情页)提供
*/
autoAsk: { type: Boolean, default: true }
})
const emit = defineEmits([ 'completed', 'update:status' ])
// ==================== 全局任务执行器 ====================
// 任务推进(run 轮询)统一由 store 负责:本组件只做状态订阅与日志渲染,
// 因此离开页面后任务仍会继续推进,回到页面时也能接着渲染已有事件流。
const runner = useTaskRunnerStore()
const rt = computed<any>(() => runner.tasks[ props.taskKey ] ?? null)
// ==================== 任务状态(全部取自 store,保证各页面一致) ====================
const terminalRef = ref<any>(null)
const terminalName = 'task-terminal-' + Date.now()
const status = computed(() => rt.value?.status ?? '')
const progress = computed(() => Number(rt.value?.progress ?? 0))
const stage = computed(() => rt.value?.stage ?? '')
const actions = computed<any[]>(() => rt.value?.actions ?? [])
const startTime = computed(() => Number(rt.value?.startTime ?? 0))
const duration = computed(() => Number(rt.value?.duration ?? 0))
// 任务锁被其它进程占用(瞬时状态,不代表任务真实状态;后端租约到期会自动接管)
const locked = computed(() => !!rt.value?.locked)
const isTerminal = computed(() => [ 'success', 'failed', 'canceled', 'rolled_back', 'rollback_failed' ].includes(status.value))
const waitingInput = computed(() => status.value === 'waiting_input')
// 任务状态名称由后端 TaskDict 维护:多个终端实例共用同一份字典,只拉一次
const statusOptions = ref<Array<{ label: string, value: string }>>([])
let statusDictRequested = false
function loadTaskConfig() {
if (statusDictRequested) return
statusDictRequested = true
getTaskConfig().then((res: any) => {
statusOptions.value = res?.data?.status || []
}).catch(() => {
statusDictRequested = false // 失败则允许后续实例重试
statusOptions.value = []
})
}
/** 字典未就绪时回退为状态标识本身(不写死文案) */
const statusText = computed(() => {
const hit = statusOptions.value.find(item => item.value === status.value)
return hit?.label || status.value || '-'
})
// 窗口标题栏文案:带任务标识,强化终端窗口感
const titleText = computed(() => props.taskKey ? `执行终端 · ${ props.taskKey }` : '执行终端')
// 标题栏状态点:运行中绿色 / 等待决策(暂停)黄色 / 已结束红色
const dotClass = computed(() => {
if (waitingInput.value) return 'tt-dot-yellow'
if (isTerminal.value) return 'tt-dot-red'
return 'tt-dot-green'
})
const statusTagType = computed(() => {
if (status.value === 'success') return 'success'
if ([ 'failed', 'rollback_failed' ].includes(status.value)) return 'danger'
if (waitingInput.value) return 'warning'
if (status.value === 'canceled' || status.value === 'rolled_back') return 'info'
return 'primary'
})
const progressStatus = computed(() => {
if (status.value === 'success') return 'success'
if ([ 'failed', 'rollback_failed' ].includes(status.value)) return 'exception'
return ''
})
const durationText = computed(() => {
if (!startTime.value) return '--'
const mins = Math.floor(duration.value / 60)
const secs = duration.value % 60
return mins > 0 ? `${ mins }分${ secs }秒` : `${ secs }秒`
})
watch(status, (val) => {
emit('update:status', val)
// 离开等待决策:允许下次再次提示
if (val !== 'waiting_input') askedForActions = false
})
// ==================== 终端输出 ====================
// 已渲染文本集合,避免 SSE 与轮询双通道重复输出
const renderedTexts = new Set<string>()
// 已实时展示过的进度(key:percent):终态补渲染时据此跳过,避免与实时进度条重复留痕
const progressSeen = new Set<string>()
// 已渲染到 store 事件流的下标(增量渲染)
let renderedIndex = 0
// 进度条(key => { label, percent }),用于上传/下载等带进度的任务
const progressBars = reactive<Record<string, { label: string, percent: number }>>({})
// 终端内实时回显(TerminalFlash):单行原地刷新进度,不另开区域、不刷多条
let progressFlash: any = null
let progressFlashOpen = false
let progressFlashContent = ''
// 终态/取消后不再接收进度,防止迟到的 SSE 进度继续刷新
let progressFrozen = false
// 终态收尾摘要行是否已输出(防止重复打印)
let summaryPrinted = false
// 历史回放进行中:终态摘要行推迟到回放完成后输出,保证结论行始终位于日志最下方
let replayPending = false
// flash 兜底输出去重:flash 机制未就绪时,避免每次进度都刷一条
let lastFallbackLine = ''
// 终端内询问(TerminalAsk):在等待决策(waiting_input)时,用 .t-ask 输入框代替页面按钮
let askedForActions = false
let askActions: any[] = []
// 本次暂停的失败原因(错误级日志):每次进入决策提示前都重新展示一次,
// 保证「回复后重试、问题依旧」时用户能再次看到错误信息(不受日志去重影响)
let pauseReasons: string[] = []
// 生成固定宽度的进度条,如 [### ];整体宽度恒为 width,仅左侧 # 填充随进度增长
function barText(percent: number): string {
// 宽度取 24:加上文案(如「源码上传 100%」约 12 列)整行 ≤ 40 列,
// 详情面板窄终端也不会折行(折行会把一条进度显示成两行)
const width = 24
const filled = Math.max(0, Math.min(width, Math.round((percent / 100) * width)))
// 实心部分用 #,空位用「不换行空格」(\u00A0):视觉上和普通空格一样留白,
// 但不会被终端折叠行尾空格,从而保证 [] 整体宽度固定、只有左侧填充变长。
return '#'.repeat(filled) + '\u00a0'.repeat(width - filled)
}
// 进行中阶段的 spinner 帧动画(braille 逐帧切换,非 CSS 旋转)
const SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏']
let spinnerFrame = 0
let spinnerTimer: any = null
function spinnerChar(): string {
return SPINNER_FRAMES[ spinnerFrame % SPINNER_FRAMES.length ]
}
// 是否仍有处于进行中(<100%)的阶段:决定 spinner 是否继续转
function hasRunningStage(): boolean {
return Object.values(progressBars).some((b) => b.percent < 100)
}
// 启动/停止帧动画定时器(幂等):仅 flash 会话存在且仍有进行中阶段时转动
function startSpinner() {
if (spinnerTimer) return
spinnerTimer = setInterval(() => {
if (!progressFlashOpen || !hasRunningStage()) { stopSpinner(); return }
spinnerFrame = (spinnerFrame + 1) % SPINNER_FRAMES.length
progressFlashContent = progressText()
flushProgress()
}, 80)
}
function stopSpinner() {
if (spinnerTimer) { clearInterval(spinnerTimer); spinnerTimer = null }
}
// 根据当前进度状态同步 spinner 定时器
function refreshSpinner() {
if (progressFlashOpen && hasRunningStage()) startSpinner()
else stopSpinner()
}
// 生成当前所有进度的文本(仅用于终端内实时回显:单行原地刷新)
// 带自定义文案的事件(如排队「前面还有 N 人」)用文案 + 条形,不显示百分比
// 进行中的阶段带逐帧 spinner(步骤行动态化的视觉载体),完成阶段显示 ✓
function progressText(): string {
const parts = Object.entries(progressBars).map(([k, b]) =>
(b.percent >= 100 ? '✓ ' : spinnerChar() + ' ') + progressLineText(b.label, b.percent, b.text)
)
return parts.join(' ') || spinnerChar() + ' 任务进行中…'
}
// 单条进度的文本(固化用:一个阶段一行,避免多阶段进度被拼成一行)
function progressLineText(label: string, percent: number, text: string = ''): string {
if (text) return `${ text } [${ barText(percent) }]`
return `${ label } [${ barText(percent) }] ${ percent }%`
}
// 固化单个进度:相同内容只输出一次,避免阶段收尾时把已输出过的进度再打一遍
function persistOne(key: string) {
const bar = progressBars[ key ]
if (!bar) return
const text = progressLineText(bar.label, bar.percent, bar.text)
if (renderedTexts.has(text)) return
renderedTexts.add(text)
// 完成的阶段进度行染绿,进行中保持默认色
doPush(text, bar.percent >= 100 ? 'success' : 'info')
}
// 确保已开启实时回显会话(首次进度事件时懒开启)
function ensureProgressFlash() {
if (progressFlashOpen) return
progressFlashOpen = true
terminalRef.value?.execute('__progress__')
refreshSpinner()
}
// 把当前进度刷新到终端内单行(原地刷新)
function flushProgress() {
if (progressFlash) {
progressFlash.flush(progressFlashContent)
return
}
// 兜底:flash 因故未建立(如热更新后 execute 未派发 onExecCmd、TerminalFlash 创建失败)
// 时,退化为普通日志行输出当前进度,避免上传/下载阶段「完全无输出」。
// 仅当内容变化时才输出,防止进度回显时刷出大量重复行。
if (progressFlashOpen && progressFlashContent && progressFlashContent !== lastFallbackLine) {
lastFallbackLine = progressFlashContent
terminalRef.value?.pushMessage({ content: progressFlashContent })
}
}
// 把当前进度逐条固化为静态日志(flash 是临时回显,finish 后会消失,需手动留存)
// 逐条输出 + 内容去重:多阶段进度不会叠成一行,也不会重复打印
function persistProgress() {
Object.keys(progressBars).forEach((key) => persistOne(key))
progressFlashContent = ''
}
// 结束实时回显:先固化当前进度为静态日志,再关闭临时回显,保证进度可见且后续日志排在它下方
function finishProgress() {
stopSpinner()
if (progressFlash) {
try { progressFlash.finish() } catch (e) { /* 已关闭则忽略 */ }
progressFlash = null
}
progressFlashOpen = false
// 清理已关闭的进度条目,避免下一阶段新进度与旧进度累加在同一行
Object.keys(progressBars).forEach(k => delete progressBars[k])
progressFlashContent = ''
lastFallbackLine = ''
}
const blockInput = () => ''
// 内部占位命令不回显:execute 会把命令行 echo 到终端(cmdLine 消息),
// 这里把内部命令格式化为空,避免 __progress__ / __ask_actions__ 显示成一行黄字
function formatCommand(cmd: string): string {
return cmd === '__progress__' || cmd === '__ask_actions__' ? '' : cmd
}
/**
* 时间戳前缀 [HH:mm:ss]:事件带 time(unix 秒)用事件时间,否则用本地当前时间。
* 仅作用于展示,不影响去重(去重仍以原始文本为键)。
*/
function fmtTime(time?: number | string): string {
let t = time !== undefined && time !== '' && time !== null ? Number(time) : NaN
if (!isFinite(t)) t = Date.now() / 1000
const d = new Date(t * 1000)
const p = (n: number) => String(n).padStart(2, '0')
return `${ p(d.getHours()) }:${ p(d.getMinutes()) }:${ p(d.getSeconds()) }`
}
/**
* 取事件时间(unix 秒):优先用后端 time 字段,缺失时用 ts(Y-m-d H:i:s 字符串)回退解析,
* 兼容历史已落盘、仅含 ts 的事件流(避免回放时全部落到当前时间)。
*/
function evTime(ev: any): number | undefined {
if (ev?.time !== undefined && ev.time !== '' && ev.time !== null) return Number(ev.time)
if (ev?.ts) {
const t = Date.parse(String(ev.ts).replace(' ', 'T'))
if (!isNaN(t)) return Math.floor(t / 1000)
}
return undefined
}
/** 真正推送一行:加时间戳前缀;去重由调用方负责(不再按等级着色) */
function doPush(text: string, _level: string = 'info', time?: number | string) {
if (!text) return
terminalRef.value?.pushMessage({
content: `[${ fmtTime(time) }] ${ text }`
})
}
function pushLine(text: string, level: string = 'info', time?: number | string) {
if (!text) return
if (renderedTexts.has(text)) return
renderedTexts.add(text)
// 进度回显进行中时,先把进度行固化,再关闭回显,避免后续日志被压到进度之上
if (progressFlashOpen) {
persistProgress()
finishProgress()
}
doPush(text, level, time)
}
// 把指定进度补齐到 100%(阶段切换或终态兜底)
function completeProgress(key: string) {
if (progressBars[key] && progressBars[key].percent < 100) {
progressBars[key].percent = 100
progressFlashContent = progressText()
if (progressFlashOpen) {
flushProgress()
persistProgress()
finishProgress()
}
}
}
// 推送进度:更新响应式 progressBars 并实时回显到终端内单行
function pushProgress(key: string, label: string, percent: number, fromReplay: boolean = false, text: string = '') {
if (progressFrozen) return
const p = Math.max(0, Math.min(100, Math.round(Number(percent) || 0)))
// 记录已实时展示过的进度:终态补渲染时同签名不再重复固化
progressSeen.add(key + ':' + p)
// 换了进度 key(如排队 -> 上传):先把上一阶段固化并收尾,
// 否则两个阶段的行会叠在同一条回显里,读起来像乱码
if (Object.keys(progressBars).length > 0 && !progressBars[ key ]) {
if (progressFlashOpen) {
persistProgress()
finishProgress()
} else {
Object.keys(progressBars).forEach(k => delete progressBars[ k ])
}
}
// 实时场景下,若某阶段第一次出现就是 100%,说明该阶段在观测前已完成,
// 直接固化为一行进度日志(不弹进度条),避免「一打开就是 100%」的观感。
// 固化的文本格式与进度条行一致,且同一内容只输出一次。
if (!fromReplay && p === 100 && !progressBars[key]) {
progressBars[ key ] = { label, percent: 100, text }
persistOne(key)
delete progressBars[ key ]
return
}
// 实时场景下,若某阶段第一次出现且百分比大于 0,先渲染一帧 0%,
// 确保进度条从空开始增长,而不是一打开就直接显示中间百分比。
if (!fromReplay && !progressBars[key] && p > 0 && p < 100) {
progressBars[key] = { label, percent: 0, text }
progressFlashContent = progressText()
ensureProgressFlash()
flushProgress()
}
progressBars[key] = { label, percent: p, text }
progressFlashContent = progressText()
ensureProgressFlash()
flushProgress()
refreshSpinner()
}
// 终态回放:按 key 缓冲进度,回放结束(flushReplayProgress)时只输出每个阶段最后一条,
// 避免里程碑(50% / 100%)被逐条打印成多行。最后一帧即完成态,正是最该保留的回显。
const replayProgressBuf: Record<string, { label: string, percent: number, text: string }> = {}
const replayProgressOrder: string[] = []
function bufferReplayProgress(key: string, label: string, percent: number, text: string = '') {
const k = key || 'progress'
if (!(k in replayProgressBuf)) replayProgressOrder.push(k)
replayProgressBuf[ k ] = { label: label || k || '进度', percent, text }
}
function flushReplayProgress() {
replayProgressOrder.forEach((k) => {
const b = replayProgressBuf[ k ]
pushLine(progressLineText(b.label, b.percent, b.text))
})
// 清空缓冲,避免跨任务残留
for (const k of Object.keys(replayProgressBuf)) delete replayProgressBuf[ k ]
replayProgressOrder.length = 0
}
// 终态回放用:把一条进度事件暂存到缓冲(不立即输出,统一在回放末尾输出每个阶段最后一条)
function pushProgressLine(key: string, label: string, percent: number, text: string = '') {
const p = Math.max(0, Math.min(100, Math.round(Number(percent) || 0)))
bufferReplayProgress(key, label, p, text)
}
// 清空进度状态(清屏 / 切换任务时调用;终端 DOM 由 reset 统一 execute('clear'))
function clearProgress() {
stopSpinner()
Object.keys(progressBars).forEach(k => delete progressBars[k])
progressFlashContent = ''
progressFlashOpen = false
progressFrozen = false
}
/**
* 文本兜底识别进度:兼容后端未下发 type:'progress' 事件、仅以日志文本携带百分比的场景
* 命中「上传 / 下载 + 百分比」时返回 { key, label, percent },否则返回 null
*/
function detectProgressFromText(text: string): { key: string, label: string, percent: number } | null {
if (!text) return null
const m = text.match(/(\d+)\s*%/)
if (!m) return null
const percent = Number(m[ 1 ])
if (isNaN(percent)) return null
if (/上传/.test(text)) return { key: 'upload', label: '源码上传', percent }
if (/(下载|编译产物)/.test(text)) return { key: 'download', label: '编译产物下载', percent }
return null
}
function clear() {
finishProgress()
terminalRef.value?.execute('clear')
}
// 程序化 execute 会派发 exec-cmd;进度 flash 已通过 pushMessage 直接推入,无需占位命令
function onExecCmd(key: string, command: string, success: any, failed: any) {
if (command === '__progress__') {
// 保留兼容:若仍有旧逻辑通过 execute 触发
try {
progressFlash = new TerminalFlash()
progressFlashOpen = true
success(progressFlash)
flushProgress()
refreshSpinner()
} catch (e) {
// TerminalFlash 建立失败时回退为普通日志(兜底输出由 flushProgress 负责)
progressFlash = null
progressFlashOpen = true
}
} else if (command === '__ask_actions__') {
// 等待决策:通过 TerminalAsk 在终端内询问用户,代替页面上的操作按钮
const asker = new TerminalAsk()
success(asker)
const list = askActions
const askCallback = (value: string) => {
const v = (value || '').trim()
let code = ''
const idx = parseInt(v, 10)
if (!isNaN(idx) && idx >= 1 && idx <= list.length) {
code = list[ idx - 1 ].code
} else {
const found = list.find((a: any) => String(a.code).toLowerCase() === v.toLowerCase())
if (found) code = found.code
}
if (!code) {
doPush(`无效输入「${ v }」,请重新选择(序号或代码)。`, 'error')
asker.ask({ question: buildAskQuestion(list), autoReview: true, callback: askCallback })
return
}
asker.finish()
// 选中后允许后续再次进入等待决策时重新提问
askedForActions = false
// 取消已在终端内明确选择,无需再弹窗二次确认
if (code === 'cancel') cancel({ confirm: false })
else operate(code as string).catch(() => {})
}
asker.ask({ question: buildAskQuestion(list), autoReview: true, callback: askCallback })
} else {
// 清屏等其它命令:结束实时回显会话
progressFlash = null
progressFlashOpen = false
success()
}
}
// 拼接等待决策时的操作选项(序号 + 文案)
function buildAskQuestion(list: any[]): string {
const lines = list.map((a, i) => ` [${ i + 1 }] ${ a.label }`).join('\n')
return `请选择操作:\n${ lines }\n请输入序号或代码后回车:`
}
// 进入等待决策:展示失败原因,并按 autoAsk 决定终端内询问还是仅提示
function promptOrHint() {
// 先固化可能残留的进度行,避免与提示/提问相互遮挡
finishProgress()
// 每次提示前重新展示本次暂停的失败原因,确保重试后问题依旧时错误信息依然可见
const reasons = Array.from(new Set(pauseReasons.filter((text) => !!text)))
reasons.forEach((text) => doPush(text, 'error'))
pauseReasons = []
if (!actions.value.length || askedForActions) return
askedForActions = true
askActions = actions.value
if (props.autoAsk) {
doPush('任务已暂停,请根据下方提示选择操作:')
terminalRef.value?.execute('__ask_actions__')
return
}
// 不在终端内询问:仅提示,操作按钮由页面提供
const labels = actions.value.map((a: any) => a.label).filter(Boolean).join(' / ')
doPush(labels ? `任务已暂停,请在页面上方选择操作:${ labels }` : '任务已暂停,请在页面上方选择操作', 'warning')
}
// ==================== 事件渲染 ====================
/**
* 渲染单条事件
* @param ev 事件
* @param terminalMode 终态回放模式(补渲染已完成阶段的进度)
* @param waiting 是否等待决策(错误原因交由 promptOrHint 统一展示)
* @param lastKey 本轮事件的最后一个进度 key(运行态只渲染当前阶段的进度)
*/
function renderEvent(ev: any, terminalMode: boolean, waiting: boolean, lastKey: string = '') {
if (!ev) return
if (ev.type === 'progress') {
// text:后端给出的自定义回显文案(如排队「前面还有 N 人」),有则优先用它
if (terminalMode) {
// 终态回放:逐条固化为静态日志行,保留上传/下载进度的完整回显
pushProgressLine(ev.key, ev.label || ev.key || '进度', Number(ev.percent ?? ev.progress ?? 0), ev.text || '')
} else if (ev.key === lastKey) {
pushProgress(ev.key, ev.label, ev.percent, false, ev.text || '')
}
return
}
const p = detectProgressFromText(ev.text || '')
if (p) {
if (terminalMode) {
pushProgressLine(p.key, p.label, p.percent)
} else if (p.key === lastKey) {
pushProgress(p.key, p.label, p.percent)
}
return
}
// 队列驱动时的事件来自 events 接口(只有 level / text / progress,无 type / key / label):
// 文本未能识别阶段名但带 progress 时,用文本本身作为阶段名回显进度,避免刷成多行文字日志
if (!ev.type && ev.progress !== null && ev.progress !== undefined && ev.progress !== '') {
const key = ev.text || 'progress'
if (terminalMode) {
pushProgressLine(key, ev.text || '', Number(ev.progress))
} else if (key === lastKey) {
pushProgress(key, ev.text || '', Number(ev.progress))
}
return
}
// 等待决策时的失败原因:不在普通日志里渲染,改由 promptOrHint 展示
if (waiting && ev.level === 'error') {
pauseReasons.push(ev.text)
return
}
// 回放中遇到普通日志:先把已缓冲的进度固化在它前面(保持进度在原始位置),
// 每个阶段只输出缓冲中的最后一帧(完成态)
flushReplayProgress()
pushLine(ev.text, ev.level, evTime(ev))
}
/** 渲染一批事件(运行态:只渲染最后一个阶段的进度,避免已完成阶段闪 100%) */
function renderEvents(list: any[]) {
if (!list.length) return
const waiting = waitingInput.value
let lastKey = ''
for (const ev of list) {
if (ev?.type === 'progress') {
lastKey = ev.key
continue
}
const p = detectProgressFromText(ev.text || '')
if (p) {
lastKey = p.key
continue
}
// 无 type 但带 progress 的事件(events 接口来源):以文本作为阶段 key
if (ev?.progress !== null && ev?.progress !== undefined && ev?.progress !== '') {
lastKey = ev.text || lastKey
}
}
list.forEach((ev) => renderEvent(ev, false, waiting, lastKey))
}
/** 终态收尾:补齐未到 100% 的进度并冻结进度接收 */
function finishTerminalProgress() {
if (status.value === 'success' || status.value === 'rolled_back') {
Object.keys(progressBars).forEach((k) => {
if (progressBars[ k ].percent < 100) progressBars[ k ].percent = 100
})
progressFlashContent = progressText()
if (progressFlashOpen) {
flushProgress()
persistProgress()
}
}
finishProgress()
progressFrozen = true
// 终态收尾行:仿构建日志退出行;历史回放未完成时推迟,保证始终位于日志最后
if (!summaryPrinted && !replayPending) {
summaryPrinted = true
// 耗时未就绪(详情刚加载、duration 为 0)时不显示,避免误导性的「耗时 0秒」
const dur = duration.value > 0 ? `,耗时 ${ durationText.value }` : ''
if (status.value === 'success' || status.value === 'rolled_back') {
doPush(`✔ 任务完成${ dur }`)
} else if (status.value === 'canceled') {
doPush(`✗ 任务已取消${ dur }`)
} else {
doPush(`✗ 任务失败:${ statusText.value }${ dur }`)
}
}
}
/**
* 一次性回放历史事件(终态任务或运行中刷新后用于补齐历史日志)
* 注意:events.jsonl 保留 type/key/label/percent 元信息(旧文件可能没有),缺元信息时通过文本兜底识别进度。
*/
async function replay() {
try {
const res: any = await getTaskEvents(props.taskKey, 0, 0)
const list = Array.isArray(res?.data) ? res.data : []
// 全量回放后同步事件游标:全局执行器后续的增量拉取不会把已回放的事件再拉一遍
const maxSeq = list.reduce((max: number, item: any) => Math.max(max, Number(item?.seq ?? 0)), 0)
if (maxSeq > 0) runner.setEventSeq(props.taskKey, maxSeq)
// 运行中任务:进度由实时驱动渲染,回放仅补普通文本日志,并跳过进度类文本。
// 否则回放会把已完成的阶段快进到 100%,再被实时进度回落到当前值,造成「一开始就是 100%」的观感。
const skipProgress = !isTerminal.value
list.forEach((item: any) => {
if (skipProgress) {
// 运行中:进度类事件由实时增量渲染,回放只补普通文本,避免进度先跳到历史值
if (item?.type === 'progress') return
if (detectProgressFromText(item.text || '')) return
pushLine(item.text, item.level, evTime(item))
return
}
// 终态回放:统一走 renderEvent(进度事件暂存到缓冲,回放末尾只输出每个阶段最后一条)
renderEvent(item, true, false)
})
// 回放结束:每个阶段只固化最后一帧(完成态),避免里程碑逐条刷成多行
flushReplayProgress()
} catch (e) {
// 忽略
}
}
// ==================== 订阅 store:状态 / 事件流 ====================
watch(() => [ rt.value?.status ?? '', rt.value?.events?.length ?? 0 ], () => {
const events: any[] = rt.value?.events ?? []
if (!rt.value) return
if (isTerminal.value) {
// 终态:后端当次返回的是完整事件,按回放模式补渲染进度(文本由去重集合跳过)
events.forEach((ev: any) => renderEvent(ev, true, false))
// 每个阶段只固化最后一帧(完成态),避免里程碑逐条刷成多行
flushReplayProgress()
renderedIndex = events.length
finishTerminalProgress()
emit('completed', status.value)
return
}
// 运行中:增量渲染本轮新增事件
const slice = events.slice(renderedIndex)
renderedIndex = events.length
renderEvents(slice)
if (waitingInput.value) {
promptOrHint()
return
}
})
// ==================== SSE(可选的多源实时通道,仅渲染) ====================
let eventSource: EventSource | null = null
function connectSSE() {
if (!props.sseUrl || isTerminal.value) return
closeSSE()
try {
eventSource = new EventSource(props.sseUrl)
} catch (e) {
return
}
const onData = (e: MessageEvent) => {
let data: any = null
try {
data = JSON.parse(e.data)
} catch (err) {
return
}
// 归一化第三方 SSE 事件为终端输出
if (!data) return
// 带百分比的进度事件:渲染为进度条
if (data.percent !== undefined && data.percent !== null) {
const p = Number(data.percent)
if (!isNaN(p)) {
pushProgress(String(data.key || data.type || 'progress'), data.label || data.action || data.msg || '进度', p)
return
}
}
// 兜底:SSE 仅以文本携带进度(如「源码上传中 14%」),解析后同样走进度条
const sseText = data.action || data.msg || ''
const pm = sseText.match(/(\d+)\s*%/)
if (pm && /(上传|下载)/.test(sseText)) {
const cat = /下载/.test(sseText) ? 'download' : 'upload'
pushProgress(cat, cat === 'upload' ? '源码上传' : '编译产物下载', Number(pm[1]))
return
}
if (data.action) pushLine(data.action, 'info')
if (data.type === 'failed') pushLine(data.msg || '执行失败', 'error')
if (data.type === 'complete') pushLine('执行完成', 'success')
if (data.msg && !data.action) pushLine(data.msg, data.code === '0' ? 'error' : 'info')
}
eventSource.onmessage = onData as any
;[ 'progress', 'complete', 'failed', 'heartbeat', 'download_start', 'download_progress', 'download_complete' ].forEach((type) => {
eventSource?.addEventListener(type, onData as any)
})
// SSE 断开:静默降级(推进由全局执行器负责,无需额外处理)
eventSource.onerror = () => {
closeSSE()
}
}
function closeSSE() {
if (eventSource) {
eventSource.close()
eventSource = null
}
}
// ==================== 用户操作(转发给全局执行器) ====================
async function operate(code: string) {
try {
await runner.operate(props.taskKey, code)
// 状态与事件由 store 更新,订阅回调负责渲染
} catch (e) {
// 操作失败:保持当前状态,由页面提示
throw e
}
}
/**
* 取消任务
* @param options confirm: 是否需要弹窗二次确认
* - 外部取消(页面按钮):需要确认,防止误触
* - 终端询问回复「取消」:用户在终端已明确选择,无需再弹窗确认
*/
async function cancel(options: { confirm?: boolean } = {}) {
if (options.confirm !== false) {
try {
await ElMessageBox.confirm('确定要取消当前任务吗?取消后正在进行的任务将终止。', '取消任务', {
type: 'warning', confirmButtonText: '确定取消', cancelButtonText: '再想想'
})
} catch (e) {
return false
}
}
try {
await runner.cancel(props.taskKey)
// 取消成功后彻底停流,避免日志继续滚动造成「无效」观感
closeSSE()
finishProgress()
progressFrozen = true
ElMessage.success('已取消任务')
return true
} catch (e: any) {
ElMessage.error(e?.msg || e?.message || '取消失败,请重试')
return false
}
}
// ==================== 生命周期 ====================
async function start() {
renderedIndex = 0
renderedTexts.clear()
progressSeen.clear()
clearProgress()
askedForActions = false
pauseReasons = []
summaryPrinted = false
// 先挂起摘要行:attach 后 watch 可能抢先以终态触发收尾,此时历史日志尚未渲染、耗时未就绪
replayPending = true
// 交给全局执行器:加载详情并在非终态时接管推进(已在推进的任务不会被打断)
await runner.attach(props.taskKey)
await nextTick()
const events: any[] = rt.value?.events ?? []
if (isTerminal.value) {
// 终态:store 内无事件(多为刷新后)时从后端回放完整历史
if (!events.length) await replay()
else events.forEach((ev: any) => renderEvent(ev, true, false))
// 历史渲染完成后解除挂起,再收尾:结论行会正确落在日志最后,耗时也已就绪
replayPending = false
finishTerminalProgress()
return
}
// 运行中:优先回放后端历史事件(补齐进入页面前的输出),否则渲染 store 已累积的事件
replayPending = false
if (!events.length) {
await replay()
} else {
renderEvents(events)
renderedIndex = events.length
}
if (props.sseUrl) connectSSE()
if (waitingInput.value) promptOrHint()
}
/** 仅清理内存态与连接,不触碰终端 DOM */
function dispose() {
closeSSE()
finishProgress()
renderedIndex = 0
renderedTexts.clear()
clearProgress()
askedForActions = false
askActions = []
pauseReasons = []
}
/** 清理渲染状态(不停止任务推进:推进由全局执行器持有) */
function reset() {
dispose()
// 清掉上一任务的终端内容(含进度行 DOM),避免与新任务进度节点混淆
terminalRef.value?.execute('clear')
}
watch(() => props.taskKey, () => {
reset()
if (props.autoStart) start()
})
onMounted(() => {
// 状态名称字典:随组件首次挂载拉取(模块级缓存,多实例只请求一次)
loadTaskConfig()
if (props.autoStart) start()
})
/**
* 卸载前清理:任务继续由全局执行器推进
*
* 必须放在 onBeforeUnmount 而不是 onUnmounted:
* onUnmounted 是 post render 回调,执行时 Vue 已经把本组件的 DOM 从文档中移除,
* 此时再 execute('clear') 会让终端去操作一个已脱离文档的节点(insertBefore of null),
* 错误发生在 post flush 阶段且未被错误处理包裹,会直接中断整个更新队列。
*/
onBeforeUnmount(() => {
dispose()
})
// ==================== 对外暴露(供页面组装头部/底部) ====================
defineExpose({
// 状态(响应式)
status,
statusText,
statusTagType,
progressStatus,
progress,
stage,
actions,
durationText,
isTerminal,
waitingInput,
locked,
// 行为
start,
clear,
replay,
operate,
cancel
})
</script>
<style>
.t-log-box {
margin-block-start: 6px!important;
margin-block-end: 6px!important;
}
</style>
<style scoped>
.task-terminal {
min-height: 200px;
/* 更接近真实终端的配色 + 窗口感 */
--t-main-background-color: #0d1117; /* GitHub 暗色 */
--t-main-font-color: #c9d1d9;
background: #0d1117;
border: 1px solid #30363d;
border-radius: 10px;
overflow: hidden;
box-shadow: 0 8px 24px rgba(1, 4, 9, 0.5);
}
.t-log-box {
margin-block-start: 10px!important;
margin-block-end: 10px!important;
}
/* 标题栏:单状态点 + 标题(运行中绿 / 等待决策黄 / 已结束红) */
.tt-titlebar {
display: flex;
align-items: center;
gap: 8px;
padding: 8px 12px;
background: #161b22;
border-bottom: 1px solid #30363d;
flex: none;
}
.tt-dot {
width: 12px;
height: 12px;
border-radius: 50%;
display: inline-block;
box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.25);
flex-shrink: 0;
}
.tt-dot-red { background: #ff5f56; }
.tt-dot-yellow { background: #ffbd2e; }
.tt-dot-green { background: #27c93f; }
.tt-title {
margin-left: 8px;
font-size: 12px;
color: #8b949e;
font-family: 'JetBrains Mono', 'Cascadia Code', 'SFMono-Regular', Consolas,
'PingFang SC', 'Microsoft YaHei', monospace;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.tt-body {
border-radius: 0;
}
/* 等宽字体 + 行高,整体更像终端输出 */
.task-terminal :deep(.t-terminal) {
font-family: 'JetBrains Mono', 'Cascadia Code', 'SFMono-Regular', 'Fira Code', Consolas,
'PingFang SC', 'Microsoft YaHei', monospace;
font-size: 12.5px;
line-height: 1.6;
}
.task-terminal :deep(.terminal-content) {
padding: 8px 10px;
}
/* 窄滚动条 */
.task-terminal :deep(.terminal-content)::-webkit-scrollbar {
width: 8px;
height: 8px;
}
.task-terminal :deep(.terminal-content)::-webkit-scrollbar-thumb {
background: #30363d;
border-radius: 4px;
}
.task-terminal :deep(.terminal-content)::-webkit-scrollbar-track {
background: transparent;
}
</style>

View File

@ -116,7 +116,7 @@ defineExpose({
min-height: 75px; min-height: 75px;
} }
.el-timeline-item :deep(.el-timeline-item__node--normal) { .el-timeline-item >>> .el-timeline-item__node--normal {
left: 117px; left: 117px;
width: 18px; width: 18px;
height: 18px; height: 18px;
@ -128,7 +128,7 @@ defineExpose({
/* 用于定位伪元素 */ /* 用于定位伪元素 */
} }
.el-timeline-item :deep(.el-timeline-item__node--normal::before) { .el-timeline-item >>> .el-timeline-item__node--normal::before {
content: ""; content: "";
position: absolute; position: absolute;
top: 50%; top: 50%;
@ -144,7 +144,7 @@ defineExpose({
/* 居中显示 */ /* 居中显示 */
} }
.el-timeline-item :deep(.el-timeline-item__tail) { .el-timeline-item >>> .el-timeline-item__tail {
left: 125px; left: 125px;
border-left-color: #dddddd; border-left-color: #dddddd;
border-left-style: dashed; border-left-style: dashed;
@ -152,7 +152,7 @@ defineExpose({
height: calc(100% - 24px - 12px); height: calc(100% - 24px - 12px);
} }
.time-dialog :deep(.el-dialog__header) { .time-dialog >>> .el-dialog__header {
padding: 10px 20px; padding: 10px 20px;
height: 25px; height: 25px;
line-height: 25px; line-height: 25px;
@ -161,33 +161,33 @@ defineExpose({
border-bottom: solid 1px #e4e7ed; border-bottom: solid 1px #e4e7ed;
} }
.time-dialog :deep(.el-card__body) { .time-dialog >>> .el-card__body {
padding: 8px; padding: 8px;
} }
.time-dialog :deep(.el-card.is-always-shadow) { .time-dialog >>> .el-card.is-always-shadow {
box-shadow: none; box-shadow: none;
} }
.time-dialog :deep(.el-dialog__headerbtn .el-dialog__close) { .time-dialog >>> .el-dialog__headerbtn .el-dialog__close {
color: #666; color: #666;
} }
.time-dialog :deep(.el-dialog__headerbtn:hover .el-dialog__close) { .time-dialog >>> .el-dialog__headerbtn:hover .el-dialog__close {
color: #666; color: #666;
} }
.time-dialog :deep(.el-dialog__headerbtn) { .time-dialog >>> .el-dialog__headerbtn {
top: 14px; top: 14px;
} }
.time-dialog :deep(.el-collapse) { .time-dialog >>> .el-collapse {
margin-left: 119px; margin-left: 119px;
border: none; border: none;
margin-top: -22px; margin-top: -22px;
} }
.time-dialog :deep(.el-collapse-item__header) { .time-dialog >>> .el-collapse-item__header {
border: none; border: none;
line-height: 25px; line-height: 25px;
height: 25px; height: 25px;
@ -195,16 +195,16 @@ defineExpose({
z-index: 999; z-index: 999;
} }
.time-dialog :deep(.el-collapse-item__wrap) { .time-dialog >>> .el-collapse-item__wrap {
border: none; border: none;
} }
.time-dialog :deep(.el-collapse-item__content) { .time-dialog >>> .el-collapse-item__content {
margin-top: 15px; margin-top: 15px;
padding-bottom: 0 !important; padding-bottom: 0 !important;
} }
.time-dialog :deep(.el-timeline-item__node--01) { .time-dialog >>> .el-timeline-item__node--01 {
width: 18px !important; width: 18px !important;
height: 18px !important; height: 18px !important;
left: 117px !important; left: 117px !important;

File diff suppressed because it is too large Load Diff

View File

@ -1,729 +0,0 @@
<template>
<div class="verify-panel">
<!-- 顶部提示:校验进行中的整体说明 -->
<div class="verify-header" :class="{ 'is-failed': finished && !passed, 'is-passed': finished && passed }">
<el-icon class="verify-header-icon">
<CircleCheckFilled v-if="finished && passed" />
<WarningFilled v-else-if="finished && !passed" />
<Loading v-else class="is-spin" />
</el-icon>
<div class="min-w-0">
<div class="verify-header-title">{{ headerTitle }}</div>
<div class="verify-header-tip">{{ headerTip }}</div>
</div>
</div>
<!-- 首次校验且清单未到达:用骨架占位,避免出现「空白 → 突然出现列表」的跳变 -->
<ul v-if="!items.length && !error" class="verify-list">
<li v-for="n in 4" :key="'skeleton-' + n" class="verify-item">
<span class="verify-icon"><span class="verify-dot"></span></span>
<div class="verify-body">
<div class="verify-skeleton w-[36%]"></div>
<div class="verify-skeleton w-[68%] mt-[7px]"></div>
</div>
</li>
</ul>
<!-- 校验项列表 -->
<ul v-else class="verify-list">
<li v-for="item in items" :key="item.key" class="verify-item" :class="'is-' + item.status">
<span class="verify-icon">
<el-icon v-if="item.status === 'passed'"><CircleCheckFilled /></el-icon>
<el-icon v-else-if="item.status === 'running'" class="is-spin"><Loading /></el-icon>
<el-icon v-else-if="item.status === 'failed'"><CircleCloseFilled /></el-icon>
<!-- 待校验:空心圆圈(不显示序号) -->
<span v-else class="verify-dot"></span>
</span>
<div class="verify-body">
<div class="verify-name">
{{ item.name }}
<span v-if="item.required" class="verify-required">必须</span>
</div>
<div class="verify-desc">{{ item.status === 'failed' && item.message ? item.message : item.desc }}</div>
<!-- 明细(如权限异常的目录清单) -->
<ul v-if="item.status === 'failed' && ( item.details?.length ?? 0 ) > 0" class="verify-details">
<li v-for="(detail, di) in item.details?.slice(0, 5)" :key="di">{{ detail }}</li>
<li v-if="( item.details?.length ?? 0 ) > 5">等 {{ item.details?.length }} 项</li>
</ul>
<!-- 修复建议(仅未通过时展示) -->
<div v-if="item.status === 'failed' && item.suggest" class="verify-suggest">
<span class="verify-suggest-label">修复建议</span>
<span class="verify-suggest-text">{{ item.suggest }}</span>
</div>
</div>
<span v-if="item.status === 'running'" class="verify-tail">校验中...</span>
<span v-else-if="item.status === 'failed'" class="verify-tail is-error">未通过</span>
</li>
</ul>
<!-- 操作区 -->
<div v-if="showFooter" class="verify-footer">
<el-button v-if="showPrev" :disabled="operating" @click="emit('prev')">{{ prevText }}</el-button>
<span v-else></span>
<div class="flex items-center gap-[10px]">
<span v-if="!operating && finished && !passed" class="text-[12px] text-[#f56c6c]">
{{ error ? '校验服务异常,可重新校验' : '存在未通过的必检项,请处理后再继续' }}
</span>
<!-- 未通过 / 服务异常:提供重新校验入口(用户处理后可原地重跑) -->
<el-button v-if="showRetry && !passed && ( finished || retrying )" :loading="retrying"
:disabled="operating" @click="retry">
{{ retryText }}
</el-button>
<el-button type="primary" :disabled="!canNext" :loading="operating" @click="emit('next')">
{{ nextText }}
</el-button>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { ref, computed, onMounted, onUnmounted } from 'vue'
import { CircleCheckFilled, CircleCloseFilled, Loading, WarningFilled } from '@element-plus/icons-vue'
import { getCheckMeta, getCachedSceneMeta, setCachedSceneMeta, getCheckStreamUrl, runCheck } from '@/app/api/check'
/**
* 通用校验面板
*
* 场景与校验项由后端字典定义(CheckSceneDict),本组件只负责:
* 1. 通过 SSE 订阅校验过程,实时渲染每一项的状态(待校验 / 校验中 / 通过 / 未通过)
* 2. 按「是否必须通过」决定整体结论与「下一步」是否可用
* 3. 支持「校验通过后自动下一步」(autoNext),不通过时可由调用方决定如何阻断
*
* SSE 不可用时自动降级为一次性接口(runCheck),保证任何环境下都能用。
*/
interface CheckItem {
key: string
name: string
desc: string
required: number
status: 'pending' | 'running' | 'passed' | 'failed'
message?: string
details?: string[]
/** 修复建议(未通过时展示) */
suggest?: string
}
const props = defineProps({
/** 校验场景(cloud_build / upgrade ...) */
scene: { type: String, required: true },
/** 业务参数(如升级的 addon) */
params: { type: Object, default: () => ({}) },
/** 覆盖后端下发的标题 / 提示 */
title: { type: String, default: '' },
tip: { type: String, default: '' },
/** 挂载后是否自动开始校验 */
autoStart: { type: Boolean, default: true },
/** 校验通过后是否自动触发下一步 */
autoNext: { type: Boolean, default: false },
/** 自动下一步延迟(毫秒),留出时间让用户看到校验结果 */
autoNextDelay: { type: Number, default: 800 },
/** 必须项未通过时是否禁用「下一步」 */
nextDisabledOnFail: { type: Boolean, default: true },
/** 是否展示底部操作区 */
showFooter: { type: Boolean, default: true },
showPrev: { type: Boolean, default: true },
prevText: { type: String, default: '上一步' },
nextText: { type: String, default: '下一步' },
/** 未通过(或校验服务异常)时是否显示「重新校验」 */
showRetry: { type: Boolean, default: true },
retryText: { type: String, default: '重新校验' },
/** 首帧超时(毫秒):超时判定 SSE 链路不可用并降级 */
firstFrameTimeout: { type: Number, default: 2000 }
})
const emit = defineEmits([ 'meta', 'item', 'done', 'passed', 'failed', 'next', 'prev', 'retry' ])
const items = ref<CheckItem[]>([])
const title = ref('')
const tip = ref('')
const started = ref(false)
const finished = ref(false)
const passed = ref(false)
/** 校验服务不可用(连接失败 / 接口异常),与「校验未通过」区分展示 */
const error = ref('')
const operating = ref(false)
/** 重新校验中(重新校验期间保持按钮可见并显示 loading) */
const retrying = ref(false)
const headerTitle = computed(() => {
if (error.value) return '校验失败'
if (!finished.value) return props.title || title.value || '正在校验...'
return passed.value ? '校验通过' : '校验未通过'
})
const headerTip = computed(() => {
if (error.value) return error.value
if (!finished.value) return props.tip || tip.value || '请稍候,正在逐项检查'
if (passed.value) return '全部必检项已通过'
return '请根据下方提示处理后重新校验'
})
const canNext = computed(() => {
if (error.value || !finished.value) return false
if (props.nextDisabledOnFail && !passed.value) return false
return true
})
// ==================== SSE 订阅 ====================
let source: EventSource | null = null
let firstFrameTimer: any = null
let autoNextTimer: any = null
let firstFrameArrived = false
/** 已降级,避免重复触发 */
let degraded = false
/**
* SSE 在本会话内是否可用
*
* 部署在 Apache + mod_fcgid 等会缓冲响应的环境时,响应头能下来但正文事件帧始终不到,
* 每次校验都要等满 firstFrameTimeout 才降级。这里记住首次失败,
* 同一个页面会话内后续校验直接走一次性通道,不再重复等待。
*/
let sseUsable = true
const closeSse = () => {
if (source) {
source.close()
source = null
}
firstFrameTimer && clearTimeout(firstFrameTimer)
firstFrameTimer = null
}
/** 只重置校验结果标记,不清理列表(列表原地重置,避免出现「消失又出现」的跳变) */
const resetFlags = () => {
finished.value = false
passed.value = false
error.value = ''
firstFrameArrived = false
degraded = false
autoNextTimer && clearTimeout(autoNextTimer)
autoNextTimer = null
}
/** 按清单构建校验项(全部为待校验) */
const buildItems = (list: any[]): CheckItem[] => ( list ?? [] ).map((item: any) => ({
key: String(item.key),
name: String(item.name ?? item.key),
desc: String(item.desc ?? ''),
required: Number(item.required ?? 1),
status: 'pending' as const,
message: '',
details: [],
suggest: String(item.suggest ?? '')
}))
/**
* 取场景清单并渲染(不执行检测)
* 优先用缓存(同步、零等待),否则请求 meta 接口 —— 保证「先有清单,再逐项检测」
*/
const loadMeta = async () => {
const cached = getCachedSceneMeta(props.scene)
if (cached && Array.isArray(cached.items) && cached.items.length) {
items.value = buildItems(cached.items)
title.value = cached.title || ''
tip.value = cached.tip || ''
return
}
try {
const res: any = await getCheckMeta(props.scene)
const data = res?.data
if (!data) return
title.value = String(data.title ?? title.value)
tip.value = String(data.tip ?? tip.value)
if (Array.isArray(data.items) && data.items.length) items.value = buildItems(data.items)
setCachedSceneMeta(props.scene, { title: title.value, tip: tip.value, items: data.items ?? [] })
} catch (e) {
// 取不到清单时保留骨架占位,SSE 的 meta 帧会兜住
}
}
const findItem = (key: string) => items.value.find((item) => item.key === key)
/** meta:初始化完整校验清单(全部为待校验),并缓存清单供下次立即渲染 */
const onMeta = (data: any) => {
firstFrameArrived = true
title.value = String(data?.title ?? title.value)
tip.value = String(data?.tip ?? tip.value)
const list = Array.isArray(data?.items) ? data.items : []
setCachedSceneMeta(props.scene, { title: title.value, tip: tip.value, items: list })
if (!items.value.length) {
// 未预先拿到清单(清单接口失败等):这里兜底铺出完整列表
items.value = buildItems(list)
emit('meta', data)
return
}
// 已有清单:只补齐缺失项 / 校正文案,保留已检测出的状态(避免把结果回退成待校验)
list.forEach((raw: any) => {
const key = String(raw?.key ?? '')
if (!key) return
const built = buildItems([ raw ])[ 0 ]
const exist = findItem(key)
if (!exist) {
items.value.push(built)
} else {
exist.name = built.name
exist.desc = built.desc
exist.required = built.required
// meta 阶段闭包形式的建议解析不了(无业务参数),下发为空,不能覆盖已检测出的具体建议
if (built.suggest) exist.suggest = built.suggest
}
})
emit('meta', data)
}
/** item:单项状态更新 */
const onItem = (data: any) => {
firstFrameArrived = true
const key = String(data?.key ?? '')
if (!key) return
const target = findItem(key)
if (!target) {
// 未收到 meta 的兜底:优先用 item 自带的口径字段,缺失才退回 key
items.value.push({
key,
name: String(data?.name ?? key),
desc: String(data?.desc ?? ''),
required: Number(data?.required ?? 1),
status: data?.status ?? 'pending',
message: data?.message ?? '',
details: data?.details ?? [],
suggest: String(data?.suggest ?? '')
})
} else {
target.status = data?.status ?? target.status
if (data?.message !== undefined) target.message = String(data.message ?? '')
if (Array.isArray(data?.details)) target.details = data.details
if (data?.suggest !== undefined) target.suggest = String(data.suggest ?? '')
}
emit('item', data)
}
/** 收尾:统一处理整体结论与自动下一步 */
const finish = (isPassed: boolean, failedKeys: string[] = []) => {
finished.value = true
passed.value = isPassed
emit('done', { passed: isPassed, failed: failedKeys })
if (isPassed) {
emit('passed')
// 自动下一步:延迟一点让用户看到「校验通过」的结果
if (props.autoNext) {
autoNextTimer = setTimeout(() => emit('next'), Math.max(0, props.autoNextDelay))
}
} else {
emit('failed', failedKeys)
}
}
const onDone = (data: any) => {
closeSse()
finish(!!data?.passed, data?.failed ?? [])
}
const onStreamFailed = (data: any) => {
error.value = String(data?.message ?? '校验服务异常')
closeSse()
finish(false)
}
/** 降级:SSE 不可用时改用一次性接口 */
const degrade = async () => {
if (degraded || finished.value) return
degraded = true
// 记住本次失败:同一页面会话内后续校验不再尝试 SSE(结果一致,且无需等待)
sseUsable = false
try {
const res: any = await runCheck(props.scene, props.params)
const data = res?.data
if (!data) {
error.value = '校验服务不可用,请稍后重试'
finish(false)
return
}
title.value = String(data.title ?? title.value)
tip.value = String(data.tip ?? tip.value)
items.value = ( data.items ?? [] ).map((item: any) => ({
key: String(item.key),
name: String(item.name ?? item.key),
desc: String(item.desc ?? ''),
required: Number(item.required ?? 1),
status: item.status ?? 'pending',
message: item.message ?? '',
details: Array.isArray(item.details) ? item.details : [],
suggest: String(item.suggest ?? '')
}))
finish(!!data.passed, data.failed ?? [])
} catch (e) {
error.value = '校验服务不可用,请稍后重试'
finish(false)
}
}
/** 开始(重新)校验:先渲染完整清单,再连 SSE 逐项接收检测结果 */
const start = async () => {
closeSse()
// 只重置结果标记:列表保留,状态回到「待校验」,避免出现消失又出现
resetFlags()
items.value = buildItems(items.value)
// 1. 先拿到并渲染完整清单(缓存优先,通常无网络等待)
await loadMeta()
started.value = true
// 2. 本会话内已确认 SSE 不可用(连得上但收不到事件帧)时直接走一次性通道,
// 避免每次校验都白等一个首帧超时
if (!sseUsable) {
await degrade()
return
}
// 3. 再连接 SSE,逐项点亮 running → passed / failed
try {
source = new EventSource(getCheckStreamUrl(props.scene, props.params))
} catch (e) {
await degrade()
return
}
source.addEventListener('meta', (e: MessageEvent) => onMeta(parse(e)))
source.addEventListener('item', (e: MessageEvent) => onItem(parse(e)))
source.addEventListener('done', (e: MessageEvent) => onDone(parse(e)))
source.addEventListener('failed', (e: MessageEvent) => onStreamFailed(parse(e)))
// 连接异常:未拿到任何数据直接降级;已开始校验则等 done(避免重复执行一次全量校验)
source.onerror = () => {
if (finished.value) {
closeSse()
return
}
if (!firstFrameArrived) {
closeSse()
degrade()
}
}
// 首帧超时:部分代理会把 SSE 攒在缓冲区,收不到首帧就降级
firstFrameTimer = window.setTimeout(() => {
if (!firstFrameArrived) {
closeSse()
degrade()
}
}, Math.max(500, props.firstFrameTimeout))
}
/** 重新校验:重置状态并完整重跑一轮(用户处理完问题后原地重跑) */
const retry = async () => {
if (retrying.value) return
retrying.value = true
emit('retry')
try {
await start()
} finally {
retrying.value = false
}
}
const parse = (e: MessageEvent): any => {
try {
return JSON.parse(e.data)
} catch (err) {
return null
}
}
/** 外部设置「操作中」(如下一步提交中)时禁用按钮 */
const setOperating = (value: boolean) => {
operating.value = !!value
}
onMounted(() => {
if (props.autoStart) start()
})
onUnmounted(() => {
closeSse()
autoNextTimer && clearTimeout(autoNextTimer)
autoNextTimer = null
})
defineExpose({
// 状态
items,
title,
tip,
started,
finished,
passed,
error,
// 行为
start,
retry,
setOperating
})
</script>
<style lang="scss" scoped>
.verify-panel {
display: flex;
flex-direction: column;
min-height: 0;
}
/* 顶部整体提示条 */
.verify-header {
display: flex;
align-items: flex-start;
gap: 8px;
padding: 10px 12px;
border: 1px solid #cdeedd;
border-radius: 6px;
background-color: #f0faf5;
&.is-failed {
border-color: #fbd9d9;
background-color: #fef3f3;
}
&.is-passed {
border-color: #cdeedd;
background-color: #f0faf5;
}
}
.verify-header-icon {
margin-top: 2px;
font-size: 16px;
color: #22b07d;
.is-failed & {
color: #f56c6c;
}
}
.verify-header-title {
font-size: 14px;
font-weight: 600;
color: #1d2a25;
.is-failed & {
color: #a94442;
}
}
.verify-header-tip {
margin-top: 2px;
font-size: 12px;
line-height: 18px;
color: #6b7c75;
.is-failed & {
color: #b96a6a;
}
}
/* 校验项列表 */
.verify-list {
margin: 8px 0 0;
padding: 0;
list-style: none;
overflow-y: auto;
}
/* 骨架占位(首次校验、清单未到达时) */
.verify-skeleton {
height: 10px;
background-color: #eef1f5;
border-radius: 4px;
animation: verify-skeleton 1.2s ease-in-out infinite;
}
@keyframes verify-skeleton {
0%, 100% { opacity: 1; }
50% { opacity: .45; }
}
.verify-item {
display: flex;
align-items: flex-start;
gap: 10px;
padding: 9px 4px;
& + .verify-item {
border-top: 1px solid #f2f4f7;
}
}
.verify-icon {
display: inline-flex;
flex-shrink: 0;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
margin-top: 1px;
font-size: 18px;
/* 待校验:空心圆圈(不显示序号) */
.verify-dot {
display: inline-block;
width: 13px;
height: 13px;
border: 1px solid #d4d9e2;
border-radius: 50%;
}
}
.verify-body {
flex: 1;
min-width: 0;
}
.verify-name {
display: flex;
align-items: center;
gap: 6px;
font-size: 13px;
color: #303133;
}
.verify-required {
padding: 0 4px;
font-size: 11px;
line-height: 15px;
color: #b26b00;
background-color: #fff7e6;
border: 1px solid #ffe0a3;
border-radius: 3px;
}
.verify-desc {
margin-top: 2px;
font-size: 12px;
line-height: 18px;
color: #909399;
word-break: break-all;
}
.verify-details {
margin: 4px 0 0;
padding: 6px 8px;
list-style: none;
font-size: 12px;
line-height: 19px;
color: #b96a6a;
background-color: #fef6f6;
border-radius: 4px;
li {
word-break: break-all;
}
}
/* 修复建议(未通过时展示) */
.verify-suggest {
display: flex;
align-items: flex-start;
gap: 6px;
margin: 4px 0 0;
padding: 6px 8px;
font-size: 12px;
line-height: 19px;
color: #8a6d3b;
background-color: #fffaf0;
border: 1px solid #ffe4b0;
border-radius: 4px;
}
.verify-suggest-label {
flex-shrink: 0;
padding: 0 4px;
font-size: 11px;
line-height: 17px;
color: #b26b00;
background-color: #fff3e0;
border: 1px solid #ffd591;
border-radius: 3px;
}
.verify-suggest-text {
word-break: break-all;
}
.verify-tail {
flex-shrink: 0;
margin-top: 1px;
font-size: 12px;
color: #1c6ef2;
&.is-error {
color: #f56c6c;
}
}
/* 状态配色 */
.verify-item.is-passed {
.verify-icon,
.verify-name {
color: #22b07d;
}
.verify-desc {
color: #6b7c75;
}
}
.verify-item.is-failed {
.verify-icon,
.verify-name {
color: #f56c6c;
}
}
.verify-item.is-running {
.verify-icon {
color: #1c6ef2;
}
.verify-name {
font-weight: 600;
color: #1c6ef2;
}
}
/* 底部操作区 */
.verify-footer {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 12px;
padding-top: 12px;
border-top: 1px solid #f2f4f7;
}
.is-spin {
animation: verify-spin 1s linear infinite;
}
@keyframes verify-spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
</style>

View File

@ -7,52 +7,6 @@
"menuTypeButton": "Button", "menuTypeButton": "Button",
"menuDeleteTips": "Are you sure you want to delete this menu?", "menuDeleteTips": "Are you sure you want to delete this menu?",
"addMenu": "Add menu", "addMenu": "Add menu",
"exportMenu": "Export menu",
"exportMenuScope": "Export scope",
"exportMenuSystem": "System menus",
"exportMenuApp": "Application menus",
"exportMenuAppPlaceholder": "Select applications to export",
"exportMenuSelectAll": "Select all",
"exportMenuClear": "Clear",
"exportMenuScopeRequired": "Please select at least one export scope",
"exportMenuSuccess": "Menu export completed",
"importMenu": "Import menu",
"importMenuUploadTips": "Click or drag to upload the exported .json menu file",
"importMenuLocalUpload": "Upload local file",
"importMenuUploadTitle": "Click or drag to upload a JSON file",
"importMenuUploadDesc": "Supports .json format",
"importMenuUploadLimitInline": ", limit ",
"importMenuReplaceTips": "Click or drag to replace the file",
"importMenuRemoveFile": "Remove file",
"importMenuOverwrite": "Overwrite existing menus",
"importMenuOverwriteTips": "When enabled, existing menus will be overwritten by the file; otherwise they will be skipped",
"importMenuFileRequired": "Please select a menu file to import",
"importMenuUploadLimit": "Max upload size allowed by PHP",
"importMenuFileTooLarge": "The file exceeds the PHP upload limit, please adjust upload_max_filesize and post_max_size in php.ini",
"importMenuResult": "Import result",
"importMenuTotal": "Total",
"importMenuInsert": "Inserted",
"importMenuUpdate": "Updated",
"importMenuSkip": "Skipped",
"importMenuFail": "Failed",
"importMenuFailList": "Failure details",
"importMenuAllSuccess": "All menus imported successfully",
"importMenuPreview": "File preview",
"importMenuPreviewTotal": "Total menus",
"importMenuPreviewApp": "Applications",
"importMenuPreviewEmpty": "No menus to preview in this file",
"importMenuPreviewInvalid": "Failed to parse the file, please make sure it is an exported menu JSON file",
"importMenuPreviewParsing": "Parsing...",
"importMenuPreviewTruncated": "Too many items, only the first 2000 are previewed",
"importMenuDone": "Import completed",
"importMenuHasFail": "Has failures",
"importMenuUnit": "items",
"importMenuFailRatio": "Ratio",
"importMenuFailReason": "Error message",
"importMenuImporting": "Importing, please wait...",
"importMenuLimitAdjustPhp": "The limit is restricted by PHP. Increase upload_max_filesize and post_max_size in php.ini and restart PHP",
"importMenuLimitAdjustSplit": "If the limit is exceeded, please split the menu file and import it in batches",
"importMenuFileOverMax": "The file exceeds the 2MB limit, please split the menu file and import it in batches",
"updateMenu": "Update menu", "updateMenu": "Update menu",
"routePath": "Route path", "routePath": "Route path",
"viewPath": "Component path", "viewPath": "Component path",

View File

@ -3,7 +3,5 @@
"login": "Login", "login": "Login",
"logging": "Logging", "logging": "Logging",
"userPlaceholder": "Please enter your account number", "userPlaceholder": "Please enter your account number",
"passwordPlaceholder": "Please enter your password", "passwordPlaceholder": "Please enter your password"
"noMenuPermissionTip": "Your account has no available menu permission and cannot access the system. Please contact the administrator",
"menuLoadErrorTip": "Failed to load menu permission. You have been logged out, please log in again"
} }

View File

@ -1,47 +0,0 @@
{
"panelTitle": "Operations Panel",
"panelSubTitle": "Track how each addon is used and stays active across sites (the cumulative curve is based on site creation time)",
"searchPlaceholder": "Search addon name",
"typeAll": "All",
"typeApp": "Application",
"typeAddon": "Addon",
"addonCount": "Total addons",
"totalSiteCount": "Total sites",
"avgUsageRate": "Avg. usage rate",
"useSiteCount": "Sites in use",
"usageRate": "Usage rate",
"siteInUseSuffix": "sites in use",
"last7NewSite": "New in 7 days",
"expireSoonCount": "Expiring soon",
"silentCount": "Silent sites",
"emptyAddonData": "No installed and enabled addons",
"author": "Author",
"rankTab": "Site ranking",
"expireTab": "Expiring soon",
"silentTab": "Silent sites",
"silentTip": "Silent sites: sites that are active, created more than 30 days ago, and have had no new member registrations in the last 30 days.",
"siteName": "Site name",
"memberCount": "Members",
"lastMemberTime": "Last signup",
"silentDays": "Silent days",
"status": "Status",
"createTime": "Created",
"expireTime": "Expires",
"remainDays": "Remaining",
"dayUnit": "d",
"rank": "Rank",
"noData": "No data",
"trendTitle": "Cumulative sites in use",
"last7Days": "Last 7 days",
"last30Days": "Last 30 days",
"trendTotal": "Cumulative sites",
"trendDaily": "New that day",
"trendTip": "Note: the cumulative value counts sites currently using this addon whose creation time is before the end of that day (monotonic, and its end point equals the total sites in use). Since the system does not record when an addon was added to a site, \"New that day\" is approximated by site creation time.",
"statusStatTitle": "Site status distribution",
"ageStatTitle": "Site age composition",
"groupStatTitle": "Package group distribution",
"groupTotal": "Sites in package",
"groupRate": "Penetration",
"coexistStatTitle": "Addons often paired with",
"coexistCount": "Paired times"
}

View File

@ -1,48 +0,0 @@
{
"title": "Code Integrity Check",
"currentVersion": "Current version",
"targetLabel": "Target",
"targetPlaceholder": "Please select a target",
"targetRequired": "Please select a target first",
"pathLabel": "Custom path (optional)",
"pathPlaceholder": "e.g. addon/shop; overrides the target above",
"algorithmLabel": "Algorithm",
"ruleLabel": "Ignore",
"ignoreBom": "Ignore byte order mark",
"ignoreEol": "Ignore line endings",
"ruleChangedTip": "Rule or algorithm changed; a different baseline file will be used and must be re-downloaded",
"startCheck": "Start check",
"checking": "Checking…",
"rescan": "Check again",
"baselineFile": "Baseline file",
"scanned": "Files scanned",
"elapsed": "Elapsed",
"baselineSourceCache": "Local cache",
"baselineSourceCloud": "Downloaded from cloud",
"statusReady": "Baseline ready",
"statusMissing": "Baseline not downloaded",
"statusVersionMismatch": "Version mismatch",
"statusConfigMismatch": "Rule/algorithm not downloaded",
"statusRulesMismatch": "Exclusion rules updated",
"statusCorrupted": "Baseline file corrupted",
"statusVersionUnknown": "Version unreadable",
"rulesVersionLabel": "Exclusion rules version",
"summaryNew": "Added",
"summaryModified": "Modified",
"summaryDeleted": "Deleted",
"allMatched": "Identical to the official release",
"allMatchedTip": "Under the current ignore rules, every file matches the official baseline.",
"detailTitle": "Differences",
"filterAll": "All types",
"typeNew": "Added",
"typeModified": "Modified",
"typeDeleted": "Deleted",
"filePath": "File path",
"changeType": "Change",
"fileSize": "Size",
"fileHash": "Hash",
"keywordPlaceholder": "Search by file path",
"emptyData": "No matching data",
"checkFailed": "Check failed, please try again later",
"configLoadFailed": "Initialization failed, please refresh the page"
}

View File

@ -1,5 +1,4 @@
{ {
"title": "授权信息",
"companyName": "授权主体", "companyName": "授权主体",
"siteAddress": "授权域名", "siteAddress": "授权域名",
"contactName": "授权联系人", "contactName": "授权联系人",
@ -16,32 +15,5 @@
"notHaveAuth": "还没有授权?去购买", "notHaveAuth": "还没有授权?去购买",
"authInfoTips": "授权码和授权秘钥可在Niucloud官网我的授权 授权详情中查看", "authInfoTips": "授权码和授权秘钥可在Niucloud官网我的授权 授权详情中查看",
"cloudBuildTips": "是否要进行云编译该操作可能会影响到正在访问的客户是否要继续操作?", "cloudBuildTips": "是否要进行云编译该操作可能会影响到正在访问的客户是否要继续操作?",
"versionTips": "已经升级到最新版本", "versionTips": "已经升级到最新版本"
"bindTitle": "绑定官网账号",
"bindDesc": "在下方官网页面登录账号并选择要绑定到本站的授权;账号密码仅提交至官网,本站不会保存。",
"loadingEmbed": "正在加载官网页面…",
"fallbackTip": "官网页面加载失败或长时间无响应,可改用以下方式完成绑定:",
"openOfficial": "在新窗口打开官网",
"manualBind": "授权码认证",
"manualBindDesc": "也可使用授权码与授权秘钥手动完成绑定",
"switchAuth": "切换授权",
"switchTip": "在官网页面选择要切换到本站的授权,切换后当前授权将自动解绑",
"syncState": "同步状态",
"logoutAccount": "退出官网账号",
"logoutConfirm": "退出后将清除官网账号信息,已绑定的授权不受影响。是否继续?",
"source": "绑定来源",
"sourceAccount": "官网账号",
"sourceManual": "授权码手动绑定",
"lastSync": "上次同步",
"notSync": "尚未同步",
"bindSuccess": "授权绑定成功",
"selectSuccess": "授权已生效",
"cancelAuthSuccess": "已取消选用授权",
"confirm": "确定",
"currentAuthCode": "系统现有授权:",
"replaceAuthTitle": "替换现有授权",
"replaceAuthTip": "继续将替换系统现有授权,替换后旧授权立即失效。是否继续?",
"addressMismatch": "授权域名与当前站点不一致",
"cancel": "取消"
} }

View File

@ -10,52 +10,6 @@
"initializeMenuTipsOne":"重置菜单会将应用或插件的dict目录下的菜单配置文件中,菜单配置更新到数据库一般用做开发者修改了dict菜单配置文件后,同步到数据库操作。", "initializeMenuTipsOne":"重置菜单会将应用或插件的dict目录下的菜单配置文件中,菜单配置更新到数据库一般用做开发者修改了dict菜单配置文件后,同步到数据库操作。",
"initializeMenuTipsTwo":"如果用户手动调整过以下菜单项,通常允许进行本项操作,操作会重置为原始菜单。 请谨慎使用!", "initializeMenuTipsTwo":"如果用户手动调整过以下菜单项,通常允许进行本项操作,操作会重置为原始菜单。 请谨慎使用!",
"addMenu": "添加菜单", "addMenu": "添加菜单",
"exportMenu": "导出菜单",
"exportMenuScope": "导出范围",
"exportMenuSystem": "系统菜单",
"exportMenuApp": "应用菜单",
"exportMenuAppPlaceholder": "请选择要导出的应用",
"exportMenuSelectAll": "全选",
"exportMenuClear": "清空",
"exportMenuScopeRequired": "请至少选择一项导出范围",
"exportMenuSuccess": "菜单导出完成",
"importMenu": "导入菜单",
"importMenuUploadTips": "点击或拖拽上传导出的 .json 菜单文件",
"importMenuLocalUpload": "本地上传",
"importMenuUploadTitle": "点击或拖拽JSON文件上传",
"importMenuUploadDesc": "支持 .json 格式",
"importMenuUploadLimitInline": ",上限 ",
"importMenuReplaceTips": "点击或拖拽可替换文件",
"importMenuRemoveFile": "移除文件",
"importMenuOverwrite": "覆盖同名菜单",
"importMenuOverwriteTips": "开启后已存在的菜单会被文件内容覆盖,关闭则跳过并保留本地",
"importMenuFileRequired": "请先选择要导入的菜单文件",
"importMenuUploadLimit": "当前PHP允许上传的最大文件",
"importMenuFileTooLarge": "文件超过PHP上传限制,请在php.ini中调整 upload_max_filesize 与 post_max_size",
"importMenuResult": "导入结果",
"importMenuTotal": "共处理",
"importMenuInsert": "新增",
"importMenuUpdate": "更新",
"importMenuSkip": "跳过",
"importMenuFail": "失败",
"importMenuFailList": "失败明细",
"importMenuAllSuccess": "全部导入成功",
"importMenuPreview": "文件预览",
"importMenuPreviewTotal": "菜单条数",
"importMenuPreviewApp": "涉及应用",
"importMenuPreviewEmpty": "文件中没有可预览的菜单",
"importMenuPreviewInvalid": "文件解析失败,请确认是导出的菜单JSON文件",
"importMenuPreviewParsing": "解析中…",
"importMenuPreviewTruncated": "内容较多,仅预览前2000条",
"importMenuDone": "导入完成",
"importMenuHasFail": "存在失败项",
"importMenuUnit": "条",
"importMenuFailRatio": "占比",
"importMenuFailReason": "错误信息",
"importMenuImporting": "正在导入,请稍候…",
"importMenuLimitAdjustPhp": "当前上限受 PHP 配置限制,可在 php.ini 中调大 upload_max_filesize 与 post_max_size 后重启 PHP",
"importMenuLimitAdjustSplit": "超出上限时,请拆分菜单文件后分批导入",
"importMenuFileOverMax": "文件超过 2MB 上限,请拆分菜单文件后分批导入",
"updateMenu": "编辑菜单", "updateMenu": "编辑菜单",
"routePath": "路由路径", "routePath": "路由路径",
"viewPath": "组件路径", "viewPath": "组件路径",

View File

@ -7,52 +7,6 @@
"menuTypeButton": "按钮", "menuTypeButton": "按钮",
"menuDeleteTips": "确定要删除该菜单吗?", "menuDeleteTips": "确定要删除该菜单吗?",
"addMenu": "添加菜单", "addMenu": "添加菜单",
"exportMenu": "导出菜单",
"exportMenuScope": "导出范围",
"exportMenuSystem": "系统菜单",
"exportMenuApp": "应用菜单",
"exportMenuAppPlaceholder": "请选择要导出的应用",
"exportMenuSelectAll": "全选",
"exportMenuClear": "清空",
"exportMenuScopeRequired": "请至少选择一项导出范围",
"exportMenuSuccess": "菜单导出完成",
"importMenu": "导入菜单",
"importMenuUploadTips": "点击或拖拽上传导出的 .json 菜单文件",
"importMenuLocalUpload": "本地上传",
"importMenuUploadTitle": "点击或拖拽JSON文件上传",
"importMenuUploadDesc": "支持 .json 格式",
"importMenuUploadLimitInline": ",上限 ",
"importMenuReplaceTips": "点击或拖拽可替换文件",
"importMenuRemoveFile": "移除文件",
"importMenuOverwrite": "覆盖同名菜单",
"importMenuOverwriteTips": "开启后已存在的菜单会被文件内容覆盖,关闭则跳过并保留本地",
"importMenuFileRequired": "请先选择要导入的菜单文件",
"importMenuUploadLimit": "当前PHP允许上传的最大文件",
"importMenuFileTooLarge": "文件超过PHP上传限制,请在php.ini中调整 upload_max_filesize 与 post_max_size",
"importMenuResult": "导入结果",
"importMenuTotal": "共处理",
"importMenuInsert": "新增",
"importMenuUpdate": "更新",
"importMenuSkip": "跳过",
"importMenuFail": "失败",
"importMenuFailList": "失败明细",
"importMenuAllSuccess": "全部导入成功",
"importMenuPreview": "文件预览",
"importMenuPreviewTotal": "菜单条数",
"importMenuPreviewApp": "涉及应用",
"importMenuPreviewEmpty": "文件中没有可预览的菜单",
"importMenuPreviewInvalid": "文件解析失败,请确认是导出的菜单JSON文件",
"importMenuPreviewParsing": "解析中…",
"importMenuPreviewTruncated": "内容较多,仅预览前2000条",
"importMenuDone": "导入完成",
"importMenuHasFail": "存在失败项",
"importMenuUnit": "条",
"importMenuFailRatio": "占比",
"importMenuFailReason": "错误信息",
"importMenuImporting": "正在导入,请稍候…",
"importMenuLimitAdjustPhp": "当前上限受 PHP 配置限制,可在 php.ini 中调大 upload_max_filesize 与 post_max_size 后重启 PHP",
"importMenuLimitAdjustSplit": "超出上限时,请拆分菜单文件后分批导入",
"importMenuFileOverMax": "文件超过 2MB 上限,请拆分菜单文件后分批导入",
"initializeMenu":"重置菜单", "initializeMenu":"重置菜单",
"initializeMenuTipsOne":"重置菜单会将应用或插件的dict目录下的菜单配置文件中,菜单配置更新到数据库一般用做开发者修改了dict菜单配置文件后,同步到数据库操作。", "initializeMenuTipsOne":"重置菜单会将应用或插件的dict目录下的菜单配置文件中,菜单配置更新到数据库一般用做开发者修改了dict菜单配置文件后,同步到数据库操作。",
"initializeMenuTipsTwo":"如果用户手动调整过以下菜单项,通常允许进行本项操作,操作会重置为原始菜单。 请谨慎使用!", "initializeMenuTipsTwo":"如果用户手动调整过以下菜单项,通常允许进行本项操作,操作会重置为原始菜单。 请谨慎使用!",

View File

@ -45,8 +45,6 @@
"againUpload": "重新上传", "againUpload": "重新上传",
"uploadWeapp": "上传小程序", "uploadWeapp": "上传小程序",
"undoAudit" : "撤回审核", "undoAudit" : "撤回审核",
"rollback" : "回退",
"rollbackTips" : "回退将使用该版本上传时保留的源码包重新提交一次小程序发布",
"undoAuditTips" : "撤回代码审核,单个账号每天审核撤回次数最多不超过 5 次(每天的额度从0点开始生效),一个月不超过 10 次。是否要继续撤回?", "undoAuditTips" : "撤回代码审核,单个账号每天审核撤回次数最多不超过 5 次(每天的额度从0点开始生效),一个月不超过 10 次。是否要继续撤回?",
"versionDeleteTips" : "删除后该版本将不可恢复,是否确定删除?", "versionDeleteTips" : "删除后该版本将不可恢复,是否确定删除?",
"helpInfo": "查看帮助", "helpInfo": "查看帮助",

View File

@ -34,11 +34,6 @@
"bgHeightScaleTip": "为0时背景高度自适应展示", "bgHeightScaleTip": "为0时背景高度自适应展示",
"marginSet": "边距设置", "marginSet": "边距设置",
"componentStyleTitle": "组件样式", "componentStyleTitle": "组件样式",
"componentIsShowTitle": "显示设置",
"componentIsShow": "是否展示",
"componentIsShowTips": "隐藏后前台不展示该组件,装修预览中仍可编辑",
"componentShowAction": "设为展示",
"componentHideAction": "设为隐藏",
"bottomBgColor": "底部背景", "bottomBgColor": "底部背景",
"bottomBgTips": "底部背景包含边距和圆角", "bottomBgTips": "底部背景包含边距和圆角",
"componentBgColor": "组件背景色", "componentBgColor": "组件背景色",
@ -209,18 +204,6 @@
"noticeShowLink": "跳转链接", "noticeShowLink": "跳转链接",
"dragMouseAdjustOrder": "鼠标拖拽可调整顺序", "dragMouseAdjustOrder": "鼠标拖拽可调整顺序",
"noticePlaceholderText": "请输入公告内容", "noticePlaceholderText": "请输入公告内容",
"carouselSearchHeaderSet": "顶部标题栏",
"carouselSearchHeaderBackIsShow": "返回箭头",
"carouselSearchHeaderTitleIsShow": "标题",
"carouselSearchHeaderTitle": "标题文字",
"carouselSearchHeaderTitlePlaceholder": "请输入标题文字",
"carouselSearchHeaderPositionIsShow": "地址定位",
"carouselSearchHeaderTextColor": "文字颜色",
"carouselSearchHeaderIconColor": "图标颜色",
"carouselSearchHeaderTips": "返回箭头、标题、地址定位可单独控制显示/隐藏,三项全部关闭时该行整体隐藏",
"carouselSearchHeaderStyle1Tips": "当前为风格1:返回箭头显示在上传图片左侧,标题与地址定位不适用于该风格,已禁止开启",
"carouselSearchHeaderStyle2Tips": "当前为风格2:返回箭头显示在生活圈(上传图片)左侧;地址定位显示在搜索框左侧,仍由「地址定位」开关控制;标题不适用于该风格(已禁止开启)",
"carouselSearchHeaderStyle3Tips": "当前为风格3:返回箭头显示在地址定位左侧,标题不适用于该风格(已禁止开启);地址定位内嵌在搜索行内,仍由「地址定位」开关控制",
"carouselSearchShowPosition": "显示设置", "carouselSearchShowPosition": "显示设置",
"carouselSearchOpen": "开启", "carouselSearchOpen": "开启",
"carouselSearchClose": "关闭", "carouselSearchClose": "关闭",
@ -289,8 +272,6 @@
"floatBtnImageSize": "图片大小", "floatBtnImageSize": "图片大小",
"floatBtnAroundRadius": "图片圆角", "floatBtnAroundRadius": "图片圆角",
"floatBtnImageSuggest": "建议上传正方形图片", "floatBtnImageSuggest": "建议上传正方形图片",
"floatBtnImageCircle": "建议上传圆形图片",
"floatBtnCustomerLinkTip": "固定跳转系统客服,不可更换",
"topStatusBarImg": "图片", "topStatusBarImg": "图片",
"topStatusBarNav": "导航栏", "topStatusBarNav": "导航栏",
"topStatusBarNavTips": "此处控制当前页面导航栏是否显示", "topStatusBarNavTips": "此处控制当前页面导航栏是否显示",

View File

@ -205,18 +205,6 @@
"noticeShowLink": "跳转链接", "noticeShowLink": "跳转链接",
"dragMouseAdjustOrder": "鼠标拖拽可调整顺序", "dragMouseAdjustOrder": "鼠标拖拽可调整顺序",
"noticePlaceholderText": "请输入公告内容", "noticePlaceholderText": "请输入公告内容",
"carouselSearchHeaderSet": "顶部标题栏",
"carouselSearchHeaderBackIsShow": "返回箭头",
"carouselSearchHeaderTitleIsShow": "标题",
"carouselSearchHeaderTitle": "标题文字",
"carouselSearchHeaderTitlePlaceholder": "请输入标题文字",
"carouselSearchHeaderPositionIsShow": "地址定位",
"carouselSearchHeaderTextColor": "文字颜色",
"carouselSearchHeaderIconColor": "图标颜色",
"carouselSearchHeaderTips": "返回箭头、标题、地址定位可单独控制显示/隐藏,三项全部关闭时该行整体隐藏",
"carouselSearchHeaderStyle1Tips": "当前为风格1:返回箭头显示在上传图片左侧,标题与地址定位不适用于该风格,已禁止开启",
"carouselSearchHeaderStyle2Tips": "当前为风格2:返回箭头显示在生活圈(上传图片)左侧;地址定位显示在搜索框左侧,仍由「地址定位」开关控制;标题不适用于该风格(已禁止开启)",
"carouselSearchHeaderStyle3Tips": "当前为风格3:返回箭头显示在地址定位左侧,标题不适用于该风格(已禁止开启);地址定位内嵌在搜索行内,仍由「地址定位」开关控制",
"carouselSearchShowPosition": "显示设置", "carouselSearchShowPosition": "显示设置",
"carouselSearchOpen": "开启", "carouselSearchOpen": "开启",
"carouselSearchClose": "关闭", "carouselSearchClose": "关闭",
@ -285,8 +273,6 @@
"floatBtnImageSize": "图片大小", "floatBtnImageSize": "图片大小",
"floatBtnAroundRadius": "图片圆角", "floatBtnAroundRadius": "图片圆角",
"floatBtnImageSuggest": "建议上传正方形图片", "floatBtnImageSuggest": "建议上传正方形图片",
"floatBtnImageCircle": "建议上传圆形图片",
"floatBtnCustomerLinkTip": "固定跳转系统客服,不可更换",
"topStatusBarImg": "图片", "topStatusBarImg": "图片",
"topStatusBarNav": "导航栏", "topStatusBarNav": "导航栏",
"topStatusBarNavTips": "此处控制当前页面导航栏是否显示", "topStatusBarNavTips": "此处控制当前页面导航栏是否显示",

View File

@ -8,7 +8,5 @@
"adminLogin": "平台登录", "adminLogin": "平台登录",
"userPlaceholder": "请输入您的账号", "userPlaceholder": "请输入您的账号",
"passwordPlaceholder": "请输入您的密码", "passwordPlaceholder": "请输入您的密码",
"manageAdminFramework": "管理系统后台框架", "manageAdminFramework": "管理系统后台框架"
"noMenuPermissionTip": "当前账号没有可用的菜单权限,无法进入系统,请联系管理员",
"menuLoadErrorTip": "获取菜单权限失败,已退出登录,请重新登录"
} }

View File

@ -1,47 +0,0 @@
{
"panelTitle": "运营面板",
"panelSubTitle": "掌握各插件在站点中的使用与活跃情况(累计曲线按站点创建时间统计)",
"searchPlaceholder": "搜索插件名称",
"typeAll": "全部",
"typeApp": "应用",
"typeAddon": "插件",
"addonCount": "插件总数",
"totalSiteCount": "站点总数",
"avgUsageRate": "平均使用率",
"useSiteCount": "使用站点数",
"usageRate": "使用率",
"siteInUseSuffix": "个站点在使用",
"last7NewSite": "近7天新增",
"expireSoonCount": "即将到期",
"silentCount": "静默站点",
"emptyAddonData": "暂无已安装启用的插件",
"author": "作者",
"rankTab": "站点排行",
"expireTab": "到期提醒",
"silentTab": "静默站点",
"silentTip": "静默站点:状态正常、建站超过 30 天,且近 30 天内没有任何新会员注册的站点。",
"siteName": "站点名称",
"memberCount": "会员数",
"lastMemberTime": "最后注册",
"silentDays": "静默天数",
"status": "状态",
"createTime": "创建时间",
"expireTime": "到期时间",
"remainDays": "剩余天数",
"dayUnit": "天",
"rank": "排名",
"noData": "暂无数据",
"trendTitle": "使用站点累计趋势",
"last7Days": "近7天",
"last30Days": "近30天",
"trendTotal": "累计站点数",
"trendDaily": "当日新增",
"trendTip": "口径说明:累计值 = 当前使用该插件的站点中,创建时间早于当日 24 点的站点数(单调递增,终点等于使用站点数)。由于系统未记录插件加入站点的历史时间,图中「当日新增」按站点创建时间近似统计。",
"statusStatTitle": "站点状态分布",
"ageStatTitle": "新老站点构成",
"groupStatTitle": "套餐分组分布",
"groupTotal": "套餐站点数",
"groupRate": "渗透率",
"coexistStatTitle": "常一起搭配的插件",
"coexistCount": "搭配次数"
}

View File

@ -1,23 +0,0 @@
{
"h5Wechat": "H5/微信公众号端",
"weappTerminal": "微信小程序端",
"serviceType": "客服类型",
"notEnabled": "不启用",
"selfService": "自建客服",
"workWeixinService": "企业微信客服",
"thirdService": "第三方客服",
"phoneContact": "电话联系",
"weappService": "小程序客服",
"workWeixinLink": "企微客服链接",
"workWeixinLinkPlaceholder": "请输入企微客服链接",
"thirdServiceLink": "第三方客服链接",
"thirdServiceLinkPlaceholder": "请输入第三方客服链接",
"contactsTel": "联系电话",
"phonePlaceholder": "请输入联系电话",
"workWeixinH5Tips": "H5中如何接入企业微信客服请查看",
"inWechatPageAccess": "在微信内网页中接入",
"corpId": "企业ID",
"corpIdPlaceholder": "请输入企业ID",
"workWeixinWeappTips": "小程序中如何接入企业微信客服请查看",
"inWeappAccess": "在小程序中接入"
}

View File

@ -4,7 +4,6 @@
"sms":"短信", "sms":"短信",
"weapp":"微信小程序", "weapp":"微信小程序",
"wechat":"微信公众号", "wechat":"微信公众号",
"message":"站内信",
"noticeSetting":"消息设置", "noticeSetting":"消息设置",
"name": "模板名称", "name": "模板名称",
"title": "场景", "title": "场景",

View File

@ -49,6 +49,5 @@
"siteName": "站点名称", "siteName": "站点名称",
"authTime": "授权时间", "authTime": "授权时间",
"qrcode": "二维码", "qrcode": "二维码",
"delWeappVersionTips": "是否确定要删除该版本?", "delWeappVersionTips": "是否确定要删除该版本?"
"status": "状态"
} }

View File

@ -6,27 +6,6 @@
"tencentStorage": "腾讯云存储", "tencentStorage": "腾讯云存储",
"isUse":"是否启用", "isUse":"是否启用",
"config":"设置", "config":"设置",
"addStorageConfig":"新增配置",
"editStorageConfig":"编辑配置",
"configName":"配置名称",
"configNamePlaceholder":"请输入配置名称",
"storageTypePlaceholder":"请选择存储方式",
"configParamPlaceholder":"请输入",
"storageConfigDeleteTips":"确定要删除该存储配置吗?",
"disable":"禁用",
"localStorageTips":"文件保存在服务器本地磁盘,无需配置,适合访问量较小的场景。",
"localStorageTipsForSite":"未单独配置时,将使用平台(总后台)启用的存储配置。",
"notConfigured":"未配置",
"storageConfigNotCompleteTips":"请先完善配置后再启用",
"storageConfigMissingTips":"缺少配置项:",
"storageTypeDesc":"配置 {name} 驱动",
"qiniuStorageDesc":"文件存储在七牛云,需配置存储空间、密钥和空间域名。",
"aliStorageDesc":"文件存储在阿里云 OSS,需配置存储空间、密钥、Endpoint 和空间域名。",
"tencentStorageDesc":"文件存储在腾讯云 COS,需配置存储空间、地域、密钥和空间域名。",
"huaweiStorageDesc":"文件存储在华为云 OBS,需配置存储空间、密钥、Endpoint 和空间域名。",
"inUse":"使用中",
"configured":"已配置",
"disableStorageConfigTips":"禁用后站点将使用本地(默认)存储,确定要禁用吗?",
"aliBucket": "存储空间", "aliBucket": "存储空间",
"aliAccessKey": "AccessKeyID", "aliAccessKey": "AccessKeyID",
"aliSecretKey": "AccessKeySecret", "aliSecretKey": "AccessKeySecret",

View File

@ -36,15 +36,5 @@
"siteDomainPlaceholder": "请输入站点域名", "siteDomainPlaceholder": "请输入站点域名",
"siteDomainTips": "站点域名的配置是针对站点的wap和web端", "siteDomainTips": "站点域名的配置是针对站点的wap和web端",
"siteDomainTipsTwo": "需要将域名配置到您的服务器,同时域名需要解析您的服务器才可生效", "siteDomainTipsTwo": "需要将域名配置到您的服务器,同时域名需要解析您的服务器才可生效",
"siteDomainTipsThree": "站点域名不需要加http或者https,末尾不需要加/", "siteDomainTipsThree": "站点域名不需要加http或者https,末尾不需要加/"
"siteList": "站点列表",
"appEnabledCount": "{count} 个已启用",
"enterSite": "进入站点",
"addTime": "添加时间",
"permanent": "永久",
"expireSoon": "{days} 天后到期,请及时续费",
"itemCount": "{count} 个",
"emptyApp": "暂无应用",
"emptyAddon": "暂无插件",
"noPermission": "您没有该站点的管理权限"
} }

View File

@ -34,7 +34,6 @@
"siteInlet": "站点入口", "siteInlet": "站点入口",
"enterSite": "访问站点", "enterSite": "访问站点",
"siteList": "站点列表", "siteList": "站点列表",
"siteGroup": "站点套餐",
"openClose": "开启/停止", "openClose": "开启/停止",
"closeTxt":"停止", "closeTxt":"停止",
"openTxt":"开启", "openTxt":"开启",

View File

@ -12,7 +12,6 @@
"restoreTips": "此操作将恢复备份的源码和数据库,并且覆盖当前数据。为避免意外损失,请确认已了解此操作的影响,并确保已备份重要信息,是否确定继续?", "restoreTips": "此操作将恢复备份的源码和数据库,并且覆盖当前数据。为避免意外损失,请确认已了解此操作的影响,并确保已备份重要信息,是否确定继续?",
"deleteTips": "删除记录将会同步删除其备份文件,确定要操作吗?", "deleteTips": "删除记录将会同步删除其备份文件,确定要操作吗?",
"batchEmptySelectedTips": "请选择需要批量删除的记录", "batchEmptySelectedTips": "请选择需要批量删除的记录",
"detail": "详情",
"restoreTitle": "恢复备份", "restoreTitle": "恢复备份",
"backupCompleteTips": "备份成功", "backupCompleteTips": "备份成功",
"restoreCompleteTips": "恢复成功", "restoreCompleteTips": "恢复成功",

View File

@ -1,10 +1,8 @@
{ {
"title": "名称", "title": "名称",
"pageTitle": "环境检测",
"serverInformation": "服务器信息", "serverInformation": "服务器信息",
"systemDemand": "系统环境要求", "systemDemand": "系统环境要求",
"authorityStatus": "权限状态", "authorityStatus": "权限状态",
"detectionItems": "环境检测项",
"name": "选项", "name": "选项",
"demand": "要求", "demand": "要求",
"status": "状态", "status": "状态",
@ -14,82 +12,5 @@
"phpTypeValue": "大于等于8.0.0", "phpTypeValue": "大于等于8.0.0",
"mysqlType": "mysql版本", "mysqlType": "mysql版本",
"mysqlTypeValue": "大于等于5.7", "mysqlTypeValue": "大于等于5.7",
"process": "启动进程", "process": "启动进程"
"refresh": "刷新",
"health": "环境健康:",
"healthScore": "健康评分",
"excellent": "优秀",
"stable": "稳定",
"attention": "关注",
"alarm": "告警",
"normal": "正常",
"abnormal": "异常",
"checking": "检测中",
"enabled": "已启用",
"disabled": "未启用",
"serverTime": "服务器时间",
"cpuCores": "CPU 核心",
"memoryUsage": "内存占用",
"diskUsage": "磁盘占用",
"keyService": "关键服务",
"keyServiceDesc": "MySQL、Redis、队列进程与数据库容量概览",
"resourceUsage": "资源使用",
"serviceDetail": "服务详细指标",
"memory": "内存",
"disk": "磁盘",
"cpuLoad": "CPU / 负载",
"loadAvg": "负载",
"total": "总量",
"used": "已用",
"available": "可用",
"remaining": "剩余",
"mySql": "MySQL",
"redis": "Redis",
"queueProcess": "队列进程",
"dbCapacity": "数据库容量",
"mysqlDetail": "MySQL 详细统计",
"redisDetail": "Redis 详细统计",
"dbStorage": "数据库存储",
"tableTop": "数据表占用 Top",
"processInfo": "进程信息",
"connectUsage": "连接占用",
"connectCount": "连接数",
"connectStatus": "连接状态",
"connectError": "连接异常",
"slowQuery": "慢查询",
"bufferHit": "Buffer 命中",
"runTime": "运行时间",
"uptime": "运行时长",
"clients": "客户端",
"keys": "键数量",
"usedMemory": "已用内存",
"tableCount": "数据表",
"totalUsed": "总占用",
"dataSize": "数据",
"indexSize": "索引",
"avgTableSize": "平均表大小",
"maxTable": "最大表",
"noTableData": "暂无表数据",
"rows": "行",
"peakMemory": "峰值内存",
"requestPath": "请求路径",
"runtime": "运行环境",
"serverEnv": "服务器环境",
"phpConfig": "PHP 配置",
"extensionCheck": "扩展检测",
"extensionTip": "红色为项目必需但未开启的扩展,灰色为可选扩展",
"requiredExtension": "必需",
"optionalExtension": "可选",
"database": "数据库",
"os": "操作系统",
"phpVersion": "PHP 版本",
"runMode": "运行模式",
"timezone": "时区",
"driver": "驱动",
"distribution": "发行",
"inflow": "流入",
"outflow": "流出",
"day": "天",
"hour": "小时",
"minute": "分"
} }

View File

@ -1,28 +0,0 @@
{
"frameworkPatch": "补丁管理",
"syncPatch": "同步补丁",
"syncPatchTip": "同步完成",
"syncPatchNone": "同步完成,暂无新补丁",
"syncPatchFail": "同步补丁失败",
"patchTitlePlaceholder": "请输入补丁标题",
"resolveStatusPlaceholder": "请选择处理状态",
"patchNo": "补丁号",
"patchTitle": "补丁标题",
"patchDetail": "详情",
"patchDesc": "补丁说明",
"noPatchDesc": "暂无补丁说明",
"appName": "所属应用",
"frameworkVersion": "适用版本",
"releaseTime": "发布时间",
"syncTime": "同步时间",
"resolveStatus": "处理状态",
"resolvedTime": "标记时间",
"unresolved": "未解决",
"resolved": "已解决",
"markResolved": "已解决",
"markResolvedTips": "标记后表示您已处理该补丁,仅作记录且不可取消,是否确定?",
"resolveFail": "标记失败",
"all": "全部",
"download": "下载",
"downloadPatch": "下载附件"
}

View File

@ -1,48 +0,0 @@
{
"title": "代码完整性检测",
"currentVersion": "当前版本",
"targetLabel": "检测目标",
"targetPlaceholder": "请选择检测目标",
"targetRequired": "请先选择检测目标",
"pathLabel": "自定义目录(可选)",
"pathPlaceholder": "如 addon/shop,填写后将忽略上方目标",
"algorithmLabel": "校验算法",
"ruleLabel": "忽略项",
"ignoreBom": "忽略隐藏字节标记",
"ignoreEol": "忽略行尾差异",
"ruleChangedTip": "已切换规则或算法,将使用另一份清单文件,需要重新下载",
"startCheck": "开始检测",
"checking": "检测中…",
"rescan": "重新检测",
"baselineFile": "清单文件",
"scanned": "已扫描文件",
"elapsed": "耗时",
"baselineSourceCache": "复用本地缓存",
"baselineSourceCloud": "本次从云端下载",
"statusReady": "清单就绪",
"statusMissing": "清单未下载",
"statusVersionMismatch": "版本不匹配",
"statusConfigMismatch": "规则/算法未下载",
"statusRulesMismatch": "排除规则已更新",
"statusCorrupted": "清单文件损坏",
"statusVersionUnknown": "版本读取失败",
"rulesVersionLabel": "排除规则版本",
"summaryNew": "新增文件",
"summaryModified": "修改文件",
"summaryDeleted": "删除文件",
"allMatched": "与完整版本完全一致",
"allMatchedTip": "在当前的忽略规则下,所有文件的校验值均与官方一致。",
"detailTitle": "差异明细",
"filterAll": "全部类型",
"typeNew": "新增",
"typeModified": "修改",
"typeDeleted": "删除",
"filePath": "文件路径",
"changeType": "变更类型",
"fileSize": "大小",
"fileHash": "哈希",
"keywordPlaceholder": "按文件路径搜索",
"emptyData": "没有符合条件的数据",
"checkFailed": "检测失败,请稍后重试",
"configLoadFailed": "初始化失败,请刷新页面重试"
}

View File

@ -28,7 +28,6 @@
"cronDeleteTips": "你确定要删除任务吗", "cronDeleteTips": "你确定要删除任务吗",
"addCron": "添加任务", "addCron": "添加任务",
"cronTimeTips": "任务周期时间不能为空并且大于0", "cronTimeTips": "任务周期时间不能为空并且大于0",
"cronTimePreview": "实际执行周期:",
"cronTipsOne": "启动计划任务方式:", "cronTipsOne": "启动计划任务方式:",
"cronTipsTwo": "1、使用命令启动:php think workerman 如果更改了任务周期、状态、删除任务等操作后,需要重新启动下 php think workerman 确保生效", "cronTipsTwo": "1、使用命令启动:php think workerman 如果更改了任务周期、状态、删除任务等操作后,需要重新启动下 php think workerman 确保生效",
"doOne": "执行一次", "doOne": "执行一次",

View File

@ -7,9 +7,6 @@
"completeTime": "升级时间", "completeTime": "升级时间",
"status": "状态", "status": "状态",
"failReason": "失败原因", "failReason": "失败原因",
"detail": "详情",
"batchDelete": "批量删除", "batchDelete": "批量删除",
"deleteTips": "确定要删除吗?", "deleteTips": "确定要删除吗?"
"collapse": "收起",
"expandAll": "展开全部"
} }

View File

@ -14,6 +14,5 @@
"templateID": "模板ID", "templateID": "模板ID",
"siteWeappSync": "站点小程序同步", "siteWeappSync": "站点小程序同步",
"syncSiteWeappTips": "是否要给该套餐下已授权小程序的站点提交代码?", "syncSiteWeappTips": "是否要给该套餐下已授权小程序的站点提交代码?",
"helpInfo": "查看帮助", "helpInfo": "查看帮助"
"status": "状态"
} }

View File

@ -1,152 +0,0 @@
<template>
<div class="addon-panel-host" :class="{ 'cover-mode': coverMode }">
<!-- 动态加载目标插件的面板视图(core 实例加载,清单状态与主程序一致) -->
<component
v-if="panelComp"
:is="panelComp"
:key="addon + '_' + view + '_' + memberId"
:member-id="memberId"
:member-name="memberName"
:mobile="mobile"
/>
<el-empty v-else-if="loadError" :description="'面板加载失败:' + loadError" :image-size="80" />
</div>
</template>
<script setup lang="ts">
import { ref, computed, watch, onMounted, onUnmounted, defineAsyncComponent } from 'vue'
import { useRoute } from 'vue-router'
// ★ 必须用 @/lang 的命名导出取 i18n 实例:部署构建会把 @/lang 与 @/lang/i18n
// 都 external 成同一个 /admin/assets/shared/admin-lang.js(scripts/shared-external.cjs
// 的 isAdminLangExternal + vite.config.core.ts 的 external/paths),是那个模块的 default
// 即 src/lang/index.ts 的 `{ install }` 插件对象、不是 i18n 实例;用默认导入时
// i18n.global 为 undefined,dev 正常、线上走到下面的 mergeLocaleMessage 就抛
// TypeError: Cannot read properties of undefined。(同坑见 components/file-diff/index.vue)
import { i18n } from '@/lang'
import useSystemStore from '@/stores/modules/system'
import { loadAddonView } from '@/utils/addon-loader'
/**
* 插件面板宿主页(全屏无布局,供 iframe 嵌入)
*
* 统一面板协议:任何系统的面板 = 一个 URL。
* 本系统插件:/addon_panel?addon=shop&view=customer_panel/order&member_id=1&member_name=xx&mobile=1xx
* 外部系统:直接提供完整页面地址(聊天台 PanelContainer 原样 iframe)
* 面板内推送商品卡片等结构化消息:window.parent.postMessage({ type:'shop_customer_send_message', msg_type:'goods', content:{...} }, '*')
* 由聊天台 PanelContainer 监听转发,无需接触 WS 连接。
*/
const route = useRoute()
const systemStore = useSystemStore()
// ⚠️ 不能用 useI18n():项目 i18n 为 legacy 模式创建,useI18n 会抛 "Not available in legacy mode" 导致整页空白
// 语言取值与框架守卫(router/index.ts loadLocaleMessages)一致,用 systemStore.lang
const locale = computed(() => systemStore.lang || 'zh-cn')
const addon = computed(() => String(route.query.addon || ''))
const view = computed(() => String(route.query.view || ''))
const memberId = computed(() => Number(route.query.member_id || 0))
const memberName = computed(() => String(route.query.member_name || ''))
const mobile = computed(() => String(route.query.mobile || ''))
const loadError = computed(() => (!addon.value || !view.value) ? '缺少 addon / view 参数' : '')
/**
* 面板复用的组件里都是短 key(t('deliveryType') 等),路由级 loadLocaleMessages 只带 page 前缀 key 不命中。
* 编译期 glob 所有插件语言 json,运行时把该插件当前语言的所有 key merge 到 i18n 根层级(不加前缀),
* Set 去重避免重复 merge。
*/
const allAddonLangFiles = import.meta.glob('@/addon/**/lang/**/*.json', { eager: true }) as Record<string, { default: Record<string, string> }>
const loadedAddonLangs = new Set<string>()
function loadAddonAllLang(addonKey: string, localeKey: string) {
const cacheKey = `${addonKey}:${localeKey}`
if (loadedAddonLangs.has(cacheKey)) return
loadedAddonLangs.add(cacheKey)
const prefix = `/addon/${addonKey}/lang/${localeKey}/`
const merged: Record<string, string> = {}
for (const [path, mod] of Object.entries(allAddonLangFiles)) {
if (path.includes(prefix) && mod?.default) {
Object.assign(merged, mod.default)
}
}
if (Object.keys(merged).length) {
i18n.global.mergeLocaleMessage(localeKey, merged)
}
}
// 目标面板异步组件(addon/view 变化时重新创建)
const panelComp = computed(() => {
if (!addon.value || !view.value) return null
return defineAsyncComponent(loadAddonView(addon.value, view.value))
})
watch([addon, view], () => {
if (addon.value) loadAddonAllLang(addon.value, locale.value)
}, { immediate: true })
// ============ 弹窗全窗口化(cover 模式) ============
// 面板视口窄(约 320px),弹窗挤在面板里体验差。原理:
// 1. 本页 MutationObserver 监听 body 下 .el-overlay(el-dialog / el-message-box 遮罩)出现/消失
// 2. 状态变化时 postMessage 通知父页面 PanelContainer,把 iframe 临时扩为全屏(弹窗即居中于聊天台)
// 3. 本地同步加 cover-mode class,面板内容保持右侧 320px 原位,避免列表被拉宽
// 面板业务代码(order.vue / goods.vue 等)零改动,任何插件的任何弹窗自动生效
const coverMode = ref(false)
let overlayVisible = false
const syncOverlayState = () => {
const overlays = document.querySelectorAll<HTMLElement>('.el-overlay')
const visible = Array.from(overlays).some(el => el.style.display !== 'none')
if (visible === overlayVisible) return
overlayVisible = visible
coverMode.value = visible
if (window.parent !== window) {
window.parent.postMessage({ type: 'shop_customer_panel_cover', open: visible }, '*')
}
}
const overlayObserver = new MutationObserver(syncOverlayState)
onMounted(() => {
overlayObserver.observe(document.body, { childList: true, subtree: true, attributeFilter: ['style'] })
})
onUnmounted(() => overlayObserver.disconnect())
</script>
<style lang="scss" scoped>
.addon-panel-host {
height: 100%;
min-height: 0;
overflow: hidden;
background: var(--el-bg-color, #fff);
box-sizing: border-box;
display: flex;
flex-direction: column;
}
.addon-panel-host > :deep(*) {
flex: 1;
min-height: 0;
height: 100%;
}
/* cover 模式:iframe 已被父页面扩为全屏,面板内容保持右侧 320px 原位,
避免列表被拉宽变形;弹窗遮罩(.el-overlay fixed 全屏)盖住聊天台,弹窗居中 */
.addon-panel-host.cover-mode {
width: 320px;
margin-left: auto;
padding: 0;
height: 100%;
overflow: hidden;
border-left: 1px solid var(--el-border-color-lighter, #ebeef5);
}
</style>
<style lang="scss">
/* iframe 内禁止整页滚动,只让面板内部列表滚动,避免双边滚动条宽度来回闪 */
html, body, #app {
height: 100%;
margin: 0;
overflow: hidden;
}
/* iframe 面板弹窗自适应:面板视口窄(约 320px),面板复用后台的固定宽度弹窗(如备注 460px)会溢出错位。
max-width 约束后弹窗自动收缩并居中于面板内;样式仅在宿主页(iframe)生效,不影响各插件后台原页面。
注意 el-dialog teleport 到 body,必须用非 scoped 全局样式才能命中 */
.el-dialog {
max-width: calc(100vw - 24px);
}
</style>

View File

@ -1,23 +1,76 @@
<template> <template>
<!--授权信息(页面主体为内嵌官网页面:未登录为登录+选择授权,已登录为官网账号与我的授权模块)--> <!--授权信息-->
<div class="main-container"> <div class="main-container">
<!-- 首屏加载 --> <el-card class="box-card !border-none min-h-[300px]" shadow="never" v-loading="loading">
<el-card v-if="!ready" class="box-card !border-none" shadow="never" v-loading="true" <div v-if="!loading">
:style="{ height: contentHeight + 'px' }"></el-card> <div class="title text-[16px] font-bold text-[#1D1F3A] mb-[30px]">授权信息</div>
<div>
<el-card v-else class="box-card !border-none" shadow="never"> <div class="flex items-center">
<div class="relative overflow-hidden border border-[#EBEEF7]" <div class="w-[92px] h-[92px] rounded-[10px] flex justify-center items-center mr-[20px]">
:style="{ minHeight: contentHeight + 'px' }"> <img src="@/app/assets/images/tools/authorize.png" class="w-[92px] h-[92px]" />
<iframe v-if="embedUrl" ref="embedFrame" :src="embedUrl" class="w-full block" </div>
:style="{ height: iframeRenderHeight + 'px', border: '0' }" referrerpolicy="no-referrer" <div class="flex flex-col justify-between font-500">
@load="onIframeLoad"></iframe> <div class="flex flex-wrap items-center mb-[12px]">
<span class="mr-[6px] text-[14px] text-[#666666] w-[70px] text-left">授权公司:</span>
<div v-if="!embedReady" <span class="text-[14px] text-[#333]">{{ authinfo.company_name || "--" }}</span>
class="absolute inset-0 flex flex-col items-center justify-center bg-[#F5F7FB] text-[#9699B6] text-[13px]"> </div>
<el-icon class="is-loading text-[22px] mb-[10px]"> <div class="flex flex-wrap items-center mb-[12px]">
<Loading /> <span class="mr-[6px] text-[14px] text-[#666666] w-[70px] text-left">授权域名:</span>
<span class="text-[14px] text-[#333]">{{ authinfo.site_address || "--" }}</span>
</div>
<div class="flex flex-wrap items-center">
<span class="mr-[6px] text-[14px] text-[#666666] w-[70px] text-left">授权码:</span>
<span class="text-[14px] text-[#333]">
<span class="mr-[10px]">{{ authinfo.auth_code ? (isCheck ? authinfo.auth_code : hideAuthCode(authinfo.auth_code)) : "--" }}</span>
<el-icon v-if="!isCheck" @click="isCheck = !isCheck" class="text-[14px] cursor-pointer text-[#9699B6]">
<View />
</el-icon> </el-icon>
{{ t('loadingEmbed') }} <el-icon v-else @click="isCheck = !isCheck" class="text-[14px] cursor-pointer text-[#9699B6]"> <Hide /> </el-icon>
</span>
</div>
</div>
</div>
<div class="mt-[17px] ml-[110px]">
<el-button class="!w-[140px] !h-[32px] mt-[8px] !rounded-[4px]" type="primary" @click="authCodeApproveFn">授权码认证</el-button>
<el-popover ref="getAuthCodeDialog" placement="bottom-start" :width="478" trigger="click" class="mt-[8px]">
<div class="px-[18px] py-[8px]">
<p class="leading-[32px] text-[14px]">您在官方应用市场购买任意一款应用,即可获得授权码。输入正确授权码认证通过后,即可支持在线升级和其它相关服务</p>
<div class="flex justify-end mt-[36px]">
<el-button class="w-[182px] !h-[48px]" plain @click="market">去应用市场逛逛</el-button>
<el-button class="w-[100px] !h-[48px]" plain @click="getAuthCodeDialog.hide()">关闭</el-button>
</div>
</div>
<template #reference>
<el-button class="!w-[140px] !h-[32px] mt-[8px] !rounded-[4px] !text-[var(--el-color-primary)] hover:!text-[var(--el-color-primary)] !bg-transparent" plain type="primary">如何获取授权码?</el-button>
</template>
</el-popover>
</div>
<el-dialog v-model="authCodeApproveDialog" title="授权码认证" width="400px">
<el-form :model="formData" label-width="0" ref="formRef" :rules="formRules" class="page-form">
<el-card class="box-card !border-none" shadow="never">
<el-form-item prop="auth_code">
<el-input v-model.trim="formData.auth_code" :placeholder="t('authCodePlaceholder')" class="input-width" clearable size="large" />
</el-form-item>
<div class="mt-[20px]">
<el-form-item prop="auth_secret">
<el-input v-model.trim="formData.auth_secret" clearable :placeholder="t('authSecretPlaceholder')" class="input-width" size="large" />
</el-form-item>
</div>
<div class="text-sm mt-[10px] text-info">{{ t("authInfoTips") }}</div>
<div class="mt-[20px]">
<el-button type="primary" class="w-full" size="large" :loading="saveLoading" @click="save(formRef)">{{ t("confirm") }}</el-button>
</div>
<div class="mt-[10px] text-right">
<el-button type="primary" link @click="market">{{ t("notHaveAuth") }}</el-button>
</div>
</el-card>
</el-form>
</el-dialog>
</div> </div>
</div> </div>
</el-card> </el-card>
@ -25,364 +78,100 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed, onMounted, onUnmounted } from "vue" import { reactive, ref } from "vue"
import { t } from "@/lang" import { t } from "@/lang"
import { getEmbedUrl, getAccountInfo, selectAuthorization, cancelAuthorization, saveAccountToken, logoutAccount } from "@/app/api/account" import { getVersions } from "@/app/api/auth"
import { ElMessage, ElMessageBox } from "element-plus" import { getAuthInfo, setAuthInfo } from "@/app/api/module"
import { Loading } from "@element-plus/icons-vue" import { FormInstance, FormRules } from "element-plus"
import { cloneDeep } from "lodash-es"
const ready = ref(false) const getAuthCodeDialog: Record<string, any> | null = ref(null)
const authCodeApproveDialog = ref(false)
const isCheck = ref(false)
/** 是否已选用/绑定授权 */ const hideAuthCode = (res: any) => {
const bound = ref(false) const authCode = cloneDeep(res)
const data = authCode.slice(0, authCode.length / 2) + authCode.slice(authCode.length / 2, authCode.length - 1).replace(/./g, "*")
/** 当前已选用/绑定的授权码(传给官网账号页,用于标记「当前使用中」) */ return data
const currentAuthCode = ref("")
/** 内嵌官网页面 */
const embedUrl = ref("")
/** iframe 元素(用于向内嵌页主动同步登录态) */
const embedFrame = ref<HTMLIFrameElement | null>(null)
const officialOrigin = ref("")
const embedReady = ref(false)
const iframeHeight = ref(720)
/**
* 是否已保存官网账号登录态(由服务端读取本地配置给出,令牌本身不下发前端)
* 用于决定内嵌登录页还是账号页:已登录直接进账号页,避免先闪一下登录页
*/
const hasToken = ref(false)
/** 内容区可视高度:加载阶段也要占满布局剩余空间 */
const contentHeight = ref(720)
/** iframe 实际渲染高度:不低于内容区高度 */
const iframeRenderHeight = computed(() => Math.max(iframeHeight.value, contentHeight.value))
/** 计算内容区高度(视口高度 - 容器距顶部距离) */
const calcContentHeight = () => {
const el = document.querySelector(".main-container") as HTMLElement | null
const top = el?.getBoundingClientRect().top || 120
contentHeight.value = Math.max(480, Math.round(window.innerHeight - top))
} }
/** const authCodeApproveFn = () => {
* 读取绑定状态(决定内嵌登录页还是账号页) authCodeApproveDialog.value = true
*/
const loadAccount = async () => {
try {
const res: any = await getAccountInfo()
bound.value = !!res?.data?.bound
hasToken.value = !!res?.data?.has_token
currentAuthCode.value = res?.data?.authorization?.auth_code || ""
} catch (e) {
bound.value = false
hasToken.value = false
}
} }
/** interface AuthInfo {
* 生成官网内嵌页地址(由服务端生成) company_name: string
* - 未登录:/embed/login(登录 + 选择授权) site_address: string
* - 已登录:/embed/account(官网账号资料 + 我的授权模块) auth_code: string
* - 官网登录令牌由服务端在地址中注入(前端不经手),此处只附加当前已选用授权
*/
const loadEmbed = async (mode: "login" | "account") => {
const res: any = await getEmbedUrl({ mode, origin: window.location.origin })
let url = res?.data?.url || ""
if (!url) return
// host 必须是父页面(本页)的实际 origin:
// 官网内嵌页 postMessage 时以它为 targetOrigin,与真实父窗口不一致时消息会被浏览器静默丢弃
// (表现为收不到 ready、选中授权后也不回调 select)
// domain 用本页访问域名(页面传值最准):后端给的是「接口域名」,与站点真实域名可能不一致
try {
const embedUrlObj = new URL(url)
embedUrlObj.searchParams.set("host", window.location.origin)
embedUrlObj.searchParams.set("domain", window.location.hostname)
url = embedUrlObj.toString()
} catch (e) {
// 地址异常时保持原样
} }
try { const authinfo = ref<AuthInfo>({
officialOrigin.value = new URL(url).origin company_name: "",
} catch (e) { site_address: "",
officialOrigin.value = "" auth_code: ""
}
// 附加当前已选用授权(登录令牌由服务端注入,避免地址里出现两个 token 参数)
if (currentAuthCode.value) {
url += (url.indexOf("?") > -1 ? "&" : "?") + `current_auth=${ encodeURIComponent(currentAuthCode.value) }`
}
embedReady.value = false
embedUrl.value = url
// 兜底:无论是否收到官网 ready 消息,2 秒后隐藏遮罩
setTimeout(() => { embedReady.value = true }, 2000)
}
const onIframeLoad = () => {
// iframe 加载完成即隐藏遮罩
setTimeout(() => { embedReady.value = true }, 800)
}
/**
* 站点标识:host(含端口)+ 去掉 www 前缀
* 用于忽略「协议 http/https」「裸域 / www」的差异
*/
const siteKeyOf = (value: string) => {
try {
return new URL(value).host.replace(/^www\./i, "").toLowerCase()
} catch (e) {
return ""
}
}
/**
* 消息来源校验
* 先严格相等;不相等时再比对站点标识,
* 因为官网可能出现 http -> https、裸域 -> www 跳转,跳转后的文档 origin 与后端下发的地址并不一致
*/
const isTrustedOrigin = (origin: string) => {
if (!origin) return false
if (officialOrigin.value && origin === officialOrigin.value) return true
const expected = siteKeyOf(officialOrigin.value)
return !!expected && siteKeyOf(origin) === expected
}
/**
* 接收官网内嵌页消息
*/
const onMessage = async (e: MessageEvent) => {
if (!isTrustedOrigin(e.origin)) return
const data = e.data || {}
if (data.source !== "niucloud-embed") return
switch (data.type) {
case "niucloud:ready":
embedReady.value = true
// 内嵌页已有登录态但本地没保存:主动索要并保存(消息丢失时自愈)
syncTokenFromEmbed(data.payload)
break
case "niucloud:resize":
if (data.payload?.height) {
iframeHeight.value = Math.max(600, Math.min(1400, Number(data.payload.height)))
}
break
case "niucloud:token":
// 官网登录页回传登录态:保存到本地,重进页面即可免登录
await saveEmbedToken(data.payload)
break
case "niucloud:selected":
await selectFromEmbed(data.payload)
break
case "niucloud:cancel_selected":
await cancelFromEmbed(data.payload)
break
case "niucloud:logout":
await onEmbedLogout()
break
}
}
/**
* 内嵌页已有登录态而本地未保存时,向它索要令牌并保存
* 场景:登录时的 postMessage 丢失、或当时后端未就绪,导致无法免登录
*/
const syncTokenFromEmbed = (payload: any) => {
if (!payload?.hasToken || hasToken.value) return
const frame = embedFrame.value
if (!frame?.contentWindow || !officialOrigin.value) return
frame.contentWindow.postMessage(
{ source: "niucloud-parent", type: "niucloud:need_token", payload: {} },
officialOrigin.value
)
}
/**
* 保存官网登录态(内嵌页登录后回传)
* 令牌只落到服务端配置,前端不再持有,避免每次进入都要重新登录
*/
const saveEmbedToken = async (payload: any) => {
// 优先保存长期刷新令牌(access token 过期后由服务端续期);官网旧版本只回传 token 时也能兼容
if (!payload?.token && !payload?.refresh_token) return
try {
await saveAccountToken({
token: payload.token || "",
expires_time: Number(payload.expires_time || 0),
refresh_token: payload.refresh_token || "",
refresh_expires_time: Number(payload.refresh_expires_time || 0)
}) })
hasToken.value = true const loading = ref(true)
} catch (e) { const saveLoading = ref(false)
// 保存失败不影响本次会话,仅影响下次免登录 const checkAppMange = () => {
console.error("[embed] 保存官网登录态失败(下次进入需重新登录):", e) getAuthInfo().then((res) => {
loading.value = false
if (res.data.data && res.data.data.length != 0) {
authinfo.value = res.data.data
authCodeApproveDialog.value = false
} }
} }).catch(() => {
loading.value = false
/** authCodeApproveDialog.value = false
* 授权码脱敏:保留前后各若干位,中间用 * 代替
* 星号数量与实际被隐藏的字符数一一对应(与官网内嵌页 maskedCode 规则保持一致)
*/
const maskAuthCode = (code: string) => {
const value = String(code || "")
if (!value) return ""
const len = value.length
if (len > 10) return `${ value.slice(0, 6) }${ "*".repeat(len - 10) }${ value.slice(-4) }`
if (len > 4) return `${ value.slice(0, 2) }${ "*".repeat(len - 4) }${ value.slice(-2) }`
return "*".repeat(len)
}
/**
* 覆盖确认:系统已有授权、且与新选的授权不是同一条时,先让用户确认
* @returns 是否允许继续(true = 可写入生效配置)
*/
const confirmReplaceAuth = async (nextAuthCode: string) => {
if (!bound.value || !currentAuthCode.value) return true
if (String(currentAuthCode.value) === String(nextAuthCode)) return true
try {
await ElMessageBox.confirm(
`${ t("currentAuthCode") }${ maskAuthCode(currentAuthCode.value) };${ t("replaceAuthTip") }`,
t("replaceAuthTitle"),
{
type: "warning",
confirmButtonText: t("confirm"),
cancelButtonText: t("cancel")
}
)
return true
} catch (e) {
// 用户取消:不写入、不切页
return false
}
}
/**
* 官网内嵌页回传所选授权 -> 写入系统授权配置(NIUCLOUD_CONFIG)并生效
*/
const selectFromEmbed = async (payload: any) => {
if (!payload?.auth_code || !payload?.auth_secret) return
// 系统已有授权且与新选的不是同一条:覆盖前二次确认
if (!(await confirmReplaceAuth(payload.auth_code))) return
try {
await selectAuthorization({
auth_code: payload.auth_code,
auth_secret: payload.auth_secret,
site_address: payload.site_address || "",
company_name: payload.company_name || "",
product_key_name: payload.product_key_name || ""
}) })
bound.value = true
currentAuthCode.value = payload.auth_code || ""
ElMessage.success(t("selectSuccess"))
// 选用后切换为官网账号页
await loadEmbed("account")
} catch (e) {
// 错误提示由请求层统一处理
}
} }
/** checkAppMange()
* 向官网内嵌页发消息(targetOrigin 用官网 origin)
*/
const postToEmbed = (type: string, payload: any) => {
const frame = embedFrame.value
if (!frame?.contentWindow || !officialOrigin.value) return
frame.contentWindow.postMessage( const formData = reactive<Record<string, string>>({
{ source: "niucloud-parent", type, payload }, auth_code: "",
officialOrigin.value auth_secret: ""
)
}
/**
* 官网内嵌页请求取消选用 -> 清空系统已选授权(NIUCLOUD_CONFIG)
*
* 说明:
* - 不重载 iframe:内嵌页已做乐观更新,这里只回执结果,避免整页重新请求造成闪烁与多余请求
* - 失败时回执 success:false,内嵌页据此回滚到取消前的选中状态(错误提示由请求层统一给出)
*/
const cancelFromEmbed = async (payload: any) => {
try {
await cancelAuthorization({
auth_code: payload?.auth_code || "",
site_address: payload?.site_address || "",
company_name: payload?.company_name || "",
product_key_name: payload?.product_key_name || ""
}) })
bound.value = false const formRef = ref<FormInstance>()
currentAuthCode.value = ""
ElMessage.success(t("cancelAuthSuccess"))
postToEmbed("niucloud:cancel_result", { success: true })
} catch (e) {
console.error("[embed] 取消选用授权失败:", e)
postToEmbed("niucloud:cancel_result", { success: false })
}
}
/** // 表单验证规则
* 官网内嵌页主动退出:清除本地账号信息(已绑定的授权保留),并切回登录页 const formRules = reactive<FormRules>({
*/ auth_code: [{ required: true, message: t("authCodePlaceholder"), trigger: "blur" }],
const onEmbedLogout = async () => { auth_secret: [{ required: true, message: t("authSecretPlaceholder"), trigger: "blur" }]
try {
await logoutAccount()
} catch (e) {
// 忽略:本地请求异常不影响退出体验
}
hasToken.value = false
bound.value = false
currentAuthCode.value = ""
await loadEmbed("login")
}
onMounted(async () => {
window.addEventListener("message", onMessage)
window.addEventListener("resize", calcContentHeight)
calcContentHeight()
await loadAccount()
ready.value = true
// 已保存官网登录态 / 已选用授权 -> 直接进账号页,避免先闪一下登录页
await loadEmbed(hasToken.value || bound.value ? "account" : "login")
}) })
onUnmounted(() => { const save = async(formEl: FormInstance | undefined) => {
window.removeEventListener("message", onMessage) if (saveLoading.value || !formEl) return
window.removeEventListener("resize", calcContentHeight)
await formEl.validate(async(valid) => {
if (valid) {
saveLoading.value = true
setAuthInfo(formData).then(() => {
saveLoading.value = false
checkAppMange()
}).catch(() => {
saveLoading.value = false
authCodeApproveDialog.value = false
}) })
}
})
}
const market = () => {
window.open("https://www.niucloud.com/app")
}
const versions = ref("")
const getVersionsInfo = () => {
getVersions().then((res) => {
versions.value = res.data.version.version
})
}
getVersionsInfo()
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
:deep(.el-button){ :deep(.el-button){
border-radius: 4px !important; border-radius: 4px !important;
} }
/* 内嵌页铺满卡片,去掉 el-card 默认内边距 */
:deep(.el-card__body) {
padding: 0;
}
/* 本页特殊:卡片与内嵌容器不要圆角 */
:deep(.el-card) {
border-radius: 0;
}
/**
* 本页特殊:去掉布局内容区的留白(--cmp-layout-content-padding,默认 15px),
* 让 iframe 区域铺满内容区;页面留白改由官网内嵌页自己控制
*/
.main-container {
margin: calc(0px - var(--cmp-layout-content-padding, 15px));
}
</style> </style>

View File

@ -6,26 +6,31 @@
<template v-if="Object.keys(appList).length"> <template v-if="Object.keys(appList).length">
<template v-for="(item, index) in appList" :key="index + 'b'"> <template v-for="(item, index) in appList" :key="index + 'b'">
<div class="app-group" v-if="item.list.length"> <div class="flex justify-between items-center" v-if="item.list.length">
<div class="app-group-title">{{ item.title }}</div> <span class="text-page-title">{{ item.title }}</span>
</div>
<div class="app-grid"> <div class="flex flex-wrap plug-list pb-10 plug-large" v-if="item.list.length">
<div class="app-card" v-for="(childItem, childIndex) in item.list" :key="childIndex" @click="toLink(childItem)"> <div class="cursor-pointer mt-[20px] mr-4 bg-[#f7f7f7]" v-for="(childItem,childIndex) in item.list" :key="childIndex" @click="toLink(childItem)">
<div class="app-card-head"> <div class="w-[264px] flex py-[20px] px-[17px] app-item relative">
<div class="app-card-avatar"> <el-image class="w-[40px] h-[40px] mr-[10px]" :src="img(childItem.icon)" fit="contain">
<el-image class="w-full h-full" :src="img(childItem.icon)" fit="contain">
<template #error> <template #error>
<img class="w-full h-full" src="@/app/assets/images/index/app_default.png" /> <div class="image-slot">
<img class="w-[40px] h-[40px]" src="@/app/assets/images/index/app_default.png" />
</div>
</template> </template>
</el-image> </el-image>
<div class="flex flex-col justify-between w-[180px]">
<div class="text-[14px] flex items-center">
<span class="app-text max-w-[170px]">{{ childItem.title }}</span>
<!-- <span class="iconfont iconxiaochengxu2 text-[#00b240] ml-[4px] !text-[14px]"></span>-->
</div> </div>
<div class="app-card-info"> <!-- <el-icon color="#666">
<div class="app-card-name">{{ childItem.title }}</div> <QuestionFilled />
</el-icon> -->
<p class="app-text text-[12px] text-[#999]">{{childItem.desc}}</p>
</div> </div>
</div> </div>
<p class="app-card-desc">{{ childItem.desc }}</p>
</div>
</div> </div>
</div> </div>
</template> </template>
@ -80,105 +85,16 @@ const toLink = (item: any) => {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
/* 分组:与首页站点模块保持一致的节奏 */ .app-text {
.app-group + .app-group {
margin-top: var(--space-6);
}
.app-group-title {
margin-bottom: var(--space-4);
color: var(--sys-color-text-primary);
font-size: var(--sys-font-size-md);
font-weight: var(--sys-font-weight-semibold);
}
.app-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(264px, 1fr));
gap: var(--cmp-module-card-gap);
padding-bottom: var(--space-4);
}
/* 可点击模块卡片:应用入口,与首页站点卡片共用同一套 Token */
.app-card {
position: relative;
display: flex;
flex-direction: column;
gap: var(--cmp-module-card-gap);
overflow: hidden; overflow: hidden;
padding: var(--cmp-module-card-padding); /* 超出部分隐藏 */
background-color: var(--cmp-module-card-bg);
border: var(--cmp-module-card-border-width) solid var(--cmp-module-card-border-color);
border-radius: var(--cmp-module-card-radius);
color: var(--cmp-module-card-text);
cursor: pointer;
transition: border-color .2s, box-shadow .2s, transform .2s;
&::before {
content: "";
position: absolute;
top: 0;
right: 0;
left: 0;
height: var(--cmp-module-card-accent-height);
background: linear-gradient(90deg, var(--cmp-module-card-accent-start), var(--cmp-module-card-accent-end));
opacity: 0;
transition: opacity .3s;
}
&:hover {
border-color: var(--cmp-module-card-hover-border-color);
box-shadow: var(--cmp-module-card-hover-shadow);
transform: translateY(var(--cmp-module-card-hover-offset));
&::before {
opacity: 1;
}
}
}
.app-card-head {
display: flex;
align-items: center;
gap: var(--space-3);
}
.app-card-avatar {
flex-shrink: 0;
width: 40px;
height: 40px;
overflow: hidden;
border: 1px solid var(--sys-color-border-light);
border-radius: var(--sys-radius-md);
background-color: var(--sys-color-fill-light);
img {
display: block;
width: 100%;
height: 100%;
object-fit: contain;
}
}
.app-card-info {
flex: 1;
min-width: 0;
}
.app-card-name {
overflow: hidden;
color: var(--sys-color-text-primary);
font-size: var(--sys-font-size-md);
font-weight: var(--sys-font-weight-semibold);
text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
} /* 禁止文本换行 */
.app-card-desc {
overflow: hidden;
color: var(--sys-color-text-secondary);
font-size: var(--sys-font-size-xs);
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; /* 显示省略号 */
}
.app-item:hover{
transition: 0.5s;
box-shadow: 0 2px 8px 0 rgba(0,0,0,0.1);
} }
</style> </style>

View File

@ -58,27 +58,84 @@
</div> </div>
</el-card> </el-card>
<el-dialog v-model="authCodeApproveDialog" title="授权码认证" width="400px">
<el-form :model="formData" label-width="0" ref="formRef" :rules="formRules" class="page-form">
<el-card class="box-card !border-none" shadow="never">
<el-form-item prop="auth_code">
<el-input v-model.trim="formData.auth_code" :placeholder="t('authCodePlaceholder')" class="input-width" clearable size="large" />
</el-form-item>
<div class="mt-[20px]">
<el-form-item prop="auth_secret">
<el-input v-model.trim="formData.auth_secret" clearable :placeholder="t('authSecretPlaceholder')" class="input-width" size="large" />
</el-form-item>
</div>
<div class="text-sm mt-[10px] text-info">{{ t("authInfoTips") }}</div>
<div class="mt-[20px]">
<el-button type="primary" class="w-full" size="large" :loading="saveLoading" @click="save(formRef)">{{ t("confirm") }}</el-button>
</div>
<div class="mt-[10px] text-right">
<el-button type="primary" link @click="market">{{ t("notHaveAuth") }}</el-button>
</div>
</el-card>
</el-form>
</el-dialog>
<upgrade ref="upgradeRef" /> <upgrade ref="upgradeRef" />
<upgrade-log ref="upgradeLogRef" /> <upgrade-log ref="upgradeLogRef" />
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed } from "vue" import { ref, computed, reactive } from "vue"
import { t } from "@/lang" import { t } from "@/lang"
import { getVersions } from "@/app/api/auth" import { getVersions } from "@/app/api/auth"
import { getAuthInfo, getFrameworkVersionList } from "@/app/api/module" import { getAuthInfo, getFrameworkVersionList, setAuthInfo } from "@/app/api/module"
import { ElMessage } from "element-plus" import { ElMessage, FormInstance, FormRules } from "element-plus"
import { useRouter } from "vue-router" import { useRouter } from "vue-router"
import Upgrade from "@/app/components/upgrade/index.vue" import Upgrade from "@/app/components/upgrade/index.vue"
import UpgradeLog from "@/app/components/upgrade-log/index.vue" import UpgradeLog from "@/app/components/upgrade-log/index.vue"
const upgradeRef = ref<any>(null) const upgradeRef = ref<any>(null)
const upgradeLogRef = ref<any>(null) const upgradeLogRef = ref<any>(null)
const authCodeApproveDialog = ref(false)
const frameworkVersionList = ref([]) const frameworkVersionList = ref([])
const activeName = ref(0) const activeName = ref(0)
const checkVersion = ref(false) const checkVersion = ref(false)
const formData = reactive<Record<string, string>>({
auth_code: '',
auth_secret: ''
})
const formRef = ref<FormInstance>()
// 表单验证规则
const formRules = reactive<FormRules>({
auth_code: [{ required: true, message: t('authCodePlaceholder'), trigger: 'blur' }],
auth_secret: [{ required: true, message: t('authSecretPlaceholder'), trigger: 'blur' }]
})
const saveLoading = ref(false)
const save = async(formEl: FormInstance | undefined) => {
if (saveLoading.value || !formEl) return
await formEl.validate(async (valid) => {
if (valid) {
saveLoading.value = true
setAuthInfo(formData).then(() => {
saveLoading.value = false
checkAppMange()
}).catch(() => {
saveLoading.value = false
authCodeApproveDialog.value = false
})
}
})
}
const loadingVersion = ref(false) const loadingVersion = ref(false)
const getFrameworkVersionListFn = () => { const getFrameworkVersionListFn = () => {
loadingVersion.value = true loadingVersion.value = true
@ -117,11 +174,8 @@ const newVersion: any = computed(() => {
return frameworkVersionList.value.length ? frameworkVersionList.value[0] : null return frameworkVersionList.value.length ? frameworkVersionList.value[0] : null
}) })
const router = useRouter() const authCodeApproveFn = () => {
authCodeApproveDialog.value = true
// 未绑定授权:跳转到「系统授权」页面
const toAuthorize = () => {
router.push('/admin/tools/authorize')
} }
const version = ref('') const version = ref('')
@ -159,7 +213,7 @@ const loading = ref(false)
*/ */
const handleUpgrade = () => { const handleUpgrade = () => {
if (!authInfo.value.auth_code) { if (!authInfo.value.auth_code) {
toAuthorize() authCodeApproveFn()
return return
} }
if (repeat.value) return if (repeat.value) return
@ -175,12 +229,16 @@ const checkAppMange = () => {
getAuthInfo().then((res) => { getAuthInfo().then((res) => {
if (res.data.data && res.data.data.length != 0) { if (res.data.data && res.data.data.length != 0) {
authInfo.value = res.data.data authInfo.value = res.data.data
authCodeApproveDialog.value = false
} }
}).catch(() => {}) }).catch(() => {
authCodeApproveDialog.value = false
})
} }
checkAppMange() checkAppMange()
const router = useRouter()
const upgradeRecord = () => { const upgradeRecord = () => {
router.push('/admin/tools/upgrade_records') router.push('/admin/tools/upgrade_records')
} }

View File

@ -42,7 +42,7 @@
<el-form-item :label="t('authId')" prop="api_url" v-show="formData.menu_type != 0"> <el-form-item :label="t('authId')" prop="api_url" v-show="formData.menu_type != 0">
<el-input v-model.trim="formData.api_url" :placeholder="t('authIdPlaceholder')" class="input-width"> <el-input v-model.trim="formData.api_url" :placeholder="t('authIdPlaceholder')" class="input-width">
<template #append> <template #append>
<el-select class="border-none" style="width: 130px" v-model="formData.methods"> <el-select class="border-none" style="width: 100px" v-model="formData.methods">
<el-option label="POST" value="post" /> <el-option label="POST" value="post" />
<el-option label="GET" value="get" /> <el-option label="GET" value="get" />
<el-option label="PUT" value="put" /> <el-option label="PUT" value="put" />
@ -72,14 +72,6 @@
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
<el-form-item :label="t('isBlank')" v-show="formData.menu_type == 1">
<el-radio-group v-model="formData.is_blank">
<el-radio :label="1">{{ t('blankYes') }}</el-radio>
<el-radio :label="0">{{ t('blankNo') }}</el-radio>
</el-radio-group>
<div class="w-full text-[12px] leading-[18px] mt-[4px] text-[var(--el-text-color-secondary)]">{{ t('isBlankTip') }}</div>
</el-form-item>
<el-form-item :label="t('menuShortName')"> <el-form-item :label="t('menuShortName')">
<el-input v-model.trim="formData.menu_short_name" :placeholder="t('menuShortNamePlaceholder')" class="input-width" /> <el-input v-model.trim="formData.menu_short_name" :placeholder="t('menuShortNamePlaceholder')" class="input-width" />
</el-form-item> </el-form-item>
@ -125,7 +117,6 @@ const initialFormData = {
sort: '', sort: '',
status: 1, status: 1,
is_show: 1, is_show: 1,
is_blank: 0,
menu_key: '', menu_key: '',
app_type: '', app_type: '',
addon: '', addon: '',
@ -248,8 +239,7 @@ const confirm = async (formEl: FormInstance | undefined) => {
if (valid) { if (valid) {
loading.value = true loading.value = true
// 仅菜单类型(menu_type=1)支持新窗口打开,目录/按钮统一归零 const data = formData
const data = { ...formData, is_blank: formData.menu_type == 1 ? formData.is_blank : 0 }
save(data).then(res => { save(data).then(res => {
loading.value = false loading.value = false

View File

@ -1,218 +0,0 @@
<template>
<el-dialog v-model="showDialog" :title="t('exportMenu')" width="520px" :destroy-on-close="true" @open="onOpen">
<el-form label-width="90px">
<el-form-item :label="t('exportMenuScope')">
<el-checkbox v-model="exportSystem">{{ t('exportMenuSystem') }}</el-checkbox>
</el-form-item>
<el-form-item v-if="addonOptions.length" :label="t('exportMenuApp')">
<div class="addon-panel">
<div class="addon-panel__header">
<el-checkbox
v-model="checkAll"
:indeterminate="isIndeterminate"
@change="handleCheckAllChange"
>{{ t('exportMenuSelectAll') }}</el-checkbox>
<el-button link type="primary" @click="clearAddons">{{ t('exportMenuClear') }}</el-button>
</div>
<el-checkbox-group v-model="exportAddons" class="addon-panel__list" @change="handleCheckedChange">
<el-checkbox v-for="item in addonOptions" :key="item.key" :label="item.key">
{{ item.title }}
</el-checkbox>
</el-checkbox-group>
</div>
</el-form-item>
</el-form>
<div v-if="!exportSystem && !exportAddons.length" class="text-[12px] text-[var(--el-color-danger)]">
{{ t('exportMenuScopeRequired') }}
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button>
<el-button type="primary" :loading="loading" :disabled="!exportSystem && !exportAddons.length"
@click="submitEvent">{{ t('confirm') }}</el-button>
</span>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import { ref, computed } from 'vue'
import { t } from '@/lang'
import { ElMessage } from 'element-plus'
import { getAddonDevelop } from '@/app/api/tools'
import { exportMenu } from '@/app/api/sys'
import { downloadBlob } from '@/utils/download'
const props = defineProps({
appType: {
type: String,
default: 'admin'
},
// 当前页面的菜单树,用于提取可选的应用
menus: {
type: Array,
default: () => []
}
})
const showDialog = ref(false)
const loading = ref(false)
const exportSystem = ref(true)
const exportAddons = ref<string[]>([])
const addonOptions = ref<Array<{ key: string, title: string }>>([])
const checkAll = ref(false)
const isIndeterminate = computed(() => {
const len = exportAddons.value.length
return len > 0 && len < addonOptions.value.length
})
/**
* 从菜单树中提取实际存在的应用
* @param list
* @param keys
*/
const collectAddonKeys = (list: any[], keys: string[]) => {
list.forEach((item: any) => {
if (item?.addon && !keys.includes(item.addon)) keys.push(item.addon)
if (Array.isArray(item?.children) && item.children.length) collectAddonKeys(item.children, keys)
})
}
/**
* 同步全选状态
*/
const syncCheckAll = () => {
const total = addonOptions.value.length
const selected = exportAddons.value.length
checkAll.value = total > 0 && selected === total
}
/**
* 全选切换
* @param val
*/
const handleCheckAllChange = (val: boolean | string | number) => {
exportAddons.value = val ? addonOptions.value.map(item => item.key) : []
}
/**
* 单项勾选变化
*/
const handleCheckedChange = () => {
syncCheckAll()
}
/**
* 清空应用勾选
*/
const clearAddons = () => {
exportAddons.value = []
checkAll.value = false
}
/**
* 打开弹窗时初始化导出范围(默认全选,与"导出全部"行为一致)
*/
const onOpen = async () => {
const keys: string[] = []
collectAddonKeys(props.menus as any[], keys)
const titleMap: Record<string, string> = {}
if (keys.length) {
try {
const res: any = await getAddonDevelop({})
;(res?.data || []).forEach((item: any) => {
if (item?.key) titleMap[item.key] = item.title || item.key
})
} catch (e) {
}
}
addonOptions.value = keys.map(key => ({ key, title: titleMap[key] || key }))
exportSystem.value = true
exportAddons.value = addonOptions.value.map(item => item.key)
syncCheckAll()
}
/**
* 生成导出文件名:menu_{端类型}_{时间}.json(与后端保持一致)
*/
const buildFileName = () => {
const d = new Date()
const pad = (n: number) => `${ n }`.padStart(2, '0')
const time = `${ d.getFullYear() }${ pad(d.getMonth() + 1) }${ pad(d.getDate()) }${ pad(d.getHours()) }${ pad(d.getMinutes()) }${ pad(d.getSeconds()) }`
return `menu_${ props.appType }_${ time }.json`
}
/**
* 导出
*/
const submitEvent = () => {
if (loading.value) return
if (!exportSystem.value && !exportAddons.value.length) {
ElMessage.error(t('exportMenuScopeRequired'))
return
}
const addons: string[] = exportSystem.value ? [ '' ] : []
addons.push(...exportAddons.value)
loading.value = true
exportMenu(props.appType, addons).then(async (blob: any) => {
// 下载成功才关闭弹窗并提示,失败时 downloadBlob 内部已给出错误提示
const success = await downloadBlob(blob, buildFileName())
if (success) {
showDialog.value = false
ElMessage.success(t('exportMenuSuccess'))
}
}).catch(() => {
}).finally(() => {
loading.value = false
})
}
defineExpose({
showDialog
})
</script>
<style lang="scss" scoped>
.addon-panel {
width: 100%;
border: 1px solid var(--cmp-module-card-border-color);
border-radius: var(--cmp-control-radius);
overflow: hidden;
}
.addon-panel__header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 12px;
border-bottom: 1px solid var(--cmp-form-section-header-border);
}
.addon-panel__list {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px 16px;
max-height: 260px;
padding: 12px;
overflow-y: auto;
:deep(.el-checkbox) {
margin-right: 0;
height: auto;
white-space: normal;
align-items: flex-start;
.el-checkbox__label {
// line-height: 20px;
word-break: break-all;
}
}
}
</style>

View File

@ -1,889 +0,0 @@
<template>
<el-dialog v-model="showDialog" :title="t('importMenu')" width="760px" :destroy-on-close="true"
:close-on-click-modal="!loading" @closed="reset">
<!-- 导入中遮罩:接口耗时较长(逐条写库),给明确的等待反馈 -->
<div v-loading="loading" :element-loading-text="t('importMenuImporting')" class="import-body">
<el-scrollbar class="import-scrollbar">
<div class="import-body__inner">
<!-- 上传 + 预览(同一卡片) -->
<div class="import-card import-file-card">
<el-upload
ref="uploadRef"
class="w-full import-upload"
drag
:auto-upload="false"
:limit="1"
:show-file-list="false"
accept=".json"
:on-change="onFileChange"
:on-remove="onFileRemove"
:on-exceed="onExceed"
>
<div class="upload-body">
<div class="upload-actions">
<el-button type="primary" class="upload-badge">{{ t('importMenuLocalUpload') }}</el-button>
</div>
<div class="upload-info">
<template v-if="!file">
<div class="upload-title">{{ t('importMenuUploadTitle') }}</div>
<div class="upload-desc">
{{ t('importMenuUploadDesc') }}<template v-if="limitText">{{ t('importMenuUploadLimitInline') }}{{ limitText }}</template>
</div>
<div class="upload-tip">{{ limitAdjustTip }}</div>
</template>
<template v-else>
<div class="upload-title">{{ file?.name }}</div>
<div class="upload-desc">{{ formatSize(file?.size ?? 0) }} · {{ t('importMenuReplaceTips') }}</div>
</template>
</div>
<el-button v-if="file" link class="upload-remove" @click.stop="removeFile">{{ t('importMenuRemoveFile') }}</el-button>
</div>
</el-upload>
<div v-if="fileTooLarge" class="file-too-large">
{{ tooLargeTip }}
</div>
<!-- 文件预览(纯前端解析,默认收起,可点击标题栏展开/收起) -->
<template v-if="file">
<div class="file-card-divider"></div>
<div class="preview-header" @click="togglePreview">
<span class="preview-title">
<el-icon class="preview-arrow" :class="{ 'is-open': showPreview }">
<ArrowRight />
</el-icon>
{{ t('importMenuPreview') }}
</span>
<span v-if="previewLoading || previewRendering" class="preview-brief">
{{ t('importMenuPreviewParsing') }}
</span>
<span v-else-if="!previewError && !showPreview" class="preview-brief">
{{ t('importMenuPreviewTotal') }}:{{ previewStats.total }}
</span>
</div>
<div v-if="showPreview" v-loading="previewLoading || previewRendering" class="preview-body">
<div v-if="previewError" class="preview-error">{{ previewError }}</div>
<template v-else>
<div class="preview-stats">
<span class="preview-stat">{{ t('importMenuPreviewTotal') }}:{{ previewStats.total }}</span>
<span class="preview-stat">{{ t('menuTypeDir') }}:{{ previewStats.dir }}</span>
<span class="preview-stat">{{ t('menuTypeMenu') }}:{{ previewStats.menu }}</span>
<span class="preview-stat">{{ t('menuTypeButton') }}:{{ previewStats.button }}</span>
</div>
<div class="preview-apps">
<span class="preview-app-label">{{ t('importMenuPreviewApp') }}:</span>
<div class="preview-app-list">
<el-tag v-if="previewStats.hasSystem" size="small" type="info">
{{ t('exportMenuSystem') }}
</el-tag>
<el-tag v-for="addon in previewStats.addons" :key="addon" size="small">
{{ addon }}
</el-tag>
<span v-if="!previewStats.hasSystem && !previewStats.addons.length" class="preview-stat">-</span>
</div>
</div>
<el-table :data="previewMenus" row-key="__key" size="small" max-height="240"
:tree-props="{ children: 'children' }" class="preview-table">
<el-table-column prop="menu_name" :label="t('menuName')" min-width="160" />
<el-table-column :label="t('menuType')" width="70" align="center">
<template #default="{ row }">
<el-tag size="small" :type="menuTypeTag(row.menu_type)">{{ menuTypeText(row.menu_type) }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="menu_key" :label="t('menuKey')" min-width="140" />
<el-table-column prop="api_url" :label="t('authId')" min-width="140" />
<el-table-column :label="t('addon')" width="110">
<template #default="{ row }">{{ row.addon || t('exportMenuSystem') }}</template>
</el-table-column>
</el-table>
<div v-if="previewTruncated" class="preview-tip">{{ t('importMenuPreviewTruncated') }}</div>
</template>
</div>
</template>
</div>
<!-- 覆盖同名菜单 -->
<div class="import-card overwrite-row">
<div class="overwrite-row__text">
<div class="overwrite-row__title">{{ t('importMenuOverwrite') }}</div>
<div class="overwrite-row__desc">{{ t('importMenuOverwriteTips') }}</div>
</div>
<el-switch v-model="overwrite" />
</div>
<!-- 导入结果 -->
<div v-if="result" class="import-card import-result">
<div class="result-header">
<span class="result-title">{{ t('importMenuResult') }}</span>
<span class="result-status" :class="result.fail ? 'is-danger' : 'is-success'">
{{ result.fail ? t('importMenuHasFail') : t('importMenuDone') }}
</span>
</div>
<div class="legend">
<span class="legend__item">{{ t('importMenuTotal') }} {{ result.total }}</span>
<span class="legend__item">{{ t('importMenuInsert') }} {{ result.insert }}</span>
<span class="legend__item">{{ t('importMenuSkip') }} {{ result.skip }}</span>
<span class="legend__item" :class="{ 'is-fail': result.fail }">{{ t('importMenuFail') }} {{ result.fail }}</span>
</div>
<!-- 占比进度条:成功段(紫)+ 失败段(灰) -->
<div class="ratio-bar">
<div v-for="seg in resultSegments" :key="seg.key" class="ratio-bar__seg"
:class="`seg--${ seg.key }`" :style="{ width: seg.width }"></div>
</div>
<!-- 失败明细 -->
<template v-if="result.fail_list && result.fail_list.length">
<div class="section-head">
<span class="section-head__title">{{ t('importMenuFailList') }}</span>
<span class="section-head__meta">
{{ t('importMenuFail') }} {{ result.fail }} {{ t('importMenuUnit') }}
· {{ t('importMenuFailRatio') }} {{ failRatioText }}%
</span>
</div>
<div class="failure-list">
<el-scrollbar max-height="240px">
<div v-for="(item, index) in result.fail_list" :key="index" class="failure-list__row">
<div class="failure-list__name" :title="item.menu_name || item.menu_key">
{{ item.menu_name || item.menu_key || '-' }}
</div>
<span class="failure-list__reason">{{ item.reason }}</span>
</div>
</el-scrollbar>
</div>
</template>
</div>
</div>
</el-scrollbar>
</div>
<template #footer>
<span class="dialog-footer">
<el-button @click="showDialog = false">{{ t('cancel') }}</el-button>
<el-button type="primary" :loading="loading" @click="submitEvent">{{ t('confirm') }}</el-button>
</span>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import { ref, watch, computed, nextTick } from 'vue'
import { t } from '@/lang'
import { ElMessage } from 'element-plus'
import type { UploadFile, UploadInstance, UploadRawFile } from 'element-plus'
import { ArrowRight } from '@element-plus/icons-vue'
import { importMenu, getMenuImportConfig } from '@/app/api/sys'
const props = defineProps({
appType: {
type: String,
default: 'admin'
}
})
const emit = defineEmits(['complete'])
const showDialog = ref(false)
const loading = ref(false)
const overwrite = ref(false)
const uploadRef = ref<UploadInstance>()
const file = ref<UploadRawFile | null>(null)
const result = ref<Record<string, any> | null>(null)
/**
* 导入结果各状态占比(成功合并为一段绿色,失败红色)
*/
const resultSegments = computed(() => {
const res = result.value || {}
const total = Number(res.total || 0)
if (!total) return []
const ok = Number(res.insert || 0) + Number(res.update || 0) + Number(res.skip || 0)
const fail = Number(res.fail || 0)
const segments = [
{ key: 'ok', value: ok },
{ key: 'fail', value: fail }
]
return segments
.filter(item => item.value > 0)
.map(item => ({ key: item.key, width: `${ (item.value / total) * 100 }%` }))
})
/**
* 失败占比(百分比,保留一位小数)
*/
const failRatioText = computed(() => {
const res = result.value || {}
const total = Number(res.total || 0)
const fail = Number(res.fail || 0)
return total > 0 ? ((fail / total) * 100).toFixed(1) : '0.0'
})
// 导入文件业务上限(2M),与后端 IMPORT_FILE_MAX_BYTE 保持一致
const IMPORT_MAX_BYTE = 2 * 1024 * 1024
// 生效上传上限(字节):PHP 限制更大时取 2M,更小时取 PHP 限制
const uploadLimit = ref(IMPORT_MAX_BYTE)
// 上限是否来自 PHP 配置(false 表示受业务上限限制)
const limitFromPhp = ref(false)
// 上传限制配置是否已加载
const limitConfigLoaded = ref(false)
const fileTooLarge = ref(false)
// 文件预览(纯前端解析,不调接口)
const PREVIEW_MAX = 2000
// 预览默认收起,由用户点击标题栏切换
const showPreview = ref(false)
const previewLoading = ref(false)
// 展开预览时的渲染过渡
const previewRendering = ref(false)
const previewMenus = ref<any[]>([])
const previewError = ref('')
const previewTruncated = ref(false)
const emptyPreviewStats = () => ({ total: 0, dir: 0, menu: 0, button: 0, addons: [] as string[], hasSystem: false })
const previewStats = ref(emptyPreviewStats())
/**
* 字节数格式化
* @param bytes
*/
const formatSize = (bytes: number) => {
if (!bytes) return '-'
if (bytes >= 1024 * 1024 * 1024) return `${ (bytes / 1024 / 1024 / 1024).toFixed(2) } GB`
if (bytes >= 1024 * 1024) return `${ (bytes / 1024 / 1024).toFixed(2) } MB`
if (bytes >= 1024) return `${ (bytes / 1024).toFixed(2) } KB`
return `${ bytes } B`
}
/**
* 上传上限文案
*/
const limitText = computed(() => formatSize(uploadLimit.value))
/**
* 上限调整提示:受 PHP 配置限制时提示改 php.ini,否则提示拆分文件
*/
const limitAdjustTip = computed(() => t(limitFromPhp.value ? 'importMenuLimitAdjustPhp' : 'importMenuLimitAdjustSplit'))
/**
* 文件超限提示
*/
const tooLargeTip = computed(() => t(limitFromPhp.value ? 'importMenuFileTooLarge' : 'importMenuFileOverMax'))
/**
* 菜单类型文案
* @param type
*/
const menuTypeText = (type: string) => {
if (type === '0') return t('menuTypeDir')
if (type === '1') return t('menuTypeMenu')
if (type === '2') return t('menuTypeButton')
return t('menuType')
}
/**
* 菜单类型标签配色
* @param type
*/
const menuTypeTag = (type: string): 'primary' | 'success' | 'warning' | 'info' | 'danger' => {
if (type === '0') return 'info'
if (type === '2') return 'warning'
return 'success'
}
/**
* 清空预览
*/
const clearPreview = () => {
previewMenus.value = []
previewError.value = ''
previewTruncated.value = false
previewStats.value = emptyPreviewStats()
}
/**
* 统计整棵菜单树(用于预览摘要)
* @param list
* @param stats
*/
const collectPreviewStats = (list: any[], stats: ReturnType<typeof emptyPreviewStats>) => {
list.forEach((item: any) => {
if (!item || typeof item !== 'object') return
stats.total++
const type = String(item.menu_type ?? '')
if (type === '0') stats.dir++
else if (type === '1') stats.menu++
else if (type === '2') stats.button++
const addon = `${ item.addon ?? '' }`
if (addon === '') {
stats.hasSystem = true
} else if (!stats.addons.includes(addon)) {
stats.addons.push(addon)
}
if (Array.isArray(item.children) && item.children.length) collectPreviewStats(item.children, stats)
})
}
/**
* 构建预览节点:生成合成唯一键,并按上限深度优先截断
* @param list
* @param limit
* @param counter
* @param path
*/
const buildPreviewTree = (list: any[], limit: number, counter: { count: number }, path = ''): any[] => {
const resultList: any[] = []
list.forEach((item: any, index: number) => {
if (counter.count >= limit || !item || typeof item !== 'object') return
counter.count++
const node: Record<string, any> = {
__key: `${ path }/${ index }-${ item.menu_key ?? '' }`,
menu_name: `${ item.menu_name ?? '' }`,
menu_type: String(item.menu_type ?? ''),
menu_key: `${ item.menu_key ?? '' }`,
api_url: `${ item.api_url ?? '' }`,
addon: `${ item.addon ?? '' }`
}
if (Array.isArray(item.children) && item.children.length) {
node.children = buildPreviewTree(item.children, limit, counter, node.__key)
}
resultList.push(node)
})
return resultList
}
/**
* 解析选中文件并生成预览(纯前端,不调接口)
*/
const parsePreview = async () => {
clearPreview()
if (!file.value) return
previewLoading.value = true
try {
const text = await file.value.text()
let data: any = null
try {
data = JSON.parse(text)
} catch (e) {
previewError.value = t('importMenuPreviewInvalid')
return
}
if (!Array.isArray(data)) {
previewError.value = t('importMenuPreviewInvalid')
return
}
if (!data.length) {
previewError.value = t('importMenuPreviewEmpty')
return
}
const stats = emptyPreviewStats()
collectPreviewStats(data, stats)
previewStats.value = stats
const counter = { count: 0 }
previewMenus.value = buildPreviewTree(data, PREVIEW_MAX, counter)
previewTruncated.value = stats.total > PREVIEW_MAX
} catch (e) {
previewError.value = t('importMenuPreviewInvalid')
} finally {
previewLoading.value = false
}
}
/**
* 展开/收起预览
* 展开前先让出一帧渲染出 loading 遮罩,避免大表格渲染时界面无反馈
*/
const togglePreview = async () => {
if (showPreview.value) {
showPreview.value = false
return
}
previewRendering.value = true
// 双 rAF 确保 loading 遮罩已绘制后再渲染表格
await new Promise(resolve => requestAnimationFrame(() => requestAnimationFrame(resolve)))
showPreview.value = true
await nextTick()
previewRendering.value = false
}
/**
* 获取PHP上传限制配置
*/
const getImportConfigFn = () => {
if (limitConfigLoaded.value) return
getMenuImportConfig().then((res: any) => {
const data = res?.data || {}
const phpLimit = Number(data.max_upload_byte || 0)
// 优先取后端计算的 limit_byte;接口未返回该字段时前端兜底按 min(2M, PHP限制) 计算
const limit = Number(data.limit_byte || 0) || Math.min(phpLimit > 0 ? phpLimit : IMPORT_MAX_BYTE, IMPORT_MAX_BYTE)
if (limit > 0) uploadLimit.value = limit
limitFromPhp.value = data.limit_source
? data.limit_source === 'php'
: (phpLimit > 0 && phpLimit < IMPORT_MAX_BYTE)
limitConfigLoaded.value = true
}).catch(() => {
})
}
watch(showDialog, (val) => {
if (val) getImportConfigFn()
})
const onFileChange = async (uploadFile: UploadFile) => {
result.value = null
file.value = uploadFile.raw || null
fileTooLarge.value = false
if (file.value && file.value.size > uploadLimit.value) {
fileTooLarge.value = true
ElMessage.error(tooLargeTip.value)
}
await parsePreview()
}
const onFileRemove = () => {
file.value = null
fileTooLarge.value = false
showPreview.value = false
clearPreview()
}
// 移除已选文件,重新选择
const removeFile = () => {
file.value = null
result.value = null
fileTooLarge.value = false
showPreview.value = false
clearPreview()
uploadRef.value?.clearFiles()
}
// 只允许保留一个文件,超出时替换
const onExceed = (files: File[]) => {
uploadRef.value?.clearFiles()
const raw = files[0]
if (raw) uploadRef.value?.handleStart(raw as UploadRawFile)
}
const reset = () => {
loading.value = false
overwrite.value = false
file.value = null
result.value = null
fileTooLarge.value = false
showPreview.value = false
clearPreview()
uploadRef.value?.clearFiles()
}
/**
* 提交导入
*/
const submitEvent = () => {
if (loading.value) return
if (!file.value) {
ElMessage.error(t('importMenuFileRequired'))
return
}
if (fileTooLarge.value) {
ElMessage.error(t('importMenuFileTooLarge'))
return
}
// 开始导入后自动收起预览
showPreview.value = false
const data = new FormData()
data.append('file', file.value)
data.append('overwrite', overwrite.value ? '1' : '0')
loading.value = true
importMenu(props.appType, data).then((res: any) => {
loading.value = false
result.value = res.data || null
emit('complete')
}).catch(() => {
loading.value = false
})
}
defineExpose({
showDialog
})
</script>
<style lang="scss" scoped>
.import-body {
padding: 4px 0;
}
.import-scrollbar {
:deep(.el-scrollbar__wrap) {
max-height: min(60vh, calc(100vh - 300px));
}
}
.import-body__inner {
display: flex;
flex-direction: column;
gap: 12px;
padding-right: 12px;
}
.import-card {
padding: 16px 18px;
border-radius: 12px;
border: var(--border-default);
}
.import-file-card {
.file-too-large {
margin-top: 8px;
font-size: 12px;
color: #ef4444;
}
.file-card-divider {
height: 1px;
margin: 14px 0;
background: #e8e8eb;
}
.preview-header {
display: flex;
align-items: center;
justify-content: space-between;
cursor: pointer;
user-select: none;
}
.preview-title {
display: flex;
align-items: center;
gap: 6px;
font-size: 13px;
font-weight: 500;
line-height: 1.4;
color: #1f2329;
}
.preview-arrow {
font-size: 12px;
margin-bottom: 2px;
color: #1f2329;
}
.preview-icon {
font-size: 15px;
color: #1f2329;
}
.preview-brief {
font-size: 12px;
line-height: 1.4;
color: #909399;
}
.preview-body {
padding-top: 12px;
}
.preview-stats {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.preview-stat {
font-size: 12px;
color: #909399;
}
.preview-apps {
display: flex;
align-items: flex-start;
margin-top: 8px;
}
.preview-app-label {
flex: none;
margin-right: 4px;
font-size: 12px;
line-height: 24px;
color: #909399;
}
.preview-app-list {
display: flex;
flex: 1;
flex-wrap: wrap;
gap: 5px;
min-width: 0;
}
.preview-error {
font-size: 12px;
color: #ef4444;
}
.preview-table {
margin-top: 10px;
:deep(.el-table__cell .cell) {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
.preview-tip {
margin-top: 6px;
font-size: 12px;
color: var(--el-color-warning);
}
}
.import-upload {
:deep(.el-upload) {
width: 100%;
}
:deep(.el-upload-dragger) {
position: relative;
width: 100%;
height: auto;
padding: 0;
border: none;
border-radius: 0;
background: transparent;
text-align: left;
&:hover {
border: none;
background: transparent;
}
}
.upload-body {
display: flex;
align-items: center;
gap: 14px;
}
.upload-actions {
flex: none;
}
.upload-badge {
height: 30px;
padding: 0 15px;
border: none;
border-radius: 999px;
font-size: 13px;
font-weight: 500;
}
.upload-info {
flex: 1;
min-width: 0;
}
.upload-remove {
flex: none;
height: auto;
padding: 0;
color: #a0a3ab;
font-size: 13px;
&:hover {
color: #606266;
}
}
.upload-title {
font-size: 14px;
font-weight: 600;
line-height: 1.4;
color: #1f2329;
word-break: break-all;
}
.upload-desc {
margin-top: 4px;
font-size: 12px;
line-height: 1.5;
color: #909399;
}
.upload-tip {
margin-top: 4px;
font-size: 12px;
line-height: 1.5;
color: #c0c4cc;
}
}
.overwrite-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
&__text {
flex: 1;
min-width: 0;
}
&__title {
font-size: 14px;
font-weight: 600;
color: #1f2329;
line-height: 1.4;
}
&__desc {
margin-top: 4px;
font-size: 12px;
line-height: 1.5;
color: #909399;
}
}
.import-result {
.result-header {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 10px;
}
.result-title {
font-size: 14px;
font-weight: 600;
line-height: 1.4;
color: #1f2329;
}
.result-status {
font-size: 13px;
line-height: 1.4;
white-space: nowrap;
&.is-success {
color: #22c55e;
}
&.is-danger {
color: #ef4444;
}
}
.legend {
display: flex;
flex-wrap: wrap;
gap: 16px;
}
.legend__item {
font-size: 12px;
line-height: 1.4;
color: #606266;
white-space: nowrap;
&.is-fail {
color: #ef4444;
}
}
.ratio-bar {
display: flex;
height: 8px;
margin-top: 12px;
border-radius: 999px;
overflow: hidden;
background-color: #e8e8eb;
}
.ratio-bar__seg {
height: 100%;
&.seg--ok {
background-color: var(--sys-color-primary);
}
&.seg--fail {
background-color: #e8e8eb;
}
}
.section-head {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-top: 18px;
}
.section-head__title {
font-size: 14px;
font-weight: 600;
line-height: 1.4;
color: #1f2329;
}
.section-head__meta {
font-size: 12px;
line-height: 1.4;
color: #909399;
}
.failure-list {
margin-top: 4px;
}
.failure-list__row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
padding: 12px 0;
border-bottom: 1px solid #e8e8eb;
&:last-child {
border-bottom: none;
padding-bottom: 0;
}
}
.failure-list__name {
flex: 1;
min-width: 0;
font-size: 13px;
color: #1f2329;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.failure-list__reason {
flex: none;
max-width: 62%;
font-size: 13px;
line-height: 1.4;
color: #ef4444;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
</style>

View File

@ -1,9 +1,13 @@
<template> <template>
<!--操作日志--> <!--操作日志-->
<div ref="pageRef" class="main-container table-fill-page" :style="pageStyle"> <div class="main-container">
<div class="table-fill-page__card"> <el-card class="box-card !border-none" shadow="never">
<div class="table-search-wrap table-search-wrap--panel flex justify-between items-start"> <div class="flex justify-between items-center">
<span class="text-page-title">{{ pageName }}</span>
</div>
<div class="flex justify-between items-start mt-[20px]">
<el-form :inline="true" :model="sysUserLogTableData.searchParam" ref="searchFormRef"> <el-form :inline="true" :model="sysUserLogTableData.searchParam" ref="searchFormRef">
<el-form-item :label="t('ip')" prop="ip"> <el-form-item :label="t('ip')" prop="ip">
<el-input v-model.trim="sysUserLogTableData.searchParam.ip" :placeholder="t('ipPlaceholder')" /> <el-input v-model.trim="sysUserLogTableData.searchParam.ip" :placeholder="t('ipPlaceholder')" />
@ -27,16 +31,15 @@
<el-button @click="resetForm(searchFormRef)">{{ t('reset') }}</el-button> <el-button @click="resetForm(searchFormRef)">{{ t('reset') }}</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div class="flex justify-end items-center w-[10%]">
<div>
<el-button type="primary" class="w-[100px]" @click="clearEvent()">{{ t('清空日志') }}</el-button>
</div>
</div>
</div> </div>
<div class="table-panel table-fill-page__panel"> <div>
<table-toolbar :title="pageName" :selectable="false"> <el-table :data="sysUserLogTableData.data" size="large" v-loading="sysUserLogTableData.loading">
<template #actions>
<el-button type="primary" @click="clearEvent()">{{ t('清空日志') }}</el-button>
</template>
</table-toolbar>
<div class="table-fill-page__table">
<el-table height="100%" :data="sysUserLogTableData.data" size="large" v-loading="sysUserLogTableData.loading">
<template #empty> <template #empty>
<span>{{ !sysUserLogTableData.loading ? t('emptyData') : '' }}</span> <span>{{ !sysUserLogTableData.loading ? t('emptyData') : '' }}</span>
</template> </template>
@ -56,19 +59,14 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div>
<table-pagination <div class="mt-[16px] flex justify-end">
v-model:current-page="sysUserLogTableData.page" <el-pagination v-model:current-page="sysUserLogTableData.page" v-model:page-size="sysUserLogTableData.limit" layout="total, sizes, prev, pager, next, jumper" :total="sysUserLogTableData.total" @size-change="loadSysUserLogList()" @current-change="loadSysUserLogList" />
v-model:page-size="sysUserLogTableData.limit" </div>
:total="sysUserLogTableData.total"
@size-change="loadSysUserLogList()"
@current-change="loadSysUserLogList"
/>
<user-log-detail ref="userLogDetailDialog" @complete="loadSysUserLogList()" /> <user-log-detail ref="userLogDetailDialog" @complete="loadSysUserLogList()" />
</div> </div>
</div> </el-card>
</div> </div>
</template> </template>
@ -78,16 +76,10 @@ import { t } from '@/lang'
import { getLogList, logDestroy } from '@/app/api/site' import { getLogList, logDestroy } from '@/app/api/site'
import UserLogDetail from '@/app/views/auth/components/user-log-detail.vue' import UserLogDetail from '@/app/views/auth/components/user-log-detail.vue'
import { FormInstance } from 'element-plus' import { FormInstance } from 'element-plus'
import TablePagination from '@/components/table-pagination/index.vue'
import TableToolbar from '@/components/table-toolbar/index.vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { useTablePageHeight } from '@/hooks/useTablePageHeight'
const route = useRoute() const route = useRoute()
const pageName = route.meta.title const pageName = route.meta.title
// 表格占满页面剩余高度,超出部分在表格内部滚动
const { pageRef, pageStyle } = useTablePageHeight()
const sysUserLogTableData = reactive({ const sysUserLogTableData = reactive({
page: 1, page: 1,
limit: 10, limit: 10,

View File

@ -1,27 +1,21 @@
<template> <template>
<!--平台菜单--> <!--平台菜单-->
<div ref="pageRef" class="main-container table-fill-page" :style="pageStyle"> <div class="main-container">
<div class="table-fill-page__card"> <el-card class="box-card !border-none" shadow="never">
<div class="table-panel table-fill-page__panel"> <div class="flex justify-between items-center">
<table-toolbar :title="pageName" :selectable="false"> <span class="text-page-title">{{ pageName }}</span>
<template #actions> <div class="flex items-center">
<el-button @click="importEvent"> <el-button type="primary" class="w-[100px]" @click="addEvent">
{{ t('importMenu') }}
</el-button>
<el-button @click="exportEvent">
{{ t('exportMenu') }}
</el-button>
<el-button :loading="refreshLoading" @click="refreshMenu">
{{ t('initializeMenu') }}
</el-button>
<el-button type="primary" @click="addEvent">
{{ t('addMenu') }} {{ t('addMenu') }}
</el-button> </el-button>
</template> <el-button class="w-[100px]" :loading="refreshLoading" @click="refreshMenu">
</table-toolbar> {{ t('initializeMenu') }}
<div class="table-fill-page__table"> </el-button>
<el-table height="100%" :data="menusTableData.data" row-key="menu_key" size="large" v-loading="menusTableData.loading"> </div>
</div>
<el-table class="mt-[20px]" :data="menusTableData.data" row-key="menu_key" size="large" v-loading="menusTableData.loading">
<template #empty> <template #empty>
<span>{{ !menusTableData.loading ? t('emptyData') : '' }}</span> <span>{{ !menusTableData.loading ? t('emptyData') : '' }}</span>
</template> </template>
@ -54,13 +48,9 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div>
</div>
<edit-menu ref="editMenuDialog" :menu-tree="menusTableData.data" @complete="getMenuList" app-type="admin" /> <edit-menu ref="editMenuDialog" :menu-tree="menusTableData.data" @complete="getMenuList" app-type="admin" />
<import-menu ref="importMenuDialog" app-type="admin" @complete="getMenuList" /> </el-card>
<export-menu ref="exportMenuDialog" app-type="admin" :menus="menusTableData.data" />
</div>
</div> </div>
</template> </template>
@ -70,17 +60,10 @@ import { getMenus, deleteMenu, menuRefresh } from '@/app/api/sys'
import { t } from '@/lang' import { t } from '@/lang'
import { ElMessageBox } from 'element-plus' import { ElMessageBox } from 'element-plus'
import EditMenu from '@/app/views/auth/components/edit-menu.vue' import EditMenu from '@/app/views/auth/components/edit-menu.vue'
import ImportMenu from '@/app/views/auth/components/import-menu.vue'
import ExportMenu from '@/app/views/auth/components/export-menu.vue'
import TableToolbar from '@/components/table-toolbar/index.vue'
import { useTablePageHeight } from '@/hooks/useTablePageHeight'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
const route = useRoute() const route = useRoute()
const pageName = route.meta.title const pageName = route.meta.title
// 表格占满页面剩余高度,超出部分在表格内部滚动
const { pageRef, pageStyle } = useTablePageHeight()
const menusTableData = reactive({ const menusTableData = reactive({
loading: true, loading: true,
data: [] data: []
@ -121,22 +104,6 @@ const refreshMenu = () => {
}) })
} }
/**
* 导入菜单
*/
const importMenuDialog: Record<string, any> | null = ref(null)
const importEvent = () => {
importMenuDialog.value.showDialog = true
}
/**
* 导出菜单
*/
const exportMenuDialog: Record<string, any> | null = ref(null)
const exportEvent = () => {
exportMenuDialog.value.showDialog = true
}
/** /**
* 添加菜单 * 添加菜单
*/ */

View File

@ -1,9 +1,13 @@
<template> <template>
<!--角色管理--> <!--角色管理-->
<div ref="pageRef" class="main-container table-fill-page" :style="pageStyle"> <div class="main-container">
<div class="table-fill-page__card"> <el-card class="box-card !border-none" shadow="never">
<div class="table-search-wrap table-search-wrap--panel flex justify-between items-center"> <div class="flex justify-between items-center">
<span class="text-page-title">{{ pageName }}</span>
</div>
<div class="flex justify-between items-center mt-[20px]">
<el-form :inline="true" :model="roleTableData.searchParam" ref="searchFormRef"> <el-form :inline="true" :model="roleTableData.searchParam" ref="searchFormRef">
<el-form-item :label="t('roleName')" prop="search"> <el-form-item :label="t('roleName')" prop="search">
<el-input v-model.trim="roleTableData.searchParam.search" class="w-[240px]" :placeholder="t('roleNamePlaceholder')" /> <el-input v-model.trim="roleTableData.searchParam.search" class="w-[240px]" :placeholder="t('roleNamePlaceholder')" />
@ -13,16 +17,11 @@
<el-button @click="resetForm(searchFormRef)">{{ t('reset') }}</el-button> <el-button @click="resetForm(searchFormRef)">{{ t('reset') }}</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-button type="primary" class="w-[100px] self-start" @click="addEvent">{{ t('addRole') }}</el-button>
</div> </div>
<div class="table-panel table-fill-page__panel"> <div>
<table-toolbar :title="pageName" :selectable="false"> <el-table :data="roleTableData.data" size="large" v-loading="roleTableData.loading">
<template #actions>
<el-button type="primary" @click="addEvent">{{ t('addRole') }}</el-button>
</template>
</table-toolbar>
<div class="table-fill-page__table">
<el-table height="100%" :data="roleTableData.data" size="large" v-loading="roleTableData.loading">
<template #empty> <template #empty>
<span>{{ !roleTableData.loading ? t('emptyData') : '' }}</span> <span>{{ !roleTableData.loading ? t('emptyData') : '' }}</span>
</template> </template>
@ -41,19 +40,14 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div>
<table-pagination <div class="mt-[16px] flex justify-end">
v-model:current-page="roleTableData.page" <el-pagination v-model:current-page="roleTableData.page" v-model:page-size="roleTableData.limit" layout="total, sizes, prev, pager, next, jumper" :total="roleTableData.total" @size-change="loadRoleList()" @current-change="loadRoleList" />
v-model:page-size="roleTableData.limit" </div>
:total="roleTableData.total"
@size-change="loadRoleList()"
@current-change="loadRoleList"
/>
</div> </div>
<edit-role ref="editRoleDialog" @complete="loadRoleList()" /> <edit-role ref="editRoleDialog" @complete="loadRoleList()" />
</div> </el-card>
</div> </div>
</template> </template>
@ -63,16 +57,10 @@ import { t } from '@/lang'
import { getRoleList, deleteRole, modifyRoleStatus } from '@/app/api/sys' import { getRoleList, deleteRole, modifyRoleStatus } from '@/app/api/sys'
import { ElMessageBox, FormInstance } from 'element-plus' import { ElMessageBox, FormInstance } from 'element-plus'
import EditRole from '@/app/views/auth/components/edit-role.vue' import EditRole from '@/app/views/auth/components/edit-role.vue'
import TablePagination from '@/components/table-pagination/index.vue'
import TableToolbar from '@/components/table-toolbar/index.vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { useTablePageHeight } from '@/hooks/useTablePageHeight'
const route = useRoute() const route = useRoute()
const pageName = route.meta.title const pageName = route.meta.title
// 表格占满页面剩余高度,超出部分在表格内部滚动
const { pageRef, pageStyle } = useTablePageHeight()
const roleTableData = reactive({ const roleTableData = reactive({
page: 1, page: 1,
limit: 10, limit: 10,

View File

@ -1,29 +1,24 @@
<template> <template>
<!--站点菜单--> <!--站点菜单-->
<div ref="pageRef" class="main-container table-fill-page" :style="pageStyle"> <div class="main-container">
<div class="table-fill-page__card"> <el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center">
<span class="text-page-title">{{ pageName }}</span>
<div class="flex items-center">
<el-button type="primary" class="w-[100px]" @click="addEvent">
{{ t('addMenu') }}
</el-button>
<el-button class="w-[100px]" :loading="refreshLoading" @click="refreshMenu">
{{ t('initializeMenu') }}
</el-button>
</div>
</div>
<el-tabs v-model="active"> <el-tabs v-model="active">
<el-tab-pane :label="t('system')" name="system"> <el-tab-pane :label="t('system')" name="system">
<div class="table-panel table-fill-page__panel"> <el-table :data="menusTableData.system" row-key="menu_key" size="large" v-loading="menusTableData.loading">
<table-toolbar :title="pageName" :selectable="false">
<template #actions>
<el-button @click="importEvent">
{{ t('importMenu') }}
</el-button>
<el-button @click="exportEvent">
{{ t('exportMenu') }}
</el-button>
<el-button :loading="refreshLoading" @click="refreshMenu">
{{ t('initializeMenu') }}
</el-button>
<el-button type="primary" @click="addEvent">
{{ t('addMenu') }}
</el-button>
</template>
</table-toolbar>
<div class="table-fill-page__table">
<el-table height="100%" :data="menusTableData.system" row-key="menu_key" size="large" v-loading="menusTableData.loading">
<template #empty> <template #empty>
<span>{{ !menusTableData.loading ? t('emptyData') : '' }}</span> <span>{{ !menusTableData.loading ? t('emptyData') : '' }}</span>
</template> </template>
@ -55,29 +50,9 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div>
</div>
</el-tab-pane> </el-tab-pane>
<el-tab-pane :label="t('application')" name="application"> <el-tab-pane :label="t('application')" name="application">
<div class="table-panel table-fill-page__panel"> <el-table :data="menusTableData.application" row-key="menu_key" size="large" v-loading="menusTableData.loading">
<table-toolbar :title="pageName" :selectable="false">
<template #actions>
<el-button @click="importEvent">
{{ t('importMenu') }}
</el-button>
<el-button @click="exportEvent">
{{ t('exportMenu') }}
</el-button>
<el-button :loading="refreshLoading" @click="refreshMenu">
{{ t('initializeMenu') }}
</el-button>
<el-button type="primary" @click="addEvent">
{{ t('addMenu') }}
</el-button>
</template>
</table-toolbar>
<div class="table-fill-page__table">
<el-table height="100%" :data="menusTableData.application" row-key="menu_key" size="large" v-loading="menusTableData.loading">
<template #empty> <template #empty>
<span>{{ !menusTableData.loading ? t('emptyData') : '' }}</span> <span>{{ !menusTableData.loading ? t('emptyData') : '' }}</span>
</template> </template>
@ -109,37 +84,26 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div>
</div>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</div>
<edit-menu ref="editMenuDialog" :menu-tree="menusTableData.data" @complete="getMenuList" /> <edit-menu ref="editMenuDialog" :menu-tree="menusTableData.data" @complete="getMenuList" />
<import-menu ref="importMenuDialog" app-type="site" @complete="getMenuList" /> </el-card>
<export-menu ref="exportMenuDialog" app-type="site" :menus="menuTree" />
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, ref, h, computed } from 'vue' import { reactive, ref, h } from 'vue'
import { getMenus, deleteMenu, menuRefresh } from '@/app/api/sys' import { getMenus, deleteMenu, menuRefresh } from '@/app/api/sys'
import { t } from '@/lang' import { t } from '@/lang'
import { ElMessageBox } from 'element-plus' import { ElMessageBox } from 'element-plus'
import EditMenu from '@/app/views/auth/components/edit-menu.vue' import EditMenu from '@/app/views/auth/components/edit-menu.vue'
import ImportMenu from '@/app/views/auth/components/import-menu.vue'
import ExportMenu from '@/app/views/auth/components/export-menu.vue'
import TableToolbar from '@/components/table-toolbar/index.vue'
import { useTablePageHeight } from '@/hooks/useTablePageHeight'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
const route = useRoute() const route = useRoute()
const active = ref('system') const active = ref('system')
const pageName = route.meta.title const pageName = route.meta.title
// 表格占满页面剩余高度,超出部分在表格内部滚动
const { pageRef, pageStyle } = useTablePageHeight()
const menusTableData = reactive<Record<string, any>>({ const menusTableData = reactive<Record<string, any>>({
loading: true, loading: true,
system: [], system: [],
@ -187,27 +151,6 @@ const refreshMenu = () => {
}).catch(() => { }).catch(() => {
}) })
} }
/**
* 导入菜单
*/
const importMenuDialog: Record<string, any> | null = ref(null)
const importEvent = () => {
importMenuDialog.value.showDialog = true
}
/**
* 导出范围弹窗用到的菜单树(系统菜单 + 应用菜单)
*/
const menuTree = computed(() => [ ...menusTableData.system, ...menusTableData.application ])
/**
* 导出菜单
*/
const exportMenuDialog: Record<string, any> | null = ref(null)
const exportEvent = () => {
exportMenuDialog.value.showDialog = true
}
/** /**
* 添加菜单 * 添加菜单
*/ */

View File

@ -1,9 +1,12 @@
<template> <template>
<!--管理员--> <!--管理员-->
<div ref="pageRef" class="main-container table-fill-page" :style="pageStyle"> <div class="main-container">
<div class="table-fill-page__card"> <el-card class="box-card !border-none" shadow="never">
<div class="table-search-wrap table-search-wrap--panel flex justify-between items-center"> <div class="flex justify-between items-center">
<span class="text-page-title">{{ pageName }}</span>
</div>
<div class="flex justify-between items-center mt-[20px]">
<el-form :inline="true" :model="userTableData.searchParam" ref="searchFormRef"> <el-form :inline="true" :model="userTableData.searchParam" ref="searchFormRef">
<el-form-item :label="t('accountNumber')" prop="search"> <el-form-item :label="t('accountNumber')" prop="search">
<el-input v-model.trim="userTableData.searchParam.search" class="input-width" :placeholder="t('accountNumberPlaceholder')" /> <el-input v-model.trim="userTableData.searchParam.search" class="input-width" :placeholder="t('accountNumberPlaceholder')" />
@ -13,16 +16,11 @@
<el-button @click="resetForm(searchFormRef)">{{ t('reset') }}</el-button> <el-button @click="resetForm(searchFormRef)">{{ t('reset') }}</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-button type="primary" class="w-[100px] self-start" @click="addEvent">{{ t('addUser') }}</el-button>
</div> </div>
<div class="table-panel table-fill-page__panel"> <div>
<table-toolbar :title="pageName" :selectable="false"> <el-table :data="userTableData.data" size="large" v-loading="userTableData.loading">
<template #actions>
<el-button type="primary" @click="addEvent">{{ t('addUser') }}</el-button>
</template>
</table-toolbar>
<div class="table-fill-page__table">
<el-table height="100%" :data="userTableData.data" size="large" v-loading="userTableData.loading">
<template #empty> <template #empty>
<span>{{ !userTableData.loading ? t('emptyData') : '' }}</span> <span>{{ !userTableData.loading ? t('emptyData') : '' }}</span>
</template> </template>
@ -63,22 +61,26 @@
{{ row.last_ip || '' }} {{ row.last_ip || '' }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="t('operation')" align="right" fixed="right" width="180"> <el-table-column :label="t('operation')" align="right" fixed="right" width="160">
<template #default="{ row }"> <template #default="{ row }">
<table-actions v-if="row.is_admin != 1" :actions="rowActions(row)" /> <div v-if="row.is_admin != 1">
<el-button v-else link disabled>{{ t('adminDisabled') }}</el-button> <el-button type="primary" link @click="editEvent(row)">{{ t('edit') }}</el-button>
<el-button type="primary" link @click="lockEvent(row.uid)" v-if="row.status">{{ t('lock') }}</el-button>
<el-button type="primary" link @click="unlockEvent(row.uid)" v-else>{{ t('unlock') }}</el-button>
<el-button type="primary" link @click="deleteEvent(row.uid)">{{ t('delete') }}</el-button>
</div>
<div v-else>
<el-button link disabled>{{ t('adminDisabled') }}</el-button>
</div>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div>
<table-pagination <div class="mt-[16px] flex justify-end">
v-model:current-page="userTableData.page" <el-pagination v-model:current-page="userTableData.page" v-model:page-size="userTableData.limit"
v-model:page-size="userTableData.limit" layout="total, sizes, prev, pager, next, jumper" :total="userTableData.total"
:total="userTableData.total" @size-change="loadUserList()" @current-change="loadUserList" />
@size-change="loadUserList()" </div>
@current-change="loadUserList"
/>
</div> </div>
<!-- <el-tabs v-model="activeName" class="mt-[20px]"> <!-- <el-tabs v-model="activeName" class="mt-[20px]">
<el-tab-pane :label="t('管理员')" name="userList"> <el-tab-pane :label="t('管理员')" name="userList">
@ -89,7 +91,7 @@
</el-tab-pane> </el-tab-pane>
</el-tabs> --> </el-tabs> -->
<edit-user ref="editUserDialog" @complete="loadUserList()" /> <edit-user ref="editUserDialog" @complete="loadUserList()" />
</div> </el-card>
</div> </div>
</template> </template>
@ -102,26 +104,10 @@ import userRole from '@/app/views/auth/role.vue'
import { img } from '@/utils/common' import { img } from '@/utils/common'
import { ElMessageBox } from 'element-plus' import { ElMessageBox } from 'element-plus'
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import TableActions from '@/components/table-actions/index.vue'
import TablePagination from '@/components/table-pagination/index.vue'
import TableToolbar from '@/components/table-toolbar/index.vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { useTablePageHeight } from '@/hooks/useTablePageHeight'
const route = useRoute() const route = useRoute()
const pageName = route.meta.title const pageName = route.meta.title
// 表格占满页面剩余高度,超出部分在表格内部滚动
const { pageRef, pageStyle } = useTablePageHeight()
/**
* 表格行内操作:超过 2 个自动收进「更多」
*/
const rowActions = (row: any) => [
{ label: t('edit'), onClick: () => editEvent(row) },
{ label: row.status ? t('lock') : t('unlock'), onClick: () => (row.status ? lockEvent(row.uid) : unlockEvent(row.uid)) },
{ label: t('delete'), type: 'danger', onClick: () => deleteEvent(row.uid) }
]
const userTableData = reactive({ const userTableData = reactive({
page: 1, page: 1,
limit: 10, limit: 10,

View File

@ -1,6 +1,6 @@
<template> <template>
<div ref="pageRef" class="main-container table-fill-page" :style="pageStyle"> <div class="main-container">
<el-card class="box-card !border-none table-fill-page__card" shadow="never"> <el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<span class="text-lg">{{pageName}}</span> <span class="text-lg">{{pageName}}</span>
@ -25,9 +25,8 @@
<el-button type="primary" @click="addEvent" :disabled="loading">{{ t('addAppVersion') }}</el-button> <el-button type="primary" @click="addEvent" :disabled="loading">{{ t('addAppVersion') }}</el-button>
</div> </div>
<div class="mt-[10px] table-fill-page__panel"> <div class="mt-[10px]">
<div class="table-fill-page__table"> <el-table :data="appVersionTable.data" size="large" v-loading="appVersionTable.loading">
<el-table height="100%" :data="appVersionTable.data" size="large" v-loading="appVersionTable.loading">
<template #empty> <template #empty>
<span>{{ !appVersionTable.loading ? t('emptyData') : '' }}</span> <span>{{ !appVersionTable.loading ? t('emptyData') : '' }}</span>
</template> </template>
@ -64,7 +63,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="t('operation')" fixed="right" align="right" min-width="280"> <el-table-column :label="t('operation')" fixed="right" align="right" min-width="200px">
<template #default="{ row }"> <template #default="{ row }">
<el-button type="primary" link v-if="row.release_time == 0" @click="editEvent(row)">{{ t('edit') }}</el-button> <el-button type="primary" link v-if="row.release_time == 0" @click="editEvent(row)">{{ t('edit') }}</el-button>
<el-button type="primary" link v-if="row.status == 'upload_success'" @click="releaseEvent(row)">{{ t('release') }}</el-button> <el-button type="primary" link v-if="row.status == 'upload_success'" @click="releaseEvent(row)">{{ t('release') }}</el-button>
@ -75,7 +74,6 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</div>
<div class="mt-[16px] flex justify-end"> <div class="mt-[16px] flex justify-end">
<el-pagination v-model:current-page="appVersionTable.page" v-model:page-size="appVersionTable.limit" <el-pagination v-model:current-page="appVersionTable.page" v-model:page-size="appVersionTable.limit"
layout="total, sizes, prev, pager, next, jumper" :total="appVersionTable.total" layout="total, sizes, prev, pager, next, jumper" :total="appVersionTable.total"
@ -111,15 +109,10 @@ import { useRoute, useRouter } from 'vue-router'
import { Terminal, TerminalFlash } from 'vue-web-terminal' import { Terminal, TerminalFlash } from 'vue-web-terminal'
import 'vue-web-terminal/lib/theme/dark.css' import 'vue-web-terminal/lib/theme/dark.css'
import { getAuthInfo } from '@/app/api/module' import { getAuthInfo } from '@/app/api/module'
import { useTablePageHeight } from '@/hooks/useTablePageHeight'
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const pageName = route.meta.title const pageName = route.meta.title
// 表格占满页面剩余高度,超出部分在表格内部滚动
const { pageRef, pageStyle } = useTablePageHeight()
const activeName = ref('/channel/app/version') const activeName = ref('/channel/app/version')
const terminalRef: any = ref(null) const terminalRef: any = ref(null)
const appVersionTable = reactive({ const appVersionTable = reactive({
@ -321,7 +314,7 @@ const authElMessageBox = () => {
cancelButtonText: t('toNiucloud') cancelButtonText: t('toNiucloud')
} }
).then(() => { ).then(() => {
router.push({ path: '/admin/tools/authorize' }) router.push({ path: '/app/authorize' })
}).catch((action: string) => { }).catch((action: string) => {
if (action === 'cancel') { if (action === 'cancel') {
window.open('https://www.niucloud.com/app') window.open('https://www.niucloud.com/app')

View File

@ -48,7 +48,9 @@
<template v-if="weappConfig.is_authorization"> <template v-if="weappConfig.is_authorization">
<el-button type="primary" plain @click="cencelAuth" >{{ t("取消授权") }}</el-button> <el-button type="primary" plain @click="cencelAuth" >{{ t("取消授权") }}</el-button>
<el-tooltip class="box-item" effect="light" placement="top"> <el-tooltip class="box-item" effect="light" placement="top">
<span class="iconfont iconwenhao text-[#999] !text-[14px] ml-[5px]"></span> <el-icon color="#666" size="15px" class="ml-[5px]">
<QuestionFilled />
</el-icon>
<template #content> <template #content>
<div> <div>
<div> <div>

View File

@ -1,28 +1,27 @@
<template> <template>
<!--小程序发布--> <!--小程序发布-->
<div ref="pageRef" class="main-container table-fill-page" :style="pageStyle"> <div class="main-container">
<el-card class="card !border-none table-fill-page__card" shadow="never"> <el-card class="card !border-none" shadow="never">
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<span class="text-page-title">{{ pageName }}</span> <span class="text-page-title">{{ pageName }}</span>
</div> </div>
<!-- 页签、按钮、版本信息之间的纵向间距由 .table-fill-page 容器的 gap 承担,自身不再加外边距,避免叠加出多余留白 --> <el-tabs v-model="activeName" class="my-[20px]" @tab-change="handleClick">
<el-tabs v-model="activeName" @tab-change="handleClick">
<el-tab-pane :label="t('weappAccessFlow')" name="/channel/weapp" /> <el-tab-pane :label="t('weappAccessFlow')" name="/channel/weapp" />
<el-tab-pane :label="t('subscribeMessage')" name="/channel/weapp/message" /> <el-tab-pane :label="t('subscribeMessage')" name="/channel/weapp/message" />
<el-tab-pane :label="t('weappRelease')" name="/channel/weapp/code" /> <el-tab-pane :label="t('weappRelease')" name="/channel/weapp/code" />
</el-tabs> </el-tabs>
<div v-if="!weappConfig.is_authorization"> <div class="mt-[20px]" v-if="!weappConfig.is_authorization">
<el-button type="primary" @click="openDialog" :loading="uploading" :disabled="loading">{{ t('cloudRelease') }}</el-button> <el-button type="primary" @click="openDialog" :loading="uploading" :disabled="loading">{{ t('cloudRelease') }}</el-button>
<el-button @click="localInsert" :disabled="loading">{{ t('localRelease') }}</el-button> <el-button @click="localInsert" :disabled="loading">{{ t('localRelease') }}</el-button>
</div> </div>
<div v-else> <div class="mt-[20px]" v-else>
<el-button type="primary" @click="againUpload" :loading="uploading" :disabled="loading">{{ t('uploadWeapp') }}</el-button> <el-button type="primary" @click="againUpload" :loading="uploading" :disabled="loading">{{ t('uploadWeapp') }}</el-button>
</div> </div>
<div class="text-[14px]" v-if="hasVersionInfo"> <div class="text-[14px] mt-[15px]">
<div class="flex items-center"> <div class="flex items-center">
<div v-if="weappTableData.version_info.release_version"> <div v-if="weappTableData.version_info.release_version">
线上版本: <span class="mr-10 text-primary">{{ weappTableData.version_info.release_version }}</span> 线上版本: <span class="mr-10 text-primary">{{ weappTableData.version_info.release_version }}</span>
@ -41,8 +40,7 @@
</div> </div>
</div> </div>
<div class="table-fill-page__table mt-[15px]"> <el-table class="mt-[15px]" :data="weappTableData.data" v-loading="weappTableData.loading" size="default">
<el-table height="100%" :data="weappTableData.data" v-loading="weappTableData.loading" size="default">
<template #empty> <template #empty>
<span>{{ t('emptyData') }}</span> <span>{{ t('emptyData') }}</span>
</template> </template>
@ -54,23 +52,20 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="create_time" :label="t('createTime')" align="center" /> <el-table-column prop="create_time" :label="t('createTime')" align="center" />
<el-table-column :label="t('operation')" fixed="right" align="right" min-width="250"> <el-table-column :label="t('operation')" fixed="right" align="right" min-width="120">
<template #default="{ row, $index }"> <template #default="{ row, $index }">
<template v-if="previewContent && $index == 0 && (row.status == 1 || row.status == 2) && weappTableData.page == 1"> <template v-if="previewContent && $index == 0 && (row.status == 1 || row.status == 2) && weappTableData.page == 1">
<el-tooltip :content="previewContent" raw-content effect="light"> <el-tooltip :content="previewContent" raw-content effect="light">
<el-button type="primary" link>{{ t('preview') }}</el-button> <el-button type="primary" link>{{ t('preview') }}</el-button>
</el-tooltip> </el-tooltip>
</template> </template>
<el-button type="primary" link @click="handleDetail(row)">{{ t('detail') }}</el-button> <el-button type="primary" link v-if="row.status == -1 || row.status == -2" @click="handleFailReason(row)">{{ t('failReason') }}</el-button>
<!-- 回退:用该成功版本保留的源码包重新提交发布任务 -->
<el-button type="primary" link v-if="($index > 0 || weappTableData.page > 1) && canRollback(row)" @click="rollbackVersion(row)">{{ t('rollback') }}</el-button>
<el-button type="primary" link v-if="row.status == -2" @click="againUpload(row)" :loading="uploading">{{ t('againUpload') }}</el-button> <el-button type="primary" link v-if="row.status == -2" @click="againUpload(row)" :loading="uploading">{{ t('againUpload') }}</el-button>
<el-button type="primary" link v-if="row.status == 2" @click="undoAuditFn(row)">{{ t('undoAudit') }}</el-button> <el-button type="primary" link v-if="row.status == 2" @click="undoAuditFn(row)">{{ t('undoAudit') }}</el-button>
<el-button class="table-delete" link @click="delVersion(row)">{{ t('delete') }}</el-button> <el-button type="danger" link @click="delVersion(row)">{{ t('delete') }}</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div>
<div class="mt-[16px] flex justify-end"> <div class="mt-[16px] flex justify-end">
<el-pagination v-model:current-page="weappTableData.page" v-model:page-size="weappTableData.limit" <el-pagination v-model:current-page="weappTableData.page" v-model:page-size="weappTableData.limit"
@ -151,43 +146,41 @@
</template> </template>
</el-dialog> </el-dialog>
<!-- 发布前校验:通过后创建任务并打开任务详情 --> <el-dialog v-model="uploadSuccessShowDialog" :title="t('warning')" width="500px" draggable>
<el-dialog v-model="checkVisible" title="发布前校验" width="580px" <span v-html="t('uploadSuccessTips')"></span>
:close-on-click-modal="false" :close-on-press-escape="false"> <template #footer>
<div class="min-h-[150px]"> <div class="flex justify-end">
<verify-panel v-if="checkVisible" scene="weapp_upload" :params="checkParams" <el-button @click="knownToKnow" type="primary">{{ t('knownToKnow') }}</el-button>
:auto-next="true" :auto-next-delay="500" :show-prev="false" <el-button @click="uploadSuccessShowDialog = false" type="primary" plain>{{ t('confirm') }}</el-button>
:next-text="t('nextStep')" @next="onCheckPassed" />
</div> </div>
</template>
</el-dialog> </el-dialog>
</div> </div>
<component :is="WeappUpload" ref="weappUploadRef" @success="getWeappVersionListFn" @error="getWeappVersionListFn" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { reactive, ref, computed, nextTick, watch } from 'vue' import { reactive, ref } from 'vue'
import { getWeappPreview, getWeappVersionList, getWeappConfig, deleteVersion } from '@/app/api/weapp' import { setWeappVersion, getWeappPreview, getWeappVersionList, getWeappUploadLog, getWeappConfig, deleteVersion } from '@/app/api/weapp'
import { t } from '@/lang' import { t } from '@/lang'
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import { getAuthInfo } from '@/app/api/module' import { getAuthInfo } from '@/app/api/module'
import { getAppType } from '@/utils/common' import { getAppType } from '@/utils/common'
import { ElMessageBox, ElMessage } from 'element-plus' import { ElMessageBox } from 'element-plus'
import { AnyObject } from '@/types/global' import { AnyObject } from '@/types/global'
import Storage from '@/utils/storage'
import { siteWeappCommit, undoAudit } from "@/app/api/wxoplatform"; import { siteWeappCommit, undoAudit } from "@/app/api/wxoplatform";
import { createTask } from '@/app/api/task' import WeappUpload from '@/app/components/weappupload/index.vue'
import VerifyPanel from '@/app/components/verify-panel/index.vue' // 使用导入的组件,避免未读取警告
import useTaskRunnerStore from '@/stores/modules/taskRunner' const WeappUploadComponent = WeappUpload
import { useTablePageHeight } from '@/hooks/useTablePageHeight'
const runner = useTaskRunnerStore()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const pageName = route.meta.title const pageName = route.meta.title
// 表格占满页面剩余高度,超出部分在表格内部滚动
const { pageRef, pageStyle } = useTablePageHeight()
const dialogVisible = ref(false) const dialogVisible = ref(false)
const loading = ref(true) const loading = ref(true)
const weappUploadRef = ref<any>(null)
const weappTableData:{ const weappTableData:{
page: number, page: number,
@ -211,6 +204,7 @@ const form = ref({
code2: '0', code2: '0',
code3: '0' code3: '0'
}) })
const uploadSuccessShowDialog = ref(false)
const authCode = ref('') const authCode = ref('')
getAuthInfo().then(res => { getAuthInfo().then(res => {
@ -297,12 +291,6 @@ const formRules = reactive({
} }
] ]
}); });
/** 版本信息为空时不渲染该区块:空区块仍会占掉容器 gap,多出一段空白 */
const hasVersionInfo = computed(() => {
const info = weappTableData.version_info || {}
return !!(info.release_version || info.release_time || info.exp_version || info.exp_time)
})
/** /**
* 获取版本列表 * 获取版本列表
*/ */
@ -318,6 +306,12 @@ const getWeappVersionListFn = (page?: number) => {
weappTableData.data = res.data.data weappTableData.data = res.data.data
weappTableData.total = res.data.total weappTableData.total = res.data.total
weappTableData.version_info = res.data.version_info weappTableData.version_info = res.data.version_info
const uploadingTask = res.data.data.find((d: any) => d.status == 0)
if (uploadingTask && weappUploadRef.value) {
weappUploadRef.value.setTask(uploadingTask)
weappUploadRef.value.open(uploadingTask.task_key, uploadingTask)
}
}).catch(() => { }).catch(() => {
weappTableData.loading = false weappTableData.loading = false
}) })
@ -359,93 +353,64 @@ const handleCloseCloudVersion = () => {
} }
} }
// ==================== 发布(校验 -> 任务 -> 详情) ==================== const save = () => {
const uploading = ref(false) cloudRuleFormRef.value.validate((valid: boolean) => {
/** 本次发起的发布任务标识(终态时刷新列表) */ if (valid) {
const runningTaskKey = ref('') if (form.value.type == 2) {
const checkVisible = ref(false) form.value.version = `${form.value.code1}.${form.value.code2}.${form.value.code3}`
/** 校验通过后的动作:upload 云端发布(创建任务)/ commit 已授权站点提交(同步调用) */
const pendingAction = ref<'upload' | 'commit'>('upload')
/** 待发布的版本号(空 = 按站点版本递增自动生成) */
const pendingVersion = ref('')
const checkParams = computed(() => ({
version: pendingVersion.value,
mode: pendingAction.value
}))
/**
* 发起发布:先做发布前校验(授权码 / 小程序配置 / 上传占用 / 云端连通),通过后再执行
* @param action upload 云端发布 | commit 已授权站点提交
* @param version 自定义版本号(空则自动递增)
*/
const startCheck = (action: 'upload' | 'commit', version: string = '') => {
if (checkVisible.value) return
pendingAction.value = action
pendingVersion.value = version
checkVisible.value = true
} }
delete form.value.code1
/** 校验通过:云端发布创建任务并打开任务详情;已授权站点提交仍为一次性同步调用 */ delete form.value.code2
const onCheckPassed = () => { delete form.value.code3
// verify-panel 的 next 是 setTimeout 回调,同步销毁自身会 patch 已卸载的 vnode delete form.value.type
nextTick(() => { checkVisible.value = false }) cloudVersionDialogVisible.value = false
insert()
const action = pendingAction.value
const version = pendingVersion.value
pendingVersion.value = ''
if (action === 'commit') {
doSiteCommit()
return
} }
previewContent.value = ''
uploading.value = true
// 先占位打开任务详情:创建期间不留空窗
runner.openPendingDetail('weapp_upload', '正在发起发布')
createTask('weapp_upload', { version }).then((res: any) => {
uploading.value = false
const key = res?.data?.task_key
if (!key) {
runner.closePendingDetail()
ElMessage.error('发布任务创建失败')
return
}
// 全局抽屉打开任务详情:不离开当前页,发布过程可随时关闭继续操作
runner.openDetail(key, 'weapp_upload')
runningTaskKey.value = key
getWeappVersionListFn()
}).catch((err: any) => {
uploading.value = false
runner.closePendingDetail()
ElMessage({ message: err?.msg || err?.message || '发布任务创建失败', type: 'error' })
}) })
} }
/** 已授权站点的小程序提交:一次性同步调用,无中间过程,保持原逻辑 */ const uploading = ref(false)
const doSiteCommit = () => { const insert = () => {
if (!authCode.value) {
authElMessageBox()
return
}
if (!weappConfig.value.app_id) {
configElMessageBox()
return
}
if (uploading.value) {
const ref = weappUploadRef.value
if (ref && ref.cloudBuildTask && ref.cloudBuildTask.task_key) {
ref.open(ref.cloudBuildTask.task_key, ref.cloudBuildTask)
} else if (ref) {
ref.showDialog = true
}
return
}
uploading.value = true uploading.value = true
siteWeappCommit().then(() => {
getWeappVersionListFn() previewContent.value = ''
setWeappVersion(form.value).then(res => {
const versionId = res.data
getWeappVersionListFn().then(() => {
const item = weappTableData.data.find((d: any) => d.id === versionId)
if (item && item.task_key) {
const ref = weappUploadRef.value
if (ref) {
ref.open(item.task_key, item)
}
}
getWeappPreviewImage() getWeappPreviewImage()
uploading.value = false uploading.value = false
}).catch(() => { }).catch(() => {
uploading.value = false uploading.value = false
}) })
} }).catch(() => {
uploading.value = false
const save = () => {
cloudRuleFormRef.value.validate((valid: boolean) => {
if (valid) {
// 自定义版本:1.0.0 形式;默认则由后端按站点版本递增
const version = form.value.type == 2
? `${form.value.code1}.${form.value.code2}.${form.value.code3}`
: ''
cloudVersionDialogVisible.value = false
handleCloseCloudVersion()
startCheck('upload', version)
}
}) })
} }
@ -464,6 +429,62 @@ const getWeappPreviewImage = () => {
}).catch() }).catch()
} }
const currentUploadKey = ref<string | null>(null)
const uploadPollingCount = ref(0)
const maxPollingCount = 150
const getWeappUploadLogFn = (key: string) => {
if (!key) return
if (currentUploadKey.value !== key) {
currentUploadKey.value = key
uploadPollingCount.value = 0
}
uploadPollingCount.value++
if (uploadPollingCount.value > maxPollingCount) {
currentUploadKey.value = null
uploadPollingCount.value = 0
uploading.value = false
return
}
getWeappUploadLog(key).then(res => {
if (currentUploadKey.value !== key) return
const data = (res.data && res.data.data) ? res.data.data : []
if (data[0] && data[0].length) {
const last = data[0][data[0].length - 1]
if (last.code == 0) {
currentUploadKey.value = null
uploadPollingCount.value = 0
getWeappVersionListFn()
return
}
if (last.code == 1 && last.percent == 100) {
currentUploadKey.value = null
uploadPollingCount.value = 0
getWeappVersionListFn()
getWeappPreviewImage()
!Storage.get('weappUploadTipsLock') && (uploadSuccessShowDialog.value = true)
return
}
}
if (currentUploadKey.value === key) {
setTimeout(() => {
getWeappUploadLogFn(key)
}, 2000)
}
}).catch(() => {
if (currentUploadKey.value === key) {
setTimeout(() => {
getWeappUploadLogFn(key)
}, 2000)
}
})
}
const authElMessageBox = () => { const authElMessageBox = () => {
if (getAppType() == 'admin') { if (getAppType() == 'admin') {
ElMessageBox.confirm( ElMessageBox.confirm(
@ -475,7 +496,7 @@ const authElMessageBox = () => {
cancelButtonText: t('toNiucloud') cancelButtonText: t('toNiucloud')
} }
).then(() => { ).then(() => {
router.push({ path: '/admin/tools/authorize' }) router.push({ path: '/app/authorize' })
}).catch((action: string) => { }).catch((action: string) => {
if (action === 'cancel') { if (action === 'cancel') {
window.open('https://www.niucloud.com/app') window.open('https://www.niucloud.com/app')
@ -518,49 +539,6 @@ const undoAuditFn = (data: any) => {
}) })
} }
/**
* 是否可回退:上传成功(status=1)且保留了上传时的源码包
* 源码包由发布任务保留并登记,历史记录没有包时无法回退
*/
const canRollback = (row: any) => Number(row.status) === 1 && !!row.source_zip
/**
* 版本回退:用该版本保留的源码包重新提交一次发布任务
* 会生成一条新的版本记录(版本号沿用被回退的版本),过程在任务详情查看
*/
const rollbackVersion = (row: any) => {
ElMessageBox.confirm(
`确认回退到版本 ${ row.version }?${ t('rollbackTips') }`,
t('rollback'),
{
confirmButtonText: t('confirm'),
cancelButtonText: t('cancel'),
type: 'warning'
}
).then(() => {
// 先占位打开任务详情:创建期间不留空窗
runner.openPendingDetail('weapp_upload', '正在发起回退')
createTask('weapp_upload', {
version: row.version,
source_zip: row.source_zip
}).then((res: any) => {
const key = res?.data?.task_key
if (!key) {
runner.closePendingDetail()
ElMessage.error('回退任务创建失败')
return
}
runner.openDetail(key, 'weapp_upload')
runningTaskKey.value = key
getWeappVersionListFn()
}).catch((err: any) => {
runner.closePendingDetail()
ElMessage({ message: err?.msg || err?.message || '回退任务创建失败', type: 'error' })
})
}).catch(() => {
})
}
/** /**
* 删除版本 * 删除版本
* @param data * @param data
@ -582,39 +560,32 @@ const delVersion = (data: any) => {
const failReason = ref('') const failReason = ref('')
const failReasonDialogVisible = ref(false) const failReasonDialogVisible = ref(false)
const handleFailReason = (data: any) => {
/** failReason.value = data.fail_reason
* 查看失败原因 failReasonDialogVisible.value = true
* 上传失败(-1):任务里保留了完整的执行日志与失败原因,优先打开任务详情;
* 查不到任务(任务记录已清理 / 改造前的历史记录)时回退为失败原因弹窗。
* 审核失败(-2)由微信审核产生,没有对应任务,仍走弹窗。
*/
const handleDetail = (data: any) => {
runner.openDetail(String(data.upload_task_key), 'weapp_upload')
} }
const helpInfo = () => { const helpInfo = () => {
window.open('https://doc.press.niucloud.com/php/saas-framework/use/configFAQ/minWaChatUpload.html') window.open('https://doc.press.niucloud.com/php/saas-framework/use/configFAQ/minWaChatUpload.html')
} }
/** 上传小程序(已授权站点):同样先做发布前校验,通过后提交 */ const knownToKnow = () => {
const againUpload = () => { Storage.set({ key: 'weappUploadTipsLock', data: true })
if (uploading.value) return uploadSuccessShowDialog.value = false
startCheck('commit')
} }
/** const againUpload = () => {
* 发布任务结束后刷新列表 if (uploading.value) return
* 版本状态(成功 / 失败)由任务回写,这里只负责把最新结果同步到页面 uploading.value = true
*/
watch(() => runningTaskKey.value ? String(runner.tasks[ runningTaskKey.value ]?.status ?? '') : '', (status) => { siteWeappCommit().then(() => {
if (!status) return
if ([ 'success', 'failed', 'canceled' ].includes(status)) {
getWeappVersionListFn() getWeappVersionListFn()
getWeappPreviewImage() getWeappPreviewImage()
runningTaskKey.value = '' uploading.value = false
} }).catch(() => {
uploading.value = false
}) })
}
</script> </script>
<style lang="scss" scoped></style> <style lang="scss" scoped></style>

View File

@ -1,7 +1,7 @@
<template> <template>
<!--自动回复--> <!--自动回复-->
<div ref="pageRef" class="main-container table-fill-page" :style="pageStyle"> <div class="main-container">
<el-card class="card !border-none table-fill-page__card" shadow="never"> <el-card class="card !border-none" shadow="never">
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<span class="text-page-title">{{ t('title') }}</span> <span class="text-page-title">{{ t('title') }}</span>
@ -14,21 +14,20 @@
<el-tab-pane :label="t('reply')" name="/channel/wechat/reply" /> <el-tab-pane :label="t('reply')" name="/channel/wechat/reply" />
</el-tabs> </el-tabs>
<div class="table-fill-page__panel"> <div>
<el-radio-group v-model="replyType" style="margin-bottom: 30px"> <el-radio-group v-model="replyType" style="margin-bottom: 30px">
<el-radio-button label="keyword">{{ t('keywordReply') }}</el-radio-button> <el-radio-button label="keyword">{{ t('keywordReply') }}</el-radio-button>
<el-radio-button label="default">{{ t('defaultReply') }}</el-radio-button> <el-radio-button label="default">{{ t('defaultReply') }}</el-radio-button>
<el-radio-button label="subscribe">{{ t('subscribeReply') }}</el-radio-button> <el-radio-button label="subscribe">{{ t('subscribeReply') }}</el-radio-button>
</el-radio-group> </el-radio-group>
<div v-show="replyType == 'keyword'" class="table-fill-page__panel"> <div v-show="replyType == 'keyword'">
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<el-button type="primary" @click="addKeywordsReply">新建回复</el-button> <el-button type="primary" @click="addKeywordsReply">新建回复</el-button>
</div> </div>
<div class="mt-[10px] table-fill-page__panel"> <div class="mt-[10px]">
<div class="table-fill-page__table"> <el-table :data="replyTableData.data" size="large" v-loading="replyTableData.loading">
<el-table height="100%" :data="replyTableData.data" size="large" v-loading="replyTableData.loading">
<template #empty> <template #empty>
<span>{{ !replyTableData.loading ? t('emptyData') : '' }}</span> <span>{{ !replyTableData.loading ? t('emptyData') : '' }}</span>
</template> </template>
@ -51,7 +50,6 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div>
<div class="mt-[16px] flex justify-end"> <div class="mt-[16px] flex justify-end">
<el-pagination v-model:current-page="replyTableData.page" v-model:page-size="replyTableData.limit" <el-pagination v-model:current-page="replyTableData.page" v-model:page-size="replyTableData.limit"
@ -91,15 +89,11 @@ import {
} from '@/app/api/wechat' } from '@/app/api/wechat'
import ReplyForm from '@/app/views/channel/wechat/components/reply-form.vue' import ReplyForm from '@/app/views/channel/wechat/components/reply-form.vue'
import { ElMessageBox } from 'element-plus' import { ElMessageBox } from 'element-plus'
import { useTablePageHeight } from '@/hooks/useTablePageHeight'
const router = useRouter() const router = useRouter()
const activeName = ref('/channel/wechat/reply') const activeName = ref('/channel/wechat/reply')
const replyType = ref('keyword') const replyType = ref('keyword')
// 表格占满页面剩余高度,超出部分在表格内部滚动
const { pageRef, pageStyle } = useTablePageHeight()
const addKeywordsReply = () => { const addKeywordsReply = () => {
router.push('/channel/wechat/keyword_reply_edit') router.push('/channel/wechat/keyword_reply_edit')
} }

View File

@ -10,7 +10,7 @@
<el-table-column :label="t('dataValue')" prop="value" /> <el-table-column :label="t('dataValue')" prop="value" />
<el-table-column :label="t('sort')" align="center" min-width="100px" prop="sort" /> <el-table-column :label="t('sort')" align="center" min-width="100px" prop="sort" />
<el-table-column :label="t('memo')" prop="memo" /> <el-table-column :label="t('memo')" prop="memo" />
<el-table-column :label="t('operation')" align="right" fixed="right" width="140"> <el-table-column :label="t('operation')" align="right" fixed="right" width="120">
<template #default="{ row, $index }"> <template #default="{ row, $index }">
<el-button type="primary" link @click="editEvent(row, $index)">{{ t('edit') }}</el-button> <el-button type="primary" link @click="editEvent(row, $index)">{{ t('edit') }}</el-button>
<el-button type="primary" link @click="deleteEvent($index)">{{ t('delete') }}</el-button> <el-button type="primary" link @click="deleteEvent($index)">{{ t('delete') }}</el-button>

View File

@ -1,6 +1,6 @@
<template> <template>
<el-dialog v-model="showDialog" :title="formData.id ? t('updateDict') : t('addDict')" width="480" class="diy-dialog-wrap" :destroy-on-close="true"> <el-dialog v-model="showDialog" :title="formData.id ? t('updateDict') : t('addDict')" width="480" class="diy-dialog-wrap" :destroy-on-close="true">
<el-form :model="formData" label-width="100px" ref="formRef" :rules="formRules" class="page-form" v-loading="loading"> <el-form :model="formData" label-width="120px" ref="formRef" :rules="formRules" class="page-form" v-loading="loading">
<el-form-item :label="t('name')" prop="name"> <el-form-item :label="t('name')" prop="name">
<el-input v-model.trim="formData.name" clearable maxlength="40" show-word-limit :placeholder="t('namePlaceholder')" class="input-width" /> <el-input v-model.trim="formData.name" clearable maxlength="40" show-word-limit :placeholder="t('namePlaceholder')" class="input-width" />
</el-form-item> </el-form-item>

View File

@ -1,9 +1,16 @@
<template> <template>
<!--数据字典--> <!--数据字典-->
<div ref="pageRef" class="main-container table-fill-page" :style="pageStyle"> <div class="main-container">
<div class="table-fill-page__card"> <el-card class="box-card !border-none" shadow="never">
<el-card class="box-card !border-none table-search-wrap table-search-wrap--panel table-fill-page__search" shadow="never"> <div class="flex justify-between items-center">
<span class="text-page-title">{{pageName}}</span>
<el-button type="primary" @click="addEvent">
{{ t('addDict') }}
</el-button>
</div>
<el-card class="box-card !border-none my-[10px] table-search-wrap" shadow="never">
<el-form :inline="true" :model="dictTable.searchParam" ref="searchFormRef"> <el-form :inline="true" :model="dictTable.searchParam" ref="searchFormRef">
<el-form-item :label="t('name')" prop="name"> <el-form-item :label="t('name')" prop="name">
<el-input v-model.trim="dictTable.searchParam.name" :placeholder="t('namePlaceholder')" /> <el-input v-model.trim="dictTable.searchParam.name" :placeholder="t('namePlaceholder')" />
@ -19,16 +26,8 @@
</el-form> </el-form>
</el-card> </el-card>
<div class="table-panel table-fill-page__panel"> <div class="mt-[10px]">
<table-toolbar :title="pageName" :selectable="false"> <el-table :data="dictTable.data" size="large" v-loading="dictTable.loading">
<template #actions>
<el-button type="primary" @click="addEvent">
{{ t('addDict') }}
</el-button>
</template>
</table-toolbar>
<div class="table-fill-page__table">
<el-table height="100%" :data="dictTable.data" size="large" v-loading="dictTable.loading">
<template #empty> <template #empty>
<span>{{ !dictTable.loading ? t('emptyData') : '' }}</span> <span>{{ !dictTable.loading ? t('emptyData') : '' }}</span>
</template> </template>
@ -36,26 +35,25 @@
<el-table-column prop="key" :label="t('key')" min-width="120" /> <el-table-column prop="key" :label="t('key')" min-width="120" />
<el-table-column prop="memo" :label="t('memo')" min-width="120" /> <el-table-column prop="memo" :label="t('memo')" min-width="120" />
<el-table-column prop="create_time" :label="t('createTime')" min-width="120" /> <el-table-column prop="create_time" :label="t('createTime')" min-width="120" />
<el-table-column :label="t('operation')" align="right" fixed="right" min-width="200"> <el-table-column :label="t('operation')" align="right" fixed="right" min-width="120">
<template #default="{ row }"> <template #default="{ row }">
<table-actions :actions="rowActions(row)" /> <el-button type="primary" link @click="dictData(row)">{{ t('dictData') }}</el-button>
<el-button type="primary" link @click="editEvent(row)">{{ t('edit') }}</el-button>
<el-button type="primary" link @click="deleteEvent(row.id)">{{ t('delete') }}</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="mt-[16px] flex justify-end">
<el-pagination v-model:current-page="dictTable.page" v-model:page-size="dictTable.limit"
layout="total, sizes, prev, pager, next, jumper" :total="dictTable.total"
@size-change="loadDictList()" @current-change="loadDictList" />
</div> </div>
<table-pagination
v-model:current-page="dictTable.page"
v-model:page-size="dictTable.limit"
:total="dictTable.total"
@size-change="loadDictList()"
@current-change="loadDictList"
/>
</div> </div>
<edit ref="editDictDialog" @complete="loadDictList" /> <edit ref="editDictDialog" @complete="loadDictList" />
<dict ref="dictDialog" @complete="loadDictList" /> <dict ref="dictDialog" @complete="loadDictList" />
</div> </el-card>
</div> </div>
</template> </template>
@ -67,26 +65,10 @@ import { ElMessageBox } from 'element-plus'
import type { FormInstance } from 'element-plus' import type { FormInstance } from 'element-plus'
import Edit from '@/app/views/dict/components/edit.vue' import Edit from '@/app/views/dict/components/edit.vue'
import dict from '@/app/views/dict/components/dict.vue' import dict from '@/app/views/dict/components/dict.vue'
import TableActions from '@/components/table-actions/index.vue'
import TablePagination from '@/components/table-pagination/index.vue'
import TableToolbar from '@/components/table-toolbar/index.vue'
import { useRoute } from 'vue-router' import { useRoute } from 'vue-router'
import { useTablePageHeight } from '@/hooks/useTablePageHeight'
const route = useRoute() const route = useRoute()
const pageName = route.meta.title as string const pageName = route.meta.title
// 表格占满页面剩余高度,超出部分在表格内部滚动
const { pageRef, pageStyle } = useTablePageHeight()
/**
* 表格行内操作:超过 2 个自动收进「更多」
*/
const rowActions = (row: any) => [
{ label: t('edit'), onClick: () => editEvent(row) },
{ label: t('dictData'), onClick: () => dictData(row) },
{ label: t('delete'), type: 'danger' as const, onClick: () => deleteEvent(row.id) }
]
const dictTable = reactive({ const dictTable = reactive({
page: 1, page: 1,

View File

@ -278,23 +278,23 @@ const showTitleStyle = () => {
const titleStyleList = reactive([ const titleStyleList = reactive([
{ {
url: 'static/resource/images/diy/active_cube/title_style1_new.png', url: 'static/resource/images/diy/active_cube/title_style1.png',
title: '风格1', title: '风格1',
value: 'style-1' value: 'style-1'
}, { }, {
url: 'static/resource/images/diy/active_cube/title_style2_new.png', url: 'static/resource/images/diy/active_cube/title_style2.png',
title: '风格2', title: '风格2',
value: 'style-2' value: 'style-2'
}, { }, {
url: 'static/resource/images/diy/active_cube/title_style3_new.png', url: 'static/resource/images/diy/active_cube/title_style3.png',
title: '风格3', title: '风格3',
value: 'style-3' value: 'style-3'
}, { }, {
url: 'static/resource/images/diy/active_cube/title_style5_new.png', url: 'static/resource/images/diy/active_cube/title_style5.png',
title: '风格4', title: '风格4',
value: 'style-4' value: 'style-4'
}, { }, {
url: 'static/resource/images/diy/active_cube/title_style6_new.png', url: 'static/resource/images/diy/active_cube/title_style6.png',
title: '风格5', title: '风格5',
value: 'style-5' value: 'style-5'
} }

View File

@ -2,31 +2,6 @@
<!-- 内容 --> <!-- 内容 -->
<div class="content-wrap" v-show="diyStore.editTab == 'content'"> <div class="content-wrap" v-show="diyStore.editTab == 'content'">
<div class="edit-attr-item-wrap">
<h3 class="mb-[10px]">{{ t('carouselSearchHeaderSet') }}</h3>
<el-form label-width="100px" class="px-[10px]" @submit.prevent>
<el-form-item :label="t('carouselSearchHeaderBackIsShow')">
<el-switch v-model="diyStore.editComponent.header.backIsShow" />
</el-form-item>
<el-form-item :label="t('carouselSearchHeaderTitleIsShow')">
<el-switch v-model="headerTitleIsShow" :disabled="headerTitleDisabled" />
</el-form-item>
<el-form-item :label="t('carouselSearchHeaderTitle')" v-if="diyStore.editComponent.header.titleIsShow && !headerTitleDisabled">
<el-input v-model.trim="diyStore.editComponent.header.title" :placeholder="t('carouselSearchHeaderTitlePlaceholder')" clearable maxlength="10" show-word-limit />
</el-form-item>
<el-form-item :label="t('carouselSearchHeaderPositionIsShow')">
<el-switch v-model="headerPositionIsShow" :disabled="headerPositionDisabled" />
</el-form-item>
<el-form-item :label="t('carouselSearchHeaderTextColor')">
<el-color-picker v-model="diyStore.editComponent.header.textColor" :disabled="headerTextColorDisabled" show-alpha :predefine="diyStore.predefineColors" />
</el-form-item>
<el-form-item :label="t('carouselSearchHeaderIconColor')">
<el-color-picker v-model="diyStore.editComponent.header.iconColor" show-alpha :predefine="diyStore.predefineColors" />
</el-form-item>
<div class="text-sm text-gray-400 leading-[1.5]">{{ t(headerTipsKey) }}</div>
</el-form>
</div>
<div class="edit-attr-item-wrap"> <div class="edit-attr-item-wrap">
<h3 class="mb-[10px]">{{ t('carouselSearchShowPosition') }}</h3> <h3 class="mb-[10px]">{{ t('carouselSearchShowPosition') }}</h3>
<el-form label-width="100px" class="px-[10px]"> <el-form label-width="100px" class="px-[10px]">
@ -353,8 +328,7 @@
import { t } from '@/lang' import { t } from '@/lang'
import { img } from '@/utils/common' import { img } from '@/utils/common'
import useDiyStore from '@/stores/modules/diy' import useDiyStore from '@/stores/modules/diy'
import { ref, reactive, watch, onMounted, nextTick, computed } from 'vue' import { ref, reactive, watch, onMounted, nextTick } from 'vue'
import { useRoute } from 'vue-router'
import { ElTable } from 'element-plus' import { ElTable } from 'element-plus'
import Sortable from 'sortablejs' import Sortable from 'sortablejs'
import { range, cloneDeep } from 'lodash-es' import { range, cloneDeep } from 'lodash-es'
@ -362,104 +336,35 @@ import { range, cloneDeep } from 'lodash-es'
import { getDiyPageListByCarouselSearch } from '@/app/api/diy' import { getDiyPageListByCarouselSearch } from '@/app/api/diy'
const diyStore = useDiyStore() const diyStore = useDiyStore()
const route = useRoute()
diyStore.editComponent.ignore = ['componentBgColor', 'componentBgUrl', 'marginTop', 'marginBottom', 'topRounded', 'bottomRounded', 'pageBgColor', 'marginBoth'] // 忽略公共属性 diyStore.editComponent.ignore = ['componentBgColor', 'componentBgUrl', 'marginTop', 'marginBottom', 'topRounded', 'bottomRounded', 'pageBgColor', 'marginBoth'] // 忽略公共属性
// 顶部标题栏默认标题,按当前所在应用区分
const defaultHeaderTitle = () => {
const titleMap: Record<string, string> = {
mall: '商城'
}
return titleMap[(route.meta.addon as string) || ''] || '商城'
}
// 顶部标题栏配置,兼容未保存过该字段/字段不全的历史数据
// 默认值口径与后端组件字典(ComponentDict.php)保持一致:返回箭头关 / 标题关 / 地址定位开
const headerDefaults = {
backIsShow: false, // 返回箭头
titleIsShow: false, // 标题
title: defaultHeaderTitle(), // 标题文字
positionIsShow: true, // 地址定位
textColor: '#333333', // 文字颜色
iconColor: '#333333' // 图标颜色
}
diyStore.editComponent.header = Object.assign({}, headerDefaults, diyStore.editComponent.header || {})
// 内嵌内容行的风格:返回箭头并入内容行左侧,不使用通用标题栏
// 风格1(返回箭头在搜索行)、风格2(返回箭头在生活圈行、地址定位在搜索行)、风格3(返回箭头在地址定位左侧)
const isEmbedStyle = computed(() => {
const style = diyStore.editComponent.search.style
return style == 'style-1' || style == 'style-2' || style == 'style-3'
})
// 标题:三种内嵌风格的行内都没有标题位,一律禁止开启
const headerTitleDisabled = computed(() => isEmbedStyle.value)
// 地址定位:风格1 行内没有定位位;风格2/3 的定位都内嵌在搜索框左侧,仍由该开关控制
const headerPositionDisabled = computed(() => {
const style = diyStore.editComponent.search.style
return style == 'style-1'
})
// 文字颜色:风格1 行内没有文字元素;风格2/3 的地址定位文字仍受该颜色控制
const headerTextColorDisabled = computed(() => headerPositionDisabled.value)
// 禁用的开关强制显示为关闭且不可操作,避免误开启;
// 仅影响展示,不改写已保存的值,切回其它风格后可恢复原有设置
const headerTitleIsShow = computed({
get: () => (headerTitleDisabled.value ? false : diyStore.editComponent.header.titleIsShow),
set: (val: boolean) => {
diyStore.editComponent.header.titleIsShow = val
}
})
const headerPositionIsShow = computed({
get: () => (headerPositionDisabled.value ? false : diyStore.editComponent.header.positionIsShow),
set: (val: boolean) => {
diyStore.editComponent.header.positionIsShow = val
}
})
// 顶部标题栏提示文案,按当前风格给出对应说明
const headerTipsKey = computed(() => {
const style = diyStore.editComponent.search.style
if (style == 'style-1') return 'carouselSearchHeaderStyle1Tips'
if (style == 'style-2') return 'carouselSearchHeaderStyle2Tips'
return 'carouselSearchHeaderTips'
})
// 组件验证 // 组件验证
diyStore.editComponent.verify = (index: number) => { diyStore.editComponent.verify = (index: number) => {
const res = { code: true, message: '' } const res = { code: true, message: '' }
const component = diyStore.value[index]
if (!component) return res
const hotWordList = component.search?.hotWord?.list diyStore.value[index].search.hotWord.list.forEach((item: any) => {
if (Array.isArray(hotWordList)) {
hotWordList.forEach((item: any) => {
if (item.text == '') { if (item.text == '') {
res.code = false res.code = false
res.message = t('carouselSearchHotWordTextPlaceholder') res.message = t('carouselSearchHotWordTextPlaceholder')
return res return res
} }
}) })
}
const tabList = component.tab?.list diyStore.value[index].tab.list.forEach((item: any) => {
if (Array.isArray(tabList)) {
tabList.forEach((item: any) => {
if (item.text == '') { if (item.text == '') {
res.code = false res.code = false
res.message = t('carouselSearchTabCategoryTextPlaceholder') res.message = t('carouselSearchTabCategoryTextPlaceholder')
return res return res
} }
// if(item.diy_id == ''){
// res.code = false
// res.message = t('selectDiyPagePlaceholder')
// return res
// }
}) })
}
if (component.swiper?.control) { if (diyStore.value[index].swiper.control) {
const swiperList = component.swiper?.list diyStore.value[index].swiper.list.forEach((item: any) => {
if (Array.isArray(swiperList)) {
swiperList.forEach((item: any) => {
if (item.imageUrl == '') { if (item.imageUrl == '') {
res.code = false res.code = false
res.message = t('imageUrlTip') res.message = t('imageUrlTip')
@ -467,7 +372,6 @@ diyStore.editComponent.verify = (index: number) => {
} }
}) })
} }
}
return res return res
} }
@ -512,15 +416,17 @@ const searchStyleList = reactive([
/** ************ 搜索框样式选择-end ********************/ /** ************ 搜索框样式选择-end ********************/
const ensureListItemId = (list: any) => { diyStore.editComponent.search.hotWord.list.forEach((item: any) => {
if (!Array.isArray(list)) return if (!item.id) item.id = diyStore.generateRandom()
list.forEach((item: any) => { })
diyStore.editComponent.tab.list.forEach((item: any) => {
if (!item.id) item.id = diyStore.generateRandom()
})
diyStore.editComponent.swiper.list.forEach((item: any) => {
if (!item.id) item.id = diyStore.generateRandom() if (!item.id) item.id = diyStore.generateRandom()
}) })
}
ensureListItemId(diyStore.editComponent?.search?.hotWord?.list)
ensureListItemId(diyStore.editComponent?.tab?.list)
ensureListItemId(diyStore.editComponent?.swiper?.list)
const activeNames = ref(['tab', 'swiper']) const activeNames = ref(['tab', 'swiper'])
const handleChange = (val: string[]) => { const handleChange = (val: string[]) => {
@ -683,10 +589,8 @@ const diyPageShowDialogOpen = (index: any) => {
} }
watch( watch(
() => diyStore.editComponent?.swiper?.list, () => diyStore.editComponent.swiper.list,
(list) => { (newValue, oldValue) => {
// 切换 isShow 等场景下组件数据可能短暂不完整,直接跳过
if (!Array.isArray(list)) return
// 设置图片宽高 // 设置图片宽高
handleHeight() handleHeight()
}, },
@ -713,15 +617,12 @@ const changeSwiperStyle = (value: any) => {
// 处理高度 // 处理高度
const handleHeight = (isCalcHeight: boolean = false) => { const handleHeight = (isCalcHeight: boolean = false) => {
const list = diyStore.editComponent?.swiper?.list diyStore.editComponent.swiper.list.forEach((item: any, index: number) => {
if (!Array.isArray(list)) return
list.forEach((item: any, index: number) => {
if (!item?.imageUrl) return
const image = new Image() const image = new Image()
image.src = img(item.imageUrl) image.src = img(item.imageUrl)
image.onload = () => { image.onload = async () => {
if (item.imgWidth !== image.width) item.imgWidth = image.width item.imgWidth = image.width
if (item.imgHeight !== image.height) item.imgHeight = image.height item.imgHeight = image.height
// 计算第一张图片高度 // 计算第一张图片高度
if (isCalcHeight && index == 0) { if (isCalcHeight && index == 0) {
const ratio = item.imgHeight / item.imgWidth const ratio = item.imgHeight / item.imgWidth

View File

@ -1,117 +0,0 @@
<template>
<!-- 内容:客服快捷浮窗(链接固定为系统客服,不可更换;位置固定右侧中部,仅可偏移) -->
<div class="content-wrap float-btn" v-show="diyStore.editTab == 'content'">
<div class="edit-attr-item-wrap">
<h3 class="mb-[10px]">{{ t('floatBtnButton') }}</h3>
<el-form label-width="80px" class="px-[10px]">
<el-form-item :label="t('floatBtnOffset')">
<el-slider v-model="diyStore.editComponent.offset" show-input size="small" class="ml-[10px] diy-nav-slider" :min="-100" :max="100" />
</el-form-item>
<el-form-item :label="t('lateralBtnOffset')">
<el-slider v-model="diyStore.editComponent.lateralOffset" show-input size="small" class="ml-[10px] diy-nav-slider" :max="15" :min="-10" />
</el-form-item>
</el-form>
</div>
<div class="edit-attr-item-wrap">
<h3 class="mb-[10px]">{{ t('floatBtnImageSet') }}</h3>
<el-form label-width="80px" class="px-[10px]">
<el-form-item :label="t('floatBtnImageSize')">
<el-slider v-model="diyStore.editComponent.imageSize" show-input size="small" class="ml-[10px] diy-nav-slider" :min="30" :max="100" />
</el-form-item>
<div class="text-[12px] text-[#999] mb-[15px] mt-[5px]">{{ t('floatBtnImageCircle') }}</div>
<div ref="imageBoxRef">
<div v-for="(item,index) in diyStore.editComponent.list" :key="item.id || index"
class="item-wrap p-[10px] pb-0 relative border border-dashed border-gray-300 mb-[16px]">
<el-form-item :label="t('image')">
<upload-image v-model="item.imageUrl" :limit="1" />
</el-form-item>
<el-form-item :label="t('link')">
<el-input :model-value="CUSTOMER_LINK.title" disabled />
<div class="text-[12px] text-[#999] mt-[4px]">{{ t('floatBtnCustomerLinkTip') }}</div>
</el-form-item>
</div>
</div>
</el-form>
</div>
</div>
<!-- 样式 -->
<div class="style-wrap" v-show="diyStore.editTab == 'style'">
<slot name="style"></slot>
</div>
</template>
<script lang="ts" setup>
import { ref, onMounted } from 'vue'
import { t } from '@/lang'
import useDiyStore from '@/stores/modules/diy'
/** 系统客服链接(与 LinkDict MEMBER_CONTACT 一致,不可更换) */
const CUSTOMER_LINK = {
name: 'MEMBER_CONTACT',
parent: 'MEMBER_LINK',
title: '客服',
url: '/app/pages/member/contact',
action: ''
}
/** 固定右侧中部(黄框区域),不可选四角 */
const FIXED_POSITION = 'middleRight'
const diyStore = useDiyStore()
diyStore.editComponent.ignore = ['pageBgColor', 'marginTop', 'marginBottom', 'marginBoth', 'componentBgUrl']
/** 始终写回固定客服链接与位置,防止历史数据或脏数据被改掉 */
const lockCustomerLink = () => {
diyStore.editComponent.aroundRadius = 50
diyStore.editComponent.bottomPosition = FIXED_POSITION
if (!Array.isArray(diyStore.editComponent.list) || !diyStore.editComponent.list.length) {
diyStore.editComponent.list = [{
id: diyStore.generateRandom(),
imageUrl: '',
link: { ...CUSTOMER_LINK }
}]
return
}
// 客服浮窗仅保留一个入口
diyStore.editComponent.list = diyStore.editComponent.list.slice(0, 1).map((item: any) => ({
...item,
id: item.id || diyStore.generateRandom(),
link: { ...CUSTOMER_LINK }
}))
}
lockCustomerLink()
diyStore.editComponent.verify = (index: number) => {
const res = { code: true, message: '' }
const list = diyStore.value[index]?.list || []
// 保存时强制位置
diyStore.value[index].bottomPosition = FIXED_POSITION
for (const item of list) {
if (!item.imageUrl) {
res.code = false
res.message = t('imageUrlTip')
return res
}
// 保存前再锁一次链接
item.link = { ...CUSTOMER_LINK }
}
return res
}
const imageBoxRef = ref()
onMounted(() => {
lockCustomerLink()
})
defineExpose({})
</script>
<style lang="scss" scoped>
</style>

View File

@ -158,16 +158,12 @@ import { range } from 'lodash-es'
import useDiyStore from '@/stores/modules/diy' import useDiyStore from '@/stores/modules/diy'
const diyStore = useDiyStore() const diyStore = useDiyStore()
if (diyStore.editComponent) {
diyStore.editComponent.ignore = [] // 忽略公共属性 diyStore.editComponent.ignore = [] // 忽略公共属性
}
// 组件验证 // 组件验证
diyStore.editComponent.verify = (index: number) => { diyStore.editComponent.verify = (index: number) => {
const res = { code: true, message: '' } const res = { code: true, message: '' }
const list = diyStore.value[index]?.list
if (!Array.isArray(list)) return res
list.forEach((item: any) => { diyStore.value[index].list.forEach((item: any) => {
if ((diyStore.value[index].mode === 'graphic' || diyStore.value[index].mode === 'img') && item.imageUrl === '') { if ((diyStore.value[index].mode === 'graphic' || diyStore.value[index].mode === 'img') && item.imageUrl === '') {
res.code = false res.code = false
res.message = t('imageUrlTip') res.message = t('imageUrlTip')
@ -182,25 +178,20 @@ diyStore.editComponent.verify = (index: number) => {
return res return res
} }
if (Array.isArray(diyStore.editComponent?.list)) {
diyStore.editComponent.list.forEach((item: any) => { diyStore.editComponent.list.forEach((item: any) => {
if (!item.id) item.id = diyStore.generateRandom() if (!item.id) item.id = diyStore.generateRandom()
}) })
}
watch( watch(
() => diyStore.editComponent?.list, () => diyStore.editComponent.list,
(list) => { (newValue, oldValue) => {
// 切换 isShow 等场景下 editComponent 可能短暂非当前组件,list 为空需直接跳过 // 设置图片宽高
if (!Array.isArray(list)) return diyStore.editComponent.list.forEach((item: any) => {
// 设置图片宽高(仅在尺寸变化时写入,避免 deep watch 反复触发)
list.forEach((item: any) => {
if (!item?.imageUrl) return
const image = new Image() const image = new Image()
image.src = img(item.imageUrl) image.src = img(item.imageUrl)
image.onload = () => { image.onload = async () => {
if (item.imgWidth !== image.width) item.imgWidth = image.width item.imgWidth = image.width
if (item.imgHeight !== image.height) item.imgHeight = image.height item.imgHeight = image.height
} }
}) })
}, },

View File

@ -100,15 +100,6 @@
<el-tooltip effect="light" :content="t('resetComponent')" placement="right"> <el-tooltip effect="light" :content="t('resetComponent')" placement="right">
<icon name="iconfont iconloader-line" size="20px" class="block cursor-pointer leading-[40px]" @click="diyStore.resetComponent" /> <icon name="iconfont iconloader-line" size="20px" class="block cursor-pointer leading-[40px]" @click="diyStore.resetComponent" />
</el-tooltip> </el-tooltip>
<el-tooltip effect="light" :content="componentIsShow ? t('componentHideAction') : t('componentShowAction')" placement="right">
<el-icon
:size="20"
class="block flex items-center justify-center cursor-pointer leading-[40px] mx-auto h-[40px]"
@click="componentIsShow = !componentIsShow"
>
<component :is="componentIsShow ? View : Hide" />
</el-icon>
</el-tooltip>
</ul> </ul>
<!-- 组件预览渲染区域 --> <!-- 组件预览渲染区域 -->
@ -147,27 +138,6 @@
<div class="edit-component-wrap"> <div class="edit-component-wrap">
<!-- 样式 Tab:所有装修组件通用显示/隐藏(不依赖各组件 style 插槽) -->
<div class="edit-attr-item-wrap" v-if="diyStore.currentIndex >= 0 && diyStore.editTab == 'style'">
<h3 class="mb-[10px]">{{ t('componentIsShowTitle') }}</h3>
<el-form label-width="90px" class="px-[10px]">
<el-form-item>
<template #label>
<div class="flex items-center">
<span class="mr-[3px]">{{ t('componentIsShow') }}</span>
<el-tooltip effect="light" placement="top">
<template #content>
<p>{{ t('componentIsShowTips') }}</p>
</template>
<span class="iconfont iconwenhao text-[#999] !text-[14px]"></span>
</el-tooltip>
</div>
</template>
<el-switch v-model="componentIsShow" />
</el-form-item>
</el-form>
</div>
<component v-if="diyStore.currentComponent" :is="modules[diyStore.currentComponent]" :key="diyStore.currentIndex" :value="diyStore.value[diyStore.currentIndex]"> <component v-if="diyStore.currentComponent" :is="modules[diyStore.currentComponent]" :key="diyStore.currentIndex" :value="diyStore.value[diyStore.currentIndex]">
<template #style> <template #style>
<div class="edit-attr-item-wrap"> <div class="edit-attr-item-wrap">
@ -243,9 +213,9 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, reactive, toRaw, watch, inject, defineAsyncComponent, computed } from 'vue' import { ref, reactive, toRaw, watch, inject, defineAsyncComponent } from 'vue'
import { t } from '@/lang' import { t } from '@/lang'
import { ArrowLeft, View, Hide } from "@element-plus/icons-vue" import { ArrowLeft } from "@element-plus/icons-vue"
import { img } from '@/utils/common' import { img } from '@/utils/common'
import { getDiyTemplatePages, addDiyPage, editDiyPage, initPage } from '@/app/api/diy' import { getDiyTemplatePages, addDiyPage, editDiyPage, initPage } from '@/app/api/diy'
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
@ -261,17 +231,6 @@ const diyStore = useDiyStore()
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
// 无 isShow 时默认 true(显示),开关默认开启
const componentIsShow = computed({
get: () => diyStore.currentIndex >= 0 && diyStore.editComponent?.isShow !== false,
set: (val: boolean) => {
// 仅当前选中装修组件时可改,避免切页/同步瞬间写到错误对象触发子组件 watch 报错
if (diyStore.currentIndex >= 0 && diyStore.editComponent && diyStore.editComponent.componentName) {
diyStore.editComponent.isShow = val
}
}
})
route.query.id = route.query.id || 0 route.query.id = route.query.id || 0
route.query.name = route.query.name || '' route.query.name = route.query.name || ''
route.query.url = route.query.url || '' // 页面路径 route.query.url = route.query.url || '' // 页面路径
@ -387,10 +346,8 @@ const changeTemplatePage = (value: any) => {
if (value) { if (value) {
let data = cloneDeep(templatePages[value].data); let data = cloneDeep(templatePages[value].data);
diyStore.global = data.global; diyStore.global = data.global;
diyStore.ensureTemplateIsShow()
if (data.value.length) { if (data.value.length) {
diyStore.value = data.value diyStore.value = data.value
diyStore.normalizeComponentIsShow()
} }
} else { } else {
if (route.query.title) diyStore.global.title = diyStore.typeName if (route.query.title) diyStore.global.title = diyStore.typeName
@ -404,10 +361,8 @@ const changeTemplatePage = (value: any) => {
if (value) { if (value) {
let data = cloneDeep(templatePages[value].data) let data = cloneDeep(templatePages[value].data)
diyStore.global = data.global diyStore.global = data.global
diyStore.ensureTemplateIsShow()
if (data.value.length) { if (data.value.length) {
diyStore.value = data.value diyStore.value = data.value
diyStore.normalizeComponentIsShow()
} }
} else { } else {
if (route.query.title) diyStore.global.title = diyStore.typeName if (route.query.title) diyStore.global.title = diyStore.typeName
@ -469,10 +424,8 @@ initPage({
if (data.value) { if (data.value) {
const sources = JSON.parse(data.value) const sources = JSON.parse(data.value)
diyStore.global = sources.global diyStore.global = sources.global
diyStore.ensureTemplateIsShow()
if (sources.value.length) { if (sources.value.length) {
diyStore.value = sources.value diyStore.value = sources.value
diyStore.normalizeComponentIsShow()
// diyStore.changeCurrentIndex(0,diyStore.value[0]); // diyStore.changeCurrentIndex(0,diyStore.value[0]);
} }
} else { } else {
@ -606,7 +559,6 @@ window.addEventListener('message', (event) => {
diyStore.changeCurrentIndex(data.index, data.component) diyStore.changeCurrentIndex(data.index, data.component)
diyStore.global = data.global diyStore.global = data.global
diyStore.value = data.value diyStore.value = data.value
diyStore.normalizeComponentIsShow()
break break
} }
} catch (e) { } catch (e) {

View File

@ -1,13 +1,13 @@
<template> <template>
<div ref="pageRef" class="main-container table-fill-page" :style="pageStyle"> <div class="main-container">
<el-card class="box-card !border-none table-fill-page__card" shadow="never"> <el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<span class="text-page-title">{{ pageName }}</span> <span class="text-page-title">{{ pageName }}</span>
<el-button type="primary" class="w-[100px]" @click="dialogVisible = true">{{ t('addDiyPage') }}</el-button> <el-button type="primary" class="w-[100px]" @click="dialogVisible = true">{{ t('addDiyPage') }}</el-button>
</div> </div>
<el-card class="box-card !border-none my-[10px] table-search-wrap table-fill-page__search" shadow="never"> <el-card class="box-card !border-none my-[10px] table-search-wrap" shadow="never">
<el-form :inline="true" :model="diyPageTableData.searchParam" ref="searchFormDiyPageRef"> <el-form :inline="true" :model="diyPageTableData.searchParam" ref="searchFormDiyPageRef">
<el-form-item :label="t('title')" prop="title"> <el-form-item :label="t('title')" prop="title">
<el-input v-model.trim="diyPageTableData.searchParam.title" :placeholder="t('titlePlaceholder')" /> <el-input v-model.trim="diyPageTableData.searchParam.title" :placeholder="t('titlePlaceholder')" />
@ -31,8 +31,7 @@
</el-form> </el-form>
</el-card> </el-card>
<div class="table-fill-page__table"> <el-table :data="diyPageTableData.data" size="large" v-loading="diyPageTableData.loading">
<el-table height="100%" :data="diyPageTableData.data" size="large" v-loading="diyPageTableData.loading">
<template #empty> <template #empty>
<span>{{ !diyPageTableData.loading ? t('emptyData') : '' }}</span> <span>{{ !diyPageTableData.loading ? t('emptyData') : '' }}</span>
</template> </template>
@ -51,7 +50,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="update_time" :label="t('updateTime')" min-width="120" /> <el-table-column prop="update_time" :label="t('updateTime')" min-width="120" />
<el-table-column :label="t('operation')" fixed="right" align="right" min-width="340"> <el-table-column :label="t('operation')" fixed="right" align="right" min-width="160">
<template #default="{ row }"> <template #default="{ row }">
<el-button type="primary" link @click="toPreview(row)">{{ t('preview') }}</el-button> <el-button type="primary" link @click="toPreview(row)">{{ t('preview') }}</el-button>
<el-button v-if="row.is_default == 0" type="primary" link @click="setUse(row.id)">{{ t('use') }}</el-button> <el-button v-if="row.is_default == 0" type="primary" link @click="setUse(row.id)">{{ t('use') }}</el-button>
@ -63,7 +62,6 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</div>
<div class="mt-[16px] flex justify-end"> <div class="mt-[16px] flex justify-end">
<el-pagination v-model:current-page="diyPageTableData.page" v-model:page-size="diyPageTableData.limit" <el-pagination v-model:current-page="diyPageTableData.page" v-model:page-size="diyPageTableData.limit"
layout="total, sizes, prev, pager, next, jumper" :total="diyPageTableData.total" layout="total, sizes, prev, pager, next, jumper" :total="diyPageTableData.total"
@ -133,15 +131,11 @@ import { getApps, getDiyPageList, deleteDiyPage, getDiyTemplate, editDiyPageShar
import { ElMessageBox, FormInstance } from 'element-plus' import { ElMessageBox, FormInstance } from 'element-plus'
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import { setTablePageStorage, getTablePageStorage } from '@/utils/common' import { setTablePageStorage, getTablePageStorage } from '@/utils/common'
import { useTablePageHeight } from '@/hooks/useTablePageHeight'
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const pageName = route.meta.title const pageName = route.meta.title
// 表格占满页面剩余高度,超出部分在表格内部滚动
const { pageRef, pageStyle } = useTablePageHeight()
const pageType: any = reactive({}) // 页面类型 const pageType: any = reactive({}) // 页面类型
// 添加自定义页面 // 添加自定义页面

View File

@ -1,12 +1,12 @@
<template> <template>
<div ref="pageRef" class="main-container table-fill-page" :style="pageStyle"> <div class="main-container">
<el-card class="box-card !border-none table-fill-page__card" shadow="never"> <el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<span class="text-page-title">{{pageName}}</span> <span class="text-page-title">{{pageName}}</span>
</div> </div>
<el-card class="box-card !border-none my-[10px] table-search-wrap table-fill-page__search" shadow="never"> <el-card class="box-card !border-none my-[10px] table-search-wrap" shadow="never">
<el-form :inline="true" :model="diyRouteTableData.searchParam" ref="searchFormDiyRouteRef"> <el-form :inline="true" :model="diyRouteTableData.searchParam" ref="searchFormDiyRouteRef">
<el-form-item :label="t('title')" prop="title"> <el-form-item :label="t('title')" prop="title">
<el-input v-model.trim="diyRouteTableData.searchParam.title" :placeholder="t('titlePlaceholder')" /> <el-input v-model.trim="diyRouteTableData.searchParam.title" :placeholder="t('titlePlaceholder')" />
@ -24,8 +24,7 @@
</el-form> </el-form>
</el-card> </el-card>
<div class="table-fill-page__table"> <el-table :data="diyRouteTableData.data" size="large" v-loading="diyRouteTableData.loading">
<el-table height="100%" :data="diyRouteTableData.data" size="large" v-loading="diyRouteTableData.loading">
<template #empty> <template #empty>
<span>{{ !diyRouteTableData.loading ? t('emptyData') : '' }}</span> <span>{{ !diyRouteTableData.loading ? t('emptyData') : '' }}</span>
</template> </template>
@ -54,7 +53,6 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div>
<div class="mt-[16px] flex justify-end"> <div class="mt-[16px] flex justify-end">
<el-pagination v-model:current-page="diyRouteTableData.page" v-model:page-size="diyRouteTableData.limit" layout="total, sizes, prev, pager, next, jumper" :total="diyRouteTableData.total" @size-change="getDiyRouteListFn" @current-change="loadDiyRouteList" /> <el-pagination v-model:current-page="diyRouteTableData.page" v-model:page-size="diyRouteTableData.limit" layout="total, sizes, prev, pager, next, jumper" :total="diyRouteTableData.total" @size-change="getDiyRouteListFn" @current-change="loadDiyRouteList" />
</div> </div>
@ -102,15 +100,11 @@ import { useRoute, useRouter } from 'vue-router'
import { useClipboard } from '@vueuse/core' import { useClipboard } from '@vueuse/core'
import { getUrl } from '@/app/api/sys' import { getUrl } from '@/app/api/sys'
import { cloneDeep } from 'lodash-es' import { cloneDeep } from 'lodash-es'
import { useTablePageHeight } from '@/hooks/useTablePageHeight'
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const pageName = route.meta.title const pageName = route.meta.title
// 表格占满页面剩余高度,超出部分在表格内部滚动
const { pageRef, pageStyle } = useTablePageHeight()
const pageTemplate: any = reactive({}) const pageTemplate: any = reactive({})
const formRef = ref<FormInstance>() const formRef = ref<FormInstance>()

View File

@ -1,13 +1,12 @@
<template> <template>
<div ref="pageRef" class="main-container table-fill-page" :style="pageStyle"> <div class="main-container">
<el-card class="box-card !border-none table-fill-page__card" shadow="never"> <el-card class="box-card !border-none" shadow="never">
<div class="flex justify-between items-center"> <div class="flex justify-between items-center">
<span class="text-page-title">{{ pageName }}</span> <span class="text-page-title">{{ pageName }}</span>
</div> </div>
<div class="table-fill-page__table mt-[20px]"> <el-table class="mt-[20px]" :data="bottomNavTableData.data" size="large" v-loading="bottomNavTableData.loading">
<el-table height="100%" :data="bottomNavTableData.data" size="large" v-loading="bottomNavTableData.loading">
<template #empty> <template #empty>
<span>{{ !bottomNavTableData.loading ? t('emptyData') : '' }}</span> <span>{{ !bottomNavTableData.loading ? t('emptyData') : '' }}</span>
</template> </template>
@ -32,7 +31,6 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div>
<div class="mt-[16px] flex justify-end"> <div class="mt-[16px] flex justify-end">
<el-pagination v-model:current-page="bottomNavTableData.page" v-model:page-size="bottomNavTableData.limit" <el-pagination v-model:current-page="bottomNavTableData.page" v-model:page-size="bottomNavTableData.limit"
@ -51,15 +49,11 @@
import { getDiyBottomList } from '@/app/api/diy' import { getDiyBottomList } from '@/app/api/diy'
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import { cloneDeep } from 'lodash-es' import { cloneDeep } from 'lodash-es'
import { useTablePageHeight } from '@/hooks/useTablePageHeight'
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const pageName = route.meta.title const pageName = route.meta.title
// 表格占满页面剩余高度,超出部分在表格内部滚动
const { pageRef, pageStyle } = useTablePageHeight()
const bottomNavTableData: any = reactive({ const bottomNavTableData: any = reactive({
page: 1, page: 1,
limit: 10, limit: 10,

View File

@ -28,7 +28,9 @@
<p>会自动将提交的个人信息做加密展示。</p> <p>会自动将提交的个人信息做加密展示。</p>
<p>适用于公开展示收集的数据且不暴露用户隐私。</p> <p>适用于公开展示收集的数据且不暴露用户隐私。</p>
</template> </template>
<span class="iconfont iconwenhao text-[#999] !text-[14px]"></span> <el-icon>
<QuestionFilled color="#999999" />
</el-icon>
</el-tooltip> </el-tooltip>
</div> </div>
</template> </template>

View File

@ -22,7 +22,9 @@
<p>{{ t('preventDuplicationTipsOne') }}</p> <p>{{ t('preventDuplicationTipsOne') }}</p>
<p>{{ t('preventDuplicationTipsTwo') }}</p> <p>{{ t('preventDuplicationTipsTwo') }}</p>
</template> </template>
<span class="iconfont iconwenhao text-[#999] !text-[14px]"></span> <el-icon>
<QuestionFilled color="#999999" />
</el-icon>
</el-tooltip> </el-tooltip>
</div> </div>
</template> </template>
@ -37,7 +39,9 @@
<p>{{ t('privacyProtectionTipsOne') }}</p> <p>{{ t('privacyProtectionTipsOne') }}</p>
<p>{{ t('privacyProtectionTipsTwo') }}</p> <p>{{ t('privacyProtectionTipsTwo') }}</p>
</template> </template>
<span class="iconfont iconwenhao text-[#999] !text-[14px]"></span> <el-icon>
<QuestionFilled color="#999999" />
</el-icon>
</el-tooltip> </el-tooltip>
</div> </div>
</template> </template>

View File

@ -13,7 +13,9 @@
<div class="flex items-center"> <div class="flex items-center">
<span class="mr-[3px]">{{ t('defaultValue') }}</span> <span class="mr-[3px]">{{ t('defaultValue') }}</span>
<el-tooltip effect="light" :content="t('defaultValueTips')" placement="top"> <el-tooltip effect="light" :content="t('defaultValueTips')" placement="top">
<span class="iconfont iconwenhao text-[#999] !text-[14px]"></span> <el-icon>
<QuestionFilled color="#999999" />
</el-icon>
</el-tooltip> </el-tooltip>
</div> </div>
</template> </template>
@ -33,7 +35,9 @@
<p>{{ t('preventDuplicationTipsOne') }}</p> <p>{{ t('preventDuplicationTipsOne') }}</p>
<p>{{ t('preventDuplicationTipsTwo') }}</p> <p>{{ t('preventDuplicationTipsTwo') }}</p>
</template> </template>
<span class="iconfont iconwenhao text-[#999] !text-[14px]"></span> <el-icon>
<QuestionFilled color="#999999" />
</el-icon>
</el-tooltip> </el-tooltip>
</div> </div>
</template> </template>

View File

@ -25,7 +25,9 @@
<p>{{ t('privacyProtectionTipsOne') }}</p> <p>{{ t('privacyProtectionTipsOne') }}</p>
<p>{{ t('privacyProtectionTipsTwo') }}</p> <p>{{ t('privacyProtectionTipsTwo') }}</p>
</template> </template>
<span class="iconfont iconwenhao text-[#999] !text-[14px]"></span> <el-icon>
<QuestionFilled color="#999999" />
</el-icon>
</el-tooltip> </el-tooltip>
</div> </div>
</template> </template>

View File

@ -22,7 +22,9 @@
<p>{{ t('preventDuplicationTipsOne') }}</p> <p>{{ t('preventDuplicationTipsOne') }}</p>
<p>{{ t('preventDuplicationTipsTwo') }}</p> <p>{{ t('preventDuplicationTipsTwo') }}</p>
</template> </template>
<span class="iconfont iconwenhao text-[#999] !text-[14px]"></span> <el-icon>
<QuestionFilled color="#999999" />
</el-icon>
</el-tooltip> </el-tooltip>
</div> </div>
</template> </template>
@ -37,7 +39,9 @@
<p>{{ t('privacyProtectionTipsOne') }}</p> <p>{{ t('privacyProtectionTipsOne') }}</p>
<p>{{ t('privacyProtectionTipsTwo') }}</p> <p>{{ t('privacyProtectionTipsTwo') }}</p>
</template> </template>
<span class="iconfont iconwenhao text-[#999] !text-[14px]"></span> <el-icon>
<QuestionFilled color="#999999" />
</el-icon>
</el-tooltip> </el-tooltip>
</div> </div>
</template> </template>

View File

@ -16,7 +16,9 @@
<div class="flex items-center"> <div class="flex items-center">
<span class="mr-[3px]">{{ t('defaultValue') }}</span> <span class="mr-[3px]">{{ t('defaultValue') }}</span>
<el-tooltip effect="light" :content="t('defaultValueTips')" placement="top"> <el-tooltip effect="light" :content="t('defaultValueTips')" placement="top">
<span class="iconfont iconwenhao text-[#999] !text-[14px]"></span> <el-icon>
<QuestionFilled color="#999999" />
</el-icon>
</el-tooltip> </el-tooltip>
</div> </div>
</template> </template>

View File

@ -13,7 +13,9 @@
<div class="flex items-center"> <div class="flex items-center">
<span class="mr-[3px]">{{ t('defaultValue') }}</span> <span class="mr-[3px]">{{ t('defaultValue') }}</span>
<el-tooltip effect="light" :content="t('defaultValueTips')" placement="top"> <el-tooltip effect="light" :content="t('defaultValueTips')" placement="top">
<span class="iconfont iconwenhao text-[#999] !text-[14px]"></span> <el-icon>
<QuestionFilled color="#999999" />
</el-icon>
</el-tooltip> </el-tooltip>
</div> </div>
</template> </template>

View File

@ -10,7 +10,9 @@
<div class="flex items-center"> <div class="flex items-center">
<span class="mr-[3px]">{{ t('上传方式') }}</span> <span class="mr-[3px]">{{ t('上传方式') }}</span>
<el-tooltip effect="light" :content="t('拍摄时长限制1分钟,从相册上传不限制时长。')" placement="top"> <el-tooltip effect="light" :content="t('拍摄时长限制1分钟,从相册上传不限制时长。')" placement="top">
<span class="iconfont iconwenhao text-[#999] !text-[14px]"></span> <el-icon>
<QuestionFilled color="#999999" />
</el-icon>
</el-tooltip> </el-tooltip>
</div> </div>
</template> </template>

View File

@ -68,7 +68,9 @@
<template #content> <template #content>
<p>{{ t('displayTextMessagesTips') }}</p> <p>{{ t('displayTextMessagesTips') }}</p>
</template> </template>
<span class="iconfont iconwenhao text-[#999] !text-[14px]"></span> <el-icon>
<QuestionFilled color="#999999" />
</el-icon>
</el-tooltip> </el-tooltip>
</el-radio> </el-radio>
<!-- todo 后续完善 --> <!-- todo 后续完善 -->
@ -114,7 +116,9 @@
<template #content> <template #content>
<p>{{ t('specifyTimeTips') }}</p> <p>{{ t('specifyTimeTips') }}</p>
</template> </template>
<span class="iconfont iconwenhao text-[#999] !text-[14px]"></span> <el-icon>
<QuestionFilled color="#999999" />
</el-icon>
</el-tooltip> </el-tooltip>
</el-radio> </el-radio>
<el-radio label="submission_time" class="!block"> <el-radio label="submission_time" class="!block">
@ -123,7 +127,9 @@
<template #content> <template #content>
<p class="w-[250px]">{{ t('submissionTimeTips') }}</p> <p class="w-[250px]">{{ t('submissionTimeTips') }}</p>
</template> </template>
<span class="iconfont iconwenhao text-[#999] !text-[14px]"></span> <el-icon>
<QuestionFilled color="#999999" />
</el-icon>
</el-tooltip> </el-tooltip>
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>

View File

@ -74,7 +74,9 @@
<template #content> <template #content>
<p class="w-[250px]">{{ t('writeTips') }}</p> <p class="w-[250px]">{{ t('writeTips') }}</p>
</template> </template>
<span class="iconfont iconwenhao text-[#999] !text-[14px]"></span> <el-icon>
<QuestionFilled color="#999999" />
</el-icon>
</el-tooltip> </el-tooltip>
</div> </div>
</el-form-item> </el-form-item>

Some files were not shown because too many files have changed in this diff Show More