Commit 5b38eb73 authored by lvtz's avatar lvtz

fix

parents 8579974a 93a3d0cb
......@@ -21,6 +21,10 @@ import {
getAccountList,
getMemberMe
} from '../../../service/common.js';
import {
studentidentity,
identityswitch,
} from "../../../service/customer/signup.js";
import apis from '../../../constants/api.js';
import permissionUtils from '../../../utilities/permission.js';
var app = getApp();
......@@ -51,6 +55,7 @@ Page({
page: 1,
perPage: 10,
currole: 1, // 1从个人中心进入 标记学生身份 2从工作台切换身份 标记老师身份
studentId: 0,
},
/**
* 生命周期函数--监听页面加载
......@@ -68,9 +73,9 @@ Page({
wx.showLoading({
title: '数据加载中'
})
this.getStudentSchoolList();
this.getTeacherSchoolList();
this.getMasterSchoolList();
this.getTeacherSchoolList();
this.getStudentSchoolList();
},
tabShift (e) {
const { tab } = e.currentTarget.dataset;
......@@ -210,6 +215,7 @@ Page({
this.setData({
studentSchoolList: res.data.list
})
this.userShow();
}
}).catch(() => {
wx.hideLoading();
......@@ -232,6 +238,22 @@ Page({
});
return _length;
},
userShow() {
studentidentity({
school_id: this.data.sid
})
.then(res => {
const { data, code } = res;
if (code == 200 && data) {
this.setData({
studentId: data.student_id
})
} else {
}
})
.catch(err => {
});
},
getHistorySchoolList(type) {
if (!this.data.hasmore) {
return;
......@@ -243,8 +265,8 @@ Page({
listLoading: true
});
historySchoolList({
page: 1,
perPage: 10
page: this.data.page,
perPage: this.data.perPage
}).then(res => {
const { code, data } = res;
this.setData({
......@@ -333,10 +355,36 @@ Page({
const {
item
} = e.currentTarget.dataset;
console.log(item)
wx.reLaunch({
url: `/ucenter/index?sid=${item.school_id}`
identityswitch({
school_id: item.school_id,
student_id: item.id
})
.then(res => {
const { data, code } = res;
if (code == 200) {
const visitor = LocalStorage.getItem("visitor");
Object.assign(visitor, {
studentId: item.id
});
LocalStorage.setItem("visitor", visitor);
wx.reLaunch({
url: `/ucenter/index?sid=${item.school_id}`
})
} else {
wx.showToast({
title: "切换失败",
icon: "none",
duration: 2000
});
}
})
.catch(res => {
wx.showToast({
title: "切换失败",
icon: "none",
duration: 2000
});
});
},
goWebsite(e) {
const {
......
......@@ -49,7 +49,7 @@
<view class="rolebox" wx:for="{{studentSchoolList}}" wx:key="id" wx:for-item="studentschool" data-item="{{studentschool}}" bindtap="goUcenter">
<view class="leftbox">
<image class="schoolavatar" src="{{filter.imagify(studentschool.avatar)}}" />
<view class="schoolname {{currole == 1 && sid == studentschool.school_id ? 'short' : ''}}">
<view class="schoolname {{currole == 1 && sid == studentschool.school_id && studentId == studentschool.id ? 'short' : ''}}">
<view class="schoolnametext">
{{studentschool.school.title}}
</view>
......@@ -58,7 +58,7 @@
</view>
</view>
</view>
<view class="currenttag" wx:if="{{currole == 1 && sid == studentschool.school_id}}">您当前身份</view>
<view class="currenttag" wx:if="{{currole == 1 && sid == studentschool.school_id && studentId == studentschool.id}}">您当前身份</view>
</view>
</view>
<view class="boxwrap operatebox" bindtap="goLogin">
......
......@@ -10,7 +10,7 @@
</view>
<view class="info-box">
<view class="name">{{nickName}}</view>
<view class="roletag" wx:if="{{type == 1}}">老师</view>
<view class="roletag {{type == 1 ? 'teacher' : ''}}" wx:if="{{type == 1}}">老师</view>
<view class="roletag" wx:if="{{type == 2}}">校长</view>
</view>
<view class="right">
......
......@@ -55,6 +55,11 @@ page{
display: inline-block;
padding: 0 7rpx;
}
.header-box .top-box .info-box .roletag.teacher {
color: #FF9F49;
background-color: #FFF2E7;
border: 1px solid rgba(255,159,73,1);
}
.header-box .top-box .info-box .name{
font-size:28rpx;
font-family:PingFang SC;
......
......@@ -113,12 +113,12 @@
<text class="title" bindtap="feedbackLog">意见反馈</text>
<text class="desc">不好用就吐槽</text>
</navigator>
<view class="menu-item" wx:if="{{cSchoolTotal > 0}}" bindtap="exchangeSchool">
<!-- <view class="menu-item" wx:if="{{cSchoolTotal > 0}}" bindtap="exchangeSchool">
<loginbtn loginCode="{{loginCode}}"/>
<image class="menuicon" src="{{imageRoot}}2c/ucenter2/icon_exchangeschool.png?{{imageVersion}}"></image>
<text class="title">切换校区</text>
<text class="desc"></text>
</view>
</view> -->
<view class="menu-item">
<loginbtn loginCode="{{loginCode}}"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment