修改vite需要替换的原始配置

This commit is contained in:
蒋吉兆
2021-09-04 16:04:07 +08:00
parent a785f12fb3
commit ebca96d95c
19 changed files with 430 additions and 327 deletions
+1 -1
View File
@@ -19,7 +19,7 @@
</template>
<script>
const path = process.env.VUE_APP_BASE_API
const path = import.meta.env.VITE_BASE_API
import { getFileList } from '@/api/fileUploadAndDownload'
export default {
props: {
+1 -1
View File
@@ -16,7 +16,7 @@
<script>
import { mapGetters } from 'vuex'
const path = process.env.VUE_APP_BASE_API
const path = import.meta.env.VITE_BASE_API
export default {
name: 'CustomPic',
props: {
+1 -1
View File
@@ -17,7 +17,7 @@
</template>
<script>
const path = process.env.VUE_APP_BASE_API
const path = import.meta.env.VITE_BASE_API
import { mapGetters } from 'vuex'
import ImageCompress from '@/utils/image'
export default {
+8 -9
View File
@@ -1,19 +1,18 @@
/*
* gin-vue-admin web框架组
*
* */
* gin-vue-admin web框架组
*
* */
// 加载网站配置文件夹
import { register } from './global'
export const run = function(app) {
register(app)
console.log(`
register(app)
console.log(`
欢迎使用 Gin-Vue-Admin
当前版本:V2.4.5 alpha
加群方式:微信:shouzi_1994 QQ群:622360840
默认自动化文档地址:http://127.0.0.1:${process.env.VUE_APP_SERVER_PORT}/swagger/index.html
默认前端文件运行地址:http://127.0.0.1:${process.env.VUE_APP_CLI_PORT}
默认自动化文档地址:http://127.0.0.1:${import.meta.env.VITE_SERVER_PORT}/swagger/index.html
默认前端文件运行地址:http://127.0.0.1:${import.meta.env.VITE_CLI_PORT}
如果项目让您获得了收益,希望您能请团队喝杯可乐:https://www.gin-vue-admin.com/docs/coffee
`)
}
}
+102 -108
View File
@@ -1,134 +1,128 @@
.login-register-box {
height: 100vh;
.login-box {
width: 40vw;
position: absolute;
left: 50%;
margin-left: -22vw;
top: 5vh;
.logo {
height: 35vh;
width: 35vh;
}
width: 40vw;
position: absolute;
left: 50%;
margin-left: -22vw;
top: 5vh;
.logo {
height: 35vh;
width: 35vh;
}
}
}
.link-icon {
}
.link-icon {
width: 20px;
min-width: 20px;
height: 20px;
border-radius: 10px;
}
.vPic {
}
.vPic {
width: 33%;
height: 38px;
float: right !important;
background: #ccc;
img {
cursor: pointer;
vertical-align: middle;
cursor: pointer;
vertical-align: middle;
}
}
.logo_login {
}
.logo_login {
width: 100px;
}
#userLayout.user-layout-wrapper {
}
#userLayout.user-layout-wrapper {
height: 100%;
position: relative;
&.mobile {
.container {
.main {
max-width: 368px;
width: 98%;
.container {
.main {
max-width: 368px;
width: 98%;
}
}
}
}
.container {
position: relative;
overflow: auto;
width: 100%;
min-height: 100%;
background: #f0f2f5 url(~@/assets/background.svg) no-repeat 50%;
background-size: 100%;
padding: 110px 0 144px;
a {
text-decoration: none;
}
.top {
text-align: center;
margin-top: -40px;
.header {
height: 44px;
line-height: 44px;
margin-bottom: 30px;
.badge {
position: absolute;
display: inline-block;
line-height: 1;
vertical-align: middle;
margin-left: -12px;
margin-top: -10px;
opacity: 0.8;
}
.logo {
height: 44px;
vertical-align: top;
margin-right: 16px;
border-style: none;
}
.title {
font-size: 33px;
color: rgba(0, 0, 0, 0.85);
font-family: Avenir, "Helvetica Neue", Arial, Helvetica, sans-serif;
font-weight: 600;
position: relative;
top: 2px;
}
}
.desc {
font-size: 14px;
color: rgba(0, 0, 0, 0.45);
margin-top: 12px;
}
}
.main {
min-width: 260px;
width: 368px;
margin: 0 auto;
}
.footer {
position: relative;
overflow: auto;
width: 100%;
padding: 0 20px;
margin: 40px 0 10px;
text-align: center;
.links {
margin-bottom: 8px;
font-size: 14px;
width: 330px;
display: inline-flex;
flex-direction: row;
justify-content: space-between;
padding-right: 40px;
a {
color: rgba(0, 0, 0, 0.45);
transition: all 0.3s;
}
min-height: 100%;
background: #f0f2f5 url(@/assets/background.svg) no-repeat 50%;
background-size: 100%;
padding: 110px 0 144px;
a {
text-decoration: none;
}
.copyright {
color: rgba(0, 0, 0, 0.45);
font-size: 14px;
padding-right: 40px;
.top {
text-align: center;
margin-top: -40px;
.header {
height: 44px;
line-height: 44px;
margin-bottom: 30px;
.badge {
position: absolute;
display: inline-block;
line-height: 1;
vertical-align: middle;
margin-left: -12px;
margin-top: -10px;
opacity: 0.8;
}
.logo {
height: 44px;
vertical-align: top;
margin-right: 16px;
border-style: none;
}
.title {
font-size: 33px;
color: rgba(0, 0, 0, 0.85);
font-family: Avenir, "Helvetica Neue", Arial, Helvetica, sans-serif;
font-weight: 600;
position: relative;
top: 2px;
}
}
.desc {
font-size: 14px;
color: rgba(0, 0, 0, 0.45);
margin-top: 12px;
}
}
.main {
min-width: 260px;
width: 368px;
margin: 0 auto;
}
.footer {
position: relative;
width: 100%;
padding: 0 20px;
margin: 40px 0 10px;
text-align: center;
.links {
margin-bottom: 8px;
font-size: 14px;
width: 330px;
display: inline-flex;
flex-direction: row;
justify-content: space-between;
padding-right: 40px;
a {
color: rgba(0, 0, 0, 0.45);
transition: all 0.3s;
}
}
.copyright {
color: rgba(0, 0, 0, 0.45);
font-size: 14px;
padding-right: 40px;
}
}
}
}
}
}
+2 -2
View File
@@ -1,7 +1,7 @@
#userLayout {
margin: 0;
padding: 0;
background-image: url("~@/assets/login_background.jpg");
background-image: url("@/assets/login_background.jpg");
background-size: cover;
width: 100%;
height: 100%;
@@ -19,7 +19,7 @@
align-items: center;
justify-content: space-evenly;
.login_panle_right {
background-image: url("~@/assets/login_left.svg");
background-image: url("@/assets/login_left.svg");
background-size: cover;
width: 40%;
height: 60%;
+87 -87
View File
@@ -4,113 +4,113 @@ import { store } from '@/store'
import { emitter } from '@/utils/bus.js'
const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API,
timeout: 99999
baseURL: import.meta.env.VITE_BASE_API,
timeout: 99999
})
let acitveAxios = 0
let timer
const showLoading = () => {
acitveAxios++
if (timer) {
clearTimeout(timer)
}
timer = setTimeout(() => {
if (acitveAxios > 0) {
emitter.emit('showLoading')
acitveAxios++
if (timer) {
clearTimeout(timer)
}
}, 400)
timer = setTimeout(() => {
if (acitveAxios > 0) {
emitter.emit('showLoading')
}
}, 400)
}
const closeLoading = () => {
acitveAxios--
if (acitveAxios <= 0) {
clearTimeout(timer)
emitter.emit('closeLoading')
}
}
// http request 拦截器
acitveAxios--
if (acitveAxios <= 0) {
clearTimeout(timer)
emitter.emit('closeLoading')
}
}
// http request 拦截器
service.interceptors.request.use(
config => {
if (!config.donNotShowLoading) {
showLoading()
config => {
if (!config.donNotShowLoading) {
showLoading()
}
const token = store.getters['user/token']
const user = store.getters['user/userInfo']
config.data = JSON.stringify(config.data)
config.headers = {
'Content-Type': 'application/json',
'x-token': token,
'x-user-id': user.ID
}
return config
},
error => {
closeLoading()
ElMessage({
showClose: true,
message: error,
type: 'error'
})
return error
}
const token = store.getters['user/token']
const user = store.getters['user/userInfo']
config.data = JSON.stringify(config.data)
config.headers = {
'Content-Type': 'application/json',
'x-token': token,
'x-user-id': user.ID
}
return config
},
error => {
closeLoading()
ElMessage({
showClose: true,
message: error,
type: 'error'
})
return error
}
)
// http response 拦截器
service.interceptors.response.use(
response => {
closeLoading()
if (response.headers['new-token']) {
store.commit('user/setToken', response.headers['new-token'])
}
if (response.data.code === 0 || response.headers.success === 'true') {
if (response.headers.msg) {
response.data.msg = decodeURI(response.headers.msg)
}
return response.data
} else {
ElMessage({
showClose: true,
message: response.data.msg,
type: 'error'
})
if (response.data.data && response.data.data.reload) {
store.commit('user/LoginOut')
}
return response.data.msg ? response.data : response
}
},
error => {
closeLoading()
switch (error.response.status) {
case 500:
ElMessageBox.confirm(`
response => {
closeLoading()
if (response.headers['new-token']) {
store.commit('user/setToken', response.headers['new-token'])
}
if (response.data.code === 0 || response.headers.success === 'true') {
if (response.headers.msg) {
response.data.msg = decodeURI(response.headers.msg)
}
return response.data
} else {
ElMessage({
showClose: true,
message: response.data.msg,
type: 'error'
})
if (response.data.data && response.data.data.reload) {
store.commit('user/LoginOut')
}
return response.data.msg ? response.data : response
}
},
error => {
closeLoading()
switch (error.response.status) {
case 500:
ElMessageBox.confirm(`
<p>检测到接口错误${error}</p>
<p>错误码<span style="color:red"> 500 </span>:此类错误内容常见于后台panic,请先查看后台日志,如果影响您正常使用可强制登出清理缓存</p>
`, '接口报错', {
dangerouslyUseHTMLString: true,
distinguishCancelAndClose: true,
confirmButtonText: '清理缓存',
cancelButtonText: '取消'
})
.then(() => {
store.commit('user/LoginOut')
})
break
case 404:
ElMessageBox.confirm(`
dangerouslyUseHTMLString: true,
distinguishCancelAndClose: true,
confirmButtonText: '清理缓存',
cancelButtonText: '取消'
})
.then(() => {
store.commit('user/LoginOut')
})
break
case 404:
ElMessageBox.confirm(`
<p>检测到接口错误${error}</p>
<p>错误码<span style="color:red"> 404 </span>:此类错误多为接口未注册(或未重启)或者请求路径(方法)与api路径(方法)不符--如果为自动化代码请检查是否存在空格</p>
`, '接口报错', {
dangerouslyUseHTMLString: true,
distinguishCancelAndClose: true,
confirmButtonText: '我知道了',
cancelButtonText: '取消'
})
break
}
dangerouslyUseHTMLString: true,
distinguishCancelAndClose: true,
confirmButtonText: '我知道了',
cancelButtonText: '取消'
})
break
}
return error
}
return error
}
)
export default service
export default service
@@ -140,7 +140,7 @@ export default {
},
async upLoadFileSlice(item) {
// 切片上传
await axios.post(process.env.VUE_APP_BASE_API + '/fileUploadAndDownload/breakpointContinue', item.formData)
await axios.post(import.meta.env.VITE_BASE_API + '/fileUploadAndDownload/breakpointContinue', item.formData)
this.waitNum-- // 百分数增加
if (this.waitNum === 0) {
// 切片传完以后 合成文件
+1 -1
View File
@@ -31,7 +31,7 @@
</template>
<script>
const path = process.env.VUE_APP_BASE_API
const path = import.meta.env.VITE_BASE_API
import { mapGetters } from 'vuex'
import infoList from '@/mixins/infoList'
import { exportExcel, loadExcelData, downloadTemplate } from '@/api/excel'
+1 -1
View File
@@ -67,7 +67,7 @@
</template>
<script>
const path = process.env.VUE_APP_BASE_API
const path = import.meta.env.VITE_BASE_API
import { mapGetters } from 'vuex'
import infoList from '@/mixins/infoList'
import { getFileList, deleteFile } from '@/api/fileUploadAndDownload'
+1 -1
View File
@@ -116,7 +116,7 @@ export default {
.init_page{
margin: 0;
padding: 0;
background-image: url("~@/assets/login_background.jpg");
background-image: url("@/assets/login_background.jpg");
background-size: cover;
width: 100%;
height: 100%;
+1 -1
View File
@@ -106,7 +106,7 @@ import ChooseImg from '@/components/chooseImg'
import { setUserInfo, changePassword } from '@/api/user'
import { mapGetters, mapMutations } from 'vuex'
const path = process.env.VUE_APP_BASE_API
const path = import.meta.env.VITE_BASE_API
export default {
name: 'Person',
components: {
+1 -1
View File
@@ -96,7 +96,7 @@
<script>
// 获取列表内容封装在mixins内部 getTableData方法 初始化已封装完成
const path = process.env.VUE_APP_BASE_API
const path = import.meta.env.VITE_BASE_API
import {
getUserList,
setUserAuthorities,
@@ -5,7 +5,7 @@
</template>
<script>
var path = process.env.VUE_APP_BASE_PATH
var path = import.meta.env.VITE_BASE_PATH
export default {
name: 'FormGenerator',
data() {