活动添加分享
parent
fcf7563f69
commit
17646d19b0
|
|
@ -29,6 +29,7 @@ export default {
|
||||||
// #endif
|
// #endif
|
||||||
},
|
},
|
||||||
onShow: function (option) {
|
onShow: function (option) {
|
||||||
|
console.log(option);
|
||||||
let invite_code = option.query.invite_code || strToParams(decodeURIComponent(option.query.scene)).invite_code
|
let invite_code = option.query.invite_code || strToParams(decodeURIComponent(option.query.scene)).invite_code
|
||||||
uni.setStorageSync('INVITE_CODE',invite_code)
|
uni.setStorageSync('INVITE_CODE',invite_code)
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
<cu-popup v-model="show" mode="bottom" border-radius="20" closeable close-icon-size="24">
|
<cu-popup v-model="show" mode="bottom" border-radius="20" closeable close-icon-size="24">
|
||||||
<view class="px-40rpx mt-40rpx">
|
<view class="px-40rpx mt-40rpx">
|
||||||
<view class="flex py-base">
|
<view class="flex py-base">
|
||||||
<image class="flex-none rounded-20rpx w-200rpx h-200rpx" :src="sku.cover" mode="aspectFill"></image>
|
<image @tap="previewImage(sku.cover)" class="flex-none rounded-20rpx w-200rpx h-200rpx" :src="sku.cover" mode="aspectFill"></image>
|
||||||
<view class="flex flex-col justify-end ml-40rpx">
|
<view class="flex flex-col justify-end ml-40rpx">
|
||||||
<view class="font-bold text-hex-FF0200 mr-36rpx text-52rpx"> {{ sku.sell_price }} </view>
|
<view class="font-bold text-hex-FF0200 mr-36rpx text-52rpx"> {{ sku.sell_price }} </view>
|
||||||
<view class="mt-10rpx text-28rpx"> 会员价:{{ sku.vip_price }} </view>
|
<view class="mt-10rpx text-28rpx"> 会员价:{{ sku.vip_price }} </view>
|
||||||
|
|
@ -20,12 +20,12 @@
|
||||||
<view class="inline-block mr-24rpx mb-16rpx" v-for="(spce,index2) in item.items" :key="index2">
|
<view class="inline-block mr-24rpx mb-16rpx" v-for="(spce,index2) in item.items" :key="index2">
|
||||||
<view
|
<view
|
||||||
@tap="onChangeSku(spce, item.items)"
|
@tap="onChangeSku(spce, item.items)"
|
||||||
:class="spce.selected?'text-hex-FF0000 bg-hex-FDF2EC':'text-hex-333333 bg-hex-F8F8F8'"
|
:class="spce.selected?'text-hex-FF0000 bg-hex-FDF2EC border border-solid border-hex-FF0000':'text-hex-333333 bg-hex-F8F8F8 border border-solid border-hex-F8F8F8'"
|
||||||
:text="spce.name"
|
:text="spce.name"
|
||||||
class="cu-tag"
|
class="cu-tag"
|
||||||
:disabled="spce.sku_id == 0"
|
:disabled="spce.sku_id == 0"
|
||||||
:color="spce.selected ? '#FF0000' : '#333333'"
|
:color="spce.selected ? '#FF0000' : '#333333'"
|
||||||
:bg-color="spce.selected ? '#FDF2EC' : '#F8F8F8'"
|
|
||||||
:border-color="spce.selected ? '#FDF2EC' : '#F8F8F8'"
|
:border-color="spce.selected ? '#FDF2EC' : '#F8F8F8'"
|
||||||
shape="circle"
|
shape="circle"
|
||||||
>{{spce.name}}
|
>{{spce.name}}
|
||||||
|
|
@ -187,13 +187,19 @@ export default {
|
||||||
if (this.isOutStock) return this.$u.toast('超出库存');
|
if (this.isOutStock) return this.$u.toast('超出库存');
|
||||||
this.$emit(type, this.sku);
|
this.$emit(type, this.sku);
|
||||||
},
|
},
|
||||||
|
//图片预览
|
||||||
|
previewImage(url){
|
||||||
|
uni.previewImage({
|
||||||
|
urls: [url],
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.cu-tag{
|
.cu-tag{
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
border-radius: 30rpx;
|
border-radius: 15rpx;
|
||||||
padding:10rpx 25rpx;
|
padding:10rpx 40rpx;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="h-full">
|
<view class="h-full">
|
||||||
<loading-view v-if="isFirstLoading"></loading-view>
|
<loading-view v-if="isFirstLoading && isLogin "></loading-view>
|
||||||
<view
|
<view
|
||||||
class="bg min-h-full overflow-hidden"
|
class="bg min-h-full overflow-hidden"
|
||||||
v-else
|
v-else-if="isLogin"
|
||||||
:style="{ backgroundImage: `url(${draw_activity.bg_image})`, backgroundColor: draw_activity.bg_color }"
|
:style="{ backgroundImage: `url(${draw_activity.bg_image})`, backgroundColor: draw_activity.bg_color }"
|
||||||
>
|
>
|
||||||
<view class="">
|
<view class="">
|
||||||
|
|
@ -22,6 +22,7 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="w-full" :style="{ height: 50 + statusBarHeight + 'px' }"> </view>
|
<view class="w-full" :style="{ height: 50 + statusBarHeight + 'px' }"> </view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="h-300rpx w-full"></view>
|
<view class="h-300rpx w-full"></view>
|
||||||
<view class="w-full relative">
|
<view class="w-full relative">
|
||||||
<view class="h-100rpx"></view>
|
<view class="h-100rpx"></view>
|
||||||
|
|
@ -89,12 +90,11 @@
|
||||||
>
|
>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<block>
|
|
||||||
<view class="p-30rpx">
|
<view class="p-30rpx">
|
||||||
<u-parse :html="draw_activity.desc"></u-parse>
|
<u-parse :html="draw_activity.desc"></u-parse>
|
||||||
</view>
|
</view>
|
||||||
</block>
|
</block>
|
||||||
|
|
||||||
<u-mask :show="show">
|
<u-mask :show="show">
|
||||||
<view class="flex items-center justify-center h-full">
|
<view class="flex items-center justify-center h-full">
|
||||||
<view class="">
|
<view class="">
|
||||||
|
|
@ -230,6 +230,9 @@ export default {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
user() {
|
||||||
|
return this.$store.getters.user ?? {};
|
||||||
|
},
|
||||||
isApple() {
|
isApple() {
|
||||||
return uni.getSystemInfoSync().platform === 'ios';
|
return uni.getSystemInfoSync().platform === 'ios';
|
||||||
},
|
},
|
||||||
|
|
@ -242,16 +245,44 @@ export default {
|
||||||
},
|
},
|
||||||
async onLoad({ id }) {
|
async onLoad({ id }) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
setTimeout(()=>{
|
||||||
|
if(!this.isLogin){
|
||||||
|
this.$u.route({
|
||||||
|
type:'redirectTo',
|
||||||
|
url:`/pages/login/index?redirec=${encodeURIComponent(`/pageB/lucky/index?id=${id}`)}`
|
||||||
|
})
|
||||||
|
}else{
|
||||||
this.getConfig();
|
this.getConfig();
|
||||||
this.getLuckyLog();
|
this.getLuckyLog();
|
||||||
|
}
|
||||||
|
},300)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
//微信分享
|
||||||
|
onShareAppMessage(res) {
|
||||||
|
let code = this.user.code ? this.user.code : '';
|
||||||
|
let shareObj = {
|
||||||
|
title: this.draw_activity.name,
|
||||||
|
path: `/pageB/lucky/index?id=${this.id}&invite_code=${code}`,
|
||||||
|
imageUrl: this.draw_activity.bg_image,
|
||||||
|
};
|
||||||
|
return shareObj;
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
change(e) {
|
change(e) {
|
||||||
this.current = e.detail.current;
|
this.current = e.detail.current;
|
||||||
},
|
},
|
||||||
onBack() {
|
onBack() {
|
||||||
uni.navigateBack();
|
const pages = getCurrentPages()
|
||||||
|
const prevPage = pages[pages.length - 2]
|
||||||
|
if(prevPage){
|
||||||
|
uni.navigateBack({})
|
||||||
|
}else{
|
||||||
|
uni.switchTab({
|
||||||
|
url:'/pages/index/index'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// uni.navigateBack();
|
||||||
},
|
},
|
||||||
async getConfig() {
|
async getConfig() {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -62,13 +62,15 @@
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { getWxCode } from '@/utils/login';
|
// import { getWxCode } from '@/utils/login';
|
||||||
|
import { wxMnpLogin,getWxCode } from '@/utils/login'
|
||||||
import { mapMutations } from 'vuex';
|
import { mapMutations } from 'vuex';
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
check: false,
|
check: false,
|
||||||
code:'',
|
code:'',
|
||||||
|
redirec:null,
|
||||||
form: {
|
form: {
|
||||||
phone: '',
|
phone: '',
|
||||||
password: '',
|
password: '',
|
||||||
|
|
@ -95,7 +97,10 @@ export default {
|
||||||
onReady() {
|
onReady() {
|
||||||
// this.$refs.uForm.setRules(this.rules);
|
// this.$refs.uForm.setRules(this.rules);
|
||||||
},
|
},
|
||||||
async onLoad({ type, phone }) {
|
async onLoad({ type, phone,redirec}) {
|
||||||
|
|
||||||
|
|
||||||
|
this.redirec = redirec
|
||||||
this.form.phone = phone ?? '';
|
this.form.phone = phone ?? '';
|
||||||
/* #ifdef MP-WEIXIN */
|
/* #ifdef MP-WEIXIN */
|
||||||
this.code = await getWxCode();
|
this.code = await getWxCode();
|
||||||
|
|
@ -115,14 +120,23 @@ export default {
|
||||||
if(!code) return
|
if(!code) return
|
||||||
const invite_code = uni.getStorageSync('INVITE_CODE');
|
const invite_code = uni.getStorageSync('INVITE_CODE');
|
||||||
// const code = await getWxCode();
|
// const code = await getWxCode();
|
||||||
|
if(!this.$store.getters.token){
|
||||||
|
await wxMnpLogin()
|
||||||
|
}
|
||||||
const params = {}
|
const params = {}
|
||||||
if(!!invite_code) params.inviter_code = invite_code
|
if(!!invite_code) params.inviter_code = invite_code
|
||||||
|
console.log(params.inviter_code);
|
||||||
const resData = await this.$api.post('/v1/wechat-mini/bind-phone', {
|
const resData = await this.$api.post('/v1/wechat-mini/bind-phone', {
|
||||||
code:code,
|
code:code,
|
||||||
...params
|
...params
|
||||||
});
|
});
|
||||||
this.LOGIN(resData.token);
|
await this.LOGIN(resData.token);
|
||||||
uni.navigateBack({
|
// await this.LOGIN('555|bZL3mr19Tpgs4jRvpKkguoH865lL2zGLa35WdU7Z')
|
||||||
|
if(!!this.redirec) this.$u.route({
|
||||||
|
type:'redirectTo',
|
||||||
|
url:decodeURIComponent(this.redirec)
|
||||||
|
})
|
||||||
|
else uni.navigateBack({
|
||||||
delta: 1,
|
delta: 1,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -25,17 +25,17 @@ const mutations = {
|
||||||
RESET_STATE: (state) => {
|
RESET_STATE: (state) => {
|
||||||
Object.assign(state, getDefaultState())
|
Object.assign(state, getDefaultState())
|
||||||
},
|
},
|
||||||
LOGIN(state, value) {
|
async LOGIN(state, value) {
|
||||||
this.commit('user/SET_TOKEN',value)
|
await this.commit('user/SET_TOKEN',value)
|
||||||
this.dispatch('user/getUserInfo',false)
|
await this.dispatch('user/getUserInfo',false)
|
||||||
},
|
},
|
||||||
LOGOUT(){
|
LOGOUT(){
|
||||||
return this.dispatch('user/resetToken')
|
return this.dispatch('user/resetToken')
|
||||||
},
|
},
|
||||||
// 登录
|
// 登录
|
||||||
SET_TOKEN(state, value) {
|
async SET_TOKEN(state, value) {
|
||||||
state.token = value
|
state.token = value
|
||||||
uni.setStorageSync(TOKEN, value);
|
await uni.setStorageSync(TOKEN, value);
|
||||||
},
|
},
|
||||||
//获取用户信息
|
//获取用户信息
|
||||||
SET_USERINFO(state, value) {
|
SET_USERINFO(state, value) {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ export function getWxCode() {
|
||||||
export async function wxMnpLogin(){
|
export async function wxMnpLogin(){
|
||||||
store.commit('user/LOGOUT')
|
store.commit('user/LOGOUT')
|
||||||
const code = await getWxCode()
|
const code = await getWxCode()
|
||||||
silentLogin({code})
|
await silentLogin({code})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue