set.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <v-header title="我的设置" border backgroundColor="#fff">
  3. <view class="set-container flex">
  4. <view
  5. v-for="(item,index) in controlData"
  6. :key="index"
  7. class="step-control-item row aCenter"
  8. @click="trigger(item)"
  9. >
  10. <view class="flex-all-1">{{item.label}}</view>
  11. <text class="iconfont iconfont-more step-control-more"></text>
  12. </view>
  13. <view class="flex-all-1"></view>
  14. <view v-if="isLogin" class="step-control-button-container center">
  15. <view @click="outLogin" class="step-control-button center">退出登录</view>
  16. </view>
  17. </view>
  18. </v-header>
  19. </template>
  20. <script>
  21. import vHeader from '@/components/v-header/main.vue';
  22. import mixins from './mixins/index';
  23. import controlData from './data/control';
  24. import modal from '@/utils/tool/modal';
  25. import notice from "@/utils/notice/index";
  26. import toast from "../../utils/tool/toast";
  27. export default {
  28. components:{
  29. vHeader
  30. },
  31. data(){
  32. return {
  33. controlData
  34. }
  35. },
  36. methods:{
  37. outLogin(){
  38. modal.confirm({
  39. title:'是否退出登录?',
  40. confirmText: '退出',
  41. confirmColor:'#FD3232',
  42. confirm:()=>{
  43. this.$store.commit('clearUserInfo');
  44. }
  45. })
  46. }
  47. },
  48. onShow(){
  49. if (this.storageMsg) {
  50. toast.success(this.storageMsg);
  51. this.storageMsg = null;
  52. }
  53. },
  54. created(){
  55. notice.on('set',(item)=>{
  56. if(item.toast) {
  57. this.storageMsg = item.toast;
  58. }
  59. },'setup');
  60. },
  61. beforeDestroy(){
  62. return notice.off('set','setup');
  63. },
  64. mixins
  65. }
  66. </script>
  67. <style lang='scss' scoped src="./style.scss"></style>