other.nvue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. onShareAppMessage() {
  43. },
  44. onNavigationBarButtonTap(e) {
  45. },
  46. watch: {
  47. },
  48. methods: {
  49. ExitLogin() {
  50. uni.showModal({
  51. //计算删除的数量
  52. title: '提示',
  53. content: '是否确认注销登录?? \r\n点击确定按钮后,需要重新登录系统!!', //文章内容
  54. cancelText: '取消', //取消按钮的文字
  55. confirmText: '确定', //确定文本的文字
  56. cancelColor: '#007aff', //取消按钮文本颜色
  57. confirmColor: '#007aff', //确定按钮文本颜色
  58. success: function(res) {
  59. if (res.confirm) {
  60. let parm = {
  61. url : '/logout',
  62. data: {},
  63. method: 'POST',
  64. isHaveToken : true
  65. }
  66. getApp().RequestData(parm).then(() => {
  67. uni.removeStorage({
  68. key: 'userInfo',
  69. success: function(res) {
  70. uni.showToast({
  71. title: '退出登录成功',
  72. icon: 'success',
  73. duration: 500
  74. })
  75. }
  76. })
  77. uni.reLaunch({
  78. url:"/pages/login/login",
  79. })
  80. })
  81. }
  82. }
  83. })
  84. },
  85. ExitApp() {
  86. let app = getApp()
  87. app.AppExit()
  88. },
  89. GetUserInfo() {
  90. this.popStr = uni.getStorageSync('userInfo').username
  91. let type = 'center'
  92. this.type = type
  93. this.$refs.popup.open(type)
  94. // console.log(this.popStr)
  95. }
  96. }
  97. }
  98. </script>
  99. <style lang="scss">
  100. @import '../../../common/uni-nvue.css';
  101. </style>