mine.vue 12 KB

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