bug
This commit is contained in:
@@ -2,16 +2,20 @@ import axios from 'axios'
|
|||||||
import i18n from '../i18n/i18n'
|
import i18n from '../i18n/i18n'
|
||||||
import store from '../vuex/store'
|
import store from '../vuex/store'
|
||||||
|
|
||||||
const urlHost = store.getters.serverUrl
|
|
||||||
|
|
||||||
axios.defaults.timeout = 50000
|
axios.defaults.timeout = 50000
|
||||||
axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8'
|
axios.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8'
|
||||||
// 补充GET请求默认Content-Type(可选,GET请求通常无需此配置,但部分后端可能需要)
|
|
||||||
axios.defaults.headers.get['Content-Type'] = 'application/json;charset=UTF-8'
|
axios.defaults.headers.get['Content-Type'] = 'application/json;charset=UTF-8'
|
||||||
|
|
||||||
// 请求拦截器
|
// 请求拦截器
|
||||||
axios.interceptors.request.use(
|
axios.interceptors.request.use(
|
||||||
config => {
|
config => {
|
||||||
|
const urlHost = store.getters.serverUrl
|
||||||
|
if (urlHost && !config.url.startsWith('http')) {
|
||||||
|
// 移除urlHost和sevmethod中的多余斜杠,确保只保留一个
|
||||||
|
const base = urlHost.replace(/\/$/, '')
|
||||||
|
const path = config.url.replace(/^\//, '')
|
||||||
|
config.url = `${base}/${path}`
|
||||||
|
}
|
||||||
config.headers['Accept-Language'] = i18n.locale === 'en-us' ? 'en' : 'zh'
|
config.headers['Accept-Language'] = i18n.locale === 'en-us' ? 'en' : 'zh'
|
||||||
return config
|
return config
|
||||||
},
|
},
|
||||||
@@ -53,7 +57,7 @@ axios.interceptors.response.use(
|
|||||||
|
|
||||||
export const post = (sevmethod, params) => {
|
export const post = (sevmethod, params) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios.post(`${urlHost}/${sevmethod}`, params)
|
axios.post(sevmethod, params)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
resolve(response.data)
|
resolve(response.data)
|
||||||
})
|
})
|
||||||
@@ -65,7 +69,7 @@ export const post = (sevmethod, params) => {
|
|||||||
|
|
||||||
export const get = (sevmethod, params = {}) => {
|
export const get = (sevmethod, params = {}) => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
axios.get(`${urlHost}/${sevmethod}`, { params })
|
axios.get(sevmethod, { params })
|
||||||
.then(response => {
|
.then(response => {
|
||||||
resolve(response.data)
|
resolve(response.data)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
<el-col :span="7"><button class="button_control button_control_disabled" @click="dialogVisible = false"><p>{{$t('Cancel')}}</p></button></el-col>
|
<el-col :span="7"><button class="button_control button_control_disabled" @click="dialogVisible = false"><p>{{$t('Cancel')}}</p></button></el-col>
|
||||||
<el-col :span="7"><button class="button_control" @click="_setStation"><p>{{$t('Save')}}</p></button></el-col>
|
<el-col :span="7"><button class="button_control" @click="_setStation"><p>{{$t('Save')}}</p></button></el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<vue-touch-keyboard id="keyboard" :options="options" v-if="visible" :layout="layout" :cancel="hide" :accept="accept" :input="input" :next="next" />
|
<!-- <vue-touch-keyboard id="keyboard" :options="options" v-if="visible" :layout="layout" :cancel="hide" :accept="accept" :input="input" :next="next" /> -->
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<transition name="custom-message" >
|
<transition name="custom-message" >
|
||||||
<div v-if="message" class="message" :style="{'top': isTop ? '.87rem' : '.57rem', 'color': error ? '#F56C6C' : '#67C23A'}">
|
<div v-if="message" class="message" :style="{'top': isTop ? '.87rem' : '.57rem', 'color': error ? '#F56C6C' : '#67C23A'}">
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<save-chain v-if="saveVisible" ref="saveChain" @dataFormSubmit="dataFormSubmit"/>
|
<save-chain v-if="saveVisible" ref="saveChain" @dataFormSubmit="dataFormSubmit"/>
|
||||||
<vue-touch-keyboard id="keyboard" :options="options" v-if="visible" :layout="layout" :cancel="hide" :accept="accept" :input="input" :next="next" />
|
<!-- <vue-touch-keyboard id="keyboard" :options="options" v-if="visible" :layout="layout" :cancel="hide" :accept="accept" :input="input" :next="next" /> -->
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<el-col :span="7"><button class="button_control button_control_disabled" @click="exitUser"><p>{{$t('Cancel')}}</p></button></el-col>
|
<el-col :span="7"><button class="button_control button_control_disabled" @click="exitUser"><p>{{$t('Cancel')}}</p></button></el-col>
|
||||||
<el-col :span="7"><button class="button_control" @click="dataFormSubmit"><p>{{$t('Save')}}</p></button></el-col>
|
<el-col :span="7"><button class="button_control" @click="dataFormSubmit"><p>{{$t('Save')}}</p></button></el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<vue-touch-keyboard id="keyboard" :options="options" v-if="visible" :layout="layout" :cancel="hide" :accept="accept" :input="input" :next="next" />
|
<!-- <vue-touch-keyboard id="keyboard" :options="options" v-if="visible" :layout="layout" :cancel="hide" :accept="accept" :input="input" :next="next" /> -->
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
<el-col :span="7"><button class="button_control button_control_disabled" @click="exitUser"><p>{{$t('Cancel')}}</p></button></el-col>
|
<el-col :span="7"><button class="button_control button_control_disabled" @click="exitUser"><p>{{$t('Cancel')}}</p></button></el-col>
|
||||||
<el-col :span="7"><button class="button_control" @click="dataFormSubmit"><p>{{$t('Save')}}</p></button></el-col>
|
<el-col :span="7"><button class="button_control" @click="dataFormSubmit"><p>{{$t('Save')}}</p></button></el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<vue-touch-keyboard id="keyboard" :options="options" v-if="visible" :layout="layout" :cancel="hide" :accept="accept" :input="input" :next="next" />
|
<!-- <vue-touch-keyboard id="keyboard" :options="options" v-if="visible" :layout="layout" :cancel="hide" :accept="accept" :input="input" :next="next" /> -->
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
<el-col :span="7" v-if="userRole === 1"><button class="button_control button_control_disabled" @click="exitUser"><p>{{ $t('Logout') }}</p></button></el-col>
|
<el-col :span="7" v-if="userRole === 1"><button class="button_control button_control_disabled" @click="exitUser"><p>{{ $t('Logout') }}</p></button></el-col>
|
||||||
<el-col :span="7" v-else><button class="button_control" @click="dataFormSubmit"><p>{{$t('Login')}}</p></button></el-col>
|
<el-col :span="7" v-else><button class="button_control" @click="dataFormSubmit"><p>{{$t('Login')}}</p></button></el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<vue-touch-keyboard id="keyboard" :options="options" v-if="visible" :layout="layout" :cancel="hide" :accept="accept" :input="input" :next="next" />
|
<!-- <vue-touch-keyboard id="keyboard" :options="options" v-if="visible" :layout="layout" :cancel="hide" :accept="accept" :input="input" :next="next" /> -->
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user