左晓为主开发手持机充值管理机
zuoxiao
2025-04-11 040f1aba13b179ff318366680a6346af7fd97795
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package com.dayu.general.activity
 
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.dayu.baselibrary.business.BusinessProvider
import com.dayu.baselibrary.view.ConfirmDialog
import com.dayu.general.BaseApplication
import com.dayu.general.databinding.FragmentMyBinding
 
class MyFragment : Fragment() {
    var binding: FragmentMyBinding? = null;
    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        binding = FragmentMyBinding.inflate(inflater, container, false)
        binding?.logoutRL?.setOnClickListener {
            ConfirmDialog(requireContext(), "提示", "确定要退出登录吗?") {
                logout()
            }.show()
        }
        
 
        
        return binding?.root
    }
 
    override fun onResume() {
        super.onResume()
        if (BaseApplication.userName.isNotEmpty()) {
            binding?.myName?.text = BaseApplication.userName
        } else {
            binding?.myName?.text = "未登录"
        }
        if (BaseApplication.userPhone.isNotEmpty()) {
            binding?.myPhone?.text = BaseApplication.userPhone
        } else {
            binding?.myPhone?.text = "未登录"
        }
        if (BaseApplication.blockName.isNotEmpty()) {
            binding?.myAdName?.text = BaseApplication.blockName
        } else {
            binding?.myAdName?.text = "未登录"
        }
    }
 
    fun logout() {
        BaseApplication.userId = ""
        BaseApplication.userName = ""
        BaseApplication.userPhone = ""
        BaseApplication.blockId = ""
        BaseApplication.blockName = ""
        binding?.myName?.text = "未登录"
        binding?.myPhone?.text = "未登录"
        binding?.myAdName?.text = "未登录"
 
        // 使用路由管理器跳转到登录页面
        context?.let {
            BusinessProvider.getBusinessProvider().startLoginNavigotor.navigateToLogin(context)
        }
    }
}