setting.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <view class="padding-lr">
  3. <view v-for="(section,i) in mineItems" :key="i">
  4. <u-gap height="15"/>
  5. <view class="cu-card padding radius shadow bg-white">
  6. <view class="cu-bar justify-between align-center" v-for="(item,index) in section" :key="index" @click="itemDidClick(item)">
  7. <view class="cu-bar">
  8. <image :src="item.image" style="width: 30px;height: 30px;"></image>
  9. <text class="text-bold padding-sm"> {{ $t(item.title) }} </text>
  10. </view>
  11. <text v-if="item.detail"> {{ item.detail }} </text>
  12. <text v-else class="lg text-gray cuIcon-right"></text>
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import { mapState, mapMutations } from 'vuex'
  20. export default {
  21. data() {
  22. return {
  23. mineItems: [
  24. [
  25. {'index': 0, 'image': '/static/mine/modify_psw.png','title': 'changePassword', 'url': ''},
  26. {'index': 1, 'image': '/static/mine/about.png','title': 'aboutUs', 'url': ''},
  27. {'index': 2, 'image': '/static/mine/fk_edit.png','title': 'mineFeedback', 'url': ''}
  28. ],
  29. [
  30. {'index': 3, 'image': '/static/mine/student_old.png','title': 'checkUpdate', 'url': ''},
  31. ],
  32. [
  33. {'index': 4, 'image': '/static/mine/language.png','title': 'switchLanguage', 'url': ''},
  34. ],
  35. [
  36. {'index': 5, 'image': '/static/mine/logout.png','title': 'logOut', 'url': '../login/index'},
  37. ],
  38. ]
  39. };
  40. },
  41. name: 'tabbar-mine',
  42. computed: {
  43. ...mapState(['userInfo'])
  44. },
  45. props: {
  46. },
  47. mounted() {
  48. },
  49. methods: {
  50. /// 列表跳转
  51. itemDidClick(item) {
  52. switch (item.index) {
  53. case 5:
  54. this.$store.commit('clearUserInfo')
  55. uni.navigateTo({
  56. url:'../login/index',
  57. animationType:'fade-in'
  58. })
  59. break
  60. case 4:
  61. let locale = this.$i18n.locale
  62. locale === 'zh' ? this.$i18n.locale = 'en' : this.$i18n.locale = 'zh'
  63. this.$store.commit('setLocale', this.$i18n.locale)
  64. uni.setNavigationBarTitle({ title:this.$i18n.t('setting') })
  65. break
  66. default: break
  67. }
  68. }
  69. }
  70. }
  71. </script>
  72. <style lang="scss">
  73. .mine {
  74. width: 100%;
  75. position: absolute;
  76. display: flex;
  77. flex-direction: column;
  78. height: 100%;
  79. .mine-top {
  80. width: 100%;
  81. .mine-bg {
  82. width: 100%;
  83. height: 55vw;
  84. }
  85. }
  86. .mine-content {
  87. position: absolute;
  88. top: 20vw;
  89. width: 90%;
  90. left: 5%;
  91. .mine-card{
  92. display: flex;
  93. flex-direction: column;
  94. justify-content: center;
  95. align-items: center;
  96. .user-card-top {
  97. position: absolute;
  98. top: 0;
  99. left: 0;
  100. align-self: flex-start;
  101. width: 40px;
  102. height: 20px;
  103. }
  104. }
  105. }
  106. }
  107. </style>