2.1.0版本更新

This commit is contained in:
赵海雷 2026-10-17 19:26:55 +08:00
parent f1b4466bdb
commit 4dceaef8e1
323 changed files with 51634 additions and 37835 deletions

9
.gitignore vendored
View File

@ -20,3 +20,12 @@ bin-release/
/.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 生成,勿手工编辑)
uni-app/src/components/diy-dynamic-bridge-*/

106
README.md
View File

@ -1,81 +1,47 @@
### NIUCLOUD-ADMIN 是什么?
![输入图片说明](https://www.niucloud.com/img/readme/%E9%A1%B6%E9%83%A8%E5%B9%BF%E5%91%8A1.jpg)
niucloud-admin-saas是一款快速开发通用管理后台框架,整体功能架构全部精心设计!代码干净整洁!低耦合,高质量!!!前后端API接口完全分离!!!前端采用最新技术**Vite+TypeScript+Vue3+ElementPlus**,后台采用PHP8、MYSQL8、THINKPHP8 全部最新技术栈,内置Workman高性能消息队列,计划任务处理,完全兼容容器路由运行技术。 采用多租户多站点多应用多插件任意组合使用的SAAS架构设计,内置代码生成器,插件生成器,一键云编译、一键云部署,集成用户权限、表单设计、云存储、短信发送、素材中心、微信及公众号、Api模块一系列开箱即用功能,是一款快速搭建开发企业级应用的软件系统。源码100%开源无加密!框架采用MIT协议,终身免费,商用免费!
### niucloud-admin是什么?
niucloud-admin是一款快速开发通用管理后台框架,前端采用最新的技术栈Vite+TypeScript+Vue3+ElementPlus最流行技术架构,后台结合PHP8、Java SDK、Python等主流后端语言搭建,内置集成用户权限、代码生成器、表单设计、云存储、短信发送、素材中心、微信及公众号、Api模块一系列开箱即用功能,是一款快速可以开发企业级应用的软件系统。
目前NIUCLOUD生态开发者入驻近千人,各行业应用插件正在陆续上线中...
### niucloud-admin采用的技术亮点
请到官方网站了解更多[https://www.niucloud.com](https://gitee.com/link?target=https%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支持国际化多语言开发。
- 手机端采用uniapp前后端分离,使用uview、vue3.0、typescript、vite、pina前端技术,支持h5,微信小程序,支付宝小程序,抖音小程序等使用场景。
- niucloud-admin采用多租户的saas系统设计,支持多站点多商户多门店多应用多插件组合使用。
- 手机端采用uniapp前后端分离,同时使用uview、vue3.0、typescript、vite、pina等前端技术,同时使用i18n支持国际化多语言开发,可以灵活编译成h5,微信小程序,支付宝小程序,抖音小程序等使用场景。
- niucloud-admin采用多租户的saas系统设计,能够提供企业级软件服务运营 ,同时满足用户多站点,多商户,多门店等系统开发需求。
- niucloud-admin结合当前市面上很多框架结构不规范,导致基础结构不稳定等情况,严格定义了分层设计的开发规范,同时api接口严格采用restful的开发规范,能够满足大型业务系统或者微服务的开发需求。
- niucloud-admin前端以及后端采用严格的多语言开发规范,包括前端展示,api接口返回,数据验证,错误返回等全部使用多语言设计规范,使开发者能够真生意义上实现多语言的开发需求。
- niucloud-admin已经搭建好常规系统的开发底层,具体的底层功能包括:管理员管理,权限管理,网站设置,计划任务管理,素材管理,会员管理,会员账户管理,微信公众号以及小程序管理,
支付管理,第三方登录管理,消息管理,短信管理,文章管理,前端装修等全面的基础功能,这样开发者不需要开发基础的结构而专心开发业务。
- niucloud-admin已经搭建好常规系统的开发底层,具体的底层功能包括:管理员管理,权限管理,网站设置,计划任务管理,素材管理,会员管理,会员账户管理,微信公众号以及小程序管理,支付管理,第三方登录管理,消息管理,短信管理,文章管理,前端装修等全面的基础功能,这样开发者不需要开发基础的结构而专心开发业务。
- niucloud-admin系统内置支持微信/支付宝支付,微信公众号/小程序/短信消息管理,阿里云/腾讯云短信,七牛云/阿里云存储等基础的功能扩展,后续会根据实际业务不断扩展基础组件。
- niucloud-admin结合系统结构特点专门开发了代码生成器,这样开发者根据数据表就可以一键生成基础的业务代码,包括:后台php业务代码以及对应的前端vue代码。
- 前端采用标准的element-plus,开发者不需要详细了解前端,只需要用标准的element组件就可以。
- 手机端设计开发了自定义装修,同时提供了基础的开发组件,方便开发者设计开发手机自定义页面装修的开发需求。
```
### 商城插件SHOP
<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>
- 手机端使用uniapp ,同时使用uview页面展示,可以开发出丰富的手机样式,同时不需要专门学习小程序,app等开发语言,只需要通过uniapp编译就可以。
### 操作指南
* [官网地址](https://www.niucloud.com)
* [服务市场](https://www.niucloud.com)
* [使用手册](https://www.niucloud.com/doc)
* [二开手册](https://www.niucloud.com/doc)
* [开发视频](https://www.niucloud.com/doc)
* [API接口手册](https://api.niucloud.com/apidoc.html?target_id=001)
* [论坛地址](https://niucloud.com/bbs)
[官网地址](https://www.niucloud.com)
| [服务市场](https://www.niucloud.com)
| [使用手册](https://www.kancloud.cn/niucloud/niucloud-admin-develop/3153336)
| [二开手册](https://www.kancloud.cn/niucloud/niucloud-admin-develop/3153336)
| [API接口手册](https://www.niucloud.com/apidoc.html)
| [论坛地址](https://www.niucloud.com/bbs)
### 演示地址
- 平台后台演示网址:[<a href='https://v2-cs.site.niucloud.com/admin' target="_blank"> 查看 </a>]
<a href='https://v2-cs.site.niucloud.com/admin' target="_blank">https://v2-cs.site.niucloud.com/admin</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;">
- 站点后台演示网址:[<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 账号:test 密码:123456
- 平台后台演示网址:[<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
### 开源使用须知
@ -91,10 +57,14 @@ niucloud-admin-saas是一款快速开发通用管理后台框架,整体功能
6.一切事物有个人喜好的标准,本开源代码意在分享,不喜勿喷。
### 版权信息
版权所有Copyright © 2015-2026 niucloud-admin 版权所有
版权所有Copyright © 2015-2030 niucloud-admin 版权所有
All rights reserved。
杭州数字云动科技有限公司
杭州牛之云科技有限公司
提供技术支持
杭州数字云动科技有限公司
杭州牛之云科技有限公司
提供技术支持

View File

@ -8,4 +8,4 @@ VITE_IMG_DOMAIN=''
VITE_REQUEST_HEADER_TOKEN_KEY='token'
# 请求时header中站点的参数名
VITE_REQUEST_HEADER_SITEID_KEY='site-id'
VITE_REQUEST_HEADER_SITEID_KEY='site-id'

18
admin/README.md Normal file
View File

@ -0,0 +1,18 @@
# Vue 3 + TypeScript + Vite
This template should help get you started developing with Vue 3 and TypeScript in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
## Recommended IDE Setup
- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
## Type Support For `.vue` Imports in TS
TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types.
If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps:
1. Disable the built-in TypeScript Extension
1. Run `Extensions: Show Built-in Extensions` from VSCode's command palette
2. Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)`
2. Reload the VSCode window by running `Developer: Reload Window` from the command palette.

View File

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

39
admin/components.d.ts vendored
View File

@ -7,27 +7,20 @@ export {}
declare module '@vue/runtime-core' {
export interface GlobalComponents {
AddUser: typeof import('./src/components/add-user/index.vue')['default']
Attachment: typeof import('./src/components/upload-attachment/attachment.vue')['default']
DiyLink: typeof import('./src/components/diy-link/index.vue')['default']
DiyPage: typeof import('./src/components/diy-page/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']
ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']
ElButton: typeof import('element-plus/es')['ElButton']
ElCalendar: typeof import('element-plus/es')['ElCalendar']
ElCard: typeof import('element-plus/es')['ElCard']
ElCarousel: typeof import('element-plus/es')['ElCarousel']
ElCarouselItem: typeof import('element-plus/es')['ElCarouselItem']
ElCascader: typeof import('element-plus/es')['ElCascader']
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']
ElCollapse: typeof import('element-plus/es')['ElCollapse']
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
ElColorPicker: typeof import('element-plus/es')['ElColorPicker']
ElConfigProvider: typeof import('element-plus/es')['ElConfigProvider']
ElContainer: typeof import('element-plus/es')['ElContainer']
@ -35,12 +28,10 @@ declare module '@vue/runtime-core' {
ElDescriptions: typeof import('element-plus/es')['ElDescriptions']
ElDescriptionsItem: typeof import('element-plus/es')['ElDescriptionsItem']
ElDialog: typeof import('element-plus/es')['ElDialog']
ElDivider: typeof import('element-plus/es')['ElDivider']
ElDrawer: typeof import('element-plus/es')['ElDrawer']
ElDropdown: typeof import('element-plus/es')['ElDropdown']
ElDropdownItem: typeof import('element-plus/es')['ElDropdownItem']
ElDropdownMenu: typeof import('element-plus/es')['ElDropdownMenu']
ElEmpty: typeof import('element-plus/es')['ElEmpty']
ElForm: typeof import('element-plus/es')['ElForm']
ElFormItem: typeof import('element-plus/es')['ElFormItem']
ElHeader: typeof import('element-plus/es')['ElHeader']
@ -48,31 +39,16 @@ declare module '@vue/runtime-core' {
ElImage: typeof import('element-plus/es')['ElImage']
ElImageViewer: typeof import('element-plus/es')['ElImageViewer']
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']
ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
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']
ElPopover: typeof import('element-plus/es')['ElPopover']
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']
ElScrollbar: typeof import('element-plus/es')['ElScrollbar']
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']
ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable']
@ -80,15 +56,10 @@ declare module '@vue/runtime-core' {
ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs']
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']
ElTree: typeof import('element-plus/es')['ElTree']
ElTreeSelect: typeof import('element-plus/es')['ElTreeSelect']
ElUpload: typeof import('element-plus/es')['ElUpload']
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']
Icon: typeof import('./src/components/icon/index.vue')['default']
MapSelector: typeof import('./src/components/map-selector/index.vue')['default']
@ -100,6 +71,11 @@ declare module '@vue/runtime-core' {
SelectArea: typeof import('./src/components/select-area/index.vue')['default']
SelectIcon: typeof import('./src/components/select-icon/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']
UploadAudio: typeof import('./src/components/upload-audio/index.vue')['default']
UploadFile: typeof import('./src/components/upload-file/index.vue')['default']
@ -109,6 +85,7 @@ declare module '@vue/runtime-core' {
VerifyPoints: typeof import('./src/components/verifition/Verify/VerifyPoints.vue')['default']
VerifySlide: typeof import('./src/components/verifition/Verify/VerifySlide.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 {
vLoading: typeof import('element-plus/es')['ElLoadingDirective']

302
admin/package-lock.json generated
View File

@ -23,7 +23,7 @@
"date-fns": "^4.1.0",
"day": "^0.0.2",
"echarts": "5.4.1",
"element-plus": "2.7.4",
"element-plus": "^2.7.4",
"esbuild": "^0.16.17",
"highlight.js": "11.0.1",
"lodash-es": "4.17.21",
@ -32,8 +32,9 @@
"qrcode": "1.5.1",
"sass": "1.58.0",
"sortablejs": "1.15.0",
"v-code-diff": "^1.16.0",
"vditor": "^3.10.9",
"vue": "3.3.7",
"vue": "3.2.45",
"vue-i18n": "9.2.2",
"vue-jsonp": "2.0.0",
"vue-router": "4.1.6",
@ -1118,9 +1119,9 @@
}
},
"node_modules/@jridgewell/sourcemap-codec": {
"version": "1.5.5",
"resolved": "https://registry.npmmirror.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
"integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="
"version": "1.6.0",
"resolved": "https://registry.npmmirror.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz",
"integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw=="
},
"node_modules/@jridgewell/trace-mapping": {
"version": "0.3.20",
@ -1853,6 +1854,7 @@
"version": "3.3.7",
"resolved": "https://registry.npmmirror.com/@vue/compiler-core/-/compiler-core-3.3.7.tgz",
"integrity": "sha512-pACdY6YnTNVLXsB86YD8OF9ihwpolzhhtdLVHhBL6do/ykr6kKXNYABRtNMGrsQXpEXXyAdwvWWkuTbs4MFtPQ==",
"dev": true,
"dependencies": {
"@babel/parser": "^7.23.0",
"@vue/shared": "3.3.7",
@ -1864,6 +1866,7 @@
"version": "3.3.7",
"resolved": "https://registry.npmmirror.com/@vue/compiler-dom/-/compiler-dom-3.3.7.tgz",
"integrity": "sha512-0LwkyJjnUPssXv/d1vNJ0PKfBlDoQs7n81CbO6Q0zdL7H1EzqYRrTVXDqdBVqro0aJjo/FOa1qBAPVI4PGSHBw==",
"dev": true,
"dependencies": {
"@vue/compiler-core": "3.3.7",
"@vue/shared": "3.3.7"
@ -1873,6 +1876,7 @@
"version": "3.3.7",
"resolved": "https://registry.npmmirror.com/@vue/compiler-sfc/-/compiler-sfc-3.3.7.tgz",
"integrity": "sha512-7pfldWy/J75U/ZyYIXRVqvLRw3vmfxDo2YLMwVtWVNew8Sm8d6wodM+OYFq4ll/UxfqVr0XKiVwti32PCrruAw==",
"dev": true,
"dependencies": {
"@babel/parser": "^7.23.0",
"@vue/compiler-core": "3.3.7",
@ -1890,14 +1894,16 @@
"version": "0.30.21",
"resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-0.30.21.tgz",
"integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==",
"dev": true,
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.5.5"
}
},
"node_modules/@vue/compiler-sfc/node_modules/postcss": {
"version": "8.5.19",
"resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.5.19.tgz",
"integrity": "sha512-Mz8SaolMd8nB+G13WkORcxQKHZ/NE4xXevtkJHVuG+guo9/wYKlIMTKAqGdEmYOXR2ijPjTYNHssizdaVSUNdQ==",
"version": "8.5.28",
"resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.5.28.tgz",
"integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==",
"dev": true,
"funding": [
{
"type": "opencollective",
@ -1913,7 +1919,7 @@
}
],
"dependencies": {
"nanoid": "^3.3.12",
"nanoid": "^3.3.18",
"picocolors": "^1.1.1",
"source-map-js": "^1.2.1"
},
@ -1925,6 +1931,7 @@
"version": "3.3.7",
"resolved": "https://registry.npmmirror.com/@vue/compiler-ssr/-/compiler-ssr-3.3.7.tgz",
"integrity": "sha512-TxOfNVVeH3zgBc82kcUv+emNHo+vKnlRrkv8YvQU5+Y5LJGJwSNzcmLUoxD/dNzv0bhQ/F0s+InlgV0NrApJZg==",
"dev": true,
"dependencies": {
"@vue/compiler-dom": "3.3.7",
"@vue/shared": "3.3.7"
@ -1939,6 +1946,7 @@
"version": "3.3.7",
"resolved": "https://registry.npmmirror.com/@vue/reactivity/-/reactivity-3.3.7.tgz",
"integrity": "sha512-cZNVjWiw00708WqT0zRpyAgduG79dScKEPYJXq2xj/aMtk3SKvL3FBt2QKUlh6EHBJ1m8RhBY+ikBUzwc7/khg==",
"dev": true,
"dependencies": {
"@vue/shared": "3.3.7"
}
@ -1947,6 +1955,7 @@
"version": "3.3.7",
"resolved": "https://registry.npmmirror.com/@vue/reactivity-transform/-/reactivity-transform-3.3.7.tgz",
"integrity": "sha512-APhRmLVbgE1VPGtoLQoWBJEaQk4V8JUsqrQihImVqKT+8U6Qi3t5ATcg4Y9wGAPb3kIhetpufyZ1RhwbZCIdDA==",
"dev": true,
"dependencies": {
"@babel/parser": "^7.23.0",
"@vue/compiler-core": "3.3.7",
@ -1959,45 +1968,104 @@
"version": "0.30.21",
"resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-0.30.21.tgz",
"integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==",
"dev": true,
"dependencies": {
"@jridgewell/sourcemap-codec": "^1.5.5"
}
},
"node_modules/@vue/runtime-core": {
"version": "3.3.7",
"resolved": "https://registry.npmmirror.com/@vue/runtime-core/-/runtime-core-3.3.7.tgz",
"integrity": "sha512-LHq9du3ubLZFdK/BP0Ysy3zhHqRfBn80Uc+T5Hz3maFJBGhci1MafccnL3rpd5/3wVfRHAe6c+PnlO2PAavPTQ==",
"version": "3.2.45",
"resolved": "https://registry.npmmirror.com/@vue/runtime-core/-/runtime-core-3.2.45.tgz",
"integrity": "sha512-gzJiTA3f74cgARptqzYswmoQx0fIA+gGYBfokYVhF8YSXjWTUA2SngRzZRku2HbGbjzB6LBYSbKGIaK8IW+s0A==",
"dependencies": {
"@vue/reactivity": "3.3.7",
"@vue/shared": "3.3.7"
"@vue/reactivity": "3.2.45",
"@vue/shared": "3.2.45"
}
},
"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": {
"version": "3.3.7",
"resolved": "https://registry.npmmirror.com/@vue/runtime-dom/-/runtime-dom-3.3.7.tgz",
"integrity": "sha512-PFQU1oeJxikdDmrfoNQay5nD4tcPNYixUBruZzVX/l0eyZvFKElZUjW4KctCcs52nnpMGO6UDK+jF5oV4GT5Lw==",
"version": "3.2.45",
"resolved": "https://registry.npmmirror.com/@vue/runtime-dom/-/runtime-dom-3.2.45.tgz",
"integrity": "sha512-cy88YpfP5Ue2bDBbj75Cb4bIEZUMM/mAkDMfqDTpUYVgTf/kuQ2VQ8LebuZ8k6EudgH8pYhsGWHlY0lcxlvTwA==",
"dependencies": {
"@vue/runtime-core": "3.3.7",
"@vue/shared": "3.3.7",
"csstype": "^3.1.2"
"@vue/runtime-core": "3.2.45",
"@vue/shared": "3.2.45",
"csstype": "^2.6.8"
}
},
"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": {
"version": "3.3.7",
"resolved": "https://registry.npmmirror.com/@vue/server-renderer/-/server-renderer-3.3.7.tgz",
"integrity": "sha512-UlpKDInd1hIZiNuVVVvLgxpfnSouxKQOSE2bOfQpBuGwxRV/JqqTCyyjXUWiwtVMyeRaZhOYYqntxElk8FhBhw==",
"version": "3.2.45",
"resolved": "https://registry.npmmirror.com/@vue/server-renderer/-/server-renderer-3.2.45.tgz",
"integrity": "sha512-ebiMq7q24WBU1D6uhPK//2OTR1iRIyxjF5iVq/1a5I1SDMDyDu4Ts6fJaMnjrvD3MqnaiFkKQj+LKAgz5WIK3g==",
"dependencies": {
"@vue/compiler-ssr": "3.3.7",
"@vue/shared": "3.3.7"
"@vue/compiler-ssr": "3.2.45",
"@vue/shared": "3.2.45"
},
"peerDependencies": {
"vue": "3.3.7"
"vue": "3.2.45"
}
},
"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": {
"version": "3.3.7",
"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": {
"version": "9.12.0",
@ -2691,11 +2759,6 @@
"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": {
"version": "4.1.0",
"resolved": "https://registry.npmmirror.com/date-fns/-/date-fns-4.1.0.tgz",
@ -2837,6 +2900,14 @@
"integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==",
"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": {
"version": "1.0.5",
"resolved": "https://registry.npmmirror.com/diff-match-patch/-/diff-match-patch-1.0.5.tgz",
@ -4642,9 +4713,9 @@
"dev": true
},
"node_modules/nanoid": {
"version": "3.3.16",
"resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.16.tgz",
"integrity": "sha512-bzlKTyNJ7+LdGIIwy8ijFpIqEQIvafahV7eYykJ8Cvh42EdJeODoJ6gUJXpQJvej1BddH8OqTXZNE/KfbWAu8Q==",
"version": "3.3.19",
"resolved": "https://registry.npmmirror.com/nanoid/-/nanoid-3.3.19.tgz",
"integrity": "sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug==",
"funding": [
{
"type": "github",
@ -4989,7 +5060,6 @@
"version": "8.4.21",
"resolved": "https://registry.npmmirror.com/postcss/-/postcss-8.4.21.tgz",
"integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==",
"dev": true,
"dependencies": {
"nanoid": "^3.3.4",
"picocolors": "^1.0.0",
@ -5468,6 +5538,12 @@
"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": {
"version": "3.6.0",
"resolved": "https://registry.npmmirror.com/std-env/-/std-env-3.6.0.tgz",
@ -6051,6 +6127,60 @@
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
"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": {
"version": "3.10.9",
"resolved": "https://registry.npmmirror.com/vditor/-/vditor-3.10.9.tgz",
@ -6112,23 +6242,15 @@
}
},
"node_modules/vue": {
"version": "3.3.7",
"resolved": "https://registry.npmmirror.com/vue/-/vue-3.3.7.tgz",
"integrity": "sha512-YEMDia1ZTv1TeBbnu6VybatmSteGOS3A3YgfINOfraCbf85wdKHzscD6HSS/vB4GAtI7sa1XPX7HcQaJ1l24zA==",
"version": "3.2.45",
"resolved": "https://registry.npmmirror.com/vue/-/vue-3.2.45.tgz",
"integrity": "sha512-9Nx/Mg2b2xWlXykmCwiTUCWHbWIj53bnkizBxKai1g61f2Xit700A1ljowpTIM11e3uipOeiPcSqnmBg6gyiaA==",
"dependencies": {
"@vue/compiler-dom": "3.3.7",
"@vue/compiler-sfc": "3.3.7",
"@vue/runtime-dom": "3.3.7",
"@vue/server-renderer": "3.3.7",
"@vue/shared": "3.3.7"
},
"peerDependencies": {
"typescript": "*"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
"@vue/compiler-dom": "3.2.45",
"@vue/compiler-sfc": "3.2.45",
"@vue/runtime-dom": "3.2.45",
"@vue/server-renderer": "3.2.45",
"@vue/shared": "3.2.45"
}
},
"node_modules/vue-eslint-parser": {
@ -6366,6 +6488,11 @@
"resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.3.13.tgz",
"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": {
"version": "0.30.5",
"resolved": "https://registry.npmmirror.com/magic-string/-/magic-string-0.30.5.tgz",
@ -6410,6 +6537,77 @@
}
}
},
"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": {
"version": "1.3.1-beta.6",
"resolved": "https://registry.npmmirror.com/vue3-video-play/-/vue3-video-play-1.3.1-beta.6.tgz",

View File

@ -6,7 +6,7 @@
"scripts": {
"dev": "vite",
"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 && 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 && cross-env SKIP_ADDONS=1 node scripts/assemble-admin.cjs",
"build:shared": "node scripts/build-shared.cjs",
"build:addon": "node scripts/build-addon.cjs",
"build:assemble": "node scripts/assemble-admin.cjs",
@ -28,7 +28,7 @@
"date-fns": "^4.1.0",
"day": "^0.0.2",
"echarts": "5.4.1",
"element-plus": "2.7.4",
"element-plus": "^2.7.4",
"esbuild": "^0.16.17",
"highlight.js": "11.0.1",
"lodash-es": "4.17.21",
@ -37,8 +37,9 @@
"qrcode": "1.5.1",
"sass": "1.58.0",
"sortablejs": "1.15.0",
"v-code-diff": "^1.16.0",
"vditor": "^3.10.9",
"vue": "3.3.7",
"vue": "3.2.45",
"vue-i18n": "9.2.2",
"vue-jsonp": "2.0.0",
"vue-router": "4.1.6",
@ -68,4 +69,4 @@
"vite": "4.1.0",
"vue-tsc": "1.0.24"
}
}
}

View File

@ -16,7 +16,7 @@ export function getAccountInfo() {
}
/**
* 选用授权(仅保存官网嵌入页所选授权的授权码,不做绑定)
* 选用授权(选中即写入系统授权配置 NIUCLOUD_CONFIG 并生效)
* 成功提示由页面统一给出,这里关掉请求层的提示,避免弹两次
*/
export function selectAuthorization(params: Record<string, any>) {
@ -24,7 +24,16 @@ export function selectAuthorization(params: Record<string, any>) {
}
/**
* 绑定授权(官网嵌入页回传授权凭据后调用;复用现有授权校验链路)
* 取消选用授权(清空系统已选授权,回到未授权状态)
* 幂等:系统本就无授权时同样返回成功
* 成功提示由页面统一给出,这里关掉请求层的提示,避免弹两次
*/
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 })

View File

@ -56,6 +56,29 @@ 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 地址
*

View File

@ -0,0 +1,134 @@
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

@ -905,3 +905,13 @@ export function getQrcode(params: Record<string, any>) {
export function checkJobStatus() {
return request.get(`sys/job`)
}
/**
* 平台端队列检测提醒
* 平台端后台访问时调用:后端检测队列未运行会发送站内信,恢复后发送「已恢复」
* 站点端不调用(后端也会按 site_id 二次拦截)
* @returns
*/
export function checkQueueNotice() {
return request.get(`sys/queue_notice`, { showErrorMessage: false })
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -182,26 +182,23 @@ const open = (addonKey: string = '', callback: any = null, otherData: any = {})
const apps = upgradeContent.value?.upgrade_apps?.join(',') ?? ''
upgradeAppKey.value = apps === 'niucloud-admin' ? '' : apps
let upgradeCount = 0
let failUpgradeCount = 0
for (let i = 0; i < upgradeContent.value.content.length; i++) {
if (upgradeContent.value.content[i].version_list.length) {
upgradeCount++
} else {
failUpgradeCount++
}
}
if (upgradeContent.value.content.length == upgradeCount) {
isAllowUpgrade.value = true
} else if (upgradeContent.value.content.length == failUpgradeCount) {
isAllowUpgrade.value = false
}
// 仅当存在确实可升级(有 version_list)的应用时才允许发起升级;
// content 为空(例如所选应用均为未上架应用、被后端跳过)时必须禁止,
// 否则会以空 addon 误发框架升级任务
const contentList = upgradeContent.value.content || []
const upgradeCount = contentList.filter((item: any) => item?.version_list?.length).length
isAllowUpgrade.value = upgradeCount > 0
// 校验弹窗已在发起请求前弹出,此处不再重复打开(否则会重置已通过的校验状态)
if (callback) callback()
}).catch(() => {
loading.value = false
if (callback) callback()
})
}).catch((err: any) => {
// 任务状态接口异常:不能按「无进行中任务」继续升级(可能重复发起),提示后结束本次流程
loading.value = false
ElMessage({ message: err?.msg || err?.message || '获取升级任务状态失败,请稍后重试', type: 'error' })
if (callback) callback()
})
}
@ -220,38 +217,61 @@ const handleUpgrade = () => {
/**
* 校验通过:自动关闭校验弹窗,按是否有可勾选项决定流程
*
* - 存在历史备份(last_backup):弹出选项弹窗让用户确认是否备份
* - 无历史备份:没有可选项,跳过选项弹窗直接发起升级
* - 无可升级内容:两者都不做,提示后结束
* 关窗的同时若升级内容尚未返回(getUpgradeContent 取云端升级包,是主要耗时),
* 先打开任务抽屉占位(「正在获取升级内容」)填补空窗,内容到达后按分支收尾。
*
* - 存在历史备份(last_backup):关掉占位,弹出选项弹窗让用户确认是否备份
* - 无历史备份:没有可选项,占位原地衔接为「正在发起升级」并直接发起升级
* - 无可升级内容 / 内容获取失败:关掉占位,提示后结束
*/
const onCheckPassed = async () => {
is_pass.value = true
// 校验通过时升级内容可能尚未返回:getUpgradeContent 要请求云端取升级包,是这段流程的主要耗时。
// 此时先开任务抽屉占位,避免「校验弹窗已关、任务详情还没出来」的空窗;
// 内容已就绪(接口更快)则不开占位,避免抽屉一闪而过
const needPending = !upgradeContent.value
// verify-panel 在自己的定时器回调里 emit('next'),此刻它可能仍有渲染在途;
// 同步卸载会让 Vue 去 patch 已销毁的 vnode,故延后一个 tick 再关闭
nextTick(() => {
checkVisible.value = false
// 与关闭校验弹窗同帧打开占位,两段动画自然衔接
if (needPending) runner.openPendingDetail('upgrade', '正在获取升级内容')
})
// 校验不再等内容接口,因此它可能先返回:这里等内容落地再决定后续流程
if (contentPromise) await contentPromise.catch(() => null)
if (!upgradeContent.value) {
if (needPending) runner.closePendingDetail()
ElMessage({ message: '获取升级内容失败,请重新发起升级', type: 'error' })
return
}
// 全部应用都没有可升级版本:既不弹选项也不发起升级
// 全部应用都没有可升级版本,或所选应用均为未上架应用被后端跳过:既不弹选项也不发起升级
if (!isAllowUpgrade.value) {
ElMessage({ message: '暂无可升级的内容', type: 'warning' })
if (needPending) runner.closePendingDetail()
const notSupportApps = ( upgradeContent.value?.not_support_apps || [] )
.map((item: any) => item?.app_name || item?.app_key)
.filter(Boolean)
ElMessage({
message: notSupportApps.length
? `${ notSupportApps.join('、') } 未上架应用市场,暂不支持在线升级`
: '暂无可升级的内容',
type: 'warning'
})
return
}
// 无备份选项:无需用户选择,直接发起升级(下一步)
if (!upgradeContent.value.last_backup) {
// upgradeAddonFn 内部会再次 openPendingDetail(标题更新为「正在发起升级」),
// 占位抽屉原地衔接,此处无需关闭
upgradeAddonFn()
return
}
// 需要用户选择是否备份:先关掉占位抽屉再弹选项弹窗
if (needPending) runner.closePendingDetail()
showDialog.value = true
}
@ -266,7 +286,8 @@ const upgradeAddonFn = () => {
showDialog.value = false
const appKey = upgradeContent.value?.upgrade_apps.join(',') != 'niucloud-admin' ? upgradeContent.value?.upgrade_apps.join(',') : ''
const upgradeApps: string[] = upgradeContent.value?.upgrade_apps || []
const appKey = upgradeApps.join(',') != 'niucloud-admin' ? upgradeApps.join(',') : ''
// 无选项分支没有弹窗缓冲:先打开占位抽屉,避免「校验弹窗已关、详情还没出来」的空窗
runner.openPendingDetail('upgrade', '正在发起升级')
@ -300,6 +321,9 @@ const elNotificationClick = () => {
notificationEl && notificationEl.close()
toTaskDetail(active.task_key)
}
}).catch((err: any) => {
// 任务状态接口异常:给出提示,避免点击通知后无任何反馈
ElMessage({ message: err?.msg || err?.message || '获取升级任务状态失败,请稍后重试', type: 'error' })
})
}

View File

@ -3,5 +3,7 @@
"login": "Login",
"logging": "Logging",
"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

@ -36,7 +36,12 @@
"lastSync": "上次同步",
"notSync": "尚未同步",
"bindSuccess": "授权绑定成功",
"selectSuccess": "已保存所选授权",
"selectSuccess": "授权已生效",
"cancelAuthSuccess": "已取消选用授权",
"confirm": "确定",
"currentAuthCode": "系统现有授权:",
"replaceAuthTitle": "替换现有授权",
"replaceAuthTip": "继续将替换系统现有授权,替换后旧授权立即失效。是否继续?",
"addressMismatch": "授权域名与当前站点不一致",
"cancel": "取消"
}

View File

@ -34,6 +34,11 @@
"bgHeightScaleTip": "为0时背景高度自适应展示",
"marginSet": "边距设置",
"componentStyleTitle": "组件样式",
"componentIsShowTitle": "显示设置",
"componentIsShow": "是否展示",
"componentIsShowTips": "隐藏后前台不展示该组件,装修预览中仍可编辑",
"componentShowAction": "设为展示",
"componentHideAction": "设为隐藏",
"bottomBgColor": "底部背景",
"bottomBgTips": "底部背景包含边距和圆角",
"componentBgColor": "组件背景色",

View File

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

View File

@ -19,7 +19,7 @@
"resolvedTime": "标记时间",
"unresolved": "未解决",
"resolved": "已解决",
"markResolved": "标记已解决",
"markResolved": "已解决",
"markResolvedTips": "标记后表示您已处理该补丁,仅作记录且不可取消,是否确定?",
"resolveFail": "标记失败",
"all": "全部",

View File

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

View File

@ -27,8 +27,8 @@
<script lang="ts" setup>
import { ref, computed, onMounted, onUnmounted } from "vue"
import { t } from "@/lang"
import { getEmbedUrl, getAccountInfo, selectAuthorization, saveAccountToken, logoutAccount } from "@/app/api/account"
import { ElMessage } from "element-plus"
import { getEmbedUrl, getAccountInfo, selectAuthorization, cancelAuthorization, saveAccountToken, logoutAccount } from "@/app/api/account"
import { ElMessage, ElMessageBox } from "element-plus"
import { Loading } from "@element-plus/icons-vue"
const ready = ref(false)
@ -94,9 +94,11 @@ const loadEmbed = async (mode: "login" | "account") => {
// 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) {
// 地址异常时保持原样
@ -176,6 +178,9 @@ const onMessage = async (e: MessageEvent) => {
case "niucloud:selected":
await selectFromEmbed(data.payload)
break
case "niucloud:cancel_selected":
await cancelFromEmbed(data.payload)
break
case "niucloud:logout":
await onEmbedLogout()
break
@ -203,12 +208,15 @@ const syncTokenFromEmbed = (payload: any) => {
* 令牌只落到服务端配置,前端不再持有,避免每次进入都要重新登录
*/
const saveEmbedToken = async (payload: any) => {
if (!payload?.token) return
// 优先保存长期刷新令牌(access token 过期后由服务端续期);官网旧版本只回传 token 时也能兼容
if (!payload?.token && !payload?.refresh_token) return
try {
await saveAccountToken({
token: payload.token,
expires_time: Number(payload.expires_time || 0)
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
} catch (e) {
@ -218,11 +226,53 @@ const saveEmbedToken = async (payload: any) => {
}
/**
* 官网内嵌页回传所选授权 -> 保存到本地(仅保存,不做绑定)
* 授权码脱敏:保留前后各若干位,中间用 * 代替
* 星号数量与实际被隐藏的字符数一一对应(与官网内嵌页 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,
@ -241,6 +291,44 @@ const selectFromEmbed = async (payload: any) => {
}
}
/**
* 向官网内嵌页发消息(targetOrigin 用官网 origin)
*/
const postToEmbed = (type: string, payload: any) => {
const frame = embedFrame.value
if (!frame?.contentWindow || !officialOrigin.value) return
frame.contentWindow.postMessage(
{ source: "niucloud-parent", type, payload },
officialOrigin.value
)
}
/**
* 官网内嵌页请求取消选用 -> 清空系统已选授权(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
currentAuthCode.value = ""
ElMessage.success(t("cancelAuthSuccess"))
postToEmbed("niucloud:cancel_result", { success: true })
} catch (e) {
console.error("[embed] 取消选用授权失败:", e)
postToEmbed("niucloud:cancel_result", { success: false })
}
}
/**
* 官网内嵌页主动退出:清除本地账号信息(已绑定的授权保留),并切回登录页
*/

View File

@ -58,84 +58,27 @@
</div>
</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-log ref="upgradeLogRef" />
</div>
</template>
<script lang="ts" setup>
import { ref, computed, reactive } from "vue"
import { ref, computed } from "vue"
import { t } from "@/lang"
import { getVersions } from "@/app/api/auth"
import { getAuthInfo, getFrameworkVersionList, setAuthInfo } from "@/app/api/module"
import { ElMessage, FormInstance, FormRules } from "element-plus"
import { getAuthInfo, getFrameworkVersionList } from "@/app/api/module"
import { ElMessage } from "element-plus"
import { useRouter } from "vue-router"
import Upgrade from "@/app/components/upgrade/index.vue"
import UpgradeLog from "@/app/components/upgrade-log/index.vue"
const upgradeRef = ref<any>(null)
const upgradeLogRef = ref<any>(null)
const authCodeApproveDialog = ref(false)
const frameworkVersionList = ref([])
const activeName = ref(0)
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 getFrameworkVersionListFn = () => {
loadingVersion.value = true
@ -174,8 +117,11 @@ const newVersion: any = computed(() => {
return frameworkVersionList.value.length ? frameworkVersionList.value[0] : null
})
const authCodeApproveFn = () => {
authCodeApproveDialog.value = true
const router = useRouter()
// 未绑定授权:跳转到「系统授权」页面
const toAuthorize = () => {
router.push('/admin/tools/authorize')
}
const version = ref('')
@ -213,7 +159,7 @@ const loading = ref(false)
*/
const handleUpgrade = () => {
if (!authInfo.value.auth_code) {
authCodeApproveFn()
toAuthorize()
return
}
if (repeat.value) return
@ -229,16 +175,12 @@ const checkAppMange = () => {
getAuthInfo().then((res) => {
if (res.data.data && res.data.data.length != 0) {
authInfo.value = res.data.data
authCodeApproveDialog.value = false
}
}).catch(() => {
authCodeApproveDialog.value = false
})
}).catch(() => {})
}
checkAppMange()
const router = useRouter()
const upgradeRecord = () => {
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-input v-model.trim="formData.api_url" :placeholder="t('authIdPlaceholder')" class="input-width">
<template #append>
<el-select class="border-none" style="width: 100px" v-model="formData.methods">
<el-select class="border-none" style="width: 130px" v-model="formData.methods">
<el-option label="POST" value="post" />
<el-option label="GET" value="get" />
<el-option label="PUT" value="put" />

View File

@ -321,7 +321,7 @@ const authElMessageBox = () => {
cancelButtonText: t('toNiucloud')
}
).then(() => {
router.push({ path: '/app/authorize' })
router.push({ path: '/admin/tools/authorize' })
}).catch((action: string) => {
if (action === 'cancel') {
window.open('https://www.niucloud.com/app')

View File

@ -7,21 +7,22 @@
<span class="text-page-title">{{ pageName }}</span>
</div>
<el-tabs v-model="activeName" class="my-[20px]" @tab-change="handleClick">
<!-- 页签、按钮、版本信息之间的纵向间距由 .table-fill-page 容器的 gap 承担,自身不再加外边距,避免叠加出多余留白 -->
<el-tabs v-model="activeName" @tab-change="handleClick">
<el-tab-pane :label="t('weappAccessFlow')" name="/channel/weapp" />
<el-tab-pane :label="t('subscribeMessage')" name="/channel/weapp/message" />
<el-tab-pane :label="t('weappRelease')" name="/channel/weapp/code" />
</el-tabs>
<div class="mt-[20px]" v-if="!weappConfig.is_authorization">
<div v-if="!weappConfig.is_authorization">
<el-button type="primary" @click="openDialog" :loading="uploading" :disabled="loading">{{ t('cloudRelease') }}</el-button>
<el-button @click="localInsert" :disabled="loading">{{ t('localRelease') }}</el-button>
</div>
<div class="mt-[20px]" v-else>
<div v-else>
<el-button type="primary" @click="againUpload" :loading="uploading" :disabled="loading">{{ t('uploadWeapp') }}</el-button>
</div>
<div class="text-[14px] mt-[15px]">
<div class="text-[14px]" v-if="hasVersionInfo">
<div class="flex items-center">
<div v-if="weappTableData.version_info.release_version">
线上版本: <span class="mr-10 text-primary">{{ weappTableData.version_info.release_version }}</span>
@ -296,6 +297,12 @@ 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)
})
/**
* 获取版本列表
*/
@ -468,7 +475,7 @@ const authElMessageBox = () => {
cancelButtonText: t('toNiucloud')
}
).then(() => {
router.push({ path: '/app/authorize' })
router.push({ path: '/admin/tools/authorize' })
}).catch((action: string) => {
if (action === 'cancel') {
window.open('https://www.niucloud.com/app')

View File

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

View File

@ -431,38 +431,44 @@ const headerTipsKey = computed(() => {
// 组件验证
diyStore.editComponent.verify = (index: number) => {
const res = { code: true, message: '' }
const component = diyStore.value[index]
if (!component) return res
diyStore.value[index].search.hotWord.list.forEach((item: any) => {
if (item.text == '') {
res.code = false
res.message = t('carouselSearchHotWordTextPlaceholder')
return res
}
})
diyStore.value[index].tab.list.forEach((item: any) => {
if (item.text == '') {
res.code = false
res.message = t('carouselSearchTabCategoryTextPlaceholder')
return res
}
// if(item.diy_id == ''){
// res.code = false
// res.message = t('selectDiyPagePlaceholder')
// return res
// }
})
if (diyStore.value[index].swiper.control) {
diyStore.value[index].swiper.list.forEach((item: any) => {
if (item.imageUrl == '') {
const hotWordList = component.search?.hotWord?.list
if (Array.isArray(hotWordList)) {
hotWordList.forEach((item: any) => {
if (item.text == '') {
res.code = false
res.message = t('imageUrlTip')
res.message = t('carouselSearchHotWordTextPlaceholder')
return res
}
})
}
const tabList = component.tab?.list
if (Array.isArray(tabList)) {
tabList.forEach((item: any) => {
if (item.text == '') {
res.code = false
res.message = t('carouselSearchTabCategoryTextPlaceholder')
return res
}
})
}
if (component.swiper?.control) {
const swiperList = component.swiper?.list
if (Array.isArray(swiperList)) {
swiperList.forEach((item: any) => {
if (item.imageUrl == '') {
res.code = false
res.message = t('imageUrlTip')
return res
}
})
}
}
return res
}
@ -506,17 +512,15 @@ const searchStyleList = reactive([
/** ************ 搜索框样式选择-end ********************/
diyStore.editComponent.search.hotWord.list.forEach((item: any) => {
if (!item.id) item.id = diyStore.generateRandom()
})
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()
})
const ensureListItemId = (list: any) => {
if (!Array.isArray(list)) return
list.forEach((item: any) => {
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 handleChange = (val: string[]) => {
@ -679,8 +683,10 @@ const diyPageShowDialogOpen = (index: any) => {
}
watch(
() => diyStore.editComponent.swiper.list,
(newValue, oldValue) => {
() => diyStore.editComponent?.swiper?.list,
(list) => {
// 切换 isShow 等场景下组件数据可能短暂不完整,直接跳过
if (!Array.isArray(list)) return
// 设置图片宽高
handleHeight()
},
@ -707,12 +713,15 @@ const changeSwiperStyle = (value: any) => {
// 处理高度
const handleHeight = (isCalcHeight: boolean = false) => {
diyStore.editComponent.swiper.list.forEach((item: any, index: number) => {
const list = diyStore.editComponent?.swiper?.list
if (!Array.isArray(list)) return
list.forEach((item: any, index: number) => {
if (!item?.imageUrl) return
const image = new Image()
image.src = img(item.imageUrl)
image.onload = async () => {
item.imgWidth = image.width
item.imgHeight = image.height
image.onload = () => {
if (item.imgWidth !== image.width) item.imgWidth = image.width
if (item.imgHeight !== image.height) item.imgHeight = image.height
// 计算第一张图片高度
if (isCalcHeight && index == 0) {
const ratio = item.imgHeight / item.imgWidth

View File

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

View File

@ -100,6 +100,15 @@
<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" />
</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>
<!-- 组件预览渲染区域 -->
@ -138,6 +147,27 @@
<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]">
<template #style>
<div class="edit-attr-item-wrap">
@ -213,9 +243,9 @@
</template>
<script lang="ts" setup>
import { ref, reactive, toRaw, watch, inject, defineAsyncComponent } from 'vue'
import { ref, reactive, toRaw, watch, inject, defineAsyncComponent, computed } from 'vue'
import { t } from '@/lang'
import { ArrowLeft } from "@element-plus/icons-vue"
import { ArrowLeft, View, Hide } from "@element-plus/icons-vue"
import { img } from '@/utils/common'
import { getDiyTemplatePages, addDiyPage, editDiyPage, initPage } from '@/app/api/diy'
import { useRoute, useRouter } from 'vue-router'
@ -231,6 +261,17 @@ const diyStore = useDiyStore()
const route = useRoute()
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.name = route.query.name || ''
route.query.url = route.query.url || '' // 页面路径
@ -346,8 +387,10 @@ const changeTemplatePage = (value: any) => {
if (value) {
let data = cloneDeep(templatePages[value].data);
diyStore.global = data.global;
diyStore.ensureTemplateIsShow()
if (data.value.length) {
diyStore.value = data.value
diyStore.normalizeComponentIsShow()
}
} else {
if (route.query.title) diyStore.global.title = diyStore.typeName
@ -361,8 +404,10 @@ const changeTemplatePage = (value: any) => {
if (value) {
let data = cloneDeep(templatePages[value].data)
diyStore.global = data.global
diyStore.ensureTemplateIsShow()
if (data.value.length) {
diyStore.value = data.value
diyStore.normalizeComponentIsShow()
}
} else {
if (route.query.title) diyStore.global.title = diyStore.typeName
@ -424,8 +469,10 @@ initPage({
if (data.value) {
const sources = JSON.parse(data.value)
diyStore.global = sources.global
diyStore.ensureTemplateIsShow()
if (sources.value.length) {
diyStore.value = sources.value
diyStore.normalizeComponentIsShow()
// diyStore.changeCurrentIndex(0,diyStore.value[0]);
}
} else {
@ -559,6 +606,7 @@ window.addEventListener('message', (event) => {
diyStore.changeCurrentIndex(data.index, data.component)
diyStore.global = data.global
diyStore.value = data.value
diyStore.normalizeComponentIsShow()
break
}
} catch (e) {

View File

@ -10,8 +10,8 @@
<div class="error-text text-[28px] font-bold">404错误!</div>
<div class="text-[#222] text-[20px] mt-[15px]">哎呀,出错了!您访问的页面不存在...</div>
<div class="text-[#c4c2c2] text-[12px] mt-[5px]">尝试检查URL的错误,然后点击浏览器刷新按钮。</div>
<div class="mt-[40px]">
<el-button class="bottom" @click="router.go(-1)">{{ second }} 秒后返回上一页</el-button>
<div v-if="showBack" class="mt-[40px]">
<el-button class="bottom" @click="goBack">{{ second }} 秒后返回上一页</el-button>
</div>
</div>
@ -20,25 +20,59 @@
</template>
<script lang="ts" setup>
import { onUnmounted, ref } from 'vue'
import { useRouter } from 'vue-router'
import { computed, onUnmounted, ref, watch } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import useSystemStore from '@/stores/modules/system'
import useTabbarStore from '@/stores/modules/tabbar'
let timer: any = null
const second = ref(5)
const route = useRoute()
const router = useRouter()
const systemStore = useSystemStore()
const tabbarStore = useTabbarStore()
timer = setInterval(() => {
if (second.value === 0) {
clearInterval(timer)
router.go(-1)
} else {
second.value--
}
}, 1000)
onUnmounted(() => {
timer && clearInterval(timer)
/**
* 有标签栏且当前页已在标签中:关标签/切换即可,不展示返回按钮
* 无标签栏、或真·404(不在标签中):保留返回上一页
*/
const showBack = computed(() => {
const name = route.name as string
const inTab = !!(systemStore.tab && name && tabbarStore.tabs[name])
return !inTab
})
let timer: ReturnType<typeof setInterval> | null = null
const second = ref(5)
const clearTimer = () => {
if (timer) {
clearInterval(timer)
timer = null
}
}
const goBack = () => {
clearTimer()
router.go(-1)
}
const startTimer = () => {
clearTimer()
second.value = 5
timer = setInterval(() => {
if (second.value <= 1) {
goBack()
} else {
second.value--
}
}, 1000)
}
watch(showBack, (val) => {
if (val) startTimer()
else clearTimer()
}, { immediate: true })
onUnmounted(clearTimer)
</script>
<style lang="scss" scoped>

View File

@ -468,12 +468,12 @@ watch(addonList, () => nextTick(updateScrollState), { flush: 'post' })
* 渠道标识 -> iconfont
*/
const channelIcons: Record<string, string> = {
pc: 'iconPCc',
h5: 'iconH5c',
app: 'iconAPPc',
weapp: 'iconxiaochengxutongbuc',
aliapp: 'iconzhifubaoxiaochengxuc',
wechat: 'iconweixingongzhonghao'
pc: 'iconPCduanPCxx1',
h5: 'iconH5PCxx1',
app: 'icona-shoujipc30',
weapp: 'iconweixinPCxx-2',
aliapp: 'iconzhifubaoPCxx',
wechat: 'iconweixinPCxx'
}
const channelIcon = (key: string) => channelIcons[key] || ''

View File

@ -23,6 +23,14 @@
</div>
</div>
<div class="am-framework__ops">
<!-- 备份管理:存在任何写回备份时才出现,放在「校验」前面 -->
<button v-if="hasBackups" type="button" class="am-btn am-btn--ghost" @click="openBackup">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">
<path d="M4.2 8.4 12 4.8l7.8 3.6v7.2L12 19.2l-7.8-3.6Z" />
<path d="M4.2 8.4 12 12l7.8-3.6M12 12v7.2" />
</svg>
<span>{{ t('backupManageTitle') }}</span>
</button>
<!-- 校验框架:检测目标只认 framework(列表里的 key 是 niucloud-admin,后端不认) -->
<button type="button" class="am-btn am-btn--ghost" @click="openFrameworkDiff">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">
@ -142,15 +150,10 @@
<span class="am-card__key" :title="row.key">{{ row.key }}</span>
</div>
</div>
<!-- 应用状态:卡片右上角,基于「应用名称 + 应用标识」这两行垂直居中 -->
<!-- 应用状态:卡片右上角,基于「应用名称 + 应用标识」这两行垂直居中;多个标签上下排列、右对齐 -->
<div class="am-card__status">
<span
v-if="
row.install_info &&
Object.keys(row.install_info)?.length &&
row.install_info.version != row.version &&
isNeedUpgrade(row.install_info.version, row.version)
"
v-if="canUpgrade(row)"
class="am-pill am-pill--warn"
>可升级</span
>
@ -179,9 +182,10 @@
</span>
<!-- 两段之间的竖线:只在右半边存在时显示 —— 已最新时右半边不渲染,
留着这根线会变成孤零零的 1px 立在中间 -->
<span class="am-card__sep" v-if="!cardUpToDate(row)"></span>
<!-- 不是最新才需要单独报「最新版本」(一致时上面那个「最新」标记已经说明了) -->
<span class="am-card__meta-item" v-if="!cardUpToDate(row)">
<span class="am-card__sep" v-if="!cardUpToDate(row) && !row.is_local"></span>
<!-- 不是最新才需要单独报「最新版本」(一致时上面那个「最新」标记已经说明了)。
本地自有应用(is_local)云端没有版本记录,info.json 的版本号不代表可升级版本,不展示 -->
<span class="am-card__meta-item" v-if="!cardUpToDate(row) && !row.is_local">
<span class="am-card__meta-k">最新版本</span>
<span
class="am-card__meta-v"
@ -231,12 +235,7 @@
<el-button
class="am-act am-act--ok"
link
v-if="
row.install_info &&
Object.keys(row.install_info)?.length &&
row.install_info.version != row.version &&
isNeedUpgrade(row.install_info.version, row.version)
"
v-if="canUpgrade(row)"
@click.stop="upgradeAddonFn(row)"
>升级</el-button
>
@ -306,12 +305,7 @@
<el-tag
type="danger"
size="small"
v-if="
activeName == 'recentlyUpdated' &&
row.install_info &&
Object.keys(row.install_info)?.length &&
row.install_info.version != row.version
"
v-if="activeName == 'recentlyUpdated' && canUpgrade(row)"
>
{{ t('newVersion') }}{{ row.version }}
</el-tag>
@ -392,12 +386,7 @@
<template v-else>
<el-button
class="!text-[13px]"
v-if="
activeName == 'recentlyUpdated' &&
row.install_info &&
Object.keys(row.install_info)?.length &&
row.install_info.version != row.version
"
v-if="activeName == 'recentlyUpdated' && canUpgrade(row)"
type="primary"
link
@click="upgradeAddonFn(row)"
@ -460,26 +449,7 @@
>
<div class="mb-[20px] text-sm text-[#888]">检测到当前账号尚未绑定授权,请先绑定授权!</div>
<div class="flex flex-1 flex-wrap justify-center relative">
<el-button class="w-[154px] !h-[48px] mt-[8px]" type="primary" @click="authCodeApproveFn">授权码认证</el-button>
<el-popover ref="getAuthCodeDialog" placement="bottom" :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-[154px] !h-[48px] mt-[8px] !text-[var(--el-color-primary)] hover:!text-[var(--el-color-primary)] !bg-transparent"
plain
type="primary"
>如何获取授权码?
</el-button>
</template>
</el-popover>
<el-button class="w-[154px] !h-[48px] mt-[8px]" type="primary" @click="toAuthorize">授权码认证</el-button>
</div>
</div>
<el-empty class="mx-auto overview-empty" v-if="showType == 'card' && noAppLen && !loading && authinfo && activeName == 'all' && !authLoading">
@ -507,45 +477,6 @@
</template>
</el-empty>
<el-dialog v-model="authCodeApproveDialog" title="授权码认证" width="400px">
<el-form :model="formData" label-width="0" ref="formRef" :rules="formRules" class="page-form">
<div class="p-[20px]">
<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>
</div>
</el-form>
</el-dialog>
<!-- 安装弹窗 -->
<el-dialog
v-model="installShowDialog"
@ -802,8 +733,9 @@
>
安装
</button>
<!-- 与「可更新」页签同一口径:本地自有应用(is_local)云端没有升级包,不显示升级 -->
<button
v-else-if="detailAddon.install_info.version != detailAddon.version"
v-else-if="detailCanUpgrade"
type="button"
class="am-btn am-btn--primary"
@click.stop="upgradeAddonFn(detailAddon)"
@ -844,6 +776,8 @@
</div>
<!-- 文件差异弹框(公共组件):传入应用标识与图标 -->
<file-diff v-model:show="diffVisible" :target="diffTarget" :icon="diffIcon" />
<!-- 备份管理弹框:不限定目标,展示全部备份批次 -->
<backup-list v-model:show="backupVisible" />
<upgrade-log :upgradeKey="upgradeKey" ref="upgradeLogRef" />
<upgrade ref="upgradeRef" @complete="upgradeCompleteFn" @cloudbuild="handleCloudBuild" />
@ -867,9 +801,9 @@ import {
getAddonInit
} from '@/app/api/addon'
import { deleteAddonDevelop } from '@/app/api/tools'
import { downloadVersion, getAuthInfo, setAuthInfo, getFrameworkNewVersion, getAppVersionList } from '@/app/api/module'
import { downloadVersion, getAuthInfo, getFrameworkNewVersion, getAppVersionList } from '@/app/api/module'
import { getVersions } from '@/app/api/auth'
import { ElMessage, ElMessageBox, ElNotification, FormInstance, FormRules } from 'element-plus'
import { ElMessage, ElMessageBox, ElNotification } from 'element-plus'
import 'vue-web-terminal/lib/theme/dark.css'
import { Terminal, TerminalFlash } from 'vue-web-terminal'
import { findFirstValidRoute } from '@/router/routers'
@ -880,6 +814,8 @@ import Upgrade from '@/app/components/upgrade/index.vue'
import VerifyPanel from '@/app/components/verify-panel/index.vue'
import UpgradeLog from '@/app/components/upgrade-log/index.vue'
import FileDiff from '@/components/file-diff/index.vue'
import BackupList from '@/components/backup-list/index.vue'
import { getIntegrityBackupList } from '@/app/api/integrity'
import { deepClone, img } from '@/utils/common'
import { useTablePageHeight } from '@/hooks/useTablePageHeight'
@ -931,6 +867,20 @@ const isNeedUpgrade = (currVersion: unknown, onlineVersion: unknown) => {
return false
}
/**
* 是否可在线升级
*
* 只有云端有登记(is_local = false,即已上架应用市场)的应用/插件才拿得到官方升级包,
* 才可能存在「新版本」。is_local = true 是本地自有(云端商城没有它),本地 info.json 的
* 版本号并不代表云端有可升级的版本,因此不能算作可升级,也不应显示「可升级/最新版本」。
*/
const canUpgrade = (row: any) => {
if (row?.is_local) return false
const installInfo = row?.install_info
if (!installInfo || !Object.keys(installInfo).length) return false
return installInfo.version != row.version && isNeedUpgrade(installInfo.version, row.version)
}
const searchParam = reactive({
keywords: '',
type: '',
@ -1117,7 +1067,8 @@ const localListFn = () => {
if (data[i].install_info && Object.keys(data[i].install_info)?.length) {
localList.value.installed.push(data[i])
if (data[i].install_info.version != data[i].version && isNeedUpgrade(data[i].install_info.version, data[i].version)) {
// 只有云端有登记(is_local=false)的应用才拿得到官方升级包,才算「可更新」
if (data[i].is_local == false && data[i].install_info.version != data[i].version && isNeedUpgrade(data[i].install_info.version, data[i].version)) {
localList.value.recentlyUpdated.push(data[i])
}
} else {
@ -1469,13 +1420,14 @@ const handleCloudInstall = () => {
}
const authElMessageBox = () => {
// 未绑定授权:引导用户前往「系统授权」页面完成绑定
ElMessageBox.confirm(t('authTips'), t('warning'), {
distinguishCancelAndClose: true,
confirmButtonText: t('toBind'),
cancelButtonText: t('toNiucloud'),
})
.then(() => {
authCodeApproveFn()
router.push('/admin/tools/authorize')
})
.catch((action: string) => {
if (action === 'cancel') {
@ -1565,6 +1517,12 @@ const doUninstall = () => {
* @param key
*/
const upgradeAddonFn = (data: any) => {
// 本地自有应用(is_local:云端商城没有它)没有官方升级包,云端也取不到升级内容,
// 这里提前拦截并提示,避免进入在线升级流程后报错
if (data?.is_local) {
ElMessage({ message: `${ data.title || data.key } 未上架应用市场,暂不支持在线升级`, type: 'warning', duration: 5000 })
return
}
upgradeRef.value?.open(data.key,null,data)
}
@ -1588,10 +1546,6 @@ const handleCloudBuild = () => {
// 卸载前校验由统一校验组件承担(scene=addon_uninstall),通过后执行 doUninstall()
const market = () => {
window.open('https://www.niucloud.com/app')
}
/**
* 安装弹窗关闭提示
* @param done
@ -1633,10 +1587,7 @@ const updateInformationFn = (data: any) => {
openDetail(data)
}
// 授权
const authCodeApproveDialog = ref(false)
const authinfo = ref('')
const getAuthCodeDialog = ref(null)
const saveLoading = ref(false)
const authLoading = ref(true)
const checkAppMange = () => {
authLoading.value = true
@ -1649,46 +1600,14 @@ const checkAppMange = () => {
})
.catch(() => {
authLoading.value = false
authCodeApproveDialog.value = false
})
}
checkAppMange()
const authCodeApproveFn = () => {
authCodeApproveDialog.value = true
}
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 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
setTimeout(() => {
location.reload()
}, 1000)
})
.catch(() => {
saveLoading.value = false
})
}
})
// 未绑定授权:跳转到「系统授权」页面
const toAuthorize = () => {
router.push('/admin/tools/authorize')
}
const goRouter = () => {
@ -1741,17 +1660,22 @@ const appKeySingleSelect = (event: any, key: string) => {
}
const batchUpgrade = () => {
// 未上架应用市场(is_local:云端商城没有它)的应用没有官方升级包,批量升级时需排除
const notSupportKeys = localList.value.recentlyUpdated
.filter((item: any) => item.is_local)
.map((item: any) => item.key)
// 顶部框架栏常驻:未勾选任何应用时,默认升级全部可更新应用
const selected = batchUpgradeApp.value.length
const selected = ( batchUpgradeApp.value.length
? batchUpgradeApp.value
: localList.value.recentlyUpdated.map((item: any) => item.key)
: localList.value.recentlyUpdated.map((item: any) => item.key) )
.filter((key: string) => !notSupportKeys.includes(key))
const appKeys = deepClone(selected)
if (frameworkHasUpdate.value && !appKeys.includes('niucloud-admin')) {
appKeys.unshift('niucloud-admin')
}
if (!appKeys.length) {
ElMessage({
message: '当前已是最新版',
message: notSupportKeys.length ? '所选应用未上架应用市场,暂不支持在线升级' : '当前已是最新版',
type: 'error',
duration: 5000,
})
@ -1794,6 +1718,8 @@ const detailInstalled = computed(() => {
return Boolean(installInfo && Object.keys(installInfo).length)
})
const detailCanUpgrade = computed(() => {
// 本地自有应用(is_local)云端没有版本记录,不存在在线升级
if (detailAddon.value?.is_local) return false
const installInfo = detailAddon.value?.install_info
if (!installInfo || !Object.keys(installInfo).length) return false
const latest = detailAddon.value?.version
@ -1906,6 +1832,34 @@ const openFrameworkDiff = () => {
diffIcon.value = frameworkIcon
diffVisible.value = true
}
/**
* 备份管理入口(框架栏「校验」前这一个,全站唯一)
*
* 写回官方文件(文件差异弹框里的「恢复」)会在服务器留备份。
* 只要有任何目标的备份就显示入口;弹框不限定目标,能看到全部备份。
*/
const backupVisible = ref(false)
const hasBackups = ref(false)
const loadBackupFlag = () => {
getIntegrityBackupList().then((res: any) => {
hasBackups.value = (res.data?.list || []).length > 0
}).catch(() => {
// 拉不到就不显示入口,不影响页面其它功能
})
}
const openBackup = () => {
backupVisible.value = true
}
// 写回/恢复都会改变备份集合:相关弹框关掉后刷新标记,入口的出现与消失才跟得上实际状态
watch([diffVisible, backupVisible], () => {
if (!diffVisible.value && !backupVisible.value) loadBackupFlag()
})
loadBackupFlag()
// 应用详情 ------ end
const toLink = (type)=>{
@ -2391,13 +2345,14 @@ html.dark .table-head-bg {
*
* 位于 head 的第三列,align-self: center —— 该行正是「应用名称 + 应用标识」两行,
* 所以状态标签与这两行整体垂直居中。
* 多个标签(如「可升级」+「兼容提示」)上下排列、右对齐,避免横向挤占应用标识的宽度。
* 标签不压缩(见下方 flex: none):空间不够时由标识自己出省略号(.am-card__key)。
*/
.am-card__status {
display: flex;
align-items: center;
gap: 6px;
flex-wrap: nowrap;
flex-direction: column;
align-items: flex-end;
gap: 4px;
align-self: center;
}

View File

@ -81,6 +81,7 @@
<script lang="ts" setup>
import { computed, reactive, ref } from 'vue'
import { ElMessage } from 'element-plus'
import type { FormInstance, FormRules } from 'element-plus'
import { useRoute, useRouter } from 'vue-router'
import { t } from '@/lang'
@ -105,6 +106,21 @@ getWebCopyright().then(({ data }) => {
})
route.redirectedFrom && (route.query.redirect = route.redirectedFrom.path)
// 登录页提示:由路由守卫跳转时通过 query 传递(无可用菜单权限、菜单加载失败等)
const tipKeyMap: Record<string, string> = {
no_permission: 'noMenuPermissionTip',
menu_error: 'menuLoadErrorTip'
}
const loginTip = route.query.tip as string
if (loginTip && tipKeyMap[ loginTip ]) {
ElMessage.error({ message: t(tipKeyMap[ loginTip ]), duration: 6000 })
// 清理 query,避免刷新页面后重复提示
const query: Record<string, any> = { ...route.query }
delete query.tip
router.replace({ query })
}
const webSite: any = computed(() => useSystemStore().website)
const siteBackgroundStyle = computed(() => ({

View File

@ -49,7 +49,7 @@
</div>
</template>
<el-empty v-else description="消息不存在或已被删除" />
<el-empty v-else description="消息不存在或已被删除" :image-size="80" />
</el-card>
</div>
</template>

View File

@ -0,0 +1,147 @@
<template>
<el-drawer v-model="visible" :title="form.id ? '编辑开放账号' : '创建开放账号'" size="520px"
@closed="reset">
<el-form ref="formRef" :model="form" :rules="rules" label-position="top">
<div class="mb-5">
<div class="font-medium text-gray-800 mb-3 pb-2 border-b border-gray-100">基础信息</div>
<el-form-item label="账号名称" prop="name">
<el-input v-model.trim="form.name" placeholder="例如:ERP对接-上海店" maxlength="100" show-word-limit />
</el-form-item>
<el-form-item label="有效期">
<el-switch v-model="hasExpire" active-text="设置过期时间" />
<el-date-picker v-if="hasExpire" v-model="form.expire_time" type="datetime" value-format="X"
placeholder="选择过期时间" class="w-full mt-2" />
</el-form-item>
<el-form-item label="备注">
<el-input v-model="form.remark" type="textarea" :rows="2" maxlength="255"
placeholder="用途说明,便于后续排查问题" />
</el-form-item>
</div>
<div class="mb-5">
<div class="font-medium text-gray-800 mb-3 pb-2 border-b border-gray-100">安全策略</div>
<el-form-item label="IP 白名单">
<el-input v-model="form.ip_white" type="textarea" :rows="2"
placeholder="每行一个或逗号分隔,留空表示不限制来源 IP" />
</el-form-item>
<el-form-item label="令牌有效期(秒)">
<el-input-number v-model="form.token_expire" :min="0" :step="600" class="w-full" />
</el-form-item>
<el-form-item label="状态">
<el-switch v-model="form.status" :active-value="1" :inactive-value="0"
active-text="启用" inactive-text="禁用" />
</el-form-item>
</div>
<div>
<div class="font-medium text-gray-800 mb-3 pb-2 border-b border-gray-100">能力授权</div>
<domain-auth ref="domainAuthRef" v-model="form.auth_domains" />
</div>
</el-form>
<template #footer>
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" :loading="loading" @click="submit">保存</el-button>
</template>
</el-drawer>
</template>
<script lang="ts" setup>
import { reactive, ref } from 'vue'
import { addOpenapiApp, editOpenapiApp, getOpenapiApiTree } from '@/app/api/openapi'
import DomainAuth from './domain-auth.vue'
const emit = defineEmits<{
(e: 'complete', data: any): void
}>()
const visible = ref(false)
const loading = ref(false)
const hasExpire = ref(false)
const formRef = ref()
const domainAuthRef = ref()
const form = reactive({
id: 0,
name: '',
status: 1,
auth_domains: [] as string[],
ip_white: '',
expire_time: 0,
token_expire: 7200,
remark: ''
})
const rules = {
name: [{ required: true, message: '请输入开放账号名称', trigger: 'blur' }]
}
/**
* 拉取可授权接口清单
*/
const loadApiTree = () => {
getOpenapiApiTree().then((res: any) => {
domainAuthRef.value?.setTree(res.data || [])
})
}
/**
* 打开抽屉,传入 row 为编辑,不传为新增
*/
const show = (row?: any) => {
visible.value = true
loadApiTree()
if (row) {
hasExpire.value = !!row.expire_time
Object.assign(form, {
id: row.id,
name: row.name,
status: row.status,
auth_domains: [ ...(row.auth_domains || []) ],
ip_white: row.ip_white,
expire_time: row.expire_time,
token_expire: row.token_expire,
remark: row.remark
})
}
}
/**
* 提交表单
*/
const submit = () => {
formRef.value?.validate((valid: boolean) => {
if (!valid) return
loading.value = true
const data = { ...form, auth_domains: [ ...form.auth_domains ], expire_time: hasExpire.value ? form.expire_time : 0 }
const request = form.id ? editOpenapiApp(form.id, data) : addOpenapiApp(data)
request.then((res: any) => {
loading.value = false
visible.value = false
emit('complete', res.data)
}).catch(() => {
loading.value = false
})
})
}
const reset = () => {
formRef.value?.resetFields()
Object.assign(form, {
id: 0,
name: '',
status: 1,
auth_domains: [],
ip_white: '',
expire_time: 0,
token_expire: 7200,
remark: ''
})
hasExpire.value = false
}
defineExpose({ show })
</script>

View File

@ -0,0 +1,74 @@
<template>
<el-dialog v-model="visible" title="批量重置密钥结果" width="820px" :close-on-click-modal="false" @closed="handleClosed">
<el-alert type="warning" :closable="false" show-icon class="mb-4"
title="以下为新生成的密钥,请立即复制并妥善保存;关闭后仍可在账号列表中逐个点击眼睛查看" />
<el-table :data="list" size="small" border max-height="380">
<el-table-column prop="name" label="账号名称" min-width="140" show-overflow-tooltip />
<el-table-column label="Access Key" min-width="220">
<template #default="{ row }">
<span class="font-mono text-xs break-all">{{ row.app_key }}</span>
</template>
</el-table-column>
<el-table-column label="Secret Key" min-width="240">
<template #default="{ row }">
<span class="font-mono text-xs break-all">{{ row.app_secret }}</span>
</template>
</el-table-column>
<el-table-column label="操作" width="90" align="right">
<template #default="{ row }">
<el-button link type="primary" @click="copyRow(row)">复制</el-button>
</template>
</el-table-column>
</el-table>
<template #footer>
<el-button :disabled="!list.length" @click="copyAll">复制全部</el-button>
<el-button type="primary" @click="visible = false">知道了</el-button>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { ElMessage } from 'element-plus'
const visible = ref(false)
const list = ref<any[]>([])
/**
* 打开弹窗展示批量重置结果
*/
const show = (items: any[]) => {
list.value = items || []
visible.value = true
}
const copy = (text: string) => {
if (!text) return
navigator.clipboard?.writeText(text).then(() => ElMessage.success('已复制到剪贴板'))
}
/**
* 复制单条密钥(账号名 + AK + SK)
*/
const copyRow = (row: any) => {
copy(`${ row.name }\nAccess Key: ${ row.app_key }\nSecret Key: ${ row.app_secret }`)
}
/**
* 复制全部结果,便于一次性分发给多个对接方
*/
const copyAll = () => {
const text = (list.value || [])
.map(row => `${ row.name }\nAccess Key: ${ row.app_key }\nSecret Key: ${ row.app_secret }`)
.join('\n\n')
copy(text)
}
const handleClosed = () => {
list.value = []
}
defineExpose({ show })
</script>

View File

@ -0,0 +1,132 @@
<template>
<div>
<div class="flex items-center justify-between mb-3">
<span class="text-sm text-gray-500">
已授权 <b class="text-primary">{{ checkedCount }}</b> / {{ tree.length }} 个模块
</span>
<div>
<el-button link type="primary" @click="setAll">全选</el-button>
<el-button link type="danger" @click="clearAll">清空</el-button>
</div>
</div>
<div v-if="!tree.length" class="auth-empty">
<el-icon class="auth-empty__icon">
<Files />
</el-icon>
<span>暂无可授权的开放接口</span>
</div>
<div v-else class="flex flex-col gap-3">
<div v-for="group in tree" :key="group.group_key"
class="border rounded-lg p-3 transition-colors"
:class="isChecked(group.domain) ? 'border-primary bg-primary/5' : 'border-gray-200'">
<div class="flex items-center justify-between">
<el-checkbox :model-value="isChecked(group.domain)"
@change="(val) => toggle(group.domain, val)">
<span class="font-medium">{{ group.group_name }}</span>
</el-checkbox>
<span class="text-xs text-gray-400">含 {{ group.items.length }} 个接口</span>
</div>
<div class="mt-2 pl-6 flex flex-col gap-1.5">
<div v-for="item in group.items" :key="item.api_key"
class="flex items-center gap-2 text-xs">
<el-tag size="small" :type="methodType(item.method)" class="shrink-0">
{{ (item.method || 'get').toUpperCase() }}
</el-tag>
<span class="text-gray-700 shrink-0">{{ item.name }}</span>
<span class="font-mono text-gray-400 truncate">{{ item.path }}</span>
</div>
</div>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { computed, ref } from 'vue'
import { Files } from '@element-plus/icons-vue'
interface ApiItem {
api_key: string
name: string
desc: string
method: string
path: string
}
interface ApiGroup {
group_key: string
group_name: string
domain: string
items: ApiItem[]
}
const props = defineProps<{
modelValue: string[]
}>()
const emit = defineEmits<{
(e: 'update:modelValue', value: string[]): void
}>()
const tree = ref<ApiGroup[]>([])
/**
* 设置可授权模块树
*/
const setTree = (list: ApiGroup[]) => {
tree.value = list || []
}
const checkedModules = computed(() => props.modelValue || [])
const checkedCount = computed(() => checkedModules.value.length)
const isChecked = (module: string) => checkedModules.value.includes(module)
/**
* 勾选 / 取消某个模块(勾选即拥有该模块下全部接口权限)
*/
const toggle = (module: string, checked: boolean) => {
const current = new Set(props.modelValue || [])
if (checked) current.add(module)
else current.delete(module)
emit('update:modelValue', Array.from(current))
}
const setAll = () => emit('update:modelValue', tree.value.map(group => group.domain))
const clearAll = () => emit('update:modelValue', [])
const methodType = (method: string) => {
const m = (method || 'get').toLowerCase()
if (m === 'get') return 'success'
if (m === 'post') return 'primary'
if (m === 'put') return 'warning'
if (m === 'delete') return 'danger'
return 'info'
}
defineExpose({ setTree })
</script>
<style lang="scss" scoped>
.auth-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 8px;
padding: 28px 0;
color: #c0c4cc;
font-size: 13px;
&__icon {
font-size: 32px;
}
}
</style>

View File

@ -0,0 +1,47 @@
<template>
<el-drawer v-model="visible" :title="title" size="960px" destroy-on-close @opened="onOpened">
<div class="log-drawer__body">
<log-list ref="logListRef" :app-id="appId" :auto-load="false" />
</div>
</el-drawer>
</template>
<script lang="ts" setup>
import { computed, ref } from 'vue'
import LogList from './log-list.vue'
const visible = ref(false)
const appId = ref<number | string>('')
const appName = ref('')
const logListRef = ref()
const title = computed(() => appName.value ? `调用日志 - ${ appName.value }` : '调用日志')
/**
* 打开日志抽屉
* @param id 开放账号 id(可选,不传则查看全部)
* @param name 开放账号名称(可选,用于标题展示)
*/
const show = (id?: number | string, name?: string) => {
appId.value = id ?? ''
appName.value = name ?? ''
visible.value = true
}
// 抽屉动画结束后再加载,保证表格拿到正确高度
const onOpened = () => {
logListRef.value?.refresh()
}
defineExpose({ show })
</script>
<style lang="scss" scoped>
.log-drawer__body {
height: 100%;
}
:deep(.el-drawer__body) {
overflow: hidden;
}
</style>

View File

@ -0,0 +1,211 @@
<template>
<div class="log-list">
<div class="table-search-wrap table-search-wrap--panel log-list__search">
<el-form :inline="true" :model="searchParam">
<el-form-item label="时间范围">
<el-date-picker v-model="searchParam.create_time" type="datetimerange"
value-format="YYYY-MM-DD HH:mm:ss" range-separator="至"
start-placeholder="开始时间" end-placeholder="结束时间" />
</el-form-item>
<el-form-item label="接口">
<el-input v-model.trim="searchParam.api_key" class="input-width" placeholder="接口标识"
clearable @keyup.enter="loadList(1)" />
</el-form-item>
<el-form-item label="响应码">
<el-select v-model="searchParam.code" class="input-width" placeholder="全部" clearable>
<el-option label="成功" :value="1" />
<el-option label="失败" :value="0" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="loadList(1)">搜索</el-button>
<el-button @click="resetSearch">重置</el-button>
</el-form-item>
</el-form>
</div>
<div class="table-panel log-list__panel">
<div class="log-list__table">
<el-table height="100%" :data="tableData.data" size="large" v-loading="tableData.loading">
<template #empty>
<span>{{ !tableData.loading ? '暂无调用记录' : '' }}</span>
</template>
<el-table-column type="expand">
<template #default="{ row }">
<div class="px-6 py-2">
<div class="text-xs text-gray-400 mb-1">请求参数(已脱敏)</div>
<pre class="text-xs bg-gray-50 p-3 rounded overflow-auto">{{ prettyParams(row.params) }}</pre>
</div>
</template>
</el-table-column>
<el-table-column label="时间" width="170">
<template #default="{ row }">{{ formatTime(row.create_time) }}</template>
</el-table-column>
<el-table-column label="账号" min-width="160" show-overflow-tooltip>
<template #default="{ row }">
<span class="font-mono text-xs">{{ row.app_key || '--' }}</span>
</template>
</el-table-column>
<el-table-column label="接口" min-width="200" show-overflow-tooltip>
<template #default="{ row }">{{ row.api_key || row.url }}</template>
</el-table-column>
<el-table-column label="方法" width="90" align="center">
<template #default="{ row }">
<el-tag size="small" :type="methodTagType(row.method)">{{ row.method }}</el-tag>
</template>
</el-table-column>
<el-table-column label="耗时(ms)" width="100" align="center">
<template #default="{ row }">{{ row.cost_ms }}</template>
</el-table-column>
<el-table-column label="响应码" width="100" align="center">
<template #default="{ row }">
<span :class="row.code === 1 ? 'text-green-600' : 'text-red-500'">{{ row.code }}</span>
</template>
</el-table-column>
<el-table-column label="来源 IP" width="140">
<template #default="{ row }">{{ row.ip }}</template>
</el-table-column>
</el-table>
</div>
<table-pagination v-model:current-page="tableData.page" v-model:page-size="tableData.limit"
:total="tableData.total" @size-change="loadList()" @current-change="loadList" />
</div>
</div>
</template>
<script lang="ts" setup>
import { reactive, watch } from 'vue'
import TablePagination from '@/components/table-pagination/index.vue'
import { getOpenapiLogPage } from '@/app/api/openapi'
const props = defineProps<{
/** 按开放账号过滤(可选) */
appId?: number | string
/** 是否挂载后自动加载(置于抽屉中时由外部在打开动画结束后触发) */
autoLoad?: boolean
}>()
const tableData = reactive({
page: 1,
limit: 10,
total: 0,
loading: true,
data: [] as any[]
})
const searchParam = reactive({
api_key: '',
code: '' as string | number,
create_time: [] as string[]
})
/**
* 时间展示:后端时间字段可能是时间戳(数字)或已格式化的日期字符串,兼容处理
*/
const formatTime = (time: number | string) => {
if (!time) return '--'
// 已是「YYYY-MM-DD HH:mm:ss」格式,直接展示
if (typeof time === 'string') return time.slice(0, 19)
const date = new Date(time * 1000)
if (Number.isNaN(date.getTime())) return '--'
const pad = (num: number) => String(num).padStart(2, '0')
return `${ date.getFullYear() }-${ pad(date.getMonth() + 1) }-${ pad(date.getDate()) } ${ pad(date.getHours()) }:${ pad(date.getMinutes()) }:${ pad(date.getSeconds()) }`
}
const prettyParams = (params: any) => {
if (!params || Object.keys(params).length === 0) return '无'
try {
return JSON.stringify(params, null, 2)
} catch (e) {
console.error(e)
return String(params)
}
}
const methodTagType = (method: string) => {
const map: Record<string, string> = {
GET: 'success',
POST: 'primary',
PUT: 'warning',
DELETE: 'danger'
}
return map[ String(method).toUpperCase() ] || 'info'
}
/**
* 加载调用日志
*/
const loadList = (page?: number) => {
if (page) tableData.page = page
tableData.loading = true
getOpenapiLogPage({
page: tableData.page,
limit: tableData.limit,
app_id: props.appId || '',
api_key: searchParam.api_key,
code: searchParam.code,
create_time: searchParam.create_time
}).then((res: any) => {
tableData.loading = false
tableData.data = res.data.data || []
tableData.total = res.data.total || 0
}).catch(() => {
tableData.loading = false
})
}
const resetSearch = () => {
searchParam.api_key = ''
searchParam.code = ''
searchParam.create_time = []
loadList(1)
}
// 过滤的账号变化时重新加载
watch(() => props.appId, () => loadList(1))
if (props.autoLoad !== false) loadList()
defineExpose({ refresh: () => loadList(1) })
</script>
<style lang="scss" scoped>
.log-list {
display: flex;
flex-direction: column;
height: 100%;
min-height: 0;
overflow: hidden;
&__search {
flex-shrink: 0;
}
&__panel {
flex: 1;
display: flex;
flex-direction: column;
min-height: 0;
overflow: hidden;
}
&__table {
flex: 1;
min-height: 0;
overflow: hidden;
}
}
</style>

View File

@ -0,0 +1,63 @@
<template>
<el-dialog v-model="visible" title="开放账号密钥" width="560px" :close-on-click-modal="false" @closed="handleClosed">
<el-alert type="info" :closable="false" show-icon class="mb-4"
title="密钥已生成,可在账号列表中点击眼睛图标随时查看;建议复制后妥善保存" />
<div class="mb-4">
<div class="text-sm text-gray-500 mb-2">Access Key</div>
<div class="flex items-center gap-2 bg-gray-900 text-gray-100 rounded px-3 py-2">
<span class="flex-1 font-mono text-base break-all">{{ data.app_key }}</span>
<el-button link type="primary" @click="copy(data.app_key)">复制</el-button>
</div>
</div>
<div class="mb-2">
<div class="text-sm text-gray-500 mb-2">Secret Key</div>
<div class="flex items-center gap-2 bg-gray-900 text-gray-100 rounded px-3 py-2">
<span class="flex-1 font-mono text-base break-all">{{ data.app_secret }}</span>
<el-button link type="primary" @click="copy(data.app_secret)">复制</el-button>
</div>
</div>
<template #footer>
<el-button type="primary" @click="visible = false">知道了</el-button>
</template>
</el-dialog>
</template>
<script lang="ts" setup>
import { reactive, ref } from 'vue'
import { ElMessage } from 'element-plus'
const visible = ref(false)
const data = reactive({
app_key: '',
app_secret: ''
})
/**
* 打开弹窗展示密钥(仅在创建成功与重置密钥后调用)
*/
const show = (app_key: string, app_secret: string) => {
data.app_key = app_key
data.app_secret = app_secret
visible.value = true
}
/**
* 复制到剪贴板
*/
const copy = (text: string) => {
navigator.clipboard?.writeText(text).then(() => {
ElMessage.success('已复制到剪贴板')
})
}
const handleClosed = () => {
data.app_key = ''
data.app_secret = ''
}
defineExpose({ show })
</script>

View File

@ -0,0 +1,702 @@
<template>
<div class="main-container doc-page">
<!-- 顶部:端类型切换 -->
<div class="doc-tabs">
<el-tabs v-model="activeTab" @tab-change="onTabChange">
<el-tab-pane label="平台端(开放)" name="admin" />
<el-tab-pane label="站点端(开放)" name="site" />
</el-tabs>
</div>
<div class="doc-body">
<!-- 左侧:接口列表 -->
<aside class="doc-aside">
<div class="doc-aside__head">
<el-input v-model.trim="keyword" placeholder="搜索接口名称 / 路径" clearable prefix-icon="Search" />
</div>
<div class="doc-aside__body">
<div v-if="!filteredTree.length" class="doc-empty doc-empty--sm">
<el-icon class="doc-empty__icon">
<Files />
</el-icon>
<div class="doc-empty__text">暂无接口</div>
</div>
<template v-else>
<div v-for="group in filteredTree" :key="group.group_key" class="doc-group">
<div class="doc-group__title">
<span>{{ group.group_name }}</span>
<span class="text-xs text-gray-400">{{ group.items.length }}</span>
</div>
<div v-for="item in group.items" :key="item.api_key"
class="doc-api" :class="{ 'is-active': detail && detail.api_key === item.api_key }"
@click="selectApi(item.api_key)">
<el-tag size="small" :type="methodType(item.method)" class="shrink-0">
{{ (item.method || 'get').toUpperCase() }}
</el-tag>
<span class="doc-api__name">{{ item.name }}</span>
</div>
</div>
</template>
</div>
</aside>
<!-- 右侧:接口详情 + 在线调试 -->
<section class="doc-main">
<div v-if="!detail" class="doc-empty">
<el-icon class="doc-empty__icon">
<Pointer />
</el-icon>
<div class="doc-empty__text">请选择左侧接口查看详情</div>
</div>
<template v-else>
<div class="doc-detail__head">
<div class="flex items-center justify-between gap-2 flex-wrap">
<div class="flex items-center gap-2 flex-wrap">
<el-tag :type="methodType(detail.method)">{{ (detail.method || 'get').toUpperCase() }}</el-tag>
<span class="text-lg font-medium">{{ detail.name }}</span>
<el-tag v-if="!detail.need_auth" size="small" type="warning">免鉴权</el-tag>
</div>
<el-button type="primary" @click="openDebug">
<el-icon class="mr-1">
<VideoPlay />
</el-icon>
在线调试
</el-button>
</div>
<div class="text-sm text-gray-500 mt-2">{{ detail.desc || '暂无接口说明' }}</div>
<div class="doc-path mt-3">
<span class="font-mono break-all">{{ detail.path }}</span>
<el-button link type="primary" @click="copy(fullPath)">复制地址</el-button>
</div>
<div class="flex flex-wrap gap-x-6 gap-y-1 mt-3 text-xs text-gray-500">
<span>所属模块:{{ detail.group_name }}</span>
<span>接口标识:{{ detail.api_key }}</span>
<span v-if="detail.addon">所属插件:{{ detail.addon }}</span>
<span>端类型:{{ appTypeName(detail.app_type) }}</span>
</div>
</div>
<!-- 请求参数 -->
<div class="doc-section">
<div class="doc-section__title">请求参数</div>
<el-table v-if="paramList.length" :data="paramList" size="small" border>
<el-table-column prop="name" label="参数名" min-width="150" />
<el-table-column prop="type" label="类型" width="100" />
<el-table-column label="必填" width="80" align="center">
<template #default="{ row }">
<el-tag v-if="row.required" size="small" type="danger">是</el-tag>
<span v-else class="text-gray-400">否</span>
</template>
</el-table-column>
<el-table-column prop="desc" label="说明" min-width="180">
<template #default="{ row }">
<span>{{ row.desc || row.name }}</span>
</template>
</el-table-column>
</el-table>
<div v-else class="text-sm text-gray-400">该接口无请求参数</div>
</div>
<!-- 返回示例 -->
<div class="doc-section">
<div class="doc-section__title">返回示例</div>
<pre v-if="hasResponseSample" class="doc-code">{{ responseSample }}</pre>
<div v-else class="text-sm text-gray-400">暂无静态返回示例,可点击右上角「在线调试」查看真实响应</div>
</div>
<!-- 在线调试(右侧抽屉) -->
<el-drawer v-model="debugVisible" :title="debugTitle" size="640px">
<div class="doc-debug">
<!-- 当前正在调试的接口 -->
<div class="doc-debug__api">
<div class="flex items-center gap-2 flex-wrap">
<el-tag :type="methodType(detail.method)">{{ (detail.method || 'get').toUpperCase() }}</el-tag>
<span class="font-medium">{{ detail.name }}</span>
<el-tag v-if="!detail.need_auth" size="small" type="warning">免鉴权</el-tag>
</div>
<div class="doc-path mt-2">
<span class="font-mono break-all">{{ detail.path }}</span>
<el-button link type="primary" @click="copy(fullPath)">复制地址</el-button>
</div>
</div>
<div class="text-xs text-gray-400 mb-3">
{{ detail.need_auth ? '由浏览器直接请求开放平台接口,需携带访问令牌(AK/SK 换取)' : '该接口免鉴权,无需访问令牌' }}
</div>
<div class="flex flex-wrap gap-3 items-end mb-3">
<div>
<div class="text-xs text-gray-500 mb-1">接口地址前缀</div>
<el-input v-model.trim="debug.base" class="input-base" placeholder="/openapi" />
</div>
<template v-if="detail.need_auth">
<div>
<div class="text-xs text-gray-500 mb-1">开放账号</div>
<div class="flex items-center gap-2">
<el-select v-model="debug.appId" placeholder="选择开放账号" class="input-app" clearable>
<el-option v-for="app in debugAppList" :key="app.id"
:label="app.site_id === 0 ? app.name + '(平台)' : app.name + '(站点 ' + app.site_id + ')'"
:value="app.id" />
</el-select>
<el-button :icon="Refresh" :loading="appsLoading" title="刷新开放账号" @click="loadApps" />
</div>
</div>
<el-button type="primary" :loading="tokenLoading" @click="fetchToken">获取令牌</el-button>
</template>
</div>
<div v-if="detail.need_auth" class="mb-3">
<div class="text-xs text-gray-500 mb-1">访问令牌(获得后可手工修改)</div>
<el-input v-model.trim="debug.token" placeholder="Bearer Token" clearable>
<template #append>
<el-button @click="copy(debug.token)">复制</el-button>
</template>
</el-input>
</div>
<div v-if="paramList.length" class="mb-3">
<div class="text-xs text-gray-500 mb-1">参数值</div>
<div class="flex flex-col gap-2">
<div v-for="p in paramList" :key="p.name" class="flex items-center gap-3">
<span class="doc-param-name">
{{ p.name }}<span v-if="p.required" class="text-red-500"> *</span>
</span>
<el-input v-model="debug.params[p.name]" :placeholder="p.desc || p.name" class="flex-1" />
</div>
</div>
</div>
<el-button type="primary" :loading="sending" @click="send">发送请求</el-button>
<div v-if="response" class="mt-4">
<div class="doc-section__title">
<span>响应结果</span>
<el-tag size="small" :type="response.ok ? 'success' : 'danger'">
HTTP {{ response.status }}
</el-tag>
<span class="text-xs font-normal text-gray-400">{{ response.cost }} ms</span>
</div>
<pre class="doc-code doc-code--response">{{ response.body }}</pre>
</div>
</div>
</el-drawer>
</template>
</section>
</div>
</div>
</template>
<script lang="ts" setup>
import { computed, onMounted, reactive, ref } from 'vue'
import axios from 'axios'
import { ElMessage } from 'element-plus'
import { Files, Pointer, Refresh, VideoPlay } from '@element-plus/icons-vue'
import {
getOpenapiDocApps,
getOpenapiDocBase,
getOpenapiDocDetail,
getOpenapiDocSecret,
getOpenapiDocTree
} from '@/app/api/openapi'
interface ApiItem {
api_key: string
name: string
desc: string
method: string
path: string
need_auth: boolean
param_count: number
}
interface ApiGroup {
group_key: string
group_name: string
app_type: string
domain: string
addon: string
items: ApiItem[]
}
/** 端类型显示名(本页当前只覆盖开放平台的端) */
const APP_TYPE_NAMES: Record<string, string> = {
admin: '平台端(开放)',
site: '站点端(开放)'
}
const appTypeName = (appType: string) => APP_TYPE_NAMES[appType] || appType || '-'
/** 当前端类型标签:admin 平台端(开放) / site 站点端(开放) */
const activeTab = ref('admin')
const keyword = ref('')
const tree = ref<ApiGroup[]>([])
const detail = ref<any>(null)
const appList = ref<any[]>([])
/** 在线调试抽屉 */
const debugVisible = ref(false)
const debugTitle = computed(() => detail.value ? `${ detail.value.name } - 在线调试` : '在线调试')
const openDebug = () => { debugVisible.value = true }
const debug = reactive({
base: '',
appId: '' as string | number,
token: '',
params: {} as Record<string, any>
})
const tokenLoading = ref(false)
const appsLoading = ref(false)
const sending = ref(false)
const response = ref<any>(null)
/** 当前端可用的调试账号(平台端接口用平台级账号,站点端接口用店铺账号) */
const debugAppList = computed(() => (appList.value || []).filter(app => app.app_type === activeTab.value))
/** 关键词过滤后的接口树 */
const filteredTree = computed(() => {
const kw = keyword.value.toLowerCase()
if (!kw) return tree.value
return tree.value
.map(group => {
const items = (group.items || []).filter(item =>
(item.name || '').toLowerCase().includes(kw) ||
(item.path || '').toLowerCase().includes(kw) ||
(item.api_key || '').toLowerCase().includes(kw)
)
return { ...group, items }
})
.filter(group => group.items.length > 0)
})
/** 参数列表(清单 params 为 { 参数名: { name, type, required } } 结构) */
const paramList = computed(() => {
const params = detail.value?.params || {}
return Object.keys(params).map(key => {
const item = params[key] || {}
return {
name: key,
type: item.type || 'string',
required: !!item.required,
desc: item.name && item.name !== key ? item.name : ''
}
})
})
const hasResponseSample = computed(() => {
const r = detail.value?.response
if (!r) return false
if (Array.isArray(r)) return r.length > 0
return Object.keys(r).length > 0
})
const responseSample = computed(() => {
try {
return JSON.stringify(detail.value?.response ?? {}, null, 2)
} catch (e) {
return ''
}
})
/** 完整请求地址 */
const fullPath = computed(() => {
if (!detail.value) return ''
return `${ normalizeBase(debug.base) }/${ detail.value.path }`
})
const normalizeBase = (base: string) => (base || '/openapi').replace(/\/+$/, '')
const methodType = (method: string) => {
const m = (method || 'get').toLowerCase()
if (m === 'get') return 'success'
if (m === 'post') return 'primary'
if (m === 'put') return 'warning'
if (m === 'delete') return 'danger'
return 'info'
}
const copy = (text: string) => {
if (!text) return
navigator.clipboard?.writeText(text).then(() => ElMessage.success('已复制到剪贴板'))
}
/**
* 加载接口清单树
*/
const loadTree = () => {
getOpenapiDocTree(activeTab.value).then((res: any) => {
tree.value = res.data || []
// 默认选中第一个接口
autoSelectFirst()
})
}
/**
* 默认选中第一个接口
*/
const autoSelectFirst = () => {
const first = tree.value[0]?.items?.[0]
if (first) {
selectApi(first.api_key)
} else {
detail.value = null
response.value = null
}
}
/**
* 切换端类型,按端重新加载接口清单
*/
const onTabChange = () => {
detail.value = null
response.value = null
// 端已切换,重置调试身份(账号与令牌)
debug.appId = ''
debug.token = ''
loadTree()
}
/**
* 加载开放账号列表(用于换取令牌)
*/
const loadApps = () => {
// 调试账号列表:平台端登录时返回全部账号(含禁用),店铺端登录仅返回本店铺账号
appsLoading.value = true
getOpenapiDocApps().then((res: any) => {
appList.value = res.data || []
// 已选账号若已不存在,重置选择避免使用失效账号换取令牌
if (debug.appId && !appList.value.some(app => app.id === debug.appId)) {
debug.appId = ''
debug.token = ''
}
}).finally(() => {
appsLoading.value = false
})
}
/**
* 加载调试基础地址
*/
const loadBase = () => {
getOpenapiDocBase().then((res: any) => {
debug.base = res.data?.openapi_base || '/openapi'
})
}
/**
* 选中接口,加载详情并重置调试参数
*/
const selectApi = (apiKey: string) => {
getOpenapiDocDetail(apiKey).then((res: any) => {
detail.value = res.data || null
response.value = null
debug.params = {}
})
}
/**
* 选择开放账号后自动换取令牌
*/
const fetchToken = () => {
if (!debug.appId) {
ElMessage.warning('请先选择开放账号')
return
}
tokenLoading.value = true
getOpenapiDocSecret(debug.appId as number).then((res: any) => {
const { app_key, app_secret } = res.data || {}
return axios.post(
`${ normalizeBase(debug.base) }/v1/auth/token`,
{ app_key, app_secret },
{ timeout: 30000, validateStatus: () => true }
).then((tokenRes: any) => {
tokenLoading.value = false
const body = tokenRes.data || {}
if (body.code === 1 && body.data?.access_token) {
debug.token = body.data.access_token
ElMessage.success('获取令牌成功')
} else {
ElMessage.error(body.msg || '获取令牌失败')
}
})
}).catch((err: any) => {
tokenLoading.value = false
ElMessage.error(err?.msg || '获取令牌失败')
})
}
/**
* 发送调试请求
*/
const send = () => {
if (!detail.value) return
sending.value = true
response.value = null
const start = Date.now()
// 动态路径参数(如 v1/shop/goods/:id)
const usedKeys: Record<string, boolean> = {}
const path = (detail.value.path || '').replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g, (_: string, key: string) => {
usedKeys[key] = true
return encodeURIComponent(debug.params[key] ?? '')
})
// 剩余参数按请求方式放入 query 或 body
const rest: Record<string, any> = {}
Object.keys(debug.params).forEach(key => {
const value = debug.params[key]
if (!usedKeys[key] && value !== '' && value !== undefined && value !== null) rest[key] = value
})
const method = (detail.value.method || 'get').toLowerCase()
const config: any = {
url: `${ normalizeBase(debug.base) }/${ path }`,
method,
timeout: 30000,
validateStatus: () => true,
headers: {}
}
// 免鉴权接口不携带令牌;同时带自定义头,兼容 Apache 等会丢弃 Authorization 的服务器
if (detail.value.need_auth && debug.token) {
config.headers[ 'Authorization' ] = `Bearer ${ debug.token }`
config.headers[ 'X-Openapi-Key' ] = debug.token
}
if (method === 'get') config.params = rest
else config.data = rest
axios.request(config).then((res: any) => {
sending.value = false
response.value = {
ok: res.status >= 200 && res.status < 300,
status: res.status,
cost: Date.now() - start,
body: JSON.stringify(res.data, null, 2)
}
}).catch((err: any) => {
sending.value = false
response.value = {
ok: false,
status: 0,
cost: Date.now() - start,
body: err?.message || '请求失败,请检查接口地址前缀是否正确'
}
})
}
onMounted(() => {
loadTree()
loadApps()
loadBase()
})
</script>
<style lang="scss" scoped>
// el-drawer 的 header 自带 32px 下边距,会让标题与内容之间空出一大截,收紧为 0(项目内统一做法)
:deep(.el-drawer__header) {
margin-bottom: 0 !important;
}
.doc-page {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
background: #fff;
border-radius: 8px;
}
.doc-tabs {
flex-shrink: 0;
padding: 0 16px;
border-bottom: 1px solid var(--el-border-color-lighter);
:deep(.el-tabs__header) {
margin: 0;
}
:deep(.el-tabs__nav-wrap::after) {
display: none;
}
}
.doc-body {
flex: 1;
display: flex;
overflow: hidden;
}
.doc-aside {
width: 300px;
flex-shrink: 0;
border-right: 1px solid var(--el-border-color-lighter);
display: flex;
flex-direction: column;
overflow: hidden;
&__head {
padding: 12px;
border-bottom: 1px solid var(--el-border-color-lighter);
}
&__body {
flex: 1;
overflow-y: auto;
padding: 8px;
}
}
.doc-group {
margin-bottom: 12px;
&__title {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 12px;
color: #909399;
padding: 6px 8px;
}
}
.doc-api {
display: flex;
align-items: center;
gap: 8px;
padding: 7px 8px;
border-radius: 6px;
cursor: pointer;
transition: background-color 0.2s;
&:hover {
background: var(--el-fill-color-light);
}
&.is-active {
background: var(--el-color-primary-light-9);
}
&__name {
font-size: 13px;
color: #303133;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
.doc-main {
flex: 1;
overflow-y: auto;
padding: 16px 20px;
}
.doc-detail__head {
padding-bottom: 16px;
border-bottom: 1px solid var(--el-border-color-lighter);
}
.doc-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 10px;
min-height: 320px;
color: #c0c4cc;
&__icon {
font-size: 46px;
}
&__text {
font-size: 13px;
}
&--sm {
min-height: 160px;
.doc-empty__icon {
font-size: 32px;
}
}
}
.doc-path {
display: flex;
align-items: center;
gap: 12px;
background: var(--el-fill-color-light);
border-radius: 6px;
padding: 8px 12px;
font-size: 13px;
}
.doc-section {
margin-top: 20px;
&__title {
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
font-weight: 500;
color: #303133;
margin-bottom: 10px;
}
}
.doc-param-name {
width: 150px;
flex-shrink: 0;
font-size: 13px;
color: #606266;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.doc-debug {
padding-bottom: 20px;
// 当前调试的接口信息:与详情页页头一致,用下分隔线区分
&__api {
padding-bottom: 12px;
margin-bottom: 12px;
border-bottom: 1px solid var(--el-border-color-lighter);
}
}
.input-base {
width: 320px;
}
.input-app {
width: 220px;
}
.doc-code {
background: #1e1e1e;
color: #d4d4d4;
border-radius: 6px;
padding: 12px 14px;
font-size: 12px;
line-height: 1.7;
font-family: Consolas, Monaco, monospace;
max-height: 420px;
overflow: auto;
white-space: pre-wrap;
word-break: break-all;
margin: 0;
&--response {
min-height: 80px;
}
}
</style>

View File

@ -0,0 +1,531 @@
<template>
<div ref="pageRef" class="main-container table-fill-page" :style="pageStyle">
<div class="table-fill-page__card">
<el-alert v-if="!isOpen" type="warning" :closable="false" show-icon
title="开放平台功能已关闭:对外接口已全部停止服务(含已签发的令牌),当前仅可查看账号与调用日志" />
<div class="table-search-wrap table-search-wrap--panel flex justify-between items-center">
<el-form :inline="true" :model="searchParam">
<el-form-item label="账号名称">
<el-input v-model.trim="searchParam.name" class="input-width" placeholder="请输入账号名称"
clearable @keyup.enter="loadList(1)" />
</el-form-item>
<el-form-item label="状态">
<el-select v-model="searchParam.status" class="input-width" placeholder="全部" clearable>
<el-option label="启用" :value="1" />
<el-option label="禁用" :value="0" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="loadList(1)">搜索</el-button>
<el-button @click="resetSearch">重置</el-button>
</el-form-item>
</el-form>
<!-- 开放平台总开关:平台级配置,店铺端只读 -->
<div class="flex justify-end items-center flex-1">
<div class="flex items-center">
<!-- 数据加密密钥刷新:仅平台端可见(密钥全平台共用,会影响所有站点的账号) -->
<el-tooltip v-if="isAdmin" class="box-item" effect="dark" placement="top-start"
content="重新生成全平台共用的数据加密密钥,并重新加密所有站点(含各店铺)的开放账号 Secret Key;对接方无需改动">
<el-button link type="primary" class="mr-[16px]" :loading="secretLoading"
@click="refreshSecretEvent">刷新加密密钥</el-button>
</el-tooltip>
<el-tooltip class="box-item" effect="dark" :content="configTip" placement="top-start">
<span class="text-[14px] mr-[10px] flex items-center">
开放平台功能
<span class="iconfont iconwenhao text-[#999] !text-[14px]"></span>
</span>
</el-tooltip>
<el-switch v-model="config.is_open" active-value="1" inactive-value="0"
:disabled="!isAdmin" :loading="configLoading" @change="toggleConfig" />
<el-tag :type="isOpen ? 'success' : 'danger'" size="small" class="ml-[10px]">
{{ isOpen ? '已开启' : '已关闭' }}
</el-tag>
</div>
</div>
</div>
<div class="table-panel table-fill-page__panel">
<table-toolbar title="开放账号"
:selected-count="selectedCount"
:current-page-count="tableData.data.length"
:total-count="tableData.total"
:selection-loading="selectionLoading"
:selection-disabled="!isOpen"
:allow-select-all="false"
@select-page="selectCurrentPage"
@clear-selection="clearSelection">
<template #batch-actions>
<el-button link type="primary" :disabled="!selectedCount || !isOpen"
@click="batchResetSecretEvent">批量重置密钥</el-button>
</template>
<template #actions>
<el-button type="primary" :disabled="!isOpen" @click="addEvent">创建开放账号</el-button>
</template>
</table-toolbar>
<div class="table-fill-page__table">
<el-table ref="tableRef" height="100%" :data="tableData.data" size="large" v-loading="tableData.loading"
row-key="id" @selection-change="handleSelectionChange">
<template #empty>
<span>{{ !tableData.loading ? '还没有开放账号,点击右上角创建' : '' }}</span>
</template>
<el-table-column type="selection" width="55" reserve-selection />
<el-table-column label="账号名称" min-width="170" show-overflow-tooltip>
<template #default="{ row }">
<div class="font-medium">{{ row.name }}</div>
<div v-if="row.remark" class="text-xs text-gray-400">{{ row.remark }}</div>
</template>
</el-table-column>
<el-table-column label="Access Key" min-width="230">
<template #default="{ row }">
<div class="flex items-center gap-2">
<span class="font-mono text-xs">{{ row.app_key }}</span>
<el-button link type="primary" @click="copy(row.app_key)">复制</el-button>
</div>
</template>
</el-table-column>
<el-table-column label="Secret Key" width="250">
<template #default="{ row }">
<div class="flex items-center gap-1">
<span class="font-mono text-xs">
{{ secretVisible[row.id] ? secretMap[row.id] : '••••••••' }}
</span>
<el-tooltip :content="secretVisible[row.id] ? '隐藏' : '查看'" placement="top">
<el-button link type="primary" @click="toggleSecret(row)">
<el-icon>
<component :is="secretVisible[row.id] ? Hide : View" />
</el-icon>
</el-button>
</el-tooltip>
<el-button link type="primary" @click="copySecret(row)">复制</el-button>
<el-button link type="danger" :disabled="!isOpen" @click="resetSecretEvent(row)">重置</el-button>
</div>
</template>
</el-table-column>
<el-table-column label="状态" width="90" align="center">
<template #default="{ row }">
<el-switch :model-value="row.status" :active-value="1" :inactive-value="0"
:disabled="!isOpen" @change="(val) => statusEvent(row, val)" />
</template>
</el-table-column>
<el-table-column label="已授权模块" min-width="190">
<template #default="{ row }">
<template v-if="(row.auth_domains || []).length">
<el-tag v-for="module in row.auth_domains" :key="module" size="small"
class="mr-1 mb-1" type="primary">
{{ domainName(module) }}
</el-tag>
</template>
<span v-else class="text-gray-400">未授权</span>
</template>
</el-table-column>
<el-table-column label="有效期" width="120" align="center">
<template #default="{ row }">
{{ row.expire_time ? formatTime(row.expire_time) : '长期有效' }}
</template>
</el-table-column>
<el-table-column label="最近调用" width="160" align="center">
<template #default="{ row }">
{{ row.last_visit_time ? formatTime(row.last_visit_time) : '从未调用' }}
</template>
</el-table-column>
<el-table-column label="操作" align="right" fixed="right" width="210">
<template #default="{ row }">
<table-actions :actions="rowActions(row)" />
</template>
</el-table-column>
</el-table>
</div>
<table-pagination v-model:current-page="tableData.page" v-model:page-size="tableData.limit"
:total="tableData.total" @size-change="loadList()" @current-change="loadList" />
</div>
<app-form-drawer ref="formDrawerRef" @complete="handleFormComplete" />
<secret-dialog ref="secretDialogRef" />
<batch-secret-dialog ref="batchSecretDialogRef" />
<log-drawer ref="logDrawerRef" />
</div>
</div>
</template>
<script lang="ts" setup>
import { computed, nextTick, reactive, ref } from 'vue'
import { ElMessage, ElMessageBox, ElTable } from 'element-plus'
import { useTablePageHeight } from '@/hooks/useTablePageHeight'
import { getAppType } from '@/utils/common'
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 { Hide, View } from '@element-plus/icons-vue'
import {
batchResetOpenapiSecret,
deleteOpenapiApp,
getOpenapiAppPage,
getOpenapiAppSecret,
getOpenapiConfig,
refreshOpenapiSecret,
resetOpenapiAppSecret,
setOpenapiAppStatus,
setOpenapiConfig
} from '@/app/api/openapi'
import AppFormDrawer from './components/app-form-drawer.vue'
import BatchSecretDialog from './components/batch-secret-dialog.vue'
import LogDrawer from './components/log-drawer.vue'
import SecretDialog from './components/secret-dialog.vue'
const { pageRef, pageStyle } = useTablePageHeight()
/** 模块中文名映射 */
const DOMAIN_NAMES: Record<string, string> = {
auth: '授权',
common: '公共',
goods: '商品',
order: '订单',
member: '会员'
}
const tableData = reactive({
page: 1,
limit: 10,
total: 0,
loading: true,
data: [] as any[]
})
const searchParam = reactive({
name: '',
status: '' as string | number
})
const formDrawerRef = ref()
const secretDialogRef = ref()
const logDrawerRef = ref()
const batchSecretDialogRef = ref()
/** 表格多选(支持跨页保留) */
const tableRef = ref<InstanceType<typeof ElTable>>()
const selectedIds = ref<number[]>([])
const selectionLoading = ref(false)
const syncingSelection = ref(false)
const selectedCount = computed(() => selectedIds.value.length)
/**
* 将跨页选择状态同步到当前页复选框
*/
const syncCurrentPageSelection = async () => {
await nextTick()
syncingSelection.value = true
tableRef.value?.clearSelection()
const selectedIdSet = new Set(selectedIds.value)
tableData.data.forEach((row: any) => {
if (selectedIdSet.has(row.id)) tableRef.value?.toggleRowSelection(row, true)
})
await nextTick()
syncingSelection.value = false
}
/**
* 表格选中变化:合并其他分页的已选项
*/
const handleSelectionChange = (rows: any[]) => {
if (syncingSelection.value) return
const currentPageIds = new Set(tableData.data.map((row: any) => row.id))
const otherPageIds = selectedIds.value.filter(id => !currentPageIds.has(id))
selectedIds.value = Array.from(new Set([
...otherPageIds,
...rows.map(row => row.id)
]))
}
/**
* 选择当前页全部账号
*/
const selectCurrentPage = () => {
selectedIds.value = tableData.data.map((row: any) => row.id)
syncCurrentPageSelection()
}
/**
* 清空全部选择
*/
const clearSelection = () => {
selectedIds.value = []
syncingSelection.value = true
tableRef.value?.clearSelection()
nextTick(() => {
syncingSelection.value = false
})
}
/** 是否为平台端(总开关仅平台端可修改,店铺端只读展示) */
const isAdmin = getAppType() === 'admin'
/** 开放平台总开关(平台级配置,两端读取同一份) */
const config = reactive({ is_open: '1' })
const configLoading = ref(false)
const isOpen = computed(() => config.is_open === '1')
/** 总开关说明文案(平台端可操作,店铺端只读) */
const configTip = computed(() => isAdmin
? '关闭后所有开放接口立即停止服务(含已签发的令牌),后台仅可查看'
: '由平台统一控制,如需调整请联系平台管理员')
/**
* 读取开放平台总开关
*/
const loadConfig = () => {
getOpenapiConfig().then((res: any) => {
config.is_open = String(res.data?.is_open ?? '1')
}).catch(() => {
// 读取失败不阻塞页面,按默认开启处理
config.is_open = '1'
})
}
/**
* 保存开放平台总开关
*/
const saveConfig = (is_open: string) => {
configLoading.value = true
setOpenapiConfig({ is_open }).then(() => {
configLoading.value = false
config.is_open = is_open
ElMessage.success(is_open === '1' ? '开放平台已开启' : '开放平台已关闭')
}).catch(() => {
configLoading.value = false
// 保存失败时回滚开关状态
config.is_open = is_open === '1' ? '0' : '1'
})
}
/**
* 切换总开关(关闭前二次确认)
*/
const toggleConfig = (val: string | number | boolean) => {
const next = String(val)
if (next === '1') {
saveConfig(next)
return
}
ElMessageBox.confirm('关闭后所有开放接口将立即停止服务(含已签发的令牌),确认关闭吗?', '关闭开放平台', { type: 'warning' })
.then(() => saveConfig(next))
.catch(() => { config.is_open = '1' })
}
/** 数据加密密钥刷新中 */
const secretLoading = ref(false)
/**
* 刷新数据加密密钥(仅平台端)
*/
const refreshSecretEvent = () => {
ElMessageBox.confirm(
'数据加密密钥为全平台共用,刷新后会重新加密所有站点(含各店铺)的开放账号 Secret Key,对接方无需改动。请勿中断操作,确认继续?',
'刷新加密密钥',
{ type: 'warning' }
).then(() => {
secretLoading.value = true
refreshOpenapiSecret().then((res: any) => {
secretLoading.value = false
ElMessage.success(`密钥已刷新,全平台共重新加密 ${ res.data?.app_count ?? 0 } 个开放账号(含平台与各店铺)`)
}).catch(() => {
secretLoading.value = false
})
}).catch(() => {})
}
/**
* 批量重置密钥(所选账号的旧密钥与已签发令牌立即失效)
*/
const batchResetSecretEvent = () => {
if (!selectedIds.value.length) return
ElMessageBox.confirm(
`确定要重置所选 ${ selectedIds.value.length } 个账号的密钥吗?重置后原 Secret Key 立即失效,这些账号的全部令牌将作废,需对接方重新配置。`,
'批量重置密钥',
{ type: 'warning' }
).then(() => {
selectionLoading.value = true
batchResetOpenapiSecret(selectedIds.value).then((res: any) => {
selectionLoading.value = false
const list = res.data || []
if (list.length) batchSecretDialogRef.value.show(list)
ElMessage.success(`已重置 ${ list.length } 个账号的密钥`)
clearSelection()
loadList()
}).catch(() => {
selectionLoading.value = false
})
}).catch(() => {})
}
/** 密钥明文与显示状态(按账号 id 缓存) */
const secretVisible = reactive<Record<number, boolean>>({})
const secretMap = reactive<Record<number, string>>({})
const domainName = (domain: string) => DOMAIN_NAMES[domain] || domain
const formatTime = (time: number) => {
if (!time) return '--'
const date = new Date(time * 1000)
const pad = (num: number) => String(num).padStart(2, '0')
return `${ date.getFullYear() }-${ pad(date.getMonth() + 1) }-${ pad(date.getDate()) } ${ pad(date.getHours()) }:${ pad(date.getMinutes()) }`
}
const copy = (text: string) => {
navigator.clipboard?.writeText(text).then(() => ElMessage.success('已复制到剪贴板'))
}
/**
* 查看 / 隐藏密钥明文(首次查看时按需拉取)
*/
const toggleSecret = (row: any) => {
if (secretVisible[row.id]) {
secretVisible[row.id] = false
return
}
if (secretMap[row.id]) {
secretVisible[row.id] = true
return
}
getOpenapiAppSecret(row.id).then((res: any) => {
secretMap[row.id] = res.data?.app_secret || ''
secretVisible[row.id] = true
})
}
/**
* 复制密钥(未拉取明文时先拉取)
*/
const copySecret = (row: any) => {
if (secretMap[row.id]) {
copy(secretMap[row.id])
return
}
getOpenapiAppSecret(row.id).then((res: any) => {
secretMap[row.id] = res.data?.app_secret || ''
if (secretMap[row.id]) copy(secretMap[row.id])
})
}
/**
* 清空密钥展示缓存(列表刷新后重置,避免展示过期数据)
*/
const clearSecretCache = () => {
Object.keys(secretVisible).forEach(key => delete (secretVisible as any)[key])
Object.keys(secretMap).forEach(key => delete (secretMap as any)[key])
}
/**
* 加载账号列表
*/
const loadList = (page?: number) => {
if (page) tableData.page = page
tableData.loading = true
getOpenapiAppPage({
page: tableData.page,
limit: tableData.limit,
name: searchParam.name,
status: searchParam.status
}).then((res: any) => {
tableData.loading = false
tableData.data = res.data.data || []
tableData.total = res.data.total || 0
clearSecretCache()
}).catch(() => {
tableData.loading = false
})
}
loadList()
loadConfig()
const resetSearch = () => {
searchParam.name = ''
searchParam.status = ''
loadList(1)
}
const rowActions = (row: any) => [
{ label: '编辑', disabled: !isOpen.value, onClick: () => formDrawerRef.value.show(row) },
{ label: '日志', onClick: () => openLog(row) },
{ label: '删除', type: 'danger', disabled: !isOpen.value, onClick: () => deleteEvent(row) }
]
const addEvent = () => formDrawerRef.value.show()
/**
* 新增成功后展示一次性密钥
*/
const handleFormComplete = (data: any) => {
if (data?.app_key && data?.app_secret) {
secretDialogRef.value.show(data.app_key, data.app_secret)
}
loadList()
}
/**
* 启用 / 禁用
*/
const statusEvent = (row: any, status: number | string | boolean) => {
const next = Number(status)
const text = next === 1 ? '启用' : '禁用'
ElMessageBox.confirm(`确定要${ text }账号「${ row.name }」吗?${ next === 0 ? '禁用后其已签发的令牌将立即失效。' : '' }`, '提示', { type: 'warning' })
.then(() => {
setOpenapiAppStatus(row.id, next).then(() => {
ElMessage.success(`${ text }成功`)
loadList()
})
})
.catch(() => {})
}
/**
* 重置密钥
*/
const resetSecretEvent = (row: any) => {
ElMessageBox.confirm(`重置后原 Secret Key 立即失效,账号「${ row.name }」的全部令牌将作废,需重新获取。`, '重置密钥', { type: 'warning' })
.then(() => {
resetOpenapiAppSecret(row.id).then((res: any) => {
secretDialogRef.value.show(res.data.app_key, res.data.app_secret)
loadList()
})
})
.catch(() => {})
}
const deleteEvent = (row: any) => {
ElMessageBox.confirm(`确定要删除账号「${ row.name }」吗?`, '删除账号', { type: 'warning' })
.then(() => {
deleteOpenapiApp(row.id).then(() => {
ElMessage.success('删除成功')
loadList()
})
})
.catch(() => {})
}
/**
* 打开该账号的调用日志抽屉(不跳转页面)
*/
const openLog = (row: any) => {
logDrawerRef.value.show(row.id, row.name)
}
</script>

View File

@ -0,0 +1,22 @@
<template>
<div ref="pageRef" class="main-container table-fill-page" :style="pageStyle">
<div class="table-fill-page__card">
<div class="flex-1 min-h-0">
<log-list :app-id="appId" />
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { computed } from 'vue'
import { useRoute } from 'vue-router'
import { useTablePageHeight } from '@/hooks/useTablePageHeight'
import LogList from './components/log-list.vue'
const { pageRef, pageStyle } = useTablePageHeight()
const route = useRoute()
// 支持通过 URL 带入账号 id(兼容从其他位置直接跳转的场景)
const appId = computed(() => (route.query.app_id as string) || '')
</script>

View File

@ -6,7 +6,7 @@
<el-tab-pane :label="t('小程序同步')" name="xcx">
<weappVersion></weappVersion>
</el-tab-pane>
<el-tab-pane :label="t('开放平台配置')" name="setting">
<el-tab-pane :label="t('开放平台配置')" name="setting" class="oplatform-setting-pane">
<setting></setting>
</el-tab-pane>
<el-tab-pane :label="t('授权记录')" name="auth_record">
@ -135,4 +135,12 @@ loadAuthRecordList()
padding: 0 20px;
}
// 开放平台配置是长表单,页签内容超出高度时在页签内部滚动
// position: relative 让表单底部的固定保存栏相对于当前页签定位
:deep(.el-tabs__content > .el-tab-pane.oplatform-setting-pane) {
position: relative;
overflow-x: hidden;
overflow-y: auto;
}
</style>

View File

@ -144,7 +144,7 @@ const { pageRef, pageStyle } = useTablePageHeight()
const rowActions = (row: any) => [
{ label: t('edit'), onClick: () => editEvent(row.key) },
{ label: t('step4'), show: !!Object.keys(row.install_info).length, onClick: () => addonDevelopBuildFn(row) },
{ label: t('delete'), type: 'danger', show: !Object.keys(row.install_info).length, onClick: () => deleteEvent(row.key) }
{ label: t('delete'), show: !Object.keys(row.install_info).length, onClick: () => deleteEvent(row.key) }
]
const addonTableData = reactive({

View File

@ -107,9 +107,9 @@
<el-table v-loading="versionLoading" :data="versionList">
<el-table-column prop="port_name" label="端口" width="120" />
<el-table-column prop="version" label="版本" width="130" show-overflow-tooltip />
<el-table-column prop="version" label="版本" width="150" show-overflow-tooltip />
<el-table-column prop="remark" label="版本说明" min-width="180" show-overflow-tooltip />
<el-table-column label="产物" width="190">
<el-table-column label="产物" width="220">
<template #default="{ row }">
<div class="flex items-center gap-[6px]">
<span class="text-[12px] text-[var(--el-text-color-regular)]">
@ -277,7 +277,7 @@
<script lang="ts" setup>
import { ref, reactive, computed, watch, onMounted, onBeforeUnmount, markRaw } from 'vue'
import { ElMessage } from 'element-plus'
import { ElMessage, ElMessageBox } from 'element-plus'
import { Refresh, Monitor, Iphone, ChatDotRound, Box, CircleCheckFilled, ArrowDown } from '@element-plus/icons-vue'
import { getBuildPorts, getBuildVersionList, setBuildVersionRelease, delBuildVersions } from '@/app/api/cloud'
import { getTaskActive, createTask, downloadTaskArtifact } from '@/app/api/task'
@ -556,9 +556,18 @@ const openCompile = (port: any) => {
compilePort.value = port
const scopes = port?.scopes ?? []
// 该端口只有一种编译范围(如自定义端口、web 端)=> 直接按默认范围发起,不再弹窗
// 该端口只有一种编译范围(如自定义端口、web 端):无需选范围,但仍需确认后再编译
if (scopes.length <= 1) {
startBuild(port, { scope: port?.default_scope || 'all', addon: [] })
const scope = port?.default_scope || scopes[ 0 ]?.value || 'all'
const scopeLabel = scopes[ 0 ]?.label || '整体编译'
const portName = port.label || port.name || port.key || ''
ElMessageBox.confirm(
`确定对「${ portName }」发起云编译(${ scopeLabel })吗?`,
'云编译',
{ confirmButtonText: '开始编译', cancelButtonText: '取消', type: 'warning' }
).then(() => {
startBuild(port, { scope: port?.default_scope || 'all', addon: [] })
}).catch(() => {})
return
}

View File

@ -287,7 +287,9 @@ const redis = computed<any>(() => env.value.redis || {})
const loadAverageText = computed(() => {
const values = performance.value.load_average || []
return values.length > 0 ? values.join(' / ') : '-'
return values.length > 0
? values.map((v: number | string) => Number(v).toFixed(2)).join(' / ')
: '-'
})
const largeTables = computed<any[]>(() => {

View File

@ -88,51 +88,78 @@
</div>
</div>
<!-- 补丁详情:抽屉展示(内容组织与消息详情一致:标题 + 标签 + 基本信息 + 富文本内容 + 附件) -->
<el-drawer v-model="detailVisible" :title="patchInfo.title || t('patchDetail')" size="55%">
<div v-loading="detailLoading">
<!-- 补丁详情:头区布局参考应用详情抽屉 -->
<el-drawer v-model="detailVisible" class="patch-drawer" :with-header="false" size="560px">
<div v-loading="detailLoading" class="patch-detail">
<template v-if="patchInfo.id">
<div class="mb-[12px]">
<div class="text-[16px] font-bold text-[#1D1F3A] mb-[8px]">{{ patchInfo.title }}</div>
<div class="flex items-center flex-wrap gap-[8px]">
<el-tag size="small" effect="plain">{{ patchInfo.patch_no || '-' }}</el-tag>
<el-tag size="small" effect="plain">{{ patchInfo.app_key || '-' }}</el-tag>
<el-tag size="small" effect="plain" :type="Number(patchInfo.is_resolved) === 1 ? 'success' : 'warning'">
{{ patchInfo.resolve_name }}
</el-tag>
<div class="patch-detail__head">
<div class="patch-detail__head-main">
<div class="patch-detail__ident">
<h2 class="patch-detail__title" :title="patchInfo.title || '-'">
{{ patchInfo.title || '-' }}
</h2>
<div class="flex items-center flex-wrap gap-[8px] mt-[8px]">
<el-tag size="small" effect="plain">{{ patchInfo.patch_no || '-' }}</el-tag>
<el-tag size="small" effect="plain">{{ patchInfo.app_key || '-' }}</el-tag>
<el-tag size="small" effect="plain" :type="Number(patchInfo.is_resolved) === 1 ? 'success' : 'warning'">
{{ patchInfo.resolve_name }}
</el-tag>
</div>
</div>
</div>
<button type="button" class="patch-detail__close" aria-label="关闭" @click="detailVisible = false">
<el-icon><Close /></el-icon>
</button>
</div>
<el-descriptions :column="2" border class="mb-[12px]">
<el-descriptions-item :label="t('appName')">{{ patchInfo.app_key || '-' }}</el-descriptions-item>
<el-descriptions-item :label="t('frameworkVersion')">
{{ patchInfo.app_version || patchInfo.framework_version_no || '-' }}
</el-descriptions-item>
<el-descriptions-item :label="t('releaseTime')">{{ patchInfo.release_time || '-' }}</el-descriptions-item>
<el-descriptions-item :label="t('syncTime')">{{ patchInfo.create_time || '-' }}</el-descriptions-item>
<el-descriptions-item :label="t('resolveStatus')">{{ patchInfo.resolve_name }}</el-descriptions-item>
<el-descriptions-item :label="t('resolvedTime')">
{{ Number(patchInfo.is_resolved) === 1 ? (patchInfo.resolved_time || '-') : '-' }}
</el-descriptions-item>
</el-descriptions>
<div class="patch-detail__body">
<dl class="patch-detail__meta">
<div>
<dt>{{ t('appName') }}</dt>
<dd>{{ patchInfo.app_key || '-' }}</dd>
</div>
<div>
<dt>{{ t('frameworkVersion') }}</dt>
<dd>{{ patchInfo.app_version || patchInfo.framework_version_no || '-' }}</dd>
</div>
<div>
<dt>{{ t('releaseTime') }}</dt>
<dd>{{ patchInfo.release_time || '-' }}</dd>
</div>
<div>
<dt>{{ t('syncTime') }}</dt>
<dd>{{ patchInfo.create_time || '-' }}</dd>
</div>
<div>
<dt>{{ t('resolveStatus') }}</dt>
<dd :class="Number(patchInfo.is_resolved) === 1 ? 'is-resolved' : 'is-unresolved'">
{{ patchInfo.resolve_name }}
</dd>
</div>
<div>
<dt>{{ t('resolvedTime') }}</dt>
<dd>{{ Number(patchInfo.is_resolved) === 1 ? (patchInfo.resolved_time || '-') : '-' }}</dd>
</div>
</dl>
<div class="mb-[12px]">
<div class="text-[13px] text-[#6b7280] mb-[6px]">{{ t('patchDesc') }}</div>
<!-- description 为富文本(补丁说明,含示意图),与补丁消息的内容展示保持一致 -->
<div v-if="patchInfo.description" class="patch-content-box">
<div v-html="patchInfo.description"></div>
<div class="patch-detail__desc">
<div class="patch-detail__desc-label">{{ t('patchDesc') }}</div>
<!-- description 为富文本(补丁说明,含示意图),与补丁消息的内容展示保持一致 -->
<div v-if="patchInfo.description" class="patch-content-box">
<div v-html="patchInfo.description"></div>
</div>
<div v-else class="patch-content-box">{{ t('noPatchDesc') }}</div>
</div>
<div v-else class="patch-content-box">{{ t('noPatchDesc') }}</div>
</div>
<div class="flex items-center justify-end gap-[8px]">
<el-button v-if="patchInfo.attach_url" type="primary" @click="downloadAttach(patchInfo)">
{{ t('downloadPatch') }}
</el-button>
<!-- 已解决后不再提供取消标记的操作 -->
<el-button v-if="Number(patchInfo.is_resolved) !== 1" type="success" plain @click="toggleResolve(patchInfo)">
{{ t('markResolved') }}
</el-button>
<div class="patch-detail__actions">
<!-- 已解决后不再提供取消标记的操作 -->
<el-button v-if="patchInfo.attach_url" type="primary" @click="downloadAttach(patchInfo)">
{{ t('downloadPatch') }}
</el-button>
<el-button v-if="Number(patchInfo.is_resolved) !== 1" @click="toggleResolve(patchInfo)">
{{ t('markResolved') }}
</el-button>
</div>
</div>
</template>
@ -146,6 +173,7 @@
import { reactive, ref } from 'vue'
import { t } from '@/lang'
import { ElMessage, ElMessageBox, FormInstance } from 'element-plus'
import { Close, Document } from '@element-plus/icons-vue'
import { getFrameworkPatchList, getFrameworkPatchInfo, syncFrameworkPatch, resolveFrameworkPatch } from '@/app/api/upgrade'
import TableActions from '@/components/table-actions/index.vue'
import TablePagination from '@/components/table-pagination/index.vue'
@ -189,7 +217,7 @@ const resetForm = (formEl: FormInstance | undefined) => {
/** 表格行内操作 */
const rowActions = (row: any) => [
{ label: t('patchDetail'), onClick: () => showDetail(row) },
{ label: t('download'), show: !!row.attach_url, onClick: () => downloadAttach(row) },
// { label: t('download'), show: !!row.attach_url, onClick: () => downloadAttach(row) },
{ label: t('markResolved'), type: 'success' as const, show: Number(row.is_resolved) !== 1, onClick: () => toggleResolve(row) }
]
@ -289,6 +317,190 @@ loadList()
</script>
<style lang="scss" scoped>
.patch-detail {
display: flex;
flex-direction: column;
width: 100%;
min-height: 0;
flex: 1;
background: #fff;
/* 头区:与应用详情 am-detail__head 一致 */
&__head {
display: flex;
flex: none;
gap: 12px;
align-items: flex-start;
justify-content: space-between;
padding: 18px 20px 14px;
border-bottom: 1px solid #f1f2f4;
}
&__head-main {
display: flex;
align-items: center;
min-width: 0;
}
&__tile {
display: flex;
flex: none;
align-items: center;
justify-content: center;
width: 54px;
height: 54px;
margin-right: 12px;
overflow: hidden;
color: var(--el-color-primary);
background: var(--el-color-primary-light-9, #ecf5ff);
border-radius: 8px;
}
&__ident {
min-width: 0;
}
&__title {
margin: 0;
overflow: hidden;
color: #1d1f3a;
font-size: 16px;
font-weight: 600;
line-height: 22px;
text-overflow: ellipsis;
white-space: nowrap;
}
&__close {
display: flex;
flex: none;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
color: #9699b6;
background: transparent;
border: 0;
border-radius: 6px;
cursor: pointer;
transition: background 0.14s ease, color 0.14s ease;
&:hover {
color: #1d1f3a;
background: #f4f5f7;
}
}
&__body {
flex: 1;
min-height: 0;
padding: 18px 20px 20px;
overflow-y: auto;
}
/* 与应用详情「应用信息」kv 表一致:左标签右值、行分隔线 */
&__meta {
display: flex;
flex-direction: column;
margin: 0 0 20px;
overflow: hidden;
background: #fafbfc;
border: 1px solid #ebeef5;
border-radius: 8px;
> div {
display: flex;
gap: 14px;
align-items: center;
justify-content: space-between;
padding: 10px 12px;
border-bottom: 1px solid #ebeef5;
font-size: 13px;
line-height: 20px;
&:last-child {
border-bottom: 0;
}
}
dt {
flex: none;
color: #9699b6;
}
dd {
margin: 0;
min-width: 0;
overflow: hidden;
color: #1d1f3a;
text-align: right;
text-overflow: ellipsis;
white-space: nowrap;
&.is-unresolved {
color: #f56c6c;
}
&.is-resolved {
color: #67c23a;
}
}
}
&__desc {
margin-bottom: 20px;
}
&__desc-label {
margin-bottom: 8px;
font-size: 13px;
line-height: 20px;
color: #909399;
}
&__actions {
display: flex;
gap: 8px;
align-items: center;
justify-content: flex-end;
}
}
.patch-pill {
display: inline-flex;
gap: 4px;
align-items: center;
height: 20px;
padding: 0 8px;
border-radius: 999px;
font-size: 11.5px;
line-height: 1;
white-space: nowrap;
&--muted {
color: #9699b6;
background: #f4f5f7;
}
&--ok {
color: #03c92e;
background: rgba(3, 201, 46, 0.1);
}
&--danger {
color: #f3321d;
background: rgba(243, 50, 29, 0.1);
}
&__dot {
flex: none;
width: 5px;
height: 5px;
background: currentColor;
border-radius: 999px;
}
}
/* 补丁说明:与消息详情里的内容区块保持一致(浅灰底、圆角、富文本) */
.patch-content-box {
padding: 12px 14px;
@ -296,9 +508,22 @@ loadList()
font-size: 13px;
line-height: 22px;
color: #303133;
background-color: #fafafa;
border-radius: 4px;
background-color: var(--sys-color-fill-lighter);
border-radius: 6px;
white-space: pre-wrap;
word-break: break-all;
}
</style>
<style lang="scss">
.patch-drawer {
max-width: 100vw;
.el-drawer__body {
display: flex;
flex-direction: column;
padding: 0;
overflow: hidden;
}
}
</style>

View File

@ -81,23 +81,24 @@
<el-option v-for="item in templateList" :key="item.key" :label="item.name" :value="item.key" />
</el-select>
</el-form-item>
<el-form-item :label="t('cronTime')" prop="timeDate">
<el-select v-model="formData.time.type" class="w-[150px]">
<el-form-item :label="t('cronTime')" prop="timeDate" class="schedule-cron-time">
<el-select v-model="formData.time.type" class="!w-[150px]">
<el-option v-for="(item, index) in date_type" :key="index" :label="item" :value="index" />
</el-select>
<div class="flex">
<el-select v-model="formData.time.week" class="ml-2 w-[120px]" v-if="formData.time.type == 'week'">
<el-option v-for="(item, index) in week_list" :key="index" :label="item" :value="index" />
</el-select>
<el-input v-model.trim="formData.time.day" class="ml-2 w-[120px]" v-if="['month', 'day'].indexOf(formData.time.type) != -1">
<template #append>{{ t('day') }}</template>
</el-input>
<el-input v-model.trim="formData.time.hour" class="ml-2 w-[120px]" v-if="['month', 'day', 'hour', 'week'].indexOf(formData.time.type) != -1">
<template #append>{{ t('hour') }}</template>
</el-input>
<el-input v-model.trim="formData.time.min" class="ml-2 w-[120px]" v-if="['month', 'day', 'hour', 'week', 'min'].indexOf(formData.time.type) != -1">
<template #append>{{ t('min') }}</template>
</el-input>
<el-select v-model="formData.time.week" class="!w-[120px]" v-if="formData.time.type == 'week'">
<el-option v-for="(item, index) in week_list" :key="index" :label="item" :value="index" />
</el-select>
<el-input v-model.trim="formData.time.day" class="!w-[120px]" v-if="['month', 'day'].indexOf(formData.time.type) != -1">
<template #append>{{ t('day') }}</template>
</el-input>
<el-input v-model.trim="formData.time.hour" class="!w-[120px]" v-if="['month', 'day', 'hour', 'week'].indexOf(formData.time.type) != -1">
<template #append>{{ t('hour') }}</template>
</el-input>
<el-input v-model.trim="formData.time.min" class="!w-[120px]" v-if="['month', 'day', 'hour', 'week', 'min'].indexOf(formData.time.type) != -1">
<template #append>{{ t('min') }}</template>
</el-input>
<div v-if="cronTimeDesc" class="w-full text-xs text-[var(--el-text-color-secondary)]">
{{ t('cronTimePreview') }}{{ cronTimeDesc }}
</div>
</el-form-item>
<el-form-item :label="t('isopen')">
@ -189,7 +190,7 @@ const templateGroupList = computed(() => {
return groups
})
const date_type = ref([])
const week_list = ref([])
const week_list = ref<Record<string, string>>({})
const searchFormRef = ref<FormInstance>()
const resetForm = (formEl: FormInstance | undefined) => {
@ -288,6 +289,31 @@ const validatePass = (rule: any, value: any, callback: any) => {
return error();
}
}
/**
* 根据当前任务周期设置实时换算实际执行周期描述(口径与列表 crontab_content 一致),设置不完整时返回空串
*/
const cronTimeDesc = computed(() => {
const time = formData.time
const isPositiveInt = (v: any) => /^[1-9]\d*$/.test(String(v ?? ''))
switch (time.type) {
case 'min':
return isPositiveInt(time.min) ? `每隔${time.min}分钟执行一次` : ''
case 'hour':
return isPositiveInt(time.hour) && isPositiveInt(time.min) ? `每隔${time.hour}小时的${time.min}分执行一次` : ''
case 'day':
return isPositiveInt(time.day) && isPositiveInt(time.hour) && isPositiveInt(time.min) ? `每隔${time.day}天的${time.hour}时${time.min}分执行一次` : ''
case 'week': {
const weekName = week_list.value[time.week] ?? ''
return weekName && isPositiveInt(time.hour) && isPositiveInt(time.min) ? `每周的${weekName}的${time.hour}时${time.min}分执行一次` : ''
}
case 'month':
return isPositiveInt(time.day) && isPositiveInt(time.hour) && isPositiveInt(time.min) ? `每月的${time.day}号的${time.hour}时${time.min}分执行一次` : ''
default:
return ''
}
})
const save_type = ref(false)
const addEvent = async (formEl: FormInstance | undefined) => {
if (save_type.value || !formEl) return
@ -383,4 +409,12 @@ const toLogList = (id: number) => {
.schedule-name-select .el-select-group .el-select-dropdown__item {
padding-left: 25px;
}
/** 任务周期:下拉框与输入框同行排列,一行放不下时自动换行并保留间距 */
.schedule-cron-time {
.el-form-item__content {
flex-wrap: wrap;
gap: var(--sys-space-2);
}
}
</style>

View File

@ -9,7 +9,8 @@
<div class="full-container page-sections flex flex-col" :class="{ 'h-full': !isPage }">
<!-- 顶部:标题 / 状态 / 操作 -->
<el-card shadow="never" class="!border-none">
<div class="flex items-center justify-between">
<!-- 左右两栏之间留出间距:标题较长时左栏会吃掉空隙,导致状态标签与「重试」按钮贴在一起 -->
<div class="flex items-center justify-between gap-[12px]">
<div class="flex items-center gap-[10px] min-w-0">
<!-- 返回按钮常显:页面模式回任务列表,组件模式交由父级关闭(emit back) -->
<el-button size="small" @click="goBack">返回</el-button>
@ -22,7 +23,9 @@
}}
</el-tag>
</div>
<div class="flex items-center gap-[8px]">
<!-- 组内间距交给 Element Plus 默认的 .el-button + .el-button(12px),
与左侧「返回」按钮出来的间距口径一致;外层 gap 已保证与状态标签的间隔 -->
<div class="flex items-center shrink-0">
<!-- 执行出错 / 暂停等决策:重试 / 跳过 / 取消任务 -->
<template v-if="isWaitingInput">
<el-button v-for="action in taskActions" :key="action.code" size="small"
@ -154,7 +157,7 @@
<div class="flex flex-col h-full">
<el-descriptions :column="1" size="small" border table-layout="fixed">
<el-descriptions-item label="任务编号" label-class-name="w-[80px]">{{ info.task_key || '-' }}</el-descriptions-item>
<el-descriptions-item label="云编译任务ID" v-if="cloudTaskId">{{ cloudTaskId }}</el-descriptions-item>
<el-descriptions-item label="任务ID" v-if="cloudTaskId">{{ cloudTaskId }}</el-descriptions-item>
<el-descriptions-item label="任务类型">{{
info.task_type_name || '-'
}}

View File

@ -0,0 +1,456 @@
<template>
<!--
备份管理弹框:列出 runtime/integrity/backup 下历次「写回官方文件」留下的备份批次,
每批可展开看文件明细、勾选后恢复(或整批恢复)。
与 components/file-diff 同一套约定:
- 弹框是公共组件,可能从任意页面打开;文案直接查全局语言包 common.json,
不走按路由推断语言文件的那套逻辑(理由见 file-diff/index.vue 里 t 的注释)。
- 恢复是覆盖本地文件的危险操作:确认文案里讲清后果,且后端恢复前会把
本地当前内容再备份一次(rollback),任何一步都可逆。
-->
<el-dialog v-model="visible" :title="t('backupManageTitle')" width="780px" top="6vh" append-to-body
:close-on-click-modal="false" @open="loadList">
<div v-loading="loading" class="min-h-[200px]">
<div class="mb-[10px] truncate text-[12px] text-[#909399]" :title="root">
{{ t('backupRootLabel') }}&nbsp;&nbsp;{{ root || '-' }}
</div>
<el-alert v-if="!loading && !list.length" type="info" :closable="false" show-icon
:title="t('backupEmpty')" />
<el-table v-else :data="list" border row-key="id">
<el-table-column type="expand">
<template #default="{ row }">
<div class="backup-files">
<div class="mb-[8px] flex items-center justify-between px-[4px]">
<el-checkbox :model-value="isAllChecked(row)"
:indeterminate="isIndeterminate(row)" @change="toggleAll(row, $event)">
{{ t('backupSelectAll') }}
</el-checkbox>
<div class="flex items-center gap-[8px]">
<el-button size="small" type="primary" :disabled="!row.checked.length || restoring"
@click="askRestore(row, false)">
{{ t('backupRestoreSelected') }} ({{ row.checked.length }})
</el-button>
<el-button size="small" type="danger" plain :disabled="!row.checked.length || restoring"
@click="askDelete(row, false)">
{{ t('backupDeleteSelected') }} ({{ row.checked.length }})
</el-button>
</div>
</div>
<div class="max-h-[260px] overflow-y-auto rounded-[6px] bg-[#fafafa] p-[6px]">
<div v-for="item in row.files" :key="item.file"
class="flex items-center gap-[8px] rounded-[4px] px-[4px] py-[3px] hover:bg-white">
<el-checkbox :model-value="row.checked.includes(item.file)"
class="!h-[22px] !mr-0" @change="toggleFile(row, item.file, $event)" />
<span class="min-w-0 flex-1 truncate text-[12px] text-[#303133]"
:title="item.file">{{ item.file }}</span>
<span class="shrink-0 text-[12px] text-[#909399]">{{ formatSize(item.size) }}</span>
</div>
</div>
</div>
</template>
</el-table-column>
<el-table-column :label="t('backupColTime')" prop="time" width="165" />
<el-table-column :label="t('backupColTarget')" min-width="150">
<template #default="{ row }">
<div class="flex items-center gap-[6px]">
<span class="truncate" :title="row.target_name">{{ row.target_name }}</span>
<el-tooltip v-if="!row.restorable" :content="t('backupNotRestorableTip')" placement="top">
<el-tag size="small" type="info" effect="light">{{ t('backupNotRestorable') }}</el-tag>
</el-tooltip>
</div>
</template>
</el-table-column>
<el-table-column :label="t('backupColCount')" prop="file_count" width="75" align="center" />
<el-table-column :label="t('backupColSize')" width="90" align="right">
<template #default="{ row }">{{ formatSize(row.total_size) }}</template>
</el-table-column>
<el-table-column :label="t('backupColAction')" width="130" align="center">
<template #default="{ row }">
<div class="flex items-center justify-center gap-[8px]">
<el-button size="small" :disabled="!row.restorable || !row.file_count || restoring"
@click="askRestore(row, true)">
{{ t('restoreAction') }}
</el-button>
<el-button size="small" type="danger" plain :disabled="!row.file_count || restoring"
@click="askDelete(row, true)">
{{ t('delete') }}
</el-button>
</div>
</template>
</el-table-column>
</el-table>
</div>
<template #footer>
<el-button @click="visible = false">{{ t('close') }}</el-button>
</template>
</el-dialog>
<!-- 恢复结果弹框:结构与文件差异弹框的「写回结果」保持一致 -->
<el-dialog v-model="resultVisible" :title="t('backupResultTitle')" width="560px" append-to-body
:close-on-click-modal="false">
<div class="restore-result">
<div class="restore-result__summary" :class="resultFailedCount ? 'is-warning' : 'is-success'">
<el-icon class="restore-result__summary-icon">
<WarningFilled v-if="resultFailedCount" />
<CircleCheckFilled v-else />
</el-icon>
<span class="restore-result__summary-text">{{ resultSummary }}</span>
</div>
<div v-if="restoreResult?.rollback_backup_dir" class="restore-result__backup">
{{ t('backupRollbackDirLabel') }}&nbsp;&nbsp;{{ restoreResult.rollback_backup_dir }}
</div>
<div class="restore-result__refresh">{{ t('restoreRefreshTip') }}</div>
<div v-if="restoreResult?.failed?.length" class="restore-result__section">
<div class="restore-result__section-title is-failed">{{ t('restoreFailedList') }}</div>
<div class="restore-result__list">
<div v-for="item in restoreResult.failed" :key="'f' + item.file" class="restore-result__item">
<div class="restore-result__file" :title="item.file">{{ item.file }}</div>
<div class="restore-result__msg is-failed">{{ item.message }}</div>
</div>
</div>
</div>
<div v-if="restoreResult?.skipped?.length" class="restore-result__section">
<div class="restore-result__section-title">{{ t('restoreSkippedList') }}</div>
<div class="restore-result__list">
<div v-for="item in restoreResult.skipped" :key="'s' + item.file" class="restore-result__item">
<div class="restore-result__file" :title="item.file">{{ item.file }}</div>
<div class="restore-result__msg">{{ item.message }}</div>
</div>
</div>
</div>
</div>
<template #footer>
<el-button type="primary" class="!px-[28px]" @click="resultVisible = false">
{{ t('restoreDoneOk') }}
</el-button>
</template>
</el-dialog>
</template>
<script setup lang="ts">
import { computed, ref } from 'vue'
import { ElMessage, ElMessageBox } from 'element-plus'
import { CircleCheckFilled, WarningFilled } from '@element-plus/icons-vue'
import { i18n } from '@/lang'
import { deleteIntegrityBackup, getIntegrityBackupList, restoreIntegrityBackup } from '@/app/api/integrity'
const emit = defineEmits(['update:show'])
/** 文案取法与 components/file-diff 保持一致:查全局语言包 common.json */
const t = (key: string): string => {
const value = i18n?.global?.t?.(key)
return value === undefined || value === null ? key : String(value)
}
interface BackupFile {
file: string
size: number
mtime: number
}
interface BackupBatch {
id: string
stamp: string
time: string
target: string
target_name: string
restorable: boolean
file_count: number
total_size: number
files: BackupFile[]
/** 本行勾选的文件键(恢复选中用;空 = 一个没选) */
checked: string[]
}
const props = defineProps<{
/** 是否显示 */
show: boolean
/** 只看某个检测目标(framework / addon:shop);不传 = 看全部目标 */
target?: string
}>()
const visible = computed({
get: () => props.show,
set: (value: boolean) => emit('update:show', value)
})
const loading = ref(false)
const list = ref<BackupBatch[]>([])
const root = ref('')
/** 后端单次写回/恢复的文件数量上限,提示用户分批 */
const maxFiles = ref(0)
const restoring = ref(false)
const restoreResult = ref<any>(null)
const resultVisible = ref(false)
const resultFailedCount = computed(() => restoreResult.value?.failed?.length || 0)
const resultSummary = computed(() => {
const result = restoreResult.value
if (!result) return ''
// 记号用 %x%,理由同 file-diff:{x} 会被 vue-i18n 当插值吃掉
return t('backupSummary')
.replace('%ok%', String(result.restored?.length || 0))
.replace('%skip%', String(result.skipped?.length || 0))
.replace('%fail%', String(result.failed?.length || 0))
})
/** 打开时拉一次列表(el-dialog @open 触发) */
const loadList = () => {
loading.value = true
list.value = []
getIntegrityBackupList().then((res: any) => {
const data = res.data || {}
root.value = data.root || ''
maxFiles.value = Number(data.max_files || 0)
let rows: any[] = data.list || []
// 指定了目标就只展示该目标的批次(入口本身只在「有备份」时出现,这里再兜一道)
if (props.target) {
rows = rows.filter((row: any) => row.target === props.target)
}
list.value = rows.map((row: any) => ({
...row,
id: `${row.stamp}|${row.target}`,
files: row.files || [],
checked: []
}))
}).finally(() => {
loading.value = false
})
}
/** 字节数转可读文本(口径与 file-diff 一致) */
const formatSize = (size: number) => {
if (!size) return '0 B'
if (size < 1024) return `${size} B`
if (size < 1024 * 1024) return `${(size / 1024).toFixed(1)} KB`
return `${(size / 1024 / 1024).toFixed(1)} MB`
}
const isAllChecked = (row: BackupBatch) => row.files.length > 0 && row.checked.length === row.files.length
const isIndeterminate = (row: BackupBatch) => row.checked.length > 0 && row.checked.length < row.files.length
const toggleAll = (row: BackupBatch, checked: boolean) => {
row.checked = checked ? row.files.map(item => item.file) : []
}
const toggleFile = (row: BackupBatch, file: string, checked: boolean) => {
const next = new Set(row.checked)
if (checked) {
next.add(file)
} else {
next.delete(file)
}
row.checked = [...next]
}
/**
* 恢复入口(all=true 整批;false 恢复勾选)
* 先弹确认(讲清覆盖后果与可回退),确认后调接口,成功后刷新列表并展示结果
*/
const askRestore = (row: BackupBatch, all: boolean) => {
const files = all ? [] : [...row.checked]
if (!all && !files.length) {
ElMessage.warning(t('backupSelectTip'))
return
}
if (maxFiles.value > 0 && (all ? row.file_count : files.length) > maxFiles.value) {
ElMessage.warning(
t('backupMaxFilesTip')
.replace('%max%', String(maxFiles.value))
.replace('%count%', String(all ? row.file_count : files.length))
)
return
}
ElMessageBox.confirm(t('backupConfirmText'), t('backupConfirmTitle'), {
type: 'warning',
confirmButtonText: t('backupConfirmOk'),
cancelButtonText: t('cancel')
}).then(() => {
doRestore(row, files)
}).catch(() => {})
}
const doRestore = (row: BackupBatch, files: string[]) => {
restoring.value = true
restoreIntegrityBackup({
stamp: row.stamp,
target: row.target,
files
}).then((res: any) => {
restoreResult.value = res.data || null
resultVisible.value = true
// 恢复后不自动重跑检测:结果弹框负责提醒,最新状态由用户点「重新校验」
loadList()
}).finally(() => {
restoring.value = false
})
}
/**
* 删除入口(all=true 整批;false 删除勾选)
* 备份是「最后的退路」,删了就没了,确认文案必须把后果讲死;确认后调接口、刷新列表
*/
const askDelete = (row: BackupBatch, all: boolean) => {
const files = all ? [] : [...row.checked]
if (!all && !files.length) {
ElMessage.warning(t('backupSelectTip'))
return
}
ElMessageBox.confirm(
all
? t('backupDeleteConfirmAll').replace('%count%', String(row.file_count))
: t('backupDeleteConfirmSelected').replace('%count%', String(files.length)),
t('backupDeleteConfirmTitle'),
{
type: 'warning',
confirmButtonText: t('backupDeleteOk'),
cancelButtonText: t('cancel')
}
).then(() => {
restoring.value = true
deleteIntegrityBackup({
stamp: row.stamp,
target: row.target,
files
}).then((res: any) => {
const deleted = Number(res.data?.deleted || 0)
ElMessage.success(all ? t('backupDeletedBatch') : t('backupDeleted').replace('%count%', String(deleted)))
loadList()
}).finally(() => {
restoring.value = false
})
}).catch(() => {})
}
</script>
<style lang="scss" scoped>
/*
恢复结果弹框的样式与 components/file-diff 的 .restore-result 同一套视觉:
那边是 scoped,公共组件之间不共享,所以这里按同样的类名再写一份。
*/
.restore-result {
&__summary {
display: flex;
align-items: center;
gap: 10px;
padding: 12px 14px;
border-radius: 8px;
&-icon {
font-size: 22px;
flex-shrink: 0;
}
&-text {
font-size: 14px;
font-weight: 600;
}
&.is-success {
background: var(--el-color-success-light-9);
color: var(--el-color-success);
}
&.is-warning {
background: var(--el-color-warning-light-9);
color: var(--el-color-warning);
}
}
&__backup {
margin-top: 12px;
padding: 8px 12px;
border-radius: 6px;
background: #f5f7fa;
color: #606266;
font-size: 12px;
word-break: break-all;
}
// 恢复后不自动重跑检测,这里提醒用户去哪里看最新状态
&__refresh {
margin-top: 10px;
font-size: 12px;
line-height: 18px;
color: #909399;
}
&__section {
margin-top: 14px;
&-title {
margin-bottom: 6px;
font-size: 13px;
font-weight: 600;
color: #909399;
&.is-failed {
color: var(--el-color-danger);
}
}
}
&__list {
max-height: 180px;
overflow-y: auto;
border: 1px solid #ebeef5;
border-radius: 6px;
}
&__item {
display: flex;
align-items: baseline;
gap: 10px;
padding: 6px 10px;
&+.restore-result__item {
border-top: 1px solid #f2f3f5;
}
}
&__file {
flex-shrink: 0;
width: 46%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
direction: rtl;
text-align: left;
font-size: 12px;
color: #303133;
}
&__msg {
flex: 1;
min-width: 0;
font-size: 12px;
color: #909399;
&.is-failed {
color: var(--el-color-danger);
}
}
}
</style>

File diff suppressed because it is too large Load Diff

View File

@ -37,7 +37,7 @@
</el-scrollbar>
</div>
<!-- 添加分组 -->
<popover-input :placeholder="t('upload.attachmentCategoryPlaceholder')" @confirm="addAttachmentCategory" v-model="attachmentCategoryName" v-if="prop.type != 'icon'">
<popover-input :placeholder="t('upload.attachmentCategoryPlaceholder')" width="280px" @confirm="addAttachmentCategory" v-model="attachmentCategoryName" v-if="prop.type != 'icon'">
<el-button class="add-group-btn" :icon="Plus">{{ t('upload.addAttachmentCategory') }}</el-button>
</popover-input>
</div>

View File

@ -2,7 +2,7 @@
<span class="visit-channel inline-flex items-center">
<el-popover placement="bottom" trigger="hover" :width="360" popper-class="visit-channel-popper" @show="loadChannels">
<template #reference>
<i class="iconfont iconicon_huojian1 cursor-pointer" :title="t('visitWap')"></i>
<i class="iconfont iconicon_huojian cursor-pointer" :title="t('visitWap')"></i>
</template>
<div v-if="!loaded" class="text-[13px] text-[#999]">加载中</div>
<div v-else-if="!channels.length" class="text-[13px] text-[#999]">暂无可用链接</div>

View File

@ -19,6 +19,7 @@
"compareAction": "Compare",
"compareTitle": "File content comparison",
"compareLoading": "Loading file content...",
"compareExpanding": "Expanding more content...",
"compareFailed": "Failed to load file content",
"targetSkipped": "Target skipped",
"progressTitle": "Check progress",
@ -36,6 +37,7 @@
"logCancelled": "Check cancelled",
"cancelCheck": "Cancel check",
"startCheck": "Start check",
"recheckAction": "Re-check",
"checkCancelled": "Check cancelled",
"identical": "The local code matches the official code",
"identicalTip": "Checked %count% file(s), no differences found",
@ -44,13 +46,15 @@
"officialLabel": "Official",
"officialMissing": "Official content is unavailable",
"addNotRestorable": "An \"Added\" file only exists locally, so there is no official content to restore",
"compareLargeTip": "Large file: comparison and rendering will be noticeably slower, and very long changed lines are marked as a whole instead of word by word.",
"compareLargeTruncatedTip": "This file is too large, so line-level comparison is used and only the beginning of the content is shown. Differences may not be complete.",
"confirmRestore": "Restore",
"restoreConfirmTitle": "Confirm restore",
"restoreConfirmTip": "%count% selected file(s) (%size%) will be overwritten with the official content. Originals are backed up first.",
"restoreConsequenceTitle": "Please confirm the consequences",
"restoreConsequenceOverwrite": "The selected files are replaced by the official package content: any local customization made to them is permanently lost, because the official package does not contain those changes.",
"restoreConsequenceDeleted": "A \"Deleted\" item is a file that exists officially but is missing locally — restoring it puts the file back on the site.",
"restoreConsequenceBackup": "Originals are backed up on the server first under runtime/integrity/backup (grouped by timestamp and target); the exact path for this run is shown in the result. Backups are never cleaned automatically and there is no one-click rollback — restore manually from the backup directory if needed.",
"restoreConsequenceBackup": "Originals are backed up on the server first under runtime/integrity/backup (grouped by timestamp and target); the exact path for this run is shown in the result. Backups are never cleaned automatically; you can review historical backups and restore them with one click later via \"Backup Manager\" in the file diff dialog.",
"restoreConsequenceLive": "The restore takes effect immediately: the site starts using the official content. If the site is live, prefer doing this during off-peak hours.",
"restoreDoneTitle": "Restore result",
"restoreSummary": "Done: %ok% restored, %skip% skipped, %fail% failed",
@ -58,6 +62,34 @@
"restoreSkippedList": "Files skipped",
"backupDirLabel": "Backup directory",
"restoreDoneOk": "OK",
"restoreRefreshTip": "The diff list does not refresh automatically. To see the latest status, close this dialog and click \"Re-check\".",
"backupManageTitle": "Backup Manager",
"backupRootLabel": "Backup root",
"backupEmpty": "No backups yet. Backups are created automatically on the server whenever you restore official files in the file diff dialog.",
"backupColTime": "Backup time",
"backupColTarget": "Target",
"backupColCount": "Files",
"backupColSize": "Size",
"backupColAction": "Action",
"backupDeleteSelected": "Delete selected",
"backupDeleteConfirmTitle": "Delete backup",
"backupDeleteConfirmAll": "All %count% backup files of this batch will be deleted and cannot be recovered (local files are not affected). Continue?",
"backupDeleteConfirmSelected": "The %count% selected backup files will be deleted and can no longer be restored from (local files are not affected). Continue?",
"backupDeleteOk": "Delete",
"backupDeleted": "%count% backup files deleted",
"backupDeletedBatch": "Backup batch deleted",
"backupRestoreSelected": "Restore selected",
"backupSelectAll": "Select all",
"backupSelectTip": "Select files to restore first",
"backupMaxFilesTip": "At most %max% files per run, but %count% selected. Please split into batches.",
"backupNotRestorable": "Not restorable",
"backupNotRestorableTip": "The target cannot be resolved right now (it may be uninstalled or its version info is missing), so the restore location is unknown.",
"backupConfirmTitle": "Restore from backup",
"backupConfirmText": "Restoring overwrites local files with the backup content: local changes to these files are lost. The current local content is backed up again before overwriting, so this step is reversible. Continue?",
"backupConfirmOk": "Restore",
"backupResultTitle": "Restore result",
"backupSummary": "Done: %ok% restored, %skip% skipped, %fail% failed",
"backupRollbackDirLabel": "Rollback backup directory",
"close": "Close",
"edit": "Edit",
"delete": "Delete",

View File

@ -18,6 +18,7 @@
"compareAction": "对比",
"compareTitle": "文件内容对比",
"compareLoading": "正在读取文件内容…",
"compareExpanding": "正在展开后续内容…",
"compareFailed": "读取文件内容失败",
"targetSkipped": "该目标已跳过",
"progressTitle": "检测进度",
@ -35,6 +36,7 @@
"logCancelled": "检测已取消",
"cancelCheck": "取消检测",
"startCheck": "开始校验",
"recheckAction": "重新校验",
"checkCancelled": "检测已取消",
"identical": "本地代码与官方代码一致",
"identicalTip": "共核对 %count% 个文件,未发现任何差异",
@ -43,13 +45,15 @@
"officialLabel": "官方",
"officialMissing": "官方内容不可用",
"addNotRestorable": "「新增」是本地多出来的文件,官方包里没有对应内容,无法写回",
"compareLargeTip": "文件较大:比对与渲染会明显变慢,且超长的变更行只会整行标出、不再逐词标注行内差异",
"compareLargeTruncatedTip": "文件过大,已切换为按行比对,且仅截取前面一部分内容展示,可能无法完整反映差异",
"confirmRestore": "确认写回",
"restoreConfirmTitle": "确认写回",
"restoreConfirmTip": "将用官方内容覆盖选中的 %count% 个文件(共 %size%),覆盖前会自动备份原文件。",
"restoreConsequenceTitle": "请确认后果",
"restoreConsequenceOverwrite": "选中文件的内容会被官方包直接覆盖:本地对这些文件做过的二次开发改动会永久丢失,官方包里不包含这些改动。",
"restoreConsequenceDeleted": "「删除」项是「官方有、本地缺」的文件,写回等于把它们恢复出来,站点上会重新出现这些文件。",
"restoreConsequenceBackup": "覆盖前会把原文件备份到服务器的 runtime/integrity/backup 目录下(按时间戳与目标名分层),本次实际备份路径会在写回结果里给出。备份不会自动清理,也没有一键回滚 —— 需要回退时请手动从备份目录取回原文件。",
"restoreConsequenceBackup": "覆盖前会把原文件备份到服务器的 runtime/integrity/backup 目录下(按时间戳与目标名分层),本次实际备份路径会在写回结果里给出。备份不会自动清理;之后可在文件差异弹框的「备份管理」里查看历史备份并一键恢复。",
"restoreConsequenceLive": "写回立即生效,站点会开始使用官方版内容;若站点正在运行,建议在访问低峰期操作。",
"restoreDoneTitle": "写回结果",
"restoreSummary": "写回完成:成功 %ok% 个,跳过 %skip% 个,失败 %fail% 个",
@ -57,6 +61,34 @@
"restoreSkippedList": "以下文件已跳过",
"backupDirLabel": "备份目录",
"restoreDoneOk": "确定",
"restoreRefreshTip": "差异列表不会自动刷新;要查看最新状态,请关闭本弹框后点击「重新校验」。",
"backupManageTitle": "备份管理",
"backupRootLabel": "备份根目录",
"backupEmpty": "暂无备份。在文件差异弹框里执行「恢复」时,会自动在服务器上留下备份",
"backupColTime": "备份时间",
"backupColTarget": "检测目标",
"backupColCount": "文件数",
"backupColSize": "总大小",
"backupColAction": "操作",
"backupDeleteSelected": "删除选中",
"backupDeleteConfirmTitle": "删除备份",
"backupDeleteConfirmAll": "将删除该批次全部 %count% 个备份文件,备份一旦删除无法找回(本地文件不受影响)。确定删除吗?",
"backupDeleteConfirmSelected": "将删除选中的 %count% 个备份文件,删除后无法用它们恢复(本地文件不受影响)。确定删除吗?",
"backupDeleteOk": "确定删除",
"backupDeleted": "已删除 %count% 个备份文件",
"backupDeletedBatch": "备份批次已删除",
"backupRestoreSelected": "恢复选中",
"backupSelectAll": "全选",
"backupSelectTip": "请先勾选要恢复的文件",
"backupMaxFilesTip": "单次最多恢复 %max% 个文件,本批 %count% 个,请分批处理",
"backupNotRestorable": "不可恢复",
"backupNotRestorableTip": "该目标当前无法解析(可能已卸载或版本信息缺失),无法确定恢复位置",
"backupConfirmTitle": "从备份恢复",
"backupConfirmText": "恢复会用备份内容覆盖本地文件,本地对这些文件的改动会丢失;覆盖前会把本地当前内容再备份一份(恢复错了还能退回来)。确定要恢复吗?",
"backupConfirmOk": "确定恢复",
"backupResultTitle": "恢复结果",
"backupSummary": "恢复完成:成功 %ok% 个,跳过 %skip% 个,失败 %fail% 个",
"backupRollbackDirLabel": "本次覆盖前的备份目录",
"close": "关闭",
"edit": "编辑",
"delete": "删除",

View File

@ -120,7 +120,8 @@ const localListFn = () => {
recentlyUpdated.value = []
for (const i in data) {
if (data[i].install_info && Object.keys(data[i].install_info)?.length) {
if (data[i].install_info.version != data[i].version && isNeedUpgrade(data[i].install_info.version, data[i].version)) {
// 只有云端有登记(is_local=false)的应用才拿得到官方升级包,才算可更新
if (data[i].is_local == false && data[i].install_info.version != data[i].version && isNeedUpgrade(data[i].install_info.version, data[i].version)) {
recentlyUpdated.value.push(data[i])
}
}

View File

@ -29,7 +29,7 @@
<!-- </router-link> -->
</el-dropdown-item>
<el-dropdown-item class="rounded-[4px]">
<router-link to="/tools/authorize">
<router-link to="/admin/tools/authorize">
<div class="flex items-center leading-[1] py-[5px]">
<span class="iconfont iconshouquanxinxi2 ml-[4px] !text-[14px] mr-[10px]"></span>
<span class="text-[14px]">授权信息</span>

View File

@ -59,7 +59,7 @@ const tabbarStore = useTabbarStore()
--cmp-admin-secondary-active-text: var(--sys-color-primary);
--cmp-admin-secondary-text: var(--sys-color-text-primary);
--cmp-admin-primary-width: 80px;
--cmp-admin-primary-expanded-width: 110px;
--cmp-admin-primary-expanded-width: 95px;
--cmp-admin-header-padding-inline: 10px;
--cmp-admin-control-height: 30px;
--cmp-admin-control-bg: var(--sys-color-fill-light);

View File

@ -27,7 +27,7 @@
<!-- </router-link> -->
</el-dropdown-item>
<el-dropdown-item class="rounded-[4px]">
<router-link to="/tools/authorize">
<router-link to="/admin/tools/authorize">
<div class="flex items-center leading-[1] py-[5px]">
<span class="iconfont iconshouquanxinxi2 ml-[4px] !text-[14px] mr-[10px]"></span>
<span class="text-[14px]">授权信息</span>

View File

@ -46,7 +46,6 @@
</div>
<!-- 预览 只有站点时展示-->
<visit-channel class="px-[8px]" />
<i class="iconfont iconlingdang-xianxing cursor-pointer px-[8px]" :title="t('newInfo')" v-if="appType == 'site'"></i>
<!-- 切换语言 -->
<!-- <div class="navbar-item flex items-center h-full cursor-pointer">
<switch-lang />
@ -99,7 +98,6 @@ import { useRoute, useRouter } from 'vue-router'
import { t } from '@/lang'
import storage from '@/utils/storage'
const appType = storage.get('app_type')
const taskIndicatorRef = ref()
const layoutSettingRef = ref()
const userInfoRef = ref()

View File

@ -1,7 +1,6 @@
<template>
<div class="layout-setting-trigger navbar-hit">
<icon name="element Setting" :color="iconColor" />
<icon name="iconfont iconshezhi1" :color="iconColor" />
<el-drawer v-model="drawer" :title="t('layout.layoutSetting')" size="300px">
<el-scrollbar>
<!-- 黑暗模式 -->

View File

@ -9,7 +9,8 @@
@show="onShow"
>
<template #reference>
<div class="relative">
<!-- 点击图标进入消息列表,悬浮仍展示最近消息预览 -->
<div class="relative cursor-pointer" @click="toMessageCenter">
<icon name="iconfont iconFramec-1" />
<span v-if="unreadCount > 0"
class="absolute top-[-3px] right-[-5px] min-w-[12px] h-[12px] px-[3px] rounded-full bg-[#DA203E] text-white text-[12px] leading-[12px] flex justify-center items-center">

View File

@ -14,7 +14,7 @@
<el-icon :size="18" :class="[ 'task-icon', { 'is-active': hasActive } ]" v-if="hasActive">
<Loading/>
</el-icon>
<icon name="iconfont iconrenwu1" v-else/>
<icon name="iconfont iconrenwu1-copy" v-else/>
<!-- 状态点:执行中(蓝)/ 等待决策(橙,需用户处理)/ 失败(红) -->
<span v-if="hasActive" class="task-dot" :class="dotClass"></span>
</div>

View File

@ -46,7 +46,6 @@
</div>
<!-- 预览 只有站点时展示-->
<visit-channel class="px-[8px]" />
<i class="iconfont iconlingdang-xianxing cursor-pointer px-[8px]" :title="t('newInfo')" v-if="appType == 'site'"></i>
<!-- 切换语言 -->
<!-- <div class="navbar-item flex items-center h-full cursor-pointer">
<switch-lang />
@ -99,7 +98,6 @@ import { useRoute, useRouter } from 'vue-router'
import { t } from '@/lang'
import storage from '@/utils/storage'
const appType = storage.get('app_type')
const taskIndicatorRef = ref()
const layoutSettingRef = ref()
const userInfoRef = ref()

View File

@ -63,7 +63,6 @@
</div>
<!-- 预览 只有站点时展示-->
<visit-channel class="px-[8px]" />
<i class="iconfont iconlingdang-xianxing cursor-pointer px-[8px]" :title="t('newInfo')" v-if="appType == 'site'"></i>
<!-- 切换语言 -->
<!-- <div class="navbar-item flex items-center h-full cursor-pointer">
<switch-lang />
@ -111,7 +110,6 @@ import { useRoute, useRouter } from 'vue-router'
import { t } from '@/lang'
import storage from '@/utils/storage'
const appType = storage.get('app_type')
const { toggle: toggleFullscreen } = useFullscreen()
const systemStore = useSystemStore()
const appStore = useAppStore()

View File

@ -15,6 +15,7 @@ import { getAppType } from '@/utils/common'
import useUserStore from '@/stores/modules/user'
import useSystemStore from '@/stores/modules/system'
import useTaskRunnerStore from '@/stores/modules/taskRunner'
import { checkQueueNotice } from '@/app/api/sys'
import taskDrawer from '@/layout/components/task-drawer/index.vue'
import Storage from '@/utils/storage'
import { isBlankMenu } from '@/hooks/useMenuActive'
@ -122,6 +123,20 @@ if (enableTask) {
})
}
/**
* 平台端队列检测提醒:有人打开平台端后台即检测一次消息队列是否运行,
* 未运行由后端发送站内信(30 分钟节流;重复异常只刷新同一条未读,恢复后再发一条「已恢复」)。
*
* 仅平台端调用:站点端没有这个提醒入口 —— 三端共用本组件(站点端同样会挂载),
* 因此必须在挂载前按 getAppType() 收敛,避免站点端多打一个无用请求。
* 异步 + 静默失败:检测最坏约 5 秒,不得阻塞页面渲染,也不弹全局错误提示。
*/
if (getAppType() === 'admin') {
onMounted(() => {
checkQueueNotice().catch(() => {})
})
}
/**
* 监听某些页面需要独立配置布局
*/

View File

@ -57,7 +57,6 @@
<span class="header-divider"></span>
<!-- 预览 只有站点时展示-->
<visit-channel class="navbar-item" />
<i class="navbar-item iconfont iconlingdang-xianxing cursor-pointer" :title="t('newInfo')" v-if="appType == 'site'"></i>
<!-- 切换语言 -->
<!-- <div class="navbar-item flex items-center h-full cursor-pointer">
<switch-lang />
@ -225,7 +224,6 @@ const toggleMenuCollapse = () => {
systemStore.toggleMenuCollapse(!systemStore.menuIsCollapse)
}
const appType = storage.get('app_type')
const taskIndicatorRef = ref()
const layoutSettingRef = ref()
const userInfoRef = ref()

View File

@ -48,7 +48,6 @@
<!-- 预览 只有站点时展示-->
<visit-channel class="px-[8px]" />
<i class="iconfont iconlingdang-xianxing cursor-pointer px-[8px]" :title="t('newInfo')" v-if="appType == 'site'"></i>
<!-- 切换语言 -->
<!-- <div class="navbar-item flex items-center h-full cursor-pointer">
<switch-lang />
@ -101,7 +100,6 @@ import { useRoute, useRouter } from 'vue-router'
import { t } from '@/lang'
import storage from '@/utils/storage'
const appType = storage.get('app_type')
const taskIndicatorRef = ref()
const layoutSettingRef = ref()
const userInfoRef = ref()

View File

@ -55,7 +55,6 @@
</div>
<!-- 预览 只有站点时展示-->
<visit-channel class="navbar-item text-[#333]" />
<i class="navbar-item iconfont iconlingdang-xianxing cursor-pointer text-[#333]" :title="t('newInfo')" v-if="appType == 'site'"></i>
<!-- 任务指示器:有进行中的任务时图标转动,悬浮可查看进度并进入详情 -->
<div class="navbar-item flex items-center h-full cursor-pointer" @click="openTaskIndicator">
<task-indicator ref="taskIndicatorRef" />
@ -102,7 +101,6 @@ import { img } from '@/utils/common'
import { useMenuJump } from '@/hooks/useMenuActive'
import storage from '@/utils/storage'
const appType = storage.get('app_type')
const taskIndicatorRef = ref()
const layoutSettingRef = ref()
const userInfoRef = ref()

View File

@ -58,7 +58,6 @@
<span class="header-divider"></span>
<!-- 预览 只有站点时展示-->
<visit-channel class="navbar-item" />
<i class="navbar-item iconfont iconlingdang-xianxing cursor-pointer" :title="t('newInfo')" v-if="appType == 'site'"></i>
<!-- 切换语言 -->
<!-- <div class="navbar-item flex items-center h-full cursor-pointer">
<switch-lang />
@ -111,7 +110,6 @@ import { useRoute, useRouter } from 'vue-router'
import { t } from '@/lang'
import storage from '@/utils/storage'
const appType = storage.get('app_type')
const taskIndicatorRef = ref()
const layoutSettingRef = ref()
const userInfoRef = ref()

View File

@ -120,7 +120,15 @@ router.beforeEach(async (to: any, from: any, next) => {
}
} else {
try {
if (!userStore.siteInfo || userStore.siteInfo.site_id == undefined) {
// 用户中心(/home:站点管理、切换站点)为静态路由,不依赖后端菜单:
// 无可用菜单时若继续走菜单分支,会因 routers 始终为空而反复重入守卫,这里统一落到 /home/index 放行
if (to.path === '/home' || to.path.startsWith('/home/')) {
if (to.path === '/home/index') {
next()
} else {
next({ path: '/home/index', replace: true })
}
} else if (!userStore.siteInfo || userStore.siteInfo.site_id == undefined) {
if (to.path === '/home/index') {
next()
} else {
@ -129,6 +137,13 @@ router.beforeEach(async (to: any, from: any, next) => {
} else {
await userStore.getAuthMenusFn()
// 无可用菜单:当前账号没有可访问的后台菜单权限,清理会话并跳转登录页,
// 不再 next(to)(无路由会反复重入守卫,表现为卡在"登录中"/白屏)
if (!userStore.routers.length) {
userStore.logout('no_permission')
return
}
// 设置首页路由
let firstRoute: symbol | string | undefined = findFirstValidRoute(userStore.routers)
if (getAppType() != 'admin') {
@ -172,8 +187,9 @@ router.beforeEach(async (to: any, from: any, next) => {
next(to)
}
} catch (err) {
next({ path: loginPath })
} catch (err: any) {
// 菜单获取失败:清理会话并整页跳转登录页,不再 next(loginPath) 重入守卫造成死循环
userStore.logout(err && err.code === 'NO_MENU_PERMISSION' ? 'no_permission' : 'menu_error')
}
}
} else {

View File

@ -125,6 +125,8 @@ const useDiyStore = defineStore('diy', {
bottom: 0, // 下边距
both: 0, // 左右边距
},
// 组件是否显示,true:显示,false:隐藏;旧数据无此字段时按 true 处理
isShow: true,
isHidden: false // 是否隐藏该组件 true:是,false:否,增加问号说明:勾选后该组件将隐藏,适用于你不希望看到该组件字段又不希望删除的情况;
}
@ -230,6 +232,8 @@ const useDiyStore = defineStore('diy', {
bottom: 0, // 下边距
both: 0, // 左右边距
},
// 组件是否显示,true:显示,false:隐藏;旧数据无此字段时按 true 处理
isShow: true,
isHidden: false // 是否隐藏该组件 true:是,false:否,增加问号说明:勾选后该组件将隐藏,适用于你不希望看到该组件字段又不希望删除的情况;
}
@ -257,7 +261,7 @@ const useDiyStore = defineStore('diy', {
delete component.render; // 渲染值,万能表单用到了
// 默认继承全局属性
let template = cloneDeep(this.global.template);
let template = cloneDeep(this.global.template || {});
Object.assign(component, template);
if (component.template) {
@ -266,6 +270,11 @@ const useDiyStore = defineStore('diy', {
delete component.template;
}
// 装修组件显示状态:旧 global.template 可能无此字段,新加组件默认显示
if (component.isShow === undefined || component.isShow === null) {
component.isShow = true;
}
if (!this.checkComponentIsAdd(component)) {
// 组件最多只能添加n个
ElMessage({
@ -365,9 +374,29 @@ const useDiyStore = defineStore('diy', {
if (this.currentIndex == -99) {
this.currentComponent = 'edit-page';
} else if (component) {
// 兼容旧数据:无 isShow 字段时默认显示
if (component.isShow === undefined || component.isShow === null) {
component.isShow = true;
}
this.currentComponent = component.path;
}
},
// 兼容旧数据:组件无 isShow 时默认 true(显示)
normalizeComponentIsShow(list: any[] = this.value) {
if (!Array.isArray(list)) return;
list.forEach((item: any) => {
if (item && (item.isShow === undefined || item.isShow === null)) {
item.isShow = true;
}
});
},
// 兼容旧页面:global.template 缺少 isShow 时补齐,保证新加组件能继承
ensureTemplateIsShow() {
if (!this.global.template) this.global.template = {};
if (this.global.template.isShow === undefined || this.global.template.isShow === null) {
this.global.template.isShow = true;
}
},
// 删除组件
delComponent() {
if (this.currentIndex == -99) return;

View File

@ -62,7 +62,11 @@ const userStore = defineStore('user', {
clearRouters() {
this.routers = []
},
logout() {
/**
* 退出登录(清理本地会话并整页跳转登录页)
* @param tip 登录页提示标识,如 no_permission(无可用菜单权限)、menu_error(菜单加载失败)
*/
logout(tip: string = '') {
if (!this.token) return
this.token = ''
this.userInfo = {}
@ -82,12 +86,23 @@ const userStore = defineStore('user', {
useTabbarStore().clearTab()
const login = getAppType() == 'admin' ? '/admin/login' : '/site/login'
// router.push(login)
location.href = `${location.origin}${login}`
// 提示标识通过 query 传递,整页跳转后由登录页读取并展示,避免提示随页面卸载丢失
location.href = `${location.origin}${login}${tip ? `?tip=${tip}` : ''}`
},
getAuthMenusFn() {
return new Promise((resolve, reject) => {
getAuthMenus({}).then((res) => {
this.routers = formatRouters(res.data)
this.routers = formatRouters(res.data || [])
// 无任何可用菜单:当前账号没有可访问的后台菜单权限
// 此处直接抛出标记错误,交由路由守卫统一提示并跳转登录页,
// 避免 routers 始终为空导致守卫反复重入(表现为卡在"登录中"/白屏)
if (!this.routers.length) {
this.rules = []
const error: any = new Error('NO_MENU_PERMISSION')
error.code = 'NO_MENU_PERMISSION'
reject(error)
return
}
// 获取插件的首个菜单
this.routers.forEach((item, index) => {
if (item.meta.addon !== '') {

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,9 @@ import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
const require = createRequire(import.meta.url)
const { isSharedExternal, isAdminLangExternal, adminLangExternalPath, isCoreExternal, coreExternalPath } = require('./scripts/shared-external.cjs')
const { stripElementPlusStylePlugin } = require('./scripts/vite-plugin-strip-element-plus-style.cjs')
const { createExcludeAddonPlugin } = require('./scripts/vite-plugin-exclude-addon.cjs')
const rootDir = fileURLToPath(new URL('.', import.meta.url))
const addonKey = process.env.ADDON_KEY || ''
if (!addonKey) {
@ -46,6 +49,8 @@ export default defineConfig({
}
},
plugins: [
// 排除其他插件源码:插件包只允许包含自身 src/addon/{addonKey} 的代码
createExcludeAddonPlugin({ mode: 'addon', root: rootDir, addonKey }),
// 修复:addon 中 import X from '@/utils/storage' / '@/utils/config' 的 default import
// 会被错误地 external 到 core-shared.js 的 default 导出(即 request 实例)。
// core-shared 的 export * 不转发 default,因此需要改写为命名导入。
@ -113,7 +118,13 @@ export default defineConfig({
name: 'addon-css-inject',
enforce: 'post',
generateBundle(_opts, bundle) {
const entry = bundle['index.js']
// 入口文件名已带 contenthash(index-[contenthash:8].js),按 isEntry 定位入口 chunk
let entryName = ''
for (const name of Object.keys(bundle)) {
const b = bundle[name]
if (b && b.type === 'chunk' && b.isEntry) { entryName = name; break }
}
const entry = entryName ? bundle[entryName] : null
const cssAsset = bundle['style.css']
if (entry && entry.type === 'chunk' && cssAsset && cssAsset.type === 'asset') {
// 过滤掉第三方库中污染全局的选择器(如 Vditor 的 body, html 样式)
@ -128,6 +139,30 @@ export default defineConfig({
delete bundle['style.css']
}
}
},
// 把真实入口文件名写入 entry.json:shop 等大插件的懒加载 chunk(components/xxx/index.vue)
// basename 也叫 index,产物中会同时存在多个 index-[hash].js,仅凭文件名/mtime 无法区分入口;
// resolveAddonEntry 优先读取该文件精确解析 manifest.entry
{
name: 'emit-addon-manifest',
enforce: 'post',
generateBundle(_opts, bundle) {
for (const name of Object.keys(bundle)) {
const b = bundle[name] as any
if (b && b.type === 'chunk' && b.isEntry) {
// 构建期直接写出插件 manifest.json(含内容哈希入口),sync/运行时都以其为准,无需扫描目录
const manifest = {
key: addonKey,
version: '1.0.0',
sharedVersion: 'admin-core-1.0.0',
entry: b.fileName,
langBase: './lang/'
}
this.emitFile({ type: 'asset', fileName: 'manifest.json', source: JSON.stringify(manifest, null, 2) + '\n' })
break
}
}
}
}
],
resolve: {
@ -144,14 +179,17 @@ export default defineConfig({
lib: {
entry,
formats: ['es'],
fileName: () => 'index.js'
// 入口文件名由 rollupOptions.output.entryFileNames 决定(带 contenthash)
fileName: () => 'index'
},
rollupOptions: {
external: (id) => isAdminLangExternal(id) || isSharedExternal(id) || isCoreExternal(id),
output: {
inlineDynamicImports: false,
// 入口按内容哈希命名:index-[hash].js(Rollup 的 [hash] 即内容哈希,等价于 Webpack 的 [contenthash])。
// 浏览器按文件名缓存,重新编译后文件名变化 → 旧缓存自然失效,无需强刷(与 ?v=buildTime 双保险)
chunkFileNames: '[name]-[hash].js',
entryFileNames: 'index.js',
entryFileNames: 'index-[hash].js',
paths(id) {
if (isAdminLangExternal(id)) return adminLangExternalPath()
if (isCoreExternal(id)) return coreExternalPath()

View File

@ -9,6 +9,7 @@ import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
const require = createRequire(import.meta.url)
const { isSharedExternal, isAdminLangExternal, adminLangExternalPath } = require('./scripts/shared-external.cjs')
const { stripElementPlusStylePlugin } = require('./scripts/vite-plugin-strip-element-plus-style.cjs')
const { createExcludeAddonPlugin } = require('./scripts/vite-plugin-exclude-addon.cjs')
const rootDir = fileURLToPath(new URL('.', import.meta.url))
@ -24,28 +25,12 @@ export default defineConfig({
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false
},
plugins: [
// 排除 src/addon 源码:按绝对路径判定,覆盖 import.meta.glob 展开出的 import
createExcludeAddonPlugin({ mode: 'core', root: rootDir, allowMetaJson: true }),
stripElementPlusStylePlugin(),
vue(),
AutoImport({ resolvers: [elementPlusResolver] }),
Components({ resolvers: [elementPlusResolver] }),
{
name: 'exclude-addon-source',
enforce: 'pre',
resolveId(source, importer) {
if (source.includes('*')) return null
const norm = source.replace(/\\/g, '/')
if (importer && importer.includes('/src/addon/')) return null
if (norm.startsWith('@/addon/') || norm.includes('/src/addon/')) {
// 虚拟 id 勿以 .json 结尾,否则 vite:json 会尝试解析
return '\0addon-external:' + norm.replace(/\.json$/i, '.langdata')
}
},
load(id) {
if (id.startsWith('\0addon-external:')) {
return 'export default {}'
}
}
}
Components({ resolvers: [elementPlusResolver] })
],
resolve: {
alias: {

View File

@ -5,6 +5,9 @@ import vue from '@vitejs/plugin-vue'
const require = createRequire(import.meta.url)
const { sharedExternalForBuild } = require('./scripts/shared-external.cjs')
const { createExcludeAddonPlugin } = require('./scripts/vite-plugin-exclude-addon.cjs')
const rootDir = fileURLToPath(new URL('.', import.meta.url))
const pkgKey = process.env.SHARED_PKG || 'vue'
const emptyOutDir = process.env.SHARED_EMPTY === '1'
@ -33,23 +36,9 @@ export default defineConfig({
: undefined,
plugins: needsCore
? [
vue(),
{
name: 'shared-exclude-addon',
enforce: 'pre',
resolveId(source) {
if (source.includes('*')) return null
const norm = source.replace(/\\?vue.*$/, '').replace(/\\/g, '/')
if (norm.startsWith('@/addon/') || norm.includes('/src/addon/')) {
return { id: 'virtual:addon-empty', moduleSideEffects: false }
}
return null
},
load(id) {
if (id === 'virtual:addon-empty') return 'export default {}'
return null
}
}
// 与 core 构建一致:按绝对路径排除 src/addon 源码(含 glob 展开产物)
createExcludeAddonPlugin({ mode: 'core', root: rootDir, allowMetaJson: true }),
vue()
]
: [],
build: {

View File

@ -16,6 +16,9 @@ class Request extends \think\Request
protected static $site_id = 0;
//开放平台认证信息(独立上下文,禁止与 $auth_info / $site_id 混用)
protected static $openapi_info = [];
/**
* 获取请求参数
* @param array $params
@ -237,4 +240,48 @@ class Request extends \think\Request
return static::$auth_info[$key] ?? '';
}
}
/**
* 开放平台账号上下文(独立于 auth_info / site_id,避免与其他端口相互污染)
* @param array $app
* @return array
*/
public function openapiApp(array $app = []): array
{
if (!empty($app)) {
static::$openapi_info = $app;
return $app;
}
return static::$openapi_info;
}
/**
* 获取开放平台请求携带的访问令牌
*
* 按优先级依次尝试多种传递方式:
* 1. Authorization: Bearer {token}
* 2. REDIRECT_HTTP_AUTHORIZATION(Apache 在 .htaccess 里透传后环境变量的实际名字)
* 3. X-Openapi-Key: {token}(Apache 等默认丢弃 Authorization 头的环境)
* 4. access_token 请求参数(查询串 / 表单,最后的兜底)
*
* @return string
*/
public function openapiToken(): string
{
$authorization = (string) $this->header('Authorization', '');
if ($authorization === '') {
// Apache + CGI/FastCGI 下不会产生 HTTP_AUTHORIZATION,透传后变量带 REDIRECT_ 前缀
$authorization = (string) $this->server('REDIRECT_HTTP_AUTHORIZATION', '');
}
if (stripos($authorization, 'Bearer ') === 0) {
return trim(substr($authorization, 7));
}
// 备用请求头:部分 Web 服务器(如 Apache)会丢弃 Authorization,用自定义头传递最稳
$token = trim((string) $this->header('X-Openapi-Key', ''));
if ($token !== '') return $token;
// 兜底:请求参数
return trim((string) $this->param('access_token', ''));
}
}

View File

@ -56,7 +56,9 @@ class Account extends BaseAdminController
{
$data = $this->request->params([
['token', ''],
['expires_time', 0]
['expires_time', 0],
['refresh_token', ''],
['refresh_expires_time', 0]
]);
return success('SUCCESS', (new NiucloudAccountService())->saveToken($data));
}
@ -78,6 +80,22 @@ class Account extends BaseAdminController
return success('SUCCESS', (new NiucloudAccountService())->saveSelectedAuth($data));
}
/**
* 取消选用授权
* @description 清空系统已选授权(NIUCLOUD_CONFIG),系统回到未授权状态;幂等,不影响官网账号登录态
* @return Response
*/
public function cancel()
{
$data = $this->request->params([
['auth_code', ''],
['site_address', ''],
['company_name', ''],
['product_key_name', '']
]);
return success('SUCCESS', (new NiucloudAccountService())->cancelSelectedAuth($data));
}
/**
* 绑定授权
* @description 接收官网 embed 页回传的授权凭据并完成绑定(复用现有授权校验链路)

View File

@ -0,0 +1,164 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\openapi;
use app\service\admin\openapi\OpenapiAppService;
use core\base\BaseAdminController;
use think\Response;
/**
* 开放平台账号
* Class App
* @description 开放平台账号
* @package app\adminapi\controller\openapi
*/
class App extends BaseAdminController
{
/**
* 账号列表
* @description 开放账号列表
* @return Response
*/
public function pages(): Response
{
$where = $this->request->params([
[ 'name', '' ],
[ 'status', '' ],
]);
return success((new OpenapiAppService())->getPage($where));
}
/**
* 账号详情
* @description 开放账号详情
* @param int $id
* @return Response
*/
public function info(int $id): Response
{
return success((new OpenapiAppService())->getInfo($id));
}
/**
* 新增账号
* @description 开放账号新增
* @return Response
*/
public function add(): Response
{
$data = $this->request->params([
[ 'name', '' ],
[ 'status', 1 ],
[ 'auth_domains', [] ],
[ 'ip_white', '' ],
[ 'expire_time', 0 ],
[ 'token_expire', 7200 ],
[ 'remark', '' ],
]);
$this->validate($data, 'app\validate\openapi\OpenapiApp');
return success('添加成功', (new OpenapiAppService())->add($data));
}
/**
* 编辑账号
* @description 开放账号编辑
* @param int $id
* @return Response
*/
public function edit(int $id): Response
{
$data = $this->request->params([
[ 'name', '' ],
[ 'status', 1 ],
[ 'auth_domains', [] ],
[ 'ip_white', '' ],
[ 'expire_time', 0 ],
[ 'token_expire', 7200 ],
[ 'remark', '' ],
]);
$this->validate($data, 'app\validate\openapi\OpenapiApp');
(new OpenapiAppService())->edit($id, $data);
return success('保存成功');
}
/**
* 启用 / 禁用账号
* @description 开放账号启停
* @param int $id
* @return Response
*/
public function setStatus(int $id): Response
{
$data = $this->request->params([
[ 'status', 1 ],
]);
(new OpenapiAppService())->setStatus($id, (int) $data[ 'status' ]);
return success('设置成功');
}
/**
* 重置密钥
* @description 开放账号重置密钥
* @param int $id
* @return Response
*/
public function resetSecret(int $id): Response
{
return success((new OpenapiAppService())->resetSecret($id));
}
/**
* 批量重置密钥
* @description 开放账号批量重置密钥
* @return Response
*/
public function batchResetSecret(): Response
{
$data = $this->request->params([
[ 'ids', [] ],
]);
return success('重置成功', (new OpenapiAppService())->batchResetSecret((array) $data[ 'ids' ]));
}
/**
* 查看密钥明文
* @description 查看开放账号 Secret Key 明文
* @param int $id
* @return Response
*/
public function secret(int $id): Response
{
return success((new OpenapiAppService())->getSecret($id));
}
/**
* 删除账号
* @description 开放账号删除
* @param int $id
* @return Response
*/
public function del(int $id): Response
{
(new OpenapiAppService())->del($id);
return success('删除成功');
}
/**
* 可授权接口清单
* @description 开放接口清单
* @return Response
*/
public function apiTree(): Response
{
return success((new OpenapiAppService())->getApiTree());
}
}

View File

@ -0,0 +1,59 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\openapi;
use app\service\admin\openapi\OpenapiConfigService;
use core\base\BaseAdminController;
use think\Response;
/**
* 开放平台设置
* Class Config
* @description 开放平台设置
* @package app\adminapi\controller\openapi
*/
class Config extends BaseAdminController
{
/**
* 获取开放平台设置
* @description 获取开放平台设置(总开关)
* @return Response
*/
public function getConfig(): Response
{
return success((new OpenapiConfigService())->getConfig());
}
/**
* 保存开放平台设置
* @description 保存开放平台设置(总开关)
* @return Response
*/
public function setConfig(): Response
{
$data = $this->request->params([
[ 'is_open', '1' ],
]);
(new OpenapiConfigService())->setConfig($data);
return success('设置成功');
}
/**
* 刷新数据加密密钥
* @description 刷新开放平台数据加密密钥
* @return Response
*/
public function refreshSecret(): Response
{
return success('刷新成功', (new OpenapiConfigService())->refreshSecret());
}
}

View File

@ -0,0 +1,78 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\openapi;
use app\service\admin\openapi\OpenapiDocService;
use core\base\BaseAdminController;
use think\Response;
/**
* 开放平台接口文档
* Class Doc
* @description 开放平台接口文档
* @package app\adminapi\controller\openapi
*/
class Doc extends BaseAdminController
{
/**
* 接口清单树
* @description 开放接口清单(按模块分组)
* @return Response
*/
public function tree(): Response
{
$app_type = (string) $this->request->param('app_type', '');
return success((new OpenapiDocService())->getTree($app_type));
}
/**
* 接口详情
* @description 开放接口详情
* @return Response
*/
public function detail(): Response
{
$api_key = (string) $this->request->param('api_key', '');
return success((new OpenapiDocService())->getDetail($api_key));
}
/**
* 调试基础信息
* @description 接口调试基础信息
* @return Response
*/
public function base(): Response
{
return success((new OpenapiDocService())->getDebugBase());
}
/**
* 可调试的开放账号列表
* @description 接口调试可用的开放账号列表
* @return Response
*/
public function apps(): Response
{
return success((new OpenapiDocService())->getDebugApps());
}
/**
* 调试账号密钥
* @description 接口调试获取开放账号密钥
* @param int $id
* @return Response
*/
public function secret(int $id): Response
{
return success((new OpenapiDocService())->getAppSecret($id));
}
}

View File

@ -0,0 +1,43 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\adminapi\controller\openapi;
use app\service\admin\openapi\OpenapiLogService;
use core\base\BaseAdminController;
use think\Response;
/**
* 开放平台调用日志
* Class Log
* @description 开放平台调用日志
* @package app\adminapi\controller\openapi
*/
class Log extends BaseAdminController
{
/**
* 日志列表
* @description 开放平台调用日志列表
* @return Response
*/
public function pages(): Response
{
$where = $this->request->params([
[ 'app_id', '' ],
[ 'site_id', '' ],
[ 'api_key', '' ],
[ 'method', '' ],
[ 'code', '' ],
[ 'create_time', [] ],
]);
return success((new OpenapiLogService())->getPage($where));
}
}

View File

@ -5,6 +5,7 @@ namespace app\adminapi\controller\sys;
use app\service\admin\sys\IntegrityService;
use core\base\BaseAdminController;
use core\integrity\CloudBaselineClient;
use think\Response;
use Throwable;
@ -142,8 +143,12 @@ class Integrity extends BaseAdminController
fn (string $event, array $data): bool => $this->ssePush($event, $data)
);
} catch (Throwable $e) {
// 任何异常都必须让前端知道「这轮结束了、为什么结束」,否则它会一直等下去
$this->ssePush('failed', ['message' => $e->getMessage()]);
// 任何异常都必须让前端知道「这轮结束了、为什么结束」,否则它会一直等下去。
// 异常信息可能是语言包 key(未授权时就是 NEED_TO_AUTHORIZE_FIRST),
// 而 SSE 是手工输出的、不经过 fail()/get_lang(),原样透出会让弹框里显示成一串 key
$this->ssePush('failed', [
'message' => CloudBaselineClient::readableMessage((string) $e->getMessage())
]);
}
// SSE 直接结束输出,不走框架响应(避免被包装成 JSON)
@ -196,6 +201,42 @@ class Integrity extends BaseAdminController
));
}
/**
* 备份列表(写回前留下的备份,供查看与恢复)
*/
public function backupList(): Response
{
return success((new IntegrityService())->getBackupList());
}
/**
* 从备份恢复:把备份里的文件拷回本地原位置(覆盖前再备份一次当前内容)
*/
public function backupRestore(): Response
{
$files = $this->request->param('files', []);
return success((new IntegrityService())->restoreBackup(
(string) $this->request->param('stamp', ''),
(string) $this->request->param('target', ''),
is_array($files) ? $files : []
));
}
/**
* 删除备份:整批删除,或只删批内选中的文件
*/
public function backupDelete(): Response
{
$files = $this->request->param('files', []);
return success((new IntegrityService())->deleteBackup(
(string) $this->request->param('stamp', ''),
(string) $this->request->param('target', ''),
is_array($files) ? $files : []
));
}
/**
* 取字符串参数;空字符串视为「没传」
*/

View File

@ -91,6 +91,16 @@ class System extends BaseAdminController
return success(data: (new SystemService())->checkJob());
}
/**
* 平台端队列运行检测 + 站内信提醒
* @description 检测消息队列是否运行,未运行则发送(或刷新)平台端站内信提醒,恢复后发送「已恢复」;无论谁调用,提醒都发到平台端消息中心
* @return Response
*/
public function checkQueueNotice()
{
return success(data: (new SystemService())->checkQueueNotice());
}
/**
* 校验计划任务是否正常运行
* @description 校验计划任务是否正常运行

View File

@ -34,6 +34,12 @@ Route::group('sys/integrity', function () {
Route::get('file_diff', 'sys.Integrity/fileDiff');
// 用官方内容写回本地文件(覆盖前逐文件备份)
Route::post('restore', 'sys.Integrity/restore');
// 备份列表(写回前留下的备份,供查看与恢复)
Route::get('backup_list', 'sys.Integrity/backupList');
// 从备份恢复(覆盖前会把本地当前内容再备份一次)
Route::post('backup_restore', 'sys.Integrity/backupRestore');
// 删除备份(整批或批内选中文件)
Route::post('backup_delete', 'sys.Integrity/backupDelete');
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,

View File

@ -54,6 +54,8 @@ Route::group('niucloud', function() {
Route::post('account/token', 'niucloud.Account/saveToken');
// 选用授权(仅保存所选授权的授权码,不做绑定)
Route::post('account/select', 'niucloud.Account/select');
// 取消选用授权(清空系统已选授权,回到未授权状态)
Route::post('account/cancel', 'niucloud.Account/cancel');
// 绑定授权(官网 embed 页回传授权凭据)
Route::post('account/bind', 'niucloud.Account/bind');
// 退出官网账号会话(不解除本地授权)

View File

@ -0,0 +1,71 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
use app\adminapi\middleware\AdminCheckRole;
use app\adminapi\middleware\AdminCheckToken;
use app\adminapi\middleware\AdminLog;
use think\facade\Route;
/**
* 开放平台(管理端)
* 平台端与店铺端共用同一套路由,通过请求头 site-id 区分数据范围
*/
Route::group('openapi', function () {
/***************************************************** 开放设置 ****************************************************/
// 获取开放平台设置(总开关)
Route::get('config', 'openapi.Config/getConfig');
// 保存开放平台设置(总开关)
Route::post('config', 'openapi.Config/setConfig');
// 刷新数据加密密钥(仅平台端)
Route::post('config/secret', 'openapi.Config/refreshSecret');
/***************************************************** 开放账号 ****************************************************/
// 账号列表
Route::get('app/pages', 'openapi.App/pages');
// 可授权接口清单
Route::get('app/api-tree', 'openapi.App/apiTree');
// 查看密钥明文
Route::get('app/secret/:id', 'openapi.App/secret');
// 账号详情
Route::get('app/:id', 'openapi.App/info');
// 新增账号
Route::post('app', 'openapi.App/add');
// 启用 / 禁用
Route::put('app/status/:id', 'openapi.App/setStatus');
// 重置密钥
Route::put('app/reset-secret/:id', 'openapi.App/resetSecret');
// 批量重置密钥(三段路径,避免与 PUT app/:id 冲突)
Route::put('app/batch/reset-secret', 'openapi.App/batchResetSecret');
// 编辑账号
Route::put('app/:id', 'openapi.App/edit');
// 删除账号
Route::delete('app/:id', 'openapi.App/del');
/***************************************************** 接口文档 ****************************************************/
// 接口清单树
Route::get('doc/tree', 'openapi.Doc/tree');
// 接口详情
Route::get('doc/detail', 'openapi.Doc/detail');
// 调试基础信息
Route::get('doc/base', 'openapi.Doc/base');
// 可调试的开放账号列表
Route::get('doc/apps', 'openapi.Doc/apps');
// 调试账号密钥
Route::get('doc/secret/:id', 'openapi.Doc/secret');
/***************************************************** 调用日志 ****************************************************/
// 日志列表
Route::get('log/pages', 'openapi.Log/pages');
})->middleware([
AdminCheckToken::class,
AdminCheckRole::class,
AdminLog::class,
]);

View File

@ -186,6 +186,8 @@ Route::group('sys', function() {
Route::get('system', 'sys.System/getSystemInfo');
//校验消息队列
Route::get('job', 'sys.System/checkJob');
//平台端队列检测提醒(未运行时发站内信)
Route::get('queue_notice', 'sys.System/checkQueueNotice');
//校验计划任务
Route::get('schedule', 'sys.System/checkSchedule');
//环境变量

View File

@ -4,7 +4,6 @@ declare (strict_types=1);
namespace app\command\addon;
use app\service\core\addon\CoreAddonInstallService;
use Exception;
use think\console\Command;
use think\console\Input;
use think\console\input\Option;
@ -23,13 +22,24 @@ class Install extends Command
protected function execute(Input $input, Output $output)
{
$instance = CoreAddonInstallService::instance($input->getArgument('addon'));
$addon = $input->getArgument('addon');
if (!is_string($addon) || $addon === '') {
$output->writeln("Command failed MISSING_ADDON_ARGUMENT");
return;
}
$step = $input->getOption('step');
if (!is_string($step) || $step === '') {
$output->writeln("Command failed MISSING_STEP_OPTION");
return;
}
$instance = CoreAddonInstallService::instance($addon);
try {
$instance->$step();
$output->writeln("Command executed successfully");
} catch ( Exception $e ) {
} catch ( \Throwable $e ) {
$output->writeln("Command failed " . $e->getMessage());
}
}

View File

@ -0,0 +1,179 @@
<?php
declare (strict_types=1);
namespace app\command\addon;
use app\service\core\addon\CoreAddonPurifyService;
use think\console\Command;
use think\console\Input;
use think\console\input\Option;
use think\console\Output;
/**
* 纯净框架逆推命令
*
* 用法:
* php think addon:purify # dry-run,仅输出清理计划
* php think addon:purify --apply # 实际执行清理
* php think addon:purify --addon=pintuan,shop # 仅处理指定插件
* php think addon:purify --apply --orphans # 一并删除孤儿目录
* php think addon:purify --apply --no-backup # 跳过备份
* php think addon:purify --json # 输出 JSON 报告
*/
class Purify extends Command
{
protected function configure()
{
$this->setName('addon:purify')
->addOption('addon', 'a', Option::VALUE_OPTIONAL, '限定插件 key,多个用英文逗号分隔')
->addOption('apply', null, Option::VALUE_NONE, '实际执行清理(默认仅 dry-run 预览)')
->addOption('orphans', null, Option::VALUE_NONE, '一并删除无插件源码对应的孤儿目录')
->addOption('no-backup', null, Option::VALUE_NONE, '执行前不备份')
->addOption('json', null, Option::VALUE_NONE, '以 JSON 输出报告')
->setDescription('逆推清除各端插件安装痕迹,还原纯净框架');
}
protected function execute(Input $input, Output $output)
{
$filter = [];
$addon_option = $input->getOption('addon');
if (is_string($addon_option) && trim($addon_option) !== '') {
$filter = array_values(array_filter(array_map('trim', explode(',', $addon_option))));
}
$apply = (bool) $input->getOption('apply');
$include_orphans = (bool) $input->getOption('orphans');
$backup = !$input->getOption('no-backup');
$json = (bool) $input->getOption('json');
$service = new CoreAddonPurifyService();
if (!$apply) {
$plan = $service->scan($filter);
if ($json) {
$output->writeln(json_encode([
'mode' => 'dry-run',
'summary' => $service->summarize($plan),
'plan' => $plan,
], JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
return;
}
$this->renderPlan($output, $plan, $service, $include_orphans);
$output->writeln('');
$output->info('以上为预览(dry-run)。确认无误后执行:php think addon:purify --apply');
return;
}
$report = $service->purify($filter, $include_orphans, $backup);
if ($json) {
$output->writeln(json_encode($report, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
return;
}
$this->renderReport($output, $report);
}
/**
* 渲染清理计划
*/
protected function renderPlan(Output $output, array $plan, CoreAddonPurifyService $service, bool $include_orphans)
{
$summary = $service->summarize($plan);
$output->writeln('===== 纯净框架逆推 · 扫描计划(dry-run) =====');
$output->writeln('待清理插件:' . $summary['addon_count'] . ' 个');
if (!empty($plan['addons'])) {
$output->writeln(' ' . implode(', ', $plan['addons']));
}
// 各端待删目录
$by_port = [];
foreach ($plan['dirs'] as $item) {
if (!$item['exist']) continue;
$by_port[ $item['port'] ][] = $item['rel'];
}
$output->writeln('');
$output->writeln('----- 待删除目录(各端) -----');
if (empty($by_port)) {
$output->writeln(' (无)');
}
foreach ($by_port as $port => $items) {
$output->writeln("【{$port}】 " . count($items) . ' 个');
foreach ($items as $rel) {
$output->writeln(' - ' . $rel);
}
}
// 孤儿目录
$orphans = array_values(array_filter($plan['orphans'], fn($item) => $item['exist']));
$output->writeln('');
$output->writeln('----- 孤儿目录(无对应插件源码) -----');
if (empty($orphans)) {
$output->writeln(' (无)');
}
foreach ($orphans as $item) {
$output->writeln(' ! ' . $item['rel'] . ($include_orphans ? '(将删除)' : '(仅提示,加 --orphans 才删除)'));
}
// 待重建的框架文件
$output->writeln('');
$output->writeln('----- 待重建的框架自有文件 -----');
foreach ($plan['generated'] as $gen) {
$mark = $gen['exist'] ? '存在' : '不存在';
$output->writeln(' - [' . $gen['type'] . '] ' . $gen['rel'] . "({$mark})");
}
// 依赖候选
$output->writeln('');
$output->writeln('----- 依赖人工确认(只识别不修改) -----');
foreach ($plan['depend'] as $dep) {
$output->writeln(' - ' . $dep['file'] . ' ← ' . $dep['source'] . ':' . $dep['package_count'] . ' 个依赖');
if (!empty($dep['packages'])) {
$output->writeln(' ' . implode(', ', array_keys($dep['packages'])));
}
}
}
/**
* 渲染清理结果
*/
protected function renderReport(Output $output, array $report)
{
$output->writeln('===== 纯净框架逆推 · 执行结果 =====');
if (!empty($report['backup_dir'])) {
$output->writeln('备份目录:' . $report['backup_dir']);
}
$output->writeln('已删除目录:' . ($report['deleted_dir_count'] ?? 0) . ' 个,文件:' . ($report['deleted_file_count'] ?? 0) . ' 个');
foreach ($report['deleted_dirs'] as $item) {
$output->writeln(' - [' . $item['port'] . '] ' . $item['rel'] . '(' . $item['files'] . ' 文件)');
}
$output->writeln('');
$output->writeln('重建的框架文件:');
if (empty($report['rebuilt_files'])) {
$output->writeln(' (无)');
}
foreach ($report['rebuilt_files'] as $rel) {
$output->writeln(' - ' . $rel);
}
if (!empty($report['orphan_report'])) {
$output->writeln('');
$output->writeln('孤儿目录(未删除,需人工确认):');
foreach ($report['orphan_report'] as $item) {
$output->writeln(' ! ' . $item['rel']);
}
}
$output->writeln('');
$output->writeln('依赖人工确认(未修改):');
foreach ($report['depend'] as $dep) {
$output->writeln(' - ' . $dep['file'] . ':' . $dep['package_count'] . ' 个依赖');
if (!empty($dep['packages'])) {
$output->writeln(' ' . implode(', ', array_keys($dep['packages'])));
}
}
$output->writeln('');
$output->info('清理完成。依赖文件未做修改,请按上方清单人工核对各端 package.json / composer.json。');
}
}

View File

@ -240,12 +240,14 @@ function get_start_and_end_time_by_day($day = '')
*/
function get_weekinfo_by_time($date)
{
$idx = strftime("%u", strtotime($date));
// strftime() 在 PHP 8.1 起已弃用,改用 date()(N=ISO 星期 1-7,与 strftime("%u") 等价)
$ts = strtotime($date);
$idx = (int) date("N", $ts);
$mon_idx = $idx - 1;
$sun_idx = $idx - 7;
return array(
'week_start_day' => strftime('%Y-%m-%d', strtotime($date) - $mon_idx * 86400),
'week_end_day' => strftime('%Y-%m-%d', strtotime($date) - $sun_idx * 86400),
'week_start_day' => date('Y-m-d', $ts - $mon_idx * 86400),
'week_end_day' => date('Y-m-d', $ts - $sun_idx * 86400),
);
}
@ -1103,17 +1105,21 @@ function get_last_time($time = null)
/**
* 检查目录及其子目录的权限
*
* 默认契约:目录不存在即视为调用方传错路径,直接抛异常(其它调用方 / 插件代码可能依赖此行为)。
*
* $allow_missing = true 时用于 public/wap、public/admin 这类「会由程序按需创建」的前端产物目录
* (编译 / 安装时经 dir_copy → dir_mkdir 创建):不再抛异常,改为判断「能不能创建出来」——
* 沿路径向上找第一个已存在的父级,它可写即视为通过;只有连父级都不可写才是真的权限问题。
*
* @param $dir 要检查的目录路径
* @param $data
* @param $exclude_dir 排除排除无需检测的的文件夹
* @param bool $allow_missing 目录不存在时是否允许按「可创建即通过」处理(默认 false,保持原契约)
* @return array|array[]|mixed
*/
function checkDirPermissions($dir, $data = [], $exclude_dir = [])
function checkDirPermissions($dir, $data = [], $exclude_dir = [], $allow_missing = false)
{
if (!is_dir($dir)) {
throw new \RuntimeException(sprintf('指定的路径 "%s" 不是一个有效的目录', $dir));
}
if (empty($data)) {
$data = [
'unreadable' => [],
@ -1121,6 +1127,32 @@ function checkDirPermissions($dir, $data = [], $exclude_dir = [])
];
}
if (!is_dir($dir)) {
// 默认保持原契约:目录不存在直接抛异常,避免影响依赖此行为的调用方
if (!$allow_missing) {
throw new \RuntimeException(sprintf('指定的路径 "%s" 不是一个有效的目录', $dir));
}
// 允许缺失:判断能否由程序创建出来(即最近一个已存在的父级是否可写)。
// 不能只看 dirname() 一层:public/wap 这类可能连着多层都还没建。
$parent = rtrim(str_replace('\\', '/', (string) $dir), '/');
while (($next = dirname($parent)) !== $parent) {
$parent = $next;
if (!is_dir($parent)) continue;
// 父级可写 => 后续能创建出目标目录,视为通过(这不是权限异常)
if (is_writable($parent)) return $data;
// 父级存在但不可写:无法创建,记录真正出问题的父级,便于调用方定位
$data['not_writable'][] = $parent;
return $data;
}
// 一路到根都没找到已存在的父级(异常路径):按不可写记录自身
$data['not_writable'][] = $dir;
return $data;
}
try {
if (!is_readable($dir)) {
$data['unreadable'][] = $dir;

View File

@ -37,7 +37,7 @@ return [
'menu_short_name' => '运营',
'parent_key' => '',
'menu_type' => '0',
'icon' => 'iconfont iconshujutongji',
'icon' => 'iconfont iconyunyingPCxx-1',
'api_url' => '',
'router_path' => '',
'view_path' => '',
@ -51,7 +51,7 @@ return [
'menu_key' => 'operate_panel',
'menu_short_name' => '面板',
'menu_type' => '1',
'icon' => 'iconfont iconshujutongji',
'icon' => 'iconfont iconmianbanguanliPCxx',
'api_url' => 'stat/addon_panel',
'router_path' => 'operate/panel',
'view_path' => 'operate/panel',
@ -130,7 +130,7 @@ return [
'menu_key' => 'website_setting',
'menu_short_name' => '网站设置',
'menu_type' => '0',
'icon' => 'iconfont iconwangzhanshezhic',
'icon' => 'iconfont iconwangzhanshezhiPCxx',
'api_url' => '',
'router_path' => '',
'view_path' => '',
@ -206,7 +206,7 @@ return [
'menu_key' => 'auth',
'menu_short_name' => '权限设置',
'menu_type' => '0',
'icon' => 'iconfont iconquanxianshezhic',
'icon' => 'iconfont iconquanxianshezhiPCxx',
'api_url' => '',
'router_path' => '',
'view_path' => '',
@ -408,7 +408,7 @@ return [
'menu_key' => 'setting_storage',
'menu_short_name' => '存储设置',
'menu_type' => '1',
'icon' => 'iconfont iconcunchushezhic',
'icon' => 'iconfont iconcunchushezhiPCxx',
'api_url' => 'sys/storage',
'router_path' => 'setting/storage',
'view_path' => 'setting/storage',
@ -522,7 +522,7 @@ return [
'menu_key' => 'setting_login',
'menu_short_name' => '登录设置',
'menu_type' => '1',
'icon' => 'iconfont icondenglushezhic',
'icon' => 'iconfont icondenglushezhiPCxx',
'api_url' => 'sys/config/login',
'router_path' => 'setting/adminlogin',
'view_path' => 'setting/adminlogin',
@ -552,7 +552,7 @@ return [
'menu_key' => 'wx_oplatform',
'menu_short_name' => '微信开放平台',
'menu_type' => '1',
'icon' => 'iconfont iconweixinkaifangpingtaic',
'icon' => 'iconfont icona-weixinkaifangpingtaiPCxx',
'api_url' => 'sys/config/wxoplatform',
'router_path' => 'setting/oplatform',
'view_path' => 'setting/oplatform',
@ -596,7 +596,7 @@ return [
'menu_key' => 'attachment',
'menu_short_name' => '素材管理',
'menu_type' => '1',
'icon' => 'iconfont iconsucaiguanlic',
'icon' => 'iconfont iconsucaiguanliPCxx',
'api_url' => 'sys/attachment',
'router_path' => 'setting/attachment',
'view_path' => 'tools/attachment',
@ -696,7 +696,7 @@ return [
'menu_key' => 'map_setting',
'menu_short_name' => '地图设置',
'menu_type' => '1',
'icon' => 'iconfont iconditushezhic',
'icon' => 'iconfont iconditushezhiPCxx',
'api_url' => 'sys/config/map',
'router_path' => 'setting/map',
'view_path' => 'setting/map',
@ -726,7 +726,7 @@ return [
'menu_key' => 'layout_setting',
'menu_short_name' => '布局设置',
'menu_type' => '1',
'icon' => 'iconfont iconbujushezhic',
'icon' => 'iconfont iconbujushezhiPCxx',
'api_url' => 'sys/config/layout',
'router_path' => 'setting/layout',
'view_path' => 'setting/layout',
@ -759,7 +759,7 @@ return [
'menu_short_name' => '站点',
'parent_key' => '',
'menu_type' => '1',
'icon' => 'iconfont iconFramec-4',
'icon' => 'iconfont iconzhandianPCxx',
'api_url' => '',
'router_path' => 'site/manage',
'view_path' => 'site/manage',
@ -1184,12 +1184,84 @@ return [
'status' => '1',
'is_show' => '1',
'children' => [
[
'menu_name' => '接口文档',
'menu_key' => 'openapi_doc',
'menu_short_name' => '文档',
'menu_type' => '1',
'icon' => 'element Document',
'api_url' => 'openapi/doc/tree',
'router_path' => 'openapi/doc',
'view_path' => 'openapi/doc',
'methods' => 'get',
'sort' => '99',
'status' => '1',
'is_show' => '1',
'children' => [
[
'menu_name' => '接口详情',
'menu_key' => 'openapi_doc_detail',
'menu_short_name' => '接口详情',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/doc/detail',
'router_path' => '',
'view_path' => '',
'methods' => 'get',
'sort' => '100',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '调试信息',
'menu_key' => 'openapi_doc_base',
'menu_short_name' => '调试信息',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/doc/base',
'router_path' => '',
'view_path' => '',
'methods' => 'get',
'sort' => '99',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '调试账号列表',
'menu_key' => 'openapi_doc_apps',
'menu_short_name' => '调试账号',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/doc/apps',
'router_path' => '',
'view_path' => '',
'methods' => 'get',
'sort' => '98',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '调试账号密钥',
'menu_key' => 'openapi_doc_secret',
'menu_short_name' => '调试密钥',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/doc/secret/<id>',
'router_path' => '',
'view_path' => '',
'methods' => 'get',
'sort' => '97',
'status' => '1',
'is_show' => '0',
],
],
],
[
'menu_name' => '插件开发',
'menu_key' => 'addon_expolit',
'menu_short_name' => '插件开发',
'menu_type' => '0',
'icon' => 'iconfont iconchajiankaifa11',
'icon' => 'iconfont iconchajiankaifaPCxx',
'api_url' => '',
'router_path' => 'tools/addon/expolit',
'view_path' => 'tools/addon/expolit',
@ -1381,7 +1453,7 @@ return [
'menu_key' => 'update_cache',
'menu_short_name' => '更新缓存',
'menu_type' => '1',
'icon' => 'iconfont icongengxinhuancun2',
'icon' => 'iconfont icongengxinhuancunPCxx',
'api_url' => 'sys/schema/clear',
'router_path' => 'tools/update_cache',
'view_path' => 'tools/updatecache',
@ -1511,7 +1583,7 @@ return [
'menu_key' => 'platform_menu',
'menu_short_name' => '平台菜单',
'menu_type' => '1',
'icon' => 'iconfont iconpingtaicaidan1',
'icon' => 'iconfont iconpingtaicaidanPCxx',
'api_url' => 'sys/menu',
'router_path' => 'tools/admin_menu',
'view_path' => 'auth/menu',
@ -1583,7 +1655,7 @@ return [
'menu_key' => 'site_menu',
'menu_short_name' => '站点菜单',
'menu_type' => '1',
'icon' => 'iconfont iconzhandiancaidan1',
'icon' => 'iconfont iconzhandiancaidanPCxx',
'api_url' => 'sys/menu',
'router_path' => 'tools/site_menu',
'view_path' => 'auth/site_menu',
@ -1655,7 +1727,7 @@ return [
'menu_key' => 'tools_schedule',
'menu_short_name' => '计划任务',
'menu_type' => '1',
'icon' => 'iconfont iconjihuarenwu11',
'icon' => 'iconfont iconjihuarenwuPCxx',
'api_url' => 'sys/schedule/list',
'router_path' => 'tools/schedule',
'view_path' => 'tools/schedule',
@ -1727,7 +1799,7 @@ return [
'menu_key' => 'tools_check_environment',
'menu_short_name' => '环境检测',
'menu_type' => '1',
'icon' => 'iconfont iconhuanjingjiance11',
'icon' => 'iconfont iconhuanjingjiancePCxx',
'api_url' => '',
'router_path' => 'tools/detection',
'view_path' => 'tools/detection',
@ -1741,7 +1813,7 @@ return [
'menu_key' => 'tools_database_repair',
'menu_short_name' => '数据库修复',
'menu_type' => '1',
'icon' => 'iconfont iconbeifenjilu',
'icon' => 'iconfont iconshujukuhuifuPCxx',
'api_url' => '',
'router_path' => 'tools/database_repair',
'view_path' => 'tools/database_repair',
@ -1799,7 +1871,7 @@ return [
'menu_key' => 'backup_upgrade',
'menu_short_name' => '版本升级',
'menu_type' => '1',
'icon' => 'iconfont iconbeifenjilu',
'icon' => 'iconfont iconbeifenshengjiPCxx',
'api_url' => '',
'router_path' => 'tools/backup_upgrade',
'view_path' => 'tools/backup_upgrade',
@ -1857,7 +1929,7 @@ return [
'menu_key' => 'app_auth',
'menu_short_name' => '授权信息',
'menu_type' => '1',
'icon' => 'iconfont iconshouquanxinxi1',
'icon' => 'iconfont iconshouquanxinxiPCxx',
'api_url' => '',
'router_path' => 'tools/authorize',
'view_path' => 'app/authorize',
@ -1887,7 +1959,7 @@ return [
'menu_key' => 'task_records',
'menu_short_name' => '任务管理',
'menu_type' => '1',
'icon' => 'iconfont iconjihuarenwu',
'icon' => 'iconfont iconrenwuguanliPCxx',
'api_url' => '',
'router_path' => 'tools/task_records',
'view_path' => 'tools/task_records',
@ -1896,14 +1968,184 @@ return [
'status' => '1',
'is_show' => '1',
],
[
'menu_name' => '开放账号',
'menu_key' => 'openapi_app',
'menu_short_name' => '账号',
'menu_type' => '1',
'icon' => 'element Key',
'api_url' => 'openapi/app/pages',
'router_path' => 'openapi/list',
'view_path' => 'openapi/list',
'methods' => 'get',
'sort' => '98',
'status' => '1',
'is_show' => '1',
'children' => [
[
'menu_name' => '创建开放账号',
'menu_key' => 'openapi_app_add',
'menu_short_name' => '创建账号',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/app',
'router_path' => '',
'view_path' => '',
'methods' => 'post',
'sort' => '100',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '编辑开放账号',
'menu_key' => 'openapi_app_edit',
'menu_short_name' => '编辑账号',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/app/<id>',
'router_path' => '',
'view_path' => '',
'methods' => 'put',
'sort' => '99',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '开放账号启停',
'menu_key' => 'openapi_app_status',
'menu_short_name' => '账号启停',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/app/status/<id>',
'router_path' => '',
'view_path' => '',
'methods' => 'put',
'sort' => '98',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '重置密钥',
'menu_key' => 'openapi_app_reset_secret',
'menu_short_name' => '重置密钥',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/app/reset-secret/<id>',
'router_path' => '',
'view_path' => '',
'methods' => 'put',
'sort' => '97',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '批量重置密钥',
'menu_key' => 'openapi_app_batch_reset_secret',
'menu_short_name' => '批量重置密钥',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/app/batch/reset-secret',
'router_path' => '',
'view_path' => '',
'methods' => 'put',
'sort' => '96',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '删除开放账号',
'menu_key' => 'openapi_app_delete',
'menu_short_name' => '删除账号',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/app/<id>',
'router_path' => '',
'view_path' => '',
'methods' => 'delete',
'sort' => '96',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '开放接口清单',
'menu_key' => 'openapi_app_api_tree',
'menu_short_name' => '接口清单',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/app/api-tree',
'router_path' => '',
'view_path' => '',
'methods' => 'get',
'sort' => '95',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '开放平台设置',
'menu_key' => 'openapi_config_get',
'menu_short_name' => '开放设置',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/config',
'router_path' => '',
'view_path' => '',
'methods' => 'get',
'sort' => '94',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '保存开放平台设置',
'menu_key' => 'openapi_config_set',
'menu_short_name' => '保存开放设置',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/config',
'router_path' => '',
'view_path' => '',
'methods' => 'post',
'sort' => '93',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '刷新开放平台加密密钥',
'menu_key' => 'openapi_config_secret',
'menu_short_name' => '刷新加密密钥',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/config/secret',
'router_path' => '',
'view_path' => '',
'methods' => 'post',
'sort' => '92',
'status' => '1',
'is_show' => '0',
],
],
],
[
'menu_name' => '调用日志',
'menu_key' => 'openapi_log',
'menu_short_name' => '日志',
'menu_type' => '1',
'icon' => 'element List',
'api_url' => 'openapi/log/pages',
'router_path' => 'openapi/log',
'view_path' => 'openapi/log',
'methods' => 'get',
'sort' => '97',
'status' => '1',
'is_show' => '0',
],
],
],
[
'menu_name' => '云编译',
'menu_key' => 'cloud_compile',
'menu_short_name' => '云编译',
'menu_short_name' => '编译',
'menu_type' => '1',
'icon' => 'iconfont iconyunbianyi',
'icon' => 'iconfont iconyunbianyiPCxx',
'api_url' => '',
'router_path' => 'tools/cloud_compile',
'view_path' => 'tools/cloud_compile',

View File

@ -35,7 +35,7 @@ return [
'menu_key' => 'diy_page_decorate_index',
'menu_short_name' => '启动页',
'menu_type' => '1',
'icon' => 'element House',
'icon' => 'iconfont iconshouyePCxx',
'api_url' => '',
'router_path' => 'diy/index',
'view_path' => 'diy/index',
@ -65,7 +65,7 @@ return [
'menu_key' => 'diy_page_decorate_member_index',
'menu_short_name' => '个人中心',
'menu_type' => '1',
'icon' => 'iconfont iconhuiyuanliebiao',
'icon' => 'iconfont iconwodePCxx1',
'api_url' => '',
'router_path' => 'diy/member',
'view_path' => 'diy/member',
@ -93,7 +93,7 @@ return [
'menu_key' => 'diy_page_list',
'menu_short_name' => '微页面',
'menu_type' => '1',
'icon' => 'iconfont icondianpuzhuangxiu',
'icon' => 'iconfont iconshoujiPCxx',
'api_url' => 'diy/diy',
'router_path' => 'diy/list',
'view_path' => 'diy/list',
@ -123,7 +123,7 @@ return [
'menu_key' => 'diy_page_route',
'menu_short_name' => '页面路径',
'menu_type' => '1',
'icon' => 'iconfont icondianpuzhuangxiu',
'icon' => 'iconfont iconluxianPCxx',
'api_url' => 'diy/diy',
'router_path' => 'diy/route',
'view_path' => 'diy/route',
@ -137,7 +137,7 @@ return [
'menu_key' => 'diy_bottom',
'menu_short_name' => '底部导航',
'menu_type' => '1',
'icon' => 'iconfont icondibudaohang',
'icon' => 'iconfont icondibudaohangPCxx',
'api_url' => 'diy/bottom',
'router_path' => 'diy/tabbar',
'view_path' => 'diy/tabbar',
@ -167,7 +167,7 @@ return [
'menu_key' => 'attachment',
'menu_short_name' => '素材管理',
'menu_type' => '1',
'icon' => 'element Files',
'icon' => 'iconfont iconwenjianPCxx',
'api_url' => 'sys/attachment',
'router_path' => 'diy/attachment',
'view_path' => 'tools/attachment',
@ -253,7 +253,7 @@ return [
'menu_key' => 'poster_management',
'menu_short_name' => '海报管理',
'menu_type' => '1',
'icon' => 'element Files',
'icon' => 'iconfont icontupianPCxx',
'api_url' => 'poster',
'router_path' => 'poster/list',
'view_path' => 'poster/list',
@ -282,7 +282,7 @@ return [
'menu_key' => 'diy_theme_style',
'menu_short_name' => '主题风格',
'menu_type' => '1',
'icon' => 'element Files',
'icon' => 'iconfont iconpifuPCxx',
'api_url' => '',
'router_path' => 'diy/theme_style',
'view_path' => 'diy/theme_style',
@ -341,7 +341,7 @@ return [
'menu_key' => 'member_list',
'menu_short_name' => '会员列表',
'menu_type' => '1',
'icon' => 'iconfont iconhuiyuanliebiao',
'icon' => 'iconfont iconxingmingPCxx',
'api_url' => 'member/member',
'router_path' => 'member/member',
'view_path' => 'member/member',
@ -444,7 +444,7 @@ return [
'menu_key' => 'member_label',
'menu_short_name' => '会员标签',
'menu_type' => '1',
'icon' => 'element CollectionTag',
'icon' => 'iconfont iconbiaoqianPCxx',
'api_url' => 'member/label',
'router_path' => 'member/label',
'view_path' => 'member/label',
@ -502,7 +502,7 @@ return [
'menu_key' => 'member_level',
'menu_short_name' => '会员等级',
'menu_type' => '0',
'icon' => 'element CollectionTag',
'icon' => 'iconfont iconhuiyuandengjiPCxx',
'api_url' => 'member/level',
'router_path' => 'member/level',
'view_path' => 'member/level',
@ -650,7 +650,7 @@ return [
'menu_key' => 'member_point',
'menu_short_name' => '会员积分',
'menu_type' => '0',
'icon' => 'iconfont iconjifen-xianxing',
'icon' => 'iconfont iconkeyongjifenPCxx',
'api_url' => '',
'router_path' => 'member/point',
'view_path' => '',
@ -710,7 +710,7 @@ return [
'menu_key' => 'member_balance',
'menu_short_name' => '会员余额',
'menu_type' => '1',
'icon' => 'element Money',
'icon' => 'iconfont iconhuiyuanyuePCxx',
'api_url' => 'member/account/balance',
'router_path' => 'member/balance',
'view_path' => 'member/balance',
@ -724,7 +724,7 @@ return [
'menu_key' => 'member_commission',
'menu_short_name' => '会员佣金',
'menu_type' => '1',
'icon' => 'element Money',
'icon' => 'iconfont iconhuiyuankaPCxx',
'api_url' => 'member/account/commission',
'router_path' => 'member/commission',
'view_path' => 'member/commission',
@ -755,7 +755,7 @@ return [
'menu_key' => 'site_account_list',
'menu_short_name' => '财务流水',
'menu_type' => '1',
'icon' => 'element Postcard',
'icon' => 'iconfont iconqianbaoPCxx',
'api_url' => 'finance/account',
'router_path' => 'finance/account',
'view_path' => 'finance/account',
@ -783,7 +783,7 @@ return [
'menu_key' => 'cash_out_list',
'menu_short_name' => '会员提现',
'menu_type' => '1',
'icon' => 'element Postcard',
'icon' => 'iconfont icontixianPCxx',
'api_url' => 'member/cash_out',
'router_path' => 'finance/cash_out',
'view_path' => 'finance/cash_out',
@ -827,7 +827,7 @@ return [
'menu_key' => 'member_refund_list',
'menu_short_name' => '会员退款',
'menu_type' => '1',
'icon' => 'iconfont iconhuiyuantixian',
'icon' => 'iconfont icontuikuanPCxx',
'api_url' => 'pay/refund',
'router_path' => 'finance/refund',
'view_path' => 'finance/pay_refund',
@ -1098,7 +1098,7 @@ return [
'menu_key' => 'addon_list',
'menu_short_name' => '应用列表',
'menu_type' => '1',
'icon' => 'iconfont iconmanage-apply',
'icon' => 'iconfont iconyingyongliebiaoPCxx',
'api_url' => 'addon/list',
'router_path' => 'app/index',
'view_path' => 'app/index',
@ -1159,7 +1159,7 @@ return [
'menu_key' => 'h5_config',
'menu_short_name' => 'H5端',
'menu_type' => '1',
'icon' => 'iconfont iconh5e',
'icon' => 'iconfont iconweixinPCxx-1',
'api_url' => 'channel/h5/config',
'router_path' => 'channel/h5/config',
'view_path' => 'channel/h5/config',
@ -1189,7 +1189,7 @@ return [
'menu_key' => 'channel_wechat',
'menu_short_name' => '微信公众号',
'menu_type' => '1',
'icon' => 'iconfont iconweixingongzhonghao1',
'icon' => 'iconfont iconweixinPCxx',
'api_url' => '',
'router_path' => 'channel/wechat',
'view_path' => 'channel/wechat/access',
@ -1203,7 +1203,7 @@ return [
'menu_key' => 'weapp_access',
'menu_short_name' => '微信小程序',
'menu_type' => '1',
'icon' => 'iconfont iconxiaochengxushezhi',
'icon' => 'iconfont iconweixinPCxx-2',
'api_url' => 'weapp/access',
'router_path' => 'channel/weapp',
'view_path' => 'channel/weapp/access',
@ -1217,7 +1217,7 @@ return [
'menu_key' => 'aliapp_weapp_access',
'menu_short_name' => '支付宝小程序',
'menu_type' => '1',
'icon' => 'iconfont iconzhifubao',
'icon' => 'iconfont iconzhifubaoPCxx',
'api_url' => 'aliapp/access',
'router_path' => 'channel/aliapp',
'view_path' => 'channel/aliapp/access',
@ -1585,7 +1585,7 @@ return [
'menu_key' => 'channel_app',
'menu_short_name' => 'App端',
'menu_type' => '1',
'icon' => '',
'icon' => 'iconfont iconAPPPCxx',
'api_url' => '',
'router_path' => 'channel/app',
'view_path' => 'channel/app/access',
@ -1660,7 +1660,7 @@ return [
'menu_key' => 'auth_list',
'menu_short_name' => '管理员',
'menu_type' => '1',
'icon' => 'element Lock',
'icon' => 'iconfont iconkehubiaoqianPCxx',
'api_url' => 'site/user',
'router_path' => 'auth/user',
'view_path' => 'auth/user',
@ -1774,7 +1774,7 @@ return [
'menu_key' => 'auth_role',
'menu_short_name' => '管理员角色',
'menu_type' => '1',
'icon' => 'iconfont iconhuiyuanliebiao',
'icon' => 'iconfont iconwodePCxx',
'api_url' => 'sys/role',
'router_path' => 'setting/auth/role',
'view_path' => 'auth/role',
@ -1832,7 +1832,7 @@ return [
'menu_key' => 'auth_log',
'menu_short_name' => '操作日志',
'menu_type' => '1',
'icon' => 'element Document',
'icon' => 'iconfont iconcaozuoyuanPCxx',
'api_url' => 'sys/log',
'router_path' => 'setting/auth/log',
'view_path' => 'auth/log',
@ -1863,7 +1863,7 @@ return [
'menu_key' => 'setting_system',
'menu_short_name' => '网站设置',
'menu_type' => '0',
'icon' => 'element Basketball',
'icon' => 'iconfont iconwangzhanshezhiPCxx',
'api_url' => '',
'router_path' => 'setting/system',
'view_path' => '',
@ -1969,7 +1969,7 @@ return [
'menu_key' => 'setting_member',
'menu_short_name' => '会员设置',
'menu_type' => '0',
'icon' => 'iconfont iconjiaoseyonghu',
'icon' => 'iconfont iconshezhiPCxx',
'api_url' => '',
'router_path' => 'setting/member',
'view_path' => '',
@ -1983,7 +1983,7 @@ return [
'menu_key' => 'setting_member_config',
'menu_short_name' => '会员设置',
'menu_type' => '1',
'icon' => 'iconfont iconjiaoseyonghu',
'icon' => 'iconfont iconshezhiPCxx',
'api_url' => 'member/config/member',
'router_path' => 'setting/member',
'view_path' => 'setting/member',
@ -2045,7 +2045,7 @@ return [
'menu_key' => 'setting_pay',
'menu_short_name' => '支付管理',
'menu_type' => '1',
'icon' => 'element Wallet',
'icon' => 'iconfont iconzhifuPCxx',
'api_url' => '',
'router_path' => 'setting/pay/channel',
'view_path' => '',
@ -2166,7 +2166,7 @@ return [
'menu_key' => 'setting_notice',
'menu_short_name' => '消息管理',
'menu_type' => '1',
'icon' => 'element ChatLineSquare',
'icon' => 'iconfont iconxiaoxitongzhi-lingdangPCxx',
'api_url' => '',
'router_path' => 'setting/notice/template',
'view_path' => '',
@ -2254,7 +2254,7 @@ return [
'menu_key' => 'sms_notice',
'menu_short_name' => '短信管理',
'menu_type' => '0',
'icon' => 'element Message',
'icon' => 'iconfont iconxiaoxiguanliPCxx',
'api_url' => '',
'router_path' => 'setting/sms/setting',
'view_path' => '',
@ -2373,7 +2373,7 @@ return [
'menu_key' => 'setting_tool',
'menu_short_name' => '系统工具',
'menu_type' => '0',
'icon' => 'element FolderChecked',
'icon' => 'iconfont iconwenjianjiaPCxx',
'api_url' => '',
'router_path' => 'setting/agreement',
'view_path' => '',
@ -2600,6 +2600,162 @@ return [
],
]
],
[
'menu_name' => '开放账号',
'menu_key' => 'openapi_app',
'menu_short_name' => '账号',
'menu_type' => '1',
'icon' => 'element Key',
'api_url' => 'openapi/app/pages',
'router_path' => 'openapi/list',
'view_path' => 'openapi/list',
'methods' => 'get',
'sort' => '19',
'status' => '1',
'is_show' => '1',
'children' => [
[
'menu_name' => '创建开放账号',
'menu_key' => 'openapi_app_add',
'menu_short_name' => '创建账号',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/app',
'router_path' => '',
'view_path' => '',
'methods' => 'post',
'sort' => '100',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '编辑开放账号',
'menu_key' => 'openapi_app_edit',
'menu_short_name' => '编辑账号',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/app/<id>',
'router_path' => '',
'view_path' => '',
'methods' => 'put',
'sort' => '99',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '开放账号启停',
'menu_key' => 'openapi_app_status',
'menu_short_name' => '账号启停',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/app/status/<id>',
'router_path' => '',
'view_path' => '',
'methods' => 'put',
'sort' => '98',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '重置密钥',
'menu_key' => 'openapi_app_reset_secret',
'menu_short_name' => '重置密钥',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/app/reset-secret/<id>',
'router_path' => '',
'view_path' => '',
'methods' => 'put',
'sort' => '97',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '批量重置密钥',
'menu_key' => 'openapi_app_batch_reset_secret',
'menu_short_name' => '批量重置密钥',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/app/batch/reset-secret',
'router_path' => '',
'view_path' => '',
'methods' => 'put',
'sort' => '96',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '删除开放账号',
'menu_key' => 'openapi_app_delete',
'menu_short_name' => '删除账号',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/app/<id>',
'router_path' => '',
'view_path' => '',
'methods' => 'delete',
'sort' => '96',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '开放接口清单',
'menu_key' => 'openapi_app_api_tree',
'menu_short_name' => '接口清单',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/app/api-tree',
'router_path' => '',
'view_path' => '',
'methods' => 'get',
'sort' => '95',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '查看开放平台设置',
'menu_key' => 'openapi_config_get',
'menu_short_name' => '开放设置',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/config',
'router_path' => '',
'view_path' => '',
'methods' => 'get',
'sort' => '94',
'status' => '1',
'is_show' => '0',
],
[
'menu_name' => '保存开放平台设置',
'menu_key' => 'openapi_config_set',
'menu_short_name' => '保存开放设置',
'menu_type' => '2',
'icon' => '',
'api_url' => 'openapi/config',
'router_path' => '',
'view_path' => '',
'methods' => 'post',
'sort' => '93',
'status' => '1',
'is_show' => '0',
],
],
],
[
'menu_name' => '调用日志',
'menu_key' => 'openapi_log',
'menu_short_name' => '日志',
'menu_type' => '1',
'icon' => 'element List',
'api_url' => 'openapi/log/pages',
'router_path' => 'openapi/log',
'view_path' => 'openapi/log',
'methods' => 'get',
'sort' => '18',
'status' => '1',
'is_show' => '0',
],
],
],
@ -2918,5 +3074,5 @@ return [
'is_show' => '0',
],
]
],
]
];

View File

@ -0,0 +1,87 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
use app\dict\sys\AppTypeDict;
/**
* 开放平台 - 平台端(admin)接口清单
*
* 这里维护 app_type = admin 的开放接口,只有平台级开放账号(归属站点为平台)可调用。
* 店铺端接口见同目录 site.php;两份清单由 core\dict\OpenApi 一起加载,
* 同名分组会自动合并 items,因此跨文件的分组元数据需保持一致。
*
* 新增一个开放接口 = 在下方追加一条配置 + 在对应控制器实现方法。
*
* 条目字段说明:
* - name 接口名称
* - desc 接口说明
* - app_type 端归属(admin 平台端 / site 站点端),与开放账号身份匹配
* - domain 所属模块(授权单位,与分组 key 对应),勾选模块即拥有模块下全部接口权限
* - method HTTP 方法
* - path 路由路径(不含 openapi 应用前缀)
* - handler 控制器方法,格式:类名@方法名
* - need_auth 是否需要令牌鉴权,默认 true
* - params 参数元数据(用于接口说明)
*/
return [
'auth' => [
'group_name' => '授权',
'app_type' => AppTypeDict::SITE,
'domain' => 'auth',
'items' => [
// 平台端获取令牌:与店铺端为同一个接口(v1/auth/token),此处单独登记一条,仅用于平台端文档展示
'auth.token_admin' => [
'name' => '获取访问令牌',
'desc' => '使用 Access Key / Secret Key 换取访问令牌,后续接口调用需携带该令牌(平台端)',
'app_type' => AppTypeDict::ADMIN,
'method' => 'post',
'path' => 'v1/auth/token',
'handler' => '\app\openapi\controller\v1\Auth@token',
'need_auth' => false,
'params' => [
'app_key' => [ 'name' => 'Access Key', 'type' => 'string', 'required' => true ],
'app_secret' => [ 'name' => 'Secret Key', 'type' => 'string', 'required' => true ],
],
],
],
],
'site' => [
'group_name' => '站点',
'app_type' => AppTypeDict::ADMIN,
'domain' => 'site',
'items' => [
'site.list' => [
'name' => '站点列表',
'desc' => '分页查询平台下的站点列表,可按站点名称、状态筛选',
'method' => 'get',
'path' => 'v1/platform/site/list',
'handler' => '\app\openapi\controller\v1\PlatformSite@pages',
'params' => [
'site_name' => [ 'name' => '站点名称', 'type' => 'string', 'required' => false ],
'status' => [ 'name' => '站点状态 1正常 2过期 3停止', 'type' => 'int', 'required' => false ],
'page' => [ 'name' => '页码', 'type' => 'int', 'required' => false ],
'limit' => [ 'name' => '每页条数(1-120)', 'type' => 'int', 'required' => false ],
],
],
'site.status' => [
'name' => '启用/关闭站点',
'desc' => '启用或关闭指定站点:status 1 启用、3 关闭',
'method' => 'put',
'path' => 'v1/platform/site/status',
'handler' => '\app\openapi\controller\v1\PlatformSite@setStatus',
'params' => [
'site_id' => [ 'name' => '站点id', 'type' => 'int', 'required' => true ],
'status' => [ 'name' => '状态 1启用 3关闭', 'type' => 'int', 'required' => true ],
],
],
],
],
];

View File

@ -0,0 +1,69 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
use app\dict\sys\AppTypeDict;
/**
* 开放平台 - 店铺端(site)接口清单
*
* 这里维护 app_type = site 的开放接口,店铺账号(归属站点为具体店铺)调用。
* 平台端接口见同目录 admin.php;两份清单由 core\dict\OpenApi 一起加载,
* 同名分组会自动合并 items,因此跨文件的分组元数据需保持一致。
*
* 新增一个开放接口 = 在下方追加一条配置 + 在对应控制器实现方法。
*
* 条目字段说明:
* - name 接口名称
* - desc 接口说明
* - app_type 端归属(admin 平台端 / site 站点端),与开放账号身份匹配
* - domain 所属模块(授权单位,与分组 key 对应),勾选模块即拥有模块下全部接口权限
* - method HTTP 方法
* - path 路由路径(不含 openapi 应用前缀)
* - handler 控制器方法,格式:类名@方法名
* - need_auth 是否需要令牌鉴权,默认 true
* - params 参数元数据(用于接口说明)
*/
return [
'auth' => [
'group_name' => '授权',
'app_type' => AppTypeDict::SITE,
'domain' => 'auth',
'items' => [
'auth.token' => [
'name' => '获取访问令牌',
'desc' => '使用 Access Key / Secret Key 换取访问令牌,后续接口调用需携带该令牌',
'method' => 'post',
'path' => 'v1/auth/token',
'handler' => '\app\openapi\controller\v1\Auth@token',
'need_auth' => false,
'params' => [
'app_key' => [ 'name' => 'Access Key', 'type' => 'string', 'required' => true ],
'app_secret' => [ 'name' => 'Secret Key', 'type' => 'string', 'required' => true ],
],
],
],
],
'common' => [
'group_name' => '公共',
'app_type' => AppTypeDict::SITE,
'domain' => 'common',
'items' => [
'common.site_info' => [
'name' => '获取站点信息',
'desc' => '获取当前开放账号所属站点的基本信息',
'method' => 'get',
'path' => 'v1/site/info',
'handler' => '\app\openapi\controller\v1\Site@info',
'params' => [],
],
],
],
];

View File

@ -220,6 +220,11 @@ class CheckSceneDict
'name' => '源码目录', 'desc' => '确认编译所需源码目录存在', 'required' => 1,
'suggest' => '重新下载或上传完整源码包,确认 admin、web、uni-app 目录均存在且未缺失文件'
],
[
'key' => 'front_depend', 'handler' => 'frontDepend',
'name' => '前端依赖完整性', 'desc' => '检查前端源码引用的 npm 依赖是否已在对应 package.json 中声明', 'required' => 1,
'suggest' => '把缺失的依赖补到对应端 package.json 的 dependencies 中,并在 admin / uni-app / web 目录执行 npm install 后再编译;请勿用本地 vendor 文件改写源码 import'
],
[
'key' => 'dir_permission', 'handler' => 'buildDirPermission',
'name' => '目录读写权限', 'desc' => '检查编译相关目录的读写权限', 'required' => 1,

View File

@ -45,4 +45,8 @@ class ConfigKeyDict
public const RELAY_ORDER_CONFIG = 'RELAY_ORDER_CONFIG';//接龙订单配置
public const APP = 'app';
public const OPENAPI = 'OPENAPI';//开放平台(平台级总开关)
public const OPENAPI_SECRET = 'OPENAPI_SECRET';//开放平台数据加密密钥(用于加密开放账号 Secret Key)
}

View File

@ -0,0 +1,276 @@
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址:https://www.niucloud.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace app\dict\sys;
/**
* 框架前端 npm 依赖基准(admin / wap / web 三端)
*
* 为什么需要它:
* 站点的 admin/package.json 等文件是「站点自己的」——升级包/补丁包如果只覆盖前端源码而不带
* package.json,站点就会出现「源码 import 了某包、package.json 里却没有声明」的混合态,
* 表现为云编译时 npm install 成功但 npm run build 报
* `Rollup failed to resolve import "xxx"`(线上真实案例:v-code-diff)。
*
* 现有依赖合并只处理插件(CoreDependService::installDepend 读插件的 admin-package.json、
* UpgradeService::installDepend 遍历的是已安装插件),框架自身新增的依赖没有任何路径补进老站点,
* 因此这里维护一份框架自身的依赖基准,供两条链路共用:
* 1. 升级 / 框架补丁应用后,把「站点缺失的框架依赖」补进站点 package.json(CoreDependService::mergeFrameworkDepend);
* 2. 云编译前校验与打包前的硬校验,比对源码裸依赖与站点 package.json(NpmDependScanner)。
*
* ★ 维护约定:框架的 admin/uni-app/web 三个 package.json 有变更(新增依赖、关键版本变动)时,
* 必须同步本字典——否则上面两条链路都会漏掉本次新增的依赖。
* 本字典只用于「补齐站点缺失的键」,不会覆盖站点已有版本(站点允许自定义或手工降级)。
*
* 版本号与框架 package.json 逐字保持一致,便于人工比对。
*/
class FrameworkNpmDependDict
{
/** admin 端 */
const PORT_ADMIN = 'admin';
/** 手机端(uni-app)——与 CoreDependService 的 npm 类型命名保持一致 */
const PORT_WAP = 'wap';
/** web 端 */
const PORT_WEB = 'web';
/**
* 端口配置:npm 类型 => [名称、package.json 相对路径、源码目录(可多个)、跳过的子目录、需忽略的标识符]
*
* 路径均相对站点根目录(admin / uni-app / web 与 niucloud 同级)。
* 三个端都声明了源码目录,云编译前校验与打包前硬校验据此扫描裸依赖。
*
* ★ 只扫「运行时源码」,不扫构建配置文件:
* 例如 web 的 nuxt.config.ts / windi.config.ts 会 import vite、windicss 这类
* 由 nuxt 传递依赖提供的包,扫进来会误报(误报会挡住正常编译),故按目录白名单扫描;
* admin / uni-app 的 addon 目录也排除——插件依赖由 admin-package.json 合并进
* 站点 package.json(升级 / 安装时),不属于框架依赖基准的职责。
* @return array
*/
public static function getPortConfig(): array
{
return [
self::PORT_ADMIN => [
'name' => 'admin 端',
'package' => 'admin' . DIRECTORY_SEPARATOR . 'package.json',
'src' => [ 'admin' . DIRECTORY_SEPARATOR . 'src' ],
'exclude_dirs' => [ 'addon', 'node_modules', 'dist', '.build', '.core', '.addons', '.shared', '.vite' ],
// vite alias 名(admin/vite.config*.ts 的 resolve.alias),看着像包名但不是 npm 包
'ignore' => [ 'assets' ]
],
self::PORT_WAP => [
'name' => 'uni-app 端',
'package' => 'uni-app' . DIRECTORY_SEPARATOR . 'package.json',
'src' => [ 'uni-app' . DIRECTORY_SEPARATOR . 'src' ],
'exclude_dirs' => [ 'addon', 'node_modules', 'dist', 'unpackage', '.build', '.hbuilderx', '.vite' ],
'ignore' => []
],
self::PORT_WEB => [
'name' => 'web 端',
'package' => 'web' . DIRECTORY_SEPARATOR . 'package.json',
'src' => [
'web' . DIRECTORY_SEPARATOR . 'app',
'web' . DIRECTORY_SEPARATOR . 'components',
'web' . DIRECTORY_SEPARATOR . 'composables',
'web' . DIRECTORY_SEPARATOR . 'lang',
'web' . DIRECTORY_SEPARATOR . 'layouts',
'web' . DIRECTORY_SEPARATOR . 'middleware',
'web' . DIRECTORY_SEPARATOR . 'plugins',
'web' . DIRECTORY_SEPARATOR . 'stores',
'web' . DIRECTORY_SEPARATOR . 'types',
'web' . DIRECTORY_SEPARATOR . 'utils',
'web' . DIRECTORY_SEPARATOR . 'app.vue'
],
'exclude_dirs' => [ 'addon', 'node_modules', 'dist', '.output', '.nuxt', '.git', '.vite' ],
// Nuxt 运行时与 @element-plus/nuxt 模块传递提供的包:官方 web/package.json 本就不声明,
// 提示补进 package.json 反而是错的(会与 nuxt 自身版本冲突)
'ignore' => [ 'vue', 'vue-router', '@element-plus/icons-vue' ]
]
];
}
/**
* 某端口需要跳过的源码子目录(含框架目录清单,供扫描器合并使用)
* @param string $port
* @return array
*/
public static function getExcludeDirs(string $port): array
{
return self::getPortConfig()[ $port ][ 'exclude_dirs' ] ?? [];
}
/**
* 端口显示名(校验文案用)
* @param string $port
* @return string
*/
public static function getPortName(string $port): string
{
return self::getPortConfig()[ $port ][ 'name' ] ?? $port;
}
/**
* 框架依赖基准
*
* @param string $port 端口(admin / wap / web)
* @return array ['dependencies' => [包名 => 版本], 'devDependencies' => [包名 => 版本]]
*/
public static function getDepend(string $port): array
{
return self::getDependList()[ $port ] ?? [ 'dependencies' => [], 'devDependencies' => [] ];
}
/**
* 全部端口的依赖基准
* @return array
*/
public static function getDependList(): array
{
return [
// ==================== admin 端 ====================
// 对应 admin/package.json
self::PORT_ADMIN => [
'dependencies' => [
'@element-plus/icons-vue' => '2.0.10',
'@fullcalendar/core' => '^6.1.19',
'@fullcalendar/daygrid' => '^6.1.19',
'@fullcalendar/interaction' => '^6.1.19',
'@fullcalendar/vue3' => '^6.1.19',
'@heroicons/vue' => '^2.2.0',
'@highlightjs/vue-plugin' => '2.1.0',
'@types/lodash-es' => '4.17.6',
'@vueuse/core' => '9.12.0',
'axios' => '1.4.0',
'crypto-js' => '4.1.1',
'css-color-function' => '1.3.3',
'date-fns' => '^4.1.0',
'day' => '^0.0.2',
'echarts' => '5.4.1',
'element-plus' => '^2.7.4',
'esbuild' => '^0.16.17',
'highlight.js' => '11.0.1',
'lodash-es' => '4.17.21',
'nprogress' => '0.2.0',
'pinia' => '2.0.30',
'qrcode' => '1.5.1',
'sass' => '1.58.0',
'sortablejs' => '1.15.0',
'v-code-diff' => '^1.16.0',
'vditor' => '^3.10.9',
'vue' => '3.2.45',
'vue-i18n' => '9.2.2',
'vue-jsonp' => '2.0.0',
'vue-router' => '4.1.6',
'vue-ueditor-wrap' => '^3.0.8',
'vue-web-terminal' => '3.2.2',
'vue3-video-play' => '1.3.1-beta.6'
],
'devDependencies' => [
'@tailwindcss/line-clamp' => '4.0.2',
'@types/qrcode' => '1.5.0',
'@types/sortablejs' => '1.15.0',
'@typescript-eslint/eslint-plugin' => '5.53.0',
'@vitejs/plugin-vue' => '4.0.0',
'autoprefixer' => '10.4.13',
'cross-env' => '^7.0.3',
'eslint' => '8.34.0',
'eslint-config-standard-with-typescript' => '34.0.0',
'eslint-plugin-import' => '2.27.5',
'eslint-plugin-n' => '15.6.1',
'eslint-plugin-promise' => '6.1.1',
'eslint-plugin-vue' => '9.9.0',
'postcss' => '8.4.21',
'tailwindcss' => '3.2.4',
'typescript' => '4.9.5',
'unplugin-auto-import' => '0.13.0',
'unplugin-vue-components' => '0.23.0',
'vite' => '4.1.0',
'vue-tsc' => '1.0.24'
]
],
// ==================== uni-app 端 ====================
// 对应 uni-app/package.json
self::PORT_WAP => [
'dependencies' => [
'@dcloudio/uni-app' => '3.0.0-3080720230703001',
'@dcloudio/uni-app-plus' => '3.0.0-3080720230703001',
'@dcloudio/uni-components' => '3.0.0-3080720230703001',
'@dcloudio/uni-h5' => '3.0.0-3080720230703001',
'@dcloudio/uni-mp-alipay' => '3.0.0-3080720230703001',
'@dcloudio/uni-mp-baidu' => '3.0.0-3080720230703001',
'@dcloudio/uni-mp-jd' => '3.0.0-3080720230703001',
'@dcloudio/uni-mp-kuaishou' => '3.0.0-3080720230703001',
'@dcloudio/uni-mp-lark' => '3.0.0-3080720230703001',
'@dcloudio/uni-mp-qq' => '3.0.0-3080720230703001',
'@dcloudio/uni-mp-toutiao' => '3.0.0-3080720230703001',
'@dcloudio/uni-mp-weixin' => '3.0.0-3080720230703001',
'@dcloudio/uni-quickapp-webview' => '3.0.0-3080720230703001',
'@uni-helper/vite-plugin-uni-layouts' => '^0.1.11',
'html2canvas' => '^1.4.1',
'image-tools' => '^1.4.0',
'lodash-es' => '^4.17.21',
'pinia' => '2.0.36',
'qrcode' => '^1.5.1',
'qs' => '6.7.0',
'sortablejs' => '^1.15.0',
'uview-plus' => '^3.1.29',
'vue' => '^3.3.0',
'vue-i18n' => '^9.2.2',
'weixin-js-sdk' => '^1.6.5'
],
'devDependencies' => [
'@dcasia/mini-program-tailwind-webpack-plugin' => '^1.5.6',
'@dcloudio/types' => '^3.3.2',
'@dcloudio/uni-automator' => '3.0.0-3080720230703001',
'@dcloudio/uni-cli-shared' => '3.0.0-3080720230703001',
'@dcloudio/uni-stacktracey' => '3.0.0-3080720230703001',
'@dcloudio/vite-plugin-uni' => '3.0.0-3080720230703001',
'@rollup/plugin-commonjs' => '^24.0.1',
'@types/qrcode' => '^1.5.0',
'@types/sortablejs' => '^1.15.0',
'@vue/tsconfig' => '^0.1.3',
'sass' => '^1.54.5',
'sass-loader' => '10.4.1',
'typescript' => '^4.9.4',
'vite' => '4.0.4',
'vite-plugin-windicss' => '^1.8.10',
'vue-tsc' => '^1.0.24',
'windicss' => '^3.5.6',
'cross-env' => '^7.0.3'
]
],
// ==================== web 端 ====================
// 对应 web/package.json
self::PORT_WEB => [
'dependencies' => [
'@vueuse/core' => '^9.13.0',
'element-plus' => '^2.3.2',
'pinia' => '^2.0.33',
'qrcode' => '^1.5.1',
'sass' => '^1.60.0'
],
'devDependencies' => [
'@element-plus/nuxt' => '^1.0.4',
'@types/qrcode' => '^1.5.0',
'nuxt' => '^3.4.1',
'nuxt-windicss' => '^2.6.0',
'sass' => '^1.60.0',
'vue-i18n' => '^9.2.2',
'vite-plugin-top-level-await' => '^1.3.1',
'qs' => '6.7.0'
]
]
];
}
}

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