Commit 6c54fdcd authored by Jeff's avatar Jeff

Merge remote-tracking branch 'origin/develop' into develop

# Conflicts:
#	src/main.js
parents 4b91e307 20aebacd
root = true root = true
# 对所有文件有效 //[*js]只对js文件有效 # 对所有文件有效.
# [*js]只对js文件有效
# [*.{js,jsx,ts,tsx,vue}]对指定文件类型有效
[*] [*]
charset = utf-8 charset = utf-8
......
...@@ -2,6 +2,7 @@ package.json ...@@ -2,6 +2,7 @@ package.json
package-lock.json package-lock.json
yarn.lock yarn.lock
!.eslintrc.js !.eslintrc.js
.eslintrc.js
# 忽略有所md文件 # 忽略有所md文件
*.md *.md
assets/ assets/
......
...@@ -3,12 +3,15 @@ module.exports = { ...@@ -3,12 +3,15 @@ module.exports = {
env: { env: {
node: true node: true
}, },
extends: [ // 1: ESLint with error prevention only
'plugin:vue/essential', // extends: ['plugin:vue/essential', 'eslint:recommended'],
'eslint:recommended', // 2: ESLint + Airbnb config
'@vue/prettier', // extends: ['plugin:vue/essential', '@vue/airbnb',],
'plugin:prettier/recommended' // 3: ESLint + Standard config
], // extends: [ 'plugin:vue/essential', '@vue/airbnb',],
// ESLint + Prettier
extends: ['plugin:vue/essential', 'eslint:recommended', '@vue/prettier'],
plugins: [],
parserOptions: { parserOptions: {
parser: 'babel-eslint' parser: 'babel-eslint'
}, },
...@@ -20,220 +23,10 @@ module.exports = { ...@@ -20,220 +23,10 @@ module.exports = {
* "error" 或 2 - 开启规则,使用错误级别的错误:error (当被触发的时候,程序会退出) * "error" 或 2 - 开启规则,使用错误级别的错误:error (当被触发的时候,程序会退出)
*/ */
rules: { rules: {
// 是否开启prettier校验,默认开启 // 是否开启prettier校验,默认开启.可选 warn / error / off
// "prettier/prettier": "off", // "prettier/prettier": "warn",
// "no-console": process.env.NODE_ENV === "production" ? "warn" : "off", // "no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
'no-console': [0, { llow: ['warn', 'error'] }], 'no-console': [0, { llow: ['warn', 'error'] }],
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
//缩进风格.默认4,否则会报错
indent: [
2,
4,
{
SwitchCase: 1 // 针对switch case的缩进
}
],
'linebreak-style': ['error', 'unix'],
'no-irregular-whitespace': [
1,
{ skipComments: true, skipTemplates: true, skipRegExps: true }
],
// 强制双引号
// "quotes": ["error", "double"],
// 语句强制分号结尾
// "semi": ["error", "always"],
// "semi": false,
// 分号前后空格。默认选项禁止分号之前有空格,强制分号之后有空格。
'semi-spacing': [
1,
{
before: false,
after: true
}
],
// 变量声明后必须使用;参数arg不做限制
'no-unused-vars': [
1,
{
vars: 'all',
args: 'none'
}
],
// 禁止对原生对象或只读的全局对象进行赋值
'no-native-reassign': 2,
// 变量声明、数组字面量、对象字面量、函数参数 和 序列中的逗号前不能有空格,后面必须有一个空格
'comma-spacing': [
1,
{
before: false,
after: true
}
],
// 是否用驼峰风格命名变量:never || always
camelcase: ['error', { properties: 'never' }],
// 强制函数括号之前的空格的一致性.
// 每个选项可以设置为 "always"、"never" 或 "ignore"
'space-before-function-paren': [
'warn',
{
// 针对匿名函数表达式 (比如 function () {})
anonymous: 'always',
// 针对命名的函数表达式 (比如 function foo () {})。
named: 'never',
// 针对异步的箭头函数表达式(比如 async () => {})
asyncArrow: 'always'
}
],
// 该规则禁止在 return、throw、continue 和 break 语句后出现不可达代码。
'no-unreachable': 1,
// 消除非故意 case 落空行为
'no-fallthrough': 1,
// 在条件语句中,很容易将一个比较运算符(像 ==)错写成赋值运算符(如 =)
// 所以,该规则禁止在 if、for、while 和 do...while 语句中出现模棱两可的赋值操作符
'no-cond-assign': [2, 'always'],
// 强制多行的三目运算符换行
'multiline-ternary': [1, 'always-multiline'],
// else关键字要与花括号保持在同一行。
// 'brace-style': 1,
// 'block-spacing': 1, //单行代码块两边加空格。
// 'spaced-comment': 1, //注释首尾留空格
'vue/html-indent': [
'error',
4,
{
attribute: 1,
baseIndent: 1,
closeBracket: 0,
alignAttributesVertically: true,
ignores: []
}
],
// 是否禁止在正则表达式中出现控制字符
'no-control-regex': 0,
// 指定html各种元素、svg、vue组件自闭和标签的规则
'vue/html-self-closing': [
'error',
{
html: {
void: 'never',
normal: 'never',
component: 'never'
},
svg: 'always',
math: 'always'
}
],
// 每一行的属性数量
'vue/max-attributes-per-line': [
'error',
{
// 单行的话,每行属性的数量
singleline: 2,
// 多行的话,每行属性的数量
multiline: {
max: 1,
// 第一个属性是否与开始标签在同一行
allowFirstLine: false
}
}
],
'vue/multiline-html-element-content-newline': [
'error',
{
ignoreWhenEmpty: true,
ignores: ['pre', 'textarea'],
allowEmptyLines: false
}
],
// 单行元素内容是否换行
'vue/singleline-html-element-content-newline': [
0,
{
ignoreWhenEmpty: true,
ignores: ['pre', 'textarea'],
ignoreWhenNoAttributes: true
}
],
// 多行元素闭合标签(右括号)换行规则
'vue/html-closing-bracket-newline': [
'error',
{
singleline: 'never',
multiline: 'never'
}
],
// 单行元素闭合标签(右括号)换行规则
'vue/html-closing-bracket-spacing': [
'error',
{
startTag: 'never',
endTag: 'never',
selfClosingTag: 'never'
}
],
// 属性值引号:"double" | "single"
'vue/html-quotes': ['error', 'double'],
// 组件name属性值的格式
// PascalCase:驼峰 || kebab-case:连接线
'vue/name-property-casing': ['warn', 'PascalCase'],
// v-bind写法。shorthand:简写 || longform:不缩写
'vue/v-bind-style': ['error', 'shorthand'],
'vue/v-on-style': ['error', 'shorthand'],
// html元素中属性顺序
'vue/attributes-order': [
'warn',
{
order: [
'DEFINITION',
'LIST_RENDERING',
'CONDITIONALS',
'RENDER_MODIFIERS',
'GLOBAL',
'UNIQUE',
'TWO_WAY_BINDING',
'OTHER_DIRECTIVES',
'OTHER_ATTR',
'EVENTS',
'CONTENT'
]
}
],
// 组件中属性的顺序
'vue/order-in-components': [
'warn',
{
order: [
'el',
'name',
'parent',
'functional',
['delimiters', 'comments'],
['components', 'directives', 'filters'],
'extends',
'mixins',
'inheritAttrs',
'model',
['props', 'propsData'],
'data',
'computed',
'watch',
'LIFECYCLE_HOOKS',
'methods',
['template', 'render'],
'renderError'
]
}
],
// 强制在v-on方法后加括号
'vue/v-on-function-call': [2, 'never'],
// 报告<template>中的语法错误
'vue/no-parsing-error': [
2,
{
'x-invalid-end-tag': false
}
],
// 去掉检测无用转义的规则
'no-useless-escape': [0]
} }
} }
module.exports = { module.exports = {
// 不使用prettier格式化的文件填写在项目的.prettierignore文件中
ignorePath: ".prettierignore",
// 与eslint集成(让prettier使用eslint的代码格式进行校验) // 与eslint集成(让prettier使用eslint的代码格式进行校验)
eslintIntegration: true, eslintIntegration: true,
// 换行长度 // 换行长度
printWidth: 100, printWidth: 150,
// tab缩进大小,默认为2 // tab缩进大小,默认为2
tabWidth: 4, tabWidth: 4,
// 使用tab缩进,默认false // 使用tab缩进,默认false
useTabs: false, useTabs: false,
// 使用分号, 默认true // 是否使用分号, 默认true
semi: false, semi: false,
// 使用单引号, 默认false(在jsx中配置无效, 默认都是双引号) // 是否使用单引号, 默认false(在jsx中配置无效, 默认都是双引号)
singleQuote: true, singleQuote: true,
// 行尾逗号,默认none,可选 none|es5|all // 行尾逗号,默认none,可选 none|es5|all
// es5 包括es5中的数组、对象 // es5 包括es5中的数组、对象
...@@ -31,5 +33,11 @@ module.exports = { ...@@ -31,5 +33,11 @@ module.exports = {
// 箭头函数参数括号 默认avoid 可选 avoid| always // 箭头函数参数括号 默认avoid 可选 avoid| always
// avoid 能省略括号的时候就省略 例如x => x // avoid 能省略括号的时候就省略 例如x => x
// always 总是有括号 // always 总是有括号
arrowParens: 'always' arrowParens: 'always',
// 结尾是 \n \r \n\r auto
endOfline: "auto",
// 在jsx中把'>' 是否单独放一行
jsxBracketSameLine: false,
} }
# laihua-toolkit
[toc]
## 项目介绍
> node 12.18.3 > node 12.18.3
> npm 6.14.6 > npm 6.14.6
...@@ -6,32 +9,33 @@ ...@@ -6,32 +9,33 @@
来画工具宝 来画工具宝
## Project setup ## 运行
安装依赖:
``` ```
npm install npm install
``` ```
### 本地开发 本地开发:
``` ```
npm run serve npm run serve
``` ```
### 测试环境打包 测试环境打包:
``` ```
npm run passports npm run passports
``` ```
### 生产环境打包 生产环境打包:
``` ```
npm run build npm run build
``` ```
### 打包后本地预览 打包后本地预览:
``` ```
npm run start npm run start
``` ```
### 格式校验及自动修复 格式校验及自动修复:
修复eslint报错: 修复eslint报错:
``` ```
npm run fix npm run fix
...@@ -42,5 +46,38 @@ npm run fix ...@@ -42,5 +46,38 @@ npm run fix
npm run prettier npm run prettier
``` ```
### Customize configuration ## 开发
### 分支
`develop`: 开发分支
### 目录结构
├── CHANGELOG.md // 更新日志
├── README.md
├── babel.config.js
├── config
│ └── baseUrl.js
├── package.json
├── public
│ ├── favicon.ico
│ ├── img
│ ├── index.html
│ └── robots.txt
├── src // 源码目录
│ ├── App.vue // 入口文件
│ ├── assets
│ ├── components // 组件目录
│ ├── main.js
│ ├── registerServiceWorker.js
│ ├── router
│ ├── store
│ └── views // 页面组件目录
├── vue.config.js
└── yarn.lock
注意:
1. 页面级组件(通俗理解为与路由对应的组件)统一放在`views`目录下。
2. 页面组件内的小组件、功能组件统一放在`components`目录下。例如,页面组件`pageA.vue`中拆分出了`pageheader.vue`组件,那么在`components`目录下新建一个**与页面同名的`pageA`目录**`pageA`的相关组件放进去即可。
## Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/). See [Configuration Reference](https://cli.vuejs.org/config/).
****
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
"core-js": "^3.6.5", "core-js": "^3.6.5",
"register-service-worker": "^1.7.1", "register-service-worker": "^1.7.1",
"vue": "^2.6.11", "vue": "^2.6.11",
"vue-bus": "^1.2.1",
"vue-router": "^3.2.0", "vue-router": "^3.2.0",
"vuex": "^3.4.0", "vuex": "^3.4.0",
"vue-js-modal": "^2.0.0-rc.6" "vue-js-modal": "^2.0.0-rc.6"
...@@ -45,7 +46,7 @@ ...@@ -45,7 +46,7 @@
}, },
"devDependencies": { "devDependencies": {
"@vue/cli-plugin-babel": "^4.5.0", "@vue/cli-plugin-babel": "^4.5.0",
"@vue/cli-plugin-eslint": "^4.5.0", "@vue/cli-plugin-eslint": "^4.5.4",
"@vue/cli-plugin-pwa": "^4.5.0", "@vue/cli-plugin-pwa": "^4.5.0",
"@vue/cli-service": "^4.5.0", "@vue/cli-service": "^4.5.0",
"@vue/eslint-config-prettier": "^6.0.0", "@vue/eslint-config-prettier": "^6.0.0",
...@@ -53,7 +54,7 @@ ...@@ -53,7 +54,7 @@
"commitizen": "^4.2.0", "commitizen": "^4.2.0",
"cz-conventional-changelog": "^3.2.1", "cz-conventional-changelog": "^3.2.1",
"element-ui": "^2.13.2", "element-ui": "^2.13.2",
"eslint": "^6.7.2", "eslint": "^6.8.0",
"eslint-plugin-prettier": "^3.1.3", "eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-vue": "^6.2.2", "eslint-plugin-vue": "^6.2.2",
"husky": "^3.1.0", "husky": "^3.1.0",
......
...@@ -29,17 +29,6 @@ export default { ...@@ -29,17 +29,6 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
* {
box-sizing: border-box;
line-height: 1;
margin: 0;
padding: 0;
}
html,
body {
padding: 0;
margin: 0;
}
#app { #app {
font-family: Avenir, Helvetica, Arial, sans-serif; font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
...@@ -50,6 +39,7 @@ body { ...@@ -50,6 +39,7 @@ body {
flex-direction: column; flex-direction: column;
height: 100vh; height: 100vh;
} }
.body-container { .body-container {
flex: 1; flex: 1;
display: flex; display: flex;
......
// 所有样式文件的入口
@import "./reset";
@import "./variable";
* {
box-sizing: border-box;
line-height: 1;
margin: 0;
padding: 0;
}
span,
h1,
h2,
h3,
h4,
h5,
h6,
a,
p,
ul,
li {
margin: 0;
padding: 0;
}
html,
body {
font-size: 14px;
background-color: #fff;
color: #000;
letter-spacing: 0.5px;
font-family: "Microsoft YaHei", "微软雅黑", "Source Sans Pro", Arial, sans-serif;
// 顺滑滚动
scroll-behavior: smooth;
}
ul,
li {
list-style: none;
}
a,
a:hover,
a:focus,
a:visited {
color: #000;
}
a {
text-decoration: none;
outline: none;
}
/* 去掉获取焦点时的蓝色发光边框 */
input,
textarea,
video,
button {
outline: none;
border: 0;
padding: 0;
margin: 0;
}
/*解决谷歌浏览器中的input背景色默认是黄色*/
input:-webkit-autofill {
-webkit-box-shadow: 0 0 0px 1000px white inset !important;
}
// 样式变量文件
$color-1: pink;
$bg-color:rgb(229,185,40);
<template> <template>
<div class="comp-rightpanel"> <div class="comp-rightpanel">
rightpanel <router-view name="panel"></router-view>
</div> </div>
</template> </template>
......
<template> <template>
<div class="comp-bao1"> <div>
bao1 screenshotPanel
</div> </div>
</template> </template>
...@@ -14,6 +14,4 @@ export default { ...@@ -14,6 +14,4 @@ export default {
} }
</script> </script>
<style scoped lang="scss"> <style></style>
/* @import url(); 引入css类 */
</style>
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
<div class="comp-sidenav"> <div class="comp-sidenav">
<router-link to="/">Home</router-link> <router-link to="/">Home</router-link>
<router-link to="/about">About</router-link> <router-link to="/about">About</router-link>
<router-link to="/bao1">bao1</router-link> <router-link to="/cutter">cutter</router-link>
<router-link to="/bao2">bao2</router-link> <router-link to="/videoConverter">videoConverter</router-link>
<router-link to="/screenshot">screenshot</router-link>
</div> </div>
</template> </template>
......
<template>
<div class="video-player">
<video ref="videoDom" src="https://resources.laihua.com/2020-7-27/547adf9b-73b0-4b14-bed6-6ee278a1b2b2.mp4"></video>
</div>
</template>
<script>
export default {
data() {
return {
state: 'pluse',
times: 0,
canPlay: false
}
},
mounted() {
this.$bus.on('videoPlayer.play', (data) => {
console.log(data)
// if(data.state)
})
this.$nextTick(() => {
this.$refs.videoDom.addEventListener('canplay', () => {
this.canPlay = true
})
})
},
methods: {
play() {
if (!this.canPlay) return
this.$refs.videoDom.play()
}
}
}
</script>
<style lang="scss" scoped>
.video-player {
display: flex;
justify-content: space-around;
align-items: center;
width: 100%;
height: 100%;
background-color: beige;
video {
max-width: 100%;
max-height: 100%;
}
}
</style>
...@@ -3,15 +3,19 @@ import App from './App.vue' ...@@ -3,15 +3,19 @@ import App from './App.vue'
import router from './router' import router from './router'
import store from './store' import store from './store'
import './registerServiceWorker' import './registerServiceWorker'
import './assets/style/index.scss'
import axios from 'axios' import axios from 'axios'
import VueBus from 'vue-bus'
import VModal from 'vue-js-modal' import VModal from 'vue-js-modal'
Vue.use(VueBus)
Vue.use(VModal)
import baseURL from '../config/baseUrl.js' import baseURL from '../config/baseUrl.js'
console.log('baseURL:', baseURL) console.log('baseURL:', baseURL)
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.prototype.$http = axios Vue.prototype.$http = axios
Vue
new Vue({ new Vue({
router, router,
......
...@@ -5,10 +5,7 @@ import { register } from 'register-service-worker' ...@@ -5,10 +5,7 @@ import { register } from 'register-service-worker'
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
register(`${process.env.BASE_URL}service-worker.js`, { register(`${process.env.BASE_URL}service-worker.js`, {
ready() { ready() {
console.log( console.log('App is being served from cache by a service worker.\n' + 'For more details, visit https://goo.gl/AFskqB')
'App is being served from cache by a service worker.\n' +
'For more details, visit https://goo.gl/AFskqB'
)
}, },
registered() { registered() {
console.log('Service worker has been registered.') console.log('Service worker has been registered.')
......
import Vue from 'vue' import Vue from 'vue'
import VueRouter from 'vue-router' import VueRouter from 'vue-router'
import Bao3 from '../views/bao3.vue' import Bao3 from '../views/bao3.vue'
import Screenshot from '../views/screenshot.vue'
import screenshotPanel from '../components/rightPanel/screenshotPanel.vue'
Vue.use(VueRouter) Vue.use(VueRouter)
...@@ -19,14 +21,21 @@ const routes = [ ...@@ -19,14 +21,21 @@ const routes = [
component: () => import(/* webpackChunkName: "about" */ '../views/About.vue') component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
}, },
{ {
path: '/bao1', path: '/cutter',
name: 'Bao1', name: 'Cutter',
component: () => import(/* webpackChunkName: "bao1" */ '../views/bao1.vue') component: () => import(/* webpackChunkName: "bao1" */ '../views/videoCutter.vue')
}, },
{ {
path: '/bao2', path: '/videoConverter',
name: 'Bao2', name: 'VideoConverter',
component: () => import(/* webpackChunkName: "bao2" */ '../views/bao2.vue') component: () => import(/* webpackChunkName: "bao2" */ '../views/videoConverter.vue')
},
{
path: '/screenshot',
components: {
default: Screenshot,
panel: screenshotPanel
}
} }
] ]
......
<template>
<div class="screenshot">screenshot view</div>
</template>
<script>
export default {
name: 'Screenshot',
data() {
return {}
},
created() {},
mounted() {}
}
</script>
<style lang="scss" scoped>
.screenshot {
width: 100%;
height: 100%;
margin: 30px;
}
</style>
<template>
<div class="videoConverter">转换baby</div>
</template>
<script>
export default {
name: 'VideoConverter',
components: {},
props: {},
data() {
return {}
},
computed: {},
watch: {},
methods: {}
}
</script>
<style scoped lang="scss">
.videoConverter {
width: 100%;
height: 100%;
background-color: #fff;
border: 0px solid black;
margin: 0px;
}
</style>
<template>
<div class="video-cutter">
<div class="video-content">
<video-player></video-player>
</div>
<div></div>
<div></div>
<div></div>
</div>
</template>
<script>
import VideoPlayer from '@/components/videoCutter/videoPlayer.vue'
export default {
components: {
VideoPlayer
},
data() {
return {
name: ''
}
},
created() {},
mounted() {}
}
</script>
<style scoped lang="scss">
/* @import url(); 引入css类 */
.video-cutter {
width: 100%;
height: 100%;
}
.video-content {
width: 100%;
height: 700px;
}
</style>
// console.log(`process.env1:`, process.env) // console.log(`process.env1:`, process.env);
console.log(`process.env.NODE_ENV1:`, process.env.NODE_ENV) console.log(`process.env.NODE_ENV1:`, process.env.NODE_ENV)
// dsf
//dfdfdfsdf
module.exports = { module.exports = {
// outputDir: process.env.outputDir, // outputDir: process.env.outputDir,
// assetsDir: 'static', // assetsDir: 'static',
...@@ -20,5 +19,23 @@ module.exports = { ...@@ -20,5 +19,23 @@ module.exports = {
pathRewrite: { '^/webapi': '/' } pathRewrite: { '^/webapi': '/' }
} }
} }
},
chainWebpack: (config) => {
config.module
.rule('eslint')
.use('eslint-loader')
.loader('eslint-loader')
.tap((options) => {
// 保存自动eslint修复
options.fix = true
return options
})
},
css: {
loaderOptions: {
sass: {
prependData: `@import "@/assets/style/index.scss";`
}
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment