index.vue 12 KB

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