3
0
Fork 0

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

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

View File

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

View File

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

View File

@ -1,6 +1,11 @@
<template> <template>
<u-popup :show="sucShow" closeable :round="10" mode="center" @close="sucShow= false"> <u-popup
:show="sucShow"
closeable
:round="10"
mode="center"
@close="sucShow = false"
>
<view class="pop_a"> <view class="pop_a">
<view class="tit"> <view class="tit">
<u-icon name="checkmark-circle-fill" color="#029B00"></u-icon> <u-icon name="checkmark-circle-fill" color="#029B00"></u-icon>
@ -9,7 +14,12 @@
<view class="getCode" @tap="onCopy">{{ '复制' }}</view> <view class="getCode" @tap="onCopy">{{ '复制' }}</view>
<view class="form"> <view class="form">
<u--form labelPosition="left" labelWidth="80px" :model="allData" ref="uForm"> <u--form
labelPosition="left"
labelWidth="80px"
:model="allData"
ref="uForm"
>
<u-form-item :label="'会员姓名' + ':'" borderBottom> <u-form-item :label="'会员姓名' + ':'" borderBottom>
<u--input v-model="allData.memberName" border="none"></u--input> <u--input v-model="allData.memberName" border="none"></u--input>
</u-form-item> </u-form-item>
@ -20,12 +30,10 @@
<u--input v-model="allData.phone" border="none"></u--input> <u--input v-model="allData.phone" border="none"></u--input>
</u-form-item> </u-form-item>
<u-form-item :label="'登录密码' + ':'" borderBottom> <u-form-item :label="'登录密码' + ':'" borderBottom>
<u--input v-model="allData.loginPassword" border="none"> <u--input v-model="allData.loginPassword" border="none"> </u--input>
</u--input>
</u-form-item> </u-form-item>
<u-form-item :label="'支付密码' + ':'" borderBottom> <u-form-item :label="'支付密码' + ':'" borderBottom>
<u--input v-model="allData.payPassword" border="none"> <u--input v-model="allData.payPassword" border="none"> </u--input>
</u--input>
</u-form-item> </u-form-item>
<u-form-item :label="'登录网址' + ':'" borderBottom> <u-form-item :label="'登录网址' + ':'" borderBottom>
<u--input v-model="allData.urlAddress" border="none"></u--input> <u--input v-model="allData.urlAddress" border="none"></u--input>
@ -43,8 +51,8 @@
</u-button> </u-button>
</view> </view>
</view> </view>
<img class="yh" v-show="bia" src="@/static/images/yh.gif" alt=""> <img class="yh" v-show="bia" src="@/static/images/yh.gif" alt="" />
<img class="cd" v-show="bia" src="@/static/images/cd.gif" alt=""> <img class="cd" v-show="bia" src="@/static/images/cd.gif" alt="" />
</view> </view>
</u-popup> </u-popup>
</template> </template>
@ -73,27 +81,33 @@
}, },
handleClose() { handleClose() {
this.sucShow = false this.sucShow = false
this.$emit('successClose') this.$emit('successClose', this.allData)
}, },
payPw() {}, payPw() {},
onCopy() { onCopy() {
let text = let text =
'会员姓名' + ':' + '会员姓名' +
':' +
this.allData.memberName + this.allData.memberName +
'\n' + '\n' +
'会员编号' + ':' + '会员编号' +
':' +
this.allData.memberCode + this.allData.memberCode +
'\n' + '\n' +
'会员电话' + ':' + '会员电话' +
':' +
this.allData.phone + this.allData.phone +
'\n' + '\n' +
'登录密码' + ':' + '登录密码' +
':' +
this.allData.loginPassword + this.allData.loginPassword +
'\n' + '\n' +
'支付密码' + ':' + '支付密码' +
':' +
this.allData.payPassword + this.allData.payPassword +
'\n' + '\n' +
'登录网址' + ':' + '登录网址' +
':' +
this.allData.urlAddress this.allData.urlAddress
// + // +
// '\n' + // '\n' +
@ -107,7 +121,7 @@
// 'APP'+`(${''})` + // 'APP'+`(${''})` +
// ':' + // ':' +
// this.allData.android // this.allData.android
this.$copyText(text).then((res) => { this.$copyText(text).then(res => {
uni.showToast({ uni.showToast({
title: '复制成功', title: '复制成功',
icon: 'none', icon: 'none',
@ -176,7 +190,7 @@
font-size: 30rpx; font-size: 30rpx;
font-family: Source Han Sans CN; font-family: Source Han Sans CN;
font-weight: bold; font-weight: bold;
color: #005BAC; color: #005bac;
text-align: center; text-align: center;
} }
@ -184,13 +198,17 @@
margin-top: 30px; margin-top: 30px;
text-align: center; text-align: center;
font-size: 16px; font-size: 16px;
font-family: PingFang SC-Regular, PingFang SC; font-family:
PingFang SC-Regular,
PingFang SC;
font-weight: 400; font-weight: 400;
color: #666666; color: #666666;
.red { .red {
font-size: 20px; font-size: 20px;
font-family: PingFang SC-Regular, PingFang SC; font-family:
PingFang SC-Regular,
PingFang SC;
font-weight: 400; font-weight: 400;
color: #f43c3a; color: #f43c3a;
position: relative; position: relative;
@ -236,7 +254,9 @@
text-align: right; text-align: right;
margin: 48rpx 24rpx 0 0; margin: 48rpx 24rpx 0 0;
font-size: 10px; font-size: 10px;
font-family: PingFang SC-Regular, PingFang SC; font-family:
PingFang SC-Regular,
PingFang SC;
font-weight: 400; font-weight: 400;
color: #18acff; color: #18acff;
} }

View File

@ -9,6 +9,11 @@ export const login = params =>
export const autoLogin = params => export const autoLogin = params =>
http.post('/member/api/retail-auth/auto-login', 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 => export const getInfo = params =>
http.get('/member/api/retail-member/get-info', { params }) http.get('/member/api/retail-member/get-info', { params })

View File

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

View File

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

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

After

Width:  |  Height:  |  Size: 660 KiB