123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461 |
- <template>
- <view class="pupilMine">
- <!-- 背景渐变色 -->
- <view class="back-img-box"></view>
- <!-- 信息面板 -->
- <view class="user-info-box">
- <view class="left-img-box">
- <img v-if="userData.avatar" class="avatar-img" :src="baseUrl+userData.avatar">
- <img v-else class="avatar-img" src="@/pages/images/icon_01.png">
- <img class="edit-img" src="@/pages/images/newImage/icon_wd_bj@1x.png">
- </view>
- <view class="right-name-box">
- <view class="right-name-top-box">
- <view>{{userData.userName}}</view>
- <view v-if="userData.status == 2 || userData.status == 3">
- {{userData.status == 2?'负面清单':(userData.status == 3?'黑名单':'')}}
- </view>
- </view>
- <view class="right-name-bottom-box">{{userData.deptName}}</view>
- </view>
- </view>
- <!-- 信用分面板 -->
- <view class="points-max-box">
- <view class="points-big-box">
- <view class="num-p colorA">{{creditScore?creditScore:'-'}}</view>
- <view class="img-box">
- <img src="@/pages/images/newImage/icon_wd_xyf@1x.png">
- <view>信用分</view>
- </view>
- </view>
- <view class="border-null-p"></view>
- <view class="points-big-box">
- <view class="num-p colorB">{{bonusPoints?bonusPoints:'-'}}</view>
- <view class="img-box">
- <img src="@/pages/images/newImage/icon_wd_jlf@1x.png">
- <view>奖励分</view>
- </view>
- </view>
- <view class="border-null-p"></view>
- <view class="points-big-box" @click="scanCode()">
- <view class="num-p colorC">扫一扫</view>
- <view class="img-box">
- <img style="margin-left:30rpx;" src="@/pages/images/newImage/icon_wd_dh@1x.png">
- <view>积分兑换</view>
- </view>
- </view>
- </view>
- <!-- 按钮部分 -->
- <view class="button-max-big-box">
- <view class="button-big-box" @click="goPage('entryAndExitRecordPupil')">
- <img class="left-img" src="@/pages/images/newImage/icon_wd_jcjl.png">
- <view class="left-text-p">进出记录</view>
- <view class="right-text-p"></view>
- <img class="right-img" src="@/pages/images/newImage/icon_wd_gd@1x.png">
- </view>
- </view>
- <view class="button-max-big-box">
- <view class="button-big-box" @click="goPage('identityAuthenticationPupil')">
- <img class="left-img" src="@/pages/images/newImage/icon_wd_sfyz@1x.png">
- <view class="left-text-p">身份验证</view>
- <view class="right-text-p"></view>
- <img class="right-img" src="@/pages/images/newImage/icon_wd_gd@1x.png">
- </view>
- <view class="button-big-box" @click="goPage('electronicSignaturePupil')">
- <img class="left-img" src="@/pages/images/newImage/icon_wd_dzqm@1x.png">
- <view class="left-text-p">电子签名</view>
- <view class="right-text-p"></view>
- <img class="right-img" src="@/pages/images/newImage/icon_wd_gd@1x.png">
- </view>
- </view>
- <view class="out-button" @click="clickOut">退出登录</view>
- <tab-bar></tab-bar>
- </view>
- </template>
- <script>
- import {
- config
- } from '@/api/request/config.js'
- import {
- logout,
- systemUserProfile,
- studentinfoFacemy,
- examPointsRecordGetMyPointsLogInfo,
- } from '@/pages/api/index.js'
- import {
- pageRestrictVerify
- } from '@/utils/index'
- import {
- tabBar
- } from '@/pages/component/tabBar.vue'
- export default {
- name: "pupilMine",
- components: {
- tabBar,
- },
- data() {
- return {
- baseUrl: config.base_url,
- userData:{},
- bonusPoints:null,
- creditScore:null,
- ifFaceFeature:false,
- isUpload:false,
- }
- },
- created() {
- },
- mounted() {
- this.systemUserProfile();
- this.studentinfoFacemy();
- this.examPointsRecordGetMyPointsLogInfo();
- },
- methods: {
- scanCode(){
- uni.scanCode({
- onlyFromCamera: true,
- success: function(res) {
- if(res.result.indexOf('mid') != -1 &&
- res.result.indexOf('sid') != -1 &&
- res.result.indexOf('pid') != -1 &&
- res.result.indexOf('pri') != -1 ){
- uni.navigateTo({
- url: '/pages_student/views/integralManage/codeSuccess?q=' +
- encodeURIComponent(JSON.stringify(res.result))
- });
- }else{
- uni.showToast({
- title: '请扫描正确的二维码',
- icon: "none",
- mask: true,
- duration: 2000
- });
- }
- }
- });
- },
- goPage(type) {
- if(!type){
- uni.showToast({
- title: '暂未开放',
- icon: "none",
- mask: true,
- duration: 2000
- });
- return
- }
- if (!pageRestrictVerify(type)) {
- uni.showToast({
- title: '没有相关权限,请联系管理员',
- icon: "none",
- mask: true,
- duration: 2000
- });
- return
- }
- if (type == 'entryAndExitRecordPupil') {
- //进出记录
- }else if (type == 'identityAuthenticationPupil') {
- //身份验证
- uni.navigateTo({
- url: "/pages_basics/views/faceImage",
- });
- } else if (type == 'electronicSignaturePupil') {
- //电子签名
- }
- },
- //获取个人信息
- async systemUserProfile() {
- const {
- data
- } = await systemUserProfile();
- if (data.code == 200) {
- this.$set(this, 'userData', data.data)
- uni.setStorageSync('faceImg', data.data.faceImg);
- }
- },
- //查询-信用分/奖励分
- async examPointsRecordGetMyPointsLogInfo() {
- const {
- data
- } = await examPointsRecordGetMyPointsLogInfo();
- if (data.code == 200) {
- this.bonusPoints = data.data.bonusPoints;
- this.creditScore = data.data.creditScore;
- }
- },
- //获取当前身份人脸验证状态与学生卡上传状态
- async studentinfoFacemy(){
- let obj = {
- studentsId:uni.getStorageSync('userId')
- }
- const {data} = await studentinfoFacemy(obj)
- if(data.code == 200){
- this.certification = data.data;
- this.ifFaceFeature = data.data.ifFaceFeature;
- }
- },
- //退出按钮
- clickOut() {
- let self = this;
- uni.showModal({
- // title: '确认要退出吗?',
- content: '确认要退出吗',
- cancelColor: "#999",
- confirmColor: "#0183FA",
- success: function(res) {
- if (res.confirm) {
- self.logout();
- } else if (res.cancel) {}
- }
- });
- },
- //退出登录
- async logout() {
- let self = this;
- const {
- data
- } = await logout();
- if (data.code == 200) {
- uni.removeStorageSync('token');
- uni.removeStorageSync('userId');
- uni.removeStorageSync('userType');
- uni.redirectTo({
- url: '/pages/views/login/login',
- });
- }
- },
- // 头像上传
- selectImage() {
- let self = this;
- wx.chooseImage({
- count: 1,
- sizeType: ["original", "compressed"],
- sourceType: ["album", "camera"],
- success: function(res) {
- let tempFilePaths = res.tempFilePaths[0];
- self.uploadImg(tempFilePaths);
- }
- });
- },
- async uploadImg(tempFilePaths) {
- var self = this;
- uni.showLoading({
- title: '上传中',
- mask: true
- });
- uni.uploadFile({
- url: config.base_url + '/system/file/upload', //仅为示例,非真实的接口地址
- header: {
- 'Authorization': uni.getStorageSync('token')
- },
- filePath: tempFilePaths,
- name: 'file',
- formData: {
- 'user': 'test'
- },
- success: (uploadFileRes) => {
- let res = JSON.parse(uploadFileRes.data);
- if (res.code == 200) {
- uni.navigateTo({
- url: '/pages_basics/views/avatar?src=' + config.base_url + res.data.url,
- });
- } else {
- uni.showToast({
- title: res.msg,
- icon: "none",
- mask: true,
- duration: 2000
- });
- }
- },
- fail: err => {},
- complete: () => {
- uni.hideLoading()
- }
- });
- },
- }
- }
- </script>
- <style lang="stylus" scoped>
- .pupilMine {
- flex: 1;
- display: flex;
- flex-direction: column;
- overflow: hidden;
- .back-img-box{
- z-index:0;
- position: absolute;
- top:0;
- left: 0;
- width:750rpx;
- height:291rpx;
- background: linear-gradient(180deg, rgba(1,131,250,1) 0%, rgba(255,255,255,0) 100%);
- }
- .user-info-box{
- z-index:10;
- margin:39rpx 24rpx 0;
- display: flex;
- .left-img-box{
- width:132rpx;
- height:132rpx;
- position: relative;
- margin-right:22rpx;
- .avatar-img{
- position: absolute;
- top:6rpx;
- left:6rpx;
- width:116rpx;
- height:116rpx;
- border-radius:50%;
- border:2rpx solid #fff;
- }
- .edit-img{
- z-index:5;
- position: absolute;
- right:0;
- bottom:6rpx;
- width:40rpx;
- height:40rpx;
- }
- }
- .right-name-box{
- padding-top:6rpx;
- .right-name-top-box{
- display: flex;
- view:nth-child(1){
- height:68rpx;
- line-height:62rpx;
- font-size:32rpx;
- color:#fff;
- }
- view:nth-child(2){
- margin-top:14rpx;
- margin-left:30rpx;
- width: 120rpx;
- height:40rpx;
- line-height:40rpx;
- background: #FF8C00;
- border-radius: 50rpx;
- font-size:24rpx;
- color:#fff;
- text-align: center;
- }
- }
- .right-name-bottom-box{
- height:50rpx;
- line-height:50rpx;
- font-size:28rpx;
- color:#fff;
- }
- }
- }
- .points-max-box{
- z-index:10;
- width: 690rpx;
- height: 160rpx;
- background: #FFFFFF;
- border-radius: 20rpx;
- margin:38rpx 30rpx 0;
- display: flex;
- .points-big-box{
- flex:1;
- .num-p{
- margin:39rpx 0 19rpx 0;
- text-align: center;
- font-size:28rpx;
- line-height:39rpx;
- }
- .img-box{
- display: flex;
- img{
- width:30rpx;
- height:30rpx;
- display: block;
- margin:0 20rpx 0 42rpx;
- }
- view{
- color:#333333;
- line-height:30rpx;
- font-size:28rpx;
- }
- }
- .colorA{
- color:#0183FA;
- }
- .colorB{
- color:#26C736;
- }
- .colorC{
- color:#333333;
- }
- }
- .border-null-p{
- width:1rpx;
- height:40rpx;
- margin:60rpx 0 0;
- background-color: #e0e0e0;
- }
- }
- .button-max-big-box{
- background-color: #fff;
- border-radius:20rpx;
- margin:20rpx 30rpx 0;
- .button-big-box:nth-child(1){
- border-top:none;
- }
- .button-big-box{
- border-top:1px solid #E0E0E0;
- display: flex;
- padding:0 30rpx 0 26rpx;
- .left-img{
- display: block;
- width:36rpx;
- height:36rpx;
- margin-top:25rpx;
- margin-right:21rpx;
- }
- .left-text-p{
- flex:1;
- front-size:30rpx;
- line-height:40rpx;
- margin:20rpx 0;
- }
- .right-text-p{
- front-size:30rpx;
- line-height:40rpx;
- margin:20rpx 0;
- }
- .right-img{
- display: block;
- width:30rpx;
- height:30rpx;
- margin-top:28rpx;
- }
- }
- }
- .out-button {
- position absolute;
- bottom: 140rpx;
- left: 75rpx;
- width: 600rpx;
- height: 80rpx;
- line-height: 80rpx;
- border-radius: 100rpx;
- text-align center;
- background #0183FA;
- color: #ffffff;
- font-size: 30rpx;
- margin: 0 auto;
- }
- }
- </style>
|