This commit is contained in:
tanghc
2019-05-09 13:54:13 +08:00
parent 4e4916f2bd
commit e5276bf5a3
32 changed files with 126 additions and 47 deletions

View File

@@ -2,5 +2,5 @@
ENV = 'production'
# base api
VUE_APP_BASE_API = 'http://localhost:8082/api'
VUE_APP_BASE_API = '/api'

View File

@@ -15,10 +15,10 @@ npm install --registry=https://registry.npm.taobao.org
npm run dev
# 打包发布
npm run build
npm run build:prod
# Build for production and view the bundle analyzer report
npm run build --report
npm run build:prod --report
```
- 修改端口号:打开`vue.config.js`,找到`port`属性
@@ -27,7 +27,5 @@ npm run build --report
如果想要把vue打包放到服务端步骤如下
- 打开`vue.config.js`,找到`build`下的`assetsPublicPath`参数,设置成'./'
- 打开`.env.production`,配置`VUE_APP_BASE_API`参数,设置成'/api'
- 执行`npm run build`进行打包结果在dest下
- 执行`npm run build:prod`进行打包结果在dest下
- 打包完成后把dest中的所有文件放到`sop-admin-server/src/main/resources/public`

View File

@@ -48,7 +48,6 @@
</template>
<script>
import { validUsername } from '@/utils/validate'
import md5 from 'js-md5'
import { setToken } from '@/utils/auth'
@@ -56,8 +55,8 @@ export default {
name: 'Login',
data() {
const validateUsername = (rule, value, callback) => {
if (!validUsername(value)) {
callback(new Error('请输入正确的用户名'))
if (value.length === 0) {
callback(new Error('请输入用户名'))
} else {
callback()
}

View File

@@ -18,7 +18,7 @@ module.exports = {
* In most cases please use '/' !!!
* Detail: https://cli.vuejs.org/config/#publicpath
*/
publicPath: '/',
publicPath: './',
outputDir: 'dist',
assetsDir: 'static',
lintOnSave: process.env.NODE_ENV === 'development',