Skip to content

Commit d4e8514

Browse files
author
白唯
committed
feat(基础代码架构): 项目基础代码初始化,目前只有vue 全家桶
1 parent d01b262 commit d4e8514

39 files changed

+947
-84
lines changed

.env.development

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
NODE_ENV=development
2+
// VUE_APP_BASE_URL = //10.10.10.115:8002
3+
VUE_APP_BASE_URL = //apitest.cuidc.net
4+
VUE_APP_BASE_EDITOR_URL = //editorapitest.cuidc.net
5+
VUE_APP_EDITOR_JS = //editortest.cuidc.net
6+
VUE_APP_UPLOADED_URL = //bus.cuidc.net/
7+
VUE_APP_EDITOR_URL_AUTH = a453964db52ff10ad0a3adf4be4dd4e5

.env.preview

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
NODE_ENV=production
2+
VUE_APP_BASE_URL = //apitest.cuidc.net
3+
VUE_APP_BASE_EDITOR_URL = //editorapitest.cuidc.net
4+
VUE_APP_UPLOADED_URL = //bus.cuidc.net/
5+
VUE_APP_EDITOR_JS = //editortest.cuidc.net
6+
VUE_APP_EDITOR_URL_AUTH = 7f35b26c51e980153763ee996542f541

.env.production

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
NODE_ENV=production
2+
VUE_APP_BASE_URL = //api.cuidc.net
3+
VUE_APP_BASE_EDITOR_URL = //editorapi.cuidc.net
4+
VUE_APP_EDITOR_JS = //editor.cuidc.net
5+
VUE_APP_UPLOADED_URL = //bus-acc.cuidc.net/
6+
VUE_APP_EDITOR_URL_AUTH = e3e5e9488f3e2e2857fc045b9c48566b
7+
8+
9+

.eslintrc.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = {
2+
root: true,
3+
parserOptions: {
4+
parser: 'babel-eslint'
5+
},
6+
env: {
7+
browser: true,
8+
es6: true
9+
},
10+
plugins: ['prettier', 'vue', '@typescript-eslint/eslint-plugin'],
11+
rules: {
12+
'prettier/prettier': 'error'
13+
},
14+
extends: ['standard', 'plugin:vue/essential', 'plugin:prettier/recommended']
15+
}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,6 @@ pnpm-debug.log*
2121
*.njsproj
2222
*.sln
2323
*.sw?
24+
25+
# local docs
26+
todo-list.md

.gitlab-ci.yml

Whitespace-only changes.

.prettierrc.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
printWidth: 999,
3+
singleQuote: true,
4+
semi: false,
5+
trailingComma: 'none',
6+
endOfLine: 'lf'
7+
}

babel.config.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
module.exports = {
2-
presets: [
3-
'@vue/cli-plugin-babel/preset'
4-
]
2+
presets: ['@vue/cli-plugin-babel/preset']
53
}

package.json

+42-4
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@
55
"scripts": {
66
"serve": "vue-cli-service serve",
77
"build": "vue-cli-service build",
8-
"lint": "vue-cli-service lint"
8+
"lint": "vue-cli-service lint",
9+
"commit": "npx cz"
910
},
1011
"dependencies": {
1112
"core-js": "^3.6.5",
1213
"vue": "^3.0.0-0",
1314
"vue-class-component": "^8.0.0-0",
1415
"vue-router": "^4.0.0-0",
15-
"vuex": "^4.0.0-0"
16+
"vuex": "^4.0.0-0",
17+
"vuex-persistedstate": "^3.1.0"
1618
},
1719
"devDependencies": {
1820
"@typescript-eslint/eslint-plugin": "^2.33.0",
@@ -26,15 +28,23 @@
2628
"@vue/compiler-sfc": "^3.0.0-0",
2729
"@vue/eslint-config-standard": "^5.1.2",
2830
"@vue/eslint-config-typescript": "^5.0.2",
31+
"babel-eslint": "^10.1.0",
32+
"commitizen": "^4.2.1",
33+
"cz-conventional-changelog": "3.3.0",
2934
"eslint": "^6.7.2",
35+
"eslint-config-prettier": "^6.11.0",
3036
"eslint-plugin-import": "^2.20.2",
3137
"eslint-plugin-node": "^11.1.0",
38+
"eslint-plugin-prettier": "^3.1.4",
3239
"eslint-plugin-promise": "^4.2.1",
3340
"eslint-plugin-standard": "^4.0.0",
3441
"eslint-plugin-vue": "^7.0.0-0",
3542
"less": "^3.0.4",
3643
"less-loader": "^5.0.0",
37-
"typescript": "~3.9.3"
44+
"prettier": "^2.1.1",
45+
"typescript": "~3.9.3",
46+
"vue-property-decorator": "^9.0.0",
47+
"vuex-persistedstate": "^3.1.0"
3848
},
3949
"eslintConfig": {
4050
"root": true,
@@ -55,5 +65,33 @@
5565
"> 1%",
5666
"last 2 versions",
5767
"not dead"
58-
]
68+
],
69+
"config": {
70+
"commitizen": {
71+
"path": "./node_modules/cz-conventional-changelog",
72+
"disableScopeLowerCase": false,
73+
"disableSubjectLowerCase": false,
74+
"maxHeaderWidth": 100,
75+
"maxLineWidth": 100,
76+
"defaultType": "",
77+
"defaultScope": "",
78+
"defaultSubject": "",
79+
"defaultBody": "",
80+
"defaultIssues": "",
81+
"types": {
82+
"feat": {
83+
"description": "新增功能",
84+
"title": "新增"
85+
},
86+
"ci": {
87+
"description": "部署相关",
88+
"title": "CI/CD"
89+
},
90+
"fix": {
91+
"description": "bug 修复",
92+
"title": "修复"
93+
}
94+
}
95+
}
96+
}
5997
}

src/App.vue

+15-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
<template>
22
<div id="app">
33
<div id="nav">
4-
<router-link to="/">Home</router-link> |
5-
<router-link to="/about">About</router-link>
4+
<router-link to="/">Home</router-link> | <router-link to="/about">About</router-link>|
5+
<router-link to="/contact">Contact</router-link>
66
</div>
7-
<router-view/>
7+
<router-view />
88
</div>
99
</template>
1010

11-
<style lang="less">
11+
<script lang="ts">
12+
import { defineComponent } from 'vue'
13+
const App: any = defineComponent({
14+
created() {
15+
console.log('routerList', this.$route)
16+
}
17+
})
18+
19+
export default App
20+
</script>
21+
22+
<style lang="less" scoped>
1223
#app {
1324
font-family: Avenir, Helvetica, Arial, sans-serif;
1425
-webkit-font-smoothing: antialiased;
@@ -19,11 +30,9 @@
1930
2031
#nav {
2132
padding: 30px;
22-
2333
a {
2434
font-weight: bold;
2535
color: #2c3e50;
26-
2736
&.router-link-exact-active {
2837
color: #42b983;
2938
}

src/components/HelloWorld.css

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
h3 {
2+
margin: 40px 0 0;
3+
}
4+
5+
ul {
6+
list-style-type: none;
7+
padding : 0;
8+
}
9+
10+
li {
11+
display: inline-block;
12+
margin : 0 10px;
13+
}
14+
15+
a {
16+
color: #42b983;
17+
}

src/components/HelloWorld.vue

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="hello">
33
<h1>{{ msg }}</h1>
44
<p>
5-
For a guide and recipes on how to configure / customize this project,<br>
5+
For a guide and recipes on how to configure / customize this project,<br />
66
check out the
77
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
88
</p>
@@ -34,16 +34,16 @@
3434
</template>
3535

3636
<script lang="ts">
37-
import { Options, Vue } from 'vue-class-component'
37+
import { defineComponent } from 'vue'
3838
39-
@Options({
40-
props: {
41-
msg: String
39+
const HelloWorld = defineComponent({
40+
props: { msg: { type: String, default: '' } },
41+
created() {
42+
console.log(this.msg)
4243
}
4344
})
44-
export default class HelloWorld extends Vue {
45-
msg!: string
46-
}
45+
46+
export default HelloWorld
4747
</script>
4848

4949
<!-- Add "scoped" attribute to limit CSS to this component only -->

src/components/HelloWorld1.vue

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<template>
2+
<div>{{ author }}</div>
3+
</template>
4+
5+
<script lang="ts">
6+
import { defineComponent } from 'vue'
7+
8+
const HelloWorld1 = defineComponent({
9+
name: 'hello',
10+
data() {
11+
return {
12+
pageName: 'About',
13+
author: 'author'
14+
}
15+
},
16+
methods: {
17+
caculatePageName() {
18+
this.pageName.split(',')
19+
}
20+
}
21+
})
22+
23+
export default HelloWorld1
24+
</script>

src/components/SelfButton.vue

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<template>
2+
<div><button>self-button</button></div>
3+
</template>
4+
5+
<script lang="ts">
6+
import { defineComponent } from 'vue'
7+
8+
const SlefButton = defineComponent({
9+
name: 'SlefButton',
10+
data() {
11+
return {
12+
pageName: 'About',
13+
author: 'author'
14+
}
15+
},
16+
methods: {
17+
caculatePageName() {
18+
this.pageName.split(',')
19+
}
20+
}
21+
})
22+
export default SlefButton
23+
</script>

src/components/TestDemo copy.vue

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<template>
2+
<div ref="root" class="hello">
3+
<p>{{ p }}</p>
4+
</div>
5+
</template>
6+
7+
<script lang="ts">
8+
import './HelloWorld.css'
9+
import { defineComponent, ref } from 'vue'
10+
11+
interface Prop {
12+
name: string
13+
}
14+
15+
const TestDemo = defineComponent({
16+
name: 'TestDemo',
17+
setup(props: Prop) {
18+
const root = ref(null)
19+
console.log(props)
20+
const p = ref(33)
21+
return {
22+
p,
23+
root
24+
}
25+
},
26+
data() {
27+
return {
28+
pageName: 'About',
29+
author: 'kk'
30+
}
31+
},
32+
methods: {
33+
caculatePageName() {
34+
this.pageName.split(',')
35+
}
36+
}
37+
})
38+
export default TestDemo
39+
</script>

src/components/TestDemo.vue

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<template>
2+
<div>{{ author }}</div>
3+
</template>
4+
5+
<script lang="ts">
6+
import { defineComponent } from 'vue'
7+
8+
const TestDemo = defineComponent({
9+
name: 'TestDemo',
10+
data() {
11+
return {
12+
pageName: 'About',
13+
author: 'author'
14+
}
15+
},
16+
methods: {
17+
caculatePageName() {
18+
this.pageName.split(',')
19+
}
20+
}
21+
})
22+
export default TestDemo
23+
</script>

src/config/app.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/** 跟应用全局相关的静态配置放在这里 */
2+
export default {
3+
name: '12',
4+
logo: '34'
5+
}

src/global.d.ts

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare interface Book {
2+
author?: string
3+
pageName: string
4+
}

src/main.ts

+4
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,9 @@ import { createApp } from 'vue'
22
import App from './App.vue'
33
import router from './router'
44
import store from './store'
5+
import AppConfig from './config/app'
56

7+
const app: any = createApp(App)
8+
app.config.globalProperties = AppConfig
9+
console.log('config', app.config)
610
createApp(App).use(store).use(router).mount('#app')

src/router/about.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { RouteRecordRaw } from 'vue-router'
2+
3+
/** 关于我们页面的路由配置 */
4+
const AboutRouter: RouteRecordRaw = {
5+
path: '/about',
6+
name: 'about',
7+
component: () => import(/* webpackChunkName: "about" */ '@/views/About.vue'),
8+
children: [
9+
{
10+
path: 'me',
11+
name: 'aboutMe',
12+
component: () => import(/* webpackChunkName: "about-me" */ '@/views/AboutMe.vue')
13+
}
14+
]
15+
}
16+
17+
export default AboutRouter

0 commit comments

Comments
 (0)