|
@@ -6,7 +6,7 @@
|
|
|
</view>
|
|
|
<view class="news">
|
|
|
<image :src="avatar"></image>
|
|
|
- <view v-if="name" class="phone">{{name}}</view>
|
|
|
+ <view v-if="userInfo" class="phone">{{ userInfo.realName }}</view>
|
|
|
<view v-else class="phone" @click="toLogin()">点击登录</view>
|
|
|
</view>
|
|
|
<view class="content">
|
|
@@ -47,15 +47,14 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import config from '@/config'
|
|
|
-import { loginWx,logout } from '@/apis/user.js'
|
|
|
+import {logout} from '@/apis/user.js'
|
|
|
+
|
|
|
export default {
|
|
|
components: {},
|
|
|
data() {
|
|
|
return {
|
|
|
- name: uni.getStorageSync('name'),
|
|
|
+ userInfo: uni.getStorageSync('userInfo'),
|
|
|
token: uni.getStorageSync('token'),
|
|
|
- code: '',
|
|
|
bgImg: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/bg_top%403x.png",
|
|
|
logoImg: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/img_logo%403x.png",
|
|
|
tongzhi: "https://ovp-shop.oss-cn-hangzhou.aliyuncs.com/static/9dshop/ic_tongzhi%403x.png",
|
|
@@ -89,97 +88,14 @@ export default {
|
|
|
computed: {},
|
|
|
watch: {},
|
|
|
onLoad() {
|
|
|
-
|
|
|
- let token = uni.getStorageSync('token')
|
|
|
- if(!token){
|
|
|
- this.toLogin()
|
|
|
- }
|
|
|
- // if(code !== null || code !== "") {
|
|
|
- // this.getOpenidAndUserinfo(code)
|
|
|
- // }
|
|
|
+ this.changeTabbar()
|
|
|
},
|
|
|
onShow() {
|
|
|
- this.changeTabbar()
|
|
|
+
|
|
|
},
|
|
|
methods: {
|
|
|
+ toLogin(){
|
|
|
|
|
|
- toLogin() {
|
|
|
- let isWX = this.isWechat()
|
|
|
- if (isWX) {
|
|
|
- // let code = this.getUrlCode('code')
|
|
|
- let code = '001t0H000xuK7U'
|
|
|
- uni.showToast({
|
|
|
- title: code,
|
|
|
- })
|
|
|
- if (code !== null && code !== undefined) {
|
|
|
- this.code = code
|
|
|
- this.getOpenidAndUserinfo(code)
|
|
|
- } else {
|
|
|
- this.getCode()
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- // 判断是否为微信环境
|
|
|
- isWechat() {
|
|
|
- var ua = navigator.userAgent.toLowerCase()
|
|
|
-
|
|
|
- var isWXWork = ua.match(/wxwork/i) == 'wxwork'
|
|
|
-
|
|
|
- var isWeixin = !isWXWork && ua.match(/MicroMessenger/i) == 'micromessenger'
|
|
|
- return isWeixin
|
|
|
-
|
|
|
- },
|
|
|
- getCode() {
|
|
|
- const appid = config.appid
|
|
|
- let loc_href = encodeURIComponent(window.location.href);
|
|
|
- let mainstate = Math.random()
|
|
|
- let wxUrl = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${loc_href}&response_type=code&scope=snsapi_base&state=${mainstate}#wechat_redirect`;
|
|
|
- window.location.href = wxUrl;
|
|
|
- },
|
|
|
- getUrlCode(name) {
|
|
|
- return new URL(window.location.href).searchParams.get(name + '')
|
|
|
- },
|
|
|
-
|
|
|
- getOpenidAndUserinfo(code){
|
|
|
- loginWx({
|
|
|
- code: code
|
|
|
- }).then(res => {
|
|
|
- const {
|
|
|
- name,
|
|
|
- customerVo,
|
|
|
- token,
|
|
|
- } = res
|
|
|
- uni.setStorageSync('openId', openId)
|
|
|
- const userInfo = uni.getStorageSync('userInfo')
|
|
|
- if (token) { // 登录成功 后更新用户信息
|
|
|
-
|
|
|
- uni.setStorageSync('accessToken', token)
|
|
|
- uni.setStorageSync('name', name)
|
|
|
- this.name = name
|
|
|
- // uni.setStorageSync('userInfo', customerVo)
|
|
|
- // 设置默认地址
|
|
|
- // addressFind().then(addrList => {
|
|
|
- // const defaultAddrIndex = addrList.findIndex(item => item.defaultFlag === 1);
|
|
|
- // defaultAddrIndex !== -1 && uni.setStorageSync('currentBuyerAddr', addrList[
|
|
|
- // defaultAddrIndex]);
|
|
|
- // })
|
|
|
- }
|
|
|
- if (!token) { // 未登录过
|
|
|
- // const channel = getUrlParamsNormal('channel')
|
|
|
- // if (channel === 'qrcode') { // 扫码进入的页面
|
|
|
- // uni.redirectTo({
|
|
|
- // url: '/pages/card/cardPhysical/index'
|
|
|
- // })
|
|
|
- // } else { // 进入登录
|
|
|
- // uni.redirectTo({
|
|
|
- // url: '/pages/login/index'
|
|
|
- // })
|
|
|
- // }
|
|
|
- uni.switchTab({
|
|
|
- url: '/pages/user/index'
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
},
|
|
|
changeTabbar() {
|
|
|
uni.setTabBarStyle({
|
|
@@ -190,13 +106,13 @@ export default {
|
|
|
},
|
|
|
toOrder(item) {
|
|
|
this.$router.push({
|
|
|
- path: '/pages/order/index?status=' + item.value
|
|
|
- })
|
|
|
+ path: '/pages/order/index?status=' + item.value
|
|
|
+ })
|
|
|
},
|
|
|
- outLogin(){
|
|
|
+ outLogin() {
|
|
|
logout().then(res => {
|
|
|
- uni.removeStorageSync('accessToken')
|
|
|
- uni.removeStorageSync('name')
|
|
|
+ uni.removeStorageSync('token')
|
|
|
+ uni.removeStorageSync('userInfo')
|
|
|
this.name = ''
|
|
|
this.token = ''
|
|
|
})
|
|
@@ -224,42 +140,42 @@ export default {
|
|
|
background-position: top;
|
|
|
|
|
|
.title {
|
|
|
- padding: 16rpx 32rpx;
|
|
|
+ padding: 16 rpx 32 rpx;
|
|
|
|
|
|
image {
|
|
|
- height: 56rpx;
|
|
|
+ height: 56 rpx;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.news {
|
|
|
- padding: 64rpx 48rpx 0;
|
|
|
+ padding: 64 rpx 48 rpx 0;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
|
|
|
image {
|
|
|
- width: 104rpx;
|
|
|
- height: 104rpx;
|
|
|
+ width: 104 rpx;
|
|
|
+ height: 104 rpx;
|
|
|
background-color: aqua;
|
|
|
border-radius: 50%;
|
|
|
}
|
|
|
|
|
|
.phone {
|
|
|
font-weight: bold;
|
|
|
- font-size: 44rpx;
|
|
|
+ font-size: 44 rpx;
|
|
|
color: #0D121A;
|
|
|
- margin-left: 32rpx;
|
|
|
+ margin-left: 32 rpx;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.content {
|
|
|
- padding: 0 24rpx;
|
|
|
- margin-top: 40rpx;
|
|
|
+ padding: 0 24 rpx;
|
|
|
+ margin-top: 40 rpx;
|
|
|
box-sizing: content-box;
|
|
|
}
|
|
|
|
|
|
.more {
|
|
|
- width: 32rpx;
|
|
|
- height: 32rpx;
|
|
|
+ width: 32 rpx;
|
|
|
+ height: 32 rpx;
|
|
|
}
|
|
|
|
|
|
.order-wrap {
|
|
@@ -270,11 +186,11 @@ export default {
|
|
|
|
|
|
.unpay {
|
|
|
// box-sizing: border-box;
|
|
|
- width: 638rpx;
|
|
|
+ width: 638 rpx;
|
|
|
background: #FFEEE2;
|
|
|
- border-radius: 24rpx 24rpx 0rpx 0rpx;
|
|
|
- border: 2rpx solid #FFFEFD;
|
|
|
- padding: 16rpx 18rpx 16rpx 16rpx;
|
|
|
+ border-radius: 24 rpx 24 rpx 0 rpx 0 rpx;
|
|
|
+ border: 2 rpx solid #FFFEFD;
|
|
|
+ padding: 16 rpx 18 rpx 16 rpx 16 rpx;
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
@@ -284,14 +200,14 @@ export default {
|
|
|
align-items: center;
|
|
|
|
|
|
image {
|
|
|
- width: 48rpx;
|
|
|
- height: 48rpx;
|
|
|
+ width: 48 rpx;
|
|
|
+ height: 48 rpx;
|
|
|
}
|
|
|
|
|
|
.tip {
|
|
|
- font-size: 24rpx;
|
|
|
+ font-size: 24 rpx;
|
|
|
color: #FF7441;
|
|
|
- margin-left: 14rpx;
|
|
|
+ margin-left: 14 rpx;
|
|
|
|
|
|
text {
|
|
|
font-weight: bold;
|
|
@@ -300,26 +216,26 @@ export default {
|
|
|
}
|
|
|
|
|
|
.right {
|
|
|
- width: 120rpx;
|
|
|
- height: 44rpx;
|
|
|
+ width: 120 rpx;
|
|
|
+ height: 44 rpx;
|
|
|
font-weight: 500;
|
|
|
background: #FF7441;
|
|
|
- border-radius: 24rpx;
|
|
|
- font-size: 24rpx;
|
|
|
+ border-radius: 24 rpx;
|
|
|
+ font-size: 24 rpx;
|
|
|
color: #FFFFFF;
|
|
|
text-align: center;
|
|
|
- line-height: 44rpx;
|
|
|
+ line-height: 44 rpx;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.order {
|
|
|
- padding: 32rpx 32rpx 40rpx;
|
|
|
+ padding: 32 rpx 32 rpx 40 rpx;
|
|
|
width: 100%;
|
|
|
box-sizing: border-box;
|
|
|
- height: 260rpx;
|
|
|
+ height: 260 rpx;
|
|
|
background: linear-gradient(180deg, #DEF5FD 0%, #FFFFFF 100%);
|
|
|
- border-radius: 32rpx;
|
|
|
- border: 2rpx solid #FFFFFF;
|
|
|
+ border-radius: 32 rpx;
|
|
|
+ border: 2 rpx solid #FFFFFF;
|
|
|
|
|
|
.order_top {
|
|
|
display: flex;
|
|
@@ -328,19 +244,19 @@ export default {
|
|
|
|
|
|
.mytt {
|
|
|
font-weight: 500;
|
|
|
- font-size: 32rpx;
|
|
|
+ font-size: 32 rpx;
|
|
|
color: #0D121A;
|
|
|
}
|
|
|
|
|
|
.myall {
|
|
|
font-weight: 400;
|
|
|
- font-size: 26rpx;
|
|
|
+ font-size: 26 rpx;
|
|
|
color: #0D121A;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
|
|
|
.all {
|
|
|
- margin-right: 8rpx;
|
|
|
+ margin-right: 8 rpx;
|
|
|
|
|
|
}
|
|
|
}
|
|
@@ -350,23 +266,23 @@ export default {
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
|
- margin-top: 48rpx;
|
|
|
+ margin-top: 48 rpx;
|
|
|
|
|
|
.order-box-item {
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
align-items: center;
|
|
|
- width: 128rpx;
|
|
|
+ width: 128 rpx;
|
|
|
|
|
|
image {
|
|
|
- width: 64rpx;
|
|
|
- height: 64rpx;
|
|
|
+ width: 64 rpx;
|
|
|
+ height: 64 rpx;
|
|
|
}
|
|
|
|
|
|
.name {
|
|
|
- font-size: 24rpx;
|
|
|
+ font-size: 24 rpx;
|
|
|
color: #0D121A;
|
|
|
- margin-top: 16rpx;
|
|
|
+ margin-top: 16 rpx;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -375,37 +291,37 @@ export default {
|
|
|
|
|
|
.cantact {
|
|
|
width: 100%;
|
|
|
- height: 112rpx;
|
|
|
+ height: 112 rpx;
|
|
|
background: #FFFFFF;
|
|
|
- border-radius: 24rpx;
|
|
|
+ border-radius: 24 rpx;
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
align-items: center;
|
|
|
- padding: 24rpx 32rpx;
|
|
|
- margin-top: 24rpx;
|
|
|
+ padding: 24 rpx 32 rpx;
|
|
|
+ margin-top: 24 rpx;
|
|
|
|
|
|
.canl {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
|
|
|
image {
|
|
|
- margin-right: 24rpx;
|
|
|
- width: 64rpx;
|
|
|
- height: 64rpx;
|
|
|
+ margin-right: 24 rpx;
|
|
|
+ width: 64 rpx;
|
|
|
+ height: 64 rpx;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
.outline {
|
|
|
- width: 622rpx;
|
|
|
- height: 96rpx;
|
|
|
- border-radius: 36rpx;
|
|
|
- border: 4rpx solid #E2E4EB;
|
|
|
- font-size: 28rpx;
|
|
|
+ width: 622 rpx;
|
|
|
+ height: 96 rpx;
|
|
|
+ border-radius: 36 rpx;
|
|
|
+ border: 4 rpx solid #E2E4EB;
|
|
|
+ font-size: 28 rpx;
|
|
|
color: #0D121A;
|
|
|
text-align: center;
|
|
|
- line-height: 96rpx;
|
|
|
- margin: 48rpx auto;
|
|
|
+ line-height: 96 rpx;
|
|
|
+ margin: 48 rpx auto;
|
|
|
}
|
|
|
}
|
|
|
</style>
|