info.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. <template>
  2. <view class="center">
  3. <view
  4. :style="'position: relative;border:0;background:url('+img.infoBg+');background-size:100% 100%;background-color: #fff;padding:80rpx 56rpx;margin:32rpx;border-style: none;'">
  5. <view class="top-setting" @click="doSomething(setting)">
  6. <view class="main">
  7. <image src="../../static/czzn-img/info/info-setting.png" class="setting-icon" />
  8. </view>
  9. </view>
  10. <view class="userInfo" @click.capture="toUserInfo">
  11. <!-- <u-avatar :src="userInfo.avatar" size="120rpx"></u-avatar> -->
  12. <view class="logo-title">
  13. <view class="user-name" v-if="hasLogin">
  14. <span>{{userInfo.displayName||userInfo.username}}</span>
  15. <!-- <span>退出登录</span> -->
  16. </view>
  17. <text class="user-name" v-else>{{$t('mine.notLogged')}}</text>
  18. </view>
  19. </view>
  20. </view>
  21. <!-- <template v-if="isDealerUser || isDriverUser">
  22. <view class="menu-wrap">
  23. <u-cell :isLink="true" arrow-direction="right" @click="doSomething(allOrder)" :border="false"
  24. :customStyle="{'background':'#fff','font-weight':'bold','padding':'10rpx 10rpx','borderBottom':'2rpx solid #f5f7fa'}"
  25. :title="$t('mine.order')"></u-cell>
  26. <uni-grid class="grid" :column="5" :showBorder="false" :square="true">
  27. <uni-grid-item class="item" v-for="(item,index) in gridList" @click.native="toOrdering(item)"
  28. :key="index">
  29. <image :src="item.icon" class="grid-icon" />
  30. <text class="grid-text">{{item.title}}</text>
  31. </uni-grid-item>
  32. </uni-grid>
  33. </view>
  34. <view class="menu-wrap">
  35. <u-cell :border="false"
  36. :customStyle="{'background':'#f5f7fa','font-weight':'bold','padding':'10rpx 10rpx'}"
  37. :title="$t('mine.service')"></u-cell>
  38. <template v-if="isDealerUser">
  39. <u-cell-group class="cell-wrap" :border="false">
  40. <u-cell :isLink="true" arrow-direction="right" :border="false" class="cell-item"
  41. v-for="(item,index) in dealerMenuList" @click.native="doSomething(item)" :key="index"
  42. :title="item.title">
  43. <u-icon slot="icon" :name="item.icon" color="#2979ff" size="24" class="cell-icon"></u-icon>
  44. </u-cell>
  45. </u-cell-group>
  46. </template>
  47. <template v-if="isDriverUser">
  48. <u-cell-group class="cell-wrap" :border="false">
  49. <u-cell :isLink="true" arrow-direction="right" :border="false" class="cell-item"
  50. v-for="(item,index) in driverMenuList" @click.native="doSomething(item)" :key="index"
  51. :title="item.title">
  52. <u-icon slot="icon" :name="item.icon" color="#2979ff" size="24" class="cell-icon"></u-icon>
  53. </u-cell>
  54. </u-cell-group>
  55. </template>
  56. </view>
  57. </template> -->
  58. <Bars></Bars>
  59. </view>
  60. </template>
  61. <script>
  62. import {
  63. mapGetters,
  64. mapMutations
  65. } from "vuex";
  66. import {
  67. getTenantCacheList
  68. } from '../../utils/util.js'
  69. import Bars from '../../components/tabBar/tabBar.vue';
  70. import imgUtil from '../../utils/imgUtil'
  71. export default {
  72. components: {
  73. Bars
  74. },
  75. // #ifdef APP
  76. onBackPress({
  77. from
  78. }) {
  79. if (from == "backbutton") {
  80. this.$nextTick(function() {
  81. uniShare.hide();
  82. });
  83. return uniShare.isShow;
  84. }
  85. },
  86. // #endif
  87. data() {
  88. return {
  89. img:imgUtil,
  90. setting: {
  91. title: this.$t("mine.settings"),
  92. to: "/pages/ucenter/settings",
  93. icon: "gear",
  94. show: true,
  95. },
  96. allOrder: {
  97. title: this.$t("mine.all"),
  98. icon: "file-text",
  99. to: '/subpages/order/dealerList?index=0'
  100. },
  101. role: [],
  102. userType: "0",
  103. tenantCount: 0,
  104. version: "",
  105. versionCode: "",
  106. mpVersion: "",
  107. isAuditUser: false,
  108. isDealerUser: false,
  109. isDriverUser: false,
  110. isAcceptUser: false,
  111. isDeliverUser: false,
  112. isTransUser: false,
  113. };
  114. },
  115. onLoad() {
  116. this.isAuditUser = uni.getStorageSync('isAuditUser')
  117. this.isDealerUser = uni.getStorageSync('isDealerUser')
  118. this.isDriverUser = uni.getStorageSync('isDriverUser')
  119. this.isAcceptUser = uni.getStorageSync('isAcceptUser')
  120. this.isDeliverUser = uni.getStorageSync('isDeliverUser')
  121. this.isTransUser = uni.getStorageSync('isTransUser')
  122. // const routers = getCurrentPages();
  123. // console.log(routers);
  124. if(this.isDealerUser){
  125. this.allOrder.to = '/subpages/order/dealerList?index=0'
  126. }else if(this.isDriverUser){
  127. this.allOrder.to = '/subpages/order/driverList'
  128. }
  129. console.log("开始加载");
  130. uni.hideTabBar()
  131. this.userType = uni.getStorageSync('userType')
  132. this.bindUserInfo()
  133. var that = this;
  134. uni.getSystemInfo({
  135. success: function(res) {
  136. console.log("系统信息、", res)
  137. console.log("系统版本号、", res.appVersionCode, res.appVersion)
  138. that.version = res.appVersion;
  139. that.versionCode = res.appVersionCode;
  140. console.log("系统版本号、", that.version, that.versionCode)
  141. }
  142. });
  143. // #ifdef MP-WEIXIN
  144. const accountInfo = wx.getAccountInfoSync();
  145. this.mpVersion = accountInfo.miniProgram.version // 小程序 版本号
  146. // #endif
  147. },
  148. computed: {
  149. ...mapGetters({
  150. userInfo: "user/info",
  151. hasLogin: "user/hasLogin",
  152. }),
  153. // #ifdef APP-PLUS
  154. appVersion() {
  155. return getApp().appVersion;
  156. },
  157. // #endif
  158. appConfig() {
  159. return getApp().globalData.config;
  160. },
  161. },
  162. methods: {
  163. bindUserInfo() {
  164. var tenantList = getTenantCacheList();
  165. console.log("当前租户信息、", tenantList);
  166. },
  167. //宫格点击事件
  168. doSomething(item) {
  169. if (item.to) {
  170. uni.navigateTo({
  171. url: item.to,
  172. });
  173. }
  174. if (item.event) {
  175. this[item.event]
  176. }
  177. },
  178. toOrdering(item) {
  179. if (this.isDealerUser == true) {
  180. uni.navigateTo({
  181. url: item.dealerTo,
  182. });
  183. } else {
  184. uni.navigateTo({
  185. url: item.driverTo,
  186. });
  187. }
  188. },
  189. ...mapMutations({
  190. setUserInfo: "user/login",
  191. }),
  192. toUserInfo() {
  193. if(this.hasLogin){
  194. uni.navigateTo({
  195. url: "/pages/info/userInfo?changePwd=0",
  196. });
  197. // uni.showModal({
  198. // title: this.$t('settings.tips'),
  199. // content: this.$t('settings.exitLogin'),
  200. // cancelText: this.$t('settings.cancelText'),
  201. // confirmText: this.$t('settings.confirmText'),
  202. // success: res => {
  203. // if (res.confirm) {
  204. // uni.removeStorageSync('token')
  205. // uni.removeStorageSync('tenantId')
  206. // uni.removeStorageSync('userId')
  207. // uni.removeStorageSync('userName')
  208. // uni.removeStorageSync('userInfo')
  209. // uni.removeStorageSync('userType')
  210. // uni.removeStorageSync('tenantInfo')
  211. // uni.removeStorageSync('currentTenantId')
  212. // uni.removeStorageSync('currentVehicleInfo')
  213. // uni.removeStorageSync('isAuditUser')
  214. // uni.removeStorageSync('isDealerUser')
  215. // uni.removeStorageSync('isDriverUser')
  216. // uni.removeStorageSync('enterpriseInfo')
  217. // uni.removeStorageSync('serverAddress');
  218. // uni.removeStorageSync('serverPrefix');
  219. // uni.reLaunch({
  220. // url: '/pages/login/login'
  221. // });
  222. // getApp().globalData.tabIndex = 'home';
  223. // }
  224. // },
  225. // fail: () => {},
  226. // complete: () => {}
  227. // });
  228. }else{
  229. uni.reLaunch({
  230. url: "/pages/login/login"
  231. })
  232. }
  233. },
  234. toPage(url) {
  235. uni.navigateTo({
  236. url: url,
  237. });
  238. },
  239. tapGrid(item) {
  240. // uni.showToast({
  241. // // title: '你点击了,第' + (index + 1) + '个',
  242. // title: this.$t('mine.clicked') + " " + (index + 1) ,
  243. // icon: 'none'
  244. // });
  245. },
  246. },
  247. };
  248. </script>
  249. <style lang="scss" scoped>
  250. /* #ifndef APP-NVUE */
  251. view {
  252. display: flex;
  253. box-sizing: border-box;
  254. flex-direction: column;
  255. }
  256. page {
  257. background-color: #f5f7fa;
  258. }
  259. /* #endif */
  260. .center {
  261. flex: 1;
  262. flex-direction: column;
  263. min-height: 100vh;
  264. background-color: #f5f7fa;
  265. .sevice {
  266. display: flex;
  267. flex-direction: row;
  268. justify-content: space-between;
  269. border-radius: 20rpx;
  270. margin-bottom: 24rpx;
  271. padding: 24rpx 0;
  272. overflow: hidden;
  273. background-color: #fff;
  274. .sevice-item {
  275. display: flex;
  276. width: 25%;
  277. text-align: center;
  278. .count {
  279. line-height: 48rpx;
  280. font-size: 32rpx;
  281. font-weight: bold;
  282. color: #333;
  283. }
  284. .title {
  285. line-height: 48rpx;
  286. font-size: 24rpx;
  287. color: #333;
  288. }
  289. }
  290. }
  291. .menu-wrap {
  292. // padding: 32rpx 0;
  293. // border-radius: 20rpx;
  294. overflow: hidden;
  295. background-color: #fff;
  296. .title {
  297. padding: 44rpx 44rpx 12rpx;
  298. display: flex;
  299. font-size: 32rpx;
  300. flex-direction: row;
  301. justify-content: space-between;
  302. .all {
  303. font-size: 28rpx;
  304. color: #999;
  305. display: flex;
  306. flex-direction: row;
  307. align-items: center;
  308. }
  309. }
  310. .version {
  311. padding: 8rpx 8rpx 8rpx;
  312. display: flex;
  313. font-size: 32rpx;
  314. flex-direction: row;
  315. justify-content: space-between;
  316. }
  317. .cell-icon {
  318. width: 65rpx;
  319. height: 65rpx;
  320. }
  321. .cell-wrap {
  322. padding-bottom: 40rpx;
  323. .cell-item {
  324. border-bottom: 1rpx solid #f5f7fa;
  325. }
  326. }
  327. .grid-icon {
  328. width: 60rpx;
  329. height: 60rpx;
  330. }
  331. .grid-text {
  332. margin-top: 8rpx;
  333. font-size: 24rpx;
  334. color: #333333;
  335. line-height: 48rpx;
  336. text-align: center;
  337. }
  338. }
  339. .top-set-user {
  340. background-size: 750rpx auto;
  341. background-color: #fff;
  342. padding: 40rpx 40rpx 56rpx;
  343. }
  344. .top-setting {
  345. position: absolute;
  346. top: 0rpx;
  347. right: 0rpx;
  348. z-index: 2001;
  349. .main {
  350. display: flex;
  351. flex-direction: row;
  352. align-items: center;
  353. justify-content: center;
  354. width: 100rpx;
  355. height: 100rpx;
  356. .setting-version {
  357. text-align: left;
  358. width: 50%;
  359. font-size: 24rpx;
  360. color: #999;
  361. }
  362. .setting-icon {
  363. width: 38rpx;
  364. height: 35rpx;
  365. }
  366. }
  367. }
  368. .message-wrap {
  369. margin: 40rpx 32rpx;
  370. background-color: #fff;
  371. padding: 40rpx;
  372. border-radius: 10rpx;
  373. .message-title {
  374. display: flex;
  375. flex-direction: row;
  376. justify-content: space-between;
  377. line-height: 32rpx;
  378. .label {
  379. color: #222;
  380. font-size: 28rpx;
  381. font-weight: bold;
  382. }
  383. .message {
  384. display: flex;
  385. flex-direction: row;
  386. color: #999;
  387. font-size: 24rpx;
  388. }
  389. }
  390. .message-item {
  391. margin-top: 32rpx;
  392. background-color: #f9f9f9;
  393. border-radius: 10rpx;
  394. padding: 28rpx 32rpx;
  395. .title {
  396. justify-content: space-between;
  397. display: flex;
  398. flex-direction: row;
  399. // width: 176rpx;
  400. color: #999;
  401. font-size: 24rpx;
  402. align-items: center;
  403. justify-content: space-between;
  404. margin-bottom: 32rpx;
  405. }
  406. .info {
  407. flex-direction: row;
  408. .cell-icon {
  409. width: 50rpx;
  410. height: 50rpx;
  411. background-color: #E1EBFF;
  412. border-radius: 10rpx;
  413. display: flex;
  414. justify-content: space-around;
  415. align-items: center;
  416. margin-right: 32rpx;
  417. }
  418. .info-text {
  419. flex: 1;
  420. overflow: hidden;
  421. text-overflow: ellipsis;
  422. white-space: nowrap;
  423. font-size: 22rpx;
  424. color: #666;
  425. }
  426. }
  427. }
  428. }
  429. }
  430. .versionInfo {
  431. position: absolute;
  432. bottom: 0px;
  433. right: 10rpx;
  434. size: 10pt;
  435. color: #fff;
  436. font-size: 13px;
  437. height: 28px;
  438. line-height: 28px;
  439. }
  440. .userInfo {
  441. // position: relative;
  442. flex-direction: row;
  443. align-items: center;
  444. // margin-bottom: 24rpx;
  445. }
  446. .logo-img {
  447. width: 150rpx;
  448. height: 150rpx;
  449. border-radius: 150rpx;
  450. }
  451. .logo-title {
  452. flex: 1;
  453. margin-left: 32rpx;
  454. // align-items: center;
  455. justify-content: space-between;
  456. flex-direction: column;
  457. }
  458. .user-name {
  459. height: 48rpx;
  460. line-height: 48rpx;
  461. font-size: 30rpx;
  462. display: flex;
  463. flex-direction: row;
  464. align-items: center;
  465. font-weight: bold;
  466. color: #fff;
  467. .role-tag {
  468. font-size: 20rpx;
  469. padding: 0 18rpx;
  470. border-radius: 8rpx;
  471. margin-left: 24rpx;
  472. background-color: #6695F9;
  473. box-shadow: 0px 0px 24px 0px rgba(46, 56, 181, 0.44);
  474. color: #fff;
  475. font-weight: normal;
  476. }
  477. }
  478. .user-phone {
  479. color: #fff;
  480. font-size: 26rpx;
  481. height: 56rpx;
  482. line-height: 56rpx;
  483. }
  484. .grid {
  485. background-color: #fff;
  486. // padding: 32rpx;
  487. }
  488. .uni-grid .text {
  489. font-size: 16px;
  490. height: 25px;
  491. line-height: 25px;
  492. color: #817f82;
  493. }
  494. .uni-grid .item ::v-deep .uni-grid-item__box {
  495. justify-content: center;
  496. align-items: center;
  497. }
  498. /deep/ .u-grid-item {
  499. padding: 20rpx 0;
  500. }
  501. </style>