bug
This commit is contained in:
@@ -2,16 +2,20 @@ import axios from 'axios'
|
||||
import i18n from '../i18n/i18n'
|
||||
import store from '../vuex/store'
|
||||
|
||||
const urlHost = store.getters.serverUrl
|
||||
|
||||
axios.defaults.timeout = 50000
|
||||
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.interceptors.request.use(
|
||||
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'
|
||||
return config
|
||||
},
|
||||
@@ -53,7 +57,7 @@ axios.interceptors.response.use(
|
||||
|
||||
export const post = (sevmethod, params) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.post(`${urlHost}/${sevmethod}`, params)
|
||||
axios.post(sevmethod, params)
|
||||
.then(response => {
|
||||
resolve(response.data)
|
||||
})
|
||||
@@ -65,7 +69,7 @@ export const post = (sevmethod, params) => {
|
||||
|
||||
export const get = (sevmethod, params = {}) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(`${urlHost}/${sevmethod}`, { params })
|
||||
axios.get(sevmethod, { params })
|
||||
.then(response => {
|
||||
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" @click="_setStation"><p>{{$t('Save')}}</p></button></el-col>
|
||||
</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>
|
||||
<transition name="custom-message" >
|
||||
<div v-if="message" class="message" :style="{'top': isTop ? '.87rem' : '.57rem', 'color': error ? '#F56C6C' : '#67C23A'}">
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
</el-col>
|
||||
</el-row>
|
||||
<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>
|
||||
</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" @click="dataFormSubmit"><p>{{$t('Save')}}</p></button></el-col>
|
||||
</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>
|
||||
</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" @click="dataFormSubmit"><p>{{$t('Save')}}</p></button></el-col>
|
||||
</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>
|
||||
</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-else><button class="button_control" @click="dataFormSubmit"><p>{{$t('Login')}}</p></button></el-col>
|
||||
</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>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user