feat: 无感登录

This commit is contained in:
mayubo@gmail.com 2025-06-19 18:12:17 +08:00
parent c019e03db8
commit f9ca3cce55
8 changed files with 291 additions and 238 deletions

View File

@ -1,18 +1,23 @@
page {
background: #f6f7fb;
}
.header { .header {
margin: 40rpx 0 45rpx; margin: 40rpx 0 45rpx;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
} }
.avatar_pic { .avatar_pic {
width: 130rpx; width: 130rpx;
height: 130rpx; height: 130rpx;
border-radius: 50%; border-radius: 50%;
} }
.header_desc {
margin-top: 10rpx;
}
.main { .main {
margin: 45rpx 20rpx 62rpx; margin: 45rpx 20rpx 62rpx;
background: #FFFFFF; background: #ffffff;
background: yellow;
border-radius: 20rpx 20rpx 20rpx 20rpx; border-radius: 20rpx 20rpx 20rpx 20rpx;
} }
.tabel { .tabel {
@ -22,96 +27,49 @@ align-items: center;
} }
.left { .left {
font-size: 28rpx; font-size: 28rpx;
color: #999999; color: #999999;
margin-right: 68rpx; margin-right: 68rpx;
margin-left: 20rpx;
} }
.right { .right {
display: flex; display: flex;
align-items: center; align-items: center;
height: 100rpx; height: 100rpx;
flex: 1; flex: 1;
border-bottom: 1rpx solid #EBEBEB; border-bottom: 1rpx solid #ebebeb;
} }
.right_radio { .right_radio {
margin-left: 45rpx; margin-left: 45rpx;
} }
.no_border{
border-bottom: none;
}
.btn { .btn {
margin: 62rpx 75rpx 60rpx; margin: 62rpx 75rpx 60rpx;
height: 90rpx; height: 90rpx;
line-height: 90rpx; line-height: 90rpx;
background: linear-gradient( 91deg, #FF7658 0%, #FF370B 100%); background: linear-gradient(91deg, #ff7658 0%, #ff370b 100%);
border-radius: 100rpx 100rpx 100rpx 100rpx; border-radius: 100rpx 100rpx 100rpx 100rpx;
text-align: center; text-align: center;
font-weight: 600; font-weight: 600;
font-size: 36rpx; font-size: 36rpx;
color: #FFFFFF; color: #ffffff;
} }
/* .item{ .tabel1 {
display:flex; margin: 0 20rpx;
border-bottom:1px solid #e6e6e6; border-bottom: 1rpx solid #ebebeb;
height: 90rpx; height: 100rpx;
display: flex; display: flex;
align-items: center;
justify-content: space-between; justify-content: space-between;
align-items: center; }
margin-left: 52rpx; .tabel1 > .right {
margin-right: 48rpx; flex: 1;
border-bottom: none;
justify-content: flex-end;
} }
.item-left { .no_border {
display: flex; border-bottom: none;
align-items: center;
} }
.item-title {
font-size: 26rpx;
color: #999999;
}
.item-icon {
width: 30rpx;
height: 30rpx;
margin-right: 20rpx;
}
.item-right {
text-align: right;
font-size: 26rpx;
font-weight: 400;
color: #222222;
}
.right-icon {
width: 40rpx;
height: 40rpx;
}
.item-right-icon {
width: 13rpx;
height: 26rpx;
} */
/*
.item:last-child{
border-bottom:none
}
.line {
background: #F9F9F9;
height: 20rpx;
}
.desc {
font-size: 26rpx;
font-weight: 400;
color: #FF512A;
}
.quit_login {
margin: 10rpx 50rpx 0;
background: #FF512A;
border-radius: 100rpx 100rpx 100rpx 100rpx;
height: 80rpx;
color: #FFFFFF;
font-size: 36rpx;
font-weight: 400;
line-height: 80rpx;
} */
.u-upload__wrap__preview { .u-upload__wrap__preview {
width: 130rpx; width: 130rpx;
height: 130rpx; height: 130rpx;

View File

@ -4,7 +4,7 @@
<u-upload @afterRead="afterReadImg" :deletable="false" :maxCount="1"> <u-upload @afterRead="afterReadImg" :deletable="false" :maxCount="1">
<image class="avatar_pic" :src="avatarInfo.url" alt="" /> <image class="avatar_pic" :src="avatarInfo.url" alt="" />
</u-upload> </u-upload>
<view>点击更换头像</view> <view class="header_desc">点击更换头像</view>
</view> </view>
<view class="main"> <view class="main">
<view class="tabel"> <view class="tabel">
@ -14,7 +14,7 @@
type="text" type="text"
placeholder="请填写昵称" placeholder="请填写昵称"
:value="name" :value="name"
:data-name="name" data-name="name"
@input="headerInputClick" @input="headerInputClick"
/> />
</view> </view>
@ -43,22 +43,30 @@
type="text" type="text"
placeholder="请填写邮箱地址" placeholder="请填写邮箱地址"
:value="eMail" :value="eMail"
:data-name="eMail" data-name="eMail"
@input="headerInputClick" @input="headerInputClick"
/> />
</view> </view>
</view> </view>
</view> </view>
<view class="btn">保存设置</view> <view class="btn" @click="headerSubmitClick">保存设置</view>
<view class="main"> <view class="main">
<view class="tabel"> <view class="tabel1" @click="headerRefreshClick">
<view class="left">刷新登录</view> <view class="left">刷新登录</view>
<view class="right"> <view class="right">
<u-icon name="arrow-right" /> <u-icon name="arrow-right" />
</view> </view>
</view> </view>
<button
class="login-btn"
open-type="getPhoneNumber"
style="display: none;"
@click="headerLoginClick"
@getphonenumber="getPhoneNumber"
id="hiddenLoginBtn"
></button>
<view class="tabel no_border" @click="headerSettingClick"> <view class="tabel1 no_border" @click="headerSettingClick">
<view class="left">设置授权</view> <view class="left">设置授权</view>
<view class="right"> <view class="right">
<u-icon name="arrow-right" /> <u-icon name="arrow-right" />
@ -70,55 +78,24 @@
</template> </template>
<script> <script>
import { NavgateTo, request, picUrl, upload } from "../../../utils/index"; import { request, picUrl, upload, validateEmail } from "../../../utils/index";
import { apiArr } from "../../../api/login"; import { apiArr } from "../../../api/login";
import { apiArr as apiArr2 } from "../../../api/v2User"; import { apiArr as apiArr2 } from "../../../api/v2User";
export default { export default {
data() { data() {
return { return {
avatarInfo: {}, avatarInfo: {},
userInfoList: [
{
pic: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_422.png",
desc: "上传头像",
url: "/packages/user/uploadAvatar/index",
isShowPic: true,
},
{
pic: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Classroom.png",
desc: "当前账户",
url: "",
text: "微信用户",
},
{
pic: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_423.png",
desc: "修改登录密码",
type: "login",
url: "/packages/user/resetPwd/index",
isShowPic: true,
},
{
pic: "https://wechat-img-file.oss-cn-beijing.aliyuncs.com/User/_assets/Group_424.png",
desc: "修改支付密码",
type: "pay",
url: "/packages/user/resetPwd/index",
isShowPic: true,
isLast: true,
},
],
name: "", name: "",
mobile: "", mobile: "",
eMail: "", eMail: "",
sex: 2, sex: 0,
}; };
}, },
methods: { methods: {
// //
async afterReadImg(e) { async afterReadImg(e) {
console.log("eeee", e);
const { file } = e; const { file } = e;
upload(file.url, (res) => { upload(file.url, (res) => {
console.log("1111", res);
this.avatarInfo = { this.avatarInfo = {
url: picUrl + res.data.path, url: picUrl + res.data.path,
picUrl: res.data.path, picUrl: res.data.path,
@ -129,8 +106,72 @@ export default {
icon: "success", icon: "success",
}); });
}, },
headerRefreshClick() {
uni.showLoading({
title: '刷新中',
mask: true
})
//
uni.removeStorageSync('ctoken');
uni.removeStorageSync('userId');
uni.removeStorageSync('openId');
uni.removeStorageSync('phone');
uni.removeStorageSync('is_deal');
uni.removeStorageSync('is_dev');
uni.removeStorageSync('is_shop');
uni.removeStorageSync('shopId');
uni.removeStorageSync('order_dispatch_permission');
const button = uni.createSelectorQuery().select('#hiddenLoginBtn');
button.boundingClientRect().exec();
// headerLoginClick
this.headerLoginClick();
},
headerLoginClick() {
let that = this;
uni.login({
onlyAuthorize: true,
success: (res) => {
request(apiArr.login, 'POST', {
code: res.code,
phone: '',
password: '',
}, { silent: false }).then((loginRes) => {
//
uni.setStorageSync('ctoken', loginRes.token);
uni.setStorageSync('is_deal', loginRes.is_deal);
uni.setStorageSync('is_dev', loginRes.is_dev);
uni.setStorageSync('is_shop', loginRes.is_shop);
//
request(apiArr.loginInfo, 'POST', {
token: loginRes.token
}, { silent: false } ).then((res2) => {
if (res2.error) return;
// userId 使
uni.setStorageSync('userId', res2.user_id);
uni.setStorageSync('openId', res2.open_id);
uni.setStorageSync('shopId', res2.wshop_id);
that.init(true)
})
}, (err) => {
uni.hideLoading();
console.log('登录接口错误', err);
})
}
})
},
//
getPhoneNumber(event) {
console.log('小程序登录获取手机号', event);
},
headerInputClick(e) { headerInputClick(e) {
console.log("ee", e);
const { name } = e.currentTarget.dataset; const { name } = e.currentTarget.dataset;
const { value } = e.detail; const { value } = e.detail;
this[name] = value; this[name] = value;
@ -145,12 +186,37 @@ export default {
}, },
headerRadioClick(item) { headerRadioClick(item) {
console.log("item", item);
this.sex = item; this.sex = item;
}, },
async init() {
const res = await request(apiArr2.getUserInfo, "POST", {}); async headerSubmitClick() {
console.log("111211", res); if(this.eMail && !validateEmail(this.eMail)){
uni.showToast({
title: '请输入正确邮箱地址',
icon: 'none'
})
return
};
const res = await request(apiArr2.userInfoUpdate, 'POST', {
gender: this.sex,
avatar: this.avatarInfo.picUrl,
nick_name: this.name,
email: this.eMail,
// mobile
});
uni.showToast({
title: '保存成功',
mask: true
});
setTimeout(() => {
uni.navigateBack({
delta: 1
})
}, 2000)
},
async init(item = false) {
const res = await request(apiArr2.getUserInfo, "POST", {}, {silent: item === true ? false : true});
this.avatarInfo = { this.avatarInfo = {
url: res.avatar url: res.avatar
? picUrl + res.avatar ? picUrl + res.avatar
@ -161,6 +227,18 @@ export default {
this.mobile = res.mobile; this.mobile = res.mobile;
this.sex = res.gender; this.sex = res.gender;
this.eMail = res.email; this.eMail = res.email;
if (item) {
const { community_worker } = res;
uni.setStorageSync('order_dispatch_permission', community_worker && community_worker[0].order_dispatch_permission == 1 || false);
uni.setStorageSync('phone', res.account);
uni.hideLoading();
uni.showToast({
title: '刷新成功',
icon: 'success',
mask: true,
duration: 2000,
})
}
}, },
}, },

View File

@ -98,7 +98,6 @@ font-size: 34rpx;
color: #7F3907; color: #7F3907;
} }
.monenyt { .monenyt {
/* display: inline-block; */
margin-left: 17rpx; margin-left: 17rpx;
margin-right: 37rpx; margin-right: 37rpx;
font-weight: 400; font-weight: 400;
@ -157,9 +156,7 @@ margin-right: 20rpx;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
} }
.order {
margin-top: 24rpx;
}
.nav_icon { .nav_icon {
width: 50rpx; width: 50rpx;
height: 50rpx; height: 50rpx;
@ -169,16 +166,7 @@ margin-right: 20rpx;
font-size: 24rpx; font-size: 24rpx;
} }
.item {
display: flex;
width: 48%;
height: 150rpx;
background-color: #FFFFFF;
border-radius: 30rpx;
justify-content: left;
align-items: center;
/* padding-left: 28rpx; */
}
.item1 { .item1 {
display: flex; display: flex;
@ -191,59 +179,24 @@ margin-right: 20rpx;
padding-bottom: 0; padding-bottom: 0;
} }
.item-owner { .item_device {
margin:0 116rpx 0 116rpx; display: flex;
} flex-direction: column;
align-items: center;
.item-icon {
width: 150rpx;
height: 98rpx;
margin-left: 30rpx;
}
.item-icon1 {
width: 150rpx;
height: 120rpx;
margin-left: 30rpx;
} }
.icon-img { .icon-img {
display: flex; display: flex;
width: 72rpx; width: 60rpx;
height: 72rpx; height: 60rpx;
flex-direction: column; flex-direction: column;
margin-bottom: 28rpx; margin-bottom: 10rpx;
margin-left: 17%;
}
.item-content {
display: flex;
flex-direction: column;
padding-left: 28rpx;
} }
.title-item { .title-item {
font-size: 26rpx; font-size: 26rpx;
} }
.item-title {
font-size: 28rpx;
color: #333;
font-weight: bold;
margin-bottom: 5rpx;
}
.item-subtitle {
font-size: 20rpx;
color: #666;
}
.navigation {
margin-top: 29rpx;
margin-left: 22rpx;
font-size: 32rpx;
font-weight: bold;
}
.customer { .customer {
width: 130rpx; width: 130rpx;
height: 130rpx; height: 130rpx;

View File

@ -8,13 +8,21 @@
</view> </view>
<view class="avatar_right"> <view class="avatar_right">
<view class="avatar_title"> <view class="avatar_title">
<view class="login-btn">{{userInfo.user_name ? userInfo.user_name : '登录/注册'}}</view> <view class="login-btn">{{userInfo.nick_name ? userInfo.nick_name : '登录/注册'}}</view>
<view class="avatar_setting"> <view class="avatar_setting">
<image src="http://127.0.0.1:5500/assets/page_user_Vector13.png" mode="" @click.stop="headerRefreshClick"/> <image src="http://127.0.0.1:5500/assets/page_user_Vector13.png" mode="" @click.stop="headerRefreshClick"/>
<button
class="login-btn"
open-type="getPhoneNumber"
style="display: none;"
@click="headerLoginClick"
@getphonenumber="getPhoneNumber"
id="hiddenLoginBtn"
></button>
<image src="http://127.0.0.1:5500/assets/page_user_Vector14.png" mode="" @click.stop="headerSettingsClick"/> <image src="http://127.0.0.1:5500/assets/page_user_Vector14.png" mode="" @click.stop="headerSettingsClick"/>
</view> </view>
</view> </view>
<view class="avater_mobile">{{ phoneNum }}</view> <view class="avater_mobile">{{ userInfo.mobile }}</view>
</view> </view>
</view> </view>
<view class="section section1"> <view class="section section1">
@ -36,23 +44,6 @@
</view> </view>
</view> </view>
<!-- <view class="section">
<view class="item" @click="handlePointsClick">
<view class="item-content">
<text class="item-title">积分</text>
<text class="item-subtitle">我的剩余积分</text>
</view>
<image class="item-icon" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/person/5bf7d7dca1ff7_1.png">
</image>
</view>
<view class="item" @click="handleSignClick">
<view class="item-content">
<text class="item-title">每日签到</text>
<text class="item-subtitle">签到获取积分</text>
</view>
<image class="item-icon1" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/person/Group_311.png" />
</view>
</view> -->
<view class="center"> <view class="center">
<view class="gold_container"> <view class="gold_container">
<view class="gold_title"> <view class="gold_title">
@ -65,20 +56,20 @@
<view class="item1"> <view class="item1">
<view class="item_device" @click="handleCommunityClick"> <view class="item_device" @click="handleCommunityClick">
<image class="icon-community icon-img" <image class="icon-community icon-img"
src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/person/Group_16.png"></image> src="http://127.0.0.1:5500/assets/page_user_Group_1382.png"></image>
<text class="community-title title-item">我的社区</text> <text class="community-title title-item">我的房产</text>
</view> </view>
<view class="item_device" @click="handleApplyOwnerClick"> <view class="item_device" @click="handleApplyOwnerClick">
<image class="icon-owner icon-img" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/person/Frame.png" /> <image class="icon-img" src="http://127.0.0.1:5500/assets/page_user_Group_1559.png" />
<text class="owner-title title-item">申请业主</text> <text class="owner-title title-item">物业账单</text>
</view> </view>
<view class="item_device" @click="handleFacilityClick"> <view class="item_device" @click="handleFacilityClick">
<image class="icon-device icon-img" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/person/Frame_1.png"/> <image class="icon-img" src="http://127.0.0.1:5500/assets/page_user_Group_1557.png"/>
<text class="device-title title-item">我的设备</text> <text class="device-title title-item">我的工单</text>
</view> </view>
<view class="item_device" @click="handleMeApplyClick"> <view class="item_device" @click="handleMeApplyClick">
<image class="icon-device icon-img" src="https://wechat-img-file.oss-cn-beijing.aliyuncs.com/Group_905.png"/> <image class="icon-img" src="http://127.0.0.1:5500/assets/page_user_Group_1558.png"/>
<text class="device-title title-item">我的申请</text> <text class="device-title title-item">我的管家</text>
</view> </view>
</view> </view>
</view> </view>
@ -129,6 +120,7 @@
<script> <script>
import { apiArr } from '../../api/login'; import { apiArr } from '../../api/login';
import { apiArr as apiArr2 } from '../../api/v2User';
import { menuButtonInfo, NavgateTo, picUrl, request } from '../../utils/index'; import { menuButtonInfo, NavgateTo, picUrl, request } from '../../utils/index';
export default { export default {
data() { data() {
@ -197,11 +189,8 @@
url: "", url: "",
} }
], ],
userInfo: {}, userInfo: {},
isShop: false, isShop: false,
phoneNum: uni.getStorageSync('phone'),
} }
}, },
@ -213,12 +202,72 @@
// //
headerRefreshClick() { headerRefreshClick() {
console.log('刷新') uni.showLoading({
title: '刷新中',
mask: true
})
//
uni.removeStorageSync('ctoken');
uni.removeStorageSync('userId');
uni.removeStorageSync('openId');
uni.removeStorageSync('phone');
uni.removeStorageSync('is_deal');
uni.removeStorageSync('is_dev');
uni.removeStorageSync('is_shop');
uni.removeStorageSync('shopId');
uni.removeStorageSync('order_dispatch_permission');
const button = uni.createSelectorQuery().select('#hiddenLoginBtn');
button.boundingClientRect().exec();
// headerLoginClick
this.headerLoginClick();
}, },
headerLoginClick() {
let that = this;
uni.login({
onlyAuthorize: true,
success: (res) => {
request(apiArr.login, 'POST', {
code: res.code,
phone: '',
password: '',
}, { silent: false }).then((loginRes) => {
//
uni.setStorageSync('ctoken', loginRes.token);
uni.setStorageSync('is_deal', loginRes.is_deal);
uni.setStorageSync('is_dev', loginRes.is_dev);
uni.setStorageSync('is_shop', loginRes.is_shop);
//
request(apiArr.loginInfo, 'POST', {
token: loginRes.token
}, { silent: false } ).then((res2) => {
if (res2.error) return;
// userId 使
uni.setStorageSync('userId', res2.user_id);
uni.setStorageSync('openId', res2.open_id);
uni.setStorageSync('shopId', res2.wshop_id);
that.getUserInfo(true)
})
}, (err) => {
uni.hideLoading();
console.log('登录接口错误', err);
})
}
})
},
//
getPhoneNumber(event) {
console.log('小程序登录获取手机号', event);
},
// //
headerSettingsClick() { headerSettingsClick() {
console.log('设置')
NavgateTo('/packages/user/index/index'); NavgateTo('/packages/user/index/index');
}, },
@ -227,16 +276,6 @@
console.log('客服') console.log('客服')
}, },
//
handlePointsClick() {
NavgateTo('/packages/user/points/index');
},
//
handleSignClick() {
NavgateTo('/packages/user/pointsSign/index');
},
// //
handleCommunityClick(){ handleCommunityClick(){
NavgateTo('/packages/community/index/index') NavgateTo('/packages/community/index/index')
@ -282,22 +321,6 @@
} }
}, },
//
headerGridItemClick(event) {
if (!event.url) {
this.NotOpen();
return
}
//
if (event.url === '/packages/user/customerService/index') {
NavgateTo( event.url, { isLogin: false})
return;
}
if (event.url) {
NavgateTo( event.url)
}
},
// //
NotOpen() { NotOpen() {
uni.showModal({ uni.showModal({
@ -314,15 +337,27 @@
}, },
async getUserInfo() { async getUserInfo(item = false) {
const isCtoken = uni.getStorageSync('ctoken'); const isCtoken = uni.getStorageSync('ctoken');
if (!isCtoken) return; if (!isCtoken) return;
const res = await request(apiArr.loginInfo, 'POST', {}); const res = await request(apiArr2.getUserInfo, 'POST', {}, {silent: item === true ? false : true});
const newUserInfo = { const newUserInfo = {
...res, ...res,
userPic: res.img ? `${picUrl}${res.img}` : 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/person/Group_309.png' userPic: res.avatar ? `${picUrl}${res.avatar}` : 'https://wechat-img-file.oss-cn-beijing.aliyuncs.com/person/Group_309.png'
}; };
this.userInfo = newUserInfo; this.userInfo = newUserInfo;
if (item) {
const { community_worker } = res;
uni.setStorageSync('order_dispatch_permission', community_worker && community_worker[0].order_dispatch_permission == 1 || false);
uni.setStorageSync('phone', res.account);
uni.hideLoading();
uni.showToast({
title: '刷新成功',
icon: 'success',
mask: true,
duration: 2000,
})
}
}, },
}, },

File diff suppressed because one or more lines are too long

View File

@ -19342,7 +19342,7 @@ var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/inte
Object.defineProperty(exports, "__esModule", { Object.defineProperty(exports, "__esModule", {
value: true value: true
}); });
exports.uploadVideo = exports.upload = exports.uniqueByField = exports.request = exports.picUrl = exports.menuButtonInfo = exports.isPhone = exports.getProviderPromise = exports.floatCalculate = exports.calculateDistance = exports.NavgateTo = void 0; exports.validateEmail = exports.uploadVideo = exports.upload = exports.uniqueByField = exports.request = exports.picUrl = exports.menuButtonInfo = exports.isPhone = exports.getProviderPromise = exports.floatCalculate = exports.calculateDistance = exports.NavgateTo = void 0;
var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11)); var _defineProperty2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/defineProperty */ 11));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@ -19713,7 +19713,18 @@ var uniqueByField = function uniqueByField(arr, field) {
return seen.hasOwnProperty(key) ? false : seen[key] = true; return seen.hasOwnProperty(key) ? false : seen[key] = true;
}); });
}; };
// 校验邮箱地址是否合法
exports.uniqueByField = uniqueByField; exports.uniqueByField = uniqueByField;
var validateEmail = function validateEmail(email) {
// 正则表达式验证邮箱格式
var regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
if (!regex.test(email)) {
return false;
}
return true;
};
exports.validateEmail = validateEmail;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"])) /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./node_modules/@dcloudio/uni-mp-weixin/dist/index.js */ 2)["default"]))
/***/ }), /***/ }),

View File

@ -3,12 +3,19 @@
"miniprogram": { "miniprogram": {
"list": [ "list": [
{ {
"name": "个人设置", "name": "pages/user/index",
"pathName": "packages/user/index/index", "pathName": "pages/user/index",
"query": "", "query": "",
"scene": null, "scene": null,
"launchMode": "default" "launchMode": "default"
}, },
{
"name": "个人设置",
"pathName": "packages/user/index/index",
"query": "",
"launchMode": "default",
"scene": null
},
{ {
"name": "完善注册信息", "name": "完善注册信息",
"pathName": "packages/user/replenishInfo/index", "pathName": "packages/user/replenishInfo/index",

View File

@ -358,4 +358,15 @@ export const uniqueByField = (arr, field) => {
}); });
} }
// 校验邮箱地址是否合法
export const validateEmail = (email) => {
// 正则表达式验证邮箱格式
const regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
if (!regex.test(email)) {
return false;
}
return true
}