teacherMine.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  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. uni.redirectTo({
  260. url: '/pages/views/login/ssoLogin',
  261. });
  262. }
  263. },
  264. // 头像上传
  265. selectImage() {
  266. let self = this;
  267. wx.chooseImage({
  268. count: 1,
  269. sizeType: ["original", "compressed"],
  270. sourceType: ["album", "camera"],
  271. success: function(res) {
  272. let tempFilePaths = res.tempFilePaths[0];
  273. self.uploadImg(tempFilePaths);
  274. }
  275. });
  276. },
  277. async uploadImg(tempFilePaths) {
  278. var self = this;
  279. uni.showLoading({
  280. title: '上传中',
  281. mask: true
  282. });
  283. uni.uploadFile({
  284. url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
  285. header: {
  286. 'Authorization': uni.getStorageSync('token')
  287. },
  288. filePath: tempFilePaths,
  289. name: 'file',
  290. formData: {
  291. 'user': 'test'
  292. },
  293. success: (uploadFileRes) => {
  294. let res = JSON.parse(uploadFileRes.data);
  295. if (res.code == 200) {
  296. uni.navigateTo({
  297. url: '/pages_basics/views/avatar?src=' + config.base_url + res.data
  298. .url,
  299. });
  300. } else {
  301. uni.showToast({
  302. title: res.msg,
  303. icon: "none",
  304. mask: true,
  305. duration: 2000
  306. });
  307. }
  308. },
  309. fail: err => {},
  310. complete: () => {
  311. uni.hideLoading()
  312. }
  313. });
  314. },
  315. }
  316. }
  317. </script>
  318. <style lang="stylus" scoped>
  319. .teacherMine {
  320. flex: 1;
  321. display: flex;
  322. flex-direction: column;
  323. overflow-y: scroll;
  324. overflow-x: hidden;
  325. padding-bottom:200rpx;
  326. .back-img-box {
  327. z-index: 0;
  328. position: absolute;
  329. top: 0;
  330. left: 0;
  331. width: 750rpx;
  332. height: 291rpx;
  333. background: linear-gradient(180deg, rgba(1, 131, 250, 1) 0%, rgba(255, 255, 255, 0) 100%);
  334. }
  335. .user-info-box {
  336. z-index: 10;
  337. margin: 39rpx 24rpx 0;
  338. display: flex;
  339. .left-img-box {
  340. width: 132rpx;
  341. height: 132rpx;
  342. position: relative;
  343. margin-right: 22rpx;
  344. .avatar-img {
  345. position: absolute;
  346. top: 6rpx;
  347. left: 6rpx;
  348. width: 116rpx;
  349. height: 116rpx;
  350. border-radius: 50%;
  351. border: 2rpx solid #fff;
  352. }
  353. .edit-img {
  354. z-index: 5;
  355. position: absolute;
  356. right: 0;
  357. bottom: 6rpx;
  358. width: 40rpx;
  359. height: 40rpx;
  360. }
  361. }
  362. .right-name-box {
  363. padding-top: 6rpx;
  364. .right-name-top-box {
  365. display: flex;
  366. view:nth-child(1) {
  367. height: 68rpx;
  368. line-height: 62rpx;
  369. font-size: 32rpx;
  370. color: #fff;
  371. }
  372. view:nth-child(2) {
  373. margin-top: 14rpx;
  374. margin-left: 30rpx;
  375. width: 120rpx;
  376. height: 40rpx;
  377. line-height: 40rpx;
  378. background: #FF8C00;
  379. border-radius: 50rpx;
  380. font-size: 24rpx;
  381. color: #fff;
  382. text-align: center;
  383. }
  384. }
  385. .right-name-bottom-box {
  386. height: 50rpx;
  387. line-height: 50rpx;
  388. font-size: 28rpx;
  389. color: #fff;
  390. }
  391. }
  392. }
  393. .points-max-box {
  394. z-index: 10;
  395. width: 690rpx;
  396. height: 160rpx;
  397. background: #FFFFFF;
  398. border-radius: 20rpx;
  399. margin: 38rpx 30rpx 0;
  400. display: flex;
  401. .points-big-box {
  402. flex: 1;
  403. .num-p {
  404. margin: 39rpx 0 19rpx 0;
  405. text-align: center;
  406. font-size: 28rpx;
  407. line-height: 39rpx;
  408. }
  409. .img-box {
  410. display: flex;
  411. img {
  412. width: 30rpx;
  413. height: 30rpx;
  414. display: block;
  415. margin: 0 20rpx 0 42rpx;
  416. }
  417. view {
  418. color: #333333;
  419. line-height: 30rpx;
  420. font-size: 28rpx;
  421. }
  422. }
  423. .colorA {
  424. color: #0183FA;
  425. }
  426. .colorB {
  427. color: #26C736;
  428. }
  429. .colorC {
  430. color: #333333;
  431. }
  432. }
  433. .border-null-p {
  434. width: 1rpx;
  435. height: 40rpx;
  436. margin: 60rpx 0 0;
  437. background-color: #e0e0e0;
  438. }
  439. }
  440. .button-max-big-box {
  441. background-color: #fff;
  442. border-radius: 20rpx;
  443. margin: 20rpx 30rpx 0;
  444. .button-big-box:nth-child(1) {
  445. border-top: none;
  446. }
  447. .button-big-box {
  448. border-top: 1px solid #E0E0E0;
  449. display: flex;
  450. padding: 0 30rpx 0 26rpx;
  451. .left-img {
  452. display: block;
  453. width: 36rpx;
  454. height: 36rpx;
  455. margin-top: 25rpx;
  456. margin-right: 21rpx;
  457. }
  458. .left-text-p {
  459. flex: 1;
  460. front-size: 30rpx;
  461. line-height: 40rpx;
  462. margin: 20rpx 0;
  463. }
  464. .right-text-p {
  465. front-size: 30rpx;
  466. line-height: 40rpx;
  467. margin: 20rpx 0;
  468. }
  469. .right-img {
  470. display: block;
  471. width: 30rpx;
  472. height: 30rpx;
  473. margin-top: 28rpx;
  474. }
  475. }
  476. .color-D{
  477. color:#0183FA!important;
  478. }
  479. }
  480. .null-flex-p{
  481. flex:1;
  482. }
  483. .out-button {
  484. // position absolute;
  485. // bottom: 140rpx;
  486. // left: 75rpx;
  487. margin:20rpx 0 20rpx 75rpx;
  488. width: 600rpx;
  489. height: 80rpx;
  490. line-height: 80rpx;
  491. border-radius: 100rpx;
  492. text-align center;
  493. background #0183FA;
  494. color: #ffffff;
  495. font-size: 30rpx;
  496. }
  497. }
  498. </style>