index.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <view class="mine-container" :style="'background: url('+this.imgUrl+'/index/mingbg.png) no-repeat 100% 100%;height:'+windowHeight+'px;background-position: 0 0;background-size: 100% 100%;'">
  3. <view style="position: fixed;right: 10px;z-index: 999999;top:10px" @click="changeLocale">
  4. {{ $t('login.language') }}:{{localeConfig[locale]}}<uni-icons type="gear" size="15"></uni-icons>
  5. </view>
  6. <!--顶部个人信息栏-->
  7. <view class="header-section">
  8. <view class="flex padding justify-between">
  9. <view class="flex align-center">
  10. <view v-if="!avatar" class="cu-avatar xl round bg-white">
  11. <view class="iconfont icon-people text-gray icon"></view>
  12. </view>
  13. <image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar xl round" mode="widthFix">
  14. </image>
  15. <view v-if="!name" @click="handleToLogin" class="login-tip">
  16. {{ i18('点击登录')}}
  17. </view>
  18. <view v-if="name" @click="handleToInfo" class="user-info">
  19. <view class="u_title" style="color: #8E8E8E">
  20. {{ i18('你好')}}!
  21. </view>
  22. <view class="u_title">
  23. {{ name }}
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. <view class="menu-list">
  30. <view class="list-cell list-cell-arrow" @click="handleToEditInfo">
  31. <view class="menu-item-box">
  32. <image :src="this.imgUrl+'/index/settingicon.png'" style="width: 18px;height: 18px;margin-right:5px"></image>
  33. <view class="menu-text"> {{ i18('账户设置')}}</view>
  34. </view>
  35. </view>
  36. <view class="list-cell list-cell-arrow" @click="handleAbout">
  37. <view class="menu-item-box">
  38. <image :src="this.imgUrl+'/index/chargeicon.png'" style="width: 18px;height: 18px;margin-right:5px"></image>
  39. <view class="menu-text">{{ i18('充电记录')}}</view>
  40. </view>
  41. </view>
  42. <view class="list-cell list-cell-arrow" @click="handleToSetting">
  43. <view class="menu-item-box">
  44. <image :src="this.imgUrl+'/index/planicon.png'" style="width: 18px;height: 18px;margin-right:5px"></image>
  45. <view class="menu-text">{{ i18('预约记录')}}</view>
  46. </view>
  47. </view>
  48. </view>
  49. <u-picker :show="showLocale" keyName="label" :columns="localeList" @confirm="changeLanguage"></u-picker>
  50. </view>
  51. </template>
  52. <script>
  53. import storage from '@/utils/storage'
  54. import i18 from '@/utils/i18.js'
  55. export default {
  56. data() {
  57. return {
  58. showLocale:false,
  59. locale:"",
  60. localeList:[[{"label":"简体中文","id":"zh-Hans"},{"label":"英文","id":"en"}]],
  61. localeConfig:{"zh-Hans":"简体中文","en":"英文"},
  62. name: this.$store.state.user.name,
  63. version: getApp().globalData.config.appInfo.version,
  64. imgUrl:getApp().globalData.config.imgUrl
  65. }
  66. },
  67. computed: {
  68. avatar() {
  69. return getApp().globalData.config.imgUrl+"/index/user.png"
  70. },
  71. windowHeight() {
  72. return uni.getSystemInfoSync().windowHeight - 50
  73. }
  74. },
  75. onLoad(){
  76. this.setLocale();
  77. },
  78. methods: {
  79. changeLanguage(e){
  80. this.showLocale =false;
  81. console.log(e.value[0].id)
  82. uni.setLocale(e.value[0].id);
  83. },
  84. changeLocale(){
  85. this.showLocale = true;
  86. },
  87. setLocale(){
  88. this.locale = uni.getLocale()
  89. if(this.locale == "en"){
  90. this.localeList = [[{"label":"Chinese","id":"zh-Hans"},{"label":"English","id":"en"}]];
  91. this.localeConfig={"zh-Hans":"Chinese","en":"English"};
  92. }else if(this.locale == "zh-Hans"){
  93. this.localeList = [[{"label":"简体中文","id":"zh-Hans"},{"label":"英文","id":"en"}]];
  94. this.localeConfig={"zh-Hans":"简体中文","en":"英文"};
  95. }
  96. },
  97. i18(text){
  98. return i18(text)
  99. },
  100. handleToEditInfo() {
  101. this.$tab.navigateTo('/pages/mine/pwd/index')
  102. },
  103. handleToSetting() {
  104. this.$tab.navigateTo('/pages/weitiandi/device/planrecord')
  105. },
  106. handleToLogin() {
  107. this.$tab.reLaunch('/pages/login')
  108. },
  109. handleLogout() {
  110. this.$modal.confirm('确定注销并退出系统吗?').then(() => {
  111. this.$store.dispatch('LogOut').then(() => {
  112. this.$tab.reLaunch('/pages/index')
  113. })
  114. })
  115. },
  116. handleAbout() {
  117. this.$tab.navigateTo('/pages/weitiandi/device/chargerecord')
  118. },
  119. }
  120. }
  121. </script>
  122. <style lang="scss">
  123. page {
  124. background-color: #f5f6f7;
  125. }
  126. .mine-container {
  127. width: 100%;
  128. height: 100%;
  129. .header-section {
  130. padding: 15px 15px 45px 15px;
  131. color: white;
  132. .login-tip {
  133. font-size: 18px;
  134. margin-left: 10px;
  135. }
  136. .cu-avatar {
  137. border: 2px solid #eaeaea;
  138. .icon {
  139. font-size: 40px;
  140. }
  141. }
  142. .user-info {
  143. margin-left: 15px;
  144. .u_title {
  145. font-size: 18px;
  146. line-height: 30px;
  147. color: #000000;
  148. }
  149. }
  150. }
  151. .content-section {
  152. position: relative;
  153. top: -50px;
  154. .mine-actions {
  155. margin: 15px 15px;
  156. padding: 20px 0px;
  157. border-radius: 8px;
  158. .action-item {
  159. .icon {
  160. font-size: 28px;
  161. }
  162. .text {
  163. display: block;
  164. font-size: 13px;
  165. margin: 8px 0px;
  166. }
  167. }
  168. }
  169. }
  170. }
  171. .menu-list{
  172. box-shadow: 0px 2px 24px 0px rgba(0,0,0,0.06);
  173. border-radius: 20px;
  174. }
  175. .list-cell{
  176. padding:17px 15px;
  177. }
  178. .menu-text{
  179. color:#555555
  180. }
  181. </style>