mine.vue 15 KB

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