feat: 🐛 新增备用登录方案、并优化店铺名称过长导致显示错乱的样式问题、优化自动发券功能

master
学习很差啦 2023-04-10 11:18:09 +08:00
parent 6a8e666fb8
commit af4cfe7fba
6 changed files with 336 additions and 255 deletions

View File

@ -22,5 +22,6 @@ export default {
mainColor: "#ff3c2a", // 主题色
lightColor: "#ff6b35", // 高亮主题色
aiderLightColor: "#ff9f28", // 辅助高亮颜色
defaultUserPhoto:"/static/missing-face.png" // 默认用户头像
defaultUserPhoto: "/static/missing-face.png", // 默认用户头像
enableFetchMobileLogin: true // 是否启用获取手机号登录 如果微信小程序提示封禁手机号获取权限 可将此选项设置成false作为备用登录方案
};

View File

@ -40,8 +40,8 @@
>
<!-- 店铺名称 -->
<view class="seller-info u-flex u-row-between">
<view class="seller-name" @click="navigateToStore(order)">
<view class="name">{{ order.storeName }}</view>
<view class="seller-name wes" @click="navigateToStore(order)">
<view class="name wes">{{ order.storeName }}</view>
</view>
<view class="order-sn">{{
order.orderStatus | orderStatusList
@ -689,6 +689,7 @@ page,
padding: 0 20rpx;
.seller-name {
flex:10;
font-size: 28rpx;
font-weight: 600;
display: flex;
@ -701,6 +702,9 @@ page,
}
.order-sn {
flex:2;
width:120rpx;
text-align: center;
color: $aider-light-color;
font-size: 26rpx;
}

View File

@ -156,6 +156,12 @@
order.createTime
}}</view>
</view>
<view class="order-info-view">
<view class="title">订单备注</view>
<view class="value">{{
order.remark
}}</view>
</view>
<view class="order-info-view">
<view class="title">支付状态</view>
<view class="value">
@ -753,4 +759,12 @@ page,
.address-line-height{
line-height: 1.75;
}
.seller-name{
>.name{
flex:10 !important;
}
>.status{
flex:2;
}
}
</style>

View File

@ -1,7 +1,8 @@
<template>
<view class="container">
<u-navbar :custom-back="back" title="小程序登录"></u-navbar>
<u-modal v-model="phoneAuthPopup" :mask-close-able="true" :title="projectName+'商城'" :show-confirm-button="false">
<u-modal v-model="phoneAuthPopup" :mask-close-able="true" :title="projectName+'商城'"
:show-confirm-button="false">
<div class="tips">
为了更好地用户体验需要您授权手机号
</div>
@ -19,7 +20,8 @@
<view>您的公开信息昵称头像</view>
</view>
<view class="btns">
<button type="primary" bindtap="getUserProfile" @click="getUserProfile()" class="btn-auth">使用微信授权</button>
<button type="primary" bindtap="getUserProfile" @click="getUserProfile()"
class="btn-auth">使用微信授权</button>
<div @click="backToHome" class="btn-callback">暂不登录</div>
</view>
</div>
@ -28,15 +30,22 @@
</template>
<script>
import { mpAutoLogin } from "@/api/connect.js";
import {
mpAutoLogin
} from "@/api/connect.js";
import { whetherNavigate } from "@/utils/Foundation"; //
import { getUserInfo } from "@/api/members";
import storage from "@/utils/storage.js";
import config from '@/config/config'
export default {
import {
whetherNavigate
} from "@/utils/Foundation"; //
import {
getUserInfo
} from "@/api/members";
import storage from "@/utils/storage.js";
import config from '@/config/config'
export default {
data() {
return {
configs:config,
//
phoneAuthPopup: false,
//
@ -53,15 +62,12 @@ export default {
//codecode
mounted() {
//
uni.showShareMenu({ withShareTicket: true });
uni.showShareMenu({
withShareTicket: true
});
let that = this;
//code
uni.login({
success: (res) => {
that.code = res.code;
},
});
},
methods: {
/**
@ -81,27 +87,71 @@ export default {
url: `/pages/tabbar/home/index`,
});
},
//
getUserProfile(e) {
async getUserProfile(e) {
let that = this;
//code
await uni.login({
success: (res) => {
that.code = res.code;
},
});
// 使wx.getUserProfile
uni.getUserProfile({
await uni.getUserProfile({
desc: "用于完善会员资料", //
success: (res) => {
that.nickName = res.userInfo.nickName;
that.image = res.userInfo.avatarUrl;
//
/**
* 根据公有的配置设置登录方式
*/
if(this.configs.enableFetchMobileLogin){
this.phoneAuthPopup = true;
return false
}
let iv = res.iv;
let encryptedData = res.encryptedData;
let code = this.code;
let image = this.image;
let nickName = this.nickName;
mpAutoLogin({
encryptedData,
iv,
code,
image,
nickName,
}).then((apiRes) => {
storage.setAccessToken(apiRes.data.result.accessToken);
storage.setRefreshToken(apiRes.data.result.refreshToken);
//
uni.showToast({
title: "登录成功!",
icon: "none",
});
//
getUserInfo().then((user) => {
storage.setUserInfo(user.data.result);
storage.setHasLogin(true);
uni.navigateBack({
delta: 1,
});
});
});
},
fail: (res) => {
that.nickName = "微信用户";
that.image =
"https://thirdwx.qlogo.cn/mmopen/vi_32/POgEwh4mIHO4nibH0KlMECNjjGxQUq24ZEaGT4poC6icRiccVGKSyXwibcPq4BWmiaIGuG1icwxaQX6grC9VemZoJ8rg/132";
//
this.phoneAuthPopup = true;
},
});
},
//
getPhoneNumber(e) {
let iv = e.detail.iv;
@ -142,21 +192,25 @@ export default {
});
});
},
},
};
};
</script>
<style lang="scss" scoped>
/*微信授权*/
page {
/*微信授权*/
page {
background-color: #ffffff;
}
}
.wx-auth-container {
.wx-auth-container {
width: 100%;
margin-top: 20%;
}
}
.logo-info {
.logo-info {
display: flex;
flex-wrap: nowrap;
justify-content: flex-start;
@ -166,69 +220,69 @@ page {
flex-direction: column;
font-weight: bold;
}
}
image {
image {
width: 100px;
height: 100px;
text-align: center;
-webkit-transform: scale(2.5);
transform: scale(2.5);
}
}
.logo-info-img {
.logo-info-img {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
border: none;
}
}
text.title,
text.shop {
text.title,
text.shop {
display: inline-block;
font-size: 60rpx;
color: #333;
}
}
text.shop {
text.shop {
display: inline-block;
font-size: 55rpx;
color: #333;
}
}
.box {
.box {
margin: 0 32rpx;
}
}
/* 文字提示*/
.small-tips {
/* 文字提示*/
.small-tips {
width: 94%;
padding: 20rpx;
font-size: 24rpx;
margin: 0 0 20rpx;
color: #999;
}
}
.auth-button {
.auth-button {
padding: 10px 20px;
width: calc(100% - 20 * 4rpx);
}
}
.tips {
.tips {
width: 80%;
text-align: left;
margin: 6% 10%;
margin-top: 48rpx;
line-height: 1.75;
}
}
.register {
.register {
color: $weChat-color !important;
border: none !important;
background: #fff !important;
}
}
.btn-auth {
.btn-auth {
width: 92%;
margin: 0 auto 40rpx;
border-radius: 100px;
@ -240,8 +294,9 @@ text.shop {
// -webkit-animation: mymove 5s infinite;
// -webkit-animation-direction: alternate; /**/
// -webkit-animation-timing-function: ease-in-out; /*线*/
}
.btn-callback {
}
.btn-callback {
text-align: center;
font-size: 30rpx;
background: #ededed;
@ -250,28 +305,33 @@ text.shop {
border-radius: 100px;
width: 92%;
margin: 0 auto;
}
}
.btns {
.btns {
margin-top: 100rpx;
display: flex;
flex-direction: column;
width: 100%;
justify-content: center;
}
}
@keyframes mymove {
@keyframes mymove {
0% {
transform: scale(1); /*开始为原始大小*/
transform: scale(1);
/*开始为原始大小*/
}
25% {
transform: scale(1.1); /*放大1.1倍*/
transform: scale(1.1);
/*放大1.1倍*/
}
50% {
transform: scale(1);
}
75% {
transform: scale(1.1);
}
}
}
</style>

View File

@ -26,7 +26,7 @@
@change="checkboxChangeDP(item)"></u-checkbox>
<!-- #endif -->
</u-checkbox-group>
<span class="store-name store-line-desc" @click.stop="navigateToStore(item)">{{
<span class="store-name wes store-line-desc" @click.stop="navigateToStore(item)">{{
item.storeName
}}</span>
<u-icon @click="navigateToStore(item)" size="24" style="margin-left:10rpx;" name="arrow-right"></u-icon>
@ -740,6 +740,7 @@ page {
display: flex;
// #endif
overflow: hidden;
flex:10;
}
.goods-config {
@ -758,6 +759,9 @@ page {
}
.right-col {
flex:2;
text-align: center;
width: 100rpx;
color: $light-color;
font-size: 26rpx;

View File

@ -100,13 +100,11 @@ export default {
},
methods: {
firstGetAuto() {
if(!this.$options.filters.isLogin('auth')) return false
let data = new Date();
let now = data.getDate();
let hours = data.getHours();
let flagCoup = storage.getAutoCp();
console.log(flagCoup);
console.log(now);
if (
storage.getAutoCp() &&
storage.getAutoCp() != "" &&