fix:头像显示不一致修复
This commit is contained in:
parent
ab34b1cd54
commit
1fe35b4c95
|
|
@ -41,8 +41,11 @@ const install = (Vue, vm) => {
|
||||||
let updateTeacherInfo = (params = {}) =>
|
let updateTeacherInfo = (params = {}) =>
|
||||||
vm.$u.post("api/BasicDataMaintenance/UpdateTeacher", params);
|
vm.$u.post("api/BasicDataMaintenance/UpdateTeacher", params);
|
||||||
|
|
||||||
let getData = (params = {}) =>
|
let getData = (params = {}) =>
|
||||||
vm.$u.get("api/BasicDataMaintenance/GetData", params);
|
vm.$u.get("api/BasicDataMaintenance/GetData", params);
|
||||||
|
// 获取排班数据
|
||||||
|
let getShiftSchedulingData = (params = {}) =>
|
||||||
|
vm.$u.get("api/BasicDataMaintenance/GetShiftSchedulingData", params);
|
||||||
|
|
||||||
// 登录
|
// 登录
|
||||||
let LoginApp = (params = {}) => vm.$u.post("api/Token/LoginApp", params);
|
let LoginApp = (params = {}) => vm.$u.post("api/Token/LoginApp", params);
|
||||||
|
|
@ -250,11 +253,12 @@ const install = (Vue, vm) => {
|
||||||
vm.$u.post("api/Dialogue/TransferToALiveAgent", params);
|
vm.$u.post("api/Dialogue/TransferToALiveAgent", params);
|
||||||
|
|
||||||
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
|
// 将各个定义的接口名称,统一放进对象挂载到vm.$u.api(因为vm就是this,也即this.$u.api)下
|
||||||
vm.$u.api = {
|
vm.$u.api = {
|
||||||
UploadSingleImage,
|
UploadSingleImage,
|
||||||
getTeacherInfo,
|
getTeacherInfo,
|
||||||
getData,
|
getData,
|
||||||
updateTeacherInfo,
|
getShiftSchedulingData,
|
||||||
|
updateTeacherInfo,
|
||||||
LoginApp,
|
LoginApp,
|
||||||
RegisterUser,
|
RegisterUser,
|
||||||
saveUserInfo,
|
saveUserInfo,
|
||||||
|
|
|
||||||
31
pages.json
31
pages.json
|
|
@ -43,18 +43,25 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"path": "pages/my/personalInfo",
|
"path": "pages/my/personalInfo",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "个人信息",
|
"navigationBarTitleText": "个人信息",
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/home/admissions/index",
|
"path": "pages/my/schedule",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "在线咨询",
|
"navigationBarTitleText": "我的排班",
|
||||||
"enablePullDownRefresh": false,
|
"navigationStyle": "custom"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/home/admissions/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "在线咨询",
|
||||||
|
"enablePullDownRefresh": false,
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -537,16 +537,26 @@ export default {
|
||||||
// 获取用户信息
|
// 获取用户信息
|
||||||
getUserInfo() {
|
getUserInfo() {
|
||||||
// 返回 Promise 以便调用方等待
|
// 返回 Promise 以便调用方等待
|
||||||
return this.$u.api.GetUserApi({ Id: this.vuex_user.Id }).then((res) => {
|
const isTeacher = Number(this.vuex_userType) === 1;
|
||||||
const data = res.data[0];
|
const apiMethod = isTeacher ? "getTeacherInfo" : "GetUserApi";
|
||||||
|
return this.$u.api[apiMethod]({ Id: this.vuex_user.Id }).then((res) => {
|
||||||
|
if (!res || !res.succeed) {
|
||||||
|
return Promise.reject(res?.error || "获取用户信息失败");
|
||||||
|
}
|
||||||
|
const data = (res.data && res.data[0]) || {};
|
||||||
const vuex_user = {
|
const vuex_user = {
|
||||||
...this.vuex_user,
|
...this.vuex_user,
|
||||||
Name: data.name,
|
Name: data.name || this.vuex_user.Name,
|
||||||
Sex: data.sex,
|
Sex: data.sex ?? this.vuex_user.Sex,
|
||||||
Shen: data.shen,
|
Shen: data.shen || this.vuex_user.Shen,
|
||||||
HeadSculptureUrl: data.headSculptureUrl,
|
HeadSculptureUrl: data.headSculptureUrl || this.vuex_user.HeadSculptureUrl,
|
||||||
|
CollegeName: data.collegeName || this.vuex_user.CollegeName,
|
||||||
|
ProfessionalName: data.professionalName || this.vuex_user.ProfessionalName,
|
||||||
};
|
};
|
||||||
this.$u.vuex("vuex_user", vuex_user);
|
this.$u.vuex("vuex_user", vuex_user);
|
||||||
|
if (isTeacher) {
|
||||||
|
this.$u.vuex("vuex_teacherInfo", data);
|
||||||
|
}
|
||||||
return vuex_user;
|
return vuex_user;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
@ -812,4 +822,3 @@ export default {
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,10 @@
|
||||||
<view class="main-content">
|
<view class="main-content">
|
||||||
<div class="user-info">
|
<div class="user-info">
|
||||||
<div class="avatar">
|
<div class="avatar">
|
||||||
<image :src="teacherInfo.headSculptureUrl" class="avatar-img"></image>
|
<u-avatar
|
||||||
|
:src="teacherInfo.headSculptureUrl"
|
||||||
|
size="148"
|
||||||
|
></u-avatar>
|
||||||
</div>
|
</div>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<div class="name">{{ teacherInfo.name }}</div>
|
<div class="name">{{ teacherInfo.name }}</div>
|
||||||
|
|
@ -48,6 +51,15 @@
|
||||||
<view class="arrow-icon">
|
<view class="arrow-icon">
|
||||||
<u-icon name="arrow-right" color="#999" size="24"></u-icon>
|
<u-icon name="arrow-right" color="#999" size="24"></u-icon>
|
||||||
</view>
|
</view>
|
||||||
|
</div>
|
||||||
|
<div class="menu-item" @click="navigateTo('working-schedule')">
|
||||||
|
<div class="menu-icon">
|
||||||
|
<image src="@/static/notes/menu4.png" class="menu-icon-img"></image>
|
||||||
|
</div>
|
||||||
|
<div class="menu-text">我的排班</div>
|
||||||
|
<view class="arrow-icon">
|
||||||
|
<u-icon name="arrow-right" color="#999" size="24"></u-icon>
|
||||||
|
</view>
|
||||||
</div>
|
</div>
|
||||||
<div class="menu-item" @click="navigateTo('change-password')">
|
<div class="menu-item" @click="navigateTo('change-password')">
|
||||||
<div class="menu-icon">
|
<div class="menu-icon">
|
||||||
|
|
@ -133,6 +145,10 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if (route === 'working-schedule') {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/my/schedule'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleTabChange(path, index) {
|
handleTabChange(path, index) {
|
||||||
|
|
@ -232,10 +248,10 @@ export default {
|
||||||
.avatar {
|
.avatar {
|
||||||
width: 148rpx;
|
width: 148rpx;
|
||||||
height: 148rpx;
|
height: 148rpx;
|
||||||
border-radius: 16rpx;
|
border-radius: 50%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin-right: 30rpx;
|
margin-right: 30rpx;
|
||||||
background-color: #ddd;
|
/* background-color: #ddd; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.avatar img {
|
.avatar img {
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ export default {
|
||||||
name: "",
|
name: "",
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
this.teacherInfo.headSculptureUrl = this.imageValue[0].url;
|
this.teacherInfo.headSculptureUrl = this.imageUrl;
|
||||||
// this.teacherInfo.avatar = this.imageValue[0].url;
|
// this.teacherInfo.avatar = this.imageValue[0].url;
|
||||||
this.$u.toast("上传成功");
|
this.$u.toast("上传成功");
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -205,7 +205,7 @@ export default {
|
||||||
const selectedCollege = res.data.find(
|
const selectedCollege = res.data.find(
|
||||||
(item) => item.label === this.teacherInfo.collegeName
|
(item) => item.label === this.teacherInfo.collegeName
|
||||||
);
|
);
|
||||||
if (selectedCollege && selectedCollege.children) {
|
if (selectedCollege) {
|
||||||
// 如果没有collegeManagementId,则设置它
|
// 如果没有collegeManagementId,则设置它
|
||||||
if (!this.teacherInfo.collegeManagementId) {
|
if (!this.teacherInfo.collegeManagementId) {
|
||||||
this.teacherInfo.collegeManagementId = selectedCollege.value;
|
this.teacherInfo.collegeManagementId = selectedCollege.value;
|
||||||
|
|
@ -238,8 +238,14 @@ export default {
|
||||||
|
|
||||||
|
|
||||||
console.log("this.teacherInfo----", this.teacherInfo);
|
console.log("this.teacherInfo----", this.teacherInfo);
|
||||||
|
const persistedInfo = this.vuex_teacherInfo || {};
|
||||||
let query = {
|
let query = {
|
||||||
|
...persistedInfo,
|
||||||
...this.teacherInfo,
|
...this.teacherInfo,
|
||||||
|
collegeName: this.teacherInfo.collegeName || persistedInfo.collegeName,
|
||||||
|
collegeManagementId:
|
||||||
|
this.teacherInfo.collegeManagementId ||
|
||||||
|
persistedInfo.collegeManagementId,
|
||||||
// schoolName: "江西新能源科技职业技术学院",
|
// schoolName: "江西新能源科技职业技术学院",
|
||||||
};
|
};
|
||||||
console.log('query',query);
|
console.log('query',query);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,300 @@
|
||||||
|
<template>
|
||||||
|
<view class="schedule-page">
|
||||||
|
<PageHeader
|
||||||
|
title="我的排班"
|
||||||
|
:is-back="true"
|
||||||
|
:border-bottom="false"
|
||||||
|
:background="headerBackground"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<view class="content-wrapper">
|
||||||
|
<view class="form-container">
|
||||||
|
<view class="form-card calendar-card">
|
||||||
|
<view class="card-title">{{ monthTitle }}</view>
|
||||||
|
<view class="week-row">
|
||||||
|
<text
|
||||||
|
v-for="(label, index) in weekLabels"
|
||||||
|
:key="index"
|
||||||
|
class="week-cell"
|
||||||
|
>
|
||||||
|
{{ label }}
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
|
<view class="date-grid">
|
||||||
|
<view
|
||||||
|
v-for="(item, index) in calendarDays"
|
||||||
|
:key="index"
|
||||||
|
class="date-cell"
|
||||||
|
:class="{
|
||||||
|
empty: !item.day,
|
||||||
|
active: item.isToday
|
||||||
|
}"
|
||||||
|
@click="handleSelectDay(item)"
|
||||||
|
>
|
||||||
|
<view class="day-number">{{ item.day }}</view>
|
||||||
|
<view v-if="item.hasDuty" class="duty-tag">值班</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="form-card duty-card">
|
||||||
|
<view class="card-title">{{ selectedDateTitle }}</view>
|
||||||
|
<view class="duty-row">
|
||||||
|
<text class="duty-label">今日排班:</text>
|
||||||
|
<text class="duty-value">{{ isSelectedDuty ? "值班" : "无" }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import PageHeader from "@/components/PageHeader.vue";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "MySchedule",
|
||||||
|
components: {
|
||||||
|
PageHeader,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
headerBackground: {
|
||||||
|
background: "transparent",
|
||||||
|
},
|
||||||
|
weekLabels: ["日", "一", "二", "三", "四", "五", "六"],
|
||||||
|
currentYear: 0,
|
||||||
|
currentMonth: 0,
|
||||||
|
selectedDay: 0,
|
||||||
|
scheduleList: [],
|
||||||
|
calendarDays: [],
|
||||||
|
};
|
||||||
|
},
|
||||||
|
onLoad() {
|
||||||
|
const today = new Date();
|
||||||
|
this.currentYear = today.getFullYear();
|
||||||
|
this.currentMonth = today.getMonth() + 1;
|
||||||
|
this.selectedDay = today.getDate();
|
||||||
|
this.calendarDays = this.buildCalendarDays(this.currentYear, this.currentMonth, []);
|
||||||
|
this.fetchSchedule();
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
monthTitle() {
|
||||||
|
return `${this.currentYear}年${String(this.currentMonth).padStart(2, "0")}月`;
|
||||||
|
},
|
||||||
|
selectedDateTitle() {
|
||||||
|
const dayText = String(this.selectedDay).padStart(2, "0");
|
||||||
|
return `${this.currentYear}年${String(this.currentMonth).padStart(2, "0")}月${dayText}日`;
|
||||||
|
},
|
||||||
|
isSelectedDuty() {
|
||||||
|
return this.scheduleList.some((item) => {
|
||||||
|
return (
|
||||||
|
item.year === this.currentYear &&
|
||||||
|
item.month === this.currentMonth &&
|
||||||
|
item.day === this.selectedDay
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
fetchSchedule() {
|
||||||
|
const userInfo = this.vuex_user || {};
|
||||||
|
const teacherId = userInfo.id || userInfo.Id;
|
||||||
|
if (!teacherId) {
|
||||||
|
this.$u.toast("缺少教师ID");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.$u.api
|
||||||
|
.getShiftSchedulingData({
|
||||||
|
SchedulingTime: new Date().toISOString(),
|
||||||
|
TeacherManagementId: teacherId,
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
if (res && res.succeed) {
|
||||||
|
const list = Array.isArray(res.data) ? res.data : [];
|
||||||
|
this.scheduleList = list
|
||||||
|
.map((item) => this.parseScheduleItem(item))
|
||||||
|
.filter(Boolean);
|
||||||
|
this.calendarDays = this.buildCalendarDays(
|
||||||
|
this.currentYear,
|
||||||
|
this.currentMonth,
|
||||||
|
this.scheduleList
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.$u.toast(res?.error || "获取排班失败");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.$u.toast("获取排班失败");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
parseScheduleItem(item) {
|
||||||
|
if (!item || !item.schedulingTime) return null;
|
||||||
|
const date = new Date(item.schedulingTime);
|
||||||
|
if (Number.isNaN(date.getTime())) return null;
|
||||||
|
return {
|
||||||
|
id: item.id,
|
||||||
|
year: date.getFullYear(),
|
||||||
|
month: date.getMonth() + 1,
|
||||||
|
day: date.getDate(),
|
||||||
|
};
|
||||||
|
},
|
||||||
|
buildCalendarDays(year, month, scheduleList = []) {
|
||||||
|
const firstDay = new Date(year, month - 1, 1).getDay();
|
||||||
|
const daysInMonth = new Date(year, month, 0).getDate();
|
||||||
|
const totalCells = 42;
|
||||||
|
const result = [];
|
||||||
|
const dutySet = new Set(
|
||||||
|
scheduleList
|
||||||
|
.filter((item) => item.year === year && item.month === month)
|
||||||
|
.map((item) => item.day)
|
||||||
|
);
|
||||||
|
|
||||||
|
for (let i = 0; i < totalCells; i += 1) {
|
||||||
|
const dayNumber = i - firstDay + 1;
|
||||||
|
if (dayNumber <= 0 || dayNumber > daysInMonth) {
|
||||||
|
result.push({ day: "", isToday: false, hasDuty: false });
|
||||||
|
} else {
|
||||||
|
result.push({
|
||||||
|
day: dayNumber,
|
||||||
|
isToday:
|
||||||
|
dayNumber === this.selectedDay &&
|
||||||
|
year === this.currentYear &&
|
||||||
|
month === this.currentMonth,
|
||||||
|
hasDuty: dutySet.has(dayNumber),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
handleSelectDay(item) {
|
||||||
|
if (!item || !item.day) return;
|
||||||
|
this.selectedDay = item.day;
|
||||||
|
this.calendarDays = this.buildCalendarDays(
|
||||||
|
this.currentYear,
|
||||||
|
this.currentMonth,
|
||||||
|
this.scheduleList
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.schedule-page {
|
||||||
|
height: 100vh;
|
||||||
|
background-image: url("@/static/notes/bg.png");
|
||||||
|
background-position: center top;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
background-size: 100% auto;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-wrapper {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding: 20rpx 30rpx 60px;
|
||||||
|
overflow: hidden;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-container {
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-top: 46rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-card {
|
||||||
|
background-color: #ffffff;
|
||||||
|
border-radius: 20rpx;
|
||||||
|
padding: 30rpx;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-title {
|
||||||
|
font-size: 30rpx;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333333;
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.week-row {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(7, 1fr);
|
||||||
|
margin-bottom: 12rpx;
|
||||||
|
color: #999999;
|
||||||
|
font-size: 22rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.week-cell {
|
||||||
|
line-height: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.date-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(7, 1fr);
|
||||||
|
gap: 12rpx 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.date-cell {
|
||||||
|
height: 82rpx;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: flex-start;
|
||||||
|
position: relative;
|
||||||
|
padding-top: 8rpx;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.date-cell.empty {
|
||||||
|
color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.day-number {
|
||||||
|
width: 48rpx;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #333333;
|
||||||
|
line-height: 32rpx;
|
||||||
|
height: 32rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.date-cell.active .day-number {
|
||||||
|
height: 32rpx;
|
||||||
|
line-height: 32rpx;
|
||||||
|
background-color: #4f6aff;
|
||||||
|
color: #ffffff;
|
||||||
|
border-radius: 8rpx;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.duty-tag {
|
||||||
|
margin-top: 6rpx;
|
||||||
|
font-size: 18rpx;
|
||||||
|
color: #4f6aff;
|
||||||
|
line-height: 22rpx;
|
||||||
|
height: 22rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.duty-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 26rpx;
|
||||||
|
color: #333333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.duty-label {
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.duty-value {
|
||||||
|
color: #4f6aff;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 733 B |
Loading…
Reference in New Issue