pupilMine.vue 11 KB

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