From 6a38b7e1fe22bcebd69d97a1671f3d5e89b41f5f Mon Sep 17 00:00:00 2001
From: xuechunyuan <17853500702@163.com>
Date: Tue, 22 Aug 2023 13:47:11 +0800
Subject: [PATCH] =?UTF-8?q?token=E8=8E=B7=E5=8F=96=EF=BC=8C=E4=B8=8B?=
=?UTF-8?q?=E5=8D=95=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=95=86=E5=93=81=E5=B0=81?=
=?UTF-8?q?=E9=9D=A2=E6=8B=89=E5=8F=96=E6=8E=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
App.vue | 33 +++++++
pages.json | 16 ++++
pages/pages_zhentou/contact/contact.vue | 84 +++++++++++++++++
pages/pages_zhentou/homePage/homePage.vue | 105 +++++++++++++++++++---
pages/pages_zhentou/myPage/myPage.vue | 2 +-
static/image/logo.png | Bin 0 -> 22154 bytes
6 files changed, 225 insertions(+), 15 deletions(-)
create mode 100644 pages/pages_zhentou/contact/contact.vue
create mode 100644 static/image/logo.png
diff --git a/App.vue b/App.vue
index a412bfb..a1e7a22 100644
--- a/App.vue
+++ b/App.vue
@@ -74,6 +74,7 @@
if (res.data.code == 200) {
uni.setStorageSync('userInfo', JSON.stringify(res.data.data));
uni.setStorageSync('phone', res.data.data.phone);
+ this.doLogin(res.data.data.username, res.data.data.phone);
} else {
uni.showToast({
title: res.data.msg,
@@ -83,6 +84,38 @@
}
})
},
+ //登录
+ doLogin(username, phone) {
+ uni.showLoading({
+ title: '登录中',
+ mask: true
+ });
+ uni.request({
+ url: this.globalData.baseUrl + '/blade-auth/getToken',
+ method: 'POST',
+ data: {
+ openId: this.globalData.openId,
+ username: username,
+ phone: phone
+ },
+ header: {
+ 'Authorization': 'Basic c2FiZXI6c2FiZXJfc2VjcmV0'
+ },
+ success: (res) => {
+ if (res.data.code == 200) {
+ uni.setStorageSync('token', res.data.data.access_token);
+ } else {
+ uni.showToast({
+ title: res.data.msg,
+ icon: 'none'
+ })
+ }
+ },
+ complete: () => {
+ uni.hideLoading();
+ }
+ })
+ },
//微信登陆
wxLogin() {
uni.login({
diff --git a/pages.json b/pages.json
index 094db33..e7e1a72 100644
--- a/pages.json
+++ b/pages.json
@@ -126,6 +126,22 @@
}
}
}
+ },
+ {
+ "path": "pages/pages_zhentou/contact/contact",
+ "style": {
+ "navigationBarTitleText": "售后服务",
+ "app-plus": {
+ "titleNView": {
+ // "buttons": [{
+ // "text": "\ue534",
+ // "fontSrc": "/static/uni.ttf",
+ // "fontSize": "22px",
+ // "color": "#FFFFFF"
+ // }]
+ }
+ }
+ }
}
],
// "subPackages": [{
diff --git a/pages/pages_zhentou/contact/contact.vue b/pages/pages_zhentou/contact/contact.vue
new file mode 100644
index 0000000..8573096
--- /dev/null
+++ b/pages/pages_zhentou/contact/contact.vue
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+ 壹人壹枕
+
+
+ 扫描二维码,添加客服企业微信
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/pages_zhentou/homePage/homePage.vue b/pages/pages_zhentou/homePage/homePage.vue
index d5fa7b8..e357d60 100644
--- a/pages/pages_zhentou/homePage/homePage.vue
+++ b/pages/pages_zhentou/homePage/homePage.vue
@@ -1,7 +1,7 @@
-
+
@@ -29,7 +29,8 @@
hasUserInfo: false,
canIUseGetUserProfile: false,
phone: '',
- hasPhone: false
+ hasPhone: false,
+ bgSrc: '', //背景图片
}
},
onShow() {
@@ -46,16 +47,58 @@
this.userInfo = JSON.parse(userInfo);
this.hasUserInfo = true;
}
+ //商品信息
+ if (this.bgSrc == '') {
+ this.queryGoodsInfo();
+ }
},
methods: {
+ //商品信息
+ queryGoodsInfo() {
+ uni.request({
+ url: 'http://192.168.1.106:80/blade-system/dict-biz/get-goods-info',
+ method: 'GET',
+ success: (res) => {
+ if (JSON.stringify(res.data.data) !== '{}') {
+ this.bgSrc = res.data.data.imgPath;
+ } else {
+ this.bgSrc = '../../../static/image/bag.jpg';
+ }
+ }
+ })
+ },
// 点击定制
clickCustom() {
console.log('点击定制');
+ uni.request({
+ url: 'http://192.168.1.106:80/blade-desk/order/save', //getApp().globalData.baseUrl + '/blade-desk/order/save',
+ method: 'POST',
+ data: {
+ buyerId: this.userInfo.id,
+ buyerName: this.userInfo.username,
+ buyerPhone: this.phone
+ },
+ header: {
+ 'Blade-Auth': 'bearer ' + uni.getStorageSync('token')
+ },
+ success: (res) => {
+ if (res.data.code == 200) {
+
+ } else if (res.data.code == 401) {
+
+ } else {
+ uni.showToast({
+ title: res.data.msg,
+ icon: 'none'
+ })
+ }
+ }
+ })
},
// 跳转到我的页面
- turnMyPage(){
+ turnMyPage() {
uni.navigateTo({
- url:"/pages/pages_zhentou/myPage/myPage"
+ url: "/pages/pages_zhentou/myPage/myPage"
})
},
// 填写表单
@@ -77,7 +120,7 @@
console.log(res)
this.userInfo = res.userInfo;
this.hasUserInfo = true;
- uni.setStorageSync('userInfo', JSON.stringify(res.userInfo));
+ // uni.setStorageSync('userInfo', JSON.stringify(res.userInfo));
},
fail: (err) => {
console.log(err)
@@ -131,6 +174,38 @@
}
})
},
+ //登录
+ doLogin() {
+ uni.showLoading({
+ title: '登录中',
+ mask: true
+ });
+ uni.request({
+ url: getApp().globalData.baseUrl + '/blade-auth/getToken',
+ method: 'POST',
+ data: {
+ openId: getApp().globalData.openId,
+ username: this.userInfo.username,
+ phone: this.phone
+ },
+ header: {
+ 'Authorization': 'Basic c2FiZXI6c2FiZXJfc2VjcmV0'
+ },
+ success: (res) => {
+ if (res.data.code == 200) {
+ uni.setStorageSync('token', res.data.data.access_token);
+ } else {
+ uni.showToast({
+ title: res.data.msg,
+ icon: 'none'
+ })
+ }
+ },
+ complete: () => {
+ uni.hideLoading();
+ }
+ })
+ }
}
}
@@ -138,12 +213,13 @@