pupilMine.vue 12 KB

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