pupilMine.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. <template>
  2. <view class="pupilMine">
  3. <!-- 背景渐变色 -->
  4. <view class="back-img-box"></view>
  5. <!-- 信息面板 -->
  6. <view class="user-info-box">
  7. <view class="left-img-box">
  8. <img v-if="userData.avatar" class="avatar-img" :src="baseUrl+userData.avatar">
  9. <img v-else class="avatar-img" src="@/pages/images/icon_01.png">
  10. <img class="edit-img" src="@/pages/images/newImage/icon_wd_bj@1x.png">
  11. </view>
  12. <view class="right-name-box">
  13. <view class="right-name-top-box">
  14. <view>{{userData.userName}}</view>
  15. <view v-if="userData.status == 2 || userData.status == 3">
  16. {{userData.status == 2?'负面清单':(userData.status == 3?'黑名单':'')}}
  17. </view>
  18. </view>
  19. <view class="right-name-bottom-box">{{userData.deptName}}</view>
  20. </view>
  21. </view>
  22. <!-- 信用分面板 -->
  23. <view class="points-max-box">
  24. <view class="points-big-box">
  25. <view class="num-p colorA">{{creditScore?creditScore:'-'}}</view>
  26. <view class="img-box">
  27. <img src="@/pages/images/newImage/icon_wd_xyf@1x.png">
  28. <view>信用分</view>
  29. </view>
  30. </view>
  31. <view class="border-null-p"></view>
  32. <view class="points-big-box">
  33. <view class="num-p colorB">{{bonusPoints?bonusPoints:'-'}}</view>
  34. <view class="img-box">
  35. <img src="@/pages/images/newImage/icon_wd_jlf@1x.png">
  36. <view>奖励分</view>
  37. </view>
  38. </view>
  39. <view class="border-null-p"></view>
  40. <view class="points-big-box" @click="scanCode()">
  41. <view class="num-p colorC">扫一扫</view>
  42. <view class="img-box">
  43. <img style="margin-left:30rpx;" src="@/pages/images/newImage/icon_wd_dh@1x.png">
  44. <view>积分兑换</view>
  45. </view>
  46. </view>
  47. </view>
  48. <!-- 按钮部分 -->
  49. <view class="button-max-big-box">
  50. <view class="button-big-box" @click="goPage('entryAndExitRecordPupil')">
  51. <img class="left-img" src="@/pages/images/newImage/icon_wd_jcjl.png">
  52. <view class="left-text-p">进出记录</view>
  53. <view class="right-text-p"></view>
  54. <img class="right-img" src="@/pages/images/newImage/icon_wd_gd@1x.png">
  55. </view>
  56. </view>
  57. <view class="button-max-big-box">
  58. <view class="button-big-box" @click="goPage('identityAuthenticationPupil')">
  59. <img class="left-img" src="@/pages/images/newImage/icon_wd_sfyz@1x.png">
  60. <view class="left-text-p">身份验证</view>
  61. <view class="right-text-p"></view>
  62. <img class="right-img" src="@/pages/images/newImage/icon_wd_gd@1x.png">
  63. </view>
  64. <view class="button-big-box" @click="goPage('electronicSignaturePupil')">
  65. <img class="left-img" src="@/pages/images/newImage/icon_wd_dzqm@1x.png">
  66. <view class="left-text-p">电子签名</view>
  67. <view class="right-text-p" :class="isUpload?'color-D':''">{{!isUpload?'未上传':'已上传'}}</view>
  68. <img class="right-img" src="@/pages/images/newImage/icon_wd_gd@1x.png">
  69. </view>
  70. </view>
  71. <view class="out-button" @click="clickOut">退出登录</view>
  72. <tab-bar></tab-bar>
  73. </view>
  74. </template>
  75. <script>
  76. import {
  77. config
  78. } from '@/api/request/config.js'
  79. import {
  80. logout,
  81. systemUserProfile,
  82. studentinfoFacemy,
  83. examPointsRecordGetMyPointsLogInfo,
  84. } from '@/pages/api/index.js'
  85. import {
  86. querySignature,
  87. } from '@/pages_basics/api/index.js'
  88. import {
  89. pageRestrictVerify
  90. } from '@/utils/index'
  91. import {
  92. tabBar
  93. } from '@/pages/component/tabBar.vue'
  94. export default {
  95. name: "pupilMine",
  96. components: {
  97. tabBar,
  98. },
  99. data() {
  100. return {
  101. baseUrl: config.base_url,
  102. userData: {},
  103. bonusPoints: null,
  104. creditScore: null,
  105. ifFaceFeature: false,
  106. isUpload: false,
  107. signatureUrl: '',
  108. }
  109. },
  110. created() {
  111. },
  112. mounted() {
  113. this.systemUserProfile();
  114. this.studentinfoFacemy();
  115. this.querySignature();
  116. this.examPointsRecordGetMyPointsLogInfo();
  117. },
  118. methods: {
  119. //查询用户电子签名
  120. async querySignature() {
  121. let self = this;
  122. const {
  123. data
  124. } = await querySignature();
  125. if (data.code == 200) {
  126. self.isUpload = data.data.isUpload;
  127. self.signatureUrl = data.data.signature;
  128. }
  129. },
  130. scanCode() {
  131. uni.scanCode({
  132. onlyFromCamera: true,
  133. success: function(res) {
  134. if (res.result.indexOf('mid') != -1 &&
  135. res.result.indexOf('sid') != -1 &&
  136. res.result.indexOf('pid') != -1 &&
  137. res.result.indexOf('pri') != -1) {
  138. uni.navigateTo({
  139. url: '/pages_student/views/integralManage/codeSuccess?q=' +
  140. encodeURIComponent(JSON.stringify(res.result))
  141. });
  142. } else {
  143. uni.showToast({
  144. title: '请扫描正确的二维码',
  145. icon: "none",
  146. mask: true,
  147. duration: 2000
  148. });
  149. }
  150. }
  151. });
  152. },
  153. goPage(type) {
  154. if (!type) {
  155. uni.showToast({
  156. title: '暂未开放',
  157. icon: "none",
  158. mask: true,
  159. duration: 2000
  160. });
  161. return
  162. }
  163. if (!pageRestrictVerify(type)) {
  164. uni.showToast({
  165. title: '没有相关权限,请联系管理员',
  166. icon: "none",
  167. mask: true,
  168. duration: 2000
  169. });
  170. return
  171. }
  172. if (type == 'entryAndExitRecordPupil') {
  173. //进出记录
  174. uni.navigateTo({
  175. url: "/pages_student/views/myRecord/index",
  176. });
  177. } else if (type == 'identityAuthenticationPupil') {
  178. //身份验证
  179. uni.navigateTo({
  180. url: "/pages_basics/views/faceImage",
  181. });
  182. } else if (type == 'electronicSignaturePupil') {
  183. //电子签名
  184. uni.navigateTo({
  185. url: "/pages_basics/views/signature/signature?item="+this.signatureUrl,//电子签名
  186. });
  187. }
  188. },
  189. //获取个人信息
  190. async systemUserProfile() {
  191. const {
  192. data
  193. } = await systemUserProfile();
  194. if (data.code == 200) {
  195. this.$set(this, 'userData', data.data)
  196. uni.setStorageSync('faceImg', data.data.faceImg);
  197. }
  198. },
  199. //查询-信用分/奖励分
  200. async examPointsRecordGetMyPointsLogInfo() {
  201. const {
  202. data
  203. } = await examPointsRecordGetMyPointsLogInfo();
  204. if (data.code == 200) {
  205. this.bonusPoints = data.data.bonusPoints;
  206. this.creditScore = data.data.creditScore;
  207. }
  208. },
  209. //获取当前身份人脸验证状态与学生卡上传状态
  210. async studentinfoFacemy() {
  211. let obj = {
  212. studentsId: uni.getStorageSync('userId')
  213. }
  214. const {
  215. data
  216. } = await studentinfoFacemy(obj)
  217. if (data.code == 200) {
  218. this.certification = data.data;
  219. this.ifFaceFeature = data.data.ifFaceFeature;
  220. }
  221. },
  222. //退出按钮
  223. clickOut() {
  224. let self = this;
  225. uni.showModal({
  226. // title: '确认要退出吗?',
  227. content: '确认要退出吗',
  228. cancelColor: "#999",
  229. confirmColor: "#0183FA",
  230. success: function(res) {
  231. if (res.confirm) {
  232. self.logout();
  233. } else if (res.cancel) {}
  234. }
  235. });
  236. },
  237. //退出登录
  238. async logout() {
  239. let self = this;
  240. const {
  241. data
  242. } = await logout();
  243. if (data.code == 200) {
  244. uni.removeStorageSync('token');
  245. uni.removeStorageSync('userId');
  246. uni.removeStorageSync('userType');
  247. uni.redirectTo({
  248. url: '/pages/views/login/login',
  249. });
  250. }
  251. },
  252. // 头像上传
  253. selectImage() {
  254. let self = this;
  255. wx.chooseImage({
  256. count: 1,
  257. sizeType: ["original", "compressed"],
  258. sourceType: ["album", "camera"],
  259. success: function(res) {
  260. let tempFilePaths = res.tempFilePaths[0];
  261. self.uploadImg(tempFilePaths);
  262. }
  263. });
  264. },
  265. async uploadImg(tempFilePaths) {
  266. var self = this;
  267. uni.showLoading({
  268. title: '上传中',
  269. mask: true
  270. });
  271. uni.uploadFile({
  272. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  273. header: {
  274. 'Authorization': uni.getStorageSync('token')
  275. },
  276. filePath: tempFilePaths,
  277. name: 'file',
  278. formData: {
  279. 'user': 'test'
  280. },
  281. success: (uploadFileRes) => {
  282. let res = JSON.parse(uploadFileRes.data);
  283. if (res.code == 200) {
  284. uni.navigateTo({
  285. url: '/pages_basics/views/avatar?src=' + config.base_url + res.data
  286. .url,
  287. });
  288. } else {
  289. uni.showToast({
  290. title: res.msg,
  291. icon: "none",
  292. mask: true,
  293. duration: 2000
  294. });
  295. }
  296. },
  297. fail: err => {},
  298. complete: () => {
  299. uni.hideLoading()
  300. }
  301. });
  302. },
  303. }
  304. }
  305. </script>
  306. <style lang="stylus" scoped>
  307. .pupilMine {
  308. flex: 1;
  309. display: flex;
  310. flex-direction: column;
  311. overflow: hidden;
  312. .back-img-box {
  313. z-index: 0;
  314. position: absolute;
  315. top: 0;
  316. left: 0;
  317. width: 750rpx;
  318. height: 291rpx;
  319. background: linear-gradient(180deg, rgba(1, 131, 250, 1) 0%, rgba(255, 255, 255, 0) 100%);
  320. }
  321. .user-info-box {
  322. z-index: 10;
  323. margin: 39rpx 24rpx 0;
  324. display: flex;
  325. .left-img-box {
  326. width: 132rpx;
  327. height: 132rpx;
  328. position: relative;
  329. margin-right: 22rpx;
  330. .avatar-img {
  331. position: absolute;
  332. top: 6rpx;
  333. left: 6rpx;
  334. width: 116rpx;
  335. height: 116rpx;
  336. border-radius: 50%;
  337. border: 2rpx solid #fff;
  338. }
  339. .edit-img {
  340. z-index: 5;
  341. position: absolute;
  342. right: 0;
  343. bottom: 6rpx;
  344. width: 40rpx;
  345. height: 40rpx;
  346. }
  347. }
  348. .right-name-box {
  349. padding-top: 6rpx;
  350. .right-name-top-box {
  351. display: flex;
  352. view:nth-child(1) {
  353. height: 68rpx;
  354. line-height: 62rpx;
  355. font-size: 32rpx;
  356. color: #fff;
  357. }
  358. view:nth-child(2) {
  359. margin-top: 14rpx;
  360. margin-left: 30rpx;
  361. width: 120rpx;
  362. height: 40rpx;
  363. line-height: 40rpx;
  364. background: #FF8C00;
  365. border-radius: 50rpx;
  366. font-size: 24rpx;
  367. color: #fff;
  368. text-align: center;
  369. }
  370. }
  371. .right-name-bottom-box {
  372. height: 50rpx;
  373. line-height: 50rpx;
  374. font-size: 28rpx;
  375. color: #fff;
  376. }
  377. }
  378. }
  379. .points-max-box {
  380. z-index: 10;
  381. width: 690rpx;
  382. height: 160rpx;
  383. background: #FFFFFF;
  384. border-radius: 20rpx;
  385. margin: 38rpx 30rpx 0;
  386. display: flex;
  387. .points-big-box {
  388. flex: 1;
  389. .num-p {
  390. margin: 39rpx 0 19rpx 0;
  391. text-align: center;
  392. font-size: 28rpx;
  393. line-height: 39rpx;
  394. }
  395. .img-box {
  396. display: flex;
  397. img {
  398. width: 30rpx;
  399. height: 30rpx;
  400. display: block;
  401. margin: 0 20rpx 0 42rpx;
  402. }
  403. view {
  404. color: #333333;
  405. line-height: 30rpx;
  406. font-size: 28rpx;
  407. }
  408. }
  409. .colorA {
  410. color: #0183FA;
  411. }
  412. .colorB {
  413. color: #26C736;
  414. }
  415. .colorC {
  416. color: #333333;
  417. }
  418. }
  419. .border-null-p {
  420. width: 1rpx;
  421. height: 40rpx;
  422. margin: 60rpx 0 0;
  423. background-color: #e0e0e0;
  424. }
  425. }
  426. .button-max-big-box {
  427. background-color: #fff;
  428. border-radius: 20rpx;
  429. margin: 20rpx 30rpx 0;
  430. .button-big-box:nth-child(1) {
  431. border-top: none;
  432. }
  433. .button-big-box {
  434. border-top: 1px solid #E0E0E0;
  435. display: flex;
  436. padding: 0 30rpx 0 26rpx;
  437. .left-img {
  438. display: block;
  439. width: 36rpx;
  440. height: 36rpx;
  441. margin-top: 25rpx;
  442. margin-right: 21rpx;
  443. }
  444. .left-text-p {
  445. flex: 1;
  446. front-size: 30rpx;
  447. line-height: 40rpx;
  448. margin: 20rpx 0;
  449. }
  450. .right-text-p {
  451. front-size: 30rpx;
  452. line-height: 40rpx;
  453. margin: 20rpx 0;
  454. }
  455. .right-img {
  456. display: block;
  457. width: 30rpx;
  458. height: 30rpx;
  459. margin-top: 28rpx;
  460. }
  461. }
  462. .color-D{
  463. color:#0183FA!important;
  464. }
  465. }
  466. .out-button {
  467. position absolute;
  468. bottom: 140rpx;
  469. left: 75rpx;
  470. width: 600rpx;
  471. height: 80rpx;
  472. line-height: 80rpx;
  473. border-radius: 100rpx;
  474. text-align center;
  475. background #0183FA;
  476. color: #ffffff;
  477. font-size: 30rpx;
  478. margin: 0 auto;
  479. }
  480. }
  481. </style>