diff --git a/src/tool/https.js b/src/tool/https.js index 0d1c4108..3cfbfa8e 100644 --- a/src/tool/https.js +++ b/src/tool/https.js @@ -478,14 +478,15 @@ export const Https = { }, - axiosGet(url, config) { + axiosGet(url, config, pathParams) { return new Promise((resolve, reject) => { if (isLoginTime && url != '/api/portfolio/page') { resolve('') return } + axios - .get(url, config) + .get(setPathParams(url, pathParams), config) .then(response => { resolve(response) }) @@ -495,14 +496,14 @@ export const Https = { }) }, - axiosPut(url, data) { + axiosPut(url, data, pathParams) { return new Promise((resolve, reject) => { if (isLoginTime && url != '/api/portfolio/page') { resolve('') return } axios - .put(url, data) + .put(setPathParams(url, pathParams), data) .then(response => { resolve(response) }) @@ -512,14 +513,14 @@ export const Https = { }) }, - axiosPost(url, data, config) { + axiosPost(url, data, config, pathParams) { return new Promise((resolve, reject) => { if (isLoginTime && url != '/api/portfolio/page') { resolve('') return } axios - .post(url, data, config) + .post(setPathParams(url, pathParams), data, config) .then(response => { resolve(response) }) @@ -529,14 +530,14 @@ export const Https = { }) }, - axiosDelete(url, newData) { + axiosDelete(url, newData, pathParams) { return new Promise((resolve, reject) => { if (isLoginTime && url != '/api/portfolio/page') { resolve('') return } axios - .delete(url, { data: newData }) + .delete(setPathParams(url, pathParams), { data: newData }) .then(response => { resolve(response) }) @@ -546,3 +547,12 @@ export const Https = { }) } } + +function setPathParams(url, pathParams = {}) { + const obj = typeof pathParams === 'object' ? pathParams : { id: pathParams } + const keys = Object.keys(obj) + keys.forEach(key => { + url = url.replace(new RegExp(`\\{${key}\\}`, 'g'), obj[key]); + }) + return url +} \ No newline at end of file diff --git a/src/views/HomeMain.vue b/src/views/HomeMain.vue index 7f94cefc..99511844 100644 --- a/src/views/HomeMain.vue +++ b/src/views/HomeMain.vue @@ -1215,6 +1215,7 @@ export default defineComponent({ let payOrder = this.$refs.payOrder payOrder.init(orderId) } + this.getCheckSellerDesigner() }, methods: { setTask(data) { @@ -1378,7 +1379,21 @@ export default defineComponent({ this.store.commit('set_dataLoading', false) }) }, - + //获取是否为卖家 + getCheckSellerDesigner() { + const config = { + params: { + userId: this.userDetail.userId + } + } + Https.axiosGet(Https.httpUrls.checkSellerDesigner, config).then(rv => { + if (rv) { + console.log(rv) + return rv + } + return null + }) + }, setLocale(v) { // 同步更新 localStorage 中的 loginLanguage if (v) {