minitest2.0 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/.editorconfig +8 -0
  2. package/.env.development +3 -0
  3. package/.env.production +3 -0
  4. package/.env.test +3 -0
  5. package/.gitattributes +1 -0
  6. package/.oxlintrc.json +10 -0
  7. package/.prettierrc.json +6 -0
  8. package/.vscode/extensions.json +9 -0
  9. package/.vscode/settings.json +13 -0
  10. package/README.md +179 -0
  11. package/auto-imports.d.ts +629 -0
  12. package/components.d.ts +21 -0
  13. package/design-qa.md +36 -0
  14. package/docs/MX_API.md +244 -0
  15. package/docs/REQUEST.md +217 -0
  16. package/docs/jsapi.js +515 -0
  17. package/docs/package-json-guide.md +132 -0
  18. package/env.d.ts +15 -0
  19. package/eslint.config.ts +26 -0
  20. package/index.html +16 -0
  21. package/package.json +83 -0
  22. package/plugins/bump-version.ts +61 -0
  23. package/postcss.config.ts +15 -0
  24. package/public/favicon.ico +0 -0
  25. package/public/images/12a73787-86a9-4891-a65f-66104746f6a8.png +0 -0
  26. package/public/images/5798d7aa-ba8b-4605-8079-58b35495ac55.png +0 -0
  27. package/public/images/73fef1e4-0fd0-4a1a-9b8b-a70a5b6acbbc.png +0 -0
  28. package/public/images/bc685b4c-0cca-4a79-924c-a8ee10e6f8eb.png +0 -0
  29. package/public/images/c3dbbd9d-be56-490e-b9f4-6ee17ebefffc.png +0 -0
  30. package/public/images/ea745a10-42aa-4f44-8d7f-3ab02cc0adcd.png +0 -0
  31. package/public/images/f5876785-b927-4347-ba19-999114240649.png +0 -0
  32. package/public/images/img.png +0 -0
  33. package/public/images/opening-reserve-estimate.png +0 -0
  34. package/public/images/position-estimate-report.png +0 -0
  35. package/src/App.vue +131 -0
  36. package/src/api/announcement.ts +405 -0
  37. package/src/api/health.ts +13 -0
  38. package/src/api/pbc-position.ts +178 -0
  39. package/src/api/rmb-position.ts +233 -0
  40. package/src/api/tam.ts +173 -0
  41. package/src/api/user.ts +92 -0
  42. package/src/auto-imports.d.ts +633 -0
  43. package/src/components/AppTitleBar.vue +376 -0
  44. package/src/components.d.ts +33 -0
  45. package/src/config/config.properties +3 -0
  46. package/src/config/env.ts +6 -0
  47. package/src/config/plugin.properties.pro +6 -0
  48. package/src/config/plugin.properties.test +6 -0
  49. package/src/core/mxApi/index.ts +451 -0
  50. package/src/core/request/index.ts +135 -0
  51. package/src/main.ts +40 -0
  52. package/src/router/index.ts +144 -0
  53. package/src/stores/app.ts +103 -0
  54. package/src/stores/counter.ts +12 -0
  55. package/src/stores/user.ts +137 -0
  56. package/src/styles/nprogress.css +22 -0
  57. package/src/styles/vant-overrides.css +42 -0
  58. package/src/types/api.d.ts +14 -0
  59. package/src/types/nprogress.d.ts +8 -0
  60. package/src/utils/auth-token.ts +241 -0
  61. package/src/utils/code-highlight.ts +165 -0
  62. package/src/utils/copy.ts +36 -0
  63. package/src/utils/query.ts +27 -0
  64. package/src/utils/request.ts +238 -0
  65. package/src/utils/rmb-forecast.ts +84 -0
  66. package/src/utils/toast.ts +61 -0
  67. package/src/views/article-detail/index.vue +289 -0
  68. package/src/views/article-edit/index.vue +600 -0
  69. package/src/views/articles/index.vue +293 -0
  70. package/src/views/clearing-detail/index.vue +26 -0
  71. package/src/views/dashboard/index.vue +18 -0
  72. package/src/views/foreign-position/index.vue +26 -0
  73. package/src/views/home/index.vue +213 -0
  74. package/src/views/login/index.vue +275 -0
  75. package/src/views/mine/index.vue +147 -0
  76. package/src/views/net-debit/index.vue +26 -0
  77. package/src/views/opening-reserve-estimate/index.vue +28 -0
  78. package/src/views/pbc-position/index.vue +357 -0
  79. package/src/views/position-estimate/index.vue +67 -0
  80. package/src/views/position-estimate-report/index.vue +28 -0
  81. package/src/views/rmb-position/index.vue +1013 -0
  82. package/src/views/rmb-position-create/index.vue +221 -0
  83. package/src/views/rmb-position-detail/index.vue +355 -0
  84. package/src/views/settings/index.vue +67 -0
  85. package/src/views/warning/index.vue +26 -0
  86. package/tsconfig.app.json +18 -0
  87. package/tsconfig.json +11 -0
  88. package/tsconfig.node.json +28 -0
  89. package/vite.config.ts +100 -0
package/package.json ADDED
@@ -0,0 +1,83 @@
1
+ {
2
+ "name": "minitest2.0",
3
+ "version": "0.0.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "dev:test": "vite --mode test",
9
+ "build": "run-p type-check \"build-only {@}\" --",
10
+ "build:test": "run-s type-check build-only:test",
11
+ "build:prod": "run-s type-check build-only:prod",
12
+ "preview": "vite preview",
13
+ "build-only": "vite build",
14
+ "build-only:test": "vite build --mode test",
15
+ "build-only:prod": "vite build --mode production",
16
+ "type-check": "vue-tsc --build",
17
+ "lint": "run-s lint:*",
18
+ "lint:oxlint": "oxlint . --fix",
19
+ "lint:eslint": "eslint . --fix --cache",
20
+ "format": "prettier --write --experimental-cli src/",
21
+ "发布": "npm publish",
22
+ "修订 ": "npm version patch",
23
+ "次版本": "npm version minor",
24
+ "主版本": "npm version major",
25
+ "登录": "npm login ",
26
+ "一键发布": "npm version patch && npm publish"
27
+ },
28
+ "dependencies": {
29
+ "@iconify/vue": "^5.0.1",
30
+ "@vueuse/core": "^14.3.0",
31
+ "adm-zip": "^0.5.18",
32
+ "axios": "^1.18.1",
33
+ "clipboard": "^2.0.11",
34
+ "crypto-js": "^4.2.0",
35
+ "dayjs": "^1.11.21",
36
+ "nprogress": "^0.2.0",
37
+ "pinia": "^3.0.4",
38
+ "pinia-plugin-persistedstate": "^4.7.1",
39
+ "qrcode": "^1.5.4",
40
+ "vant": "^4.10.0",
41
+ "vconsole": "^3.15.1",
42
+ "vue": "^3.5.39",
43
+ "vue-router": "^5.1.0"
44
+ },
45
+ "devDependencies": {
46
+ "@tsconfig/node24": "^24.0.4",
47
+ "@types/adm-zip": "^0.5.8",
48
+ "@types/node": "^26.0.1",
49
+ "@vitejs/plugin-vue": "^6.0.7",
50
+ "@vue/eslint-config-typescript": "^14.9.0",
51
+ "@vue/tsconfig": "^0.9.1",
52
+ "eslint": "^10.6.0",
53
+ "eslint-config-prettier": "^10.1.8",
54
+ "eslint-plugin-oxlint": "~1.72.0",
55
+ "eslint-plugin-vue": "~10.9.2",
56
+ "jiti": "^2.7.0",
57
+ "less": "^4.6.7",
58
+ "npm-run-all2": "^9.0.2",
59
+ "oxlint": "~1.72.0",
60
+ "postcss-px-to-viewport-8-plugin": "^1.2.5",
61
+ "prettier": "3.9.4",
62
+ "typescript": "~6.0.3",
63
+ "unplugin-auto-import": "^21.0.0",
64
+ "unplugin-vue-components": "^32.1.0",
65
+ "vite": "^8.1.2",
66
+ "vite-plugin-vue-devtools": "^8.1.5",
67
+ "vue-tsc": "^3.3.6"
68
+ },
69
+ "engines": {
70
+ "node": "^20.19.0 || >=22.12.0"
71
+ },
72
+ "keywords": [
73
+ "express",
74
+ "web",
75
+ "application"
76
+ ],
77
+ "publishConfig": {
78
+ "access": "public",
79
+ "registry": "https://registry.npmjs.org"
80
+ },
81
+ "author": "",
82
+ "license": "ISC"
83
+ }
@@ -0,0 +1,61 @@
1
+ import { readFileSync, writeFileSync, cpSync, rmSync } from 'node:fs'
2
+ import { resolve, basename } from 'node:path'
3
+ import type { Plugin } from 'vite'
4
+ import AdmZip from 'adm-zip'
5
+
6
+ /**
7
+ * 打包时自增版本号、复制配置文件、压缩 dist 为 zip
8
+ */
9
+ export function bumpVersion(mode: string): Plugin {
10
+ return {
11
+ name: 'bump-version-and-copy',
12
+ writeBundle(options) {
13
+ const outDir = options.dir
14
+ if (!outDir) return
15
+
16
+ const suffix = mode === 'production' ? 'pro' : 'test'
17
+ const src = `src/config/plugin.properties.${suffix}`
18
+
19
+ let content = readFileSync(src, 'utf-8')
20
+ const match = content.match(/version_code=(\d+)/)
21
+ if (!match) return
22
+
23
+ const oldCode = Number(match[1])
24
+ const newCode = oldCode + 1
25
+
26
+ // 版本号规则:5位 version_code → 4位版本名
27
+ // version_code: ABCDD A=major B=minor C=patch DD=hotfix
28
+ // version_name: A.B.C.DD 示例 66102 → 6.6.1.02
29
+ const major = Math.floor(newCode / 10000)
30
+ const minor = Math.floor((newCode / 1000) % 10)
31
+ const patch = Math.floor((newCode / 100) % 10)
32
+ const hotfix = String(newCode % 100).padStart(2, '0')
33
+ const versionName = `${major}.${minor}.${patch}.${hotfix}`
34
+
35
+ content = content
36
+ .replace(/version_code=\d+/, `version_code=${newCode}`)
37
+ .replace(/version_name=[^;\n]+/, `version_name=${versionName}`)
38
+
39
+ writeFileSync(src, content)
40
+ writeFileSync(resolve(outDir, '..', 'plugin.properties'), content)
41
+
42
+ // 复制 config.properties 到 dist/www/
43
+ cpSync('src/config/config.properties', resolve(outDir, 'config.properties'))
44
+
45
+ console.log(`[plugin.properties] version: ${oldCode} → ${newCode} (${versionName})`)
46
+
47
+ // 压缩 dist 为 zip(使用 adm-zip,跨平台兼容)
48
+ const distDir = resolve(outDir, '..')
49
+ const zipName = `dist_${newCode}.zip`
50
+ const zipPath = resolve(distDir, zipName)
51
+ const zip = new AdmZip()
52
+
53
+ zip.addLocalFolder(resolve(distDir, 'www'), 'www')
54
+ zip.addLocalFile(resolve(distDir, 'plugin.properties'))
55
+
56
+ rmSync(zipPath, { force: true })
57
+ zip.writeZip(zipPath)
58
+ console.log(`[zip] 已生成 ${basename(distDir)}/${zipName}`)
59
+ },
60
+ }
61
+ }
@@ -0,0 +1,15 @@
1
+ import pxToViewport from 'postcss-px-to-viewport-8-plugin'
2
+
3
+ export default {
4
+ plugins: [
5
+ pxToViewport({
6
+ viewportWidth: 375,
7
+
8
+ viewportUnit: 'vw',
9
+
10
+ unitPrecision: 6,
11
+
12
+ minPixelValue: 2,
13
+ }),
14
+ ],
15
+ }
Binary file
Binary file
package/src/App.vue ADDED
@@ -0,0 +1,131 @@
1
+ <script setup lang="ts">
2
+ import AppTitleBar from '@/components/AppTitleBar.vue'
3
+ import { useAppStore } from '@/stores/app'
4
+
5
+ const route = useRoute()
6
+ const router = useRouter()
7
+ const appStore = useAppStore()
8
+
9
+ const baseTabItems = [
10
+ { title: '首页', path: '/', icon: 'wap-home-o' },
11
+ { title: '看板', path: '/dashboard', icon: 'chart-trending-o' },
12
+ { title: '公告', path: '/articles', icon: 'records-o' },
13
+ { title: '我的', path: '/mine', icon: 'manager-o' },
14
+ ]
15
+
16
+ const tabItems = computed(() =>
17
+ baseTabItems.filter((item) => {
18
+ if (item.path === '/dashboard') return appStore.showDashboardTab
19
+ if (item.path === '/articles') return appStore.showAnnouncementTab
20
+
21
+ return true
22
+ }),
23
+ )
24
+
25
+ const showTabbar = computed(() => route.meta.hideTabbar !== true)
26
+ const noBackRouteNames = new Set(['Home', 'Login', 'Dashboard', 'Articles', 'Mine'])
27
+ const headerTitle = computed(() => String(route.meta.title || ''))
28
+ const showHeaderBack = computed(() => !noBackRouteNames.has(String(route.name || '')))
29
+
30
+ const activeTab = computed(() => {
31
+ const currentPath = route.path
32
+
33
+ return tabItems.value.some((item) => item.path === currentPath) ? currentPath : ''
34
+ })
35
+
36
+ function switchTab(path: string) {
37
+ if (path !== route.path) {
38
+ router.push(path)
39
+ }
40
+ }
41
+
42
+ function goHomeFromCapsuleMenu() {
43
+ if (route.name !== 'Home') {
44
+ router.replace({ name: 'Home' })
45
+ }
46
+ }
47
+
48
+ function goSettingsFromCapsuleMenu() {
49
+ if (route.name !== 'Settings') {
50
+ router.push({ name: 'Settings' })
51
+ }
52
+ }
53
+ </script>
54
+
55
+ <template>
56
+ <div class="app-shell" :class="{ 'app-shell--with-tabbar': showTabbar }">
57
+ <AppTitleBar
58
+ :title="headerTitle"
59
+ :show-back="showHeaderBack"
60
+ @back="router.back()"
61
+ @menu-home="goHomeFromCapsuleMenu"
62
+ @menu-settings="goSettingsFromCapsuleMenu"
63
+ />
64
+
65
+ <router-view v-slot="{ Component }">
66
+ <keep-alive include="HomePage">
67
+ <component :is="Component" />
68
+ </keep-alive>
69
+ </router-view>
70
+
71
+ <van-tabbar v-if="showTabbar" :model-value="activeTab" fixed placeholder safe-area-inset-bottom>
72
+ <van-tabbar-item
73
+ v-for="item in tabItems"
74
+ :key="item.path"
75
+ :name="item.path"
76
+ :icon="item.icon"
77
+ @click="switchTab(item.path)"
78
+ >
79
+ {{ item.title }}
80
+ </van-tabbar-item>
81
+ </van-tabbar>
82
+ </div>
83
+ </template>
84
+
85
+ <style scoped>
86
+ .app-shell {
87
+ --app-title-bar-height: calc(50px + env(safe-area-inset-top, 0px));
88
+ --app-tabbar-height: calc(
89
+ var(--van-tabbar-height, 50px) + env(safe-area-inset-bottom, 0px) + var(--van-border-width, 1px)
90
+ );
91
+ --app-page-bottom-height: 0px;
92
+ --app-page-min-height: calc(100vh - var(--app-title-bar-height) - var(--app-page-bottom-height));
93
+
94
+ min-height: 100vh;
95
+ background: #f7f8fa;
96
+ }
97
+
98
+ .app-shell--with-tabbar {
99
+ --app-page-bottom-height: var(--app-tabbar-height);
100
+ }
101
+
102
+ .app-shell :deep(main) {
103
+ display: flow-root;
104
+ }
105
+
106
+ @supports (height: 100dvh) {
107
+ .app-shell {
108
+ --app-page-min-height: calc(
109
+ 100dvh - var(--app-title-bar-height) - var(--app-page-bottom-height)
110
+ );
111
+
112
+ min-height: 100dvh;
113
+ }
114
+ }
115
+
116
+ :deep(.van-tabbar) {
117
+ max-width: 750px;
118
+ left: 50%;
119
+ transform: translateX(-50%);
120
+ border-top: 1px solid #f0f1f3;
121
+ }
122
+
123
+ :deep(.van-tabbar-item) {
124
+ color: #6b7280;
125
+ font-size: 12px;
126
+ }
127
+
128
+ :deep(.van-tabbar-item--active) {
129
+ color: #f22f3d;
130
+ }
131
+ </style>