fix:我的页码样式修改
This commit is contained in:
parent
76fc04f758
commit
aba6baf584
|
|
@ -27,23 +27,42 @@
|
|||
:src="receiverHeadSculptureUrl"
|
||||
></image>
|
||||
<div class="teacher-info">
|
||||
<div class="teacher-name-row">
|
||||
<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
|
||||
class="school-icon"
|
||||
src="/static/common/images/icon_college.png"
|
||||
></image>
|
||||
<text class="school-text">{{ vuex_msgUser.collegeName }}</text>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="teacher-college">
|
||||
<!-- <div class="teacher-college">
|
||||
<image
|
||||
class="college-icon"
|
||||
src="/static/common/images/icon_major.png"
|
||||
></image>
|
||||
<text class="college-text">{{ vuex_msgUser.collegeName }}</text>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
@ -456,14 +475,25 @@ export default {
|
|||
font-size: 36rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.teacher-name-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12rpx;
|
||||
}
|
||||
.sex-icon {
|
||||
width: 28rpx;
|
||||
height: 28rpx;
|
||||
}
|
||||
|
||||
.teacher-school,
|
||||
.teacher-college {
|
||||
.teacher-college,
|
||||
.teacher-location {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
.school-icon,
|
||||
.college-icon {
|
||||
.college-icon,
|
||||
.location-icon {
|
||||
margin-right: 16rpx;
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<view class="main-content">
|
||||
<div class="user-info">
|
||||
<div class="avatar">
|
||||
<image :src="teacherInfo.avatar" class="avatar-img"></image>
|
||||
<image :src="teacherInfo.headSculptureUrl" class="avatar-img"></image>
|
||||
</div>
|
||||
<div class="info">
|
||||
<div class="name">{{ teacherInfo.name }}</div>
|
||||
|
|
@ -93,10 +93,10 @@ export default {
|
|||
background: "transparent",
|
||||
},
|
||||
teacherInfo: {
|
||||
name:'孙老师',
|
||||
collegeName:'生命科学与工程学院·生物工程专业',
|
||||
professionalName:'生物工程专业',
|
||||
avatar:'/static/common/images/avatar_default.jpg',
|
||||
name:'',
|
||||
collegeName:'',
|
||||
professionalName:'',
|
||||
headSculptureUrl:'/static/common/images/avatar_default.jpg',
|
||||
},
|
||||
};
|
||||
},
|
||||
|
|
@ -139,10 +139,18 @@ export default {
|
|||
console.log("切换到标签页:", path, index);
|
||||
},
|
||||
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
|
||||
.getTeacherInfo({ Id: "b5269ed1-5bc8-11f0-9a89-00163e2d2dd3" })
|
||||
.getTeacherInfo({ Id: userId })
|
||||
.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);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,11 +12,20 @@
|
|||
<div class="form-item">
|
||||
<div class="form-label">头像</div>
|
||||
<div class="form-value">
|
||||
<image
|
||||
class="avatar"
|
||||
:src="teacherInfo.avatar || '@/static/notes/default-avatar.png'"
|
||||
mode="aspectFill"
|
||||
></image>
|
||||
<div>
|
||||
<uni-file-picker
|
||||
v-model="imageValue"
|
||||
limit="1"
|
||||
: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>
|
||||
|
||||
|
|
@ -34,7 +43,7 @@
|
|||
</div>
|
||||
|
||||
<div class="form-merge">
|
||||
<div class="form-item-merge">
|
||||
<!-- <div class="form-item-merge">
|
||||
<div class="form-label">所属学校</div>
|
||||
<div class="form-value">
|
||||
<u-input
|
||||
|
|
@ -46,36 +55,15 @@
|
|||
:disabled="true"
|
||||
></u-input>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="line" style="height: 1px"></div>
|
||||
<div class="form-item-merge">
|
||||
<div class="form-label">学院</div>
|
||||
<div class="form-label">部门</div>
|
||||
<div class="form-value" @click="showCollegePicker = true">
|
||||
{{ teacherInfo.collegeName || "请选择学院" }}
|
||||
{{ teacherInfo.collegeName || "请选择部门" }}
|
||||
<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" @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>
|
||||
|
|
@ -86,13 +74,6 @@
|
|||
:list="collegeList"
|
||||
@confirm="confirmCollege"
|
||||
></u-select>
|
||||
|
||||
<!-- 专业选择器 -->
|
||||
<u-select
|
||||
v-model="showMajorPicker"
|
||||
:list="majorList"
|
||||
@confirm="confirmMajor"
|
||||
></u-select>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -106,36 +87,101 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
baseUrl: "",
|
||||
imageUrl: "",
|
||||
imageValue: [],
|
||||
imageStyles: {
|
||||
width: 52,
|
||||
height: 52,
|
||||
border: {
|
||||
radius: "50%",
|
||||
},
|
||||
},
|
||||
teacherInfo: {
|
||||
name: "",
|
||||
id: "",
|
||||
collegeName: "",
|
||||
professionalName: "",
|
||||
post: "",
|
||||
collegeManagementId: "",
|
||||
professionalManagementId: "",
|
||||
schoolName: ""
|
||||
},
|
||||
headerBackground: {
|
||||
background: "transparent",
|
||||
},
|
||||
showCollegePicker: false,
|
||||
showMajorPicker: false,
|
||||
collegeList: [],
|
||||
majorList: [],
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
// 从vuex获取教师信息
|
||||
const info = this.vuex_teacherInfo || {};
|
||||
this.baseUrl = this.$u.http.config.baseUrl;
|
||||
this.teacherInfo = {
|
||||
...info,
|
||||
schoolName: "江西新能源科技职业技术学院",
|
||||
};
|
||||
this.initAvatar(info);
|
||||
|
||||
this.getSchoolInfo();
|
||||
},
|
||||
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() {
|
||||
this.$u.api.getData().then((res) => {
|
||||
|
|
@ -154,33 +200,16 @@ export default {
|
|||
label: item.label,
|
||||
}));
|
||||
|
||||
// 设置初始专业列表为第一个学院的专业
|
||||
if (res.data[0].children && res.data[0].children.length > 0) {
|
||||
this.majorList = res.data[0].children;
|
||||
}
|
||||
|
||||
// 如果已有选择的学院,则设置对应的专业列表
|
||||
// 如果已有选择的学院,则设置对应的学院ID
|
||||
if (this.teacherInfo.collegeName) {
|
||||
const selectedCollege = res.data.find(
|
||||
(item) => item.label === this.teacherInfo.collegeName
|
||||
);
|
||||
if (selectedCollege && selectedCollege.children) {
|
||||
this.majorList = selectedCollege.children;
|
||||
|
||||
// 如果没有collegeManagementId,则设置它
|
||||
if (!this.teacherInfo.collegeManagementId) {
|
||||
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) {
|
||||
this.teacherInfo.collegeName = e[0].label;
|
||||
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) {
|
||||
return this.$u.toast("请输入姓名");
|
||||
}
|
||||
if (!this.teacherInfo.schoolName) {
|
||||
return this.$u.toast("请输入学校名称");
|
||||
}
|
||||
// if (!this.teacherInfo.schoolName) {
|
||||
// return this.$u.toast("请输入学校名称");
|
||||
// }
|
||||
if (!this.teacherInfo.collegeName) {
|
||||
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);
|
||||
|
||||
|
||||
console.log("this.teacherInfo----", this.teacherInfo);
|
||||
let query = {
|
||||
...this.teacherInfo,
|
||||
schoolName: "江西新能源科技职业技术学院",
|
||||
// schoolName: "江西新能源科技职业技术学院",
|
||||
};
|
||||
|
||||
console.log('query',query);
|
||||
this.$u.api
|
||||
.updateTeacherInfo(query)
|
||||
.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中的变量名
|
||||
let saveStateKeys = [
|
||||
"vuex_teacherInfo",
|
||||
"vuex_user",
|
||||
"vuex_token",
|
||||
"vuex_userType",
|
||||
|
|
|
|||
Loading…
Reference in New Issue