pupilMine.vue 11 KB

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