add mockjs“
This commit is contained in:
parent
b54aa84b1c
commit
7f7192f38a
@ -40,6 +40,7 @@
|
||||
"@vue/cli-plugin-babel": "^4.4.6",
|
||||
"@vue/cli-service": "^4.4.6",
|
||||
"element-theme-chalk": "^2.15.12",
|
||||
"mockjs": "^1.1.0",
|
||||
"natives": "^1.1.6",
|
||||
"vue-template-compiler": "^2.6.11"
|
||||
},
|
||||
|
@ -41,6 +41,7 @@
|
||||
// window.SITE_CONFIG['apiURL'] = 'http://192.168.1.49:8080/pms-am'; // tengyun
|
||||
// window.SITE_CONFIG['apiURL'] = 'http://192.168.1.62:8080/pms-am'; // tao
|
||||
window.SITE_CONFIG['apiURL'] = 'http://192.168.1.21:8080/pms-am'; // xv
|
||||
// window.SITE_CONFIG['apiURL'] = 'http://localhost:3000/pms-am'; // xv
|
||||
</script>
|
||||
<% } %>
|
||||
<!-- 集成测试环境 -->
|
||||
|
@ -25,6 +25,8 @@ import cloneDeep from 'lodash/cloneDeep'
|
||||
import myComponents from 'code-brick-zj'
|
||||
|
||||
|
||||
import mocks from './mocks'
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
Vue.use(Element, {
|
||||
|
16
src/mocks/carManagement/index.js
Normal file
16
src/mocks/carManagement/index.js
Normal file
@ -0,0 +1,16 @@
|
||||
import Mock from 'mockjs'
|
||||
const Random = Mock.Random
|
||||
|
||||
const pageViewModel = () => ({
|
||||
code: Random.county(),
|
||||
stateDictValue: Random.integer(1, 7),
|
||||
orderCode: Random.string(10),
|
||||
posCode: Random.string(10),
|
||||
startTime: Random.datetime(),
|
||||
endTime: Random.datetime(),
|
||||
})
|
||||
pageViewModel.url = '/pms/carHandle/pageView'
|
||||
pageViewModel.method = 'post'
|
||||
|
||||
|
||||
export default pageViewModel
|
21
src/mocks/index.js
Normal file
21
src/mocks/index.js
Normal file
@ -0,0 +1,21 @@
|
||||
import Mock from 'mockjs'
|
||||
|
||||
import carManagement from './carManagement'
|
||||
|
||||
|
||||
function m(url, type, fn) {
|
||||
return Mock.mock(window.SITE_CONFIG['apiURL'] + url, type, fn)
|
||||
}
|
||||
|
||||
m(carManagement.url, carManagement.type, opt => {
|
||||
let { limit, page } = JSON.parse(opt.body)
|
||||
// console.log('limit, page', limit, page, opt.body)
|
||||
limit = 5
|
||||
return {
|
||||
code: 0,
|
||||
data: {
|
||||
list: Array(limit).fill(null).map(carManagement),
|
||||
total: limit * page + 10
|
||||
}
|
||||
}
|
||||
})
|
Caricamento…
Fai riferimento in un nuovo problema
Block a user