提交 b1eaba63 作者: 方治民

合并分支 'main' 到 'main'

Main

查看合并请求 hntq/zjtq-v5!1
# API 接口地址 # API 接口地址
VITE_GLOB_API_URL=http://192.168.0.156:17181 VITE_GLOB_API_URL=http://192.168.0.156:8081
# API 接口地址前缀 # API 接口地址前缀
VITE_GLOB_API_URL_PREFIX=/api VITE_GLOB_API_URL_PREFIX=/api
...@@ -10,7 +10,12 @@ module.exports = { ...@@ -10,7 +10,12 @@ module.exports = {
jsx: true, jsx: true,
}, },
}, },
extends: ['plugin:vue/vue3-recommended', 'plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'], extends: [
'@antfu',
'plugin:vue/vue3-recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
rules: { rules: {
'vue/script-setup-uses-vars': 'error', 'vue/script-setup-uses-vars': 'error',
'@typescript-eslint/ban-ts-ignore': 'off', '@typescript-eslint/ban-ts-ignore': 'off',
...@@ -62,5 +67,6 @@ module.exports = { ...@@ -62,5 +67,6 @@ module.exports = {
}, },
], ],
'vue/multi-word-component-names': 'off', 'vue/multi-word-component-names': 'off',
'no-console': 'off',
}, },
} }
...@@ -33,3 +33,5 @@ pnpm-debug.log* ...@@ -33,3 +33,5 @@ pnpm-debug.log*
.mocks/ .mocks/
.pnpm-debug.log .pnpm-debug.log
unpackage/release
{
"recommendations": [
"vue.volar",
"dbaeumer.vscode-eslint",
"stylelint.vscode-stylelint",
"DavidAnson.vscode-markdownlint",
"esbenp.prettier-vscode",
"EditorConfig.EditorConfig",
"antfu.unocss",
"antfu.iconify",
"lokalise.i18n-ally",
"mrmlnc.vscode-less",
"aaron-bond.better-comments",
"shardulm94.trailing-spaces",
"formulahendry.auto-close-tag",
"formulahendry.auto-rename-tag",
"vincaslt.highlight-matching-tag",
"ChakrounAnas.turbo-console-log",
"mikestead.dotenv",
"redhat.vscode-yaml",
"eamodio.gitlens",
"christian-kohler.path-intellisense",
"IBM.output-colorizer",
"PKief.material-icon-theme"
]
}
{ {
"typescript.tsdk": "./node_modules/typescript/lib",
"npm.packageManager": "pnpm", "npm.packageManager": "pnpm",
"editor.tabSize": 4,
"files.eol": "\n",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"i18n-ally.localesPaths": ["src/locales/lang"], "i18n-ally.localesPaths": ["src/locales/lang"],
"i18n-ally.keystyle": "nested", "i18n-ally.keystyle": "nested",
"i18n-ally.readonly": true, "i18n-ally.readonly": true,
...@@ -9,5 +15,97 @@ ...@@ -9,5 +15,97 @@
"i18n-ally.enabledParsers": ["ts", "json"], "i18n-ally.enabledParsers": ["ts", "json"],
"i18n-ally.sourceLanguage": "en", "i18n-ally.sourceLanguage": "en",
"i18n-ally.displayLanguage": "zh-Hans", "i18n-ally.displayLanguage": "zh-Hans",
"i18n-ally.enabledFrameworks": ["vue", "react"] "i18n-ally.enabledFrameworks": ["vue", "react"],
"stylelint.enable": true,
"stylelint.validate": ["css", "less", "postcss", "scss", "vue", "sass"],
"path-intellisense.mappings": {
"/@/": "${workspaceRoot}/src"
},
"[javascriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[css]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[less]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[scss]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"[vue]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.stylelint": true
}
},
"search.exclude": {
"**/node_modules": true,
"**/*.log": true,
"**/*.log*": true,
"**/bower_components": true,
"**/dist": true,
"**/elehukouben": true,
"**/.git": true,
"**/.gitignore": true,
"**/.svn": true,
"**/.DS_Store": true,
"**/.idea": true,
"**/.vscode": false,
"**/yarn.lock": true,
"**/tmp": true,
"out": true,
"dist": true,
"node_modules": true,
"CHANGELOG.md": true,
"examples": true,
"res": true,
"screenshots": true,
"yarn-error.log": true,
"**/.yarn": true,
"**/.pnpm": true
},
"files.exclude": {
"**/.cache": true,
"**/.editorconfig": true,
"**/.eslintcache": true,
"**/bower_components": true,
"**/.idea": true,
"**/tmp": true,
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true
},
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/.vscode/**": true,
"**/node_modules/**": true,
"**/tmp/**": true,
"**/bower_components/**": true,
"**/dist/**": true,
"**/yarn.lock": true,
"**/pnpm-lock.yaml": true
}
} }
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
- [x] 集成 [Stomp WebSocket](https://github.com/jmesnil/stomp-websocket) - [x] 集成 [Stomp WebSocket](https://github.com/jmesnil/stomp-websocket)
- [x] 集成 [Pont](https://github.com/alibaba/pont) - [x] 集成 [Pont](https://github.com/alibaba/pont)
- [x] 集成 [Pinia](https://pinia.vuejs.org/) - [x] 集成 [Pinia](https://pinia.vuejs.org/)
- [x] 集成 [vue-i18n](https://github.com/intlify/vue-i18n-next) - [x] 集成 [Vue-i18n](https://github.com/intlify/vue-i18n-next)
- [x] 集成 [UnoCSS](https://github.com/antfu/unocss)
- [x] UI 组件集成 [FirstUI](https://gitlab.yiring.com/open/first-ui), [uni-ui](https://uniapp.dcloud.net.cn/component/uniui/quickstart.html) - [x] UI 组件集成 [FirstUI](https://gitlab.yiring.com/open/first-ui), [uni-ui](https://uniapp.dcloud.net.cn/component/uniui/quickstart.html)
- [x] 接入 [消息推送](https://uniapp.dcloud.net.cn/unipush.html) - [x] 接入 [消息推送](https://uniapp.dcloud.net.cn/unipush.html)
- [x] 接入 [APP 升级中心](https://uniapp.dcloud.net.cn/uniCloud/upgrade-center.html) - [x] 接入 [APP 升级中心](https://uniapp.dcloud.net.cn/uniCloud/upgrade-center.html)
......
import fs from 'fs' import fs from 'node:fs'
import path from 'path' import path from 'node:path'
import dotenv from 'dotenv' import dotenv from 'dotenv'
export function isDevFn(mode: string): boolean { export function isDevFn(mode: string): boolean {
...@@ -40,7 +40,7 @@ export function wrapperEnv(envConf: Recordable): ViteEnv { ...@@ -40,7 +40,7 @@ export function wrapperEnv(envConf: Recordable): ViteEnv {
*/ */
function getConfFiles() { function getConfFiles() {
const script = process.env.npm_lifecycle_script const script = process.env.npm_lifecycle_script
const reg = new RegExp('--mode ([a-z_\\d]+)') const reg = /--mode ([a-z_\d]+)/
const result = reg.exec(script as string) as any const result = reg.exec(script as string) as any
if (result) { if (result) {
const mode = result[1] as string const mode = result[1] as string
......
import type { Plugin } from 'vite'
// https://github.com/ErKeLost/unplugin-imagemin
import imagemin from 'unplugin-imagemin/vite'
export function configImageminPlugin(): Plugin {
return imagemin({
// https://github.com/ErKeLost/unplugin-imagemin#warning
// mode: 'sharp',
cache: true,
})
}
import type { Plugin } from 'vite' import type { Plugin } from 'vite'
import colors from 'picocolors' import colors from 'picocolors'
import pkg from '../../package.json'
import { configUniPlugin } from './uni' import { configUniPlugin } from './uni'
import { configImportPlugin } from './unplugin' import { configImportPlugin } from './unplugin'
import pkg from '../../package.json' import { configUnocssPlugin } from './unocss'
export function createVitePlugins(viteEnv: ViteEnv) { export function createVitePlugins(viteEnv: ViteEnv) {
const { VITE_GLOB_APP_NAME, VITE_GLOB_APP_DESCRIPTION, VITE_GLOB_API_URL, VITE_GLOB_API_URL_PREFIX } = viteEnv const { VITE_GLOB_APP_NAME, VITE_GLOB_APP_DESCRIPTION, VITE_GLOB_API_URL, VITE_GLOB_API_URL_PREFIX } = viteEnv
...@@ -18,10 +19,16 @@ export function createVitePlugins(viteEnv: ViteEnv) { ...@@ -18,10 +19,16 @@ export function createVitePlugins(viteEnv: ViteEnv) {
// plugins // plugins
const vitePlugins: (Plugin | Plugin[])[] = [] const vitePlugins: (Plugin | Plugin[])[] = []
// unocss
vitePlugins.push(configUnocssPlugin())
// unplugin-auto-import // unplugin-auto-import
// unplugin-vue-components // unplugin-vue-components
vitePlugins.push(configImportPlugin()) vitePlugins.push(configImportPlugin())
// unplugin-imagemin
// vitePlugins.push(configImageminPlugin())
// uni-app // uni-app
vitePlugins.push(configUniPlugin()) vitePlugins.push(configUniPlugin())
......
import type { Plugin } from 'vite'
// https://github.com/antfu/unocss
import Unocss from 'unocss/vite'
import { presetIcons } from 'unocss'
export function configUnocssPlugin(): Plugin[] {
return Unocss({
presets: [
presetIcons({
prefix: 'icon-',
extraProperties: {
display: 'inline-flex',
},
}),
],
})
}
import path from 'node:path'
import type { Plugin } from 'vite' import type { Plugin } from 'vite'
import path from 'path'
// https://github.com/antfu/unplugin-auto-import // https://github.com/antfu/unplugin-auto-import
import AutoImport from 'unplugin-auto-import/vite' import AutoImport from 'unplugin-auto-import/vite'
...@@ -39,7 +39,7 @@ export function configComponentsImportPlugin(): Plugin { ...@@ -39,7 +39,7 @@ export function configComponentsImportPlugin(): Plugin {
(name: string) => { (name: string) => {
// FIX: 修复 easycom 在 APP 下不生效问题(原因不明 // FIX: 修复 easycom 在 APP 下不生效问题(原因不明
if (name.startsWith('fui-')) { if (name.startsWith('fui-')) {
return path.resolve(__dirname, `src/components/firstui/${name}/${name}.vue`).replaceAll('\\', '/') return path.resolve(__dirname, `src/components/FirstUI/${name}/${name}.vue`).replaceAll('\\', '/')
} }
// if (name.startsWith('uni-')) { // if (name.startsWith('uni-')) {
// return `@dcloudio/uni-ui/lib/${name}/${name}.vue` // return `@dcloudio/uni-ui/lib/${name}/${name}.vue`
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
- ⭐TODO Highlight - ⭐TODO Highlight
- ⭐Volar (Vue3 + TS 开发首选) - ⭐Volar (Vue3 + TS 开发首选)
-[Pont-engine](https://marketplace.visualstudio.com/items?itemName=jasonHzq.vscode-pont) 接口自动化工具,**必装** -[Pont-engine](https://marketplace.visualstudio.com/items?itemName=jasonHzq.vscode-pont) 接口自动化工具,**必装**
- ⭐UnoCSS
- ESLint - ESLint
- stylelint - stylelint
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<!-- prettier-ignore --> <!-- prettier-ignore -->
- [Vue v3.x](https://v3.vuejs.org/guide/introduction.html) - [Vue v3.x](https://v3.vuejs.org/guide/introduction.html)
- [uni-app@vue3 v3.x](https://uniapp.dcloud.io/tutorial/migration-to-vue3.html), 依赖 `HBuilderX v3.4.x+` 版本编辑器 - [uni-app@vue3 v3.x](https://uniapp.dcloud.io/tutorial/migration-to-vue3.html), 依赖 `HBuilderX v3.6.x+` 版本编辑器
- [TypeScript](https://www.typescriptlang.org/zh/) - [TypeScript](https://www.typescriptlang.org/zh/)
- [Less](https://lesscss.org/) - [Less](https://lesscss.org/)
- [Sass](https://www.sass.hk/) - [Sass](https://www.sass.hk/)
...@@ -22,12 +22,14 @@ ...@@ -22,12 +22,14 @@
- [Dayjs](https://github.com/iamkun/dayjs) 时间库 - [Dayjs](https://github.com/iamkun/dayjs) 时间库
- [@vueuse/core](https://github.com/vueuse/vueuse) Vue2/3 实用工具集 - [@vueuse/core](https://github.com/vueuse/vueuse) Vue2/3 实用工具集
- [mock.js](https://github.com/nuysoft/Mock) 数据模拟 - [mock.js](https://github.com/nuysoft/Mock) 数据模拟
- [UnoCSS](https://github.com/unocss/unocss) UnoCSS
### 网络 ### 网络
<!-- prettier-ignore --> <!-- prettier-ignore -->
- [uni.request](https://uniapp.dcloud.net.cn/api/request/request.html) - [uni.request](https://uniapp.dcloud.net.cn/api/request/request.html)
- [axios](https://github.com/axios/axios) - [axios](https://github.com/axios/axios)
- [vue-request@next](https://github.com/AttoJS/vue-request)
### 图表 ### 图表
...@@ -38,7 +40,7 @@ ...@@ -38,7 +40,7 @@
<!-- prettier-ignore --> <!-- prettier-ignore -->
- [HBuilderX Latest](https://www.dcloud.io/hbuilderx.html) - [HBuilderX Latest](https://www.dcloud.io/hbuilderx.html)
- [Vite v3.x](https://vitejs.dev) - [Vite v4.x](https://vitejs.dev)
### 其他插件 ### 其他插件
......
File added
logo.png

17.8 KB

{ {
"name": "basic-app", "name": "basic-app",
"version": "0.0.1", "version": "3.0.3.0",
"description": "APP 基础工程", "description": "APP 基础工程",
"keywords": [ "keywords": [
"app", "app",
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
"lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/", "lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
"lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js", "lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js",
"log": "conventional-changelog -p angular -i CHANGELOG.md -s", "log": "conventional-changelog -p angular -i CHANGELOG.md -s",
"up": "pnpx @dcloudio/uvm alpha",
"prepare": "husky install" "prepare": "husky install"
}, },
"config": { "config": {
...@@ -65,90 +66,100 @@ ...@@ -65,90 +66,100 @@
} }
}, },
"dependencies": { "dependencies": {
"@dcloudio/uni-app": "3.0.0-alpha-3061620230106001", "@dcloudio/uni-app": "3.0.0-3070820230322001",
"@dcloudio/uni-app-plus": "3.0.0-alpha-3061620230106001", "@dcloudio/uni-app-plus": "3.0.0-3070820230322001",
"@dcloudio/uni-components": "3.0.0-alpha-3061620230106001", "@dcloudio/uni-components": "3.0.0-3070820230322001",
"@dcloudio/uni-h5": "3.0.0-alpha-3061620230106001", "@dcloudio/uni-h5": "3.0.0-3070820230322001",
"@dcloudio/uni-mp-alipay": "3.0.0-alpha-3061620230106001", "@dcloudio/uni-mp-alipay": "3.0.0-3070820230322001",
"@dcloudio/uni-mp-baidu": "3.0.0-alpha-3061620230106001", "@dcloudio/uni-mp-baidu": "3.0.0-3070820230322001",
"@dcloudio/uni-mp-kuaishou": "3.0.0-alpha-3061620230106001", "@dcloudio/uni-mp-jd": "3.0.0-3070820230322001",
"@dcloudio/uni-mp-lark": "3.0.0-alpha-3061620230106001", "@dcloudio/uni-mp-kuaishou": "3.0.0-3070820230322001",
"@dcloudio/uni-mp-qq": "3.0.0-alpha-3061620230106001", "@dcloudio/uni-mp-lark": "3.0.0-3070820230322001",
"@dcloudio/uni-mp-toutiao": "3.0.0-alpha-3061620230106001", "@dcloudio/uni-mp-qq": "3.0.0-3070820230322001",
"@dcloudio/uni-mp-weixin": "3.0.0-alpha-3061620230106001", "@dcloudio/uni-mp-toutiao": "3.0.0-3070820230322001",
"@dcloudio/uni-quickapp-webview": "3.0.0-alpha-3061620230106001", "@dcloudio/uni-mp-weixin": "3.0.0-3070820230322001",
"@dcloudio/uni-ui": "^1.4.23", "@dcloudio/uni-quickapp-webview": "3.0.0-3070820230322001",
"@vue/runtime-core": "^3.2.45", "@dcloudio/uni-ui": "^1.4.26",
"@vueuse/core": "^9.10.0", "@vue/runtime-core": "^3.2.47",
"@vueuse/core": "^9.13.0",
"axios": "^0.26.1", "axios": "^0.26.1",
"crypto-js": "^4.1.1",
"dayjs": "^1.11.7", "dayjs": "^1.11.7",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"mockjs": "^1.1.0", "nanoid": "^4.0.1",
"nanoid": "^4.0.0", "pinia": "^2.0.33",
"pinia": "^2.0.28",
"qs": "~6.9.7", "qs": "~6.9.7",
"stompjs": "^2.3.3", "stompjs": "^2.3.3",
"urijs": "^1.19.11", "urijs": "^1.19.11",
"vue": "^3.2.45", "vue": "^3.2.47",
"vue-i18n": "^9.2.2", "vue-i18n": "^9.2.2",
"vue-request": "2.0.0-rc.4",
"vue-types": "^5.0.2" "vue-types": "^5.0.2"
}, },
"devDependencies": { "devDependencies": {
"@commitlint/cli": "^17.4.0", "@antfu/eslint-config": "^0.37.0",
"@commitlint/config-conventional": "^17.4.0", "@commitlint/cli": "^17.5.0",
"@dcloudio/types": "^3.2.7", "@commitlint/config-conventional": "^17.4.4",
"@dcloudio/uni-automator": "3.0.0-alpha-3061620230106001", "@dcloudio/types": "^3.3.2",
"@dcloudio/uni-cli-shared": "3.0.0-alpha-3061620230106001", "@dcloudio/uni-automator": "3.0.0-3070820230322001",
"@dcloudio/uni-cli-shared": "3.0.0-3070820230322001",
"@dcloudio/uni-helper-json": "^1.0.13", "@dcloudio/uni-helper-json": "^1.0.13",
"@dcloudio/vite-plugin-uni": "3.0.0-alpha-3061620230106001", "@dcloudio/uni-stacktracey": "3.0.0-3070820230322001",
"@types/lodash-es": "^4.17.6", "@dcloudio/vite-plugin-uni": "3.0.0-3070820230322001",
"@types/mockjs": "^1.0.7", "@iconify/json": "^2.2.38",
"@types/node": "^18.11.18", "@types/crypto-js": "^4.1.1",
"@types/lodash-es": "^4.17.7",
"@types/node": "^18.15.5",
"@types/prettier": "^2.7.2", "@types/prettier": "^2.7.2",
"@types/qs": "^6.9.7", "@types/qs": "^6.9.7",
"@types/stompjs": "^2.3.5", "@types/stompjs": "^2.3.5",
"@types/urijs": "^1.19.19", "@types/urijs": "^1.19.19",
"@typescript-eslint/eslint-plugin": "^5.48.0", "@typescript-eslint/eslint-plugin": "^5.56.0",
"@typescript-eslint/parser": "^5.48.0", "@typescript-eslint/parser": "^5.56.0",
"commitizen": "^4.2.6", "commitizen": "^4.3.0",
"conventional-changelog-cli": "^2.2.2", "conventional-changelog-cli": "^2.2.2",
"cz-conventional-changelog": "^3.3.0", "cz-conventional-changelog": "^3.3.0",
"cz-customizable": "^7.0.0", "cz-customizable": "^7.0.0",
"cz-git": "^1.4.1", "cz-git": "^1.6.1",
"czg": "^1.4.1", "czg": "^1.6.1",
"dotenv": "^16.0.3", "dotenv": "^16.0.3",
"eslint": "^8.31.0", "eslint": "^8.36.0",
"eslint-config-prettier": "^8.6.0", "eslint-config-prettier": "^8.8.0",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^9.8.0", "eslint-plugin-vue": "^9.9.0",
"husky": "^8.0.3", "husky": "^8.0.3",
"jest": "27.0.4",
"jest-environment-node": "27.5.1",
"less": "^4.1.3", "less": "^4.1.3",
"lint-staged": "^13.1.0", "lint-staged": "^13.2.0",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"picocolors": "^1.0.0", "picocolors": "^1.0.0",
"pont-engine": "^1.5.4", "pont-engine": "^1.5.7",
"postcss": "^8.4.21", "postcss": "^8.4.21",
"postcss-html": "^1.5.0", "postcss-html": "^1.5.0",
"postcss-less": "^6.0.0", "postcss-less": "^6.0.0",
"prettier": "^2.8.2", "prettier": "^2.8.6",
"rimraf": "^3.0.2", "rimraf": "^4.4.1",
"sass": "^1.57.1", "sass": "^1.59.3",
"sort-package-json": "^2.1.0", "sort-package-json": "^2.4.1",
"stylelint": "^14.16.1", "stylelint": "^14.16.1",
"stylelint-config-html": "^1.1.0", "stylelint-config-html": "^1.1.0",
"stylelint-config-prettier": "^9.0.4", "stylelint-config-prettier": "^9.0.5",
"stylelint-config-recommended": "^9.0.0", "stylelint-config-recommended": "^9.0.0",
"stylelint-config-standard": "^29.0.0", "stylelint-config-standard": "^29.0.0",
"stylelint-order": "^5.0.0", "stylelint-order": "^5.0.0",
"stylus": "^0.59.0", "stylus": "^0.59.0",
"terser": "^5.16.1", "terser": "^5.16.6",
"typescript": "^4.9.4", "typescript": "^4.9.5",
"unplugin-auto-import": "^0.12.1", "unocss": "^0.50.6",
"unplugin-vue-components": "^0.22.12", "unocss-preset-weapp": "^0.5.2",
"vite": "^4.0.4", "unplugin-auto-import": "^0.15.1",
"unplugin-imagemin": "^0.3.11",
"unplugin-vue-components": "^0.24.1",
"vite": "^4.2.1",
"vue-eslint-parser": "^9.1.0" "vue-eslint-parser": "^9.1.0"
}, },
"engines": { "engines": {
"node": ">=14" "node": ">=16"
} }
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
{ {
"originType": "SwaggerV2", "originType": "SwaggerV3",
"originUrl": "http://127.0.0.1:8081/api/v2/api-docs", "originUrl": "http://192.168.0.156:8081/api/v3/api-docs",
"templateType": "fetch", "templateType": "fetch",
"templatePath": "./pont-template", "templatePath": "./pont-template",
"transformPath": "./pont-transform", "transformPath": "./pont-transform",
"outDir": "./src/api/services", "outDir": "./src/api/services",
"surrounding": "typeScript", "surrounding": "typeScript",
"usingOperationId": true,
"mocks": { "mocks": {
"enable": true, "enable": true,
"basePath": "", "basePath": "",
......
import * as Pont from 'pont-engine' // import * as Pont from 'pont-engine'
import { Interface, BaseClass, Property, CodeGenerator } from 'pont-engine' import { Interface, BaseClass, Property, CodeGenerator } from 'pont-engine'
// 接口 API 前缀 // 接口 API 前缀
// 通常与项目的 env 配置中的 VITE_GLOB_API_URL_PREFIX 相同 // 通常与项目的 env 配置中的 VITE_GLOB_API_URL_PREFIX 相同
const API_URL_PREFIX = '/api' const API_URL_PREFIX = '/api'
export class FileStructures extends Pont.FileStructures {
getModsDeclaration(originCode: string): string {
return originCode
}
}
export default class BasicGenerator extends CodeGenerator { export default class BasicGenerator extends CodeGenerator {
checkJsonParam(inter: Interface, paramsCode: string): boolean { checkJsonParam(inter: Interface, paramsCode: string): boolean {
const prettier = require('prettier') const prettier = require('prettier')
...@@ -21,6 +15,7 @@ export default class BasicGenerator extends CodeGenerator { ...@@ -21,6 +15,7 @@ export default class BasicGenerator extends CodeGenerator {
// 认为没有返回值的接口表示下载(通常是) // 认为没有返回值的接口表示下载(通常是)
isDownload(inter: Interface): boolean { isDownload(inter: Interface): boolean {
console.log(inter.name, inter.responseType)
return inter.responseType === 'any' return inter.responseType === 'any'
} }
...@@ -40,8 +35,9 @@ export default class BasicGenerator extends CodeGenerator { ...@@ -40,8 +35,9 @@ export default class BasicGenerator extends CodeGenerator {
} }
if (requestParams.includes('body')) { if (requestParams.includes('body')) {
requestParams = requestParams.replace('params?: Params, ', '')
bodyTypeDef = requestParams.replace(/^.*body: (.*),.*$/gi, '$1') bodyTypeDef = requestParams.replace(/^.*body: (.*),.*$/gi, '$1')
requestParams = requestParams.replace('params?: Params, ', '')
requestParams = requestParams.replace('body:', 'body?:')
} }
} }
...@@ -56,11 +52,18 @@ export default class BasicGenerator extends CodeGenerator { ...@@ -56,11 +52,18 @@ export default class BasicGenerator extends CodeGenerator {
getInterfaceContentInDeclaration(inter: Interface) { getInterfaceContentInDeclaration(inter: Interface) {
const paramsCode = inter.getParamsCode('Params') const paramsCode = inter.getParamsCode('Params')
const requestParams = this.getParams(inter, paramsCode) const requestParams = this.getParams(inter, paramsCode)
const sourceResponseType = inter.responseType
const targetResponseType =
sourceResponseType === 'File'
? 'void'
: sourceResponseType === 'defs.ResultString'
? 'string'
: sourceResponseType.replace(/defs.Result(.*)/, 'defs.$1')
return ` return `
export ${paramsCode} export ${paramsCode}
export type Response = ${inter.responseType.replace(/defs.Result\<(.*)\>/, '$1')}; export type Response = ${targetResponseType};
export const init: Response; export const init: Response;
...@@ -88,7 +91,8 @@ export default class BasicGenerator extends CodeGenerator { ...@@ -88,7 +91,8 @@ export default class BasicGenerator extends CodeGenerator {
const method = inter.method.toUpperCase() const method = inter.method.toUpperCase()
const paramsCode = inter.getParamsCode('Params', this.surrounding) const paramsCode = inter.getParamsCode('Params', this.surrounding)
const requestParams = this.getParams(inter, paramsCode) const requestParams = this.getParams(inter, paramsCode)
const undef = inter.response.getInitialValue() === 'undefined' const initValue = inter.response.getInitialValue(true)
const undef = initValue === 'undefined' || initValue === `''`
const isBody = this.checkJsonParam(inter, paramsCode) const isBody = this.checkJsonParam(inter, paramsCode)
// TODO // TODO
...@@ -105,7 +109,7 @@ export default class BasicGenerator extends CodeGenerator { ...@@ -105,7 +109,7 @@ export default class BasicGenerator extends CodeGenerator {
${isBody ? '' : `export ${paramsCode}`} ${isBody ? '' : `export ${paramsCode}`}
${undef ? '' : `export const init = ${inter.response.getInitialValue(true)};`} ${undef ? '' : `export const init = ${initValue};`}
export function request(${requestParams}) { export function request(${requestParams}) {
return defHttp.request({ return defHttp.request({
......
...@@ -9,10 +9,10 @@ ...@@ -9,10 +9,10 @@
checkUpgrade() checkUpgrade()
// 清除消息角标 // 清除消息角标
// Push.setBadge() // Push.setBadge(0)
// 监听在线消息 // 监听在线消息
// Push.listenMessage() // Push.listen()
}) })
onShow(() => { onShow(() => {
...@@ -24,11 +24,11 @@ ...@@ -24,11 +24,11 @@
}) })
onError((err) => { onError((err) => {
Message.toast('App Error: ' + err) Message.toast(`App Error: ${err}`)
}) })
onUnhandledRejection((err) => { onUnhandledRejection((err) => {
Message.toast('App UnhandledRejection: ' + err) Message.toast(`App UnhandledRejection: ${err}`)
}) })
</script> </script>
...@@ -46,8 +46,10 @@ ...@@ -46,8 +46,10 @@
// 全局样式 // 全局样式
@import './common/public.less'; @import './common/public.less';
/** #ifdef H5 */
uni-page-body, uni-page-body,
page { page {
height: 100%; height: 100%;
} }
/** #endif */
</style> </style>
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import * as login from './login' import * as login from './login'
import * as logout from './logout' import * as logout from './logout'
import * as register from './register' import * as register from './register'
import * as safe from './safe'
import * as valid from './valid' import * as valid from './valid'
export { login, logout, register, valid } export { login, logout, register, safe, valid }
...@@ -12,7 +12,7 @@ export class Params { ...@@ -12,7 +12,7 @@ export class Params {
password: string password: string
} }
export const init = new defs.Result() export const init = new defs.ResultLoginVo()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
...@@ -7,7 +7,7 @@ import { defHttp } from '/@/utils/http/axios' ...@@ -7,7 +7,7 @@ import { defHttp } from '/@/utils/http/axios'
export class Params {} export class Params {}
export const init = new defs.Result() export const init = new defs.ResultString()
export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
...@@ -6,25 +6,23 @@ import * as defs from '../../baseClass' ...@@ -6,25 +6,23 @@ import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** 用户名 */
username: string
/** 密码 */
password: string
/** 真实姓名 */
realName: string
/** 手机号 */
mobile: string
/** 头像 */ /** 头像 */
avatar?: string avatar?: string
/** 邮箱 */ /** 邮箱 */
email?: string email?: string
/** 是否启用 */ /** 是否启用 */
enable?: boolean enable?: boolean
/** 简介 */
introduction?: string
/** 手机号 */
mobile: string
/** 密码 */
password: string
/** 真实姓名 */
realName: string
/** 用户名 */
username: string
} }
export const init = new defs.Result() export const init = new defs.ResultString()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
/**
* @desc 安全验证
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** 密码 */
password: string
}
export const init = new defs.ResultString()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request(
{
url: '/auth/safe',
method: 'GET',
params,
...config,
},
options,
)
}
/** /**
* @desc 检查登录状态 * @desc 检查登录
*/ */
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
...@@ -7,7 +7,7 @@ import { defHttp } from '/@/utils/http/axios' ...@@ -7,7 +7,7 @@ import { defHttp } from '/@/utils/http/axios'
export class Params {} export class Params {}
export const init = new defs.Result() export const init = new defs.ResultBoolean()
export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
/**
* @desc 新增
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** id */
id: string
/** 字典名称 */
name: string
/** 字典编号 */
code: string
/** 字典描述 */
description?: string
}
export const init = new defs.ResultString()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request(
{
url: '/sys/dict/add',
method: 'POST',
data: params,
...config,
},
options,
)
}
/**
* @desc 查询
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** id */
id: string
}
export const init = new defs.ResultDictVo()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request(
{
url: '/sys/dict/find',
method: 'GET',
params,
...config,
},
options,
)
}
/**
* @description 字典管理
*/
import * as add from './add'
import * as find from './find'
import * as modify from './modify'
import * as page from './page'
import * as remove from './remove'
import * as selector from './selector'
export { add, find, modify, page, remove, selector }
/**
* @desc 修改
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** id */
id: string
/** 字典名称 */
name: string
/** 字典编号 */
code: string
/** 字典描述 */
description?: string
}
export const init = new defs.ResultString()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request(
{
url: '/sys/dict/modify',
method: 'POST',
data: params,
...config,
},
options,
)
}
/**
* @desc 分页查询
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** 分页条数 */
pageSize: number
/** 当前页数 */
pageNo: number
/** 排序字段 */
sortField?: string
/** 排序方向(ASC|DESC) */
sortOrder?: string
}
export const init = new defs.ResultPageVoDictVo()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request(
{
url: '/sys/dict/page',
method: 'GET',
params,
...config,
},
options,
)
}
...@@ -10,12 +10,12 @@ export class Params { ...@@ -10,12 +10,12 @@ export class Params {
ids: string ids: string
} }
export const init = new defs.Result() export const init = new defs.ResultString()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
{ {
url: '/sys/role/deleted', url: '/sys/dict/remove',
method: 'POST', method: 'POST',
data: params, data: params,
......
/**
* @desc 选项查询
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {}
export const init = new defs.ResultArrayListKeyValueVo()
export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request(
{
url: '/sys/dict/selector',
method: 'GET',
params,
...config,
},
options,
)
}
/**
* @desc 新增
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** id */
id: string
/** 字典 ID */
dictId: string
/** 字典选项名称 */
name: string
/** 字典选项值 */
value: string
/** 字典选项描述 */
description?: string
/** 字典选项排序序号 */
serial?: number
/** 字典选项是否启用 */
enable: boolean
}
export const init = new defs.ResultString()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request(
{
url: '/sys/dict/item/add',
method: 'POST',
data: params,
...config,
},
options,
)
}
/**
* @desc 查询
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** id */
id: string
}
export const init = new defs.ResultDictItemVo()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request(
{
url: '/sys/dict/item/find',
method: 'GET',
params,
...config,
},
options,
)
}
/**
* @description 字典选项管理
*/
import * as add from './add'
import * as find from './find'
import * as modify from './modify'
import * as page from './page'
import * as remove from './remove'
import * as selector from './selector'
export { add, find, modify, page, remove, selector }
/**
* @desc 修改
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** id */
id: string
/** 字典 ID */
dictId: string
/** 字典选项名称 */
name: string
/** 字典选项值 */
value: string
/** 字典选项描述 */
description?: string
/** 字典选项排序序号 */
serial?: number
/** 字典选项是否启用 */
enable: boolean
}
export const init = new defs.ResultString()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request(
{
url: '/sys/dict/item/modify',
method: 'POST',
data: params,
...config,
},
options,
)
}
/**
* @desc 分页查询
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** 分页条数 */
pageSize: number
/** 当前页数 */
pageNo: number
/** 排序字段 */
sortField?: string
/** 排序方向(ASC|DESC) */
sortOrder?: string
}
export const init = new defs.ResultPageVoDictItemVo()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request(
{
url: '/sys/dict/item/page',
method: 'GET',
params,
...config,
},
options,
)
}
/**
* @desc 删除
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** ids 多个以逗号分割 */
ids: string
}
export const init = new defs.ResultString()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request(
{
url: '/sys/dict/item/remove',
method: 'POST',
data: params,
...config,
},
options,
)
}
/**
* @desc 选项查询
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** 字典 ID */
dictId?: string
/** 字典 ID */
dictCode?: string
/** 字典选项是否启用 */
enable?: boolean
}
export const init = new defs.ResultArrayListKeyValueVo()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request(
{
url: '/sys/dict/item/selector',
method: 'GET',
params,
...config,
},
options,
)
}
...@@ -7,7 +7,7 @@ import { defHttp } from '/@/utils/http/axios' ...@@ -7,7 +7,7 @@ import { defHttp } from '/@/utils/http/axios'
export class Params {} export class Params {}
export const init = new defs.Result() export const init = new defs.ResultString()
export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
...@@ -7,7 +7,7 @@ import { defHttp } from '/@/utils/http/axios' ...@@ -7,7 +7,7 @@ import { defHttp } from '/@/utils/http/axios'
export class Params {} export class Params {}
export const init = new defs.Result() export const init = new defs.ResultUserExtensionVo()
export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
...@@ -7,7 +7,7 @@ import { defHttp } from '/@/utils/http/axios' ...@@ -7,7 +7,7 @@ import { defHttp } from '/@/utils/http/axios'
export class Params {} export class Params {}
export const init = new defs.Result() export const init = new defs.ResultString()
export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
...@@ -7,5 +7,6 @@ import * as fail from './fail' ...@@ -7,5 +7,6 @@ import * as fail from './fail'
import * as findUserExtensionInfo from './findUserExtensionInfo' import * as findUserExtensionInfo from './findUserExtensionInfo'
import * as json from './json' import * as json from './json'
import * as page from './page' import * as page from './page'
import * as upload from './upload'
export { hello, download, fail, findUserExtensionInfo, json, page } export { hello, download, fail, findUserExtensionInfo, json, page, upload }
...@@ -5,10 +5,10 @@ ...@@ -5,10 +5,10 @@
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export const init = new defs.Result() export const init = new defs.ResultPageVoString()
export function request( export function request(
body: defs.PageParam, body?: defs.PageParam,
config?: http.RequestConfig<defs.PageParam>, config?: http.RequestConfig<defs.PageParam>,
options?: http.RequestOptions, options?: http.RequestOptions,
) { ) {
......
...@@ -6,17 +6,17 @@ import * as defs from '../../baseClass' ...@@ -6,17 +6,17 @@ import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** 当前页数 */
pageNo: number
/** 分页条数 */ /** 分页条数 */
pageSize: number pageSize: number
/** 当前页数 */
pageNo: number
/** 排序字段 */ /** 排序字段 */
sortField?: string sortField?: string
/** 排序方向(ASC|DESC) */ /** 排序方向(ASC|DESC) */
sortOrder?: 'ASC' | 'DESC' sortOrder?: string
} }
export const init = new defs.Result() export const init = new defs.ResultPageVoString()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
/**
* @desc 文件上传
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export const init = new defs.ResultString()
export function request(body?: object, config?: http.RequestConfig<object>, options?: http.RequestOptions) {
return defHttp.request(
{
url: '/example/upload',
method: 'POST',
data: body,
headers: { 'Content-Type': 'application/json' },
...config,
},
options,
)
}
...@@ -5,22 +5,15 @@ ...@@ -5,22 +5,15 @@
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params {} export const init = new defs.ResultString()
export const init = new defs.Result() export function request(body?: object, config?: http.RequestConfig<object>, options?: http.RequestOptions) {
export function request(
params: Params,
form: FormData,
config?: http.RequestConfig<Params | FormData>,
options?: http.RequestOptions,
) {
return defHttp.request( return defHttp.request(
{ {
url: '/common/file/upload', url: '/common/file/upload',
method: 'POST', method: 'POST',
data: form || params, data: body,
headers: { 'Content-Type': 'multipart/form-data;charset=UTF-8' }, headers: { 'Content-Type': 'application/json' },
...config, ...config,
}, },
......
...@@ -5,19 +5,15 @@ ...@@ -5,19 +5,15 @@
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export const init = new defs.ResultString()
/** Base64 图片信息 */
base64Image: string
}
export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(body?: string, config?: http.RequestConfig<string>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
{ {
url: '/common/file/uploadBase64Image', url: '/common/file/uploadBase64Image',
method: 'POST', method: 'POST',
data: params, data: body,
headers: { 'Content-Type': 'application/json' },
...config, ...config,
}, },
......
import * as auth from './auth' import * as auth from './auth'
import * as dict from './dict'
import * as dictItem from './dictItem'
import * as example from './example' import * as example from './example'
import * as file from './file' import * as file from './file'
import * as permission from './permission' import * as permission from './permission'
...@@ -8,6 +10,8 @@ import * as userView from './userView' ...@@ -8,6 +10,8 @@ import * as userView from './userView'
export const API = { export const API = {
auth, auth,
dict,
dictItem,
example, example,
file, file,
permission, permission,
......
...@@ -5,41 +5,19 @@ ...@@ -5,41 +5,19 @@
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export const init = new defs.ResultString()
/** 组件 */
component?: string
/** 是否启用 */
enable?: boolean
/** 是否隐藏 */
hidden?: boolean
/** 图标 */
icon?: string
/** 元数据 */
meta?: string
/** 名称 */
name: string
/** 路径 */
path?: string
/** 父级ID */
pid?: string
/** 重定向 */
redirect?: string
/** 序号 */
serial?: number
/** 权限类型 */
type: 'DIR' | 'MENU' | 'BUTTON'
/** 标识 */
uid: string
}
export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(
body?: defs.PermissionParam,
config?: http.RequestConfig<defs.PermissionParam>,
options?: http.RequestOptions,
) {
return defHttp.request( return defHttp.request(
{ {
url: '/sys/permission/add', url: '/sys/permission/add',
method: 'POST', method: 'POST',
data: params, data: body,
headers: { 'Content-Type': 'application/json' },
...config, ...config,
}, },
......
...@@ -10,7 +10,7 @@ export class Params { ...@@ -10,7 +10,7 @@ export class Params {
id: string id: string
} }
export const init = new defs.Result() export const init = new defs.ResultPermissionVo()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
* @description 权限管理 * @description 权限管理
*/ */
import * as add from './add' import * as add from './add'
import * as deleted from './deleted'
import * as find from './find' import * as find from './find'
import * as modify from './modify' import * as modify from './modify'
import * as page from './page' import * as page from './page'
import * as remove from './remove'
import * as tree from './tree' import * as tree from './tree'
export { add, deleted, find, modify, page, tree } export { add, find, modify, page, remove, tree }
...@@ -5,43 +5,19 @@ ...@@ -5,43 +5,19 @@
import * as defs from '../../baseClass' import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export const init = new defs.ResultString()
/** 组件 */
component?: string
/** 是否启用 */
enable?: boolean
/** 是否隐藏 */
hidden?: boolean
/** 图标 */
icon?: string
/** id */
id: string
/** 元数据 */
meta?: string
/** 名称 */
name: string
/** 路径 */
path?: string
/** 父级ID */
pid?: string
/** 重定向 */
redirect?: string
/** 序号 */
serial?: number
/** 权限类型 */
type: 'DIR' | 'MENU' | 'BUTTON'
/** 标识 */
uid: string
}
export const init = new defs.Result()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(
body?: defs.PermissionParam,
config?: http.RequestConfig<defs.PermissionParam>,
options?: http.RequestOptions,
) {
return defHttp.request( return defHttp.request(
{ {
url: '/sys/permission/modify', url: '/sys/permission/modify',
method: 'POST', method: 'POST',
data: params, data: body,
headers: { 'Content-Type': 'application/json' },
...config, ...config,
}, },
......
...@@ -6,17 +6,17 @@ import * as defs from '../../baseClass' ...@@ -6,17 +6,17 @@ import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** 当前页数 */
pageNo: number
/** 分页条数 */ /** 分页条数 */
pageSize: number pageSize: number
/** 当前页数 */
pageNo: number
/** 排序字段 */ /** 排序字段 */
sortField?: string sortField?: string
/** 排序方向(ASC|DESC) */ /** 排序方向(ASC|DESC) */
sortOrder?: 'ASC' | 'DESC' sortOrder?: string
} }
export const init = new defs.Result() export const init = new defs.ResultPageVoPermissionVo()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
...@@ -10,12 +10,12 @@ export class Params { ...@@ -10,12 +10,12 @@ export class Params {
id: string id: string
} }
export const init = new defs.Result() export const init = new defs.ResultString()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
{ {
url: '/sys/permission/deleted', url: '/sys/permission/remove',
method: 'POST', method: 'POST',
data: params, data: params,
......
...@@ -7,10 +7,10 @@ import { defHttp } from '/@/utils/http/axios' ...@@ -7,10 +7,10 @@ import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** pid */ /** pid */
pid?: string pid: string
} }
export const init = new defs.Result() export const init = new defs.ResultArrayListPermissionVo()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
...@@ -6,13 +6,15 @@ import * as defs from '../../baseClass' ...@@ -6,13 +6,15 @@ import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** 名称 */ /** id */
name: string id: string
/** 标识 */ /** 标识 */
uid: string uid: string
/** 名称 */
name: string
} }
export const init = new defs.Result() export const init = new defs.ResultString()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
...@@ -12,7 +12,7 @@ export class Params { ...@@ -12,7 +12,7 @@ export class Params {
ids: string ids: string
} }
export const init = new defs.Result() export const init = new defs.ResultString()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
...@@ -10,7 +10,7 @@ export class Params { ...@@ -10,7 +10,7 @@ export class Params {
id: string id: string
} }
export const init = new defs.Result() export const init = new defs.ResultRoleVo()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
*/ */
import * as add from './add' import * as add from './add'
import * as assign from './assign' import * as assign from './assign'
import * as deleted from './deleted'
import * as find from './find' import * as find from './find'
import * as modify from './modify' import * as modify from './modify'
import * as page from './page' import * as page from './page'
import * as remove from './remove'
import * as selector from './selector' import * as selector from './selector'
export { add, assign, deleted, find, modify, page, selector } export { add, assign, find, modify, page, remove, selector }
...@@ -8,13 +8,13 @@ import { defHttp } from '/@/utils/http/axios' ...@@ -8,13 +8,13 @@ import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** id */ /** id */
id: string id: string
/** 名称 */
name: string
/** 标识 */ /** 标识 */
uid: string uid: string
/** 名称 */
name: string
} }
export const init = new defs.Result() export const init = new defs.ResultString()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
...@@ -6,17 +6,17 @@ import * as defs from '../../baseClass' ...@@ -6,17 +6,17 @@ import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** 当前页数 */
pageNo: number
/** 分页条数 */ /** 分页条数 */
pageSize: number pageSize: number
/** 当前页数 */
pageNo: number
/** 排序字段 */ /** 排序字段 */
sortField?: string sortField?: string
/** 排序方向(ASC|DESC) */ /** 排序方向(ASC|DESC) */
sortOrder?: 'ASC' | 'DESC' sortOrder?: string
} }
export const init = new defs.Result() export const init = new defs.ResultPageVoRoleVo()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
/**
* @desc 删除
*/
import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios'
export class Params {
/** ids 多个以逗号分割 */
ids: string
}
export const init = new defs.ResultString()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request(
{
url: '/sys/role/remove',
method: 'POST',
data: params,
...config,
},
options,
)
}
...@@ -7,7 +7,7 @@ import { defHttp } from '/@/utils/http/axios' ...@@ -7,7 +7,7 @@ import { defHttp } from '/@/utils/http/axios'
export class Params {} export class Params {}
export const init = new defs.Result() export const init = new defs.ResultArrayListRoleVo()
export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
...@@ -12,7 +12,7 @@ export class Params { ...@@ -12,7 +12,7 @@ export class Params {
ids: string ids: string
} }
export const init = new defs.Result() export const init = new defs.ResultString()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
...@@ -6,17 +6,17 @@ import * as defs from '../../baseClass' ...@@ -6,17 +6,17 @@ import * as defs from '../../baseClass'
import { defHttp } from '/@/utils/http/axios' import { defHttp } from '/@/utils/http/axios'
export class Params { export class Params {
/** 当前页数 */
pageNo: number
/** 分页条数 */ /** 分页条数 */
pageSize: number pageSize: number
/** 当前页数 */
pageNo: number
/** 排序字段 */ /** 排序字段 */
sortField?: string sortField?: string
/** 排序方向(ASC|DESC) */ /** 排序方向(ASC|DESC) */
sortOrder?: 'ASC' | 'DESC' sortOrder?: string
} }
export const init = new defs.Result() export const init = new defs.ResultPageVoUserVo()
export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
...@@ -7,7 +7,7 @@ import { defHttp } from '/@/utils/http/axios' ...@@ -7,7 +7,7 @@ import { defHttp } from '/@/utils/http/axios'
export class Params {} export class Params {}
export const init = new defs.Result() export const init = new defs.ResultArrayListMenuVo()
export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
...@@ -7,7 +7,7 @@ import { defHttp } from '/@/utils/http/axios' ...@@ -7,7 +7,7 @@ import { defHttp } from '/@/utils/http/axios'
export class Params {} export class Params {}
export const init = new defs.Result() export const init = new defs.ResultArrayListString()
export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
...@@ -7,7 +7,7 @@ import { defHttp } from '/@/utils/http/axios' ...@@ -7,7 +7,7 @@ import { defHttp } from '/@/utils/http/axios'
export class Params {} export class Params {}
export const init = new defs.Result() export const init = new defs.ResultUserInfo()
export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) { export function request(params?: Params, config?: http.RequestConfig<Params>, options?: http.RequestOptions) {
return defHttp.request( return defHttp.request(
......
export const Message = { export const Message = {
/** /**
* 消息轻提示 * 消息轻提示
* @param text 消息内容 * @param title 消息内容
*/ */
toast: (text: string, duration?: 'short' | 'long'): void => { toast: (title: string, duration?: 'short' | 'long'): void => {
if (text) { if (title) {
// #ifndef APP-PLUS // #ifndef APP-PLUS
uni.showToast({ uni.showToast({
title: text, title,
icon: 'none', icon: 'none',
duration: duration === 'short' ? 2000 : 3500, duration: duration === 'short' ? 2000 : 3500,
}) })
// #endif // #endif
// #ifdef APP-PLUS // #ifdef APP-PLUS
plus.nativeUI.toast(text, { plus.nativeUI.toast(title, {
duration: duration || 'short', duration: duration || 'short',
}) })
// #endif // #endif
...@@ -22,51 +22,51 @@ export const Message = { ...@@ -22,51 +22,51 @@ export const Message = {
}, },
/** /**
* 消息弹窗提示 * 消息弹窗提示
* @param message 消息内容 * @param content 消息内容
* @param title 标题 * @param title 标题
* @returns Promise<void> * @returns Promise<void>
*/ */
alert: (message: string, title = '提示', confirmText = '确定'): Promise<void> => { alert: (content: string, title = '提示', confirmText = '确定'): Promise<void> => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// #ifndef APP-PLUS // #ifndef APP-PLUS
uni.showModal({ uni.showModal({
title: title, title,
content: message, content,
showCancel: false, showCancel: false,
confirmText: confirmText, confirmText,
success: () => resolve(), success: () => resolve(),
fail: (err) => reject(err), fail: (err) => reject(err),
}) })
// #endif // #endif
// #ifdef APP-PLUS // #ifdef APP-PLUS
plus.nativeUI.alert(message, resolve, title, confirmText) plus.nativeUI.alert(content, resolve, title, confirmText)
// #endif // #endif
}) })
}, },
/** /**
* 消息确认提示 * 消息确认提示
* @param title 标题 * @param title 标题
* @param message 提示内容 * @param content 提示内容
* @param confirmText 确认按钮文字 * @param confirmText 确认按钮文字
* @param showCancel 是否显示取消按钮 * @param showCancel 是否显示取消按钮
* @returns Promise<boolean> 是否点击了确认按钮 * @returns Promise<boolean> 是否点击了确认按钮
*/ */
confirm: (message: string, title = '提示', confirmText = '确定', showCancel = true): Promise<boolean> => { confirm: (content: string, title = '提示', confirmText = '确定', showCancel = true): Promise<boolean> => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
// #ifndef APP-PLUS // #ifndef APP-PLUS
uni.showModal({ uni.showModal({
title: title, title,
content: message, content,
showCancel: showCancel, showCancel,
confirmText: confirmText, confirmText,
success: (res) => resolve(res.confirm), success: (res) => resolve(res.confirm),
fail: (err) => reject(err), fail: (err) => reject(err),
}) })
// #endif // #endif
// #ifdef APP-PLUS // #ifdef APP-PLUS
plus.nativeUI.confirm(message, ({ index }) => resolve(index === 0), { plus.nativeUI.confirm(content, ({ index }) => resolve(index === 0), {
title, title,
buttons: ['确认', '取消'], buttons: ['确认', '取消'],
verticalAlign: 'center', verticalAlign: 'center',
...@@ -74,4 +74,20 @@ export const Message = { ...@@ -74,4 +74,20 @@ export const Message = {
// #endif // #endif
}) })
}, },
/**
* 加载中
* @param title 加载中文字
*/
loading: (title = '加载中...'): void => {
uni.showLoading({
title,
mask: true,
})
},
/**
* 隐藏加载中
*/
hideLoading: (): void => {
uni.hideLoading()
},
} }
...@@ -4,116 +4,3 @@ ...@@ -4,116 +4,3 @@
align-items: center; align-items: center;
height: 100vh; height: 100vh;
} }
// ================ mapbox-gl ================
// 自定义 popup 内容样式
.mapboxgl-popup-content {
box-shadow: 0 1px 5px #6e6e6e !important;
}
.mapboxgl-popup-content .mapboxgl-custom-popup {
position: relative;
}
.mapboxgl-custom-popup .popup-title {
font-weight: bold;
}
.mapboxgl-ctrl-group:not(:empty) {
box-shadow: 0 0 6px #000 !important;
}
.mapboxgl-ctrl-group button {
display: flex !important;
overflow: visible !important;
}
.mapboxgl-ctrl-logo {
display: none !important;
}
.mapboxgl-ctrl-bottom-left {
display: flex;
bottom: 0;
left: 2px;
}
.mapboxgl-ctrl-lnglat {
background: rgb(0 0 0 / 40%);
color: white;
line-height: 2em;
padding: 0 10px;
}
// 覆盖全屏控件的图标
.mapboxgl-ctrl button.mapboxgl-ctrl-fullscreen .mapboxgl-ctrl-icon {
background-image: url('data:image/svg+xml,%3Csvg xmlns="http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 16 16"%3E%3Cpath fill="currentColor" d="M3.75 3a.75.75 0 0 0-.75.75V5.5a.5.5 0 0 1-1 0V3.75C2 2.784 2.784 2 3.75 2H5.5a.5.5 0 0 1 0 1H3.75ZM10 2.5a.5.5 0 0 1 .5-.5h1.75c.966 0 1.75.784 1.75 1.75V5.5a.5.5 0 0 1-1 0V3.75a.75.75 0 0 0-.75-.75H10.5a.5.5 0 0 1-.5-.5ZM2.5 10a.5.5 0 0 1 .5.5v1.75c0 .414.336.75.75.75H5.5a.5.5 0 0 1 0 1H3.75A1.75 1.75 0 0 1 2 12.25V10.5a.5.5 0 0 1 .5-.5Zm11 0a.5.5 0 0 1 .5.5v1.75A1.75 1.75 0 0 1 12.25 14H10.5a.5.5 0 0 1 0-1h1.75a.75.75 0 0 0 .75-.75V10.5a.5.5 0 0 1 .5-.5Z"%2F%3E%3C%2Fsvg%3E') !important;
}
.mapboxgl-ctrl button.mapboxgl-ctrl-shrink .mapboxgl-ctrl-icon {
background-image: url('data:image/svg+xml,%3Csvg xmlns="http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg" width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="0 0 16 16"%3E%3Cpath fill="currentColor" d="M11 4a1 1 0 0 0 1 1h1.5a.5.5 0 0 1 0 1H12a2 2 0 0 1-2-2V2.5a.5.5 0 0 1 1 0V4Zm0 8a1 1 0 0 1 1-1h1.5a.5.5 0 0 0 0-1H12a2 2 0 0 0-2 2v1.5a.5.5 0 0 0 1 0V12Zm-7-1a1 1 0 0 1 1 1v1.5a.5.5 0 0 0 1 0V12a2 2 0 0 0-2-2H2.5a.5.5 0 0 0 0 1H4Zm1-7a1 1 0 0 1-1 1H2.5a.5.5 0 0 0 0 1H4a2 2 0 0 0 2-2V2.5a.5.5 0 0 0-1 0V4Z"%2F%3E%3C%2Fsvg%3E') !important;
}
.mapboxgl-ctrl .mapboxgl-ctrl-reset-button .mapboxgl-ctrl-icon {
background-image: url('data:image/svg+xml,%3Csvg xmlns="http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg" width="20" height="20" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"%3E%3Cpath fill="currentColor" d="M12 16c1.671 0 3-1.331 3-3s-1.329-3-3-3s-3 1.331-3 3s1.329 3 3 3z"%2F%3E%3Cpath fill="currentColor" d="M20.817 11.186a8.94 8.94 0 0 0-1.355-3.219a9.053 9.053 0 0 0-2.43-2.43a8.95 8.95 0 0 0-3.219-1.355a9.028 9.028 0 0 0-1.838-.18V2L8 5l3.975 3V6.002c.484-.002.968.044 1.435.14a6.961 6.961 0 0 1 2.502 1.053a7.005 7.005 0 0 1 1.892 1.892A6.967 6.967 0 0 1 19 13a7.032 7.032 0 0 1-.55 2.725a7.11 7.11 0 0 1-.644 1.188a7.2 7.2 0 0 1-.858 1.039a7.028 7.028 0 0 1-3.536 1.907a7.13 7.13 0 0 1-2.822 0a6.961 6.961 0 0 1-2.503-1.054a7.002 7.002 0 0 1-1.89-1.89A6.996 6.996 0 0 1 5 13H3a9.02 9.02 0 0 0 1.539 5.034a9.096 9.096 0 0 0 2.428 2.428A8.95 8.95 0 0 0 12 22a9.09 9.09 0 0 0 1.814-.183a9.014 9.014 0 0 0 3.218-1.355a8.886 8.886 0 0 0 1.331-1.099a9.228 9.228 0 0 0 1.1-1.332A8.952 8.952 0 0 0 21 13a9.09 9.09 0 0 0-.183-1.814z"%2F%3E%3C%2Fsvg%3E') !important;
}
/* stylelint-disable-next-line selector-no-vendor-prefix */
.mapboxgl-map:-webkit-full-screen {
.mapboxgl-ctrl-bottom-left {
bottom: 0;
}
}
// 自定义图层控制器样式
.mapboxgl-ctrl button.-active svg {
color: #4264fb;
}
.mapboxgl-ctrl-layer-button {
position: relative;
.mapboxgl-ctrl-layer-wrap {
display: none;
justify-items: center;
align-items: center;
position: absolute;
right: 40px;
padding: 10px;
border-radius: 3px;
box-shadow: 0 0 3px #333;
background-color: #fff;
.mapboxgl-ctrl-layer {
width: 60px;
height: 60px;
display: flex;
justify-content: center;
border: 2px solid #fff;
position: relative;
&.active {
border-color: #3385ff;
}
img {
width: 100%;
height: 100%;
}
span {
display: inline-flex;
justify-content: center;
background-color: rgb(0 0 0 / 60%);
color: white;
position: absolute;
bottom: 0;
width: 100%;
}
}
}
&.-active .mapboxgl-ctrl-layer-wrap {
display: flex;
}
}
<script setup lang="ts">
import md5 from 'crypto-js/md5'
const props = defineProps({
width: {
type: [String, Number],
default: '320',
},
height: {
type: [String, Number],
default: '240',
},
radius: {
type: [String, Number],
default: 0,
},
mode: {
type: String,
default: 'scaleToFill',
},
src: {
type: String,
required: true,
},
})
const src = ref()
const hashCacheKey = ref()
onMounted(async () => {
// 尝试缓存图片,如果失败则使用原始图片
await tryCache()
})
async function tryCache() {
let url = props.src
// #ifdef APP-PLUS
const hash = md5(url).toString()
hashCacheKey.value = `G_CACHE_IMAGE_${hash}`
if (uni.getStorageSync(hashCacheKey.value)) {
console.log('CacheImage cache hit')
url = uni.getStorageSync(hashCacheKey.value)
} else {
console.log('CacheImage cache miss')
try {
const res = await uni.downloadFile({ url })
if (res.statusCode === 200) {
const { savedFilePath } = await new Promise<UniApp.SaveFileSuccess>((resolve, reject) => {
uni.saveFile({
tempFilePath: res.tempFilePath,
success: (res) => resolve(res),
fail: (err) => reject(err),
})
})
url = `${savedFilePath}`
// 缓存图片本地地址
uni.setStorageSync(hashCacheKey.value, url)
}
} catch (e) {
console.error(e)
}
}
console.log(props.src, '=>', url, hash, hashCacheKey.value)
// #endif
src.value = url
}
const hasError = ref(false)
function onError() {
if (hasError.value) {
return
}
hasError.value = true
src.value = props.src
// 清除缓存
hashCacheKey.value && uni.removeStorageSync(hashCacheKey.value)
console.warn('CacheImage cache error')
}
</script>
<template>
<fui-lazyload
:mode="props.mode"
:width="props.width"
:height="props.height"
:radius="props.radius"
:src="src"
@error="onError"
/>
</template>
<template>
<view class="empty" :style="[{ background: bgColor }]">
<!-- 暂无数据/空数据 -->
<image src="../../static/images/empty.png" />
<!-- 提示内容 -->
<view class="empty-tips" :style="[{ color: tipsColor }]">{{ tips }}</view>
</view>
</template>
<script> <script>
export default { export default {
props: { props: {
...@@ -24,6 +16,16 @@ ...@@ -24,6 +16,16 @@
}, },
} }
</script> </script>
<template>
<view class="empty" :style="[{ background: bgColor }]">
<!-- 暂无数据/空数据 -->
<image src="../../static/images/empty.png" />
<!-- 提示内容 -->
<view class="empty-tips" :style="[{ color: tipsColor }]">{{ tips }}</view>
</view>
</template>
<style> <style>
.empty { .empty {
width: 100%; width: 100%;
......
<script setup lang="ts">
const props = defineProps({
icon: {
type: String,
required: true,
},
size: {
type: [Number, String],
default: 32,
},
color: {
type: String,
default: '#000',
},
})
const size = computed(() => `${props.size}rpx`)
const color = computed(() => props.color)
</script>
<template>
<view class="icon" />
</template>
<style lang="less" scoped>
.icon {
width: v-bind(size);
height: v-bind(size);
color: v-bind(color);
}
</style>
<script lang="ts" setup>
import type { PropType } from 'vue'
import { nanoid } from 'nanoid'
import { getPoster, isImage, isVideo } from './utils'
type Asset = Recordable & { url: string }
const props = defineProps({
width: {
type: [String, Number],
default: '96',
},
height: {
type: [String, Number],
default: '96',
},
mode: {
type: String,
default: 'aspectFit',
},
background: {
type: String,
default: '#F7F7f7',
},
assets: {
type: Array as PropType<Asset[]>,
},
})
// 生成预览容器高度
const containerHeight = `${props.height}rpx`
// 分离图片和视频资源地址
const images = computed(() => props.assets.filter((item) => isImage(item.url)))
const videos = computed(() => props.assets.filter((item) => isVideo(item.url)))
// 预览图片
const preview = (index: number) => {
uni.previewImage({
urls: images.value.map((item) => item.url),
current: index,
})
}
// 初始化视频组件配置
const videoId = nanoid()
const videoContext = ref()
const playVideoSrc = ref()
// 播放视频
const play = (index: number) => {
playVideoSrc.value = videos.value[index].url
videoContext.value?.requestFullScreen()
videoContext.value?.play()
}
const videoFullScreenChange = (e: any) => {
// 非全屏状态下停止播放
if (!e.detail.fullScreen) {
videoContext.value.seek(0)
videoContext.value.pause()
}
}
onMounted(() => {
// 初始化视频组件上下文对象
videoContext.value = uni.createVideoContext(videoId)
})
</script>
<template>
<view class="preview-wrap">
<!-- 视频预览 -->
<fui-lazyload
class="preview-video"
:background="props.background"
:mode="props.mode"
v-for="(item, index) in videos"
:key="item.url"
:src="getPoster(item.url)"
:width="props.width"
:height="props.height"
:radius="10"
@tap="play(index)"
>
<view class="icon-wrap" :style="{ width: props.width, height: props.height }">
<fui-icon class="video-play-icon" name="suspend" size="40" color="#fff" />
</view>
</fui-lazyload>
<!-- 图片预览 -->
<fui-lazyload
class="preview-image"
:background="props.background"
:mode="props.mode"
v-for="(item, index) in images"
:key="item.url"
:src="getPoster(item.url)"
:width="props.width"
:height="props.height"
:radius="10"
@tap="preview(index)"
/>
<!-- 视频 -->
<video
:id="videoId"
:src="playVideoSrc"
class="video"
autoplay
controls
@fullscreenchange="videoFullScreenChange"
></video>
</view>
</template>
<style lang="less" scoped>
.preview-wrap {
display: flex;
flex-wrap: wrap;
margin: -10rpx;
.preview-image,
.preview-video {
margin: 10rpx !important;
position: relative;
:deep(.fui-lazyload__img) {
height: v-bind(containerHeight) !important;
}
.icon-wrap {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
border-radius: 10rpx;
.video-play-icon {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
}
}
.video {
position: absolute;
top: -999999px;
}
}
</style>
export type FileType = 'image' | 'video' | 'audio'
export function isImage(url: string) {
return /\.(png|jpe?g|webp|tif?f|avif|gif|svg)(\?.*)?$/i.test(url)
}
export function isVideo(url: string) {
return /\.(mp4|flv|mov|mkv|mpeg|mpg|wmv|m3u8)(\?.*)?$/i.test(url)
}
export function isAudio(url: string) {
return /\.(mp3|wav|ogg|aac|flac)(\?.*)?$/i.test(url)
}
export function getPoster(url: string) {
if (!isVideo(url)) {
return url
}
return `${url}.jpg`
}
<!--本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号: 1 5 6 1 6 2 60195,身份证尾号: 503 75T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。-->
<template> <template>
<view @touchmove.stop.prevent="stop" v-if="isShow || !isNvue"> <view @touchmove.stop.prevent="stop" v-if="isShow || !isNvue">
<view class="fui-actionsheet__mask" :class="{'fui-actionsheet__mask-show':show}" ref="fui_asm_ani" <view class="fui-actionsheet__mask" :class="{'fui-actionsheet__mask-show':show}" ref="fui_asm_ani"
...@@ -214,8 +213,9 @@ ...@@ -214,8 +213,9 @@
let iphonex = false; let iphonex = false;
let models = ['iphonex', 'iphonexr', 'iphonexsmax', 'iphone11', 'iphone11pro', 'iphone11promax', let models = ['iphonex', 'iphonexr', 'iphonexsmax', 'iphone11', 'iphone11pro', 'iphone11promax',
'iphone12', 'iphone12mini', 'iphone12pro', 'iphone12promax', 'iphone13', 'iphone13mini', 'iphone12', 'iphone12mini', 'iphone12pro', 'iphone12promax', 'iphone13', 'iphone13mini',
'iphone13pro', 'iphone13promax', 'iphone14', 'iphone14mini', 'iphone13pro', 'iphone13promax', 'iphone14', 'iphone14mini', 'iphone14plus',
'iphone14pro', 'iphone14promax' 'iphone14pro', 'iphone14promax', 'iphone15', 'iphone15mini', 'iphone15plus',
'iphone15pro', 'iphone15promax'
] ]
const model = res.model.replace(/\s/g, "").toLowerCase() const model = res.model.replace(/\s/g, "").toLowerCase()
const newModel = model.split('<')[0] const newModel = model.split('<')[0]
...@@ -306,11 +306,12 @@ ...@@ -306,11 +306,12 @@
.fui-actionsheet__btn { .fui-actionsheet__btn {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
width: 100%; width: 100%;
box-sizing: content-box;
/* #endif */ /* #endif */
flex: 1;
height: 100rpx; height: 100rpx;
/* #ifdef APP-NVUE */ /* #ifdef APP-NVUE */
line-height: 100rpx; line-height: 100rpx;
flex: 1;
/* #endif */ /* #endif */
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
...@@ -431,4 +432,4 @@ ...@@ -431,4 +432,4 @@
opacity: 1; opacity: 1;
/* #endif */ /* #endif */
} }
</style> </style>
\ No newline at end of file
<!--本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号:1 56 16 2 60 1 95,身份证尾号:5 0 3 75T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。-->
<template> <template>
<view class="fui-alert__wrap" :class="[background?'':('fui-alert__'+type)]" <view class="fui-alert__wrap" :class="[background?'':('fui-alert__'+type)]"
:style="{background:background || getColor(type),borderRadius:radius,paddingTop:padding[0] || 0,paddingRight:padding[1]||0,paddingBottom:padding[2] || padding[0]||0,paddingLeft:padding[3] || padding[1]||0,marginTop:marginTop+'rpx',marginBottom:marginBottom+'rpx'}"> :style="{background:background || getColor(type),borderRadius:radius,paddingTop:padding[0] || 0,paddingRight:padding[1]||0,paddingBottom:padding[2] || padding[0]||0,paddingLeft:padding[3] || padding[1]||0,marginTop:marginTop+'rpx',marginBottom:marginBottom+'rpx'}">
...@@ -240,4 +239,4 @@ ...@@ -240,4 +239,4 @@
cursor: pointer; cursor: pointer;
/* #endif */ /* #endif */
} }
</style> </style>
\ No newline at end of file
<!--本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号: 1 56 16 2 6 019 5,身份证尾号:5 0 3 75T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。-->
<template> <template>
<view class="fui-popup__animation" :class="[ani.in]" :style="'transform:' + transform + ';' + stylesObject" <view class="fui-popup__animation" :class="[ani.in]" :style="'transform:' + transform + ';' + stylesObject"
@tap="change" v-if="isShow" ref="fui_ani"> @tap="change" v-if="isShow" ref="fui_ani">
...@@ -38,18 +37,7 @@ ...@@ -38,18 +37,7 @@
styles: { styles: {
type: Object, type: Object,
default () { default () {
return { return {}
position: 'fixed',
bottom: 0,
top: 0,
left: 0,
right: 0,
// #ifndef APP-NVUE
display: 'flex',
// #endif
'justify-content': 'center',
'align-items': 'center'
};
} }
} }
}, },
...@@ -77,8 +65,22 @@ ...@@ -77,8 +65,22 @@
}, },
computed: { computed: {
stylesObject() { stylesObject() {
let styles = { //默认值
...this.styles, const defStyles = {
position: 'fixed',
bottom: 0,
top: 0,
left: 0,
right: 0,
// #ifndef APP-NVUE
display: 'flex',
// #endif
'justify-content': 'center',
'align-items': 'center'
};
const mergeStyles = Object.assign({}, defStyles, this.styles);
const styles = {
...mergeStyles,
'transition-duration': this.duration / 1000 + 's' 'transition-duration': this.duration / 1000 + 's'
}; };
let transfrom = ''; let transfrom = '';
...@@ -212,4 +214,4 @@ ...@@ -212,4 +214,4 @@
.fui-popup__fade-in { .fui-popup__fade-in {
opacity: 1; opacity: 1;
} }
</style> </style>
\ No newline at end of file
...@@ -8,13 +8,19 @@ ...@@ -8,13 +8,19 @@
</gcanvas> </gcanvas>
<!-- #endif --> <!-- #endif -->
<!-- #ifndef APP-NVUE || MP-TOUTIAO--> <!-- #ifndef APP-NVUE || MP-TOUTIAO || MP-QQ-->
<canvas :disable-scroll="!completed" :canvas-id="canvasId" :id="canvasId" @touchstart="onTouchstart" <canvas :disable-scroll="!completed" :canvas-id="canvasId" :id="canvasId" @touchstart="onTouchstart"
@touchmove="onTouchmove" @touchend="onTouchend" @touchcancel="onTouchCancel" @touchmove="onTouchmove" @touchend="onTouchend" @touchcancel="onTouchCancel"
:style="{width:w+'px',height:h+'px'}" @mousedown="mousedown" @mousemove="mousemove" @mouseup="mouseup" :style="{width:w+'px',height:h+'px'}" @mousedown="mousedown" @mousemove="mousemove" @mouseup="mouseup"
@mouseleave="mouseleave"></canvas> @mouseleave="mouseleave"></canvas>
<!-- #endif --> <!-- #endif -->
<!-- #ifdef MP-QQ -->
<canvas :disable-scroll="!completed" canvas-id="canvas_autograph" @touchstart="onTouchstart"
@touchmove="onTouchmove" @touchend="onTouchend" @touchcancel="onTouchCancel"
:style="{width:w+'px',height:h+'px'}" ></canvas>
<!-- #endif -->
<!-- #ifdef MP-TOUTIAO --> <!-- #ifdef MP-TOUTIAO -->
<canvas :disable-scroll="!completed" :canvas-id="canvasId" :id="canvasId" @touchstart="onTouchstart" <canvas :disable-scroll="!completed" :canvas-id="canvasId" :id="canvasId" @touchstart="onTouchstart"
@touchmove.stop.prevent="onTouchmove" @touchend="onTouchend" @touchcancel="onTouchCancel" @touchmove.stop.prevent="onTouchmove" @touchend="onTouchend" @touchcancel="onTouchCancel"
...@@ -62,7 +68,11 @@ ...@@ -62,7 +68,11 @@
tips: { tips: {
type: String, type: String,
default: '请签名!' default: '请签名!'
} },
suffix: {
type: String,
default: 'png'
},
}, },
watch: { watch: {
width(val) { width(val) {
...@@ -77,16 +87,19 @@ ...@@ -77,16 +87,19 @@
} }
}, },
data() { data() {
// #ifndef MP-WEIXIN // #ifndef MP-WEIXIN || MP-QQ
const canvasId = `fui_ag_${Math.ceil(Math.random() * 10e5).toString(36)}` const canvasId = `fui_ag_${Math.ceil(Math.random() * 10e5).toString(36)}`
// #endif // #endif
// #ifdef MP-QQ
const canvasId = 'canvas_autograph'
// #endif
return { return {
// #ifdef APP-NVUE // #ifdef APP-NVUE
isAndroid: true, isAndroid: true,
nTop: 0, nTop: 0,
nLeft: 0, nLeft: 0,
// #endif // #endif
canvasId:canvasId, canvasId: canvasId,
w: 300, w: 300,
h: 200, h: 200,
completed: false, completed: false,
...@@ -302,7 +315,7 @@ ...@@ -302,7 +315,7 @@
x: 0, x: 0,
y: 0, y: 0,
canvasId: this.canvasId, canvasId: this.canvasId,
fileType: 'png', fileType: this.suffix,
quality: 1, quality: 1,
success: function(res) { success: function(res) {
callback && callback(res.tempFilePath) callback && callback(res.tempFilePath)
...@@ -321,7 +334,7 @@ ...@@ -321,7 +334,7 @@
this.h * 2, this.h * 2,
this.w * 2, this.w * 2,
this.h * 2, this.h * 2,
"png", this.suffix,
1, 1,
function(res) { function(res) {
callback && callback(res.tempFilePath) callback && callback(res.tempFilePath)
...@@ -337,4 +350,4 @@ ...@@ -337,4 +350,4 @@
} }
</script> </script>
<style scoped></style> <style scoped></style>
\ No newline at end of file
// 本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号: 15 6162 6019 5,身份证尾号: 5037 5T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
const isWeex = typeof WXEnvironment !== 'undefined'; const isWeex = typeof WXEnvironment !== 'undefined';
const isWeexIOS = isWeex && /ios/i.test(WXEnvironment.platform); const isWeexIOS = isWeex && /ios/i.test(WXEnvironment.platform);
const isWeexAndroid = isWeex && !isWeexIOS; const isWeexAndroid = isWeex && !isWeexIOS;
...@@ -239,4 +238,4 @@ const GBridge = { ...@@ -239,4 +238,4 @@ const GBridge = {
} }
} }
export default GBridge; export default GBridge;
\ No newline at end of file
// 本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号: 15 61 62 60 19 5,身份证尾号: 5 0 3 75T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
class FillStyleLinearGradient { class FillStyleLinearGradient {
constructor(x0, y0, x1, y1) { constructor(x0, y0, x1, y1) {
...@@ -16,4 +15,4 @@ class FillStyleLinearGradient { ...@@ -16,4 +15,4 @@ class FillStyleLinearGradient {
} }
} }
export default FillStyleLinearGradient; export default FillStyleLinearGradient;
\ No newline at end of file
// 本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号: 1 561 6 26 01 95,身份证尾号:5 03 7 5T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
class FillStylePattern { class FillStylePattern {
constructor(img, pattern) { constructor(img, pattern) {
this._style = pattern; this._style = pattern;
...@@ -6,4 +5,4 @@ class FillStylePattern { ...@@ -6,4 +5,4 @@ class FillStylePattern {
} }
} }
export default FillStylePattern; export default FillStylePattern;
\ No newline at end of file
// 本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号:156 1 6 2 601 9 5,身份证尾号:5 0 375T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
class FillStyleRadialGradient { class FillStyleRadialGradient {
constructor(x0, y0, r0, x1, y1, r1) { constructor(x0, y0, r0, x1, y1, r1) {
this._start_pos = { _x: x0, _y: y0, _r: r0 }; this._start_pos = { _x: x0, _y: y0, _r: r0 };
...@@ -15,4 +14,4 @@ class FillStyleRadialGradient { ...@@ -15,4 +14,4 @@ class FillStyleRadialGradient {
} }
} }
export default FillStyleRadialGradient; export default FillStyleRadialGradient;
\ No newline at end of file
// 本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号:156 1 62 60 1 9 5,身份证尾号: 50 375T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
import FillStylePattern from './FillStylePattern'; import FillStylePattern from './FillStylePattern';
import FillStyleLinearGradient from './FillStyleLinearGradient'; import FillStyleLinearGradient from './FillStyleLinearGradient';
import FillStyleRadialGradient from './FillStyleRadialGradient'; import FillStyleRadialGradient from './FillStyleRadialGradient';
...@@ -664,4 +663,4 @@ export default class CanvasRenderingContext2D { ...@@ -664,4 +663,4 @@ export default class CanvasRenderingContext2D {
} }
}); });
} }
} }
\ No newline at end of file
// 本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号:1 56 1 626 0 19 5,身份证尾号:50 3 7 5T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
export default class WebGLActiveInfo { export default class WebGLActiveInfo {
className = 'WebGLActiveInfo'; className = 'WebGLActiveInfo';
...@@ -9,4 +8,4 @@ export default class WebGLActiveInfo { ...@@ -9,4 +8,4 @@ export default class WebGLActiveInfo {
this.name = name; this.name = name;
this.size = size; this.size = size;
} }
} }
\ No newline at end of file
// 本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号: 1 561 6 26 01 95,身份证尾号: 5037 5T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
import {getTransferedObjectUUID} from './classUtils'; import {getTransferedObjectUUID} from './classUtils';
const name = 'WebGLBuffer'; const name = 'WebGLBuffer';
...@@ -19,4 +18,4 @@ export default class WebGLBuffer { ...@@ -19,4 +18,4 @@ export default class WebGLBuffer {
uuid() { uuid() {
return uuid(this.id); return uuid(this.id);
} }
} }
\ No newline at end of file
// 本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号:1 5 61 626 0 195,身份证尾号:503 7 5T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
import {getTransferedObjectUUID} from './classUtils'; import {getTransferedObjectUUID} from './classUtils';
const name = 'WebGLFrameBuffer'; const name = 'WebGLFrameBuffer';
...@@ -19,4 +18,4 @@ export default class WebGLFramebuffer { ...@@ -19,4 +18,4 @@ export default class WebGLFramebuffer {
uuid() { uuid() {
return uuid(this.id); return uuid(this.id);
} }
} }
\ No newline at end of file
// 本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号: 1 56 16 26 01 95,身份证尾号: 50 3 75T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
export default { export default {
"DEPTH_BUFFER_BIT": 256, "DEPTH_BUFFER_BIT": 256,
"STENCIL_BUFFER_BIT": 1024, "STENCIL_BUFFER_BIT": 1024,
...@@ -296,4 +295,4 @@ export default { ...@@ -296,4 +295,4 @@ export default {
"CONTEXT_LOST_WEBGL": 37442, "CONTEXT_LOST_WEBGL": 37442,
"UNPACK_COLORSPACE_CONVERSION_WEBGL": 37443, "UNPACK_COLORSPACE_CONVERSION_WEBGL": 37443,
"BROWSER_DEFAULT_WEBGL": 37444 "BROWSER_DEFAULT_WEBGL": 37444
}; };
\ No newline at end of file
// 本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号:15 61 6 2 60 1 95,身份证尾号: 5 0375T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
let i = 1; let i = 1;
const GLmethod = {}; const GLmethod = {};
...@@ -140,4 +139,4 @@ GLmethod.vertexAttrib4fv = i++; //new ...@@ -140,4 +139,4 @@ GLmethod.vertexAttrib4fv = i++; //new
GLmethod.vertexAttribPointer = i++; GLmethod.vertexAttribPointer = i++;
GLmethod.viewport = i++; GLmethod.viewport = i++;
export default GLmethod; export default GLmethod;
\ No newline at end of file
// 本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号: 1 561 6 2 60195,身份证尾号: 5037 5T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
const GLtype = {}; const GLtype = {};
[ [
...@@ -19,5 +18,3 @@ const GLtype = {}; ...@@ -19,5 +18,3 @@ const GLtype = {};
].sort().map((typeName, i) => GLtype[typeName] = 1 >> (i + 1)); ].sort().map((typeName, i) => GLtype[typeName] = 1 >> (i + 1));
export default GLtype; export default GLtype;
// 本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号: 156162 60 1 95,身份证尾号:5 0375T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
import {getTransferedObjectUUID} from './classUtils'; import {getTransferedObjectUUID} from './classUtils';
const name = 'WebGLProgram'; const name = 'WebGLProgram';
...@@ -19,4 +18,4 @@ export default class WebGLProgram { ...@@ -19,4 +18,4 @@ export default class WebGLProgram {
uuid() { uuid() {
return uuid(this.id); return uuid(this.id);
} }
} }
\ No newline at end of file
// 本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号: 1 5616 26 01 9 5,身份证尾号: 503 75T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
import {getTransferedObjectUUID} from './classUtils'; import {getTransferedObjectUUID} from './classUtils';
const name = 'WebGLRenderBuffer'; const name = 'WebGLRenderBuffer';
...@@ -19,4 +18,4 @@ export default class WebGLRenderbuffer { ...@@ -19,4 +18,4 @@ export default class WebGLRenderbuffer {
uuid() { uuid() {
return uuid(this.id); return uuid(this.id);
} }
} }
\ No newline at end of file
// 本文件由FirstUI授权予长沙壹润信息科技发展有限公司(手机号: 1 5616 2 6 01 9 5,身份证尾号:503 7 5T)专用,请尊重知识产权,勿私下传播,违者追究法律责任。
import GLenum from './GLenum'; import GLenum from './GLenum';
import ActiveInfo from './ActiveInfo'; import ActiveInfo from './ActiveInfo';
import Buffer from './Buffer'; import Buffer from './Buffer';
...@@ -1189,4 +1188,4 @@ export default class WebGLRenderingContext { ...@@ -1189,4 +1188,4 @@ export default class WebGLRenderingContext {
true true
) )
} }
} }
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论