mine.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  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="createSysUser" >
  167. <view class="title">
  168. <view class="icon">
  169. <img src="../../assets/img/riLine-smartphone-line@2x.png" alt="">
  170. </view>
  171. <view class="text">
  172. 创建/重置 OA账户
  173. </view>
  174. </view>
  175. <view class="right">
  176. <text class="value"></text>
  177. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  178. </view>
  179. </view>
  180. <view class="item" @click="gotoUrl('pages/mine/feedback')" >
  181. <view class="title">
  182. <view class="icon">
  183. <img src="../../assets/img/riLine-file-edit-line@2x.png" alt="">
  184. </view>
  185. <view class="text">
  186. 意见反馈
  187. </view>
  188. </view>
  189. <view class="right">
  190. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  191. </view>
  192. </view>
  193. <view class="item" v-if="false">
  194. <view class="title">
  195. <view class="icon">
  196. <img src="../../assets/img/riLine-customer-service-2-line@2x.png" alt="">
  197. </view>
  198. <view class="text">
  199. 联系我们
  200. </view>
  201. </view>
  202. <view class="right">
  203. <text class="value">0716-8888888</text>
  204. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  205. </view>
  206. </view>
  207. <view class="item" @click="logout" >
  208. <view class="title">
  209. <view class="icon">
  210. <img src="../../assets/img/riLine-logout-box-r-line@2x.png" alt="">
  211. </view>
  212. <view class="text">
  213. 退出账号
  214. </view>
  215. </view>
  216. <view class="right">
  217. <u-icon name="arrow-right" size="32" color="#cccccc"></u-icon>
  218. </view>
  219. </view>
  220. </view>
  221. <u-modal v-model="createSysUserBl"
  222. confirm-text="修改" @confirm="createSysUserConfirm"
  223. :show-cancel-button="true">
  224. <view class="createSysUserView">
  225. <view>
  226. 输入密码,可创建/重置OA电脑网页端的密码,用于登录,处理OA相关审批
  227. </view>
  228. <view @click="copyUrl" style="color:darkblue">
  229. OA 网站地址,点击复制
  230. </view>
  231. <view>
  232. <u-input v-model="password" placeholder="请输入登录密码" :border="true" ></u-input>
  233. </view>
  234. </view>
  235. </u-modal>
  236. <tabbar current="2"></tabbar>
  237. </view>
  238. </template>
  239. <script>
  240. import * as API from '@/apis/pagejs/user.js'
  241. import * as mineAPI from '@/apis/pagejs/mine.js'
  242. import tabbar from "../../components/Tabbar.vue"
  243. export default {
  244. components: {
  245. tabbar
  246. },
  247. data() {
  248. return {
  249. plusInfo:{},
  250. userInfo:{},
  251. userPhone:"",
  252. balance: 0,
  253. isCard: false,
  254. lastyear:'',
  255. createSysUserBl:false,
  256. password:"",
  257. }
  258. },
  259. onLoad() {
  260. this.lastyear=new Date().getFullYear()-1
  261. this.init()
  262. },
  263. onShow(){
  264. this.findByOpenId()
  265. },
  266. methods: {
  267. createSysUserConfirm(){
  268. if(this.password&&(this.password.length<6||this.password.length>15)){
  269. uni.showToast({
  270. title: "请输入至少6位,小于15位密码",
  271. icon: "none"
  272. })
  273. this.createSysUserBl=true
  274. return
  275. }
  276. if(this.password){
  277. uni.showLoading({
  278. title: "加载中",
  279. mask: true,
  280. })
  281. API.createSysUser({
  282. password:this.password
  283. }).then((response) => {
  284. this.password=""
  285. uni.showToast({
  286. title: "修改成功",
  287. icon: "none"
  288. })
  289. //this.getCardPayAmountList();
  290. }).catch(error => {
  291. uni.hideLoading();
  292. uni.showToast({
  293. title: "修改失败",
  294. icon: "none"
  295. })
  296. })
  297. }else{
  298. uni.showToast({
  299. title: "请输入密码",
  300. icon: "none"
  301. })
  302. this.createSysUserBl=true
  303. }
  304. },
  305. copyUrl(){
  306. var textToCopy = 'http://www.jsrailway.com.cn/railroad-portal/';
  307. uni.setClipboardData({
  308. data: textToCopy,
  309. success: function () {
  310. uni.showToast({
  311. title: "复制成功!可发送到电脑端登录",
  312. icon: "none"
  313. })
  314. }
  315. });
  316. },
  317. createSysUser(){
  318. this.createSysUserBl=true;
  319. },
  320. getCardPayAmountList() {
  321. // uni.showLoading({
  322. // title: "加载中",
  323. // mask: true,
  324. // })
  325. mineAPI.cardPayAmountList().then((response) => {
  326. //uni.hideLoading();
  327. this.balance = response.data.balance;
  328. this.isCard = true;
  329. }).catch(error => {
  330. uni.hideLoading();
  331. this.isCard = false;
  332. // uni.showToast({
  333. // title: error,
  334. // icon: "none"
  335. // })
  336. })
  337. },
  338. init(){
  339. this.plusInfo=this.carhelp.getPersonInfoPlus();
  340. this.userInfo=this.carhelp.getPersonInfo();
  341. if(this.userInfo&&this.userInfo.phone){
  342. var phone = this.userInfo.phone;
  343. var phone1 = phone.slice(0,3);
  344. var phone2 = phone.slice(-4);
  345. this.userPhone = phone1 + '****' + phone2;
  346. }
  347. },
  348. findByOpenId(){
  349. API.findByOpenId({
  350. noerror:true,
  351. openId: this.carhelp.getOpenId(),
  352. }).then((response) => {
  353. this.carhelp.setToken(response.data.token);
  354. this.carhelp.setPersonInfo(response.data.regUser);
  355. this.carhelp.setPersonInfoPlus(response.data)
  356. this.init();
  357. //this.getCardPayAmountList();
  358. }).catch(error => {
  359. uni.hideLoading();
  360. })
  361. },
  362. logoutApi(){
  363. uni.showLoading({
  364. title: "加载中",
  365. mask: true,
  366. })
  367. var data = {
  368. };
  369. API.logout(data).then((res) => {
  370. this.carhelp.logoff();
  371. uni.reLaunch({
  372. url:"/"
  373. })
  374. }).catch(error => {
  375. uni.showToast({
  376. title: error
  377. })
  378. })
  379. },
  380. phone(){
  381. uni.makePhoneCall({
  382. phoneNumber:this.tel //仅为示例
  383. });
  384. },
  385. logout(){
  386. uni.showModal({
  387. title: '提示',
  388. content: '确认是否退出?',
  389. success: res=> {
  390. if (res.confirm) {
  391. //付钱 改为组件
  392. this.logoutApi();
  393. } else if (res.cancel) {
  394. console.log('用户点击取消');
  395. }
  396. }
  397. });
  398. },
  399. }
  400. }
  401. </script>
  402. <style lang="scss" scoped>
  403. .createSysUserView{
  404. padding: 10px;
  405. }
  406. .isCard-padd {
  407. padding: 40rpx 32rpx 60rpx 32rpx !important;
  408. }
  409. .person-infos-data {
  410. 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%);
  411. color: rgba(255, 255, 255, 1);
  412. padding: 40rpx 32rpx 60rpx 32rpx;
  413. .main {
  414. display: flex;
  415. align-items: center;
  416. .photo {
  417. img {
  418. width: 120rpx;
  419. height: 120rpx;
  420. border-radius: 50px;
  421. }
  422. }
  423. .infos {
  424. margin-left: 24rpx;
  425. .name {
  426. line-height: 28px;
  427. font-size: 20px;
  428. font-family: 'Medium';
  429. }
  430. .department-position {
  431. display: flex;
  432. align-items: center;
  433. margin-top: 16rpx;
  434. .icon {
  435. margin-right: 8rpx;
  436. img {
  437. width: 28rpx;
  438. height: 28rpx;
  439. }
  440. }
  441. .department {
  442. display: flex;
  443. .text{
  444. line-height: 16px;
  445. }
  446. }
  447. .position {
  448. display: flex;
  449. margin-left: 24rpx;
  450. .text{
  451. line-height: 16px;
  452. }
  453. }
  454. }
  455. }
  456. .to-homepage {
  457. margin-left: auto;
  458. .text {
  459. font-size: 16px;
  460. margin-right: 8rpx;
  461. }
  462. }
  463. }
  464. .grid {
  465. width: 100%;
  466. display: flex;
  467. flex-direction: row;
  468. flex-wrap: wrap;
  469. align-items: center;
  470. margin-top: 24rpx;
  471. .item {
  472. width: 25%;
  473. text-align: center;
  474. .amout {
  475. font-size: 48rpx;
  476. line-height: 64rpx;
  477. }
  478. .text {
  479. font-size: 32rpx;
  480. line-height: 44rpx;
  481. }
  482. }
  483. }
  484. }
  485. .meal-ticket{
  486. border-radius: 8px 8px 0px 0px;
  487. background: linear-gradient(87.06deg, rgba(240,225,198,1) 5.57%,rgba(236,193,148,1) 96.45%);
  488. margin: -232rpx 32rpx 0;
  489. height: 232rpx;
  490. padding: 32rpx;
  491. .head{
  492. display: flex;
  493. justify-content: space-between;
  494. color: rgba(49, 54, 66, 1);
  495. font-weight: bold;
  496. .check{
  497. text{
  498. vertical-align: middle;
  499. margin-right: 8rpx;
  500. }
  501. }
  502. }
  503. .content{
  504. display: flex;
  505. justify-content: space-between;
  506. align-items:flex-end;
  507. .number-time{
  508. .number{
  509. color: rgba(16, 16, 16, 1);
  510. font-size: 72rpx;
  511. font-weight: bold;
  512. }
  513. .time{
  514. opacity: 0.7;
  515. color: rgba(49, 54, 66, 1);
  516. font-size: 24rpx;
  517. margin-top: 8rpx;
  518. .icon{
  519. vertical-align: middle;
  520. margin-right: 4rpx;
  521. }
  522. }
  523. }
  524. .payment-code{
  525. width: 96rpx;
  526. height: 96rpx;
  527. border-radius: 4px;
  528. background-color: #F0CFAD;
  529. text-align: center;
  530. font-size: 20rpx;
  531. color: rgba(49, 54, 66, 1);
  532. padding: 8rpx 0;
  533. .code{
  534. width: 48rpx;
  535. height: 48rpx;
  536. text-align: center;
  537. margin: auto;
  538. img{
  539. width: 100%;
  540. height: 100%;
  541. vertical-align: middle;
  542. }
  543. }
  544. }
  545. }
  546. }
  547. // 功能
  548. .group1 {
  549. // margin-top: -72rpx !important;
  550. }
  551. .function-group {
  552. border-radius: 8px 8px 0px 0px;
  553. background-color: rgba(255, 255, 255, 1);
  554. padding: 0 0 0 24rpx;
  555. margin: 0 32rpx;
  556. margin-top: 24rpx;
  557. .item {
  558. display: flex;
  559. justify-content: space-between;
  560. align-items: center;
  561. height: 96rpx;
  562. border-bottom: 1px solid #E6E6E6;
  563. .title {
  564. display: flex;
  565. align-items: center;
  566. .icon {
  567. margin-right: 24rpx;
  568. img {
  569. width: 40rpx;
  570. height: 40rpx;
  571. vertical-align: middle;
  572. }
  573. }
  574. .text {
  575. color: rgba(51, 51, 51, 1);
  576. font-weight: bold;
  577. }
  578. }
  579. .right {
  580. margin-right: 16rpx;
  581. margin-left: 8rpx;
  582. display: flex;
  583. }
  584. }
  585. }
  586. </style>