diff --git a/README.md b/README.md index 17c3126..77bb67b 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,64 @@ -# tduck-front +# Tduck-WEB -## 这是什么 + +TDuck 前端源码 -tduck-front 前端项目 +#### 项目源码 -## 特点 +| 后端源码 | 前端源码 | +|--- | --- | +| https://gitee.com/TDuckApp/tduck-platform | https://gitee.com/TDuckApp/tduck-front | -- 默认集成 vue-router 和 vuex -- 全局 SASS 资源自动引入 -- 精灵图自动生成 -- 全局组件自动注册 -- CDN支持,优化打包体积 -- 轻松实现团队代码规范 -## 目录简介 +#### Build Setup +``` bash +# 配置镜像加速 +https://www.ydyno.com/archives/1219.html + +# 安装依赖 +npm install + +# 启动服务 localhost:8013 +npm run serve + +# 构建生产环境 +npm run build +``` + +#### 常见问题 + +1、linux 系统在安装依赖的时候会出现 node-sass 无法安装的问题 + +解决方案: +``` +1. 单独安装:npm install --unsafe-perm node-sass +2. 直接使用:npm install --unsafe-perm +``` + +2、加速node-sass安装 + +https://www.ydyno.com/archives/1219.html + + +#### 目录简介 - api axios 封装 - assets 静态资源 - components 公共组件 - router 路由 - store vuex -- theme elementui主题 +- theme elementui主题 - util 工具类 - views 页面 + + +#### 特别鸣谢 + + +- 感谢 (https://gitee.com/eoner/vue-automation) 前端脚手架 + +- 感谢 (https://gitee.com/TDuckApp/form-generator) 表单生成器 + + + + + diff --git a/src/api/index.js b/src/api/index.js index a344f40..e5d8878 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -77,8 +77,12 @@ api.interceptors.response.use( confirmButtonText: '重新登录', cancelButtonText: '取消', type: 'warning' - }).then(() => { + }).then(() => { // 重置状态 + this.$store.dispatch('global/loginExpired', false).then(() => { + }) toLogin() + }).catch(() => { + }) }) } diff --git a/src/router/modules/root.js b/src/router/modules/root.js index 13490d9..0efc59c 100644 --- a/src/router/modules/root.js +++ b/src/router/modules/root.js @@ -82,6 +82,11 @@ export default [ meta: {requireLogin: true}, component: () => import(/* webpackChunkName: 'root' */ '@/views/project/MyProject.vue') }, + { + path: 'template/preview', + meta: {requireLogin: true}, + component: () => import(/* webpackChunkName: 'root' */ '@/views/project/TemplatePreview.vue') + }, { path: 'form', meta: {requireLogin: true}, diff --git a/src/utils/convert.js b/src/utils/convert.js index 3370286..6ae523d 100644 --- a/src/utils/convert.js +++ b/src/utils/convert.js @@ -138,6 +138,9 @@ let dataParams = { 'step': 'step' },//时间选择 11: {}, + 15: { + 'max': 'max', + }, //文件上传 17: { 'buttonText': '__config__.buttonText', diff --git a/src/views/form/ProjectForm.vue b/src/views/form/ProjectForm.vue index db0639e..4dbaf72 100644 --- a/src/views/form/ProjectForm.vue +++ b/src/views/form/ProjectForm.vue @@ -47,7 +47,9 @@ export default { props: { projectConfig: { projectKey: '', - showBtns: true + showBtns: true, + // 项目种类 1 普通 2模板 + projectKind: 1 } }, data() { @@ -62,6 +64,7 @@ export default { formConf: { fields: [], projectKey: '', + projectKind: 1, __methods__: {}, formRef: 'elForm', formModel: 'formData', @@ -90,16 +93,25 @@ export default { created() { if (this.projectConfig && this.projectConfig.projectKey) { this.formConf.projectKey = this.projectConfig.projectKey - // this.formConf.formBtns = this.projectConfig.showBtns - //不存去路由中尝试获取 iframe + if (this.projectConfig.projectKind) { + this.formConf.projectKind = this.projectConfig.projectKind + } } else if (this.$route.query.key) { + //不存去路由中尝试获取 iframe this.formConf.projectKey = this.$route.query.key + if (this.$route.query.kind) { + this.formConf.projectKind = this.$route.query.kind + } this.formConf.formBtns = true } this.formConf.size = window.innerWidth < 480 ? 'medium' : 'small' }, mounted() { - this.$api.get(`/user/project/details/${this.formConf.projectKey}`).then(res => { + let url = `/user/project/details/${this.formConf.projectKey}` + if (this.formConf.projectKind == 2) { + url = `/project/template/details/${this.formConf.projectKey}` + } + this.$api.get(url).then(res => { if (res.data) { let serialNumber = 1 let fields = res.data.projectItems.map(item => { diff --git a/src/views/form/statistics.vue b/src/views/form/statistics.vue index 45a7456..72457ed 100644 --- a/src/views/form/statistics.vue +++ b/src/views/form/statistics.vue @@ -61,7 +61,7 @@ /> -
创建一个空白模板
- {{ template.title }} +
+ {{ template.name }}
{{ template.likeCount }}人喜欢