Merge remote-tracking branch 'remotes/old/zmj' into old
This commit is contained in:
commit
c883775f4d
@ -1,351 +1,365 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class='mask' v-if='isShowAuth && code' @click='close'></view>
|
||||
<view class='Popup' v-if='isShowAuth && code' :style="'top:'+top+'px;'">
|
||||
<!-- <view class="logo-auth">
|
||||
<view>
|
||||
<view class='mask' v-if='isShowAuth && code' @click='close'></view>
|
||||
<view class='Popup' v-if='isShowAuth && code' :style="'top:'+top+'px;'">
|
||||
<!-- <view class="logo-auth">
|
||||
<image class="image" :src='routine_logo' mode="aspectFit"></image>
|
||||
</view> -->
|
||||
<!--#ifdef H5-->
|
||||
<text v-if="isWeixin" class='title'>授权提醒</text>
|
||||
<text v-else class='title'>{{title}}</text>
|
||||
<!--#endif-->
|
||||
<!--#ifdef APP-PLUS-->
|
||||
<text class='title'>用户登录</text>
|
||||
<!--#endif-->
|
||||
<!--#ifdef MP-->
|
||||
<text class='title'>{{title}}</text>
|
||||
<!--#endif-->
|
||||
<!--#ifdef H5-->
|
||||
<text v-if="isWeixin" class='tip'>请授权头像等信息,以便为您提供更好的服务!</text>
|
||||
<text v-else class='tip'>{{info}}</text>
|
||||
<!--#endif-->
|
||||
<!--#ifdef APP-PLUS-->
|
||||
<text class='tip'>请登录,将为您提供更好的服务!</text>
|
||||
<!--#endif-->
|
||||
<!--#ifdef MP-->
|
||||
<text class='tip'>{{info}}</text>
|
||||
<!--#endif-->
|
||||
<view class='bottom flex'>
|
||||
<text class='item' @click='close'>随便逛逛</text>
|
||||
<!-- #ifdef MP -->
|
||||
<button class="item grant" hover-class="none" @tap="getUserProfile"><text class="text">去授权</text></button>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<button class="item grant" @tap="toWecahtAuth">
|
||||
<text class="text">去登录</text>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef H5 -->
|
||||
<button class="item grant" @tap="toWecahtAuth">
|
||||
<text v-if="isWeixin" class="text">去授权</text>
|
||||
<text v-else class="text">去登录</text>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- #ifdef MP -->
|
||||
<editUserModal :isShow="editModal" @closeEdit="closeEdit" @editSuccess="editSuccess"></editUserModal>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
<!--#ifdef H5-->
|
||||
<text v-if="isWeixin" class='title'>授权提醒</text>
|
||||
<text v-else class='title'>{{title}}</text>
|
||||
<!--#endif-->
|
||||
<!--#ifdef APP-PLUS-->
|
||||
<text class='title'>用户登录</text>
|
||||
<!--#endif-->
|
||||
<!--#ifdef MP-->
|
||||
<text class='title'>{{title}}</text>
|
||||
<!--#endif-->
|
||||
<!--#ifdef H5-->
|
||||
<text v-if="isWeixin" class='tip'>请授权头像等信息,以便为您提供更好的服务!</text>
|
||||
<text v-else class='tip'>{{info}}</text>
|
||||
<!--#endif-->
|
||||
<!--#ifdef APP-PLUS-->
|
||||
<text class='tip'>请登录,将为您提供更好的服务!</text>
|
||||
<!--#endif-->
|
||||
<!--#ifdef MP-->
|
||||
<text class='tip'>{{info}}</text>
|
||||
<!--#endif-->
|
||||
<view class='bottom flex'>
|
||||
<text class='item' @click='close'>随便逛逛</text>
|
||||
<!-- #ifdef MP -->
|
||||
<button class="item grant" hover-class="none" @tap="getUserProfile"><text
|
||||
class="text">去授权</text></button>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef APP-PLUS -->
|
||||
<button class="item grant" @tap="toWecahtAuth">
|
||||
<text class="text">去登录</text>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef H5 -->
|
||||
<button class="item grant" @tap="toWecahtAuth">
|
||||
<text v-if="isWeixin" class="text">去授权</text>
|
||||
<text v-else class="text">去登录</text>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
<!-- #ifdef MP -->
|
||||
<editUserModal :isShow="editModal" @closeEdit="closeEdit" @editSuccess="editSuccess"></editUserModal>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
const app = getApp();
|
||||
import Cache from '../utils/cache';
|
||||
import {
|
||||
getLogo,
|
||||
commonAuth
|
||||
} from '../api/public';
|
||||
import { LOGO_URL, USER_INFO, EXPIRES_TIME } from '../config/cache';
|
||||
import { mapGetters } from 'vuex';
|
||||
import Routine from '../libs/routine';
|
||||
import { configMap } from '@/utils/index';
|
||||
import Auth from '../libs/wechat';
|
||||
import { toLogin } from '../libs/login';
|
||||
// #ifdef MP
|
||||
import editUserModal from '@/components/eidtUserModal/index.vue'
|
||||
// #endif
|
||||
export default {
|
||||
name: 'Authorize',
|
||||
props: {
|
||||
isAuto: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
isGoIndex: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
isShowAuth: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
// #ifdef MP
|
||||
editUserModal
|
||||
// #endif
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: '用户登录',
|
||||
info: '请登录,将为您提供更好的服务!',
|
||||
//#ifdef H5
|
||||
isWeixin: this.$wechat.isWeixin(),
|
||||
//#endif
|
||||
//#ifdef MP
|
||||
title: '授权提醒',
|
||||
info: '请授权头像等信息,以便为您提供更好的服务!',
|
||||
//#endif
|
||||
canUseGetUserProfile: false,
|
||||
code: null,
|
||||
top: 0,
|
||||
mp_is_new: this.$Cache.get('MP_VERSION_ISNEW') || false,
|
||||
editModal: false, // 编辑头像信息
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['isLogin', 'userInfo', 'viewColor']),
|
||||
...configMap(['routine_logo'])
|
||||
},
|
||||
watch: {
|
||||
isLogin(n) {
|
||||
n === true && this.$emit('onLoadFun', this.userInfo);
|
||||
},
|
||||
isShowAuth(n) {
|
||||
this.getCode(this.isShowAuth)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// console.log('title' + this.title)
|
||||
this.top = uni.getSystemInfoSync().windowHeight / 2 - 70
|
||||
if (wx.getUserProfile) {
|
||||
this.canUseGetUserProfile = true
|
||||
}
|
||||
this.setAuthStatus();
|
||||
this.getCode(this.isShowAuth)
|
||||
},
|
||||
methods: {
|
||||
// #ifdef MP
|
||||
editSuccess() {
|
||||
this.editModal = false
|
||||
this.$emit('onLoadFun', this.userInfo);
|
||||
},
|
||||
closeEdit() {
|
||||
this.editModal = false
|
||||
},
|
||||
// #endif
|
||||
setAuthStatus() {
|
||||
//#ifdef MP
|
||||
Routine.authorize().then(res => {
|
||||
if (res.islogin === false)
|
||||
this.$emit('onLoadFun', this.userInfo);
|
||||
}).catch(res => {
|
||||
if (this.isAuto)
|
||||
this.$emit('authColse', true);
|
||||
})
|
||||
//#endif
|
||||
},
|
||||
getCode(n) {
|
||||
// #ifdef MP
|
||||
if (n) {
|
||||
uni.showLoading({
|
||||
title: '正在登录中'
|
||||
});
|
||||
Routine.getCode().then(code => {
|
||||
uni.hideLoading();
|
||||
this.code = code;
|
||||
}).catch(e => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '登录失败',
|
||||
duration: 2000
|
||||
});
|
||||
})
|
||||
} else {
|
||||
this.code = null;
|
||||
}
|
||||
// #endif
|
||||
// #ifndef MP
|
||||
if (n) {
|
||||
this.code = 1;
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
toWecahtAuth() {
|
||||
toLogin(true);
|
||||
},
|
||||
getUserProfile() {
|
||||
// console.log(11);
|
||||
toLogin(true);
|
||||
uni.navigateTo({
|
||||
url: '/pages/users/login/login_copy'
|
||||
})
|
||||
// console.log(22);
|
||||
return
|
||||
let self = this;
|
||||
Routine.getUserProfile()
|
||||
.then(res => {
|
||||
let userInfo = res.userInfo;
|
||||
userInfo.code = this.code;
|
||||
userInfo.spread = app.globalData.spid; //获取推广人ID
|
||||
userInfo.spread_code = app.globalData.code; //获取推广人分享二维码ID
|
||||
commonAuth({
|
||||
auth: {
|
||||
type: 'routine',
|
||||
auth: userInfo
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.data.status == 200) {
|
||||
let time = res.data.result.expires_time - Cache.time();
|
||||
self.$store.commit('UPDATE_USERINFO', res.data.result.user);
|
||||
self.$store.commit('LOGIN', { token: res.data.result.token, time: time });
|
||||
self.$store.commit('SETUID', res.data.result.user.uid);
|
||||
Cache.set(EXPIRES_TIME, res.data.result.expires_time, time);
|
||||
Cache.set(USER_INFO, res.data.result.user, time);
|
||||
this.$emit('onLoadFun', res.data.result.user);
|
||||
if (res.data.result.user.isNew && this.mp_is_new) {
|
||||
this.editModal = true;
|
||||
}
|
||||
} else {
|
||||
uni.setStorageSync('auth_token', res.data.result.key);
|
||||
return uni.navigateTo({
|
||||
url: '/pages/users/login/login_copy'
|
||||
})
|
||||
}
|
||||
}).catch(res => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: res.message,
|
||||
icon: 'none',
|
||||
duration: 2000,
|
||||
const app = getApp();
|
||||
import Cache from '../utils/cache';
|
||||
import {
|
||||
getLogo,
|
||||
commonAuth
|
||||
} from '../api/public';
|
||||
import {
|
||||
LOGO_URL,
|
||||
USER_INFO,
|
||||
EXPIRES_TIME
|
||||
} from '../config/cache';
|
||||
import {
|
||||
mapGetters
|
||||
} from 'vuex';
|
||||
import Routine from '../libs/routine';
|
||||
import {
|
||||
configMap
|
||||
} from '@/utils/index';
|
||||
import Auth from '../libs/wechat';
|
||||
import {
|
||||
toLogin
|
||||
} from '../libs/login';
|
||||
// #ifdef MP
|
||||
import editUserModal from '@/components/eidtUserModal/index.vue'
|
||||
// #endif
|
||||
export default {
|
||||
name: 'Authorize',
|
||||
props: {
|
||||
isAuto: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
isGoIndex: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
isShowAuth: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
// #ifdef MP
|
||||
editUserModal
|
||||
// #endif
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
title: '用户登录',
|
||||
info: '请登录,将为您提供更好的服务!',
|
||||
//#ifdef H5
|
||||
isWeixin: this.$wechat.isWeixin(),
|
||||
//#endif
|
||||
//#ifdef MP
|
||||
title: '授权提醒',
|
||||
info: '请授权头像等信息,以便为您提供更好的服务!',
|
||||
//#endif
|
||||
canUseGetUserProfile: false,
|
||||
code: null,
|
||||
top: 0,
|
||||
mp_is_new: this.$Cache.get('MP_VERSION_ISNEW') || false,
|
||||
editModal: false, // 编辑头像信息
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['isLogin', 'userInfo', 'viewColor']),
|
||||
...configMap(['routine_logo'])
|
||||
},
|
||||
watch: {
|
||||
isLogin(n) {
|
||||
n === true && this.$emit('onLoadFun', this.userInfo);
|
||||
},
|
||||
isShowAuth(n) {
|
||||
this.getCode(this.isShowAuth)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// console.log('title' + this.title)
|
||||
this.top = uni.getSystemInfoSync().windowHeight / 2 - 70
|
||||
if (wx.getUserProfile) {
|
||||
this.canUseGetUserProfile = true
|
||||
}
|
||||
this.setAuthStatus();
|
||||
this.getCode(this.isShowAuth)
|
||||
},
|
||||
methods: {
|
||||
// #ifdef MP
|
||||
editSuccess() {
|
||||
this.editModal = false
|
||||
this.$emit('onLoadFun', this.userInfo);
|
||||
},
|
||||
closeEdit() {
|
||||
this.editModal = false
|
||||
},
|
||||
// #endif
|
||||
setAuthStatus() {
|
||||
//#ifdef MP
|
||||
Routine.authorize().then(res => {
|
||||
if (res.islogin === false)
|
||||
this.$emit('onLoadFun', this.userInfo);
|
||||
}).catch(res => {
|
||||
if (this.isAuto)
|
||||
this.$emit('authColse', true);
|
||||
})
|
||||
//#endif
|
||||
},
|
||||
getCode(n) {
|
||||
// #ifdef MP
|
||||
if (n) {
|
||||
uni.showLoading({
|
||||
title: '正在登录中'
|
||||
});
|
||||
Routine.getCode().then(code => {
|
||||
uni.hideLoading();
|
||||
this.code = code;
|
||||
}).catch(e => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '登录失败',
|
||||
duration: 2000
|
||||
});
|
||||
})
|
||||
} else {
|
||||
this.code = null;
|
||||
}
|
||||
// #endif
|
||||
// #ifndef MP
|
||||
if (n) {
|
||||
this.code = 1;
|
||||
}
|
||||
// #endif
|
||||
},
|
||||
toWecahtAuth() {
|
||||
toLogin(true);
|
||||
},
|
||||
getUserProfile() {
|
||||
// console.log(11);
|
||||
toLogin(true);
|
||||
uni.navigateTo({
|
||||
url: '/pages/users/login/login_copy'
|
||||
})
|
||||
// console.log(22);
|
||||
return
|
||||
let self = this;
|
||||
Routine.getUserProfile()
|
||||
.then(res => {
|
||||
let userInfo = res.userInfo;
|
||||
userInfo.code = this.code;
|
||||
userInfo.spread = app.globalData.spid; //获取推广人ID
|
||||
userInfo.spread_code = app.globalData.code; //获取推广人分享二维码ID
|
||||
commonAuth({
|
||||
auth: {
|
||||
type: 'routine',
|
||||
auth: userInfo
|
||||
}
|
||||
}).then(res => {
|
||||
if (res.data.status == 200) {
|
||||
let time = res.data.result.expires_time - Cache.time();
|
||||
self.$store.commit('UPDATE_USERINFO', res.data.result.user);
|
||||
self.$store.commit('LOGIN', {
|
||||
token: res.data.result.token,
|
||||
time: time
|
||||
});
|
||||
self.$store.commit('SETUID', res.data.result.user.uid);
|
||||
Cache.set(EXPIRES_TIME, res.data.result.expires_time, time);
|
||||
Cache.set(USER_INFO, res.data.result.user, time);
|
||||
this.$emit('onLoadFun', res.data.result.user);
|
||||
if (res.data.result.user.isNew && this.mp_is_new) {
|
||||
this.editModal = true;
|
||||
}
|
||||
} else {
|
||||
uni.setStorageSync('auth_token', res.data.result.key);
|
||||
return uni.navigateTo({
|
||||
url: '/pages/users/login/login_copy'
|
||||
})
|
||||
}
|
||||
}).catch(res => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: res.message,
|
||||
icon: 'none',
|
||||
duration: 2000,
|
||||
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(res => {
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
close() {
|
||||
let pages = getCurrentPages(),
|
||||
currPage = pages[pages.length - 1];
|
||||
this.$emit('authColse', false);
|
||||
if (this.isGoIndex) {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
} else {
|
||||
this.$emit('authColse', false);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(res => {
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
close() {
|
||||
let pages = getCurrentPages(),
|
||||
currPage = pages[pages.length - 1];
|
||||
this.$emit('authColse', false);
|
||||
if (this.isGoIndex) {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
} else {
|
||||
this.$emit('authColse', false);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang='scss'>
|
||||
.Popup {
|
||||
flex: 1;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 500rpx;
|
||||
background-color: #fff;
|
||||
position: fixed;
|
||||
top: 500rpx;
|
||||
left: 125rpx;
|
||||
z-index: 1000;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.Popup {
|
||||
flex: 1;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 500rpx;
|
||||
background-color: #fff;
|
||||
position: fixed;
|
||||
top: 500rpx;
|
||||
left: 125rpx;
|
||||
z-index: 1000;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.Popup {
|
||||
.logo-auth {
|
||||
z-index: -1;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 0%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 8rpx solid #fff;
|
||||
border-radius: 50%;
|
||||
background: #fff;
|
||||
}
|
||||
.Popup {
|
||||
.logo-auth {
|
||||
z-index: -1;
|
||||
position: absolute;
|
||||
left: 50%;
|
||||
top: 0%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: 8rpx solid #fff;
|
||||
border-radius: 50%;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.image {
|
||||
height: 42rpx;
|
||||
margin-top: -54rpx;
|
||||
}
|
||||
}
|
||||
.image {
|
||||
height: 42rpx;
|
||||
margin-top: -54rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.Popup .title {
|
||||
font-size: 28rpx;
|
||||
color: #000;
|
||||
text-align: center;
|
||||
margin-top: 30rpx;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 500rpx;
|
||||
display: flex;
|
||||
}
|
||||
.Popup .title {
|
||||
font-size: 28rpx;
|
||||
color: #000;
|
||||
text-align: center;
|
||||
margin-top: 30rpx;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 500rpx;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.Popup .tip {
|
||||
font-size: 22rpx;
|
||||
color: #555;
|
||||
padding: 0 24rpx;
|
||||
margin-top: 25rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.Popup .tip {
|
||||
font-size: 22rpx;
|
||||
color: #555;
|
||||
padding: 0 24rpx;
|
||||
margin-top: 25rpx;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.Popup .bottom .item {
|
||||
width: 250rpx;
|
||||
height: 80rpx;
|
||||
background-color: #eeeeee;
|
||||
text-align: center;
|
||||
line-height: 80rpx;
|
||||
margin-top: 54rpx;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
.Popup .bottom .item {
|
||||
width: 250rpx;
|
||||
height: 80rpx;
|
||||
background-color: #eeeeee;
|
||||
text-align: center;
|
||||
line-height: 80rpx;
|
||||
margin-top: 54rpx;
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
|
||||
.text {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
.text {
|
||||
font-size: 24rpx;
|
||||
color: #666;
|
||||
}
|
||||
}
|
||||
|
||||
.Popup .bottom .item.on {
|
||||
width: 500rpx;
|
||||
}
|
||||
.Popup .bottom .item.on {
|
||||
width: 500rpx;
|
||||
}
|
||||
|
||||
.flex {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.flex {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
.Popup .bottom .item.grant {
|
||||
font-weight: bold;
|
||||
background-color: #E93323;
|
||||
/* background-color: var(--view-theme); */
|
||||
border-radius: 0;
|
||||
padding: 0;
|
||||
.Popup .bottom .item.grant {
|
||||
font-weight: bold;
|
||||
background-color: #E93323;
|
||||
/* background-color: var(--view-theme); */
|
||||
border-radius: 0;
|
||||
padding: 0;
|
||||
|
||||
.text {
|
||||
font-size: 28rpx;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.text {
|
||||
font-size: 28rpx;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.65);
|
||||
z-index: 99;
|
||||
}
|
||||
.mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.65);
|
||||
z-index: 99;
|
||||
}
|
||||
</style>
|
@ -256,6 +256,71 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
<!-- 多规格购物车 -->
|
||||
<view class="" style="z-index: 9999;">
|
||||
<u-popup :show="showcartpop" @close="closecartpop" @open="opencartpop">
|
||||
<view class="sku">
|
||||
<view class="sku_head">
|
||||
<view class="sku_head_l">
|
||||
<u--image :showLoading="true" src="/static/images/BG.png" width="200.09rpx"
|
||||
height="200.09rpx"></u--image>
|
||||
</view>
|
||||
<view class="sku_head_r">
|
||||
<view class="sku_goods_tit">
|
||||
fsdfsdfsdfffffffff
|
||||
</view>
|
||||
<view class="">
|
||||
<view class="sku_goods_price">
|
||||
79.00
|
||||
</view>
|
||||
<view class="sku_goods_num">
|
||||
库存:999
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
|
||||
<view class="sku_size">
|
||||
<view class="">
|
||||
尺码
|
||||
</view>
|
||||
<view class="">
|
||||
<text>大号</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="sku_num">
|
||||
<view class="">
|
||||
数量
|
||||
</view>
|
||||
<view class="">
|
||||
<u-number-box v-model="skuNumber" @change="valChange"></u-number-box>
|
||||
</view>
|
||||
</view>
|
||||
<view class="skuaddcart">
|
||||
|
||||
加入购物车
|
||||
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</u-popup>
|
||||
</view>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse">
|
||||
</authorize>
|
||||
<view class="" :style="`height:${appInfo.bottom}px;background-color:white`">
|
||||
</view>
|
||||
</view>
|
||||
@ -285,17 +350,26 @@
|
||||
import {
|
||||
postCartAdd,
|
||||
} from '@/api/store.js';
|
||||
import authorize from '@/components/Authorize';
|
||||
import {
|
||||
mapGetters
|
||||
} from "vuex";
|
||||
export default {
|
||||
components: {
|
||||
authorize,
|
||||
},
|
||||
data() {
|
||||
let src = 'https://lihai001.oss-cn-chengdu.aliyuncs.com/public/kk/luzhou/static4/13';
|
||||
return {
|
||||
skuNumber: 0,
|
||||
showcartpop: false,
|
||||
trnList: [],
|
||||
act_cart: false,
|
||||
appInfo: {},
|
||||
pocls: "",
|
||||
type: "",
|
||||
act_swiper: "",
|
||||
current: 1,
|
||||
current: 3,
|
||||
goodsNum: 0,
|
||||
goodsList: [],
|
||||
isEmpty: false,
|
||||
@ -316,6 +390,7 @@
|
||||
page_num: 1,
|
||||
act_img: "",
|
||||
cartTagInfo: {},
|
||||
isAuto: false,
|
||||
actList: [{
|
||||
tit: '综合',
|
||||
act: "",
|
||||
@ -332,9 +407,14 @@
|
||||
}],
|
||||
status: "loadmore",
|
||||
flag: false,
|
||||
isShowAuth: false, //是否隐藏授权
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['isLogin', 'viewColor', 'uid']),
|
||||
},
|
||||
// ...mapGetters(['isLogin', 'viewColor', 'uid']),
|
||||
onLoad(e) {
|
||||
// this.cartFn()
|
||||
this.appInfo = this.$appInfo.safeAreaInsets
|
||||
@ -434,6 +514,23 @@
|
||||
|
||||
// },
|
||||
methods: {
|
||||
valChange(e) {
|
||||
this.valChange = e
|
||||
},
|
||||
closecartpop() {
|
||||
this.showcartpop = false
|
||||
},
|
||||
opencartpop() {
|
||||
this.showcartpop = true
|
||||
},
|
||||
// 授权关闭
|
||||
authColse: function(e) {
|
||||
this.isShowAuth = e;
|
||||
},
|
||||
|
||||
onLoadFun() {
|
||||
this.isShowAuth = false;
|
||||
},
|
||||
clickSwiperFn(i) {
|
||||
// console.log(i)
|
||||
this.current = i
|
||||
@ -528,6 +625,14 @@
|
||||
|
||||
},
|
||||
addcart(item, i) {
|
||||
// this.showcartpop = true
|
||||
// return
|
||||
// console.log(this.isLogin)
|
||||
if (!this.isLogin) {
|
||||
this.isAuto = true;
|
||||
this.isShowAuth = true
|
||||
return
|
||||
}
|
||||
|
||||
let data = {
|
||||
cart_num: 1,
|
||||
@ -635,6 +740,39 @@
|
||||
}
|
||||
}
|
||||
|
||||
.sku {
|
||||
padding: 20rpx;
|
||||
|
||||
.sku_head {
|
||||
display: flex;
|
||||
|
||||
.sku_head_r {
|
||||
margin-left: 20rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
// justify-content;
|
||||
}
|
||||
|
||||
.sku_num {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.skuaddcart {
|
||||
width: 50vw;
|
||||
background-color: #FEAB00;
|
||||
margin: 0 auto;
|
||||
height: 80rpx;
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
color: white;
|
||||
border-radius: 80rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.flags {
|
||||
background-color: red;
|
||||
z-index: 99999999;
|
||||
@ -958,7 +1096,7 @@
|
||||
|
||||
.card {
|
||||
width: 720rpx;
|
||||
z-index: 999999;
|
||||
z-index: 99;
|
||||
// margin:auto;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
|
@ -319,6 +319,8 @@
|
||||
},
|
||||
onLoad(options) {
|
||||
// uni.hideTabBar()
|
||||
// console.log(this.isLogin, "sdfsdkfhjsdhgfsdf")
|
||||
// return
|
||||
this.id = options.id;
|
||||
this.type = options.gtype
|
||||
|
||||
@ -617,7 +619,7 @@
|
||||
this.formData.product_info = []
|
||||
}
|
||||
this.productList = []
|
||||
this.price = 0;
|
||||
this.price = 0;
|
||||
if (data.length > 0) {
|
||||
this.productList = data;
|
||||
for (let i in data) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user