mine.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. <!-- 我的 -->
  2. <template>
  3. <view id="mine">
  4. <teacherMine class="flex-box-page" v-if="userType==1"></teacherMine>
  5. <pupilMine class="flex-box-page" v-if="userType==2"></pupilMine>
  6. <!--
  7. <view class="top-max-big-box" v-if="pageType">
  8. <view class="top-max-box-two" v-if="userType==1">
  9. <view class="user-img-box" @click="selectImage">
  10. <img v-if="userData.avatar" :src="baseUrl+userData.avatar">
  11. <img v-else src="@/pages/images/icon_01.png">
  12. <view>{{userData.avatar?'编辑':'未上传'}}</view>
  13. </view>
  14. <view class="name-box">
  15. <view>{{userData.userName}}</view>
  16. <view>{{userData.deptName}}</view>
  17. </view>
  18. </view>
  19. <view class="user-top-max-box-one" v-if="userType==2">
  20. <view class="back-posi"></view>
  21. <view class="top-max-box-one">
  22. <view class="user-img-box" @click="selectImage">
  23. <img v-if="userData.avatar" :src="userData.avatarUrl">
  24. <img v-else src="@/pages/images/icon_01.png">
  25. <view>{{userData.avatar?'编辑':'未上传'}}</view>
  26. </view>
  27. <view class="name-box">
  28. <view class="name-box-min">
  29. <view>{{userData.userName}}</view>
  30. <view
  31. :class="userData.status == 2?'view-color-one':(userData.status == 3?'view-color-two':(userData.status == 1?'view-color-tree':''))">
  32. {{userData.status == 2?'负面清单':(userData.status == 3?'黑名单':(userData.status == 1?'正常':''))}}
  33. </view>
  34. </view>
  35. <view class="name-box-user">{{userData.professional}}丨{{userData.deptName}}</view>
  36. </view>
  37. </view>
  38. <view class="num-max-box">
  39. <view class="min-num-box" @click="goUserPage('none')">
  40. <view class="min-num-view color-one">{{creditScore}}</view>
  41. <view class="bottom-min-num-view">
  42. <img class="img-one" src="@/pages/images/icon_wd_xyf.png">
  43. <view>信用分</view>
  44. </view>
  45. </view>
  46. <view class="null-p"></view>
  47. <view class="min-num-box" @click="goUserPage('none')">
  48. <view class="min-num-view color-two">{{bonusPoints}}</view>
  49. <view class="bottom-min-num-view">
  50. <img class="img-two" src="@/pages/images/icon_wd_jlf.png">
  51. <view>奖励分</view>
  52. </view>
  53. </view>
  54. <view class="null-p"></view>
  55. <view class="min-num-box" @click="goUserPage(3)">
  56. <view class="min-num-view">扫一扫</view>
  57. <view class="bottom-min-num-view">
  58. <img class="img-two" src="@/pages/images/icon_wd_dh.png">
  59. <view>兑换礼品</view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <mineConfigurationSlot v-for="(item,index) in mineConfigData" :key="index" :mineConfig="item">
  66. </mineConfigurationSlot>
  67. <view class="out-button" @click="clickOut">退出登录</view>
  68. <tab-bar></tab-bar> -->
  69. </view>
  70. </template>
  71. <script>
  72. import {
  73. teacherMine
  74. } from '@/pages/views/teacherPage/teacherMine'
  75. import {
  76. pupilMine
  77. } from '@/pages/views/pupilPage/pupilMine'
  78. // import {
  79. // config
  80. // } from '@/api/request/config.js'
  81. // import {
  82. // logout,
  83. // studentinfoFacemy,
  84. // simpleInfo,
  85. // getSafeWarnList,
  86. // fingerprintQuantity,
  87. // fingerprintQueryList,
  88. // systemAppletLayoutSelect,
  89. // systemUserProfile,
  90. // examPointsRecordGetMyPointsLogInfo
  91. // } from '@/pages/api/index.js'
  92. // import {
  93. // getMineConfig
  94. // } from '@/utils/mineConfig'
  95. // import {
  96. // tabBar
  97. // } from '@/pages/component/tabBar.vue'
  98. // import {
  99. // mineConfigurationSlot
  100. // } from '@/pages/component/mineConfigurationSlot'
  101. export default {
  102. // components: {
  103. // tabBar,
  104. // mineConfigurationSlot,
  105. // },
  106. components: {
  107. teacherMine,
  108. pupilMine,
  109. },
  110. data() {
  111. return {
  112. userType: 0,
  113. // baseUrl: config.base_url,
  114. // mineConfigData: [],
  115. // //页面状态
  116. // pageType: false,
  117. // //认证数据
  118. // certification: {
  119. // },
  120. // userType: 0,
  121. // userData: {
  122. // deptName: "",
  123. // professional: "",
  124. // userName: "",
  125. // },
  126. // securityAlertNum: 0,
  127. // adminSubCount: 0,
  128. // wranDoCount: 0,
  129. // //奖励分
  130. // bonusPoints: 0,
  131. // //信用分
  132. // creditScore: 0,
  133. // //用户签名
  134. // signatureUrl: '',
  135. // // 人脸
  136. // ifFaceFeature: "",
  137. // //签名
  138. // isUpload: "",
  139. // Quantity: 0, //指纹录取数量
  140. }
  141. },
  142. onLoad() {
  143. },
  144. onShow() {
  145. this.userType = uni.getStorageSync('userType')
  146. // this.simpleInfo();
  147. // this.systemAppletLayoutSelect();
  148. // if (uni.getStorageSync('token') && uni.getStorageSync('userId') && uni.getStorageSync('userType')) {
  149. // this.userType = uni.getStorageSync('userType')
  150. // if(this.userType == '2'){
  151. // this.examPointsRecordGetMyPointsLogInfo();
  152. // }
  153. // } else {
  154. // uni.removeStorageSync('token');
  155. // uni.removeStorageSync('userId');
  156. // uni.removeStorageSync('userType');
  157. // uni.redirectTo({
  158. // url: '/pages/login',
  159. // });
  160. // }
  161. },
  162. methods: {
  163. //获取菜单配置
  164. async systemAppletLayoutSelect() {
  165. const {
  166. data
  167. } = await systemAppletLayoutSelect({
  168. module: 'mine'
  169. })
  170. if (data.code == 200) {
  171. let list = JSON.parse(JSON.stringify(data.data))
  172. for (let i = 0; i < list.length; i++) {
  173. list[i].layout = JSON.parse(list[i].layout);
  174. }
  175. this.$set(this, 'mineConfigData', getMineConfig(list));
  176. }
  177. },
  178. //查询学生-信用分/奖励分
  179. async examPointsRecordGetMyPointsLogInfo() {
  180. const {
  181. data
  182. } = await examPointsRecordGetMyPointsLogInfo();
  183. if (data.code == 200) {
  184. this.bonusPoints = data.data.bonusPoints;
  185. this.creditScore = data.data.creditScore;
  186. }
  187. },
  188. //学生端-信用分/奖励分/扫一扫按钮
  189. goUserPage(type) {
  190. let self = this;
  191. if (type == 1) {
  192. uni.navigateTo({
  193. url: '/pages_student/views/mine/creditPoints',
  194. });
  195. } else if (type == 2) {
  196. uni.navigateTo({
  197. url: '/pages_student/views/mine/rewardPoints',
  198. });
  199. } else if (type == 3) {
  200. uni.scanCode({
  201. onlyFromCamera: true,
  202. success: function(res) {
  203. uni.navigateTo({
  204. url: '/pages_student/views/integralManage/codeSuccess?q=' +
  205. encodeURIComponent(JSON.stringify(res.result))
  206. });
  207. }
  208. });
  209. } else if (type == 'none') {
  210. uni.showToast({
  211. title: '暂未开放',
  212. icon: "none",
  213. mask: true,
  214. duration: 2000
  215. });
  216. }
  217. },
  218. //获取个人信息
  219. async simpleInfo() {
  220. const {
  221. data
  222. } = await systemUserProfile();
  223. if (data.code == 200) {
  224. this.$set(this, 'userData', data.data)
  225. uni.setStorageSync('faceImg', data.data.faceImg);
  226. this.$set(this, 'pageType', true)
  227. }
  228. },
  229. //获取报警信息列表
  230. async getSafeWarnList() {
  231. let obj = {
  232. pageNum: 1,
  233. pageSize: 1,
  234. count: 0,
  235. groupStatus: 1,
  236. };
  237. const {
  238. data
  239. } = await getSafeWarnList(obj);
  240. if (data.code == 200) {
  241. if (data.rows[0]) {
  242. this.securityAlertNum = data.rows[0].todayHappenCount;
  243. } else {
  244. this.securityAlertNum = 0;
  245. }
  246. }
  247. },
  248. //获取当前身份人脸验证状态与学生卡上传状态
  249. async studentinfoFacemy() {
  250. let obj = {
  251. studentsId: uni.getStorageSync('userId')
  252. }
  253. const {
  254. data
  255. } = await studentinfoFacemy(obj)
  256. if (data.code == 200) {
  257. this.certification = data.data;
  258. this.ifFaceFeature = data.data.ifFaceFeature;
  259. }
  260. },
  261. //退出按钮
  262. clickOut() {
  263. let self = this;
  264. uni.showModal({
  265. // title: '确认要退出吗?',
  266. content: '确认要退出吗',
  267. cancelColor: "#999",
  268. confirmColor: "#0183FA",
  269. success: function(res) {
  270. if (res.confirm) {
  271. self.logout();
  272. } else if (res.cancel) {}
  273. }
  274. });
  275. },
  276. //退出登录
  277. async logout() {
  278. let self = this;
  279. const {
  280. data
  281. } = await logout();
  282. if (data.code == 200) {
  283. uni.removeStorageSync('token');
  284. uni.removeStorageSync('userId');
  285. uni.removeStorageSync('userType');
  286. uni.redirectTo({
  287. url: '/pages/views/login/login',
  288. });
  289. }
  290. },
  291. // 头像上传
  292. selectImage() {
  293. let self = this;
  294. wx.chooseImage({
  295. count: 1,
  296. sizeType: ["original", "compressed"],
  297. sourceType: ["album", "camera"],
  298. success: function(res) {
  299. let tempFilePaths = res.tempFilePaths[0];
  300. self.uploadImg(tempFilePaths);
  301. }
  302. });
  303. },
  304. async uploadImg(tempFilePaths) {
  305. var self = this;
  306. uni.showLoading({
  307. title: '上传中',
  308. mask: true
  309. });
  310. uni.uploadFile({
  311. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  312. header: {
  313. 'Authorization': uni.getStorageSync('token')
  314. },
  315. filePath: tempFilePaths,
  316. name: 'file',
  317. formData: {
  318. 'user': 'test'
  319. },
  320. success: (uploadFileRes) => {
  321. let res = JSON.parse(uploadFileRes.data);
  322. if (res.code == 200) {
  323. uni.navigateTo({
  324. url: '/pages_basics/views/avatar?src=' + config.base_url + res.data.url,
  325. });
  326. } else {
  327. uni.showToast({
  328. title: res.msg,
  329. icon: "none",
  330. mask: true,
  331. duration: 2000
  332. });
  333. }
  334. },
  335. fail: err => {},
  336. complete: () => {
  337. uni.hideLoading()
  338. }
  339. });
  340. },
  341. },
  342. }
  343. </script>
  344. <style lang="stylus" scoped>
  345. #mine {
  346. height: 100%;
  347. display: flex;
  348. flex-direction: column;
  349. overflow: hidden;
  350. .flex-box-page{
  351. flex:1;
  352. display: flex;
  353. flex-direction: column;
  354. overflow: hidden;
  355. }
  356. .top-max-big-box {
  357. /*background:#ffffff;*/
  358. .user-top-max-box-one {
  359. overflow hidden;
  360. background url("@/pages/images/img_wd_bg.png") no-repeat;
  361. background-size: 100%;
  362. height: 350rpx;
  363. .top-max-box-one {
  364. background #fff;
  365. margin: 40rpx 40rpx 0;
  366. z-index: 1;
  367. height: 180rpx;
  368. border-top-right-radius 20rpx;
  369. border-top-left-radius 20rpx;
  370. display flex;
  371. overflow hidden;
  372. .user-img-box {
  373. height: 120rpx;
  374. width: 100rpx;
  375. margin: 30rpx 53rpx 0 22rpx;
  376. img {
  377. height: 100rpx;
  378. width: 100rpx;
  379. border-radius: 50%;
  380. }
  381. view {
  382. font-size: 22rpx;
  383. color: #666666;
  384. text-align center;
  385. line-height: 22rpx;
  386. margin-top: 10rpx;
  387. }
  388. }
  389. .name-box {
  390. margin-top: 30rpx;
  391. .name-box-min {
  392. display flex;
  393. overflow hidden;
  394. margin-bottom: 11rpx;
  395. view:nth-child(1) {
  396. height: 48rpx;
  397. line-height: 48rpx;
  398. font-size: 30rpx;
  399. color: #333;
  400. }
  401. view:nth-child(2) {
  402. height: 30rpx;
  403. line-height: 30rpx;
  404. font-size: 20rpx;
  405. padding: 0 20rpx;
  406. margin: 9rpx 0 9rpx 20rpx;
  407. }
  408. .view-color-one {
  409. background #FDD255;
  410. }
  411. .view-color-two {
  412. background #A2A2A2;
  413. }
  414. .view-color-tree {
  415. background #0183FA;
  416. }
  417. }
  418. .name-box-user {
  419. line-height: 41rpx;
  420. font-size: 22rpx;
  421. color: #333;
  422. }
  423. }
  424. }
  425. .num-max-box {
  426. width: 670rpx;
  427. background #fff;
  428. border-bottom-right-radius 20rpx;
  429. border-bottom-left-radius 20rpx;
  430. height: 130rpx;
  431. margin: 0 40rpx;
  432. display flex;
  433. .min-num-box {
  434. flex: 1;
  435. .min-num-view {
  436. margin-top: 30rpx;
  437. height: 30rpx;
  438. line-height: 30rpx;
  439. font-size: 22rpx;
  440. text-align center
  441. }
  442. .color-one {
  443. font-weight: 700;
  444. font-size: 26rpx;
  445. color: #2B99FE;
  446. }
  447. .color-two {
  448. font-weight: 700;
  449. font-size: 26rpx;
  450. color: #FDD255;
  451. }
  452. .bottom-min-num-view {
  453. display flex;
  454. margin-top: 20rpx;
  455. .img-one {
  456. width: 25rpx;
  457. height: 28rpx;
  458. margin: 0 10rpx 0 58rpx;
  459. }
  460. .img-two {
  461. width: 28rpx;
  462. height: 26rpx;
  463. margin: 0 10rpx 0 59rpx;
  464. }
  465. view {
  466. font-size: 22rpx;
  467. }
  468. }
  469. }
  470. }
  471. .null-p {
  472. background #dedede;
  473. height: 30rpx;
  474. width: 2rpx;
  475. margin: 50rpx 0 0;
  476. }
  477. }
  478. .top-max-box-two {
  479. background: #0183FA;
  480. height: 180rpx;
  481. display flex;
  482. overflow hidden;
  483. .user-img-box {
  484. height: 120rpx;
  485. width: 100rpx;
  486. margin: 50rpx 53rpx 0 22rpx;
  487. img {
  488. height: 100rpx;
  489. width: 100rpx;
  490. border-radius: 50%;
  491. }
  492. view {
  493. font-size: 22rpx;
  494. color: #fff;
  495. text-align center;
  496. line-height: 22rpx;
  497. margin-top: 10rpx;
  498. }
  499. }
  500. .name-box {
  501. margin-top: 50rpx;
  502. view:nth-child(1) {
  503. line-height: 48rpx;
  504. margin-bottom: 11rpx;
  505. font-size: 30rpx;
  506. color: #fff;
  507. }
  508. view:nth-child(2) {
  509. line-height: 41rpx;
  510. font-size: 22rpx;
  511. color: #fff;
  512. }
  513. }
  514. }
  515. .button-max-big-box {
  516. background #fff;
  517. padding: 0 20rpx;
  518. margin-top: 30rpx;
  519. .button-max-box {
  520. height: 100rpx;
  521. display flex;
  522. border-top: 1rpx solid #e0e0e0;
  523. .left-img {
  524. height: 30rpx;
  525. width: 30rpx;
  526. margin: 34rpx 44rpx 0 0;
  527. }
  528. view {
  529. line-height: 100rpx;
  530. }
  531. view:nth-child(2) {
  532. flex: 1;
  533. color: #333333;
  534. font-size: 30rpx;
  535. }
  536. .right-img {
  537. height: 24rpx;
  538. width: 12rpx;
  539. margin: 39rpx 0 0 0;
  540. }
  541. .colorA {
  542. color: #E45656 !important;
  543. }
  544. .marginType {
  545. margin-right: 12rpx;
  546. }
  547. .view-three-one {
  548. width: 30rpx;
  549. height: 30rpx;
  550. text-align center;
  551. background #FF4552;
  552. border-radius: 50%;
  553. font-size: 20rpx;
  554. line-height: 30rpx;
  555. color: #fff;
  556. margin: 36rpx 20rpx;
  557. }
  558. .view-three-two {
  559. width: 30rpx;
  560. height: 30rpx;
  561. text-align center;
  562. border-radius: 50%;
  563. font-size: 20rpx;
  564. line-height: 30rpx;
  565. color: #999;
  566. margin: 36rpx 20rpx;
  567. }
  568. .view-three-type {
  569. width: 120rpx;
  570. text-align center;
  571. color: #CCCCCC;
  572. font-size: 26rpx;
  573. }
  574. }
  575. .button-max-box:nth-child(1) {
  576. border: none;
  577. }
  578. }
  579. }
  580. .out-button {
  581. position absolute;
  582. bottom: 140rpx;
  583. left: 25rpx;
  584. width: 700rpx;
  585. height: 100rpx;
  586. line-height: 100rpx;
  587. border-radius: 10rpx;
  588. text-align center;
  589. background #E0E0E0;
  590. color: #0183FA;
  591. font-size: 30rpx;
  592. margin: 0 auto;
  593. }
  594. }
  595. </style>