index.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <view class="container">
  3. <navBar :back="true" title="设置" flex="cen" :navImg="navImg" color="#333333" background="#FFFFFF" />
  4. <view class="" style="height: 200px;">
  5. </view>
  6. <view class="" style="padding: 0 100rpx;">
  7. <button type="warn" @click="logout">退出登录</button>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. import {
  13. getCode,
  14. } from '@/api/test/index.js'
  15. import {
  16. mapMutations,
  17. mapActions,
  18. mapState,
  19. mapGetters
  20. } from 'vuex';
  21. export default {
  22. data() {
  23. return {
  24. }
  25. },
  26. onLoad() {
  27. },
  28. computed: {
  29. ...mapGetters('user', ['testInfo', 'testInfo2'])
  30. },
  31. methods: {
  32. logout() {
  33. uni.clearStorageSync()
  34. this.$toast('退出登录成功')
  35. setTimeout(() => {
  36. uni.reLaunch({
  37. url: '/pages/my/index'
  38. })
  39. }, 1500)
  40. },
  41. ...mapActions('user', ['testAct', 'testAct2']),
  42. async testReq() {
  43. let res = await getCode({
  44. mobile: '18884559619'
  45. })
  46. console.log('测试接口返回值:', res);
  47. },
  48. async testSt() {
  49. // console.log('修改仓库前的返回值:', this.$store.getters['user/testInfo']);
  50. // this.$store.dispatch('user/testAct', 'testtesttesttesttesttesttest')
  51. // console.log('修改仓库后的返回值:', this.$store.getters['user/testInfo']);
  52. let res = await this.testAct2({
  53. mobile: '15609038888'
  54. })
  55. if (res.code == 0) {
  56. this.$toast('获取验证码成功')
  57. console.log('testInfo2', this.testInfo2);
  58. } else {
  59. this.$toast(res.msg)
  60. }
  61. }
  62. }
  63. }
  64. </script>
  65. <style>
  66. </style>