index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  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. this.$tab.reLaunch('/pages/index')
  217. })
  218. })
  219. },
  220. changeDrawer(event) {
  221. if (event) {
  222. // 抽屉打开时的逻辑
  223. this.clickRightTag = 1
  224. } else {
  225. // 抽屉关闭时的逻辑
  226. this.clickRightTag = 0
  227. }
  228. },
  229. //自定义头右操作函数
  230. clickRight() {
  231. //打开抽屉
  232. if (this.clickRightTag == 0) {
  233. this.$refs.showRight.open();
  234. this.clickRightTag = 1
  235. } else {
  236. this.$refs.showRight.close()
  237. this.clickRightTag = 0
  238. }
  239. },
  240. cancelLocale() {
  241. this.showLocale = false;
  242. },
  243. changeLanguage(e) {
  244. this.showLocale = false;
  245. console.log(e.value[0].id)
  246. uni.setLocale(e.value[0].id);
  247. },
  248. changeLocale() {
  249. this.showLocale = true;
  250. },
  251. setLocale() {
  252. this.locale = uni.getLocale()
  253. if (this.locale == "en") {
  254. this.localeList = [
  255. [{
  256. "label": "Chinese",
  257. "id": "zh-Hans"
  258. }, {
  259. "label": "English",
  260. "id": "en"
  261. }]
  262. ];
  263. this.localeConfig = {
  264. "zh-Hans": "Chinese",
  265. "en": "English"
  266. };
  267. } else if (this.locale == "zh-Hans") {
  268. this.localeList = [
  269. [{
  270. "label": "简体中文",
  271. "id": "zh-Hans"
  272. }, {
  273. "label": "英文",
  274. "id": "en"
  275. }]
  276. ];
  277. this.localeConfig = {
  278. "zh-Hans": "简体中文",
  279. "en": "英文"
  280. };
  281. }
  282. },
  283. i18(text) {
  284. return i18(text)
  285. },
  286. handleToEditInfo() {
  287. this.$tab.navigateTo('/pages/mine/pwd/index')
  288. },
  289. handleToSetting() {
  290. this.$tab.navigateTo('/pages/weitiandi/device/planrecord')
  291. },
  292. handleToLogin() {
  293. this.$tab.reLaunch('/pages/login')
  294. },
  295. handleAbout() {
  296. this.$tab.navigateTo('/pages/weitiandi/device/chargerecord')
  297. },
  298. }
  299. }
  300. </script>
  301. <style lang="scss">
  302. page {
  303. // background-color: #000000;
  304. background-image: url('../../static/images/new/starts/bg1.jpg');
  305. background-size: cover;
  306. background-repeat: no-repeat;
  307. }
  308. .mine-container {
  309. // width: 100%;
  310. // height: 102vh;
  311. .header-section {
  312. padding: 15px 15px 45px 15px;
  313. color: white;
  314. .login-tip {
  315. font-size: 18px;
  316. margin-left: 10px;
  317. }
  318. .cu-avatar {
  319. border: 2px solid #eaeaea;
  320. .icon {
  321. font-size: 40px;
  322. }
  323. }
  324. .user-info {
  325. margin-left: 15px;
  326. .u_title {
  327. font-size: 18px;
  328. line-height: 30px;
  329. color: #000000;
  330. }
  331. }
  332. }
  333. .content-section {
  334. position: relative;
  335. top: -50px;
  336. .mine-actions {
  337. margin: 15px 15px;
  338. padding: 20px 0px;
  339. border-radius: 8px;
  340. .action-item {
  341. .icon {
  342. font-size: 28px;
  343. }
  344. .text {
  345. display: block;
  346. font-size: 13px;
  347. margin: 8px 0px;
  348. }
  349. }
  350. }
  351. }
  352. }
  353. .menu-list {
  354. box-shadow: 0px 2px 24px 0px rgba(54, 54, 54, 0.1);
  355. border-radius: 20px;
  356. }
  357. .list-cell {
  358. padding: 17px 15px;
  359. background-color: #555555;
  360. }
  361. .menu-text {
  362. color: #ffffff
  363. }
  364. .header {
  365. position: relative;
  366. padding-top: 4vh;
  367. }
  368. .prop-item {
  369. position: relative;
  370. display: flex;
  371. flex-direction: row;
  372. height: 40px;
  373. line-height: 40px;
  374. margin: 0 20rpx;
  375. }
  376. .prop-item-left {
  377. color: #BCBCBF;
  378. ;
  379. width: 30%;
  380. font-size: 14px;
  381. //margin-left: 36px;
  382. }
  383. .prop-item-image {
  384. width: 15px;
  385. height: 15px;
  386. position: absolute;
  387. left: 2vw;
  388. top: 0.5vh;
  389. }
  390. .prop-item-right {
  391. position: absolute;
  392. right: 10rpx;
  393. top: 5rpx;
  394. color: #BCBCBF;
  395. }
  396. </style>