多租户商城-商户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
867 B

2 years ago
2 years ago
2 years ago
2 years ago
  1. /*
  2. * 发送请求 mixin
  3. */
  4. import request from './server'
  5. import {getProject} from "@@/utils/auth.js"
  6. /* eslint-disable */
  7. export const sendReq = {
  8. data () {
  9. return {
  10. // 加载中
  11. loading: false,
  12. }
  13. },
  14. methods: {
  15. /*
  16. * 发送请求
  17. */
  18. sendReq (params, callback, errorCallback) {
  19. let self = this
  20. request({
  21. method: params.method || 'POST',
  22. url: params.url,
  23. data: params.data || {},
  24. withCredentials : true,
  25. headers: {
  26. 'Content-type': params.contentType || 'application/json;charset=utf-8',
  27. "project" : getProject()
  28. }
  29. }).then((res) => {
  30. if (res && res.data) {
  31. callback && callback(res.data)
  32. }
  33. }).catch(err => {
  34. if (err) {
  35. errorCallback && errorCallback(err)
  36. }
  37. })
  38. }
  39. }
  40. }