my.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850
  1. <template>
  2. <view>
  3. <!-- 背景图 -->
  4. <view class="top">
  5. <image src="./icon/bg.png" mode="aspectFill"></image>
  6. </view>
  7. <view class="content">
  8. <view class="user" v-if="info.name">
  9. <!-- <view class="left">
  10. <view class="img">
  11. <image v-if="user.avatar" :src="user.avatar" mode="aspectFill"></image>
  12. <view class="avatar" v-if="!user.avatar" :style="{backgroundColor:bgColor[1]}">
  13. {{user.name.split('').pop()}}
  14. </view>
  15. </view>
  16. <view class="info">
  17. <view class="name">{{user.name}}</view>
  18. <view class="section">{{user.section}}</view>
  19. </view>
  20. </view> -->
  21. <view class="left">
  22. <view class="img">
  23. <image v-if="info.avatar" :src="info.avatar" mode="aspectFill"></image>
  24. <view class="avatar" v-if="!info.avatar" :style="{backgroundColor:bgColor[1]}">
  25. {{info.name.split('').pop()}}
  26. </view>
  27. </view>
  28. <view class="info">
  29. <view class="name">{{info.name}}</view>
  30. <view class="section">{{info.section_fullname}}</view>
  31. </view>
  32. </view>
  33. <view class="right">
  34. <view class="btn" @click="go_information()">
  35. <view class="icon">
  36. <uni-icons type="person-filled" color="#fff"></uni-icons>
  37. </view>
  38. <view class="text">个人中心</view>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="section_1">
  43. <view class="title">本月使用信息</view>
  44. <view class="box">
  45. <view class="item">
  46. <view class="num">{{use.h}} <text> h </text> {{use.m}} <text> min</text></view>
  47. <view class="tip">使用时长</view>
  48. </view>
  49. <view class="item">
  50. <view class="num">{{use.times || '1'}}</view>
  51. <view class="tip">使用次数</view>
  52. </view>
  53. <view class="item">
  54. <view class="num">{{use.submit_count}}</view>
  55. <view class="tip">提交单据数</view>
  56. </view>
  57. </view>
  58. </view>
  59. <view class="section_2">
  60. <view class="inner_1">
  61. <view class="title">
  62. <view class="icon">
  63. <image src="./icon/time.png" mode=""></image>
  64. </view>
  65. <view class="text">最近使用</view>
  66. </view>
  67. <view class="box">
  68. <view class="item" v-if="recently_used.length > 0" v-for="(item,index) in recently_used"
  69. :key="index" @click="go_OA(item)">
  70. <view class="name">{{item.title}}</view>
  71. <view class="icon">
  72. <uni-icons type="right" color="#fff" size="16"></uni-icons>
  73. </view>
  74. </view>
  75. <view v-if="recently_used.length == 0"
  76. style="line-height: 80rpx;color: #FFFFFF;padding: 0 20rpx;font-size: 28rpx;">暂无使用记录。</view>
  77. </view>
  78. </view>
  79. <view class="inner_2" @click="go_integral()">
  80. <view class="num">{{total}}</view>
  81. <view class="text">积分</view>
  82. </view>
  83. </view>
  84. <view class="section_3" v-if="mine_code != 'ningdongyunying' && mine_code != 'wuyegongsi'"
  85. @click="go_downhole_statistics()">
  86. <view class="title">
  87. <view class="icon">
  88. <uni-icons type="map-pin-ellipse" color="#fff"></uni-icons>
  89. </view>
  90. <view class="text">当前位置:{{downhole.position}}</view>
  91. </view>
  92. <view class="box">
  93. <view class="item">
  94. <view class="num">{{downhole.h}} <text> h</text> {{downhole.m}} <text> min</text></view>
  95. <view class="tip">本月下井时长</view>
  96. </view>
  97. <view class="item">
  98. <view class="num">{{downhole.times}}</view>
  99. <view class="tip">本月下井次数</view>
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. <view class="content">
  105. <view class="section_4">
  106. <view class="list">
  107. <view class="item" @click="clear_cache()">
  108. <view class="icon">
  109. <image src="./icon/icon_1.png" mode="aspectFill"></image>
  110. </view>
  111. <view class="text">
  112. 清除缓存
  113. </view>
  114. </view>
  115. <view class="item" @click="tell()">
  116. <view class="icon">
  117. <image src="./icon/icon_2.png" mode="aspectFill"></image>
  118. </view>
  119. <view class="text">服务电话</view>
  120. </view>
  121. <view class="item" @click="go_feedback()">
  122. <view class="icon">
  123. <image src="./icon/icon_3.png" mode="aspectFill"></image>
  124. </view>
  125. <view class="text">建议反馈</view>
  126. </view>
  127. <view class="item" @click="go_update_log()">
  128. <view class="icon">
  129. <image src="./icon/icon_4.png" mode="aspectFill"></image>
  130. </view>
  131. <view class="text">更新日志</view>
  132. </view>
  133. <view class="item" @click="go_m_repassword()">
  134. <view class="icon">
  135. <image src="./icon/icon_5.png" mode="aspectFill"></image>
  136. </view>
  137. <view class="text">修改密码</view>
  138. </view>
  139. <view class="item" @click="login_out()">
  140. <view class="icon">
  141. <image src="./icon/icon_6.png" mode="aspectFill"></image>
  142. </view>
  143. <view class="text">退出登陆</view>
  144. </view>
  145. <view class="item" @click="go_m_download()">
  146. <view class="icon">
  147. <image src="./icon/icon_7.png" mode="aspectFill"></image>
  148. </view>
  149. <view class="text">下载二维码</view>
  150. </view>
  151. </view>
  152. </view>
  153. </view>
  154. </view>
  155. </template>
  156. <script>
  157. import {
  158. set_mine
  159. } from '@/common/set_base_url.js'
  160. export default {
  161. data() {
  162. return {
  163. // 当前煤矿编码
  164. mine_code: "",
  165. // 用户基本信息
  166. user: {},
  167. info: {},
  168. bgColor: [],
  169. // 总积分
  170. total: 0,
  171. // 下井定位卡号
  172. people_num: "",
  173. // 矿编码
  174. mine: "",
  175. // 下井数据
  176. downhole: {
  177. position: "-",
  178. h: "0",
  179. m: "0",
  180. times: "0"
  181. },
  182. // 使用时长次数
  183. use: {
  184. times: "0",
  185. h: "0",
  186. m: "0",
  187. submit_count: "0"
  188. },
  189. // 最近使用
  190. recently_used: []
  191. };
  192. },
  193. onLoad() {
  194. // console.log(set_mine(uni.getStorageSync('mine_code')))
  195. this.mine = set_mine(uni.getStorageSync('mine_code'))
  196. // 初始化当前煤矿编码
  197. this.mine_code = uni.getStorageSync('mine_code')
  198. // 判断会否登录、没有则跳转至登录页
  199. const Authorization = uni.getStorageSync('Authorization')
  200. if (Authorization == '') {
  201. uni.showToast({
  202. icon: "none",
  203. title: "用户未登录"
  204. })
  205. setTimeout(function() {
  206. uni.redirectTo({
  207. url: "../../my/login/login"
  208. })
  209. }, 1500)
  210. }
  211. // 设置头像
  212. for (let i = 0; i < 2; i++) {
  213. // 获取随机色
  214. let r = parseInt(Math.random() * 256)
  215. let g = parseInt(Math.random() * 256)
  216. let b = parseInt(Math.random() * 256)
  217. // ES6 字符串拼接
  218. // this.bgColor = `rgba(${r},${g},${b},0.3)`
  219. let color = "rgba(" + r + "," + g + "," + b + "," + 0.3 + ")"
  220. // console.log(color)
  221. this.bgColor.push(color)
  222. }
  223. // 获取用户基本信息
  224. this.user = uni.getStorageSync('user');
  225. this.$api.user_getUinfo({
  226. staff_num: uni.getStorageSync('user').staff_num
  227. }).then((res) => {
  228. this.info = res.data.data
  229. })
  230. // 查询使用时长
  231. this.get_user_selectRecordDuration()
  232. //查询员工积分
  233. this.get_staff_integral_query(),
  234. // 获取个人信息
  235. this.$api.user_getUinfo({
  236. staff_num: uni.getStorageSync('user').staff_num
  237. }).then((res) => {
  238. // console.log(res)
  239. this.people_num = res.data.data.people_code
  240. // 获取当前位置
  241. this.get_downhole()
  242. })
  243. // 获取常用列表
  244. this.get_workflow_recently_used()
  245. },
  246. methods: {
  247. // 个人信息
  248. go_information() {
  249. uni.navigateTo({
  250. url: "../../my/personal_information/personal_information"
  251. })
  252. },
  253. // 查询使用时长
  254. get_user_selectRecordDuration() {
  255. this.$api.user_selectRecordDuration({
  256. }).then((res) => {
  257. // console.log(res.data.data)
  258. this.use.h = res.data.data.hours
  259. this.use.m = res.data.data.minutes
  260. this.use.times = res.data.data.frequency
  261. })
  262. },
  263. // 退出登录
  264. login_out() {
  265. uni.clearStorageSync('Authorization');
  266. uni.showToast({
  267. icon: "none",
  268. title: "退出登录"
  269. })
  270. // 跳转登录页
  271. setTimeout(() => {
  272. uni.redirectTo({
  273. url: "../../my/login/login"
  274. })
  275. }, 1000)
  276. },
  277. // 拨打服务电话
  278. tell() {
  279. uni.makePhoneCall({
  280. phoneNumber: '18152480670'
  281. });
  282. },
  283. // 修改密码
  284. go_m_repassword() {
  285. uni.navigateTo({
  286. url: "../../my/repassword/repassword"
  287. })
  288. },
  289. // 清除缓存
  290. clear_cache() {
  291. // uni.showLoading({
  292. // mask:true
  293. // })
  294. // setTimeout(()=>{
  295. // uni.hideLoading()
  296. // uni.showToast({
  297. // icon:"none",
  298. // title:"清除完成"
  299. // })
  300. // },1500)
  301. let that = this;
  302. plus.cache.calculate(function(size) {
  303. let sizeCache = parseInt(size);
  304. if (sizeCache == 0) {
  305. that.fileSizeString = "0B";
  306. } else if (sizeCache < 1024) {
  307. that.fileSizeString = sizeCache + "B";
  308. } else if (sizeCache < 1048576) {
  309. that.fileSizeString = (sizeCache / 1024).toFixed(2) + "K";
  310. } else if (sizeCache < 1073741824) {
  311. that.fileSizeString = (sizeCache / 1048576).toFixed(2) + "M";
  312. } else {
  313. that.fileSizeString = (sizeCache / 1073741824).toFixed(2) + "G";
  314. }
  315. console.log(sizeCache)
  316. });
  317. let os = plus.os.name;
  318. if (os == 'Android') {
  319. let main = plus.android.runtimeMainActivity();
  320. let sdRoot = main.getCacheDir();
  321. let files = plus.android.invoke(sdRoot, "listFiles");
  322. let len = files.length;
  323. for (let i = 0; i < len; i++) {
  324. let filePath = '' + files[i]; // 没有找到合适的方法获取路径,这样写可以转成文件路径
  325. plus.io.resolveLocalFileSystemURL(filePath, function(entry) {
  326. if (entry.isDirectory) {
  327. entry.removeRecursively(function(entry) { //递归删除其下的所有文件及子目录
  328. uni.showToast({
  329. title: '缓存清理完成',
  330. duration: 2000
  331. });
  332. that.getStorageSize(); // 重新计算缓存
  333. }, function(e) {
  334. console.log(e.message)
  335. });
  336. } else {
  337. entry.remove();
  338. }
  339. }, function(e) {
  340. console.log('文件路径读取失败')
  341. });
  342. }
  343. } else { // ios
  344. }
  345. },
  346. // 建议反馈
  347. go_feedback() {
  348. uni.navigateTo({
  349. url: "../../origanization/OA/h5/h5",
  350. success: (res) => {
  351. // 通过eventChannel向被打开页面传送数据
  352. res.eventChannel.emit('acceptDataFromOpenerPage', {
  353. url: 'http://oa_system.nxjiewei.com:8011/?m=ying&d=we&mnum=ndyybbug&show=we&hideheader=true',
  354. title: "建议反馈"
  355. })
  356. }
  357. })
  358. },
  359. // 更新日志
  360. go_update_log() {
  361. uni.navigateTo({
  362. url: "../../my/version_record/version_record"
  363. })
  364. },
  365. //查询员工积分
  366. get_staff_integral_query() {
  367. this.$api.staff_integral_query({
  368. staff_num: uni.getStorageSync('user').staff_num
  369. }).then((res) => {
  370. // console.log(res)
  371. this.total = res.data.content.data.integral_sum
  372. })
  373. },
  374. // 积分详情
  375. go_integral() {
  376. uni.navigateTo({
  377. url: "../../index/integral/integral?total=" + this.total
  378. })
  379. },
  380. // 获取当前位置
  381. get_downhole() {
  382. this.$p_api.peopleTotalNum({
  383. people_code: this.people_num,
  384. mine: ""
  385. }).then((res) => {
  386. // console.log(res)
  387. if (res.data.data.position == null) {
  388. if (this.people_num == "") {
  389. this.downhole.position = "请点击绑定定位卡"
  390. } else {
  391. this.downhole.position = "未在井下"
  392. }
  393. } else {
  394. this.downhole.position = res.data.data.data.position
  395. }
  396. this.downhole.h = res.data.data.hours
  397. this.downhole.m = res.data.data.minutes
  398. this.downhole.times = res.data.data.total
  399. })
  400. },
  401. go_downhole_statistics() {
  402. uni.navigateTo({
  403. url: "../../production/personnel_orientation/downhole_statistics/downhole_statistics?people_num=" +
  404. this.people_num + "&depart_name=" + this.user.section + "&name=" + this.user.name +
  405. "&mine=" + this.mine
  406. })
  407. },
  408. // 获取常用列表
  409. get_workflow_recently_used() {
  410. this.$api.workflow_recently_used({
  411. staff_num: this.user.staff_num
  412. }).then((res) => {
  413. // console.log(res.data.content.data)
  414. this.recently_used = res.data.content.data.list
  415. this.use.submit_count = res.data.content.data.submit_count
  416. })
  417. },
  418. go_OA(item) {
  419. uni.navigateTo({
  420. url: "../../origanization/OA/h5/h5",
  421. success: (res) => {
  422. // 通过eventChannel向被打开页面传送数据
  423. res.eventChannel.emit('acceptDataFromOpenerPage', {
  424. url: item.url,
  425. title: item.title
  426. })
  427. }
  428. })
  429. },
  430. // 下载二维码
  431. go_m_download() {
  432. uni.navigateTo({
  433. url: "../../my/download/download"
  434. })
  435. }
  436. }
  437. }
  438. </script>
  439. <style lang="scss">
  440. .top {
  441. z-index: -1;
  442. position: fixed;
  443. top: 1;
  444. left: 0;
  445. image {
  446. width: 750rpx;
  447. height: 746rpx;
  448. }
  449. }
  450. .content {
  451. width: 750rpx;
  452. .user {
  453. margin-bottom: 40rpx;
  454. box-sizing: border-box;
  455. padding-left: 25rpx;
  456. padding-top: 25rpx;
  457. display: flex;
  458. justify-content: space-between;
  459. align-items: center;
  460. .left {
  461. display: flex;
  462. align-items: center;
  463. .img {
  464. width: 130rpx;
  465. height: 130rpx;
  466. border-radius: 50%;
  467. background: #DCDCDC;
  468. border: 2rpx solid #FFFFFF;
  469. overflow: hidden;
  470. text-align: center;
  471. line-height: 130rpx;
  472. font-size: 56rpx;
  473. font-weight: 700;
  474. color: #FFFFFF;
  475. image {
  476. width: 100%;
  477. height: 100%;
  478. display: block;
  479. }
  480. .avatar {
  481. width: 100%;
  482. height: 100%;
  483. }
  484. }
  485. .info {
  486. margin-left: 20rpx;
  487. color: #fff;
  488. .name {
  489. font-size: 38rpx;
  490. font-weight: 700;
  491. }
  492. .section {
  493. margin-top: 20rpx;
  494. font-size: 24rpx;
  495. }
  496. }
  497. }
  498. .right {
  499. background-color: rgba(255, 255, 255, .3);
  500. border-radius: 25rpx 0rpx 0rpx 25rpx;
  501. padding: 5rpx 20rpx 5rpx 20rpx;
  502. .btn {
  503. display: flex;
  504. align-items: center;
  505. color: #FFFFFF;
  506. .icon {}
  507. .text {
  508. font-size: 24rpx;
  509. }
  510. }
  511. }
  512. }
  513. .section_1 {
  514. width: 749rpx;
  515. height: 220rpx;
  516. background-image: url(./icon/section_1.png);
  517. background-size: cover;
  518. background-repeat: no-repeat;
  519. box-sizing: border-box;
  520. padding: 10rpx 20rpx;
  521. .title {
  522. padding-left: 20rpx;
  523. height: 60rpx;
  524. line-height: 60rpx;
  525. font-size: 28rpx;
  526. color: #fff;
  527. border-bottom: 1rpx solid rgba(255, 255, 255, .5);
  528. }
  529. .box {
  530. display: flex;
  531. .item {
  532. width: 236rpx;
  533. text-align: center;
  534. height: 130rpx;
  535. border-right: 1rpx solid rgba(255, 255, 255, .5);
  536. color: #FFFFFF;
  537. display: flex;
  538. flex-direction: column;
  539. justify-content: center;
  540. .num {
  541. font-size: 44rpx;
  542. font-weight: 700;
  543. text {
  544. font-size: 24rpx;
  545. }
  546. }
  547. .tip {
  548. font-size: 24rpx;
  549. }
  550. }
  551. .item:last-child {
  552. border-right: none;
  553. }
  554. }
  555. }
  556. .section_2 {
  557. box-sizing: border-box;
  558. padding: 20rpx;
  559. display: flex;
  560. justify-content: space-between;
  561. .inner_1 {
  562. width: 510rpx;
  563. height: 220rpx;
  564. background-image: url(./icon/section_2_inner_1.png);
  565. background-size: 100% 100%;
  566. background-repeat: no-repeat;
  567. .title {
  568. display: flex;
  569. align-items: center;
  570. height: 70rpx;
  571. font-size: 28rpx;
  572. color: #fff;
  573. padding-left: 20rpx;
  574. border-bottom: 1rpx solid rgba(255, 255, 255, .5);
  575. .icon {
  576. image {
  577. width: 28rpx;
  578. height: 28rpx;
  579. display: block;
  580. }
  581. }
  582. .text {
  583. margin-left: 10rpx;
  584. font-size: 28rpx;
  585. }
  586. }
  587. .box {
  588. width: 510rpx;
  589. display: flex;
  590. flex-wrap: wrap;
  591. .item {
  592. width: 255rpx;
  593. height: 70rpx;
  594. display: flex;
  595. justify-content: space-between;
  596. align-items: center;
  597. color: #FFFFFF;
  598. box-sizing: border-box;
  599. padding: 0 10rpx;
  600. border-bottom: 1rpx solid rgba(255, 255, 255, .5);
  601. border-right: 1rpx solid rgba(255, 255, 255, .5);
  602. .name {
  603. width: 200rpx;
  604. //超过一行省略号
  605. overflow: hidden;
  606. white-space: nowrap;
  607. text-overflow: ellipsis;
  608. font-size: 28rpx;
  609. }
  610. .icon {}
  611. }
  612. .item:nth-child(2n) {
  613. border-right: none;
  614. }
  615. .item:nth-child(3) {
  616. border-bottom: none;
  617. }
  618. .item:nth-child(4) {
  619. border-bottom: none;
  620. }
  621. }
  622. }
  623. .inner_2 {
  624. margin-top: -4rpx;
  625. margin-right: -10rpx;
  626. width: 200rpx;
  627. height: 250rpx;
  628. background-image: url(./icon/section_2_inner_2.png);
  629. background-size: 100% 100%;
  630. background-repeat: no-repeat;
  631. color: #FFFFFF;
  632. text-align: center;
  633. .num {
  634. height: 140rpx;
  635. line-height: 140rpx;
  636. font-size: 44rpx;
  637. font-weight: 700;
  638. }
  639. .text {
  640. height: 50rpx;
  641. line-height: 50rpx;
  642. font-size: 34rpx;
  643. }
  644. }
  645. }
  646. .section_3 {
  647. margin: -15rpx auto 0;
  648. width: 710rpx;
  649. height: 220rpx;
  650. background-image: url(./icon/section_3.png);
  651. background-size: 100% 100%;
  652. background-repeat: no-repeat;
  653. .title {
  654. display: flex;
  655. align-items: center;
  656. height: 60rpx;
  657. font-size: 24rpx;
  658. color: #fff;
  659. padding-left: 20rpx;
  660. .icon {
  661. image {
  662. width: 28rpx;
  663. height: 28rpx;
  664. display: block;
  665. }
  666. }
  667. .text {
  668. margin-left: 10rpx;
  669. font-size: 28rpx;
  670. }
  671. }
  672. .box {
  673. display: flex;
  674. .item {
  675. width: 355rpx;
  676. text-align: center;
  677. height: 140rpx;
  678. color: #FFFFFF;
  679. display: flex;
  680. flex-direction: column;
  681. justify-content: center;
  682. .num {
  683. font-size: 44rpx;
  684. font-weight: 700;
  685. text {
  686. font-size: 24rpx;
  687. }
  688. }
  689. .tip {
  690. margin-top: 10rpx;
  691. font-size: 24rpx;
  692. }
  693. }
  694. }
  695. }
  696. .section_4 {
  697. margin: 25rpx auto 40rpx;
  698. width: 710rpx;
  699. background-color: #FFFFFF;
  700. box-shadow: 10rpx 10rpx 16rpx 6rpx rgba(0, 0, 0, 0.13);
  701. border-radius: 20rpx;
  702. .list {
  703. overflow: hidden;
  704. box-sizing: border-box;
  705. padding: 30rpx 0;
  706. .item {
  707. margin-right: 30rpx;
  708. margin-bottom: 30rpx;
  709. float: left;
  710. width: 155rpx;
  711. text-align: center;
  712. .icon {
  713. margin: 0 auto;
  714. width: 80rpx;
  715. height: 80rpx;
  716. border-radius: 50%;
  717. overflow: hidden;
  718. image {
  719. width: 80rpx;
  720. height: 80rpx;
  721. display: block;
  722. }
  723. }
  724. .text {
  725. font-size: 28rpx;
  726. color: #666666;
  727. }
  728. }
  729. .item:nth-child(4n) {
  730. margin-right: 0;
  731. }
  732. }
  733. }
  734. }
  735. </style>