index.vue 12 KB

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