w-ui-v1 1.0.59 → 1.0.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "w-ui-v1",
3
- "version": "1.0.59",
3
+ "version": "1.0.60",
4
4
  "description": "w-ui",
5
5
  "author": "wgxshh",
6
6
  "license": "ISC",
@@ -27,10 +27,14 @@
27
27
  const model = reactive<{
28
28
  username : string
29
29
  password : string
30
+ remember:boolean
30
31
  }>({
31
- username: '',
32
- password: '',
32
+ username:uni.getStorageSync("username") ||'',
33
+ password:uni.getStorageSync("password") ||'',
34
+ remember:uni.getStorageSync("remember")||false
33
35
  })
36
+
37
+
34
38
 
35
39
  const form = ref()
36
40
 
@@ -43,6 +47,7 @@
43
47
 
44
48
  // 登录
45
49
  function handleLogin() {
50
+ console.log(model)
46
51
  showLoading('登录中...')
47
52
  login(model.username, model.password, pKey.value).then(({ data } : any) => {
48
53
  if (data.status === 'error') {
@@ -50,6 +55,18 @@
50
55
  }
51
56
  showSuccess('登录成功')
52
57
  uni.setStorageSync('token', data.token)
58
+ // 记住密码
59
+ if(model.remember){
60
+ uni.setStorageSync('remember', model.remember)
61
+ uni.setStorageSync('password', model.password)
62
+ uni.setStorageSync('username', model.username)
63
+ }else{
64
+ // 忘记密码
65
+ uni.removeStorageSync('remember')
66
+ uni.removeStorageSync('password')
67
+ uni.removeStorageSync('username')
68
+ }
69
+
53
70
  getUserConfig().then(({ data } : any) => {
54
71
  uni.setStorageSync('userInfo', {
55
72
  ...data.user
@@ -95,6 +112,9 @@
95
112
  placeholder="请输入用户名" :rules="[{ required: true, message: '请填写用户名' }]" />
96
113
  <wd-input v-model="model.password" label="密码" label-width="100px" prop="password" show-password
97
114
  clearable placeholder="请输入密码" :rules="[{ required: true, message: '请填写密码' }]" />
115
+ <view style="padding-left: 15px;">
116
+ <wd-checkbox v-model="model.remember" shape="square">记住密码</wd-checkbox>
117
+ </view>
98
118
  </wd-cell-group>
99
119
  <view class="footer">
100
120
  <wd-button type="primary" block :round="false" @click="handleSubmit">