pupilMine.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500
  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" @click="selectImage()">
  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="userStatus == 1 || userStatus == 2">
  16. {{userStatus == 1?'负面清单':(userStatus == 2?'黑名单':'')}}
  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. userStatus:0,
  104. faceImg: '',
  105. signatureUrl: '',
  106. }
  107. },
  108. created() {
  109. },
  110. mounted() {
  111. },
  112. onShow(){
  113. },
  114. methods: {
  115. initialize(){
  116. this.systemUserProfile();
  117. //this.examPointsRecordGetMyPointsLogInfo();
  118. },
  119. scanCode() {
  120. uni.scanCode({
  121. onlyFromCamera: true,
  122. success: function(res) {
  123. if (res.result.indexOf('mid') != -1 &&
  124. res.result.indexOf('sid') != -1 &&
  125. res.result.indexOf('pid') != -1 &&
  126. res.result.indexOf('pri') != -1) {
  127. uni.navigateTo({
  128. url: '/pages_student/views/integralManage/codeSuccess?q=' +
  129. encodeURIComponent(JSON.stringify(res.result))
  130. });
  131. } else {
  132. uni.showToast({
  133. title: '请扫描正确的二维码',
  134. icon: "none",
  135. mask: true,
  136. duration: 2000
  137. });
  138. }
  139. }
  140. });
  141. },
  142. goPage(type) {
  143. if (!type) {
  144. uni.showToast({
  145. title: '暂未开放',
  146. icon: "none",
  147. mask: true,
  148. duration: 2000
  149. });
  150. return
  151. }
  152. if (!pageRestrictVerify(type)) {
  153. uni.showToast({
  154. title: '没有相关权限,请联系管理员',
  155. icon: "none",
  156. mask: true,
  157. duration: 2000
  158. });
  159. return
  160. }
  161. if (type == 'entryAndExitRecordPupil') {
  162. //进出记录
  163. uni.navigateTo({
  164. url: "/pages_student/views/myRecord/index",
  165. });
  166. } else if (type == 'identityAuthenticationPupil') {
  167. //身份验证
  168. uni.navigateTo({
  169. url: "/pages_basics/views/faceImage",
  170. });
  171. } else if (type == 'electronicSignaturePupil') {
  172. //电子签名
  173. uni.navigateTo({
  174. url: "/pages_basics/views/signature/signature?item="+this.signatureUrl,//电子签名
  175. });
  176. }
  177. },
  178. //获取个人信息
  179. async systemUserProfile() {
  180. const {
  181. data
  182. } = await systemUserProfile();
  183. if (data.code == 200) {
  184. this.$set(this, 'userData', data.data)
  185. this.faceImg=data.data.faceImg;
  186. this.signatureUrl=data.data.signature
  187. uni.setStorageSync('faceImg', data.data.faceImg);
  188. }
  189. },
  190. //查询-信用分/奖励分
  191. async examPointsRecordGetMyPointsLogInfo() {
  192. const {
  193. data
  194. } = await examPointsRecordGetMyPointsLogInfo();
  195. if (data.code == 200) {
  196. this.bonusPoints = data.data.bonusPoints;
  197. this.creditScore = data.data.creditScore;
  198. this.userStatus = data.data.userStatus;
  199. }
  200. },
  201. //退出按钮
  202. clickOut() {
  203. let self = this;
  204. uni.showModal({
  205. // title: '确认要退出吗?',
  206. content: '确认要退出吗',
  207. cancelColor: "#999",
  208. confirmColor: "#0183FA",
  209. success: function(res) {
  210. if (res.confirm) {
  211. self.logout();
  212. } else if (res.cancel) {}
  213. }
  214. });
  215. },
  216. //退出登录
  217. async logout() {
  218. let self = this;
  219. const {
  220. data
  221. } = await logout();
  222. if (data.code == 200) {
  223. uni.removeStorageSync('token');
  224. uni.removeStorageSync('userId');
  225. uni.removeStorageSync('userType');
  226. uni.redirectTo({
  227. url: '/pages/views/login/login',
  228. });
  229. }
  230. },
  231. // 头像上传
  232. selectImage() {
  233. let self = this;
  234. wx.chooseImage({
  235. count: 1,
  236. sizeType: ["original", "compressed"],
  237. sourceType: ["album", "camera"],
  238. success: function(res) {
  239. let tempFilePaths = res.tempFilePaths[0];
  240. self.uploadImg(tempFilePaths);
  241. }
  242. });
  243. },
  244. async uploadImg(tempFilePaths) {
  245. var self = this;
  246. uni.showLoading({
  247. title: '上传中',
  248. mask: true
  249. });
  250. uni.uploadFile({
  251. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  252. header: {
  253. 'Authorization': uni.getStorageSync('token')
  254. },
  255. filePath: tempFilePaths,
  256. name: 'file',
  257. formData: {
  258. 'user': 'test'
  259. },
  260. success: (uploadFileRes) => {
  261. let res = JSON.parse(uploadFileRes.data);
  262. if (res.code == 200) {
  263. uni.navigateTo({
  264. url: '/pages_basics/views/avatar?src=' + config.base_url + res.data
  265. .url,
  266. });
  267. } else {
  268. uni.showToast({
  269. title: res.msg,
  270. icon: "none",
  271. mask: true,
  272. duration: 2000
  273. });
  274. }
  275. },
  276. fail: err => {},
  277. complete: () => {
  278. uni.hideLoading()
  279. }
  280. });
  281. },
  282. }
  283. }
  284. </script>
  285. <style lang="stylus" scoped>
  286. .pupilMine {
  287. flex: 1;
  288. display: flex;
  289. flex-direction: column;
  290. overflow-y: scroll;
  291. overflow-x: hidden;
  292. padding-bottom:200rpx;
  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. .color-D{
  444. color:#0183FA!important;
  445. }
  446. }
  447. .null-flex-p{
  448. flex:1;
  449. }
  450. .out-button {
  451. // position absolute;
  452. // bottom: 140rpx;
  453. // left: 75rpx;
  454. margin:20rpx 0 20rpx 75rpx;
  455. width: 600rpx;
  456. height: 80rpx;
  457. line-height: 80rpx;
  458. border-radius: 100rpx;
  459. text-align center;
  460. background #0183FA;
  461. color: #ffffff;
  462. font-size: 30rpx;
  463. }
  464. }
  465. </style>