pupilMine.vue 11 KB

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