mirror of
https://gitee.com/WeBank/fes.js.git
synced 2024-11-30 02:37:52 +08:00
feat: vite的mock也改为express语法
This commit is contained in:
parent
15c93eb80e
commit
5117afc9c5
@ -27,12 +27,11 @@
|
||||
"dependencies": {
|
||||
"@fesjs/compiler": "^2.0.5",
|
||||
"@fesjs/utils": "^2.0.4",
|
||||
"body-parser": "^1.19.0",
|
||||
"cookie": "^0.4.2",
|
||||
"cookie-parser": "^1.4.5",
|
||||
"envinfo": "^7.7.3",
|
||||
"mime": "^3.0.0",
|
||||
"mockjs": "^1.1.0"
|
||||
"mockjs": "^1.1.0",
|
||||
"express": "^4.17.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@vue/compiler-sfc": "^3.0.5"
|
||||
|
@ -1,13 +1,9 @@
|
||||
import { existsSync, readFileSync } from 'fs';
|
||||
import { resolve } from 'path';
|
||||
import { chokidar, lodash, parseRequireDeps } from '@fesjs/utils';
|
||||
import bodyParser from 'body-parser';
|
||||
import cookieParser from 'cookie-parser';
|
||||
import cookie from 'cookie';
|
||||
import mockjs from 'mockjs';
|
||||
import mime from 'mime';
|
||||
|
||||
function getContentType(type) {
|
||||
const mime = require('mime');
|
||||
return type.indexOf('/') === -1 ? mime.getType(type) : type;
|
||||
}
|
||||
|
||||
@ -22,7 +18,7 @@ function setCookie(res, name, value, opts = {}) {
|
||||
if (opts.path == null) {
|
||||
opts.path = '/';
|
||||
}
|
||||
|
||||
const cookie = require('cookie');
|
||||
res.setHeader('Set-Cookie', cookie.serialize(name, String(val), opts));
|
||||
}
|
||||
|
||||
@ -146,12 +142,16 @@ export default (api) => {
|
||||
api.logger.info('mock.js should export Function');
|
||||
return;
|
||||
}
|
||||
const mockjs = require('mockjs');
|
||||
initFunction({ cgiMock, mockjs, utils });
|
||||
} catch (err) {
|
||||
api.logger.error('mock.js run fail!');
|
||||
}
|
||||
|
||||
return (req, res, next) => {
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
|
||||
app.use((req, res, next) => {
|
||||
// 如果请求不是以 cgiMock.prefix 开头,直接 next
|
||||
if (!req.url.startsWith(mockPrefix)) {
|
||||
return next();
|
||||
@ -194,14 +194,10 @@ export default (api) => {
|
||||
}
|
||||
};
|
||||
|
||||
bodyParser.json({ strict: false })(req, res, () => {
|
||||
bodyParser.urlencoded({ extended: true })(req, res, () => {
|
||||
cookieParser()(req, res, () => {
|
||||
sendData();
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
sendData();
|
||||
});
|
||||
|
||||
return app;
|
||||
};
|
||||
|
||||
api.onStart(() => {
|
||||
|
@ -1,16 +1,90 @@
|
||||
// fes.config.js 只负责管理 cli 相关的配置
|
||||
import pxtoviewport from '@ttou/postcss-px-to-viewport';
|
||||
import { defineBuildConfig } from '@fesjs/fes';
|
||||
// .fes.js 只负责管理编译时配置,只能使用plain Object
|
||||
|
||||
export default defineBuildConfig({
|
||||
proxy: {
|
||||
'/v2': {
|
||||
'target': 'https://api.douban.com/',
|
||||
'changeOrigin': true,
|
||||
export default {
|
||||
// exportStatic: {},
|
||||
define: {
|
||||
__DEV__: false
|
||||
},
|
||||
title: '海贼王',
|
||||
router: {
|
||||
mode: 'hash'
|
||||
},
|
||||
access: {
|
||||
roles: {
|
||||
admin: ['*'],
|
||||
menuTest: ['/', '/menuTest']
|
||||
}
|
||||
},
|
||||
request: {
|
||||
dataField: 'result'
|
||||
},
|
||||
});
|
||||
|
||||
mock: {
|
||||
prefix: '/v2'
|
||||
},
|
||||
proxy: {
|
||||
'/v2': {
|
||||
target: 'https://api.douban.com/',
|
||||
changeOrigin: true
|
||||
}
|
||||
},
|
||||
layout: {
|
||||
title: 'Fes.js',
|
||||
footer: 'Created by MumbleFE',
|
||||
multiTabs: false,
|
||||
navigation: 'side',
|
||||
theme: 'dark',
|
||||
menus: [
|
||||
{
|
||||
name: 'index',
|
||||
icon: '/wine-outline.svg',
|
||||
match: ['/route/*']
|
||||
},
|
||||
{
|
||||
name: 'store'
|
||||
},
|
||||
{
|
||||
name: 'editor',
|
||||
icon: '/wine-outline.svg'
|
||||
},
|
||||
{
|
||||
title: '$externalLink',
|
||||
icon: 'UserOutlined',
|
||||
path: 'https://www.baidu.com'
|
||||
},
|
||||
{
|
||||
name: 'mock'
|
||||
},
|
||||
{
|
||||
title: '菜单权限测试',
|
||||
children: [
|
||||
{
|
||||
title: '子菜单',
|
||||
path: '/menuTest'
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'cssModule'
|
||||
},
|
||||
{
|
||||
name: 'pinia'
|
||||
}
|
||||
]
|
||||
},
|
||||
locale: {
|
||||
legacy: true
|
||||
},
|
||||
enums: {
|
||||
status: [
|
||||
['0', '无效的'],
|
||||
['1', '有效的']
|
||||
]
|
||||
},
|
||||
vuex: {
|
||||
strict: true
|
||||
},
|
||||
dynamicImport: true,
|
||||
monacoEditor: {
|
||||
languages: ['javascript', 'typescript', 'html', 'json']
|
||||
}
|
||||
};
|
||||
|
@ -2,7 +2,5 @@
|
||||
|
||||
|
||||
export default {
|
||||
request: {
|
||||
base: '/api'
|
||||
}
|
||||
publicPath: 'https://gw.alipayobjects.com/'
|
||||
};
|
||||
|
2
packages/fes-template-vite/.gitignore
vendored
2
packages/fes-template-vite/.gitignore
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
|
||||
/coverage
|
||||
|
||||
# fes
|
||||
/src/.fes
|
||||
|
@ -1,3 +1,12 @@
|
||||
# fes h5 模版
|
||||
# fes 模版
|
||||
|
||||
内部测试用,不对外发布
|
||||
|
||||
|
||||
## 环境变量
|
||||
|
||||
* 业务代码使用的全局变量,使用 webpack define 定义
|
||||
* 针对不同的环境构建的变量
|
||||
* 开发环境 .evn.local
|
||||
* .env 定义环境变量
|
||||
* .env.xxx 定义特定的环境变
|
@ -2,21 +2,19 @@
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
|
||||
<meta name="format-detection" content="telephone=no" />
|
||||
<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>
|
||||
<%= title %>
|
||||
</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>
|
||||
<%= title %>
|
||||
</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="./logo.png">
|
||||
</head>
|
||||
|
||||
<body ontouchstart="">
|
||||
<div id="<%= mountElementId %>"></div>
|
||||
<body>
|
||||
<div id="<%= mountElementId %>"></div>
|
||||
<script>
|
||||
console.log('<%= FES_APP_PUBLISH_ERROR_PAGE %>');
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,11 +1,13 @@
|
||||
{
|
||||
"name": "@fesjs/template-vite",
|
||||
"version": "2.0.0",
|
||||
"description": "fes vite 构建模版",
|
||||
"description": "fes项目模版",
|
||||
"scripts": {
|
||||
"build": "fes build",
|
||||
"prod": "FES_ENV=prod fes build",
|
||||
"analyze": "ANALYZE=1 fes build",
|
||||
"dev": "fes dev",
|
||||
"analyze": "ANALYZE=1 fes build"
|
||||
"test": "fes test"
|
||||
},
|
||||
"keywords": [
|
||||
"管理端",
|
||||
@ -29,9 +31,9 @@
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/WeBankFinTech/fes.js.git",
|
||||
"directory": "packages/fes-template-vite"
|
||||
"directory": "packages/fes-template"
|
||||
},
|
||||
"author": "qlin",
|
||||
"author": "harrywan",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/WeBankFinTech/fes.js/issues"
|
||||
@ -40,18 +42,26 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ttou/postcss-px-to-viewport": "1.1.4",
|
||||
"@vue/compiler-sfc": "^3.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fesjs/build-vite": "^1.0.0",
|
||||
"@fesjs/fes": "^2.0.0",
|
||||
"@fesjs/plugin-access": "^2.0.0",
|
||||
"@fesjs/plugin-layout": "^4.0.0",
|
||||
"@fesjs/plugin-locale": "^3.0.0",
|
||||
"@fesjs/plugin-model": "^2.0.0",
|
||||
"@fesjs/plugin-enums": "^2.0.0",
|
||||
"@fesjs/plugin-jest": "^2.0.0",
|
||||
"@fesjs/plugin-vuex": "^2.0.0",
|
||||
"@fesjs/plugin-icon": "^2.0.0",
|
||||
"@fesjs/plugin-request": "^2.0.0",
|
||||
"@fesjs/plugin-windicss": "^2.0.8",
|
||||
"core-js": "^3.21.1",
|
||||
"vue": "^3.2.2"
|
||||
"@fesjs/plugin-sass": "^2.0.0",
|
||||
"@fesjs/plugin-monaco-editor": "^2.0.0-beta.0",
|
||||
"@fesjs/plugin-windicss": "^2.0.0",
|
||||
"@fesjs/plugin-pinia": "^2.0.0",
|
||||
"@fesjs/fes-design": "^0.3.3",
|
||||
"@fesjs/build-vite": "^1.0.0",
|
||||
"vue": "^3.0.5",
|
||||
"vuex": "^4.0.0",
|
||||
"pinia": "^2.0.11"
|
||||
},
|
||||
"private": true
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 485 B After Width: | Height: | Size: 485 B |
@ -1,20 +0,0 @@
|
||||
import { defineRuntimeConfig } from '@fesjs/fes';
|
||||
|
||||
export default defineRuntimeConfig({
|
||||
request: {
|
||||
errorHandler: {
|
||||
111() {
|
||||
console.log('root:111');
|
||||
},
|
||||
500() {
|
||||
console.log('500 error');
|
||||
},
|
||||
default(error) {
|
||||
console.log(error);
|
||||
},
|
||||
},
|
||||
},
|
||||
patchRoutes: () => {
|
||||
console.log('patchRoutes');
|
||||
},
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
import { requestWrap } from '@fesjs/fes';
|
||||
|
||||
// TODO
|
||||
// 响应体控制
|
||||
// formData 控制
|
||||
// 错误控制
|
||||
// 跳错误页面 || 或者重新登录
|
||||
// 段时间内不能重复发送的请求
|
||||
|
||||
// or
|
||||
export default requestWrap({
|
||||
login: {
|
||||
url: '',
|
||||
throttle: 300,
|
||||
options: {
|
||||
method: 'get'
|
||||
}
|
||||
}
|
||||
});
|
@ -1,63 +0,0 @@
|
||||
// 时间格式化
|
||||
// js 数字精度计算
|
||||
// 手机号、身份证号 等的校验
|
||||
// 数字分割
|
||||
|
||||
export function resetContainerHeight(dom) {
|
||||
const originalHeight = document.body.clientHeight || document.documentElement.clientHeight;
|
||||
|
||||
window.onresize = function () {
|
||||
const resizeHeight = document.documentElement.clientHeight || document.body.clientHeight;
|
||||
if (resizeHeight < originalHeight) {
|
||||
// 恢复内容区域高度
|
||||
const container = document.querySelector(dom);
|
||||
container.style.height = originalHeight;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export function resetInputBlur() {
|
||||
const isWechat = window.navigator.userAgent.match(/MicroMessenger\/([\d.]+)/i);
|
||||
if (!isWechat) return;
|
||||
const wechatVersion = isWechat[1];
|
||||
const version = navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);
|
||||
|
||||
// 如果设备类型为iOS 12+ 和wechat 6.7.4+,恢复成原来的视口
|
||||
if (+wechatVersion.replace(/\./g, '') >= 674 && +version[1] >= 12) {
|
||||
window.scrollTo(0, Math.max(document.body.clientHeight, document.documentElement.clientHeight));
|
||||
}
|
||||
}
|
||||
|
||||
export function getQueryString(name) {
|
||||
const reg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`, 'i');
|
||||
const r = window.location.search.substr(1).match(reg);
|
||||
if (r != null) {
|
||||
return decodeURIComponent(r[2]);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
export function simpleRequest(options) {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.timeout = 3000;
|
||||
if (options.type === 'GET') {
|
||||
xhr.open(options.type, options.url, options.async || true);
|
||||
xhr.send(null);
|
||||
} else if (options.type === 'POST') {
|
||||
xhr.open(options.type, options.url, options.async || true);
|
||||
xhr.setRequestHeader('Content-Type', 'application/json');
|
||||
xhr.send(JSON.stringify(options.data || {}));
|
||||
}
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState === 4) {
|
||||
if (xhr.status >= 200 && xhr.status < 300) {
|
||||
options.successed(xhr.responseText);
|
||||
} else {
|
||||
options.failed && options.failed(xhr);
|
||||
}
|
||||
}
|
||||
};
|
||||
xhr.ontimeout = function () {
|
||||
options.failed && options.failed(xhr);
|
||||
};
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
<template>
|
||||
<div>{{ msg }}</div>
|
||||
<div>{{ obj.a }}</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
// eslint-disable-next-line
|
||||
const msg = 'hello world';
|
||||
|
||||
// eslint-disable-next-line
|
||||
const obj = {
|
||||
a: 1,
|
||||
};
|
||||
</script>
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 374 KiB |
@ -0,0 +1,8 @@
|
||||
import { ref } from 'vue';
|
||||
|
||||
export default function user() {
|
||||
const count = ref(1);
|
||||
return {
|
||||
count
|
||||
};
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
return () => <div>hello jsx</div>;
|
||||
},
|
||||
});
|
@ -1,54 +1,33 @@
|
||||
<template>
|
||||
<div class="onepiece m-10px text-green">
|
||||
fes h5 & 拉夫德鲁
|
||||
<br />
|
||||
|
||||
<fes-icon :spin="true" :class="$style.oneIcon" type="smile" @click="clickIcon" />
|
||||
<p :class="$style.oneIcon">hello css module</p>
|
||||
<HelloWorld />
|
||||
<div class="page">
|
||||
home
|
||||
<fes-icon type="smile" />
|
||||
<FButton class="m-2">Button</FButton>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { ref } from 'vue';
|
||||
import { request, defineRouteMeta } from '@fesjs/fes';
|
||||
import HelloWorld from '@/components/helloWorld.vue';
|
||||
|
||||
defineRouteMeta({
|
||||
title: '首页',
|
||||
name: 'testIndex',
|
||||
layout: false,
|
||||
});
|
||||
<script>
|
||||
import { FButton } from '@fesjs/fes-design';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
HelloWorld,
|
||||
FButton,
|
||||
},
|
||||
setup() {
|
||||
const fes = ref('fes upgrade to vue3');
|
||||
const rotate = ref(90);
|
||||
const clickIcon = () => {
|
||||
console.log('click Icon');
|
||||
};
|
||||
|
||||
request('/v2/movie/in_theaters_proxy', (res) => {
|
||||
console.log(res);
|
||||
});
|
||||
|
||||
return {
|
||||
fes,
|
||||
rotate,
|
||||
clickIcon,
|
||||
};
|
||||
return {};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" module>
|
||||
.oneIcon {
|
||||
color: yellow;
|
||||
font-size: 24px;
|
||||
}
|
||||
.onepiece {
|
||||
text-align: center;
|
||||
<style>
|
||||
.page {
|
||||
height: 1000px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<config>
|
||||
{
|
||||
"name": "index",
|
||||
"title": "$home"
|
||||
}
|
||||
</config>
|
||||
|
@ -1,23 +0,0 @@
|
||||
<template>
|
||||
<div class="m-10px">{{ fes }}</div>
|
||||
<img :src="publicPath + 'logo.png'" />
|
||||
</template>
|
||||
<config>
|
||||
{
|
||||
"title": "onepiece",
|
||||
"layout": true
|
||||
}
|
||||
</config>
|
||||
<script>
|
||||
import { ref } from 'vue';
|
||||
|
||||
export default {
|
||||
setup() {
|
||||
const fes = ref('fes upgrade to vue3');
|
||||
return {
|
||||
publicPath: process.env.BASE_URL,
|
||||
fes,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
@ -1,15 +0,0 @@
|
||||
import { defineRouteMeta, useRoute } from '@fesjs/fes';
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
defineRouteMeta({
|
||||
title: 'test',
|
||||
name: 'test',
|
||||
});
|
||||
|
||||
export default defineComponent({
|
||||
setup() {
|
||||
const route = useRoute();
|
||||
console.log(route);
|
||||
return () => <div>hello tsx</div>;
|
||||
},
|
||||
});
|
@ -1,45 +0,0 @@
|
||||
a,
|
||||
img {
|
||||
-webkit-touch-callout: none;
|
||||
}
|
||||
|
||||
html {
|
||||
touch-action: manipulation; // 处理 IOS10+,click点击 300ms 问题
|
||||
}
|
||||
body {
|
||||
background-color: #f7f7f7;
|
||||
}
|
||||
|
||||
input {
|
||||
line-height: normal;
|
||||
border: none;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #0af;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
* {
|
||||
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
/* 适配 iPhone X 顶部填充*/
|
||||
@supports (top: env(safe-area-inset-top)){
|
||||
body,
|
||||
.alien-screen-header {
|
||||
padding-top: constant(safe-area-inset-top, 40px);
|
||||
padding-top: env(safe-area-inset-top, 40px);
|
||||
padding-top: var(safe-area-inset-top, 40px);
|
||||
}
|
||||
}
|
||||
|
||||
/* 判断iPhoneX 将 footer 的 padding-bottom 填充到最底部 */
|
||||
@supports (bottom: env(safe-area-inset-bottom)){
|
||||
body,
|
||||
.alien-screen-footer {
|
||||
padding-bottom: constant(safe-area-inset-bottom, 20px);
|
||||
padding-bottom: env(safe-area-inset-bottom, 20px);
|
||||
padding-top: var(safe-area-inset-bottom, 20px);
|
||||
}
|
||||
}
|
@ -1,173 +0,0 @@
|
||||
@import "../theme";
|
||||
|
||||
.scale-hairline-common(@color, @top, @right, @bottom, @left) {
|
||||
content: '';
|
||||
position: absolute;
|
||||
background-color: @color;
|
||||
display: block;
|
||||
z-index: 1;
|
||||
top: @top;
|
||||
right: @right;
|
||||
bottom: @bottom;
|
||||
left: @left;
|
||||
}
|
||||
|
||||
.hairline(@direction, @color: @border-color-base) when (@direction ='top') {
|
||||
border-top: 1PX solid @color;
|
||||
|
||||
html:not([data-scale]) & {
|
||||
@media (min-resolution: 2dppx) {
|
||||
border-top: none;
|
||||
position: relative;
|
||||
|
||||
&::before {
|
||||
.scale-hairline-common(@color, 0, auto, auto, 0);
|
||||
width: 100%;
|
||||
height: 1PX;
|
||||
transform-origin: 50% 50%;
|
||||
transform: scaleY(0.5);
|
||||
|
||||
@media (min-resolution: 3dppx) {
|
||||
transform: scaleY(0.33);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.hairline(@direction, @color: @border-color-base) when (@direction ='right') {
|
||||
border-right: 1PX solid @color;
|
||||
|
||||
html:not([data-scale]) & {
|
||||
@media (min-resolution: 2dppx) {
|
||||
border-right: none;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
.scale-hairline-common(@color, 0, 0, auto, auto);
|
||||
width: 1PX;
|
||||
height: 100%;
|
||||
background: @color;
|
||||
transform-origin: 100% 50%;
|
||||
transform: scaleX(0.5);
|
||||
|
||||
@media (min-resolution: 3dppx) {
|
||||
transform: scaleX(0.33);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.hairline(@direction, @color: @border-color-base) when (@direction ='bottom') {
|
||||
border-bottom: 1PX solid @color;
|
||||
|
||||
html:not([data-scale]) & {
|
||||
@media (min-resolution: 2dppx) {
|
||||
border-bottom: none;
|
||||
position: relative;
|
||||
|
||||
&::after {
|
||||
.scale-hairline-common(@color, auto, auto, 0, 0);
|
||||
width: 100%;
|
||||
height: 1PX;
|
||||
transform-origin: 50% 100%;
|
||||
transform: scaleY(0.5);
|
||||
|
||||
@media (min-resolution: 3dppx) {
|
||||
transform: scaleY(0.33);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.hairline(@direction, @color: @border-color-base) when (@direction ='left') {
|
||||
border-left: 1PX solid @color;
|
||||
|
||||
html:not([data-scale]) & {
|
||||
@media (min-resolution: 2dppx) {
|
||||
border-left: none;
|
||||
position: relative;
|
||||
|
||||
&::before {
|
||||
.scale-hairline-common(@color, 0, auto, auto, 0);
|
||||
width: 1PX;
|
||||
height: 100%;
|
||||
transform-origin: 100% 50%;
|
||||
transform: scaleX(0.5);
|
||||
|
||||
@media (min-resolution: 3dppx) {
|
||||
transform: scaleX(0.33);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.hairline(@direction, @color: @border-color-base, @radius: 0) when (@direction ='all') {
|
||||
border: 1PX solid @color;
|
||||
border-radius: @radius;
|
||||
|
||||
html:not([data-scale]) & {
|
||||
@media (min-resolution: 2dppx) {
|
||||
position: relative;
|
||||
border: none;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 200%;
|
||||
height: 200%;
|
||||
border: 1PX solid @color;
|
||||
border-radius: @radius * 2;
|
||||
transform-origin: 0 0;
|
||||
transform: scale(0.5);
|
||||
box-sizing: border-box;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.hairline-remove(@position) when (@position ='left') {
|
||||
border-left: 0;
|
||||
|
||||
&:before {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.hairline-remove(@position) when (@position ='right') {
|
||||
border-right: 0;
|
||||
|
||||
&:after {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.hairline-remove(@position) when (@position ='top') {
|
||||
border-top: 0;
|
||||
|
||||
&:before {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.hairline-remove(@position) when (@position ='bottom') {
|
||||
border-bottom: 0;
|
||||
|
||||
&:after {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
||||
|
||||
.hairline-remove(@position) when (@position ='all') {
|
||||
border: 0;
|
||||
|
||||
&:before {
|
||||
display: none !important;
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
|
||||
.hover() {
|
||||
&:active {
|
||||
box-shadow: inset 0 0 1000px rgba(0, 0, 0, .5);
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
.scroll() {
|
||||
-webkit-overflow-scrolling: touch;
|
||||
overflow-y: auto;
|
||||
}
|
@ -1,142 +0,0 @@
|
||||
@charset "UTF-8";
|
||||
|
||||
// 所有元素为border-box
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html {
|
||||
-webkit-text-size-adjust: 100%;
|
||||
-ms-text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
body,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
ul,
|
||||
ol,
|
||||
li,
|
||||
dl,
|
||||
dd,
|
||||
p,
|
||||
form,
|
||||
th,
|
||||
td,
|
||||
fieldset,
|
||||
legend,
|
||||
blockquote,
|
||||
button,
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
body,
|
||||
button,
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
font: 14*@PX/1.5 tahoma, arial, "Hiragino Sans GB", "Microsoft YaHei";
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
color: @txt-color;
|
||||
background-color: @bg-color;
|
||||
font-size: 14px;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6 {
|
||||
font-size: 100%;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
ol,
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
img {
|
||||
border: 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
address,
|
||||
cite,
|
||||
dfn,
|
||||
em,
|
||||
i,
|
||||
var {
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
table {
|
||||
border-spacing: 0;
|
||||
word-wrap: break-word;
|
||||
border-collapse: separate;
|
||||
}
|
||||
|
||||
input,
|
||||
select,
|
||||
button {
|
||||
outline: none;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
input[type='search']::-webkit-search-decoration,
|
||||
input[type='search']::-webkit-search-cancel-button,
|
||||
input[type='search']::-webkit-search-results-button,
|
||||
input[type='search']::-webkit-search-results-decoration {
|
||||
display: none;
|
||||
}
|
||||
|
||||
input::-ms-clear {
|
||||
display: none;
|
||||
}
|
||||
|
||||
select::-ms-expand {
|
||||
display: none;
|
||||
}
|
||||
|
||||
button,
|
||||
input,
|
||||
select,
|
||||
textarea {
|
||||
margin: 0;
|
||||
font-size: 100%;
|
||||
font-family: inherit;
|
||||
outline-offset: 0;
|
||||
outline-style: none;
|
||||
outline-width: 0;
|
||||
background-image: none;
|
||||
}
|
||||
|
||||
input[readonly],
|
||||
textarea[readonly] {
|
||||
background-color: #F1F1F1;
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
@charset "UTF-8";
|
||||
|
||||
@PX: 1px;
|
||||
@rem: 0.01rem;
|
||||
@a-hover: #eeeeee;
|
||||
|
||||
//大背景色
|
||||
//-----------------------------------------------------
|
||||
@bg-color: #ffffff;
|
||||
|
||||
// 边框色
|
||||
@border-color-base: #ddd;
|
||||
|
||||
|
||||
//文字颜色
|
||||
//-----------------------------------------------------
|
||||
@txt-color: #666666;
|
||||
|
||||
// icon 颜色
|
||||
@icon-color: inherit;
|
@ -3,10 +3,7 @@
|
||||
"outDir": "build/dist",
|
||||
"module": "esnext",
|
||||
"target": "esnext",
|
||||
"lib": [
|
||||
"esnext",
|
||||
"dom"
|
||||
],
|
||||
"lib": ["esnext", "dom"],
|
||||
"sourceMap": true,
|
||||
"baseUrl": ".",
|
||||
"jsx": "preserve",
|
||||
@ -17,31 +14,25 @@
|
||||
"suppressImplicitAnyIndexErrors": true,
|
||||
"noUnusedLocals": true,
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"experimentalDecorators": true,
|
||||
"strict": true,
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"./src/*"
|
||||
],
|
||||
"@@/*": [
|
||||
"./src/.fes/*"
|
||||
]
|
||||
"@/*": ["./src/*"],
|
||||
"@@/*": ["./src/.fes/*"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"*.js",
|
||||
".fes.js",
|
||||
"src/**/*",
|
||||
"tests/**/*",
|
||||
"test/**/*",
|
||||
"__test__/**/*",
|
||||
"typings/**/*",
|
||||
"config/**/*",
|
||||
".eslintrc.js",
|
||||
".stylelintrc.js",
|
||||
".prettierrc.js",
|
||||
"src/.fes/configType.d.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"build",
|
||||
"dist",
|
||||
"scripts",
|
||||
"webpack",
|
||||
"jest",
|
||||
"node_modules"
|
||||
]
|
||||
}
|
||||
"exclude": ["node_modules", "build", "dist", "scripts", "src/.fes/*", "webpack", "jest"]
|
||||
}
|
||||
|
@ -1,90 +0,0 @@
|
||||
// .fes.js 只负责管理编译时配置,只能使用plain Object
|
||||
|
||||
export default {
|
||||
// exportStatic: {},
|
||||
define: {
|
||||
__DEV__: false
|
||||
},
|
||||
title: '海贼王',
|
||||
router: {
|
||||
mode: 'hash'
|
||||
},
|
||||
access: {
|
||||
roles: {
|
||||
admin: ['*'],
|
||||
menuTest: ['/', '/menuTest']
|
||||
}
|
||||
},
|
||||
request: {
|
||||
dataField: 'result'
|
||||
},
|
||||
mock: {
|
||||
prefix: '/v2'
|
||||
},
|
||||
proxy: {
|
||||
'/v2': {
|
||||
target: 'https://api.douban.com/',
|
||||
changeOrigin: true
|
||||
}
|
||||
},
|
||||
layout: {
|
||||
title: 'Fes.js',
|
||||
footer: 'Created by MumbleFE',
|
||||
multiTabs: false,
|
||||
navigation: 'side',
|
||||
theme: 'dark',
|
||||
menus: [
|
||||
{
|
||||
name: 'index',
|
||||
icon: '/wine-outline.svg',
|
||||
match: ['/route/*']
|
||||
},
|
||||
{
|
||||
name: 'store'
|
||||
},
|
||||
{
|
||||
name: 'editor',
|
||||
icon: '/wine-outline.svg'
|
||||
},
|
||||
{
|
||||
title: '$externalLink',
|
||||
icon: 'UserOutlined',
|
||||
path: 'https://www.baidu.com'
|
||||
},
|
||||
{
|
||||
name: 'mock'
|
||||
},
|
||||
{
|
||||
title: '菜单权限测试',
|
||||
children: [
|
||||
{
|
||||
title: '子菜单',
|
||||
path: '/menuTest'
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
name: 'cssModule'
|
||||
},
|
||||
{
|
||||
name: 'pinia'
|
||||
}
|
||||
]
|
||||
},
|
||||
locale: {
|
||||
legacy: true
|
||||
},
|
||||
enums: {
|
||||
status: [
|
||||
['0', '无效的'],
|
||||
['1', '有效的']
|
||||
]
|
||||
},
|
||||
vuex: {
|
||||
strict: true
|
||||
},
|
||||
dynamicImport: true,
|
||||
monacoEditor: {
|
||||
languages: ['javascript', 'typescript', 'html', 'json']
|
||||
}
|
||||
};
|
@ -1,6 +0,0 @@
|
||||
// .fes.js 只负责管理编译时配置,只能使用plain Object
|
||||
|
||||
|
||||
export default {
|
||||
publicPath: 'https://gw.alipayobjects.com/'
|
||||
};
|
11
packages/fes-template-vite1/.gitignore
vendored
11
packages/fes-template-vite1/.gitignore
vendored
@ -1,11 +0,0 @@
|
||||
.DS_Store
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/coverage
|
||||
|
||||
# fes
|
||||
/src/.fes
|
||||
/src/.fes-production
|
||||
/src/.fes-test
|
||||
/.env.local
|
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020-present webank
|
||||
|
||||
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.
|
@ -1,12 +0,0 @@
|
||||
# fes 模版
|
||||
|
||||
内部测试用,不对外发布
|
||||
|
||||
|
||||
## 环境变量
|
||||
|
||||
* 业务代码使用的全局变量,使用 webpack define 定义
|
||||
* 针对不同的环境构建的变量
|
||||
* 开发环境 .evn.local
|
||||
* .env 定义环境变量
|
||||
* .env.xxx 定义特定的环境变
|
@ -1,20 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>
|
||||
<%= title %>
|
||||
</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="./logo.png">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="<%= mountElementId %>"></div>
|
||||
<script>
|
||||
console.log('<%= FES_APP_PUBLISH_ERROR_PAGE %>');
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
@ -1,66 +0,0 @@
|
||||
{
|
||||
"name": "@fesjs/template",
|
||||
"version": "2.0.0",
|
||||
"description": "fes项目模版",
|
||||
"scripts": {
|
||||
"build": "fes build",
|
||||
"prod": "FES_ENV=prod fes build",
|
||||
"analyze": "ANALYZE=1 fes build",
|
||||
"dev": "fes dev",
|
||||
"test": "fes test"
|
||||
},
|
||||
"keywords": [
|
||||
"管理端",
|
||||
"fes",
|
||||
"fast",
|
||||
"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"
|
||||
},
|
||||
"author": "harrywan",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/WeBankFinTech/fes.js/issues"
|
||||
},
|
||||
"homepage": "https://github.com/WeBankFinTech/fes.js#readme",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fesjs/fes": "^2.0.0",
|
||||
"@fesjs/plugin-access": "^2.0.0",
|
||||
"@fesjs/plugin-layout": "^4.0.0",
|
||||
"@fesjs/plugin-locale": "^3.0.0",
|
||||
"@fesjs/plugin-model": "^2.0.0",
|
||||
"@fesjs/plugin-enums": "^2.0.0",
|
||||
"@fesjs/plugin-jest": "^2.0.0",
|
||||
"@fesjs/plugin-vuex": "^2.0.0",
|
||||
"@fesjs/plugin-request": "^2.0.0",
|
||||
"@fesjs/plugin-sass": "^2.0.0",
|
||||
"@fesjs/plugin-monaco-editor": "^2.0.0-beta.0",
|
||||
"@fesjs/plugin-windicss": "^2.0.0",
|
||||
"@fesjs/plugin-pinia": "^2.0.0",
|
||||
"@fesjs/fes-design": "^0.3.3",
|
||||
"@fesjs/build-vite": "^1.0.0",
|
||||
"vue": "^3.0.5",
|
||||
"vuex": "^4.0.0",
|
||||
"pinia": "^2.0.11"
|
||||
},
|
||||
"private": true
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 33 KiB |
@ -1,19 +0,0 @@
|
||||
import { requestWrap } from '@fesjs/fes';
|
||||
|
||||
// TODO
|
||||
// 响应体控制
|
||||
// formData 控制
|
||||
// 错误控制
|
||||
// 跳错误页面 || 或者重新登录
|
||||
// 段时间内不能重复发送的请求
|
||||
|
||||
// or
|
||||
export default requestWrap({
|
||||
login: {
|
||||
url: '',
|
||||
throttle: 300,
|
||||
options: {
|
||||
method: 'get'
|
||||
}
|
||||
}
|
||||
});
|
@ -1,8 +0,0 @@
|
||||
import { ref } from 'vue';
|
||||
|
||||
export default function user() {
|
||||
const count = ref(1);
|
||||
return {
|
||||
count
|
||||
};
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
home222
|
||||
<FButton class="m-2">Button</FButton>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { FButton } from '@fesjs/fes-design';
|
||||
|
||||
export default {
|
||||
components: {
|
||||
FButton,
|
||||
},
|
||||
setup() {
|
||||
return {};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.page {
|
||||
height: 1000px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<config>
|
||||
{
|
||||
"name": "index",
|
||||
"title": "$home"
|
||||
}
|
||||
</config>
|
@ -1,38 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "build/dist",
|
||||
"module": "esnext",
|
||||
"target": "esnext",
|
||||
"lib": ["esnext", "dom"],
|
||||
"sourceMap": true,
|
||||
"baseUrl": ".",
|
||||
"jsx": "preserve",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"moduleResolution": "node",
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noImplicitReturns": true,
|
||||
"suppressImplicitAnyIndexErrors": true,
|
||||
"noUnusedLocals": true,
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"experimentalDecorators": true,
|
||||
"strict": true,
|
||||
"paths": {
|
||||
"@/*": ["./src/*"],
|
||||
"@@/*": ["./src/.fes/*"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"src/**/*",
|
||||
"tests/**/*",
|
||||
"test/**/*",
|
||||
"__test__/**/*",
|
||||
"typings/**/*",
|
||||
"config/**/*",
|
||||
".eslintrc.js",
|
||||
".stylelintrc.js",
|
||||
".prettierrc.js",
|
||||
"src/.fes/configType.d.ts"
|
||||
],
|
||||
"exclude": ["node_modules", "build", "dist", "scripts", "src/.fes/*", "webpack", "jest"]
|
||||
}
|
@ -4176,7 +4176,7 @@ core-js-compat@^3.20.2, core-js-compat@^3.21.0:
|
||||
browserslist "^4.19.1"
|
||||
semver "7.0.0"
|
||||
|
||||
core-js@^3.19.2, core-js@^3.21.1, core-js@^3.6.1:
|
||||
core-js@^3.19.2, core-js@^3.6.1:
|
||||
version "3.21.1"
|
||||
resolved "https://registry.npmmirror.com/core-js/-/core-js-3.21.1.tgz#f2e0ddc1fc43da6f904706e8e955bc19d06a0d94"
|
||||
integrity sha512-FRq5b/VMrWlrmCzwRrpDYNxyHP9BcAZC+xHJaqTgIE5091ZV1NTmyh0sGOg5XqpnHvR0svdy0sv1gWA1zmhxig==
|
||||
|
Loading…
Reference in New Issue
Block a user