Commit 402c2847 by 李金轩

ljx

1 parent f6b11234
.vscode
\ No newline at end of file \ No newline at end of file
.vscode
.idea
\ No newline at end of file \ No newline at end of file
git status
git add *
git commit -m %1%
git pull
git push
git status
\ No newline at end of file \ No newline at end of file
This diff could not be displayed because it is too large.
const API = { const API = {
Login: '/users/login', Login: '/users/login',
Accounts: '/accounts', Accounts: '/accounts',
Malls: '/malls', Malls: '/malls',
Gates: '/gates', Gates: '/gates',
Devices: '/devices', Devices: '/devices',
Channels: '/channels', Channels: '/channels',
Mall: '/mall/', Mall: '/mall/',
FaceRecognitionsCount: '/faceRecognitions/count', FaceRecognitionsCount: '/faceRecognitions/count',
SimulationFaceRecognition: '/simulation/faceRecognition', SimulationFaceRecognition: '/simulation/faceRecognition',
SimulationCountData: '/simulation/countData', SimulationCountData: '/simulation/countData',
PreviewCountData: '/preview/countData', PreviewCountData: '/preview/countData',
mallStaffFeature: '/mall/staffFeature', mallStaffFeature: '/mall/staffFeature',
MallFeature: '/mall/feature', MallFeature: '/mall/feature',
MallStaffPool: '/mall/staffPool', MallStaffPool: '/mall/staffPool',
MallCustomPool: '/mall/customPool', MallCustomPool: '/mall/customPool',
MallStaff: '/mall/staff', MallStaff: '/mall/staff',
MallCustom: '/mall/custom' MallCustom: '/mall/custom'
} }
const WSAPI = { const WSAPI = {
RecalSchedule: '/recal/schedule/' RecalSchedule: '/recal/schedule/'
} }
window._serverHost = window.location.hostname === 'localhost' ? 'store.keliuyun.com:9998' : window.location.host
window._baseUrl = `http://${window._serverHost}`
window._CONF_ = { window._CONF_ = {
reportApiUrl: '', reportApiUrl: '',
apiUrl: '', apiUrl: window._baseUrl,
webSockUrl: '' webSockUrl: ''
} }
const log = console.log.bind(console)
const Axios = axios.create({ const Axios = axios.create({
baseURL: window._CONF_.apiUrl, baseURL: window._CONF_.apiUrl,
timeout: 0, timeout: 0,
withCredentials: true, withCredentials: true,
headers: { headers: {
"Content-Type": "application/json;charset=UTF-8" "Content-Type": "application/json;charset=UTF-8"
} }
}) })
Axios.interceptors.request.use( Axios.interceptors.request.use(
config => { config => {
// const atoken = Cookies.get('atoken') // const atoken = Cookies.get('atoken')
// console.log('atoken', atoken) // console.log('atoken', atoken)
// atoken && (config.headers.Authorization = atoken) // atoken && (config.headers.Authorization = atoken)
return config return config
}, },
error => { error => {
return Promise.reject(error) return Promise.reject(error)
} }
) )
Axios.interceptors.response.use( Axios.interceptors.response.use(
res => { res => {
// if (res.data.enote || res.data.code === 401) { // if (res.data.enote || res.data.code === 401) {
// ELEMENT.MessageBox.alert('授权到期, 请重新登录', '提示', { // ELEMENT.MessageBox.alert('授权到期, 请重新登录', '提示', {
// confirmButtonText: '确定', // confirmButtonText: '确定',
// callback: action => { // callback: action => {
// console.log('action', action) // console.log('action', action)
// window.location.replace(window.location.href + 'login.html') // window.location.replace(window.location.href + 'login.html')
// } // }
// }); // });
// } else { // } else {
return Promise.resolve(res.data) return Promise.resolve(res.data)
// } // }
}, },
error => { error => {
console.error(error) console.error(error)
return Promise.reject(error) return Promise.reject(error)
} }
) )
function get(url, params = {}, config = {}) { function get(url, params = {}, config = {}) {
params['s'] = +new Date() params['s'] = +new Date()
return Axios.get(url, { ...config, params }) return Axios.get(url, {...config, params})
} }
function post(url, params, config = {}) { function post(url, params, config = {}) {
return Axios.post(url, params, config) return Axios.post(url, params, config)
} }
function deletes(url, params, config = {}) { function deletes(url, params, config = {}) {
return Axios.delete(url, params, config) return Axios.delete(url, params, config)
} }
function put(url, params, config = {}) { function put(url, params, config = {}) {
return Axios.put(url, params, config) return Axios.put(url, params, config)
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!