fix:我的页码样式修改
This commit is contained in:
parent
76fc04f758
commit
aba6baf584
|
|
@ -27,23 +27,42 @@
|
||||||
:src="receiverHeadSculptureUrl"
|
:src="receiverHeadSculptureUrl"
|
||||||
></image>
|
></image>
|
||||||
<div class="teacher-info">
|
<div class="teacher-info">
|
||||||
|
<div class="teacher-name-row">
|
||||||
<div class="teacher-name">{{ vuex_msgUser.name }}</div>
|
<div class="teacher-name">{{ vuex_msgUser.name }}</div>
|
||||||
|
<image
|
||||||
|
v-if="vuex_msgUser.sex === 0"
|
||||||
|
class="sex-icon"
|
||||||
|
src="@/static/common/images/sex-male.png"
|
||||||
|
></image>
|
||||||
|
<image
|
||||||
|
v-else-if="vuex_msgUser.sex === 1"
|
||||||
|
class="sex-icon"
|
||||||
|
src="@/static/common/images/sex-female.png"
|
||||||
|
></image>
|
||||||
|
</div>
|
||||||
|
<div class="teacher-location">
|
||||||
|
<image class="location-icon" src="@/static/common/images/location.png">
|
||||||
|
</image>
|
||||||
|
<text class="location-text">
|
||||||
|
归属地: <span style="font-weight: bold;">{{vuex_msgUser.shen}}</span>
|
||||||
|
</text>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="teacher-school">
|
<!-- <div class="teacher-school">
|
||||||
<image
|
<image
|
||||||
class="school-icon"
|
class="school-icon"
|
||||||
src="/static/common/images/icon_college.png"
|
src="/static/common/images/icon_college.png"
|
||||||
></image>
|
></image>
|
||||||
<text class="school-text">{{ vuex_msgUser.collegeName }}</text>
|
<text class="school-text">{{ vuex_msgUser.collegeName }}</text>
|
||||||
</div>
|
</div> -->
|
||||||
|
|
||||||
<div class="teacher-college">
|
<!-- <div class="teacher-college">
|
||||||
<image
|
<image
|
||||||
class="college-icon"
|
class="college-icon"
|
||||||
src="/static/common/images/icon_major.png"
|
src="/static/common/images/icon_major.png"
|
||||||
></image>
|
></image>
|
||||||
<text class="college-text">{{ vuex_msgUser.collegeName }}</text>
|
<text class="college-text">{{ vuex_msgUser.collegeName }}</text>
|
||||||
</div>
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -456,14 +475,25 @@ export default {
|
||||||
font-size: 36rpx;
|
font-size: 36rpx;
|
||||||
color: #333333;
|
color: #333333;
|
||||||
}
|
}
|
||||||
|
.teacher-name-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12rpx;
|
||||||
|
}
|
||||||
|
.sex-icon {
|
||||||
|
width: 28rpx;
|
||||||
|
height: 28rpx;
|
||||||
|
}
|
||||||
|
|
||||||
.teacher-school,
|
.teacher-school,
|
||||||
.teacher-college {
|
.teacher-college,
|
||||||
|
.teacher-location {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
||||||
.school-icon,
|
.school-icon,
|
||||||
.college-icon {
|
.college-icon,
|
||||||
|
.location-icon {
|
||||||
margin-right: 16rpx;
|
margin-right: 16rpx;
|
||||||
width: 24rpx;
|
width: 24rpx;
|
||||||
height: 24rpx;
|
height: 24rpx;
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<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.avatar" class="avatar-img"></image>
|
<image :src="teacherInfo.headSculptureUrl" class="avatar-img"></image>
|
||||||
</div>
|
</div>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<div class="name">{{ teacherInfo.name }}</div>
|
<div class="name">{{ teacherInfo.name }}</div>
|
||||||
|
|
@ -93,10 +93,10 @@ export default {
|
||||||
background: "transparent",
|
background: "transparent",
|
||||||
},
|
},
|
||||||
teacherInfo: {
|
teacherInfo: {
|
||||||
name:'孙老师',
|
name:'',
|
||||||
collegeName:'生命科学与工程学院·生物工程专业',
|
collegeName:'',
|
||||||
professionalName:'生物工程专业',
|
professionalName:'',
|
||||||
avatar:'/static/common/images/avatar_default.jpg',
|
headSculptureUrl:'/static/common/images/avatar_default.jpg',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
@ -139,10 +139,18 @@ export default {
|
||||||
console.log("切换到标签页:", path, index);
|
console.log("切换到标签页:", path, index);
|
||||||
},
|
},
|
||||||
getTeacherInfo() {
|
getTeacherInfo() {
|
||||||
|
const userInfo = this.vuex_user || {};
|
||||||
|
console.log("userInfo:", userInfo);
|
||||||
|
const userId = userInfo.id || userInfo.Id;
|
||||||
|
if (!userId) {
|
||||||
|
console.warn("getTeacherInfo 缺少用户Id");
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.$u.api
|
this.$u.api
|
||||||
.getTeacherInfo({ Id: "b5269ed1-5bc8-11f0-9a89-00163e2d2dd3" })
|
.getTeacherInfo({ Id: userId })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.teacherInfo = res.data[0];
|
const info = (res && res.data && res.data[0]) || {};
|
||||||
|
this.teacherInfo = { ...this.teacherInfo, ...info };
|
||||||
this.$u.vuex("vuex_teacherInfo", this.teacherInfo);
|
this.$u.vuex("vuex_teacherInfo", this.teacherInfo);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,20 @@
|
||||||
<div class="form-item">
|
<div class="form-item">
|
||||||
<div class="form-label">头像</div>
|
<div class="form-label">头像</div>
|
||||||
<div class="form-value">
|
<div class="form-value">
|
||||||
<image
|
<div>
|
||||||
class="avatar"
|
<uni-file-picker
|
||||||
:src="teacherInfo.avatar || '@/static/notes/default-avatar.png'"
|
v-model="imageValue"
|
||||||
mode="aspectFill"
|
limit="1"
|
||||||
></image>
|
:del-icon="false"
|
||||||
|
disable-preview
|
||||||
|
:imageStyles="imageStyles"
|
||||||
|
file-mediatype="image"
|
||||||
|
style="font-size: 12rpx;margin-left: auto;"
|
||||||
|
@select="onSelect"
|
||||||
|
>
|
||||||
|
<text></text>
|
||||||
|
</uni-file-picker>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -34,7 +43,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-merge">
|
<div class="form-merge">
|
||||||
<div class="form-item-merge">
|
<!-- <div class="form-item-merge">
|
||||||
<div class="form-label">所属学校</div>
|
<div class="form-label">所属学校</div>
|
||||||
<div class="form-value">
|
<div class="form-value">
|
||||||
<u-input
|
<u-input
|
||||||
|
|
@ -46,36 +55,15 @@
|
||||||
:disabled="true"
|
:disabled="true"
|
||||||
></u-input>
|
></u-input>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
<div class="line" style="height: 1px"></div>
|
<div class="line" style="height: 1px"></div>
|
||||||
<div class="form-item-merge">
|
<div class="form-item-merge">
|
||||||
<div class="form-label">学院</div>
|
<div class="form-label">部门</div>
|
||||||
<div class="form-value" @click="showCollegePicker = true">
|
<div class="form-value" @click="showCollegePicker = true">
|
||||||
{{ teacherInfo.collegeName || "请选择学院" }}
|
{{ teacherInfo.collegeName || "请选择部门" }}
|
||||||
<u-icon name="arrow-right" color="#999" size="24"></u-icon>
|
<u-icon name="arrow-right" color="#999" size="24"></u-icon>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="line" style="height: 1px"></div>
|
|
||||||
<div class="form-item-merge">
|
|
||||||
<div class="form-label">专业</div>
|
|
||||||
<div class="form-value" @click="showMajorPicker = true">
|
|
||||||
{{ teacherInfo.professionalName || "请选择专业" }}
|
|
||||||
<u-icon name="arrow-right" color="#999" size="24"></u-icon>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="line" style="height: 1px"></div>
|
|
||||||
<div class="form-item-merge">
|
|
||||||
<div class="form-label">岗位</div>
|
|
||||||
<div class="form-value">
|
|
||||||
<u-input
|
|
||||||
v-model="teacherInfo.post"
|
|
||||||
:border="false"
|
|
||||||
placeholder="请输入岗位"
|
|
||||||
:clearable="false"
|
|
||||||
:custom-style="{ textAlign: 'right' }"
|
|
||||||
></u-input>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -86,13 +74,6 @@
|
||||||
:list="collegeList"
|
:list="collegeList"
|
||||||
@confirm="confirmCollege"
|
@confirm="confirmCollege"
|
||||||
></u-select>
|
></u-select>
|
||||||
|
|
||||||
<!-- 专业选择器 -->
|
|
||||||
<u-select
|
|
||||||
v-model="showMajorPicker"
|
|
||||||
:list="majorList"
|
|
||||||
@confirm="confirmMajor"
|
|
||||||
></u-select>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
@ -106,36 +87,101 @@ export default {
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
baseUrl: "",
|
||||||
|
imageUrl: "",
|
||||||
|
imageValue: [],
|
||||||
|
imageStyles: {
|
||||||
|
width: 52,
|
||||||
|
height: 52,
|
||||||
|
border: {
|
||||||
|
radius: "50%",
|
||||||
|
},
|
||||||
|
},
|
||||||
teacherInfo: {
|
teacherInfo: {
|
||||||
name: "",
|
name: "",
|
||||||
id: "",
|
id: "",
|
||||||
collegeName: "",
|
collegeName: "",
|
||||||
professionalName: "",
|
|
||||||
post: "",
|
|
||||||
collegeManagementId: "",
|
collegeManagementId: "",
|
||||||
professionalManagementId: "",
|
|
||||||
schoolName: ""
|
schoolName: ""
|
||||||
},
|
},
|
||||||
headerBackground: {
|
headerBackground: {
|
||||||
background: "transparent",
|
background: "transparent",
|
||||||
},
|
},
|
||||||
showCollegePicker: false,
|
showCollegePicker: false,
|
||||||
showMajorPicker: false,
|
|
||||||
collegeList: [],
|
collegeList: [],
|
||||||
majorList: [],
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLoad() {
|
onLoad() {
|
||||||
// 从vuex获取教师信息
|
// 从vuex获取教师信息
|
||||||
const info = this.vuex_teacherInfo || {};
|
const info = this.vuex_teacherInfo || {};
|
||||||
|
this.baseUrl = this.$u.http.config.baseUrl;
|
||||||
this.teacherInfo = {
|
this.teacherInfo = {
|
||||||
...info,
|
...info,
|
||||||
schoolName: "江西新能源科技职业技术学院",
|
|
||||||
};
|
};
|
||||||
|
this.initAvatar(info);
|
||||||
|
|
||||||
this.getSchoolInfo();
|
this.getSchoolInfo();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
initAvatar(info) {
|
||||||
|
const rawUrl = info.headSculptureUrl || info.avatar || "";
|
||||||
|
const displayUrl = this.buildAvatarUrl(rawUrl);
|
||||||
|
if (displayUrl) {
|
||||||
|
this.imageValue = [
|
||||||
|
{
|
||||||
|
url: displayUrl,
|
||||||
|
extname: "",
|
||||||
|
name: "",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
if (info.headSculptureUrl) {
|
||||||
|
this.imageUrl = info.headSculptureUrl;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// 拼装头像地址,兼容相对路径
|
||||||
|
buildAvatarUrl(url) {
|
||||||
|
const fallback = "/static/common/images/avatar_default.jpg";
|
||||||
|
if (!url) return fallback;
|
||||||
|
if (/^https?:\/\//i.test(url)) return url;
|
||||||
|
const baseUrl = this.baseUrl || this.$u?.http?.config?.baseUrl || "";
|
||||||
|
if (baseUrl) return `${baseUrl}/${url}`;
|
||||||
|
return url.startsWith("/") ? url : `/${url}`;
|
||||||
|
},
|
||||||
|
// 获取上传状态
|
||||||
|
onSelect(data) {
|
||||||
|
const file = (data && data.tempFiles && data.tempFiles[0]) || {};
|
||||||
|
const filePath =
|
||||||
|
file.path || file.url || (file.image && file.image.location);
|
||||||
|
if (!filePath) {
|
||||||
|
this.$u.toast("无法获取文件路径");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$u.api
|
||||||
|
.UploadSingleImage({
|
||||||
|
filePath,
|
||||||
|
name: "file",
|
||||||
|
formData: {},
|
||||||
|
})
|
||||||
|
.then((res) => {
|
||||||
|
if (res.succeed) {
|
||||||
|
this.imageUrl = res.data.replace(/\\/g, "/") || "";
|
||||||
|
this.imageValue = [
|
||||||
|
{
|
||||||
|
url: `${this.baseUrl}/${this.imageUrl}`,
|
||||||
|
extname: file.extname || "",
|
||||||
|
name: "",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
this.teacherInfo.headSculptureUrl = this.imageValue[0].url;
|
||||||
|
// this.teacherInfo.avatar = this.imageValue[0].url;
|
||||||
|
this.$u.toast("上传成功");
|
||||||
|
} else {
|
||||||
|
this.$u.toast(res.error || "上传失败");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
// 获取学院和专业信息
|
// 获取学院和专业信息
|
||||||
getSchoolInfo() {
|
getSchoolInfo() {
|
||||||
this.$u.api.getData().then((res) => {
|
this.$u.api.getData().then((res) => {
|
||||||
|
|
@ -154,33 +200,16 @@ export default {
|
||||||
label: item.label,
|
label: item.label,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
// 设置初始专业列表为第一个学院的专业
|
// 如果已有选择的学院,则设置对应的学院ID
|
||||||
if (res.data[0].children && res.data[0].children.length > 0) {
|
|
||||||
this.majorList = res.data[0].children;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 如果已有选择的学院,则设置对应的专业列表
|
|
||||||
if (this.teacherInfo.collegeName) {
|
if (this.teacherInfo.collegeName) {
|
||||||
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 && selectedCollege.children) {
|
||||||
this.majorList = selectedCollege.children;
|
|
||||||
|
|
||||||
// 如果没有collegeManagementId,则设置它
|
// 如果没有collegeManagementId,则设置它
|
||||||
if (!this.teacherInfo.collegeManagementId) {
|
if (!this.teacherInfo.collegeManagementId) {
|
||||||
this.teacherInfo.collegeManagementId = selectedCollege.value;
|
this.teacherInfo.collegeManagementId = selectedCollege.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果有专业名称但没有专业ID,则设置专业ID
|
|
||||||
if (this.teacherInfo.professionalName && !this.teacherInfo.professionalManagementId) {
|
|
||||||
const selectedMajor = selectedCollege.children.find(
|
|
||||||
(item) => item.label === this.teacherInfo.professionalName
|
|
||||||
);
|
|
||||||
if (selectedMajor) {
|
|
||||||
this.teacherInfo.professionalManagementId = selectedMajor.value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -190,27 +219,6 @@ export default {
|
||||||
confirmCollege(e) {
|
confirmCollege(e) {
|
||||||
this.teacherInfo.collegeName = e[0].label;
|
this.teacherInfo.collegeName = e[0].label;
|
||||||
this.teacherInfo.collegeManagementId = e[0].value;
|
this.teacherInfo.collegeManagementId = e[0].value;
|
||||||
|
|
||||||
// 根据选中的学院更新专业列表
|
|
||||||
this.$u.api.getData().then((res) => {
|
|
||||||
if (res.succeed && res.data) {
|
|
||||||
const selectedCollege = res.data.find(
|
|
||||||
(item) => item.label === this.teacherInfo.collegeName
|
|
||||||
);
|
|
||||||
|
|
||||||
if (selectedCollege && selectedCollege.children) {
|
|
||||||
this.majorList = selectedCollege.children;
|
|
||||||
// 清空之前选择的专业
|
|
||||||
this.teacherInfo.professionalName = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
// 确认专业选择
|
|
||||||
confirmMajor(e) {
|
|
||||||
this.teacherInfo.professionalName = e[0].label;
|
|
||||||
this.teacherInfo.professionalManagementId = e[0].value;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// 保存个人信息
|
// 保存个人信息
|
||||||
|
|
@ -219,26 +227,22 @@ export default {
|
||||||
if (!this.teacherInfo.name) {
|
if (!this.teacherInfo.name) {
|
||||||
return this.$u.toast("请输入姓名");
|
return this.$u.toast("请输入姓名");
|
||||||
}
|
}
|
||||||
if (!this.teacherInfo.schoolName) {
|
// if (!this.teacherInfo.schoolName) {
|
||||||
return this.$u.toast("请输入学校名称");
|
// return this.$u.toast("请输入学校名称");
|
||||||
}
|
// }
|
||||||
if (!this.teacherInfo.collegeName) {
|
if (!this.teacherInfo.collegeName) {
|
||||||
return this.$u.toast("请选择学院");
|
return this.$u.toast("请选择学院");
|
||||||
}
|
}
|
||||||
if (!this.teacherInfo.professionalName) {
|
|
||||||
return this.$u.toast("请选择专业");
|
|
||||||
}
|
|
||||||
if (!this.teacherInfo.post) {
|
|
||||||
return this.$u.toast("请输入岗位");
|
|
||||||
}
|
|
||||||
|
|
||||||
this.$u.vuex("vuex_teacherInfo", this.teacherInfo);
|
this.$u.vuex("vuex_teacherInfo", this.teacherInfo);
|
||||||
|
|
||||||
|
|
||||||
console.log("this.teacherInfo----", this.teacherInfo);
|
console.log("this.teacherInfo----", this.teacherInfo);
|
||||||
let query = {
|
let query = {
|
||||||
...this.teacherInfo,
|
...this.teacherInfo,
|
||||||
schoolName: "江西新能源科技职业技术学院",
|
// schoolName: "江西新能源科技职业技术学院",
|
||||||
};
|
};
|
||||||
|
console.log('query',query);
|
||||||
this.$u.api
|
this.$u.api
|
||||||
.updateTeacherInfo(query)
|
.updateTeacherInfo(query)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 891 B |
Binary file not shown.
|
After Width: | Height: | Size: 1023 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
|
|
@ -12,6 +12,7 @@ try {
|
||||||
|
|
||||||
// 需要永久存储,且下次APP启动需要取出的,在state中的变量名
|
// 需要永久存储,且下次APP启动需要取出的,在state中的变量名
|
||||||
let saveStateKeys = [
|
let saveStateKeys = [
|
||||||
|
"vuex_teacherInfo",
|
||||||
"vuex_user",
|
"vuex_user",
|
||||||
"vuex_token",
|
"vuex_token",
|
||||||
"vuex_userType",
|
"vuex_userType",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue