token获取,下单接口,商品封面拉取接口

main
xuechunyuan 2 years ago
parent 290343055a
commit 6a38b7e1fe
  1. 33
      App.vue
  2. 16
      pages.json
  3. 84
      pages/pages_zhentou/contact/contact.vue
  4. 105
      pages/pages_zhentou/homePage/homePage.vue
  5. 2
      pages/pages_zhentou/myPage/myPage.vue
  6. BIN
      static/image/logo.png

@ -74,6 +74,7 @@
if (res.data.code == 200) { if (res.data.code == 200) {
uni.setStorageSync('userInfo', JSON.stringify(res.data.data)); uni.setStorageSync('userInfo', JSON.stringify(res.data.data));
uni.setStorageSync('phone', res.data.data.phone); uni.setStorageSync('phone', res.data.data.phone);
this.doLogin(res.data.data.username, res.data.data.phone);
} else { } else {
uni.showToast({ uni.showToast({
title: res.data.msg, 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() { wxLogin() {
uni.login({ uni.login({

@ -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": [{ // "subPackages": [{

@ -0,0 +1,84 @@
<template>
<view>
<view class="contact_box">
<view class="qrcode_bg">
<image src="../../../static/image/logo.png" class="contact_logo"></image>
<image src="../../../static/image/add.png" class="qrcode"></image>
<view class="contact_txt">
<image src="../../../static/image/icon-contact.png" style="width: 44rpx; height: 44rpx;"></image>
<text class="txt">壹人壹枕</text>
</view>
</view>
<view class="contact_des">扫描二维码添加客服企业微信</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {}
},
methods: {}
}
</script>
<style lang="scss" scoped>
.contact_box {
background-color: #fff;
margin: 30rpx;
border-radius: 30rpx;
padding-top: 128rpx;
overflow: hidden;
.contact_des {
line-height: 33rpx;
font-size: 24rpx;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #999999;
text-align: center;
margin: 50rpx 0 80rpx;
}
.qrcode_bg {
position: relative;
width: 325rpx;
height: 484rpx;
background: #FCEFEF;
border-radius: 20rpx;
padding: 0 30rpx;
margin: 0 auto;
.contact_logo {
width: 96rpx;
height: 96rpx;
position: absolute;
left: 50%;
top: -48rpx;
margin: 0 0 0 -48rpx;
}
.qrcode{
width: 325rpx;
height: 325rpx;
margin-top: 73rpx;
}
.contact_txt {
display: flex;
flex-flow: row wrap;
justify-content: center;
margin-top: 21rpx;
.txt {
color: #333333;
line-height: 44rpx;
font-size: 26rpx;
font-family: PingFang SC-Bold, PingFang SC;
font-weight: bold;
margin-left: 10rpx;
}
}
}
}
</style>

@ -1,7 +1,7 @@
<template> <template>
<view> <view>
<view class="img_box"> <view class="img_box">
<image class="img" mode="widthFix" src="../../../static/image/bag.jpg"></image> <image class="img" mode="widthFix" :src="bgSrc"></image>
<!-- <img class="img" src="../../../static/image/bag.jpg" mode=""></img> --> <!-- <img class="img" src="../../../static/image/bag.jpg" mode=""></img> -->
</view> </view>
<view class="per_box" @click="turnMyPage"> <view class="per_box" @click="turnMyPage">
@ -29,7 +29,8 @@
hasUserInfo: false, hasUserInfo: false,
canIUseGetUserProfile: false, canIUseGetUserProfile: false,
phone: '', phone: '',
hasPhone: false hasPhone: false,
bgSrc: '', //
} }
}, },
onShow() { onShow() {
@ -46,16 +47,58 @@
this.userInfo = JSON.parse(userInfo); this.userInfo = JSON.parse(userInfo);
this.hasUserInfo = true; this.hasUserInfo = true;
} }
//
if (this.bgSrc == '') {
this.queryGoodsInfo();
}
}, },
methods: { 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() { clickCustom() {
console.log('点击定制'); 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({ uni.navigateTo({
url:"/pages/pages_zhentou/myPage/myPage" url: "/pages/pages_zhentou/myPage/myPage"
}) })
}, },
// //
@ -77,7 +120,7 @@
console.log(res) console.log(res)
this.userInfo = res.userInfo; this.userInfo = res.userInfo;
this.hasUserInfo = true; this.hasUserInfo = true;
uni.setStorageSync('userInfo', JSON.stringify(res.userInfo)); // uni.setStorageSync('userInfo', JSON.stringify(res.userInfo));
}, },
fail: (err) => { fail: (err) => {
console.log(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();
}
})
}
} }
} }
</script> </script>
@ -138,12 +213,13 @@
<style lang="scss" scoped> <style lang="scss" scoped>
.img_box { .img_box {
padding-bottom: 180rpx; padding-bottom: 180rpx;
.img { .img {
width: 100%; width: 100%;
} }
} }
.per_box{ .per_box {
width: 70rpx; width: 70rpx;
height: 118rpx; height: 118rpx;
background: rgba(255, 255, 255, 0.8); background: rgba(255, 255, 255, 0.8);
@ -156,17 +232,18 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
cursor: pointer; cursor: pointer;
.image_box{ .image_box {
width: 44rpx; width: 44rpx;
height: 44rpx; height: 44rpx;
.img{ .img {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
} }
.per_txt{
.per_txt {
margin-top: 10rpx; margin-top: 10rpx;
color: #333; color: #333;
font-size: 24rpx; font-size: 24rpx;
@ -196,13 +273,13 @@
align-items: center; align-items: center;
justify-content: center; justify-content: center;
margin-top: 30rpx; margin-top: 30rpx;
// &:first-child { // &:first-child {
// background: #E9B332; // background: #E9B332;
// margin-bottom: 40rpx; // margin-bottom: 40rpx;
// display: flex; // display: flex;
// flex-direction: column; // flex-direction: column;
// .form_txt{ // .form_txt{
// height: 50rpx; // height: 50rpx;
// font-size: 28rpx; // font-size: 28rpx;

@ -56,7 +56,7 @@
}, },
returnContact(){ returnContact(){
uni.navigateTo({ uni.navigateTo({
url:"/pages/pages_zhentou/myPage/address" url:"/pages/pages_zhentou/contact/contact"
}) })
}, },
returnAddress(){ returnAddress(){

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Loading…
Cancel
Save