Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
W
wly-APP
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘川
wly-APP
Commits
bb5a4fc1
Commit
bb5a4fc1
authored
Oct 10, 2022
by
xiangzj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
登录记住账号密码
parent
d1d544a6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
13 deletions
+90
-13
group-baseinfo.nvue
pages/group-buy/group-baseinfo.nvue
+1
-0
login.nvue
pages/login/login.nvue
+89
-13
No files found.
pages/group-buy/group-baseinfo.nvue
View file @
bb5a4fc1
...
@@ -467,6 +467,7 @@
...
@@ -467,6 +467,7 @@
.uni-input-text {
.uni-input-text {
font-size: 14px;
font-size: 14px;
color: #888;
color: #888;
line-height: 50%;
}
}
.icon-arrow {
.icon-arrow {
...
...
pages/login/login.nvue
View file @
bb5a4fc1
...
@@ -30,6 +30,37 @@
...
@@ -30,6 +30,37 @@
placeholder-class='placeholder-text' />
placeholder-class='placeholder-text' />
</view> -->
</view> -->
</view>
</view>
<!-- <view class="mui-input-row mui-checkbox rememberAll">
<view class="rememberNum">
<checkbox-group @change="checkboxChangeNum">
<checkbox
color="#FF1D32"
id="chkRemNum"
type="checkbox"
:checked="rememberAt"
@tap="rememberAt = !rememberAt"
class="RememberCheck"
>
</checkbox>
<lable for="chkRemNum" class="RememberPass">记住账号</lable>
</checkbox-group>
</view>
<view class="">
<checkbox-group @change="checkboxChange">
<checkbox
color="#FF1D32"
id="chkRem"
type="checkbox"
:checked="rememberPsw"
@tap="rememberPsw = !rememberPsw"
class="RememberCheck"
>
</checkbox>
<lable for="chkRem" class="RememberPass">记住密码</lable>
</checkbox-group>
</view>
</view> -->
<view class="bottom">
<view class="bottom">
<button class="btn" type="default" @click="goLogin" :class="{ 'btn-disabled': disabled }"
<button class="btn" type="default" @click="goLogin" :class="{ 'btn-disabled': disabled }"
:disabled="disabled"><text class="btn-text">{{loginBtnText}}</text></button>
:disabled="disabled"><text class="btn-text">{{loginBtnText}}</text></button>
...
@@ -65,7 +96,9 @@
...
@@ -65,7 +96,9 @@
loginType: 'password',
loginType: 'password',
passwordVisible: false,
passwordVisible: false,
disabled: false,
disabled: false,
cursorNumber: 0
cursorNumber: 0,
rememberPsw: true,
rememberAt: true,
}
}
},
},
computed: {
computed: {
...
@@ -112,18 +145,13 @@
...
@@ -112,18 +145,13 @@
mounted() {
mounted() {
let that = this;
let that = this;
//缓存的账号
//缓存的账号
const username = uni.getStorageSync('username');
const username = uni.getStorageSync('username')
|| ''
;
//缓存的密码
//缓存的密码
const password = uni.getStorageSync('password');
const password = uni.getStorageSync('password')
|| ''
;
console.log("密码",password,username)
console.log("密码",password,username)
//有缓存就赋值给文本没有就清空
//有缓存就赋值给文本没有就清空
if (username && password) {
that.account = username || ''
that.account = username;
that.password = password || ''
that.password = password;
} else {
that.account = '';
that.password = '';
}
that.handlePasswordVisible()
that.handlePasswordVisible()
that.$nextTick(()=>{
that.$nextTick(()=>{
setTimeout(function() {
setTimeout(function() {
...
@@ -132,6 +160,27 @@
...
@@ -132,6 +160,27 @@
})
})
},
},
methods: {
methods: {
checkboxChangeNum(){
if (e.detail.value.length == 1) {
//获取缓存的账号
uni.getStorageSync('username',this.account);
// uni.getStorageSync('password',this.password);
} else {
uni.removeStorageSync('username');
// uni.removeStorageSync('password');
}
},
//复选框
checkboxChange: function(e) {
if (e.detail.value.length == 1) {
//获取缓存的账号
// uni.getStorageSync('username',this.account);
uni.getStorageSync('password',this.password);
} else {
// uni.removeStorageSync('username');
uni.removeStorageSync('password');
}
},
// 切换密码可见性
// 切换密码可见性
handlePasswordVisible() {
handlePasswordVisible() {
this.passwordVisible = !this.passwordVisible;
this.passwordVisible = !this.passwordVisible;
...
@@ -157,8 +206,19 @@
...
@@ -157,8 +206,19 @@
// status: 1
// status: 1
// }
// }
if (res.status === 1) {
if (res.status === 1) {
uni.setStorageSync('username', this.account);
//缓存账号和密码
if (this.rememberPsw) {
uni.setStorageSync('password', this.password);
uni.setStorageSync('password', this.password);
} else {
uni.removeStorageSync('password');
}
if(this.rememberAt){
uni.setStorageSync('username', this.account);
} else {
uni.removeStorageSync('username');
}
// uni.setStorageSync('username', this.account);
// uni.setStorageSync('password', this.password);
this.$uStore({
this.$uStore({
name: 'userInfo',
name: 'userInfo',
value: {
value: {
...
@@ -221,6 +281,13 @@
...
@@ -221,6 +281,13 @@
</script>
</script>
<style lang="scss" scoped>
<style lang="scss" scoped>
.mui-checkbox input[type='checkbox']:checked:before {
color: #00bbb1;
}
.RememberPass {
color: #adadad;
margin-top: 5px;
}
.login {
.login {
display: flex;
display: flex;
flex-direction: column;
flex-direction: column;
...
@@ -248,7 +315,7 @@
...
@@ -248,7 +315,7 @@
.middle {
.middle {
display: flex;
display: flex;
flex-direction: column;
flex-direction: column;
margin: 100rpx 0
5
6rpx;
margin: 100rpx 0
2
6rpx;
}
}
.placeholder-text {
.placeholder-text {
...
@@ -322,4 +389,13 @@
...
@@ -322,4 +389,13 @@
font-size: 28rpx;
font-size: 28rpx;
color: #666660;
color: #666660;
}
}
.rememberAll{
margin-bottom: 28rpx;
}
.rememberNum{
margin-right: 60rpx;
}
.RememberCheck{
margin-right: 10rpx;
}
</style>
</style>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment