mine.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  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. .flex-box-page{
  350. flex:1;
  351. display: flex;
  352. flex-direction: column;
  353. }
  354. .top-max-big-box {
  355. /*background:#ffffff;*/
  356. .user-top-max-box-one {
  357. overflow hidden;
  358. background url("@/pages/images/img_wd_bg.png") no-repeat;
  359. background-size: 100%;
  360. height: 350rpx;
  361. .top-max-box-one {
  362. background #fff;
  363. margin: 40rpx 40rpx 0;
  364. z-index: 1;
  365. height: 180rpx;
  366. border-top-right-radius 20rpx;
  367. border-top-left-radius 20rpx;
  368. display flex;
  369. overflow hidden;
  370. .user-img-box {
  371. height: 120rpx;
  372. width: 100rpx;
  373. margin: 30rpx 53rpx 0 22rpx;
  374. img {
  375. height: 100rpx;
  376. width: 100rpx;
  377. border-radius: 50%;
  378. }
  379. view {
  380. font-size: 22rpx;
  381. color: #666666;
  382. text-align center;
  383. line-height: 22rpx;
  384. margin-top: 10rpx;
  385. }
  386. }
  387. .name-box {
  388. margin-top: 30rpx;
  389. .name-box-min {
  390. display flex;
  391. overflow hidden;
  392. margin-bottom: 11rpx;
  393. view:nth-child(1) {
  394. height: 48rpx;
  395. line-height: 48rpx;
  396. font-size: 30rpx;
  397. color: #333;
  398. }
  399. view:nth-child(2) {
  400. height: 30rpx;
  401. line-height: 30rpx;
  402. font-size: 20rpx;
  403. padding: 0 20rpx;
  404. margin: 9rpx 0 9rpx 20rpx;
  405. }
  406. .view-color-one {
  407. background #FDD255;
  408. }
  409. .view-color-two {
  410. background #A2A2A2;
  411. }
  412. .view-color-tree {
  413. background #0183FA;
  414. }
  415. }
  416. .name-box-user {
  417. line-height: 41rpx;
  418. font-size: 22rpx;
  419. color: #333;
  420. }
  421. }
  422. }
  423. .num-max-box {
  424. width: 670rpx;
  425. background #fff;
  426. border-bottom-right-radius 20rpx;
  427. border-bottom-left-radius 20rpx;
  428. height: 130rpx;
  429. margin: 0 40rpx;
  430. display flex;
  431. .min-num-box {
  432. flex: 1;
  433. .min-num-view {
  434. margin-top: 30rpx;
  435. height: 30rpx;
  436. line-height: 30rpx;
  437. font-size: 22rpx;
  438. text-align center
  439. }
  440. .color-one {
  441. font-weight: 700;
  442. font-size: 26rpx;
  443. color: #2B99FE;
  444. }
  445. .color-two {
  446. font-weight: 700;
  447. font-size: 26rpx;
  448. color: #FDD255;
  449. }
  450. .bottom-min-num-view {
  451. display flex;
  452. margin-top: 20rpx;
  453. .img-one {
  454. width: 25rpx;
  455. height: 28rpx;
  456. margin: 0 10rpx 0 58rpx;
  457. }
  458. .img-two {
  459. width: 28rpx;
  460. height: 26rpx;
  461. margin: 0 10rpx 0 59rpx;
  462. }
  463. view {
  464. font-size: 22rpx;
  465. }
  466. }
  467. }
  468. }
  469. .null-p {
  470. background #dedede;
  471. height: 30rpx;
  472. width: 2rpx;
  473. margin: 50rpx 0 0;
  474. }
  475. }
  476. .top-max-box-two {
  477. background: #0183FA;
  478. height: 180rpx;
  479. display flex;
  480. overflow hidden;
  481. .user-img-box {
  482. height: 120rpx;
  483. width: 100rpx;
  484. margin: 50rpx 53rpx 0 22rpx;
  485. img {
  486. height: 100rpx;
  487. width: 100rpx;
  488. border-radius: 50%;
  489. }
  490. view {
  491. font-size: 22rpx;
  492. color: #fff;
  493. text-align center;
  494. line-height: 22rpx;
  495. margin-top: 10rpx;
  496. }
  497. }
  498. .name-box {
  499. margin-top: 50rpx;
  500. view:nth-child(1) {
  501. line-height: 48rpx;
  502. margin-bottom: 11rpx;
  503. font-size: 30rpx;
  504. color: #fff;
  505. }
  506. view:nth-child(2) {
  507. line-height: 41rpx;
  508. font-size: 22rpx;
  509. color: #fff;
  510. }
  511. }
  512. }
  513. .button-max-big-box {
  514. background #fff;
  515. padding: 0 20rpx;
  516. margin-top: 30rpx;
  517. .button-max-box {
  518. height: 100rpx;
  519. display flex;
  520. border-top: 1rpx solid #e0e0e0;
  521. .left-img {
  522. height: 30rpx;
  523. width: 30rpx;
  524. margin: 34rpx 44rpx 0 0;
  525. }
  526. view {
  527. line-height: 100rpx;
  528. }
  529. view:nth-child(2) {
  530. flex: 1;
  531. color: #333333;
  532. font-size: 30rpx;
  533. }
  534. .right-img {
  535. height: 24rpx;
  536. width: 12rpx;
  537. margin: 39rpx 0 0 0;
  538. }
  539. .colorA {
  540. color: #E45656 !important;
  541. }
  542. .marginType {
  543. margin-right: 12rpx;
  544. }
  545. .view-three-one {
  546. width: 30rpx;
  547. height: 30rpx;
  548. text-align center;
  549. background #FF4552;
  550. border-radius: 50%;
  551. font-size: 20rpx;
  552. line-height: 30rpx;
  553. color: #fff;
  554. margin: 36rpx 20rpx;
  555. }
  556. .view-three-two {
  557. width: 30rpx;
  558. height: 30rpx;
  559. text-align center;
  560. border-radius: 50%;
  561. font-size: 20rpx;
  562. line-height: 30rpx;
  563. color: #999;
  564. margin: 36rpx 20rpx;
  565. }
  566. .view-three-type {
  567. width: 120rpx;
  568. text-align center;
  569. color: #CCCCCC;
  570. font-size: 26rpx;
  571. }
  572. }
  573. .button-max-box:nth-child(1) {
  574. border: none;
  575. }
  576. }
  577. }
  578. .out-button {
  579. position absolute;
  580. bottom: 140rpx;
  581. left: 25rpx;
  582. width: 700rpx;
  583. height: 100rpx;
  584. line-height: 100rpx;
  585. border-radius: 10rpx;
  586. text-align center;
  587. background #E0E0E0;
  588. color: #0183FA;
  589. font-size: 30rpx;
  590. margin: 0 auto;
  591. }
  592. }
  593. </style>