diff --git a/order-app/src/api/category.js b/order-app/src/api/category.js
new file mode 100644
index 0000000..4f5a831
--- /dev/null
+++ b/order-app/src/api/category.js
@@ -0,0 +1,5 @@
+import http from '../common/http.js'
+//分类数据
+export const getCategoryListApi = () => {
+ return http.get("/wxapi/category/getCategoryList")
+}
\ No newline at end of file
diff --git a/order-app/src/api/home.js b/order-app/src/api/home.js
index 5a896f7..71a8ac4 100644
--- a/order-app/src/api/home.js
+++ b/order-app/src/api/home.js
@@ -3,7 +3,6 @@ import http from '../common/http.js'
export const getSwipperListApi = ()=>{
return http.get("/api/home/getSwipperList")
}
-
//首页热推
export const getHotListApi = ()=>{
return http.get("/api/home/getHotList")
diff --git a/order-app/src/api/user.js b/order-app/src/api/user.js
new file mode 100644
index 0000000..afb8832
--- /dev/null
+++ b/order-app/src/api/user.js
@@ -0,0 +1,48 @@
+import http from '../common/http.js'
+//获取code
+export const getCode = () => {
+ const promise = new Promise((resolve, reject) => {
+ uni.login({
+ provider: 'weixin', //使用微信登录
+ success: function(loginRes) {
+ console.log('8888888888')
+ console.log(loginRes.code);
+ //如果返回数据
+ if (loginRes && loginRes.code) {
+ //数据返回
+ resolve(loginRes.code)
+ } else {
+ reject(loginRes)
+ }
+ }
+ })
+ }).catch(res => {
+ uni.showToast({
+ icon: 'none',
+ title: res.errMsg || '获取code失败!'
+ })
+ })
+ return promise;
+}
+//小程序登录
+export const wxLoginApi = (code) => {
+ return http.post('/wxapi/user/wxLogin', {
+ code: code
+ })
+}
+//封装登录
+export const userLogin = async () => {
+ //获取code
+ let res = await getCode()
+ //登录: 调用我们自己的后端接口
+ const {
+ data
+ } = await wxLoginApi(res)
+ console.log('登录')
+ console.log(data)
+ if (data) {
+ //存储
+ uni.setStorageSync('openid', data.openid)
+ uni.setStorageSync('sessionkey', data.sessionKey)
+ }
+}
\ No newline at end of file
diff --git a/order-app/src/common/http.js b/order-app/src/common/http.js
index 52788f2..c218975 100644
--- a/order-app/src/common/http.js
+++ b/order-app/src/common/http.js
@@ -1,4 +1,5 @@
-const baseUrl = 'http://localhost:8089'
+ const baseUrl = 'http://localhost:8089'
+//const baseUrl = 'http://192.168.31.70:8089'
const http = (options = {}) => {
return new Promise((resolve, reject) => {
uni.request({
diff --git a/order-app/src/pages.json b/order-app/src/pages.json
index 6cf9333..1540273 100644
--- a/order-app/src/pages.json
+++ b/order-app/src/pages.json
@@ -1,5 +1,11 @@
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
+ /* {
+ "path": "pages/address/address",
+ "style": {
+ "navigationBarTitleText": ""
+ }
+ }, */
{
"path": "pages/index/index",
"style": {
@@ -11,33 +17,35 @@
"navigationBarTitleText": "分类",
"enablePullDownRefresh": false
}
-
}, {
"path": "pages/car/car",
"style": {
"navigationBarTitleText": "购物车",
"enablePullDownRefresh": false
}
-
}, {
"path": "pages/mine/mine",
"style": {
"navigationBarTitleText": "我的",
"enablePullDownRefresh": false
}
-
- },
- {
+ }, {
"path": "pages/detail/detail",
"style": {
"navigationBarTitleText": ""
}
- },{
+ }, {
"path": "pages/address/address",
"style": {
"navigationBarTitleText": ""
}
- }
+ },
+ {
+ "path" : "common/common",
+ "style" :
+ {
+ "navigationBarTitleText" : ""
+ } }
],
"globalStyle": {
// 导航字体颜色,仅支持 black/white
diff --git a/order-app/src/pages/car/car.vue b/order-app/src/pages/car/car.vue
index 74d9a11..7e19901 100644
--- a/order-app/src/pages/car/car.vue
+++ b/order-app/src/pages/car/car.vue
@@ -57,9 +57,9 @@
const checked = ref(true);
//获取购物车数据
const goods = computed(() => {
- if(store.carList.length == 0){
+ if (store.carList.length == 0) {
allchecked.value = false;
- }else{
+ } else {
allchecked.value = true;
}
return store.carList
@@ -101,18 +101,19 @@
}
const reduce = (item) => {
+ console.log(item)
let num = item.num
if (num > 1) {
num -= 1
} else if (num = 1) {
- store.carList.map((dom, i) => {
+ goods.map((dom, i) => {
if (dom.goodsID == item.goodsID) {
- store.carList.splice(i, 1)
+ goods.splice(i, 1)
}
})
}
item.num = num;
- if (store.carList.length == 0) {
+ if (goods.length == 0) {
allchecked.value = false;
}
}
diff --git a/order-app/src/pages/category/category.vue b/order-app/src/pages/category/category.vue
index f6ce2ec..ff445b6 100644
--- a/order-app/src/pages/category/category.vue
+++ b/order-app/src/pages/category/category.vue
@@ -5,7 +5,8 @@
- {{item.name}}
+
+ {{item.categoryName}}
@@ -16,9 +17,10 @@
{{item.name}}
-->
-
-
-
+
+
+
@@ -30,84 +32,76 @@
@@ -229,5 +223,5 @@
width: 120rpx;
height: 120rpx;
}
-
+
\ No newline at end of file
diff --git a/order-app/src/pages/detail/detail.vue b/order-app/src/pages/detail/detail.vue
index 07288d5..3bfd1e6 100644
--- a/order-app/src/pages/detail/detail.vue
+++ b/order-app/src/pages/detail/detail.vue
@@ -32,22 +32,7 @@
- 我是内容一
- 我是内容一
- 我是内容一
- 我是内容一
- 我是内容一
- 我是内容一
- 我是内容一
- 我是内容一
- 我是内容一
- 我是内容一
- 我是内容一
- 我是内容一
- 我是内容一
- 我是内容一
- 我是内容一
- 我是内容一
+
@@ -79,11 +64,11 @@
-
+
首页
-
+
购物车
@@ -97,6 +82,9 @@