axios修改,当返回类型非json时返回完整的response,否则返回response.data

master
toesbieya 6 years ago
parent 8d2b5e99e3
commit 1fbf5b8bbc
  1. 9
      vue/src/api/account/index.js
  2. 14
      vue/src/api/doc/purchase/inbound.js
  3. 14
      vue/src/api/doc/purchase/order.js
  4. 14
      vue/src/api/doc/sell/order.js
  5. 16
      vue/src/api/doc/sell/outbound.js
  6. 8
      vue/src/api/message/manage.js
  7. 2
      vue/src/api/message/user.js
  8. 8
      vue/src/api/request.js
  9. 6
      vue/src/api/system/customer.js
  10. 6
      vue/src/api/system/department.js
  11. 6
      vue/src/api/system/resource.js
  12. 8
      vue/src/api/system/role.js
  13. 6
      vue/src/api/system/supplier.js
  14. 10
      vue/src/api/system/user.js
  15. 2
      vue/src/component/biz/CategoryTree/index.vue
  16. 2
      vue/src/component/biz/doc/DocHistory.vue
  17. 2
      vue/src/mixin/docDetailMixin.js
  18. 4
      vue/src/mixin/docTableMixin.js
  19. 2
      vue/src/store/module/resource.js
  20. 8
      vue/src/store/module/user.js
  21. 2
      vue/src/util/browser.js
  22. 4
      vue/src/util/file.js
  23. 3
      vue/src/view/app/login/RegisterForm.vue
  24. 2
      vue/src/view/index/component/DailyFinishOrderStat.vue
  25. 2
      vue/src/view/index/component/DailyProfitStat.vue
  26. 2
      vue/src/view/index/component/PanelGroup/index.vue
  27. 2
      vue/src/view/index/component/TotalProfitGoods.vue
  28. 2
      vue/src/view/message/manage/indexPage.vue
  29. 2
      vue/src/view/message/user/MessageStream.vue
  30. 2
      vue/src/view/purchase/inbound/component/OrderSelector.vue
  31. 2
      vue/src/view/purchase/order/component/CategorySelector.vue
  32. 2
      vue/src/view/purchase/order/component/SupplierSelector.vue
  33. 2
      vue/src/view/sell/order/component/CustomerSelector.vue
  34. 5
      vue/src/view/sell/order/component/StockSelector.vue
  35. 5
      vue/src/view/sell/outbound/component/OrderSelector.vue
  36. 5
      vue/src/view/sell/outbound/component/StockSelector.vue
  37. 2
      vue/src/view/sell/outbound/detailPage.vue
  38. 5
      vue/src/view/stock/current/DetailDialog.vue
  39. 5
      vue/src/view/stock/current/indexPage.vue
  40. 2
      vue/src/view/system/category/component/List.vue
  41. 4
      vue/src/view/system/customer/indexPage.vue
  42. 2
      vue/src/view/system/department/indexPage.vue
  43. 2
      vue/src/view/system/role/EditDialog.vue
  44. 2
      vue/src/view/system/role/indexPage.vue
  45. 4
      vue/src/view/system/supplier/indexPage.vue
  46. 2
      vue/src/view/system/user/component/DepartmentSelector.vue
  47. 2
      vue/src/view/system/user/component/RoleSelector.vue
  48. 2
      vue/src/view/system/user/indexPage.vue
  49. 3
      vue/src/view/userCenter/component/Account.vue
  50. 2
      vue/src/view/userCenter/component/Avatar.vue
  51. 2
      vue/src/view/userCenter/component/LoginHistory.vue
  52. 2
      vue/src/view/userCenter/component/UserAction.vue

@ -10,20 +10,17 @@ export const updateUserPwd = new PostApi(`/account/updatePwd`)
export const updateAvatar = new GetApi(
`/account/updateAvatar`,
key => ({params: {key: encodeURIComponent(key)}}),
p => p.then(({data}) => data)
key => ({params: {key: encodeURIComponent(key)}})
)
export const validate = new GetApi(`/account/validate`, pwd => ({params: {pwd}}))
export const checkLoginName = new GetApi(
`/account/checkLoginName`,
(name, id) => ({params: {name, id}}),
p => p.then(({data}) => data)
(name, id) => ({params: {name, id}})
)
export const checkNickName = new GetApi(
`/account/checkNickName`,
(name, id) => ({params: {name, id}}),
p => p.then(({data}) => data)
(name, id) => ({params: {name, id}})
)

@ -8,16 +8,16 @@ export const getSubById = new GetApi(`${baseUrl}/getSubById`, id => ({params: {i
export const search = new PostApi(`${baseUrl}/search`)
export const add = new PostApi(`${baseUrl}/add`, null, p => p.then(({data}) => data))
export const add = new PostApi(`${baseUrl}/add`)
export const update = new PostApi(`${baseUrl}/update`, null, p => p.then(({data}) => data))
export const update = new PostApi(`${baseUrl}/update`)
export const commit = new PostApi(`${baseUrl}/commit`, null, p => p.then(({data}) => data))
export const commit = new PostApi(`${baseUrl}/commit`)
export const withdraw = new PostApi(`${baseUrl}/withdraw`, null, p => p.then(({data}) => data))
export const withdraw = new PostApi(`${baseUrl}/withdraw`)
export const pass = new PostApi(`${baseUrl}/pass`, null, p => p.then(({data}) => data))
export const pass = new PostApi(`${baseUrl}/pass`)
export const reject = new PostApi(`${baseUrl}/reject`, null, p => p.then(({data}) => data))
export const reject = new PostApi(`${baseUrl}/reject`)
export const del = new GetApi(`${baseUrl}/del`, id => ({params: {id}}), p => p.then(({data}) => data))
export const del = new GetApi(`${baseUrl}/del`, id => ({params: {id}}))

@ -8,16 +8,16 @@ export const getSubById = new GetApi(`${baseUrl}/getSubById`, id => ({params: {i
export const search = new PostApi(`${baseUrl}/search`)
export const add = new PostApi(`${baseUrl}/add`, null, p => p.then(({data}) => data))
export const add = new PostApi(`${baseUrl}/add`)
export const update = new PostApi(`${baseUrl}/update`, null, p => p.then(({data}) => data))
export const update = new PostApi(`${baseUrl}/update`)
export const commit = new PostApi(`${baseUrl}/commit`, null, p => p.then(({data}) => data))
export const commit = new PostApi(`${baseUrl}/commit`)
export const withdraw = new PostApi(`${baseUrl}/withdraw`, null, p => p.then(({data}) => data))
export const withdraw = new PostApi(`${baseUrl}/withdraw`)
export const pass = new PostApi(`${baseUrl}/pass`, null, p => p.then(({data}) => data))
export const pass = new PostApi(`${baseUrl}/pass`)
export const reject = new PostApi(`${baseUrl}/reject`, null, p => p.then(({data}) => data))
export const reject = new PostApi(`${baseUrl}/reject`)
export const del = new GetApi(`${baseUrl}/del`, id => ({params: {id}}), p => p.then(({data}) => data))
export const del = new GetApi(`${baseUrl}/del`, id => ({params: {id}}))

@ -8,16 +8,16 @@ export const getSubById = new GetApi(`${baseUrl}/getSubById`, id => ({params: {i
export const search = new PostApi(`${baseUrl}/search`)
export const add = new PostApi(`${baseUrl}/add`, null, p => p.then(({data}) => data))
export const add = new PostApi(`${baseUrl}/add`)
export const update = new PostApi(`${baseUrl}/update`, null, p => p.then(({data}) => data))
export const update = new PostApi(`${baseUrl}/update`)
export const commit = new PostApi(`${baseUrl}/commit`, null, p => p.then(({data}) => data))
export const commit = new PostApi(`${baseUrl}/commit`)
export const withdraw = new PostApi(`${baseUrl}/withdraw`, null, p => p.then(({data}) => data))
export const withdraw = new PostApi(`${baseUrl}/withdraw`)
export const pass = new PostApi(`${baseUrl}/pass`, null, p => p.then(({data}) => data))
export const pass = new PostApi(`${baseUrl}/pass`)
export const reject = new PostApi(`${baseUrl}/reject`, null, p => p.then(({data}) => data))
export const reject = new PostApi(`${baseUrl}/reject`)
export const del = new GetApi(`${baseUrl}/del`, id => ({params: {id}}), p => p.then(({data}) => data))
export const del = new GetApi(`${baseUrl}/del`, id => ({params: {id}}))

@ -1,4 +1,4 @@
import request, {GetApi, PostApi} from "@/api/request"
import {GetApi, PostApi} from "@/api/request"
export const baseUrl = `/doc/sell/outbound`
@ -8,16 +8,16 @@ export const getSubById = new GetApi(`${baseUrl}/getSubById`, id => ({params: {i
export const search = new PostApi(`${baseUrl}/search`)
export const add = new PostApi(`${baseUrl}/add`, null, p => p.then(({data}) => data))
export const add = new PostApi(`${baseUrl}/add`)
export const update = new PostApi(`${baseUrl}/update`, null, p => p.then(({data}) => data))
export const update = new PostApi(`${baseUrl}/update`)
export const commit = new PostApi(`${baseUrl}/commit`, null, p => p.then(({data}) => data))
export const commit = new PostApi(`${baseUrl}/commit`)
export const withdraw = new PostApi(`${baseUrl}/withdraw`, null, p => p.then(({data}) => data))
export const withdraw = new PostApi(`${baseUrl}/withdraw`)
export const pass = new PostApi(`${baseUrl}/pass`, null, p => p.then(({data}) => data))
export const pass = new PostApi(`${baseUrl}/pass`)
export const reject = new PostApi(`${baseUrl}/reject`, null, p => p.then(({data}) => data))
export const reject = new PostApi(`${baseUrl}/reject`)
export const del = new GetApi(`${baseUrl}/del`, id => ({params: {id}}), p => p.then(({data}) => data))
export const del = new GetApi(`${baseUrl}/del`, id => ({params: {id}}))

@ -2,12 +2,12 @@ import {GetApi, PostApi} from "@/api/request"
export const search = new PostApi(`/message/manage/search`)
export const add = new PostApi(`/message/manage/add`, null, p => p.then(({data}) => data))
export const add = new PostApi(`/message/manage/add`)
export const update = new PostApi(`/message/manage/update`, null, p => p.then(({data}) => data))
export const update = new PostApi(`/message/manage/update`)
export const publish = new PostApi(`/message/manage/publish`, null, p => p.then(({data}) => data))
export const publish = new PostApi(`/message/manage/publish`)
export const withdraw = new PostApi(`/message/manage/withdraw`, null, p => p.then(({data}) => data))
export const withdraw = new PostApi(`/message/manage/withdraw`)
export const del = new GetApi(`/message/manage/del`, (id, title) => ({params: {id, title}}))

@ -1,7 +1,5 @@
import {GetApi, PostApi} from "@/api/request"
export const baseUrl = `/message/user`
export const search = new PostApi(`/message/user/search`)
export const read = new GetApi(`/message/user/read`, id => ({params: {id}}))

@ -29,11 +29,12 @@ instance.interceptors.request.use(
instance.interceptors.response.use(
response => {
const res = response.data
const res = response.data, {responseType = 'json'} = response.config
//当返回类型非{status,data,msg}的接口请求时,不使用status来判断请求是否成功
if (!('status' in res) || res.status === 200) {
return response
//当返回类型为json时,返回response.data
return responseType === 'json' ? res : response
}
//服务器异常
@ -86,9 +87,6 @@ class Api {
this.arg = arg
this.chain = chain
this.isGet = isGet
if (this.chain === undefined) {
this.chain = p => p.then(({data}) => data.data)
}
}
request(...args) {

@ -4,8 +4,8 @@ export const getLimitRegion = new GetApi(`/system/customer/getLimitRegion`)
export const search = new PostApi(`/system/customer/search`)
export const add = new PostApi(`/system/customer/add`, null, p => p.then(({data}) => data))
export const add = new PostApi(`/system/customer/add`)
export const update = new PostApi(`/system/customer/update`, null, p => p.then(({data}) => data))
export const update = new PostApi(`/system/customer/update`)
export const del = new PostApi(`/system/customer/del`, null, p => p.then(({data}) => data))
export const del = new PostApi(`/system/customer/del`)

@ -2,8 +2,8 @@ import {GetApi, PostApi} from "@/api/request"
export const get = new GetApi(`/system/department/get`, (all = true) => ({params: {all}}))
export const add = new PostApi(`/system/department/add`, null, p => p.then(({data}) => data))
export const add = new PostApi(`/system/department/add`)
export const update = new PostApi(`/system/department/update`, null, p => p.then(({data}) => data))
export const update = new PostApi(`/system/department/update`)
export const del = new PostApi(`/system/department/del`, null, p => p.then(({data}) => data))
export const del = new PostApi(`/system/department/del`)

@ -2,8 +2,8 @@ import {GetApi, PostApi} from "@/api/request"
export const getAll = new GetApi(`/system/resource/getAll`)
export const add = new PostApi(`/system/resource/add`, null, p => p.then(({data}) => data))
export const add = new PostApi(`/system/resource/add`)
export const update = new PostApi(`/system/resource/update`, null, p => p.then(({data}) => data))
export const update = new PostApi(`/system/resource/update`)
export const del = new GetApi(`/system/resource/del`, id => ({params: {id}}), p => p.then(({data}) => data))
export const del = new GetApi(`/system/resource/del`, id => ({params: {id}}))

@ -1,13 +1,11 @@
import {GetApi, PostApi} from "@/api/request"
export const baseUrl = `/system/role`
export const search = new PostApi(`/system/role/search`)
export const get = new GetApi(`/system/role/get`)
export const add = new PostApi(`/system/role/add`, null, p => p.then(({data}) => data))
export const add = new PostApi(`/system/role/add`)
export const update = new PostApi(`/system/role/update`, null, p => p.then(({data}) => data))
export const update = new PostApi(`/system/role/update`)
export const del = new PostApi(`/system/role/del`, null, p => p.then(({data}) => data))
export const del = new PostApi(`/system/role/del`)

@ -4,8 +4,8 @@ export const getLimitRegion = new GetApi(`/system/supplier/getLimitRegion`)
export const search = new PostApi(`/system/supplier/search`)
export const add = new PostApi(`/system/supplier/add`, null, p => p.then(({data}) => data))
export const add = new PostApi(`/system/supplier/add`)
export const update = new PostApi(`/system/supplier/update`, null, p => p.then(({data}) => data))
export const update = new PostApi(`/system/supplier/update`)
export const del = new PostApi(`/system/supplier/del`, null, p => p.then(({data}) => data))
export const del = new PostApi(`/system/supplier/del`)

@ -2,12 +2,12 @@ import {PostApi} from "@/api/request"
export const search = new PostApi(`/system/user/search`)
export const kick = new PostApi(`/system/user/kick`, null, p => p.then(({data}) => data))
export const kick = new PostApi(`/system/user/kick`)
export const add = new PostApi(`/system/user/add`, null, p => p.then(({data}) => data))
export const add = new PostApi(`/system/user/add`)
export const update = new PostApi(`/system/user/update`, null, p => p.then(({data}) => data))
export const update = new PostApi(`/system/user/update`)
export const del = new PostApi(`/system/user/del`, null, p => p.then(({data}) => data))
export const del = new PostApi(`/system/user/del`)
export const resetPwd = new PostApi(`/system/user/resetPwd`, null, p => p.then(({data}) => data))
export const resetPwd = new PostApi(`/system/user/resetPwd`)

@ -35,7 +35,7 @@ export default {
if (this.data.length > 0) return
getAll
.request()
.then(data => this.$store.commit('dataCache/categories', data))
.then(({data}) => this.$store.commit('dataCache/categories', data))
.finally(() => this.loading = false)
}
}

@ -51,7 +51,7 @@ export default {
if (isEmpty(this.id)) return
search
.request({pid: this.id, ...this.searchForm})
.then(({total, list}) => {
.then(({data: {list, total}}) => {
this.transformData(list)
this.data = list
this.total = total

@ -215,7 +215,7 @@ export default {
}
this.api.getById
.request(id)
.then(data => {
.then(({data}) => {
if (!data || id !== data.id) return Promise.reject()
this.modifyDataBeforeMerge && this.modifyDataBeforeMerge(data)
return Promise.resolve(mergeObj(this.form, data))

@ -77,7 +77,7 @@ export default {
this.row = null
this.api.search
.request(this.mergeSearchForm())
.then(({list, total}) => {
.then(({data: {list, total}}) => {
list.forEach(i => {
i._loading = false //加载状态
i._loaded = false //是否已经加载完成
@ -92,7 +92,7 @@ export default {
row._loading = true
this.api.getSubById
.request(row.id)
.then(data => {
.then(({data}) => {
row.data = data
row._loaded = true
})

@ -51,7 +51,7 @@ const actions = {
init({commit}, {resources, admin, addRoutes = false}) {
return getAll
.request()
.then(data => {
.then(({data}) => {
const routes = transformOriginRouteData(data)
metaExtend(routes)
addRoutes && addDynamicRoutes(routes)

@ -26,8 +26,9 @@ const mutations = createMutations(state, true)
const actions = {
login({commit, dispatch}, userInfo) {
const {username, password} = userInfo
return login.request({username: username.trim(), password})
.then(user => {
return login
.request({username: username.trim(), password})
.then(({data: user}) => {
if (user.admin === true) user.roleName = '超级管理员'
user.avatar = autoCompleteUrl(user.avatar)
commit('$all', user)
@ -40,7 +41,8 @@ const actions = {
return new Promise((resolve, reject) => {
if (state.prepareLogout) return Promise.reject()
commit('prepareLogout', true)
logout.request(state.token)
logout
.request(state.token)
.then(() => {
commit('resource/init', false, {root: true})
return Promise.all([

@ -19,7 +19,7 @@ export function getElementHeight(ele, style) {
if (!ele) return 0
let node = ele.cloneNode(true)
node.style.visibility = 'hidden'
node.style.opacity = '0'
if (style) {
Object.keys(style).forEach(item => {

@ -20,7 +20,7 @@ export function preview(url) {
const connectChar = url.includes('?') ? '&' : '?'
url = url + connectChar + 'fullfilename=' + url.replace(attachmentPrefix, '')
const anchor = document.createElement('a')
anchor.style.visibility = 'hidden'
anchor.style.opacity = '0'
anchor.href = `${filePreviewPrefix}/onlinePreview?url=${encodeURIComponent(url)}`
anchor.target = '_blank'
document.body.appendChild(anchor)
@ -38,7 +38,7 @@ export function download(url, name) {
const href = typeof url === 'object' ? window.URL.createObjectURL(url) : url
const anchor = document.createElement('a')
anchor.style.visibility = 'hidden'
anchor.style.opacity = '0'
anchor.href = href
anchor.download = name
document.body.appendChild(anchor)

@ -113,7 +113,8 @@ export default {
this.$refs.form.validate(valid => {
if (!valid) return
this.loading = true
register.request({
register
.request({
username: this.form.username,
nick: this.form.nick,
password: md5(this.form.pwd)

@ -18,7 +18,7 @@ export default {
this.loading = true
getDailyFinishOrder
.request()
.then(data => {
.then(({data}) => {
const time = []
const purchase = []
const sell = []

@ -18,7 +18,7 @@ export default {
this.loading = true
getDailyProfitStat
.request()
.then(data => {
.then(({data}) => {
const time = []
const purchase = []
const sell = []

@ -63,7 +63,7 @@ export default {
this.loading = true
getFourBlock
.request()
.then(data => {
.then(({data}) => {
this.list.forEach(i => {
if (i.id in data) i.value = data[i.id]
})

@ -49,7 +49,7 @@ export default {
this.loading = true
getTotalProfitGoods
.request()
.then(data => {
.then(({data}) => {
const purchase = []
const sell = []
const profit = []

@ -114,7 +114,7 @@ export default {
this.type = 'see'
search
.request(this.searchForm)
.then(({list, total}) => {
.then(({data: {list, total}}) => {
this.searchForm.total = total
this.tableData = list
})

@ -87,7 +87,7 @@ export default {
this.config.loading = true
search
.request({...this.searchForm, unread})
.then(({list, total}) => {
.then(({data: {list, total}}) => {
if (this.mode !== currentMode) return
unread && this.$store.commit('message/unreadCount', total)
this.searchForm.total = total

@ -97,7 +97,7 @@ export default {
this.row = null
search
.request(this.searchForm)
.then(({list, total}) => {
.then(({data: {list, total}}) => {
list.forEach(i => {
i._loading = false //
i._loaded = false //

@ -54,7 +54,7 @@ export default {
if (this.tree.length === 0) {
getAll
.request()
.then(data => this.$store.commit('dataCache/categories', data))
.then(({data}) => this.$store.commit('dataCache/categories', data))
}
},

@ -89,7 +89,7 @@ export default {
this.row = null
search
.request(this.searchForm)
.then(({list, total}) => {
.then(({data: {list, total}}) => {
this.searchForm.total = total
this.tableData = list
})

@ -74,7 +74,7 @@ export default {
this.row = null
search
.request(this.searchForm)
.then(({list, total}) => {
.then(({data: {list, total}}) => {
this.searchForm.total = total
this.tableData = list
})

@ -64,8 +64,9 @@ export default {
if (!this.value || this.config.loading) return
this.config.loading = true
this.$refs.table && this.$refs.table.clearSelection()
search.request(this.searchForm)
.then(({list, total}) => {
search
.request(this.searchForm)
.then(({data: {list, total}}) => {
this.searchForm.total = total
this.tableData = list
})

@ -95,8 +95,9 @@ export default {
if (!this.value || this.config.loading) return
this.config.loading = true
this.row = null
search(this.searchForm)
.then(({list, total}) => {
search
.request(this.searchForm)
.then(({data: {list, total}}) => {
list.forEach(i => {
i._loading = false //
i._loaded = false //

@ -69,8 +69,9 @@ export default {
if (!this.value || this.loading) return
this.loading = true
this.$refs.table && this.$refs.table.clearSelection()
getDetail.request(this.cid)
.then(data => this.tableData = data)
getDetail
.request(this.cid)
.then(({data}) => this.tableData = data)
.finally(() => this.loading = false)
},

@ -160,7 +160,7 @@ export default {
getParentSubById.request(this.form.pid),
getStockDetail.request(ids)
])
.then(([r1, r2]) => this.buildDisplayTableData(r1, r2))
.then(([r1, r2]) => this.buildDisplayTableData(r1.data, r2.data))
},
//

@ -83,8 +83,9 @@ export default {
this.tableData = []
if (!this.value || isEmpty(this.cid) || this.loading) return
this.loading = true
getDetail.request(this.cid)
.then(data => {
getDetail
.request(this.cid)
.then(({data}) => {
this.prepareData(data)
this.tableData = data
})

@ -150,8 +150,9 @@ export default {
search() {
if (this.config.loading) return
this.config.loading = true
search.request(this.mergeSearchForm())
.then(({list, total}) => {
search
.request(this.mergeSearchForm())
.then(({data: {list, total}}) => {
this.searchForm.total = total
this.tableData = list
})

@ -53,7 +53,7 @@ export default {
this.contextmenu.show = false
getAll
.request()
.then(data => this.$store.commit('dataCache/categories', data))
.then(({data}) => this.$store.commit('dataCache/categories', data))
.finally(() => this.loading = false)
},

@ -113,7 +113,7 @@ export default {
methods: {
getLimitRegion() {
return getLimitRegion.request()
return getLimitRegion.request().then(data => data.data)
},
clearSidSearch() {
@ -141,7 +141,7 @@ export default {
this.type = 'see'
search
.request(this.mergeSearchForm())
.then(({list, total}) => {
.then(({data: {list, total}}) => {
this.searchForm.total = total
this.tableData = list
})

@ -161,7 +161,7 @@ export default {
this.loading = true
get
.request()
.then(data => createTreeByWorker(data))
.then(({data}) => createTreeByWorker(data))
.then(data => {
this.completeDepartment(data)
this.data = data[0]

@ -188,7 +188,7 @@ export default {
mounted() {
getDepartments
.request(false)
.then(data => createTreeByWorker(data))
.then(({data}) => createTreeByWorker(data))
.then(data => {
this.departments = data
})

@ -108,7 +108,7 @@ export default {
this.type = 'see'
search
.request(this.mergeSearchForm())
.then(({list, total}) => {
.then(({data: {list, total}}) => {
list.forEach(i => {
i.departmentId = this.str2intArray(i.departmentId)
i.resourceId = this.str2intArray(i.resourceId)

@ -113,7 +113,7 @@ export default {
methods: {
getLimitRegion() {
return getLimitRegion.request()
return getLimitRegion.request().then(data => data.data)
},
clearSidSearch() {
@ -141,7 +141,7 @@ export default {
this.type = 'see'
search
.request(this.mergeSearchForm())
.then(({list, total}) => {
.then(({data: {list, total}}) => {
this.searchForm.total = total
this.tableData = list
})

@ -30,7 +30,7 @@ export default {
mounted() {
get
.request(false)
.then(data => createTreeByWorker(data))
.then(({data}) => createTreeByWorker(data))
.then(data => {
this.data = data
})

@ -21,7 +21,7 @@ export default {
methods: {
init() {
get.request().then(data => this.roles = data)
get.request().then(({data}) => this.roles = data)
},
emit(v) {

@ -132,7 +132,7 @@ export default {
this.type = 'see'
search
.request(this.mergeSearchForm())
.then(({list, total}) => {
.then(({data: {list, total}}) => {
list.forEach(u => u.avatar = autoCompleteUrl(u.avatar))
this.searchForm.total = total
this.tableData = list

@ -71,7 +71,8 @@ export default {
this.$refs.form.validate(v => {
if (!v) return
this.loading = true
updateUserPwd.request({
updateUserPwd
.request({
oldPwd: md5(this.form.oldPwd),
newPwd: md5(this.form.newPwd),
})

@ -85,7 +85,7 @@ export default {
this.loading = true
this.$refs.cropper.getCropBlob(data => {
upload(new Blob([data]), this.name)
.then(({key}) => updateAvatar.request(key))
.then(({data}) => updateAvatar.request(data.data))
.then(({data, msg}) => {
this.$store.commit('user/avatar', autoCompleteUrl(data))
this.$store.dispatch('user/refresh')

@ -51,7 +51,7 @@ export default {
this.config.loading = true
searchLoginHistory
.request({...this.searchForm, uid: this.uid})
.then(({list, total}) => {
.then(({data: {list, total}}) => {
this.searchForm.total = total
this.tableData = list
})

@ -52,7 +52,7 @@ export default {
this.config.loading = true
searchUserAction
.request({...this.searchForm, uid: this.$store.state.user.id})
.then(({list, total}) => {
.then(({data: {list, total}}) => {
this.searchForm.total = total
this.tableData = list
})

Loading…
Cancel
Save