修复首页选学生头像都一样的问题
This commit is contained in:
parent
3762f9232d
commit
98d18a15aa
@ -10,7 +10,7 @@
|
||||
</view>
|
||||
<view class="user-content">
|
||||
<view class="user-avatar">
|
||||
<image :src="xsTx || '/static/base/home/11222.png'" class="avatar-img"></image>
|
||||
<image :src="curXs.xstxUrl || '/static/base/home/11222.png'" class="avatar-img"></image>
|
||||
<view class="avatar-ring"></view>
|
||||
</view>
|
||||
<view class="user-details">
|
||||
@ -108,7 +108,7 @@
|
||||
@click="switchXs(xs)"
|
||||
>
|
||||
<view class="student-avatar">
|
||||
<image :src="xsTx || '/static/base/home/11222.png'" class="avatar-img"></image>
|
||||
<image :src="xs.xstxUrl || '/static/base/home/11222.png'" class="avatar-img"></image>
|
||||
</view>
|
||||
<view class="student-info">
|
||||
<text class="student-name">{{ xs.xm }}</text>
|
||||
@ -204,12 +204,12 @@ const xsList = ref([
|
||||
bjmc: "01班",
|
||||
njmcId: "",
|
||||
xstx: "/static/base/home/11222.png",
|
||||
xstxUrl: ''
|
||||
}
|
||||
]);
|
||||
|
||||
// 当前选中的学生
|
||||
let curXs = ref(xsList.value[0]);
|
||||
const xsTx = ref(imagUrl(curXs.value.xstx));
|
||||
|
||||
// 控制选择器显示状态
|
||||
const showSelector = ref(false);
|
||||
@ -238,7 +238,6 @@ function showXsSelector() {
|
||||
// 切换学生
|
||||
function switchXs(xs: any) {
|
||||
curXs.value = xs;
|
||||
xsTx.value = imagUrl(xs.xstx);
|
||||
showSelector.value = false;
|
||||
getArticleList();
|
||||
// 记录存储切换
|
||||
@ -260,7 +259,7 @@ function goToDetail(notice: any) {
|
||||
|
||||
const getArticleList = async () => {
|
||||
const params = Object.assign({}, pageParams.value, { njmcId: curXs.value.njmcId });
|
||||
cmsArticlePageApi(pageParams.value).then(res => {
|
||||
cmsArticlePageApi(params).then(res => {
|
||||
announcements.value = res.rows;
|
||||
})
|
||||
.catch((error) => {
|
||||
@ -271,9 +270,12 @@ const getArticleList = async () => {
|
||||
|
||||
onMounted(async () => {
|
||||
xsList.value = getUser.xsList;
|
||||
for (let i = 0; i < xsList.value.length; i++) {
|
||||
const xs = xsList.value[i];
|
||||
xs.xstxUrl = imagUrl(xs.xstx) || "";
|
||||
}
|
||||
curXs.value = getCurXs;
|
||||
xsTx.value = imagUrl(getCurXs.xstx);
|
||||
console.log(xsTx.value, getCurXs.xstx)
|
||||
curXs.value.xstxUrl = imagUrl(getCurXs.xstx) || "";
|
||||
getArticleList();
|
||||
});
|
||||
</script>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user