other.nvue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <!-- <view >
  3. <button type="primary" @click="ExitLogin">注销</button>
  4. <button type="primary" style="margin: 1;" @click="ExitApp">退出应用</button>
  5. <button type="primary" @click="GetUserInfo">获取用户信息和Token数据</button>
  6. </view> -->
  7. <view>
  8. <view style="height: 5px;"></view>
  9. <view class="uni-navigate-item-my" @click="ExitLogin">
  10. <text class="uni-navigate-text-my">注销</text>
  11. <text class="uni-navigate-icon-my uni-icon">&#xe470;</text>
  12. </view>
  13. <view style="height: 5px;"></view>
  14. <view class="uni-navigate-item-my" @click="ExitApp">
  15. <text class="uni-navigate-text-my">退出应用</text>
  16. <text class="uni-navigate-icon-my uni-icon">&#xe470;</text>
  17. </view>
  18. </view>
  19. </template>
  20. <script>
  21. // TODO 修复Android v3 加载过慢问题
  22. // #ifdef APP-PLUS
  23. var domModule = weex.requireModule('dom');
  24. domModule.addRule('fontFace', {
  25. 'fontFamily': "uniicons",
  26. 'src': "url('/static/uni.ttf')"
  27. });
  28. // #endif
  29. export default {
  30. props: {
  31. hasLeftWin: {
  32. type: Boolean
  33. },
  34. leftWinActive: {
  35. type: String
  36. }
  37. },
  38. data() {
  39. return {
  40. }
  41. },
  42. // onBackPress() {
  43. // return true
  44. // },
  45. onShareAppMessage() {
  46. },
  47. onNavigationBarButtonTap(e) {
  48. },
  49. watch: {
  50. },
  51. methods: {
  52. ExitLogin() {
  53. uni.showModal({
  54. //计算删除的数量
  55. title: '提示',
  56. content: '是否确认注销登录?? \r\n点击确定按钮后,需要重新登录系统!!', //文章内容
  57. cancelText: '取消', //取消按钮的文字
  58. confirmText: '确定', //确定文本的文字
  59. cancelColor: '#007aff', //取消按钮文本颜色
  60. confirmColor: '#007aff', //确定按钮文本颜色
  61. success: function(res) {
  62. if (res.confirm) {
  63. let parm = {
  64. url : '/logout',
  65. data: {},
  66. method: 'POST',
  67. isHaveToken : true
  68. }
  69. getApp().RequestData(parm).then(() => {
  70. uni.removeStorage({
  71. key: 'userInfo',
  72. success: function(res) {
  73. uni.showToast({
  74. title: '退出登录成功',
  75. icon: 'success',
  76. duration: 500
  77. })
  78. }
  79. })
  80. uni.reLaunch({
  81. url:"/pages/login/login",
  82. })
  83. })
  84. }
  85. }
  86. })
  87. },
  88. ExitApp() {
  89. let app = getApp()
  90. app.AppExit()
  91. },
  92. GetUserInfo() {
  93. this.popStr = uni.getStorageSync('userInfo').username
  94. let type = 'center'
  95. this.type = type
  96. this.$refs.popup.open(type)
  97. // console.log(this.popStr)
  98. }
  99. }
  100. }
  101. </script>
  102. <style lang="scss">
  103. @import '../../../common/uni-nvue.css';
  104. </style>