teacherMine.vue 12 KB

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