diff --git a/.env.development b/.env.development
new file mode 100644
index 0000000..37bfb7f
--- /dev/null
+++ b/.env.development
@@ -0,0 +1,9 @@
+# 页面标题
+VITE_APP_TITLE=里派基础框架
+
+# 开发环境配置
+VITE_APP_ENV='development'
+
+# 开发环境
+VITE_API_BASE='https://dev.api.leapy.cn/merchant/'
+VITE_WS_URL='wss://dev.api.leapy.cn/mms'
diff --git a/.env.production b/.env.production
new file mode 100644
index 0000000..7393827
--- /dev/null
+++ b/.env.production
@@ -0,0 +1,9 @@
+# 页面标题
+VITE_APP_TITLE=里派基础框架
+
+# 生产环境配置
+VITE_APP_ENV='production'
+
+# 生产环境
+VITE_API_BASE='https://dev.api.leapy.cn/merchant/'
+VITE_WS_URL='wss://dev.api.leapy.cn/mms'
diff --git a/.gitignore b/.gitignore
index b27f945..2b44a22 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,4 +19,5 @@ dist
*.njsproj
*.sln
*.sw?
-yarn.lock
\ No newline at end of file
+yarn.lock
+package-lock.json
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..ab19ca3
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2025 leapy
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
\ No newline at end of file
diff --git a/package.json b/package.json
index e36bc1f..a3f3a6e 100644
--- a/package.json
+++ b/package.json
@@ -50,6 +50,7 @@
"@dcloudio/uni-mp-weixin": "3.0.0-4030620241128001",
"@dcloudio/uni-mp-xhs": "3.0.0-4030620241128001",
"@dcloudio/uni-quickapp-webview": "3.0.0-4030620241128001",
+ "crypto-js": "^4.2.0",
"pinia": "^3.0.3",
"pinia-plugin-persistedstate": "^4.3.0",
"vue": "^3.4.21",
@@ -61,6 +62,7 @@
"@dcloudio/uni-cli-shared": "3.0.0-4030620241128001",
"@dcloudio/uni-stacktracey": "3.0.0-4030620241128001",
"@dcloudio/vite-plugin-uni": "3.0.0-4030620241128001",
+ "@types/crypto-js": "^4.2.2",
"@vue/runtime-core": "^3.4.21",
"@vue/tsconfig": "^0.1.3",
"typescript": "^4.9.4",
diff --git a/src/App.vue b/src/App.vue
index 6086575..6681c25 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,13 +1,8 @@
diff --git a/src/api/index.ts b/src/api/index.ts
new file mode 100644
index 0000000..e69de29
diff --git a/src/config/index.ts b/src/config/index.ts
new file mode 100644
index 0000000..e69de29
diff --git a/src/locale/en.json b/src/locale/en.json
new file mode 100644
index 0000000..c389f19
--- /dev/null
+++ b/src/locale/en.json
@@ -0,0 +1,6 @@
+{
+ "system.title": "hello",
+ "index": {
+ "title": "user"
+ }
+}
\ No newline at end of file
diff --git a/src/locales/index.ts b/src/locale/index.ts
similarity index 56%
rename from src/locales/index.ts
rename to src/locale/index.ts
index 28a35b1..c4c364f 100644
--- a/src/locales/index.ts
+++ b/src/locale/index.ts
@@ -1,7 +1,7 @@
import {createI18n} from 'vue-i18n'
-import en from './lang/en'
-import zhHans from './lang/zh-cn'
+import en from './en.json'
+import zhHans from './zh-Hans.json'
const messages = {
en,
@@ -9,9 +9,9 @@ const messages = {
}
const i18n = createI18n({
+ legacy: false,
locale: uni.getLocale(),
- messages,
- legacy: false
+ messages
})
export default i18n;
\ No newline at end of file
diff --git a/src/locale/zh-Hans.json b/src/locale/zh-Hans.json
new file mode 100644
index 0000000..b42a74b
--- /dev/null
+++ b/src/locale/zh-Hans.json
@@ -0,0 +1,6 @@
+{
+ "system.title": "你好",
+ "index": {
+ "title": "用户"
+ }
+}
\ No newline at end of file
diff --git a/src/locales/lang/en.ts b/src/locales/lang/en.ts
deleted file mode 100644
index 209604a..0000000
--- a/src/locales/lang/en.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export default {
- system: {
- title: 'hello',
- },
-}
\ No newline at end of file
diff --git a/src/locales/lang/zh-cn.ts b/src/locales/lang/zh-cn.ts
deleted file mode 100644
index 60c9b23..0000000
--- a/src/locales/lang/zh-cn.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export default {
- system: {
- title: '你好',
- },
-}
diff --git a/src/main.ts b/src/main.ts
index 28289ef..aecf6b0 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -1,8 +1,8 @@
import { createSSRApp } from "vue";
import App from "./App.vue";
-import pinia from "@/stores";
+import pinia from "@/store";
import * as Pinia from 'pinia';
-import i18n from "@/locales";
+import i18n from "@/locale";
export function createApp() {
const app = createSSRApp(App);
diff --git a/src/manifest.json b/src/manifest.json
index 309b9ec..11348e8 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -1,10 +1,12 @@
{
- "name" : "",
- "appid" : "",
+ "name" : "user",
+ "appid" : "__UNI__8385663",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
+ "locale": "zh-Hans",
"transformPx" : false,
+ "debug": true,
/* 5+App特有相关 */
"app-plus" : {
"usingComponents" : true,
@@ -50,7 +52,7 @@
"quickapp" : {},
/* 小程序特有相关 */
"mp-weixin" : {
- "appid" : "",
+ "appid" : "wxb6b7d1cc569581b2",
"setting" : {
"urlCheck" : false
},
diff --git a/src/pages.json b/src/pages.json
index 1aea851..9ec4e56 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -3,7 +3,7 @@
{
"path": "pages/index/index",
"style": {
- "navigationBarTitleText": "uni-app"
+ "navigationBarTitleText": "%system.title%"
}
}
],
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index 723df5f..984dc01 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -12,9 +12,8 @@ import {ref} from 'vue'
import {useI18n} from 'vue-i18n'
const {t, locale} = useI18n()
-const title = ref(t('system.title'))
+const title = ref(t('index.title'))
-console.log(title)
diff --git a/src/stores/index.ts b/src/store/index.ts
similarity index 100%
rename from src/stores/index.ts
rename to src/store/index.ts
diff --git a/src/utils/request.ts b/src/utils/request.ts
new file mode 100644
index 0000000..e69de29
diff --git a/src/utils/tools.ts b/src/utils/tools.ts
new file mode 100644
index 0000000..f1e0dbc
--- /dev/null
+++ b/src/utils/tools.ts
@@ -0,0 +1,62 @@
+import CryptoJS from 'crypto-js'
+
+const tools = {
+ data: {
+ set(cacheKey: string, data: any, expireIn: number = 0) {
+ let cacheValue = {
+ content: data,
+ expireIn: expireIn === 0 ? 0 : new Date().getTime() + expireIn * 1000
+ }
+ return uni.setStorageSync(cacheKey, tools.base64.encrypt(JSON.stringify(cacheValue)))
+ },
+ get(cacheKey: string) {
+ try {
+ const cacheValue = JSON.parse(tools.base64.decrypt(uni.getStorageSync(cacheKey)))
+ if (cacheValue) {
+ let nowTime = new Date().getTime()
+ if (nowTime > cacheValue.expireIn && cacheValue.expireIn !== 0) {
+ uni.removeStorageSync(cacheKey)
+ return null;
+ }
+ return cacheValue.content
+ }
+ return null
+ } catch (err) {
+ return null
+ }
+ },
+ remove(cacheKey: string) {
+ return uni.removeStorageSync(cacheKey)
+ },
+ clear() {
+ return uni.clearStorageSync()
+ }
+ },
+ base64: {
+ encrypt(data: string) {
+ return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(data))
+ },
+ decrypt(cipher: string) {
+ return CryptoJS.enc.Base64.parse(cipher).toString(CryptoJS.enc.Utf8)
+ }
+ },
+ go: async function (fn: Function) {
+ try {
+ let res = await fn
+ return [res, null]
+ } catch (err) {
+ return [null, err]
+ }
+ },
+ crypto: {
+ //MD5加密
+ MD5(data: string) {
+ return CryptoJS.MD5(data).toString()
+ },
+ },
+ objCopy: function (obj: any) {
+ return JSON.parse(JSON.stringify(obj));
+ },
+}
+
+export default tools
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
index 11fffd2..d4f3380 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -9,5 +9,5 @@
"lib": ["esnext", "dom"],
"types": ["@dcloudio/types"]
},
- "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
+ "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "src/**/*.json"]
}