index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  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:30px" @click="changeLocale">
  4. {{ $t('login.language') }}:{{localeConfig[locale]}}<uni-icons type="gear" size="15"></uni-icons>
  5. </view> -->
  6. <view class="mine-container">
  7. <view style="height: 0vh;place-items: center;display: grid;">
  8. <image style="height: 3vh;width: 15vh;margin-top: 5vh;top: 3vh;"
  9. src="../../static/images/new/starts/login/backImg2.png"></image>
  10. <text @click="clickRight()" style="color: #ffffff;font-size: 15px;margin: 0 0 0 31vh;font-weight: bold;">· · ·</text>
  11. <view>
  12. <uni-drawer @change="changeDrawer" width="250" style="top:20vh;height: 24vh" ref="showRight" mode="right"
  13. :mask-click="true">
  14. <scroll-view style="background: linear-gradient(#000000, #5a5a58);font-size: 20px;" scroll-y="true">
  15. <view class="prop-item" @click="handleLogout()">
  16. <!-- <view class="prop-item-image">
  17. <image :src="imgUrl+'/logout.png'" style="width: 30%;height:100%;" />
  18. </view> -->
  19. <view class="prop-item-right">{{i18('退出登录')}}</view>
  20. <view class="prop-item-left">
  21. <uni-icons type="forward" color="lightgray" size="16"></uni-icons>
  22. </view>
  23. </view>
  24. <u-divider/>
  25. <view class="prop-item" @click="skip(2)">
  26. <!-- <view class="prop-item-image">
  27. <image :src="imgUrl+'/logout.png'" style="width: 30%;height:100%;" />
  28. </view> -->
  29. <view class="prop-item-right">{{i18('关于我们')}}</view>
  30. <view class="prop-item-left">
  31. <uni-icons type="forward" color="lightgray" size="16"></uni-icons>
  32. </view>
  33. </view>
  34. <u-divider/>
  35. <view class="prop-item" @click="skip(3)">
  36. <!-- <view class="prop-item-image">
  37. <image :src="imgUrl+'/logout.png'" style="width: 30%;height:100%;" />
  38. </view> -->
  39. <view class="prop-item-right">{{i18('帮助')}}</view>
  40. <view class="prop-item-left">
  41. <uni-icons type="forward" color="lightgray" size="16"></uni-icons>
  42. </view>
  43. </view>
  44. <u-divider/>
  45. </scroll-view>
  46. </uni-drawer>
  47. </view>
  48. </view>
  49. <u-divider style="margin-top: 15vh;"></u-divider>
  50. <view style="margin-top: 5vh;justify-content: center;align-items: center;justify-content: center;display: grid;align-content: center;justify-items: center;line-height: 30px;">
  51. <image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar xl round" mode="widthFix">
  52. </image>
  53. <view style="font-size: 20px;font-weight: bold;color: #d0d0d0;">
  54. {{ name }}
  55. </view>
  56. <view >
  57. <image style="width: 40rpx;height: 40rpx;" src="../../static/images/new/starts/mine/start_light.png"></image>
  58. <image style="width: 40rpx;height: 40rpx;" src="../../static/images/new/starts/mine/start_light.png"></image>
  59. <image style="width: 40rpx;height: 40rpx;" src="../../static/images/new/starts/mine/start_light.png"></image>
  60. <image style="width: 40rpx;height: 40rpx;" src="../../static/images/new/starts/mine/start_light.png"></image>
  61. <image style="width: 40rpx;height: 40rpx;" src="../../static/images/new/starts/mine/start.png"></image>
  62. </view>
  63. <view style="color: #d0d0d0;">
  64. {{ name }}
  65. </view>
  66. </view>
  67. <u-divider style="color: aqua;"/>
  68. <view class="menu-list">
  69. <view class="list-cell list-cell-arrow" @click="handleToEditInfo">
  70. <view class="menu-item-box">
  71. <image :src="this.imgUrl+'/mine/symbol.png'" style="width: 18px;height: 18px;margin-right:5px"></image>
  72. <view class="menu-text"> {{ i18('账户设置')}}</view>
  73. </view>
  74. </view>
  75. <view class="list-cell list-cell-arrow" @click="handleAbout">
  76. <view class="menu-item-box">
  77. <image :src="this.imgUrl+'/mine/record.png'" style="width: 18px;height: 18px;margin-right:5px"></image>
  78. <view class="menu-text">{{ i18('充电记录')}}</view>
  79. </view>
  80. </view>
  81. <view class="list-cell list-cell-arrow" @click="handleToSetting">
  82. <view class="menu-item-box">
  83. <image :src="this.imgUrl+'/mine/symbol (1).png'" style="width: 18px;height: 18px;margin-right:5px"></image>
  84. <view class="menu-text">{{ i18('预约记录')}}</view>
  85. </view>
  86. </view>
  87. </view>
  88. <!--顶部个人信息栏-->
  89. <!-- <view class="header-section">
  90. <view class="flex padding justify-between">
  91. <view class="flex align-center">
  92. <view v-if="!avatar" class="cu-avatar xl round bg-white">
  93. <view class="iconfont icon-people text-gray icon"></view>
  94. </view>
  95. <image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar xl round" mode="widthFix">
  96. </image>
  97. <view v-if="!name" @click="handleToLogin" class="login-tip">
  98. {{ i18('点击登录')}}
  99. </view>
  100. <view v-if="name" @click="handleToInfo" class="user-info">
  101. <view class="u_title" style="color: #8E8E8E">
  102. {{ i18('你好')}}!
  103. </view>
  104. <view class="u_title">
  105. {{ name }}
  106. </view>
  107. </view>
  108. </view>
  109. </view>
  110. </view>
  111. <view class="menu-list">
  112. <view class="list-cell list-cell-arrow" @click="handleToEditInfo">
  113. <view class="menu-item-box">
  114. <image :src="this.imgUrl+'/index/settingicon.png'" style="width: 18px;height: 18px;margin-right:5px"></image>
  115. <view class="menu-text"> {{ i18('账户设置')}}</view>
  116. </view>
  117. </view>
  118. <view class="list-cell list-cell-arrow" @click="handleAbout">
  119. <view class="menu-item-box">
  120. <image :src="this.imgUrl+'/index/chargeicon.png'" style="width: 18px;height: 18px;margin-right:5px"></image>
  121. <view class="menu-text">{{ i18('充电记录')}}</view>
  122. </view>
  123. </view>
  124. <view class="list-cell list-cell-arrow" @click="handleToSetting">
  125. <view class="menu-item-box">
  126. <image :src="this.imgUrl+'/index/planicon.png'" style="width: 18px;height: 18px;margin-right:5px"></image>
  127. <view class="menu-text">{{ i18('预约记录')}}</view>
  128. </view>
  129. </view>
  130. </view> -->
  131. <u-picker @cancel="cancelLocale" :confirmText="i18('确认')" :cancelText="i18('取消')" :show="showLocale"
  132. keyName="label" :columns="localeList" @confirm="changeLanguage"></u-picker>
  133. </view>
  134. </template>
  135. <script>
  136. import storage from '@/utils/storage'
  137. import i18 from '@/utils/i18.js'
  138. export default {
  139. data() {
  140. return {
  141. showLocale: false,
  142. locale: "",
  143. localeList: [
  144. [{
  145. "label": "简体中文",
  146. "id": "zh-Hans"
  147. }, {
  148. "label": "英文",
  149. "id": "en"
  150. }]
  151. ],
  152. localeConfig: {
  153. "zh-Hans": "简体中文",
  154. "en": "英文"
  155. },
  156. name: this.$store.state.user.name,
  157. version: getApp().globalData.config.appInfo.version,
  158. imgUrl: getApp().globalData.config.imgUrl,
  159. clickRightTag: 0
  160. }
  161. },
  162. computed: {
  163. avatar() {
  164. console.log(JSON.stringify(this.$store.state.user))
  165. if(this.$store.state.user.avatar==null||this.$store.state.user.avatar==''){
  166. return getApp().globalData.config.imgUrl + "/index/user.png"
  167. }else{
  168. return this.$store.state.user.avatar
  169. }
  170. },
  171. windowHeight() {
  172. return uni.getSystemInfoSync().windowHeight - 50
  173. }
  174. },
  175. onLoad() {
  176. this.setLocale();
  177. },
  178. onShow() {
  179. uni.setNavigationBarTitle({
  180. title: this.$t('page.mine')
  181. })
  182. },
  183. methods: {
  184. handleLogout() {
  185. this.$modal.confirm('确定注销并退出系统吗?').then(() => {
  186. this.$store.dispatch('LogOut').then(() => {
  187. this.$tab.reLaunch('/pages/index')
  188. })
  189. })
  190. },
  191. changeDrawer(event) {
  192. if (event) {
  193. // 抽屉打开时的逻辑
  194. this.clickRightTag = 1
  195. } else {
  196. // 抽屉关闭时的逻辑
  197. this.clickRightTag = 0
  198. }
  199. },
  200. //自定义头右操作函数
  201. clickRight() {
  202. //打开抽屉
  203. if (this.clickRightTag == 0) {
  204. this.$refs.showRight.open();
  205. this.clickRightTag = 1
  206. } else {
  207. this.$refs.showRight.close()
  208. this.clickRightTag = 0
  209. }
  210. },
  211. cancelLocale() {
  212. this.showLocale = false;
  213. },
  214. changeLanguage(e) {
  215. this.showLocale = false;
  216. console.log(e.value[0].id)
  217. uni.setLocale(e.value[0].id);
  218. },
  219. changeLocale() {
  220. this.showLocale = true;
  221. },
  222. setLocale() {
  223. this.locale = uni.getLocale()
  224. if (this.locale == "en") {
  225. this.localeList = [
  226. [{
  227. "label": "Chinese",
  228. "id": "zh-Hans"
  229. }, {
  230. "label": "English",
  231. "id": "en"
  232. }]
  233. ];
  234. this.localeConfig = {
  235. "zh-Hans": "Chinese",
  236. "en": "English"
  237. };
  238. } else if (this.locale == "zh-Hans") {
  239. this.localeList = [
  240. [{
  241. "label": "简体中文",
  242. "id": "zh-Hans"
  243. }, {
  244. "label": "英文",
  245. "id": "en"
  246. }]
  247. ];
  248. this.localeConfig = {
  249. "zh-Hans": "简体中文",
  250. "en": "英文"
  251. };
  252. }
  253. },
  254. i18(text) {
  255. return i18(text)
  256. },
  257. handleToEditInfo() {
  258. this.$tab.navigateTo('/pages/mine/pwd/index')
  259. },
  260. handleToSetting() {
  261. this.$tab.navigateTo('/pages/weitiandi/device/planrecord')
  262. },
  263. handleToLogin() {
  264. this.$tab.reLaunch('/pages/login')
  265. },
  266. handleLogout() {
  267. this.$modal.confirm('确定注销并退出系统吗?').then(() => {
  268. this.$store.dispatch('LogOut').then(() => {
  269. this.$tab.reLaunch('/pages/index')
  270. })
  271. })
  272. },
  273. handleAbout() {
  274. this.$tab.navigateTo('/pages/weitiandi/device/chargerecord')
  275. },
  276. }
  277. }
  278. </script>
  279. <style lang="scss">
  280. page {
  281. // background-color: #000000;
  282. background-image: url('../../static/images/new/starts/bg1.jpg');
  283. background-size: cover;
  284. background-repeat: no-repeat;
  285. }
  286. .mine-container {
  287. // width: 100%;
  288. // height: 102vh;
  289. .header-section {
  290. padding: 15px 15px 45px 15px;
  291. color: white;
  292. .login-tip {
  293. font-size: 18px;
  294. margin-left: 10px;
  295. }
  296. .cu-avatar {
  297. border: 2px solid #eaeaea;
  298. .icon {
  299. font-size: 40px;
  300. }
  301. }
  302. .user-info {
  303. margin-left: 15px;
  304. .u_title {
  305. font-size: 18px;
  306. line-height: 30px;
  307. color: #000000;
  308. }
  309. }
  310. }
  311. .content-section {
  312. position: relative;
  313. top: -50px;
  314. .mine-actions {
  315. margin: 15px 15px;
  316. padding: 20px 0px;
  317. border-radius: 8px;
  318. .action-item {
  319. .icon {
  320. font-size: 28px;
  321. }
  322. .text {
  323. display: block;
  324. font-size: 13px;
  325. margin: 8px 0px;
  326. }
  327. }
  328. }
  329. }
  330. }
  331. .menu-list {
  332. box-shadow: 0px 2px 24px 0px rgba(54, 54, 54, 0.1);
  333. border-radius: 20px;
  334. }
  335. .list-cell {
  336. padding: 17px 15px;
  337. background-color: #555555;
  338. }
  339. .menu-text {
  340. color: #ffffff
  341. }
  342. .header {
  343. position: relative;
  344. padding-top: 4vh;
  345. }
  346. .prop-item {
  347. position: relative;
  348. display: flex;
  349. flex-direction: row;
  350. height: 40px;
  351. line-height: 40px;
  352. margin: 0 20rpx;
  353. }
  354. .prop-item-left {
  355. color: #BCBCBF;
  356. ;
  357. width: 30%;
  358. font-size: 14px;
  359. //margin-left: 36px;
  360. }
  361. .prop-item-image {
  362. width: 15px;
  363. height: 15px;
  364. position: absolute;
  365. left: 2vw;
  366. top: 0.5vh;
  367. }
  368. .prop-item-right {
  369. position: absolute;
  370. right: 10rpx;
  371. top: 5rpx;
  372. color: #BCBCBF;
  373. }
  374. </style>