3
0
Fork 0

feat(share): 分享下单成功后自动登录

This commit is contained in:
woody 2025-09-02 13:54:39 +08:00
parent d870bb4f6e
commit 5b69bbbc56
8 changed files with 388 additions and 344 deletions

View File

@ -17,6 +17,7 @@ export default {
'pages/shareArea/hiList',
'pages/shareArea/hiOrder',
'pages/pay/hiPay',
'pages/pay/success',
]
if (whiteList.indexOf(options.path) !== -1) return
this.$store.dispatch('GetInfo')

View File

@ -3,7 +3,7 @@
<!-- 背景图片替代CSS background -->
<img
class="share-bg-image"
src="/static/images/share-bg.png"
src="/static/images/share-bg.jpg"
mode="scaleToFill"
crossorigin="anonymous"
@load="onBackgroundImageLoad"
@ -28,12 +28,7 @@
<!-- 会员编号样式区域 - 用户自定义样式位置 -->
<text
class="member-code-text"
style="
font-size: 30rpx;
color: #fff;
font-weight: bold;
margin-top: 10rpx;
"
style="font-size: 30rpx; color: #fff; font-weight: bold"
>{{ desensitization(userInfo.memberCode) }}</text
>
</view>
@ -187,22 +182,22 @@ export default {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
/* 背景图片样式 */
.share-bg-image {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
width: 100%;
// height: 100%;
z-index: 1;
// object-fit: cover;
}
.share-wrapper {
position: absolute;
z-index: 2;
top: 360rpx;
bottom: 30rpx;
display: flex;
flex-direction: column;
align-items: center;
@ -216,15 +211,14 @@ export default {
box-sizing: border-box;
flex-direction: column;
align-items: center;
justify-content: center;
margin: 0 auto;
opacity: 0;
transform: translateY(20rpx);
transition: all 0.3s ease;
text-align: center;
}
.portal-frame.is-loaded {
opacity: 1;
transform: translateY(0);
}
/* 二维码样式区域 - 用户自定义样式位置 */
@ -275,6 +269,8 @@ export default {
/* 会员编号样式区域 - 用户自定义样式位置 */
.member-code-text {
display: block;
text-align: center;
/* 用户可以在这里自定义会员编号的样式 */
}

View File

@ -1,262 +1,282 @@
<template>
<u-popup :show="sucShow" closeable :round="10" mode="center" @close="sucShow= false">
<view class="pop_a">
<view class="tit">
<u-icon name="checkmark-circle-fill" color="#029B00"></u-icon>
<view>{{'注册成功'}}</view>
</view>
<view class="getCode" @tap="onCopy">{{'复制'}}</view>
<view class="form">
<u--form labelPosition="left" labelWidth="80px" :model="allData" ref="uForm">
<u-form-item :label="'会员姓名'+':'" borderBottom>
<u--input v-model="allData.memberName" border="none"></u--input>
</u-form-item>
<u-form-item :label="'会员编号'+':'" borderBottom>
<u--input v-model="allData.memberCode" border="none"></u--input>
</u-form-item>
<u-form-item :label="'会员电话'+':'" borderBottom>
<u--input v-model="allData.phone" border="none"></u--input>
</u-form-item>
<u-form-item :label="'登录密码'+':'" borderBottom>
<u--input v-model="allData.loginPassword" border="none">
</u--input>
</u-form-item>
<u-form-item :label="'支付密码'+':'" borderBottom>
<u--input v-model="allData.payPassword" border="none">
</u--input>
</u-form-item>
<u-form-item :label="'登录网址'+':'" borderBottom>
<u--input v-model="allData.urlAddress" border="none"></u--input>
</u-form-item>
</u--form>
<view class="disflx">
<u-button
type="success"
class="uBtn"
shape="circle"
color="linear-gradient(to right, #005BAC, #005BAC )"
@tap="handleClose"
>
确定
</u-button>
</view>
</view>
<img class="yh" v-show="bia" src="@/static/images/yh.gif" alt="">
<img class="cd" v-show="bia" src="@/static/images/cd.gif" alt="">
</view>
</u-popup>
<u-popup
:show="sucShow"
closeable
:round="10"
mode="center"
@close="sucShow = false"
>
<view class="pop_a">
<view class="tit">
<u-icon name="checkmark-circle-fill" color="#029B00"></u-icon>
<view>{{ '注册成功' }}</view>
</view>
<view class="getCode" @tap="onCopy">{{ '复制' }}</view>
<view class="form">
<u--form
labelPosition="left"
labelWidth="80px"
:model="allData"
ref="uForm"
>
<u-form-item :label="'会员姓名' + ':'" borderBottom>
<u--input v-model="allData.memberName" border="none"></u--input>
</u-form-item>
<u-form-item :label="'会员编号' + ':'" borderBottom>
<u--input v-model="allData.memberCode" border="none"></u--input>
</u-form-item>
<u-form-item :label="'会员电话' + ':'" borderBottom>
<u--input v-model="allData.phone" border="none"></u--input>
</u-form-item>
<u-form-item :label="'登录密码' + ':'" borderBottom>
<u--input v-model="allData.loginPassword" border="none"> </u--input>
</u-form-item>
<u-form-item :label="'支付密码' + ':'" borderBottom>
<u--input v-model="allData.payPassword" border="none"> </u--input>
</u-form-item>
<u-form-item :label="'登录网址' + ':'" borderBottom>
<u--input v-model="allData.urlAddress" border="none"></u--input>
</u-form-item>
</u--form>
<view class="disflx">
<u-button
type="success"
class="uBtn"
shape="circle"
color="linear-gradient(to right, #005BAC, #005BAC )"
@tap="handleClose"
>
确定
</u-button>
</view>
</view>
<img class="yh" v-show="bia" src="@/static/images/yh.gif" alt="" />
<img class="cd" v-show="bia" src="@/static/images/cd.gif" alt="" />
</view>
</u-popup>
</template>
<script>
export default {
data() {
return {
sucShow: false,
bia: false,
allData: '',
}
},
methods: {
showSuccess(data) {
this.allData = data
// this.allData.gzh = ''
// this.allData.ios = 'http://yxydl.hzs413.com/q2efum'
// this.allData.android = 'https://cn.hzs413.com/'
this.sucShow = true
this.bia = true
let that = this
setTimeout(() => {
that.bia = false
}, 3000)
},
handleClose() {
this.sucShow = false
this.$emit('successClose')
},
payPw() {},
onCopy() {
let text =
'会员姓名' + ':' +
this.allData.memberName +
'\n' +
'会员编号' + ':' +
this.allData.memberCode +
'\n' +
'会员电话' + ':' +
this.allData.phone +
'\n' +
'登录密码' + ':' +
this.allData.loginPassword +
'\n' +
'支付密码' + ':' +
this.allData.payPassword +
'\n' +
'登录网址' + ':' +
this.allData.urlAddress
// +
// '\n' +
// ''+':' +
// this.allData.gzh+
// '\n' +
// 'APP'+`(${''})` +
// ':' +
// this.allData.ios+
// '\n' +
// 'APP'+`(${''})` +
// ':' +
// this.allData.android
this.$copyText(text).then((res) => {
uni.showToast({
title: '复制成功',
icon: 'none',
})
})
},
},
}
export default {
data() {
return {
sucShow: false,
bia: false,
allData: '',
}
},
methods: {
showSuccess(data) {
this.allData = data
// this.allData.gzh = ''
// this.allData.ios = 'http://yxydl.hzs413.com/q2efum'
// this.allData.android = 'https://cn.hzs413.com/'
this.sucShow = true
this.bia = true
let that = this
setTimeout(() => {
that.bia = false
}, 3000)
},
handleClose() {
this.sucShow = false
this.$emit('successClose', this.allData)
},
payPw() {},
onCopy() {
let text =
'会员姓名' +
':' +
this.allData.memberName +
'\n' +
'会员编号' +
':' +
this.allData.memberCode +
'\n' +
'会员电话' +
':' +
this.allData.phone +
'\n' +
'登录密码' +
':' +
this.allData.loginPassword +
'\n' +
'支付密码' +
':' +
this.allData.payPassword +
'\n' +
'登录网址' +
':' +
this.allData.urlAddress
// +
// '\n' +
// ''+':' +
// this.allData.gzh+
// '\n' +
// 'APP'+`(${''})` +
// ':' +
// this.allData.ios+
// '\n' +
// 'APP'+`(${''})` +
// ':' +
// this.allData.android
this.$copyText(text).then(res => {
uni.showToast({
title: '复制成功',
icon: 'none',
})
})
},
},
}
</script>
<style lang="scss" scoped>
.dialog-footer {
display: flex;
}
.dialog-footer {
display: flex;
}
.btn {
line-height: 50px;
width: 120px;
height: 50px;
background: #d5251d;
border-radius: 6px 6px 6px 6px;
text-align: center;
font-size: 18px;
font-weight: 500;
color: #ffffff;
margin: 25px auto;
cursor: pointer;
}
.btn {
line-height: 50px;
width: 120px;
height: 50px;
background: #d5251d;
border-radius: 6px 6px 6px 6px;
text-align: center;
font-size: 18px;
font-weight: 500;
color: #ffffff;
margin: 25px auto;
cursor: pointer;
}
.hui {
line-height: 50px;
width: 120px;
height: 50px;
background: #ccc;
border-radius: 6px 6px 6px 6px;
text-align: center;
font-size: 18px;
font-weight: 500;
color: #ffffff;
margin: 25px auto;
cursor: pointer;
}
.hui {
line-height: 50px;
width: 120px;
height: 50px;
background: #ccc;
border-radius: 6px 6px 6px 6px;
text-align: center;
font-size: 18px;
font-weight: 500;
color: #ffffff;
margin: 25px auto;
cursor: pointer;
}
::v-deep .el-dialog {
border-radius: 10px;
}
::v-deep .el-dialog {
border-radius: 10px;
}
::v-deep .el-dialog__body {
padding: 0;
}
::v-deep .el-dialog__body {
padding: 0;
}
.tit {
display: flex;
align-items: center;
justify-content: center;
font-size: 30rpx;
font-family: Source Han Sans CN;
font-weight: bold;
color: #333333;
// border-bottom: 1px solid #f2f2f2;
// padding-bottom: 15px;
margin-top: 20px;
}
.tit {
display: flex;
align-items: center;
justify-content: center;
font-size: 30rpx;
font-family: Source Han Sans CN;
font-weight: bold;
color: #333333;
// border-bottom: 1px solid #f2f2f2;
// padding-bottom: 15px;
margin-top: 20px;
}
.tit1 {
font-size: 30rpx;
font-family: Source Han Sans CN;
font-weight: bold;
color: #005BAC;
text-align: center;
}
.tit1 {
font-size: 30rpx;
font-family: Source Han Sans CN;
font-weight: bold;
color: #005bac;
text-align: center;
}
.digBody {
margin-top: 30px;
text-align: center;
font-size: 16px;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #666666;
.digBody {
margin-top: 30px;
text-align: center;
font-size: 16px;
font-family:
PingFang SC-Regular,
PingFang SC;
font-weight: 400;
color: #666666;
.red {
font-size: 20px;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #f43c3a;
position: relative;
line-height: 30px;
height: 30px;
.red {
font-size: 20px;
font-family:
PingFang SC-Regular,
PingFang SC;
font-weight: 400;
color: #f43c3a;
position: relative;
line-height: 30px;
height: 30px;
.copy {
position: absolute;
right: 0;
transform: translateX(-100%);
top: 0;
font-size: 14px;
line-height: 30px;
height: 30px;
color: #333;
cursor: pointer;
}
}
.copy {
position: absolute;
right: 0;
transform: translateX(-100%);
top: 0;
font-size: 14px;
line-height: 30px;
height: 30px;
color: #333;
cursor: pointer;
}
}
view {
margin-bottom: 5px;
}
}
view {
margin-bottom: 5px;
}
}
.yh {
width: 262px;
height: 262px;
position: absolute;
top: -100px;
left: 0;
right: 0;
margin: 0 auto;
}
.yh {
width: 262px;
height: 262px;
position: absolute;
top: -100px;
left: 0;
right: 0;
margin: 0 auto;
}
.cd {
width: 496px;
height: 496px;
position: absolute;
bottom: 0;
}
.cd {
width: 496px;
height: 496px;
position: absolute;
bottom: 0;
}
.getCode {
text-align: right;
margin: 48rpx 24rpx 0 0;
font-size: 10px;
font-family: PingFang SC-Regular, PingFang SC;
font-weight: 400;
color: #18acff;
}
.getCode {
text-align: right;
margin: 48rpx 24rpx 0 0;
font-size: 10px;
font-family:
PingFang SC-Regular,
PingFang SC;
font-weight: 400;
color: #18acff;
}
.pop_a {
padding: 40rpx 40rpx;
}
.pop_a {
padding: 40rpx 40rpx;
}
.uBtn {
margin: 20rpx;
}
.uBtn {
margin: 20rpx;
}
::v-deep .u-popup__content {
width: 90%;
}
::v-deep .u-popup__content {
width: 90%;
}
::v-deep .u-form-item__body__left__content__label {
font-size: 24rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #999999;
}
</style>
::v-deep .u-form-item__body__left__content__label {
font-size: 24rpx;
font-family: Source Han Sans CN;
font-weight: 400;
color: #999999;
}
</style>

View File

@ -9,6 +9,11 @@ export const login = params =>
export const autoLogin = params =>
http.post('/member/api/retail-auth/auto-login', params)
// 分享注册后自动登录
// registered-auto-login
export const registeredAutoLogin = params =>
http.post('/member/api/retail-auth/registered-auto-login', params)
//用户信息
export const getInfo = params =>
http.get('/member/api/retail-member/get-info', { params })

View File

@ -1,26 +1,26 @@
<template>
<view class="main">
<view class="title">
{{ '会员登录' }}
</view>
<u-form :model="loginForm"
labelWidth="auto"
ref="uForm">
<u-form :model="loginForm" labelWidth="auto" ref="uForm">
<view class="view-class pa">
<!-- <view class="account-s">
</view> -->
<u-form-item label=""
prop="username">
<u-input v-model="loginForm.username"
clearable
placeholder-class="place-class"
class="border-color "
:placeholder="'会员账号'">
<image class="tou"
slot="prefix"
src="../../static/images/login/index-icon4.png"></image>
<u-form-item label="" prop="username">
<u-input
v-model="loginForm.username"
clearable
placeholder-class="place-class"
class="border-color"
:placeholder="'会员账号'"
>
<image
class="tou"
slot="prefix"
src="../../static/images/login/index-icon4.png"
></image>
</u-input>
</u-form-item>
<!-- <view class="close-s"
@ -33,62 +33,75 @@
<!-- <view class="account-s widths">
<image src="../../static/images/login/index-icon2.png"></image>
</view> -->
<u-form-item label=""
prop="password">
<u-input placeholder-style="color:#333"
:type="password"
class="border-color"
v-model="loginForm.password"
:placeholder="'登录密码'">
<image class="mm"
slot="prefix"
src="../../static/images/login/index-icon2.png"></image>
<u-form-item label="" prop="password">
<u-input
placeholder-style="color:#333"
:type="password"
class="border-color"
v-model="loginForm.password"
:placeholder="'登录密码'"
>
<image
class="mm"
slot="prefix"
src="../../static/images/login/index-icon2.png"
></image>
<view slot="suffix">
<view v-if="password=='text'"
@click="changeFlagTap('password')">
<image class="eye"
src="../../static/images/login/icon1.png"></image>
<view
v-if="password == 'text'"
@click="changeFlagTap('password')"
>
<image
class="eye"
src="../../static/images/login/icon1.png"
></image>
</view>
<view v-else
@click="changeFlagTap('text')">
<image class="eye"
src="../../static/images/login/icon2.png"></image>
<view v-else @click="changeFlagTap('text')">
<image
class="eye"
src="../../static/images/login/icon2.png"
></image>
</view>
</view>
</u-input>
</u-form-item>
</view>
<view class="view-class">
<!-- <view class="account-s yzm">
<image src="../../static/images/login/index-icon1.png"></image>
</view> -->
<u-form-item label=""
prop="code">
<u-input v-model="loginForm.code"
placeholder-class="place-class"
class="border-color"
:placeholder="'验证码'">
<image class="mm"
slot="prefix"
src="../../static/images/login/index-icon1.png"></image>
<img :src="codeUrl"
slot="suffix"
style="height: 38px;"
@click="getVerifyCode" />
<u-form-item label="" prop="code">
<u-input
v-model="loginForm.code"
placeholder-class="place-class"
class="border-color"
:placeholder="'验证码'"
>
<image
class="mm"
slot="prefix"
src="../../static/images/login/index-icon1.png"
></image>
<img
:src="codeUrl"
slot="suffix"
style="height: 38px"
@click="getVerifyCode"
/>
</u-input>
</u-form-item>
</view>
</u-form>
<u-button type="success"
shape="circle"
class="btn"
:loading="isLoading"
:loadingText="'登录中'"
@click="toLogin">{{'登录'}}</u-button>
<view class="paswwrod_btn"
@click="submit">{{'忘记密码'}}</view>
<u-button
type="success"
shape="circle"
class="btn"
:loading="isLoading"
:loadingText="'登录中'"
@click="toLogin"
>{{ '登录' }}</u-button
>
<view class="paswwrod_btn" @click="submit">{{ '忘记密码' }}</view>
</view>
</template>
@ -116,7 +129,7 @@ export default {
},
onLoad() {
this.getVerifyCode()
this.loginForm.username = uni.getStorageSync('username')||''
this.loginForm.username = uni.getStorageSync('username') || ''
// this.getLanguage()
},
methods: {
@ -135,13 +148,13 @@ export default {
this.loginForm.username = ''
},
getVerifyCode() {
api.captchaImage().then((res) => {
api.captchaImage().then(res => {
this.codeUrl = 'data:image/gif;base64,' + res.img
this.loginForm.uuid = res.uuid
})
},
toLogin() {
api.login(this.loginForm).then((res) => {
api.login(this.loginForm).then(res => {
this.isLoading = false
if (!res) {
// uni.showToast({
@ -165,29 +178,16 @@ export default {
url: url,
method: 'GET',
responseType: 'arraybuffer',
success: (res) => {},
fail: (err) => {
success: res => {},
fail: err => {
reject(err)
},
})
})
},
getUseInfo() {
store.dispatch('GetInfo').then((res) => {
store.dispatch('GetInfo').then(res => {
uni.switchTab({ url: '/pages/index/index' })
//
// if (res.data.loginType == 1) {
// uni.redirectTo({ url: '/pages/specialMember/index' })
// } else {
// if (res.data.registerFans == 0) {
// uni.redirectTo({ url: '/pages/shareArea/index?specialArea=7' })
// } else if (res.data.registerShare == 0) {
// // uni.redirectTo({ url: '/pages/shareArea/haiNdex?specialArea=21 ' })
// uni.switchTab({ url: '/pages/index/index' })
// } else {
// uni.switchTab({ url: '/pages/index/index' })
// }
// }
})
// api.getInfo().then((res) => {
// uni.setStorage('User', res.data)
@ -239,7 +239,7 @@ body {
text-align: center;
}
.btn {
background-color: #005BAC;
background-color: #005bac;
border: none;
height: 92rpx;
line-height: 92rpx;
@ -329,4 +329,4 @@ body {
.pa {
padding: 7px 20rpx;
}
</style>
</style>

View File

@ -1,7 +1,13 @@
<template>
<view
class="share-page"
style="display: flex; flex-direction: column; height: 100vh"
style="
display: flex;
flex-direction: column;
height: 100vh;
align-items: center;
width: 100%;
"
>
<view id="shareContainer" class="share-container">
<!-- 默认场景 -->
@ -19,13 +25,7 @@
class="wechat-fullscreen-overlay"
v-show="(isWechat || userInfo.sharePosterImage) && generatedImageUrl"
>
<img
class="fullscreen-image"
:src="generatedImageUrl"
width="100%"
height="100%"
@click.stop=""
/>
<img class="fullscreen-image" :src="generatedImageUrl" @click.stop="" />
</view>
</view>
<cl-tabbar class="tabbar" :current="2" />
@ -172,6 +172,7 @@ export default {
position: relative;
overflow: hidden;
display: flex;
width: 100%;
flex-direction: column;
align-items: center;
}
@ -181,8 +182,8 @@ export default {
position: absolute;
top: 0;
left: 0;
width: 100vw;
height: 100%;
width: 100%;
background-color: transparent;
z-index: 999;
display: flex;
@ -194,9 +195,8 @@ export default {
}
.fullscreen-image {
width: 100vw;
height: 100%;
object-fit: cover;
width: 100%;
margin: 0;
padding: 0;
border: none;

View File

@ -44,7 +44,7 @@
<view class="action-section">
<view class="button-group">
<button
v-if="!isRecharge"
v-if="!isRecharge && !isSharePay"
class="btn btn-secondary"
@click="goToOrderList"
>
@ -61,8 +61,10 @@
<script>
import { mapGetters } from 'vuex'
import { payStatus, registerInfo } from '@/config/pay.js'
import { registeredAutoLogin } from '@/config/login.js'
import successDialog from '@/components/successDialog.vue'
import { setToken } from '@/config/auth.js'
import store from '@/store'
let paySetTimeoutFlag = null
let getRegisterInfoTimeoutFlag = null
export default {
@ -76,6 +78,7 @@ export default {
specialArea: null,
isRecharge: undefined,
payStatus: 0,
isSharePay: false,
}
},
computed: {
@ -97,6 +100,7 @@ export default {
this.specialArea = extParam.specialArea
this.isRecharge = extParam.isRecharge
this.orderCode = extParam.orderCode || ''
this.isSharePay = extParam.isSharePay
if (this.orderCode) {
setTimeout(() => {
this.pollingPayStatus(this.orderCode)
@ -152,7 +156,25 @@ export default {
url: '/pages/mine/order/index',
})
},
successClose() {
// token
getTempToken({ memberCode, loginPassword, uuid }) {
registeredAutoLogin({
username: memberCode,
password: loginPassword,
uuid,
}).then(res => {
uni.setStorageSync('username', memberCode)
setToken(res.data.access_token)
store.dispatch('GetInfo').then(res => {
uni.switchTab({ url: '/pages/index/index' })
})
})
},
successClose({ memberCode, loginPassword, uuid }) {
if (this.isSharePay) {
this.getTempToken({ memberCode, loginPassword, uuid })
return
}
uni.redirectTo({
url: '/pages/mine/order/index',
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

After

Width:  |  Height:  |  Size: 660 KiB