diff --git a/README.md b/README.md index 02061536..d385f53a 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ ### **技术体系** - 前端:Vue3 + Vite5 + Vue-Router + Pinia + Ant Design Vue 4.X -- 移动端:uniapp + uview2.x +- 移动端:uniapp (vue3版本) + uni-ui + (同时支持APP、小程序、H5) - 后端:SpringBoot + Sa Token + Mybatis-plus + 多种数据库 - 在线预览:[https://preview.smartadmin.vip](https://preview.smartadmin.vip) - 官方文档:[https://smartadmin.vip](https://smartadmin.vip) diff --git a/smart-app/.env.development b/smart-app/.env.development new file mode 100644 index 00000000..7ae8066c --- /dev/null +++ b/smart-app/.env.development @@ -0,0 +1,3 @@ +NODE_ENV=development +VITE_APP_TITLE='SmartAdmin 开发环境(Dev)' +VITE_APP_API_URL='http://127.0.0.1:1024' \ No newline at end of file diff --git a/smart-app/.env.localhost b/smart-app/.env.localhost new file mode 100644 index 00000000..697befa3 --- /dev/null +++ b/smart-app/.env.localhost @@ -0,0 +1,3 @@ +NODE_ENV=development +VITE_APP_TITLE='SmartH5 本地环境(Local)' +VITE_APP_API_URL='http://127.0.0.1:1024' diff --git a/smart-app/.env.pre b/smart-app/.env.pre new file mode 100644 index 00000000..687cc0fa --- /dev/null +++ b/smart-app/.env.pre @@ -0,0 +1,3 @@ +NODE_ENV=production +VITE_APP_TITLE='SmartH5 预发布环境(Pre)' +VITE_APP_API_URL='https://preview.smartadmin.vip/smart-admin-api' \ No newline at end of file diff --git a/smart-app/.env.production b/smart-app/.env.production new file mode 100644 index 00000000..78defb1b --- /dev/null +++ b/smart-app/.env.production @@ -0,0 +1,3 @@ +NODE_ENV=production +VITE_APP_TITLE='SmartH5 V3.X' +VITE_APP_API_URL='https://preview.smartadmin.vip/smart-admin-api' \ No newline at end of file diff --git a/smart-app/.env.test b/smart-app/.env.test new file mode 100644 index 00000000..b7f34bae --- /dev/null +++ b/smart-app/.env.test @@ -0,0 +1,3 @@ +NODE_ENV=production +VITE_APP_TITLE='SmartH5 测试环境(Test)' +VITE_APP_API_URL='http://127.0.0.1:1024' \ No newline at end of file diff --git a/smart-app/.eslintignore b/smart-app/.eslintignore new file mode 100644 index 00000000..78e1638b --- /dev/null +++ b/smart-app/.eslintignore @@ -0,0 +1,18 @@ + +*.sh +node_modules +lib +*.md +*.woff +*.ttf +.vscode +.idea +dist +public +/docs +.husky +.local +.localhost +/bin +Dockerfile +src/assets diff --git a/smart-app/.eslintrc.cjs b/smart-app/.eslintrc.cjs new file mode 100644 index 00000000..81e7acc0 --- /dev/null +++ b/smart-app/.eslintrc.cjs @@ -0,0 +1,66 @@ +/* + * @Description: + * @Author: zhuoda + * @Date: 2021-11-05 + * @LastEditTime: 2022-07-05 + * @LastEditors: zhuoda + */ +module.exports = { + root: true, //此项是用来告诉eslint找当前配置文件不能往父级查找 + env: { + browser: true, + es2021: true, + node: true, + }, + parser: 'vue-eslint-parser', //使用vue-eslint-parser 来解析vue文件中的 template和script + parserOptions: { + ecmaVersion: 12, // 默认情况下,ESLint使用的是ECMAScript5语法,此处我们设置的选项是 es12 + sourceType: 'module', // 指定js导入的方式 + }, + extends: ['plugin:vue/vue3-essential', 'eslint:recommended', 'plugin:vue/base'], + globals: { + defineProps: 'readonly', + defineEmits: 'readonly', + defineExpose: 'readonly', + withDefaults: 'readonly', + }, + plugins: ['vue'], + rules: { + 'no-unused-vars': [ + 'error', + // we are only using this rule to check for unused arguments since TS + // catches unused variables but not args. + { varsIgnorePattern: '.*', args: 'none' }, + ], + 'space-before-function-paren': 'off', + + 'vue/attributes-order': 'off', + 'vue/one-component-per-file': 'off', + 'vue/html-closing-bracket-newline': 'off', + 'vue/max-attributes-per-line': 'off', + 'vue/multiline-html-element-content-newline': 'off', + 'vue/singleline-html-element-content-newline': 'off', + 'vue/attribute-hyphenation': 'off', + 'vue/require-default-prop': 'off', + 'vue/multi-word-component-names': [ + 'error', + { + ignores: ['index'], //需要忽略的组件名 + }, + ], + 'vue/html-self-closing': [ + 'error', + { + html: { + void: 'always', + normal: 'never', + component: 'always', + }, + svg: 'always', + math: 'always', + }, + ], + // Enable vue/script-setup-uses-vars rule + 'vue/script-setup-uses-vars': 'error', + }, +}; diff --git a/smart-app/.gitignore b/smart-app/.gitignore new file mode 100644 index 00000000..7ce6e504 --- /dev/null +++ b/smart-app/.gitignore @@ -0,0 +1,21 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +.DS_Store +dist +*.local + +# Editor directories and files +.idea +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? \ No newline at end of file diff --git a/smart-app/.prettierrc.cjs b/smart-app/.prettierrc.cjs new file mode 100644 index 00000000..d1c4ba82 --- /dev/null +++ b/smart-app/.prettierrc.cjs @@ -0,0 +1,30 @@ +/* + * 代码格式化配置 + * + * @Author: 1024创新实验室-主任:卓大 + * @Date: 2022-09-12 14:44:18 + * @Wechat: zhuda1024 + * @Email: lab1024@163.com + * @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012 + */ +module.exports = { + printWidth: 150, // 每行代码长度(默认80) + tabWidth: 2, // 缩进空格数 + useTabs: false, //不用tab缩进 + semi: true, //// 在语句末尾打印分号 + singleQuote: true, // 使用单引号而不是双引号 + vueIndentScriptAndStyle: true, //Vue文件脚本和样式标签缩进 + quoteProps: 'as-needed', // 更改引用对象属性的时间 可选值"" + jsxSingleQuote: true, // 在JSX中使用单引号而不是双引号 + trailingComma: 'es5', //多行时尽可能打印尾随逗号。(例如,单行数组永远不会出现逗号结尾。) 可选值"",默认none + bracketSpacing: true, // 在对象文字中的括号之间打印空格 + jsxBracketSameLine: false, //jsx 标签的反尖括号需要换行 + arrowParens: 'always', // 在单独的箭头函数参数周围包括括号 always:(x) => x \ avoid:x => x + rangeStart: 0, // 这两个选项可用于格式化以给定字符偏移量(分别包括和不包括)开始和结束的代码 + rangeEnd: Infinity, + requirePragma: false, // 指定要使用的解析器,不需要写文件开头的 @prettier + insertPragma: false, // 不需要自动在文件开头插入 @prettier + proseWrap: 'preserve', // 使用默认的折行标准 always\never\preserve + htmlWhitespaceSensitivity: 'css', // 指定HTML文件的全局空格敏感度 css\strict\ignore + endOfLine: 'auto', // 因为prettier的规范和eslint的换行规则不同,所以这个必须配置。要不然每次打开文件都会有一堆的警告;换行符使用 lf 结尾是 可选值" + + + + + + + + + +
+ + + diff --git a/smart-app/package.json b/smart-app/package.json new file mode 100644 index 00000000..0570a21d --- /dev/null +++ b/smart-app/package.json @@ -0,0 +1,81 @@ +{ + "name": "uni-preset-vue", + "version": "0.0.0", + "scripts": { + "dev:app": "uni -p app", + "dev:app-android": "uni -p app-android", + "dev:app-ios": "uni -p app-ios", + "dev:custom": "uni -p", + "dev:h5": "uni", + "dev:h5:ssr": "uni --ssr", + "dev:mp-alipay": "uni -p mp-alipay", + "dev:mp-baidu": "uni -p mp-baidu", + "dev:mp-jd": "uni -p mp-jd", + "dev:mp-kuaishou": "uni -p mp-kuaishou", + "dev:mp-lark": "uni -p mp-lark", + "dev:mp-qq": "uni -p mp-qq", + "dev:mp-toutiao": "uni -p mp-toutiao", + "dev:mp-weixin": "uni -p mp-weixin", + "dev:mp-xhs": "uni -p mp-xhs", + "dev:quickapp-webview": "uni -p quickapp-webview", + "dev:quickapp-webview-huawei": "uni -p quickapp-webview-huawei", + "dev:quickapp-webview-union": "uni -p quickapp-webview-union", + "build:app": "uni build -p app", + "build:app-android": "uni build -p app-android", + "build:app-ios": "uni build -p app-ios", + "build:custom": "uni build -p", + "build:h5": "uni build", + "build:h5:ssr": "uni build --ssr", + "build:mp-alipay": "uni build -p mp-alipay", + "build:mp-baidu": "uni build -p mp-baidu", + "build:mp-jd": "uni build -p mp-jd", + "build:mp-kuaishou": "uni build -p mp-kuaishou", + "build:mp-lark": "uni build -p mp-lark", + "build:mp-qq": "uni build -p mp-qq", + "build:mp-toutiao": "uni build -p mp-toutiao", + "build:mp-weixin": "uni build -p mp-weixin", + "build:mp-xhs": "uni build -p mp-xhs", + "build:quickapp-webview": "uni build -p quickapp-webview", + "build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei", + "build:quickapp-webview-union": "uni build -p quickapp-webview-union" + }, + "dependencies": { + "@dcloudio/uni-app": "3.0.0-3090920231225001", + "@dcloudio/uni-app-plus": "3.0.0-3090920231225001", + "@dcloudio/uni-components": "3.0.0-3090920231225001", + "@dcloudio/uni-h5": "3.0.0-3090920231225001", + "@dcloudio/uni-mp-alipay": "3.0.0-3090920231225001", + "@dcloudio/uni-mp-baidu": "3.0.0-3090920231225001", + "@dcloudio/uni-mp-jd": "3.0.0-3090920231225001", + "@dcloudio/uni-mp-kuaishou": "3.0.0-3090920231225001", + "@dcloudio/uni-mp-lark": "3.0.0-3090920231225001", + "@dcloudio/uni-mp-qq": "3.0.0-3090920231225001", + "@dcloudio/uni-mp-toutiao": "3.0.0-3090920231225001", + "@dcloudio/uni-mp-weixin": "3.0.0-3090920231225001", + "@dcloudio/uni-mp-xhs": "3.0.0-3090920231225001", + "@dcloudio/uni-quickapp-webview": "3.0.0-3090920231225001", + "@dcloudio/uni-ui": "1.5.0", + "lodash": "^4.17.21", + "pinia": "^2.0.36", + "vue": "3.2.47", + "vue-i18n": "9.1.9", + "sm-crypto": "0.3.13", + "crypto-js": "4.1.1" + }, + "devDependencies": { + "@dcloudio/types": "3.3.2", + "@dcloudio/uni-automator": "3.0.0-3090920231225001", + "@dcloudio/uni-cli-shared": "3.0.0-3090920231225001", + "@dcloudio/uni-stacktracey": "3.0.0-3090920231225001", + "@dcloudio/vite-plugin-uni": "3.0.0-3090920231225001", + "@vue/runtime-core": "3.2.45", + "sass": "1.69.7", + "sass-loader": "10.1.1", + "vite": "4.0.3", + "prettier": "3.0.2", + "eslint": "8.16.0", + "eslint-config-prettier": "9.0.0", + "eslint-plugin-prettier": "5.0.0", + "eslint-plugin-vue": "9.17.0" + } +} diff --git a/smart-app/shims-uni.d.ts b/smart-app/shims-uni.d.ts new file mode 100644 index 00000000..ed4adcfc --- /dev/null +++ b/smart-app/shims-uni.d.ts @@ -0,0 +1,10 @@ +/// +import 'vue' + +declare module '@vue/runtime-core' { + type Hooks = App.AppInstance & Page.PageInstance; + + interface ComponentCustomOptions extends Hooks { + + } +} diff --git a/smart-app/src/App.vue b/smart-app/src/App.vue new file mode 100644 index 00000000..f4385584 --- /dev/null +++ b/smart-app/src/App.vue @@ -0,0 +1,19 @@ + + + diff --git a/smart-app/src/api/business/goods/goods-api.js b/smart-app/src/api/business/goods/goods-api.js new file mode 100644 index 00000000..02d132b1 --- /dev/null +++ b/smart-app/src/api/business/goods/goods-api.js @@ -0,0 +1,31 @@ +/* + * @Description: + * @Author: zhuoda + * @Date: 2021-11-05 + * @LastEditTime: 2022-06-23 + * @LastEditors: zhuoda + */ +import { postRequest, getRequest } from '/@/lib/smart-request'; + +export const goodsApi = { + // 添加商品 @author zhuoda + addGoods: (param) => { + return postRequest('/goods/add', param); + }, + // 删除 @author zhuoda + deleteGoods: (goodsId) => { + return getRequest(`/goods/delete/${goodsId}`); + }, + // 批量 @author zhuoda + batchDelete: (goodsIdList) => { + return postRequest('/goods/batchDelete', goodsIdList); + }, + // 分页查询 @author zhuoda + queryGoodsList: (param) => { + return postRequest('/goods/query', param); + }, + // 更新商品 @author zhuoda + updateGoods: (param) => { + return postRequest('/goods/update', param); + }, +}; diff --git a/smart-app/src/api/business/oa/enterprise-api.js b/smart-app/src/api/business/oa/enterprise-api.js new file mode 100644 index 00000000..87cb85af --- /dev/null +++ b/smart-app/src/api/business/oa/enterprise-api.js @@ -0,0 +1,37 @@ +/* + * 企业信息 + * + * @Author: 开云 + * @Date: 2023-09-03 21:47:28 + * @Wechat: zhuda1024 + * @Email: lab1024@163.com + * @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012 + */ +import { postRequest, getRequest } from '/@/lib/smart-request'; + +export const enterpriseApi = { + // 新建企业 @author 开云 + create: (param) => { + return postRequest('/oa/enterprise/create', param); + }, + + // 查询企业详情 @author 开云 + detail: (enterpriseId) => { + return getRequest(`/oa/enterprise/get/${enterpriseId}`); + }, + + // 分页查询企业模块 @author 开云 + pageQuery: (param) => { + return postRequest('/oa/enterprise/page/query', param); + }, + + // 编辑企业 @author 开云 + update: (param) => { + return postRequest('/oa/enterprise/update', param); + }, + + // 删除企业 @author 开云 + delete: (enterpriseId) => { + return getRequest(`/oa/enterprise/delete/${enterpriseId}`); + }, +}; diff --git a/smart-app/src/api/business/oa/notice-api.js b/smart-app/src/api/business/oa/notice-api.js new file mode 100644 index 00000000..8fcd87b9 --- /dev/null +++ b/smart-app/src/api/business/oa/notice-api.js @@ -0,0 +1,33 @@ +/* + * @Description: 公告信息、企业动态 + * @version: + * @Author: zhuoda + * @Date: 2022-08-16 20:34:36 + */ +import { postRequest, getRequest } from '/@/lib/smart-request'; + +export const noticeApi = { + // ---------------- 通知公告类型 ----------------------- + + // 通知公告类型-获取全部 @author zhuoda + getAllNoticeTypeList() { + return getRequest('/oa/noticeType/getAll'); + }, + + // --------------------- 【员工】查看 通知公告 ------------------------- + + // 通知公告-员工-查看详情 @author zhuoda + view(noticeId) { + return getRequest(`/oa/notice/employee/view/${noticeId}`); + }, + + // 通知公告-员工-查询 @author zhuoda + queryEmployeeNotice(param) { + return postRequest('/oa/notice/employee/query', param); + }, + + // 【员工】通知公告-查询 查看记录 @author zhuoda + queryViewRecord(param) { + return postRequest('/oa/notice/employee/queryViewRecord', param); + }, +}; diff --git a/smart-app/src/api/support/change-log-api.js b/smart-app/src/api/support/change-log-api.js new file mode 100644 index 00000000..67727d95 --- /dev/null +++ b/smart-app/src/api/support/change-log-api.js @@ -0,0 +1,17 @@ +/** + * 系统更新日志 api 封装 + * + * @Author: 卓大 + * @Date: 2022-09-26 14:53:50 + * @Copyright 1024创新实验室 + */ +import { postRequest, getRequest } from '/@/lib/smart-request'; + +export const changeLogApi = { + /** + * 分页查询 @author 卓大 + */ + queryPage: (param) => { + return postRequest('/support/changeLog/queryPage', param); + }, +}; diff --git a/smart-app/src/api/support/dict-api.js b/smart-app/src/api/support/dict-api.js new file mode 100644 index 00000000..70fc7ec2 --- /dev/null +++ b/smart-app/src/api/support/dict-api.js @@ -0,0 +1,59 @@ +/* + * 字典 + * + * @Author: 1024创新实验室-主任:卓大 + * @Date: 2022-09-03 21:55:25 + * @Wechat: zhuda1024 + * @Email: lab1024@163.com + * @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012 + */ +import { postRequest, getRequest } from '/@/lib/smart-request'; + +export const dictApi = { + // 分页查询数据字典KEY - @author 卓大 + keyQuery: (param) => { + return postRequest('/support/dict/key/query', param); + }, + // 查询全部字典key - @author 卓大 + queryAllKey: () => { + return getRequest('/support/dict/key/queryAll'); + }, + /** + * 分页查询数据字典value - @author 卓大 + */ + valueQuery: (param) => { + return postRequest('/support/dict/value/query', param); + }, + // 数据字典KEY-添加- @author 卓大 + keyAdd: (param) => { + return postRequest('/support/dict/key/add', param); + }, + // 分页查询数据字典value - @author 卓大 + valueAdd: (param) => { + return postRequest('/support/dict/value/add', param); + }, + // 数据字典key-更新- @author 卓大 + keyEdit: (param) => { + return postRequest('/support/dict/key/edit', param); + }, + // 数据字典Value-更新- @author 卓大 + valueEdit: (param) => { + return postRequest('/support/dict/value/edit', param); + }, + // 数据字典key-删除- @author 卓大 + keyDelete: (keyIdList) => { + return postRequest('/support/dict/key/delete', keyIdList); + }, + // 数据字典Value-删除- @author 卓大 + valueDelete: (valueIdList) => { + return postRequest('/support/dict/value/delete', valueIdList); + }, + // 缓存刷新- @author 卓大 + cacheRefresh: () => { + return getRequest('/support/dict/cache/refresh'); + }, + // 数据字典-值列表- @author 卓大 + valueList: (keyCode) => { + return getRequest(`/support/dict/value/list/${keyCode}`); + }, +}; diff --git a/smart-app/src/api/system/login-api.js b/smart-app/src/api/system/login-api.js new file mode 100644 index 00000000..bbc2ba40 --- /dev/null +++ b/smart-app/src/api/system/login-api.js @@ -0,0 +1,40 @@ +/* + * 登录 + * + * @Author: 1024创新实验室-主任:卓大 + * @Date: 2022-09-03 21:59:58 + * @Wechat: zhuda1024 + * @Email: lab1024@163.com + * @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012 + */ +import { getRequest, postRequest } from '/@/lib/smart-request'; + +export const loginApi = { + /** + * 登录 @author 卓大 + */ + login: (param) => { + return postRequest('/login', param); + }, + + /** + * 退出登录 @author 卓大 + */ + logout: () => { + return getRequest('/login/logout'); + }, + + /** + * 获取验证码 @author 卓大 + */ + getCaptcha: () => { + return getRequest('/login/getCaptcha'); + }, + + /** + * 获取登录信息 @author 卓大 + */ + getLoginInfo: () => { + return getRequest('/login/getLoginInfo'); + }, +}; diff --git a/smart-app/src/components/dict-select/index.vue b/smart-app/src/components/dict-select/index.vue new file mode 100644 index 00000000..6e5b66f0 --- /dev/null +++ b/smart-app/src/components/dict-select/index.vue @@ -0,0 +1,55 @@ + + + + diff --git a/smart-app/src/components/smart-card/index.vue b/smart-app/src/components/smart-card/index.vue new file mode 100644 index 00000000..2596546f --- /dev/null +++ b/smart-app/src/components/smart-card/index.vue @@ -0,0 +1,70 @@ + + + + + \ No newline at end of file diff --git a/smart-app/src/components/smart-enum-radio/index.vue b/smart-app/src/components/smart-enum-radio/index.vue new file mode 100644 index 00000000..934f82e2 --- /dev/null +++ b/smart-app/src/components/smart-enum-radio/index.vue @@ -0,0 +1,42 @@ + + + + diff --git a/smart-app/src/components/smart-enum-select/index.vue b/smart-app/src/components/smart-enum-select/index.vue new file mode 100644 index 00000000..a0b5a988 --- /dev/null +++ b/smart-app/src/components/smart-enum-select/index.vue @@ -0,0 +1,49 @@ + + + + diff --git a/smart-app/src/components/smart-tabs/index.vue b/smart-app/src/components/smart-tabs/index.vue new file mode 100644 index 00000000..9bdfc12e --- /dev/null +++ b/smart-app/src/components/smart-tabs/index.vue @@ -0,0 +1,73 @@ + + + + + diff --git a/smart-app/src/constants/business/erp/goods-const.js b/smart-app/src/constants/business/erp/goods-const.js new file mode 100644 index 00000000..599a62d4 --- /dev/null +++ b/smart-app/src/constants/business/erp/goods-const.js @@ -0,0 +1,26 @@ +/* + * 商品 + * + * @Author: 1024创新实验室-主任:卓大 + * @Date: 2022-09-03 22:08:10 + * @Wechat: zhuda1024 + * @Email: lab1024@163.com + * @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012 + */ +export const GOODS_STATUS_ENUM = { + APPOINTMENT: { + value: 1, + desc: '预约中', + }, + SELL: { + value: 2, + desc: '售卖中', + }, + SELL_OUT: { + value: 3, + desc: '售罄', + }, +}; +export default { + GOODS_STATUS_ENUM, +}; diff --git a/smart-app/src/constants/business/oa/enterprise-const.js b/smart-app/src/constants/business/oa/enterprise-const.js new file mode 100644 index 00000000..7b8f04fa --- /dev/null +++ b/smart-app/src/constants/business/oa/enterprise-const.js @@ -0,0 +1,24 @@ +/* + * 企业 + * + * @Author: 1024创新实验室-主任:卓大 + * @Date: 2023-09-03 22:07:27 + * @Wechat: zhuda1024 + * @Email: lab1024@163.com + * @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012 + */ + +export const ENTERPRISE_TYPE_ENUM = { + NORMAL: { + value: 1, + desc: '有限企业', + }, + FOREIGN: { + value: 2, + desc: '外资企业', + }, +}; + +export default { + ENTERPRISE_TYPE_ENUM, +}; diff --git a/smart-app/src/constants/common-const.js b/smart-app/src/constants/common-const.js new file mode 100644 index 00000000..8db06ca2 --- /dev/null +++ b/smart-app/src/constants/common-const.js @@ -0,0 +1,70 @@ +/* + * 通用常量 + * + * @Author: 1024创新实验室-主任:卓大 + * @Date: 2022-09-06 19:57:29 + * @Wechat: zhuda1024 + * @Email: lab1024@163.com + * @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012 + */ + +export const PAGE_SIZE = 10; + +export const PAGE_SIZE_OPTIONS = ['5', '10', '15', '20', '30', '40', '50', '75', '100', '150', '200', '300', '500']; + +//登录页面名字 +export const PAGE_PATH_LOGIN = '/login'; + +//404页面名字 +export const PAGE_PATH_404 = '/404'; + +export const showTableTotal = function (total) { + return `共${total}条`; +}; + +export const FLAG_NUMBER_ENUM = { + TRUE: { + value: 1, + desc: '是', + }, + FALSE: { + value: 0, + desc: '否', + }, +}; + +export const GENDER_ENUM = { + UNKNOWN: { + value: 0, + desc: '未知', + }, + MAN: { + value: 1, + desc: '男', + }, + WOMAN: { + value: 2, + desc: '女', + }, +}; + +export const USER_TYPE_ENUM = { + ADMIN_EMPLOYEE: { + value: 1, + desc: '员工', + }, + +}; + +export const DATA_TYPE_ENUM = { + NORMAL: { + value: 1, + desc: '普通', + }, + ENCRYPT: { + value: 10, + desc: '加密', + }, + +}; + diff --git a/smart-app/src/constants/index.js b/smart-app/src/constants/index.js new file mode 100644 index 00000000..e502ff46 --- /dev/null +++ b/smart-app/src/constants/index.js @@ -0,0 +1,24 @@ +/* + * 所有常量入口 + * + * @Author: 1024创新实验室-主任:卓大 + * @Date: 2022-09-06 19:58:28 + * @Wechat: zhuda1024 + * @Email: lab1024@163.com + * @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012 + */ +import { FLAG_NUMBER_ENUM, GENDER_ENUM, USER_TYPE_ENUM } from './common-const'; +import loginDevice from './system/login-device-const'; +import enterpriseConst from './business/oa/enterprise-const'; +import goodsConst from './business/erp/goods-const'; +import changeLogConst from './support/change-log-const'; + +export default { + FLAG_NUMBER_ENUM, + GENDER_ENUM, + USER_TYPE_ENUM, + ...loginDevice, + ...enterpriseConst, + ...goodsConst, + ...changeLogConst, +}; diff --git a/smart-app/src/constants/local-storage-key-const.js b/smart-app/src/constants/local-storage-key-const.js new file mode 100644 index 00000000..8e13a29b --- /dev/null +++ b/smart-app/src/constants/local-storage-key-const.js @@ -0,0 +1,19 @@ +/* + * key 常量 + * + * @Author: 1024创新实验室-主任:卓大 + * @Date: 2022-09-06 19:58:50 + * @Wechat: zhuda1024 + * @Email: lab1024@163.com + * @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012 + */ + +/** + * key前缀 + */ +const KEY_PREFIX = 'smart_h5_'; +/** + * localStorageKey集合 + */ +// token +export const USER_TOKEN = `${KEY_PREFIX}token`; diff --git a/smart-app/src/constants/regular-const.js b/smart-app/src/constants/regular-const.js new file mode 100644 index 00000000..0633dc87 --- /dev/null +++ b/smart-app/src/constants/regular-const.js @@ -0,0 +1,28 @@ +/* + * 正则常量 + * + * @Author: 1024创新实验室-主任:卓大 + * @Date: 2022-09-06 19:59:05 + * @Wechat: zhuda1024 + * @Email: lab1024@163.com + * @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012 + */ +export const regular = { + phone: /^(13|14|15|16|17|18|19)\d{9}$/, + qq: /^[1-9]\d{3,}$/, + linkUrl: + /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/, + // eslint-disable-next-line no-useless-escape + isNumber: /(^[\-1-9][1-9]*(.[1-9]+)?)$/, // 判断是否为数字,除了0 外 + isLandlineOrPhone: /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/, // 验证 座机 或者手机 + account: /^[a-z0-9]{3,16}$/, // 请输入3-16位(小写字母|数字)的账号 + mobileAccount: /^[a-z0-9]{6,16}$/, // 请输入6-16位(小写字母|数字)的账号(和移动端保持一致) + accountDesc: '请输入3-16位(小写字母|数字)的账号', + pwd: /^[A-Za-z0-9._]{6,16}$/, // 请输入6-16位(大小写字母|数字|小数点|下划线)的密码 + pwdDesc: '请输入6-16位(大小写字母|数字|小数点|下划线)的密码', + delBlankSpace: /\s+/g, // 删除空格 + isPdfReg: new RegExp(/\.(pdf|PDF)/), + isElseFileReg: new RegExp(/\.(doc|docx|xls|xlsx|txt|ppt|pptx|pps|ppxs)/), + isIdentityCard: /^[1-9]\d{5}[1-9]\d{3}((0\d)|(1[0-2]))(([0|1|2]\d)|3[0-1])\d{3}([0-9]|X|x)$/, // 验证身份证号 + isChinese: /^[\u4e00-\u9fa5]+$/gi, // 验证是否汉字 +}; diff --git a/smart-app/src/constants/support/change-log-const.js b/smart-app/src/constants/support/change-log-const.js new file mode 100644 index 00000000..dc10d436 --- /dev/null +++ b/smart-app/src/constants/support/change-log-const.js @@ -0,0 +1,32 @@ +/** + * 系统更新日志 枚举 + * + * @Author: 卓大 + * @Date: 2022-09-26 14:53:50 + * @Copyright 1024创新实验室 + */ + +/** + * 更新类型:[1:特大版本功能更新;2:功能更新;3:bug修复] + */ +export const CHANGE_LOG_TYPE_ENUM = { + MAJOR_UPDATE: { + value: 1, + desc: '重大更新', + type: 'error', + }, + FUNCTION_UPDATE: { + value: 2, + desc: '功能更新', + type: 'primary', + }, + BUG_FIX: { + value: 3, + desc: 'Bug修复', + type: 'warning', + }, +}; + +export default { + CHANGE_LOG_TYPE_ENUM, +}; diff --git a/smart-app/src/constants/system/login-device-const.js b/smart-app/src/constants/system/login-device-const.js new file mode 100644 index 00000000..f2031212 --- /dev/null +++ b/smart-app/src/constants/system/login-device-const.js @@ -0,0 +1,31 @@ +/* + * 登录设备 + * + * @Author: 1024创新实验室-主任:卓大 + * @Date: 2022-09-06 19:56:56 + * @Wechat: zhuda1024 + * @Email: lab1024@163.com + * @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012 + */ +export const LOGIN_DEVICE_ENUM = { + PC: { + value: 1, + desc: '电脑端', + }, + ANDROID: { + value: 2, + desc: '安卓', + }, + APPLE: { + value: 3, + desc: '苹果', + }, + H5: { + value: 3, + desc: 'H5', + }, +}; + +export default { + LOGIN_DEVICE_ENUM, +}; diff --git a/smart-app/src/lib/encrypt.js b/smart-app/src/lib/encrypt.js new file mode 100644 index 00000000..8f2fbeed --- /dev/null +++ b/smart-app/src/lib/encrypt.js @@ -0,0 +1,87 @@ +import CryptoJS from 'crypto-js'; +import CryptoSM from 'sm-crypto'; + +function object2string(data) { + if (typeof data === 'Object') { + return JSON.stringify(data); + } + + let str = JSON.stringify(data); + if (str.startsWith("'") || str.startsWith('"')) { + str = str.substring(1); + } + if (str.endsWith("'") || str.endsWith('"')) { + str = str.substring(0, str.length - 1); + } + return str; +} + +// ----------------------- AES 加密、解密 ----------------------- +const AES_KEY = '1024abcd1024abcd1024abcd1024abcd'; + +const AES = { + encryptData: function (data) { + // AES 加密 并转为 base64 + let utf8Data = CryptoJS.enc.Utf8.parse(object2string(data)); + const key = CryptoJS.enc.Utf8.parse(AES_KEY); + const encrypted = CryptoJS.AES.encrypt(utf8Data, key, { + mode: CryptoJS.mode.ECB, + padding: CryptoJS.pad.Pkcs7, + }); + + return encrypted.toString(); + }, + + decryptData: function (data) { + // 第一步:Base64 解码 + let words = CryptoJS.enc.Base64.parse(data); + + // 第二步:AES 解密 + const key = CryptoJS.enc.Utf8.parse(AES_KEY); + return CryptoJS.AES.decrypt({ ciphertext: words }, key, { + mode: CryptoJS.mode.ECB, + padding: CryptoJS.pad.Pkcs7, + }).toString(CryptoJS.enc.Utf8); + }, +}; + +// ----------------------- 国密SM4算法 加密、解密 ----------------------- +const SM4_KEY = '1024abcd1024abcd1024abcd1024abcd'; + +const SM4 = { + encryptData: function (data) { + // 第一步:SM4 加密 + let encryptData = CryptoSM.sm4.encrypt(object2string(data), SM4_KEY); + // 第二步: Base64 编码 + return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(encryptData)); + }, + + decryptData: function (data) { + // 第一步:Base64 解码 + let words = CryptoJS.enc.Base64.parse(data); + let decode64Str = CryptoJS.enc.Utf8.stringify(words); + + // 第二步:SM4 解密 + return CryptoSM.sm4.decrypt(decode64Str, SM4_KEY); + }, +}; + +// ----------------------- 对外暴露: 加密、解密 ----------------------- + +// 默认使用SM4算法 +const EncryptObject = SM4; +// const EncryptObject = AES; + +/** + * 加密 + */ +export const encryptData = function (data) { + return !data ? null : EncryptObject.encryptData(data); +}; + +/** + * 解密 + */ +export const decryptData = function (data) { + return !data ? null : EncryptObject.decryptData(data); +}; diff --git a/smart-app/src/lib/smart-request.js b/smart-app/src/lib/smart-request.js new file mode 100644 index 00000000..9945b26e --- /dev/null +++ b/smart-app/src/lib/smart-request.js @@ -0,0 +1,96 @@ +/* + * ajax请求 + * + * @Author: 1024创新实验室-主任:卓大 + * @Date: 2022-09-06 20:46:03 + * @Wechat: zhuda1024 + * @Email: lab1024@163.com + * @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012 + */ +import { USER_TOKEN } from '/@/constants/local-storage-key-const'; +import { DATA_TYPE_ENUM } from '/@/constants/common-const'; +import { decryptData, encryptData } from './encrypt'; +import { useUserStore } from '/@/store/modules/system/user'; + +const baseUrl = import.meta.env.VITE_APP_API_URL; + +function getUserToken() { + let token = uni.getStorageSync(USER_TOKEN); + if (token) { + return token; + } + return ''; +} + +/** + * 通用请求封装 + */ +export const request = function (url, method, data) { + return new Promise((resolve, reject) => { + uni.request({ + url: baseUrl + url, //拼接请求路径 + data: data, + method: method, + header: { + 'x-access-token': getUserToken(), + }, + success: (response) => { + // 如果是加密数据 + if (response.data.dataType === DATA_TYPE_ENUM.ENCRYPT.value) { + response.data.encryptData = response.data.data; + let decryptStr = decryptData(response.data.data); + if (decryptStr) { + response.data.data = JSON.parse(decryptStr); + } + } + + const res = response.data; + if (res.code && res.code !== 1) { + // `token` 过期或者账号已在别处登录 + if (res.code === 30007 || res.code === 30008 || res.code === 30012) { + uni.showToast({ + title: res.msg, + icon: 'none', + }); + useUserStore().clearUserLoginInfo(); + uni.navigateTo({ url: '/pages/login/login' }); + } + + uni.showToast({ + title: res.msg, + icon: 'none', + }); + reject(response); + } else { + resolve(res); + } + }, + fail: (error) => { + reject(error); + }, + }); + }); +}; + +/** + * get请求 + */ +export const getRequest = (url) => { + return request(url, 'GET'); +}; + +/** + * post请求 + */ +export const postRequest = (url, data) => { + return request(url, 'POST', data); +}; + +// ================================= 加密 ================================= + +/** + * 加密请求参数的post请求 + */ +export const postEncryptRequest = (url, data) => { + return request(url, 'POST', { encryptData: encryptData(data) }); +}; diff --git a/smart-app/src/lib/smart-sentry.js b/smart-app/src/lib/smart-sentry.js new file mode 100644 index 00000000..25427c1c --- /dev/null +++ b/smart-app/src/lib/smart-sentry.js @@ -0,0 +1,22 @@ +/* + * 错误上报sentry + * + * @Author: 1024创新实验室-主任:卓大 + * @Date: 2024-01-02 20:49:28 + * @Wechat: zhuda1024 + * @Email: lab1024@163.com + * @Copyright 1024创新实验室 ( https://1024lab.net ),Since 2012 + */ + +export const smartSentry = { + /** + * sentry 主动上报 + */ + captureError: (error) => { + if (error.config && error.data && error && error.headers && error.request && error.status) { + return; + } + // Sentry.captureException(error); + console.error(error); + }, +}; diff --git a/smart-app/src/lib/smart-support.js b/smart-app/src/lib/smart-support.js new file mode 100644 index 00000000..32cb0855 --- /dev/null +++ b/smart-app/src/lib/smart-support.js @@ -0,0 +1,30 @@ +export const SmartLoading = { + show: function (msg) { + uni.showLoading({ title: msg ? msg : '加载中' }); + }, + + hide: function () { + uni.hideLoading(); + }, +}; + +export const SmartToast = { + success: (message) => { + uni.showToast({ + title: message, + icon: 'success', + }); + }, + error: (message) => { + uni.showToast({ + title: message, + icon: 'error', + }); + }, + toast: (message) => { + uni.showToast({ + title: message, + icon: 'none', + }); + }, +}; diff --git a/smart-app/src/main.js b/smart-app/src/main.js new file mode 100644 index 00000000..4247b318 --- /dev/null +++ b/smart-app/src/main.js @@ -0,0 +1,18 @@ +import { createSSRApp } from 'vue'; +import App from './App.vue'; +import { store } from './store/index'; +// 枚举管理 +import smartEnumPlugin from '/@/plugins/smart-enums-plugin'; +import constantsInfo from '/@/constants/index'; +import lodash from 'lodash'; + +export function createApp() { + const app = createSSRApp(App); + app.use(store); + app.use(smartEnumPlugin, constantsInfo); + app.config.globalProperties.$lodash = lodash; + return { + app, + store, + }; +} diff --git a/smart-app/src/manifest.json b/smart-app/src/manifest.json new file mode 100644 index 00000000..309b9ec3 --- /dev/null +++ b/smart-app/src/manifest.json @@ -0,0 +1,72 @@ +{ + "name" : "", + "appid" : "", + "description" : "", + "versionName" : "1.0.0", + "versionCode" : "100", + "transformPx" : false, + /* 5+App特有相关 */ + "app-plus" : { + "usingComponents" : true, + "nvueStyleCompiler" : "uni-app", + "compilerVersion" : 3, + "splashscreen" : { + "alwaysShowBeforeRender" : true, + "waiting" : true, + "autoclose" : true, + "delay" : 0 + }, + /* 模块配置 */ + "modules" : {}, + /* 应用发布信息 */ + "distribute" : { + /* android打包配置 */ + "android" : { + "permissions" : [ + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + ] + }, + /* ios打包配置 */ + "ios" : {}, + /* SDK配置 */ + "sdkConfigs" : {} + } + }, + /* 快应用特有相关 */ + "quickapp" : {}, + /* 小程序特有相关 */ + "mp-weixin" : { + "appid" : "", + "setting" : { + "urlCheck" : false + }, + "usingComponents" : true + }, + "mp-alipay" : { + "usingComponents" : true + }, + "mp-baidu" : { + "usingComponents" : true + }, + "mp-toutiao" : { + "usingComponents" : true + }, + "uniStatistics": { + "enable": false + }, + "vueVersion" : "3" +} diff --git a/smart-app/src/pages.json b/smart-app/src/pages.json new file mode 100644 index 00000000..44d5ed04 --- /dev/null +++ b/smart-app/src/pages.json @@ -0,0 +1,186 @@ +{ + "easycom": { + "autoscan": true, + "custom": { + "^uni-(.*)": "@dcloudio/uni-ui/lib/uni-$1/uni-$1.vue" + } + }, + "pages": [ + { + "path": "pages/home/index", + "style": { + "navigationStyle":"custom" + } + }, + { + "path": "pages/login/login", + "style": { + "navigationBarTitleText": "登录", + "navigationBarTextStyle": "white", + "navigationStyle": "custom" + } + }, + { + "path" : "pages/mine/mine", + "style" : + { + "navigationBarTitleText" : "我的", + "enablePullDownRefresh" : false, + "navigationStyle": "custom" + } + }, + { + "path" : "pages/enterprise/enterprise-list", + "style" : + { + "navigationBarTitleText" : "客户线索", + "enablePullDownRefresh" : false, + "navigationBarBackgroundColor": "#fff" + } + }, + { + "path" : "pages/enterprise/enterprise-form", + "style" : + { + "navigationBarTitleText" : "添加客户", + "enablePullDownRefresh" : false, + "navigationBarBackgroundColor": "#fff" + } + }, + { + "path" : "pages/enterprise/enterprise-detail", + "style" : + { + "navigationBarTitleText" : "客户详情", + "enablePullDownRefresh" : false, + "navigationBarBackgroundColor": "#fff" + } + }, + { + "path" : "pages/notice/notice-index", + "style" : + { + "navigationBarTitleText" : "通知公告", + "enablePullDownRefresh" : false, + "navigationBarBackgroundColor": "#fff" + } + }, + { + "path" : "pages/notice/notice-detail", + "style" : + { + "navigationBarTitleText" : "通知公告", + "enablePullDownRefresh" : false, + "navigationBarBackgroundColor": "#fff" + } + }, + { + "path" : "pages/goods/goods-index", + "style" : + { + "navigationBarTitleText" : "商品", + "enablePullDownRefresh" : false, + "navigationBarBackgroundColor": "#fff" + } + }, + { + "path" : "pages/support/change-log/change-log-list", + "style" : + { + "navigationBarTitleText" : "版本更新", + "enablePullDownRefresh" : false, + "navigationBarBackgroundColor": "#fff" + } + }, + { + "path" : "pages/list/list", + "style" : + { + "navigationBarTitleText" : "常见列表", + "enablePullDownRefresh" : true, + "navigationStyle": "custom" + } + }, + { + "path" : "pages/message/message", + "style" : + { + "navigationBarTitleText" : "消息", + "enablePullDownRefresh" : false, + "navigationBarBackgroundColor": "#fff" + } + }, + { + "path" : "pages/form/form", + "style" : + { + "navigationBarTitleText" : "提交表单", + "enablePullDownRefresh" : false, + "navigationBarBackgroundColor": "#fff" + } + }, + { + "path" : "pages/select-people/select-people", + "style" : + { + "navigationBarTitleText" : "选择人员", + "enablePullDownRefresh" : false, + "navigationBarBackgroundColor": "#fff" + } + }, + { + "path" : "pages/pure-list/pure-list", + "style" : + { + "navigationBarTitleText" : "列表", + "enablePullDownRefresh" : false, + "navigationBarBackgroundColor": "#fff" + } + }, + { + "path" : "pages/order-detail/order-detail", + "style" : + { + "navigationBarTitleText" : "运单详情", + "enablePullDownRefresh" : false, + "navigationBarBackgroundColor": "#fff" + } + } + ], + "globalStyle": { + "navigationBarTextStyle": "black", + "navigationBarTitleText": "uni-app", + "navigationBarBackgroundColor": "#F8F8F8", + "backgroundColor": "#F8F8F8" + }, + "tabBar": { + "color": "#858585", + "selectedColor": "#1A9AFF", + "borderStyle": "black", + "backgroundColor": "#ffffff", + "list": [{ + "pagePath": "pages/home/index", + "iconPath": "static/images/tabbar/home-icon.png", + "selectedIconPath": "static/images/tabbar/home-icon-h.png", + "text": "首页" + }, + { + "pagePath": "pages/list/list", + "iconPath": "static/images/tabbar/list-icon.png", + "selectedIconPath": "static/images/tabbar/list-icon-h.png", + "text": "常见列表" + }, + { + "pagePath": "pages/message/message", + "iconPath": "static/images/tabbar/message-icon.png", + "selectedIconPath": "static/images/tabbar/message-icon-h.png", + "text": "消息" + }, + { + "pagePath": "pages/mine/mine", + "iconPath": "static/images/tabbar/mine-icon.png", + "selectedIconPath": "static/images/tabbar/mine-icon-h.png", + "text": "我的" + }] + } +} diff --git a/smart-app/src/pages/enterprise/enterprise-detail.vue b/smart-app/src/pages/enterprise/enterprise-detail.vue new file mode 100644 index 00000000..f05af913 --- /dev/null +++ b/smart-app/src/pages/enterprise/enterprise-detail.vue @@ -0,0 +1,293 @@ + + + + + diff --git a/smart-app/src/pages/enterprise/enterprise-form.vue b/smart-app/src/pages/enterprise/enterprise-form.vue new file mode 100644 index 00000000..32d719af --- /dev/null +++ b/smart-app/src/pages/enterprise/enterprise-form.vue @@ -0,0 +1,184 @@ + + + + + diff --git a/smart-app/src/pages/enterprise/enterprise-list.vue b/smart-app/src/pages/enterprise/enterprise-list.vue new file mode 100644 index 00000000..440ac1ae --- /dev/null +++ b/smart-app/src/pages/enterprise/enterprise-list.vue @@ -0,0 +1,217 @@ + + + + + diff --git a/smart-app/src/pages/form/components/font-size-select.vue b/smart-app/src/pages/form/components/font-size-select.vue new file mode 100644 index 00000000..f1cb8c01 --- /dev/null +++ b/smart-app/src/pages/form/components/font-size-select.vue @@ -0,0 +1,49 @@ + + + + + diff --git a/smart-app/src/pages/form/components/interest.vue b/smart-app/src/pages/form/components/interest.vue new file mode 100644 index 00000000..32b2e70c --- /dev/null +++ b/smart-app/src/pages/form/components/interest.vue @@ -0,0 +1,59 @@ + + + + + \ No newline at end of file diff --git a/smart-app/src/pages/form/components/radio-sex.vue b/smart-app/src/pages/form/components/radio-sex.vue new file mode 100644 index 00000000..913a950f --- /dev/null +++ b/smart-app/src/pages/form/components/radio-sex.vue @@ -0,0 +1,60 @@ + + + + + diff --git a/smart-app/src/pages/form/form.vue b/smart-app/src/pages/form/form.vue new file mode 100644 index 00000000..f22d9f0e --- /dev/null +++ b/smart-app/src/pages/form/form.vue @@ -0,0 +1,199 @@ +