diff --git a/api-interface/.idea/.gitignore b/api-interface/.idea/.gitignore new file mode 100644 index 0000000..35410ca --- /dev/null +++ b/api-interface/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/api-interface/.idea/MarsCodeWorkspaceAppSettings.xml b/api-interface/.idea/MarsCodeWorkspaceAppSettings.xml new file mode 100644 index 0000000..3b9bb1d --- /dev/null +++ b/api-interface/.idea/MarsCodeWorkspaceAppSettings.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/api-interface/.idea/api-interface.iml b/api-interface/.idea/api-interface.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/api-interface/.idea/api-interface.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/api-interface/.idea/compiler.xml b/api-interface/.idea/compiler.xml new file mode 100644 index 0000000..cfdba17 --- /dev/null +++ b/api-interface/.idea/compiler.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/api-interface/.idea/encodings.xml b/api-interface/.idea/encodings.xml new file mode 100644 index 0000000..7e50513 --- /dev/null +++ b/api-interface/.idea/encodings.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/api-interface/.idea/jarRepositories.xml b/api-interface/.idea/jarRepositories.xml new file mode 100644 index 0000000..712ab9d --- /dev/null +++ b/api-interface/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/api-interface/.idea/misc.xml b/api-interface/.idea/misc.xml new file mode 100644 index 0000000..ba2a02d --- /dev/null +++ b/api-interface/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/api-interface/.idea/modules.xml b/api-interface/.idea/modules.xml new file mode 100644 index 0000000..55d8e64 --- /dev/null +++ b/api-interface/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/api-interface/.idea/vcs.xml b/api-interface/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/api-interface/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/order-app/src/api/order.js b/order-app/src/api/order.js index 2a626ca..4a4189c 100644 --- a/order-app/src/api/order.js +++ b/order-app/src/api/order.js @@ -1,4 +1,10 @@ import http from '../common/http.js' export const splaceOrderApi = (parm) => { return http.post("/wxapi/order/splaceOrder", parm) +} +export const getOrderListApi = (parm) => { + return http.get("/wxapi/order/getOrderList", parm) +} +export const cancelOrderApi = (parm) => { + return http.post("/wxapi/order/cancelOrder", parm) } \ No newline at end of file diff --git a/order-app/src/api/user.js b/order-app/src/api/user.js index 1f806b6..cf87bea 100644 --- a/order-app/src/api/user.js +++ b/order-app/src/api/user.js @@ -65,4 +65,8 @@ export const editAddressApi = (parm) => { export const getAddressApi = (parm) => { console.log("查询默认地址成功") return http.get("/wxapi/address/getAddress", parm) +} +//头像上传 +export const uploadImageApi = (parm) => { + return http.upload(parm) } \ No newline at end of file diff --git a/order-app/src/common/http.js b/order-app/src/common/http.js index c218975..b3d0922 100644 --- a/order-app/src/common/http.js +++ b/order-app/src/common/http.js @@ -1,40 +1,62 @@ - const baseUrl = 'http://localhost:8089' -//const baseUrl = 'http://192.168.31.70:8089' +const baseUrl = 'http://localhost:8089' +//const baseUrl = 'http://192.168.31.70:8089' const http = (options = {}) => { - return new Promise((resolve, reject) => { - uni.request({ - url: baseUrl + options.url || '', - method:options.type || 'GET' , - data: options.data || {}, - header: options.header || {}, - }).then((response) => { - console.log(response) - resolve(response.data); - }).catch(error => { - reject(error) - }) - }); + return new Promise((resolve, reject) => { + uni.request({ + url: baseUrl + options.url || '', + method: options.type || 'GET', + data: options.data || {}, + header: options.header || {}, + }).then((response) => { + console.log(response) + resolve(response.data); + }).catch(error => { + reject(error) + }) + }); } -const get=(url,data,options={})=>{ - options.type='get'; - options.data = data; - options.url = url; - return http(options) +const get = (url, data, options = {}) => { + options.type = 'get'; + options.data = data; + options.url = url; + return http(options) } const post = (url, data, options = {}) => { - options.type = 'post'; - options.data = data; - options.url = url; - return http(options) + options.type = 'post'; + options.data = data; + options.url = url; + return http(options) } const put = (url, data, options = {}) => { - options.type = 'put'; - options.data = data; - options.url = url; - return http(options) + options.type = 'put'; + options.data = data; + options.url = url; + return http(options) +} +const upload = (parm) => { + return new Promise((resolve, reject) => { + uni.uploadFile({ + url: baseUrl + parm.url, + filePath: parm.filePath, + name: 'file', + formData: { + openid: uni.getStorageSync('openid') + }, + header: { + // Authorization: uni.getStorageSync("token") + }, + success: (res) => { + resolve(res.data); + }, + fail: (error) => { + reject(error) + } + }) + }) } export default { - get, - post, - put + get, + post, + put, + upload } \ No newline at end of file diff --git a/order-app/src/pages/category/category.vue b/order-app/src/pages/category/category.vue index 74cf2e7..4ff0dc9 100644 --- a/order-app/src/pages/category/category.vue +++ b/order-app/src/pages/category/category.vue @@ -49,6 +49,7 @@ const scrollTop = ref(0) const current = ref(0) const menuHeight = ref(0) + const menuItemHeight = ref(0) const getImg = () => { return Math.floor(Math.random() * 35) @@ -104,6 +105,7 @@ // }); uni.navigateTo({ + url: '../detail/detail?goods=' + encodeURIComponent(JSON.stringify(item)) }); } diff --git a/order-app/src/pages/mine/mine.vue b/order-app/src/pages/mine/mine.vue index d206dfa..a9acedc 100644 --- a/order-app/src/pages/mine/mine.vue +++ b/order-app/src/pages/mine/mine.vue @@ -1,24 +1,27 @@ @@ -28,12 +31,20 @@ } from '@dcloudio/uni-app'; import { ref, +<<<<<<< HEAD onMounted +======= + getCurrentInstance +>>>>>>> 68b2157c4343ab2af362312b5f64deb4e53904e3 } from 'vue' + import { + userLogin + } from '../../api/user.js' //昵称 const nickName = ref('微信用户') //头像 const avatarUrl = ref('/static/user.jpg') +<<<<<<< HEAD // 页面加载时从缓存读取用户信息 onMounted(() => { const storedAvatar = uni.getStorageSync('avatarUrl') @@ -46,6 +57,33 @@ } }) +======= + const onChooseAvatar = async (e) => { + console.log(e) + avatarUrl.value = e.detail.avatarUrl + uploadImageApi({ + url: "/api/upload/uploadImage", + filePath: e.detail.avatarUrl + }).then((res) => { + console.log(res) + }) + } + const onNickName = (e) => { + console.log(e) + uni.createSelectorQuery().in(instance) // 注意这里要加上 in(this) + .select("#nickname-input") + .fields({ + properties: ["value"], + }) + .exec((res) => { + console.log(res) + nickName.value = res?.[0]?.value + console.log('昵称', nickName.value) + + }) + // nickName.value = e.detail.nickName + } +>>>>>>> 68b2157c4343ab2af362312b5f64deb4e53904e3 //获取头像点击事件 const getUserInfo = () => { console.log('获取用户信息') @@ -149,6 +187,21 @@ } }) } +<<<<<<< HEAD +======= + //跳转详情 + const toOrder = () => { + getUserInfo() + //在起始页面跳转到details.vue页面并传递参数 + uni.navigateTo({ + url: '../order/order' + }); + } + onShow(() => { + userLogin() + getUserInfo() + }) +>>>>>>> 68b2157c4343ab2af362312b5f64deb4e53904e3