Browse Source

1.添加修改密码接口

20241218TB223FC(测试jar包)
wangwanlei 8 months ago
parent
commit
8af7645c33

+ 6
- 1
app/src/main/java/com/xhly/manageapp/network/UriAdress.kt View File

@@ -12,7 +12,7 @@ object UriAdress {
12 12
     const val LOGPUSH_ADD = "/logPush/add"
13 13
 
14 14
     /**
15
-     *应用启动日志-添加
15
+     *应用启动日志-添加,用来记录app的使用时长。
16 16
      */
17 17
     const val LOGAPPSTARTADD = "/logAppStart/add"
18 18
 
@@ -85,4 +85,9 @@ object UriAdress {
85 85
      * 解除当前锁屏
86 86
      */
87 87
     const val PWD_DEATIL_USERPAD = "/password/detail_userpad"
88
+
89
+    /**
90
+     * 修改密码
91
+     */
92
+    const val EDITPWD="/user/edit_pwd"
88 93
 }

+ 6
- 0
app/src/main/java/com/xhly/manageapp/ui/login/netservice/LoginService.kt View File

@@ -33,4 +33,10 @@ interface LoginService {
33 33
      */
34 34
     @POST(UriAdress.PWD_DEATIL_USERPAD)
35 35
     suspend fun postPwdDetail(@Body map:HashMap<String,Any>):ResponseData<Any>
36
+
37
+    /**
38
+     * 修改密码 userid用户id loginpwd新密码 oldpwd原密码
39
+     */
40
+    @POST(UriAdress.EDITPWD)
41
+    suspend fun postEditPwd(@Body map:HashMap<String,Any>):ResponseData<Any>
36 42
 }

+ 3
- 4
app/src/main/java/com/xhly/manageapp/ui/main/activity/MainActivity.kt View File

@@ -323,7 +323,7 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
323 323
                             val userBean = spUtils.getFromJson(
324 324
                                 Const.USERINFO, UserBean().javaClass
325 325
                             ) as UserBean
326
-
326
+                             viewModel.postEditPwd(userBean.userid,newCode,oldCode)
327 327
                         } catch (e: Exception) {
328 328
 
329 329
                         }
@@ -508,10 +508,9 @@ class MainActivity : BaseActivity<MainViewModel, ActivityMainBinding>() {
508 508
                 timer?.schedule( object : TimerTask() {
509 509
                     override fun run() {
510 510
                         // 在这里编写您的定时任务代码
511
-                        Toast(getString(R.string.durationtips))
512
-                        startTimeTask(bean)
511
+                        Toast(getString(R.string.durationtips)+"|||"+bean.duration)
513 512
                     }
514
-                },0L,bean.duration*60*1000L)
513
+                },bean.duration*60*1000L,bean.duration*60*1000L)
515 514
             }
516 515
         }
517 516
         //如果设置的有时间则取消所有任务

+ 18
- 0
app/src/main/java/com/xhly/manageapp/ui/main/viewmodel/MainViewModel.kt View File

@@ -2,6 +2,8 @@ package com.xhly.manageapp.ui.main.viewmodel
2 2
 
3 3
 import androidx.lifecycle.LiveData
4 4
 import androidx.lifecycle.MutableLiveData
5
+import com.xhly.corelib.Const
6
+import com.xhly.corelib.eventbus.UIEvent
5 7
 import com.xhly.corelib.network.RetrofitService
6 8
 import com.xhly.manageapp.bean.AppModel
7 9
 import com.xhly.manageapp.bean.ListAppBean
@@ -192,4 +194,20 @@ class MainViewModel : BaseViewModel() {
192 194
             }
193 195
         }
194 196
     }
197
+
198
+    /**
199
+     * 修改密码
200
+     */
201
+    fun postEditPwd(userid:Long, loginpwd:String, oldpwd:String){
202
+        launchUI {
203
+            val map=HashMap<String,Any>()
204
+            map["userid"] = userid
205
+            map["loginpwd"] =loginpwd
206
+            map["oldpwd"] = oldpwd
207
+            val postEditPwd = loginService.postEditPwd(map)
208
+            if (postEditPwd.code==0){
209
+              UIEvent(Const.ACCOUNTLOGINOUT).post()
210
+            }
211
+        }
212
+    }
195 213
 }

Loading…
Cancel
Save