mine.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. <template>
  2. <view>
  3. <!-- 个人信息 -->
  4. <view class="person-infos-data" :class="isCard ? '': 'isCard-padd'">
  5. <view class="main">
  6. <view class="photo">
  7. <img v-if="userInfo.headImg" :src="userInfo.headImg" alt="">
  8. <u-avatar v-else size="120" ></u-avatar>
  9. </view>
  10. <view class="infos">
  11. <view class="name">
  12. {{userInfo.name}}
  13. </view>
  14. <view class="department-position">
  15. <view class="department" v-if="userInfo.orgName">
  16. <view class="icon">
  17. <img src="../../assets/img/department.png" alt="">
  18. </view>
  19. <view class="text">
  20. {{userInfo.orgName}}
  21. </view>
  22. </view>
  23. <view class="position">
  24. <text class="icon">
  25. <img src="../../assets/img/position.png" alt="">
  26. </text>
  27. <text class="text">
  28. 员工
  29. </text>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="to-homepage" >
  34. <text class="text" @click="gotoUrl('pages/mine/personalPage')" >个人主页</text><text>
  35. <u-icon size="32" name="arrow-right"></u-icon>
  36. </text>
  37. </view>
  38. </view>
  39. <view class="grid" >
  40. <view class="item" @click="gotoUrl('pages/mine/personalPage')" >
  41. <view class="amout">
  42. {{plusInfo.userShare}}
  43. </view>
  44. <view class="text">
  45. <u>发布</u>
  46. </view>
  47. </view>
  48. <view class="item" @click="gotoUrl('pages/mine/myLike')" >
  49. <view class="amout">
  50. {{plusInfo.userNewsLike}}
  51. </view>
  52. <view class="text">
  53. <u>点赞</u>
  54. </view>
  55. </view>
  56. <view class="item" @click="gotoUrl('pages/mine/myComment')" >
  57. <view class="amout">
  58. {{plusInfo.userNewsComment}}
  59. </view>
  60. <view class="text">
  61. <u>评论</u>
  62. </view>
  63. </view>
  64. <view class="item" >
  65. <!-- // -->
  66. <view class="amout" @click="gotoUrl('pages/mine/points/points')" >
  67. {{plusInfo.userPoints}}
  68. </view>
  69. <view class="text">
  70. <u>积分</u>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. <!-- 饭票卡片信息 -->
  76. <!-- <view class="meal-ticket" v-if="isCard">
  77. <view class="head">
  78. <view class="balance">
  79. 饭卡余额(元)
  80. </view>
  81. <view class="check" @click="gotoUrl('pages/mine/myMealCard')">
  82. <text><img src="../../assets/img/riLine-eye-line@1x.png" alt=""></text>查看消费记录
  83. </view>
  84. </view>
  85. <view class="content">
  86. <view class="number-time">
  87. <view class="number">
  88. {{balance}}
  89. </view>
  90. <view class="time">
  91. <text class="icon"><img src="../../assets/img/riLine-information-line@1x.png" alt=""></text>
  92. <text>下次清零 2023月6月1日 0点</text>
  93. </view>
  94. </view>
  95. <view class="payment-code" @click="gotoUrl('pages/mine/paymentCode')">
  96. <view class="code">
  97. <img src="../../assets/img/iconPark-pay-code-one@1x.png" alt="">
  98. </view>
  99. <view class="text">
  100. 付款码
  101. </view>
  102. </view>
  103. </view>
  104. </view> -->
  105. <!-- 功能 -->
  106. <view class="function-group group1" @click="gotoUrl('pages/mine/myWinningRecord')" >
  107. <view class="item">
  108. <view class="title">
  109. <view class="icon">
  110. <img src="../../assets/img/riLine-gift-2-line@2x.png" alt="">
  111. </view>
  112. <view class="text">
  113. 我的获奖记录
  114. </view>
  115. </view>
  116. <view class="right">
  117. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  118. </view>
  119. </view>
  120. <view class="item" v-if="false" >
  121. <view class="title">
  122. <view class="icon">
  123. <img src="../../assets/img/riLine-coin-line@2x.png" alt="">
  124. </view>
  125. <view class="text">
  126. 积分兑换
  127. </view>
  128. </view>
  129. <view class="right">
  130. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  131. </view>
  132. </view>
  133. </view>
  134. <view class="function-group ">
  135. <view class="item" @click="gotoUrl('pages/mine/data')">
  136. <view class="title">
  137. <view class="icon">
  138. <img src="../../assets/img/riLine-account-box-line@2x.png" alt="">
  139. </view>
  140. <view class="text">
  141. 个人资料
  142. </view>
  143. </view>
  144. <view class="right">
  145. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  146. </view>
  147. </view>
  148. <view class="item" @click="gotoUrl('pages/mine/phone')" >
  149. <view class="title">
  150. <view class="icon">
  151. <img src="../../assets/img/riLine-smartphone-line@2x.png" alt="">
  152. </view>
  153. <view class="text">
  154. 绑定手机
  155. </view>
  156. </view>
  157. <view class="right">
  158. <text class="value">{{userPhone}}</text>
  159. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  160. </view>
  161. </view>
  162. <view class="item" @click="gotoUrl('pages/mine/feedback')" >
  163. <view class="title">
  164. <view class="icon">
  165. <img src="../../assets/img/riLine-file-edit-line@2x.png" alt="">
  166. </view>
  167. <view class="text">
  168. 意见反馈
  169. </view>
  170. </view>
  171. <view class="right">
  172. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  173. </view>
  174. </view>
  175. <view class="item" v-if="false">
  176. <view class="title">
  177. <view class="icon">
  178. <img src="../../assets/img/riLine-customer-service-2-line@2x.png" alt="">
  179. </view>
  180. <view class="text">
  181. 联系我们
  182. </view>
  183. </view>
  184. <view class="right">
  185. <text class="value">0716-8888888</text>
  186. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  187. </view>
  188. </view>
  189. <view class="item" @click="logout" >
  190. <view class="title">
  191. <view class="icon">
  192. <img src="../../assets/img/riLine-logout-box-r-line@2x.png" alt="">
  193. </view>
  194. <view class="text">
  195. 退出账号
  196. </view>
  197. </view>
  198. <view class="right">
  199. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  200. </view>
  201. </view>
  202. </view>
  203. <tabbar current="2"></tabbar>
  204. </view>
  205. </template>
  206. <script>
  207. import * as API from '@/apis/pagejs/user.js'
  208. import * as mineAPI from '@/apis/pagejs/mine.js'
  209. import tabbar from "../../components/Tabbar.vue"
  210. export default {
  211. components: {
  212. tabbar
  213. },
  214. data() {
  215. return {
  216. plusInfo:{},
  217. userInfo:{},
  218. userPhone:"",
  219. balance: 0,
  220. isCard: false
  221. }
  222. },
  223. onLoad() {
  224. this.init()
  225. },
  226. onShow(){
  227. this.findByOpenId()
  228. },
  229. methods: {
  230. getCardPayAmountList() {
  231. // uni.showLoading({
  232. // title: "加载中",
  233. // mask: true,
  234. // })
  235. mineAPI.cardPayAmountList().then((response) => {
  236. //uni.hideLoading();
  237. this.balance = response.data.balance;
  238. this.isCard = true;
  239. }).catch(error => {
  240. uni.hideLoading();
  241. this.isCard = false;
  242. // uni.showToast({
  243. // title: error,
  244. // icon: "none"
  245. // })
  246. })
  247. },
  248. init(){
  249. this.plusInfo=this.carhelp.getPersonInfoPlus();
  250. this.userInfo=this.carhelp.getPersonInfo();
  251. if(this.userInfo&&this.userInfo.phone){
  252. var phone = this.userInfo.phone;
  253. var phone1 = phone.slice(0,3);
  254. var phone2 = phone.slice(-4);
  255. this.userPhone = phone1 + '****' + phone2;
  256. }
  257. },
  258. findByOpenId(){
  259. API.findByOpenId({
  260. noerror:true,
  261. openId: this.carhelp.getOpenId(),
  262. }).then((response) => {
  263. this.carhelp.setToken(response.data.token);
  264. this.carhelp.setPersonInfo(response.data.regUser);
  265. this.carhelp.setPersonInfoPlus(response.data)
  266. this.init();
  267. this.getCardPayAmountList();
  268. }).catch(error => {
  269. uni.hideLoading();
  270. })
  271. },
  272. logoutApi(){
  273. uni.showLoading({
  274. title: "加载中",
  275. mask: true,
  276. })
  277. var data = {
  278. };
  279. API.logout(data).then((res) => {
  280. this.carhelp.logoff();
  281. uni.reLaunch({
  282. url:"/"
  283. })
  284. }).catch(error => {
  285. uni.showToast({
  286. title: error
  287. })
  288. })
  289. },
  290. phone(){
  291. uni.makePhoneCall({
  292. phoneNumber:this.tel //仅为示例
  293. });
  294. },
  295. logout(){
  296. uni.showModal({
  297. title: '提示',
  298. content: '确认是否退出?',
  299. success: res=> {
  300. if (res.confirm) {
  301. //付钱 改为组件
  302. this.logoutApi();
  303. } else if (res.cancel) {
  304. console.log('用户点击取消');
  305. }
  306. }
  307. });
  308. },
  309. }
  310. }
  311. </script>
  312. <style lang="scss" scoped>
  313. page{
  314. font-family: 'PingFang Regular';
  315. }
  316. .isCard-padd {
  317. padding: 40rpx 32rpx 60rpx 32rpx !important;
  318. }
  319. // 个人信息
  320. .person-infos-data {
  321. background: linear-gradient(45.45deg, rgba(6, 50, 130, 1) -0.45%, rgba(0, 88, 209, 1) 23.41%, rgba(0, 53, 153, 1) 52.12%, rgba(0, 66, 178, 1) 77.4%, rgba(0, 20, 130, 1) 100.65%);
  322. color: rgba(255, 255, 255, 1);
  323. padding: 40rpx 32rpx 60rpx 32rpx;
  324. .main {
  325. display: flex;
  326. align-items: center;
  327. .photo {
  328. img {
  329. width: 120rpx;
  330. height: 120rpx;
  331. border-radius: 50px;
  332. }
  333. }
  334. .infos {
  335. margin-left: 24rpx;
  336. .name {
  337. line-height: 28px;
  338. font-size: 20px;
  339. font-family: 'Medium';
  340. }
  341. .department-position {
  342. display: flex;
  343. align-items: center;
  344. margin-top: 16rpx;
  345. .icon {
  346. margin-right: 8rpx;
  347. img {
  348. width: 28rpx;
  349. height: 28rpx;
  350. }
  351. }
  352. .department {
  353. display: flex;
  354. .text{
  355. line-height: 16px;
  356. }
  357. }
  358. .position {
  359. display: flex;
  360. margin-left: 24rpx;
  361. .text{
  362. line-height: 16px;
  363. }
  364. }
  365. }
  366. }
  367. .to-homepage {
  368. margin-left: auto;
  369. .text {
  370. font-size: 16px;
  371. margin-right: 8rpx;
  372. }
  373. }
  374. }
  375. .grid {
  376. width: 100%;
  377. display: flex;
  378. flex-direction: row;
  379. flex-wrap: wrap;
  380. align-items: center;
  381. margin-top: 24rpx;
  382. .item {
  383. width: 25%;
  384. text-align: center;
  385. .amout {
  386. font-size: 48rpx;
  387. line-height: 64rpx;
  388. }
  389. .text {
  390. font-size: 32rpx;
  391. line-height: 44rpx;
  392. }
  393. }
  394. }
  395. }
  396. // 饭票信息
  397. .meal-ticket{
  398. border-radius: 8px 8px 0px 0px;
  399. background: linear-gradient(87.06deg, rgba(240,225,198,1) 5.57%,rgba(236,193,148,1) 96.45%);
  400. margin: -232rpx 32rpx 0;
  401. height: 232rpx;
  402. padding: 32rpx;
  403. .head{
  404. display: flex;
  405. justify-content: space-between;
  406. color: rgba(49, 54, 66, 1);
  407. font-weight: bold;
  408. .check{
  409. text{
  410. vertical-align: middle;
  411. margin-right: 8rpx;
  412. }
  413. }
  414. }
  415. .content{
  416. display: flex;
  417. justify-content: space-between;
  418. align-items:flex-end;
  419. .number-time{
  420. .number{
  421. color: rgba(16, 16, 16, 1);
  422. font-size: 72rpx;
  423. font-weight: bold;
  424. }
  425. .time{
  426. opacity: 0.7;
  427. color: rgba(49, 54, 66, 1);
  428. font-size: 24rpx;
  429. margin-top: 8rpx;
  430. .icon{
  431. vertical-align: middle;
  432. margin-right: 4rpx;
  433. }
  434. }
  435. }
  436. .payment-code{
  437. width: 96rpx;
  438. height: 96rpx;
  439. border-radius: 4px;
  440. background-color: #F0CFAD;
  441. text-align: center;
  442. font-size: 20rpx;
  443. color: rgba(49, 54, 66, 1);
  444. padding: 8rpx 0;
  445. .code{
  446. width: 48rpx;
  447. height: 48rpx;
  448. text-align: center;
  449. margin: auto;
  450. img{
  451. width: 100%;
  452. height: 100%;
  453. vertical-align: middle;
  454. }
  455. }
  456. }
  457. }
  458. }
  459. // 功能
  460. .group1 {
  461. // margin-top: -72rpx !important;
  462. }
  463. .function-group {
  464. border-radius: 8px 8px 0px 0px;
  465. background-color: rgba(255, 255, 255, 1);
  466. padding: 0 0 0 24rpx;
  467. margin: 0 32rpx;
  468. margin-top: 24rpx;
  469. .item {
  470. display: flex;
  471. justify-content: space-between;
  472. align-items: center;
  473. height: 96rpx;
  474. border-bottom: 1px solid #E6E6E6;
  475. .title {
  476. display: flex;
  477. align-items: center;
  478. .icon {
  479. margin-right: 24rpx;
  480. img {
  481. width: 40rpx;
  482. height: 40rpx;
  483. vertical-align: middle;
  484. }
  485. }
  486. .text {
  487. color: rgba(51, 51, 51, 1);
  488. font-weight: bold;
  489. }
  490. }
  491. .right {
  492. margin-right: 16rpx;
  493. margin-left: 8rpx;
  494. display: flex;
  495. }
  496. }
  497. }
  498. </style>