Skip to content

Commit

Permalink
feat: 更新模板
Browse files Browse the repository at this point in the history
  • Loading branch information
wanchun committed Feb 3, 2021
1 parent f8c03ff commit c373b22
Show file tree
Hide file tree
Showing 16 changed files with 179 additions and 28 deletions.
22 changes: 19 additions & 3 deletions packages/create-fes-app/templates/app/h5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,41 @@
"easy",
"strong"
],
"files": [
".eslintrc.js",
".gitignore",
".fes.js",
".fes.prod.js",
"mock.js",
"package.json",
"README.md",
"tsconfig.json",
"/src",
"/config"
],
"repository": {
"type": "git",
"url": "git+https://github.com/WeBankFinTech/fes.js.git",
"directory": "packages/fes-template-h5"
},
"author": "harrywan qlin",
"author": "qlin",
"license": "MIT",
"bugs": {
"url": "https://github.com/WeBankFinTech/fes.js/issues"
},
"homepage": "https://github.com/WeBankFinTech/fes.js#readme",
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@webank/eslint-config-webank": "0.2.7",
"@webank/eslint-config-webank": "^0.2.10",
"postcss-px-to-viewport": "1.1.1"
},
"dependencies": {
"@webank/fes": "^2.0.0-alpha.0",
"@webank/fes-plugin-icon": "^2.0.0-alpha.0",
"@webank/fes-plugin-request": "^2.0.0-alpha.0",
"vue": "3.0.5"
}
},
"private": true
}
1 change: 1 addition & 0 deletions packages/create-fes-app/templates/app/h5/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<meta name="format-detection" content="email=no"/>
<meta name="viewport" content="viewport-fit=cover,width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no">
<title><%= htmlWebpackPlugin.options.title %></title>
<link rel="shortcut icon" type="image/x-icon" href="./logo.png">
</head>
<body ontouchstart="">
<div id="app"></div>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 10 additions & 15 deletions packages/create-fes-app/templates/app/pc/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@

module.exports = {
extends: [
'@webank/eslint-config-webank/vue.js'
extends: ['@webank/eslint-config-webank/vue.js'],
overrides: [
{
files: [
'**/__tests__/*.{j,t}s?(x)',
'**/tests/unit/**/*.spec.{j,t}s?(x)'
]
}
],
globals: {
// 这里填入你的项目需要的全局变量
// 这里值为 false 表示这个全局变量不允许被重新赋值,比如:
//
// Vue: false
__DEV__: false
},
rules: {
'vue/comment-directive': 'off',
'global-require': 'off',
'import/no-unresolved': 'off',
'no-restricted-syntax': 'off'
env: {
jest: true
}
};
5 changes: 4 additions & 1 deletion packages/create-fes-app/templates/app/pc/.fes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
},
layout: {
title: "Fes.js",
logo: 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg',
footer: 'Created by MumbelFe',
multiTabs: false,
menus: [{
name: 'index'
Expand All @@ -27,5 +27,8 @@ export default {
},
devServer: {
port: 8080
},
enums: {
status: [['0', '无效的'], ['1', '有效的']]
}
};
2 changes: 1 addition & 1 deletion packages/create-fes-app/templates/app/pc/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# dependencies
/node_modules

/coverage

# fes
/src/.fes
Expand Down
5 changes: 5 additions & 0 deletions packages/create-fes-app/templates/app/pc/__tests__/add.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import sum from "@/utils/sum"

test('adds 1 + 2 to equal 3', () => {
expect(sum(1, 2)).toBe(3);
});
29 changes: 25 additions & 4 deletions packages/create-fes-app/templates/app/pc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"build": "fes build",
"prod": "FES_ENV=prod fes build",
"analyze": "ANALYZE=1 fes build",
"dev": "fes dev"
"dev": "fes dev",
"test:unit": "fes test:unit"
},
"keywords": [
"管理端",
Expand All @@ -15,6 +16,18 @@
"easy",
"strong"
],
"files": [
".eslintrc.js",
".gitignore",
".fes.js",
".fes.prod.js",
"mock.js",
"package.json",
"README.md",
"tsconfig.json",
"/src",
"/config"
],
"repository": {
"type": "git",
"url": "git+https://github.com/WeBankFinTech/fes.js.git",
Expand All @@ -26,17 +39,25 @@
"url": "https://github.com/WeBankFinTech/fes.js/issues"
},
"homepage": "https://github.com/WeBankFinTech/fes.js#readme",
"publishConfig": {
"access": "public"
},
"devDependencies": {
"@webank/eslint-config-webank": "0.2.7"
"@webank/eslint-config-webank": "^0.2.10"
},
"dependencies": {
"@webank/fes": "^2.0.0-alpha.0",
"@webank/fes-plugin-access": "^2.0.0-alpha.0",
"@webank/fes-plugin-layout": "^2.0.0-alpha.0",
"@webank/fes-plugin-locale": "^2.0.0-alpha.0",
"@webank/fes-plugin-model": "^2.0.0-alpha.0",
"@webank/fes-plugin-enums": "^2.0.0-alpha.0",
"@webank/fes-plugin-jest": "^2.0.0-alpha.0",
"@webank/fes-plugin-vuex": "^2.0.0-alpha.0",
"ant-design-vue": "2.0.0-rc.3",
"vue": "3.0.5"
}
"vue": "3.0.5",
"vuex": "^4.0.0-rc.2"
},
"private": true
}

3 changes: 2 additions & 1 deletion packages/create-fes-app/templates/app/pc/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>fes Vue3</title>
<title>fes.js</title>
<link rel="shortcut icon" type="image/x-icon" href="./logo.png">
</head>
<body>
<div id="app"></div>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 48 additions & 3 deletions packages/create-fes-app/templates/app/pc/src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
<access :id="accessId"> accessOnepicess1 <input /> </access>
<div v-access="accessId"> accessOnepicess2 <input /> </div>
<input />
<h4>数据字典</h4>
<div v-for="item in enumsGet('status')" :key="item.key">{{item.value}}:{{item.key}}</div>
<div v-for="item in roles" :key="item.key">{{item.name}}:{{item.disabled}}</div>
<div>{{enumsGet('roles', '2', { dir: 'eName' })}}</div>
<h4>Vuex <button @click="increment">click me:{{count}}</button></h4>
</div>
</template>
<config>
Expand All @@ -14,9 +19,10 @@
}
</config>
<script>
import { ref, onMounted } from 'vue';
import { ref, onMounted, computed } from 'vue';
import { useStore } from 'vuex';
import {
access, useAccess, useRouter, useI18n, locale
access, useAccess, useRouter, useI18n, locale, enums
} from '@webank/fes';
export default {
Expand All @@ -26,6 +32,41 @@ export default {
const localI18n = useI18n();
const router = useRouter();
const accessId = ref('/onepiece1');
enums.push('roles', [
{
id: '1',
cName: '系统管理员',
eName: 'System',
perm: ['1', '2', '3']
},
{
id: '2',
cName: '业务管理员',
eName: 'Business',
perm: ['1', '2']
},
{
id: '3',
cName: '普通用户',
eName: 'User',
perm: ['1']
}
], { keyName: 'id' });
const roles = enums.get('roles', {
extend: [
{
key: 'name',
dir: 'cName'
},
{
key: 'disabled',
transfer: item => item.value.perm.some(i => i >= 2)
}
]
});
console.log(roles);
const store = useStore();
console.log('store==>', store);
onMounted(() => {
console.log(router);
setTimeout(() => {
Expand All @@ -43,7 +84,11 @@ export default {
accessId,
fes,
accessOnepicess,
t: localI18n.t
t: localI18n.t,
enumsGet: enums.get,
roles,
count: computed(() => store.state.counter.count),
increment: () => store.commit('counter/increment')
};
}
};
Expand Down
10 changes: 10 additions & 0 deletions packages/create-fes-app/templates/app/pc/src/pages/test.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<template>
<div>test</div>
</template>
<script>
import { } from '@webank/fes';
export default {
};
</script>
23 changes: 23 additions & 0 deletions packages/create-fes-app/templates/app/pc/src/stores/counter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export default {
namespaced: true,
state: () => ({
count: 0
}),
mutations: {
increment(state) {
state.count++;
}
},
getters: {
doubleCount(state) {
return state.count * 2;
}
},
actions: {
asyncIncrement({ commit }) {
setTimeout(() => {
commit('increment');
}, 2000);
}
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { createLogger } from 'vuex';

export default createLogger();
25 changes: 25 additions & 0 deletions packages/create-fes-app/templates/app/pc/src/stores/user.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
export default {
namespaced: true,
state: () => ({
name: 'aring',
age: 20,
count: 0
}),
mutations: {
increment(state) {
state.count++;
}
},
getters: {
doubleCount(state) {
return state.count * 2;
}
},
actions: {
asyncIncrement({ commit }) {
setTimeout(() => {
commit('increment');
}, 2000);
}
}
};
3 changes: 3 additions & 0 deletions packages/create-fes-app/templates/app/pc/src/utils/sum.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function sum(a, b) {
return a + b;
}

0 comments on commit c373b22

Please sign in to comment.