我的页和设置页完成

This commit is contained in:
田岩
2025-06-27 17:08:58 +08:00
parent ece5e7e1a9
commit a9ccdd2b95
22 changed files with 3298 additions and 133 deletions
@@ -15,7 +15,7 @@
</view>
<view class="title">
{{item.bbsContent}}
</view>azf
</view>
<view class="img_div pic-cell">
<image-preview v-for="img in item.imgIdList" :imgId="img" class="pic-item"></image-preview>
</view>
+34
View File
@@ -1,6 +1,9 @@
<template>
<view class="max_page detail-main" style="overflow: hidden;">
<image src="/src/static/images/courseDetail/mipmap-xhdpi/bg.png" mode="widthFix" class="back-image"></image>
<view class="back_div" @click="common.navigateBack()">
<view class="back-icon"></view>
</view>
<view class="detail-body">
<view class="head-title font_pf">
<view class="title-text">{{ form.crsName }}</view>
@@ -101,6 +104,37 @@
</script>
<style lang="scss" scoped>
.back_div {
margin-right: 10rpx;
position: absolute;
left: 46rpx;
top: 64rpx;
.back-icon {
position: relative;
width: 40rpx;
height: 40rpx;
cursor: pointer;
}
.back-icon::before,
.back-icon::after {
content: '';
position: absolute;
transition: all 0.3s ease;
}
.back-icon::after {
top: 25%;
left: 25%;
width: 40%;
height: 40%;
border-top: 4rpx solid #FFFFFF;
border-left: 4rpx solid #FFFFFF;
transform: rotate(-45deg);
}
}
.detail-main {
background-color: #f5f5f5;
position: relative;
+3 -2
View File
@@ -41,13 +41,13 @@
提问</view>
</view>
<view class="input-textarea">
<uv-textarea v-model="formData.bbsContent" height="124" count
<uv-textarea v-model="formData.bbsContent" height="124" count :maxlength="TextareaInputLimitCharacter"
:placeholder="formData.bbsTag == 'SUG'?'请输入你的建议...':'请输入你的问题...'"></uv-textarea>
</view>
</view>
</view>
<view class="btn-box font_pf">
<uv-button type="primary" @click="submit">提交评价</uv-button>
<uv-button type="primary" @click="submit" :disabled="!formData.bbsContent">提交评价</uv-button>
</view>
</view>
</template>
@@ -57,6 +57,7 @@
reactive,
ref
} from 'vue';
import {TextareaInputLimitCharacter} from "@/enum.js"
import {
onLoad
} from '@dcloudio/uni-app';
+7 -4
View File
@@ -252,6 +252,7 @@
const stdtTmLenRef = ref(null);
const accmPracticeCntRef = ref(null);
const accmExamCntRef = ref(null);
const three_list_request_time = ref(0); // 三个列表更新时间
// 计算透明度
const opacity = computed(() => {
@@ -304,7 +305,7 @@
"get_statistics_data": async function() {
try {
const time_now = Date.now();
if (time_now - this.request_time > 30) {
if (time_now - this.request_time > 300 * 1000) {
this.request_time = time_now;
// 获取最新数据
const res = await getStatisticsData();
@@ -333,7 +334,7 @@
console.log('时间没到无需更新');
}
} catch (error) {
console.error('获取统计数据失败:', error);
console.log('获取统计数据失败:', error);
}
}
});
@@ -347,13 +348,12 @@
common.navigateTo('/pages/courseDetail/index?crsNum=' + crsNum)
}
onShow(() => {
console.log('onShow');
if(!common.isLogin()){
common.navigateTo('/pages/login/login')
return
}
statistics_data['get_statistics_data']() // 获取统计数据
})
onMounted(async () => {
if(!common.isLogin()) return;
queryCrsInfoByLastnew().then(res => {
new_class_list.value = res.body
@@ -365,6 +365,9 @@
recommend_class_list.value = res.body
})
})
onLoad(async () => {
})
</script>
+8 -4
View File
@@ -8,7 +8,9 @@
<!-- 用户个人信息 -->
<view class="personal_information">
<view class="profile">
<image v-if="user_info.imageAddr" class="img_100" src="/static/images/test/touxiang.png"></image>
<!-- <image-preview v-if="user_info.imageAddr" class="img_100" :src="user_info.imageAddr"></image-preview> -->
<image v-if="user_info.imagePath" class="img_100" :src="user_info.imagePath"></image>
<image-preview v-else-if="user_info.imageAddr" class="img_100" :src="user_info.imageAddr"></image-preview>
<image v-else class="img_100" src="/static/images/me/default_user_avatar.png"></image>
</view>
<view class="personal_information_data">
@@ -17,8 +19,8 @@
{{ user_info.userName }}
</view>
<view class="sex">
<image v-if="user_info.gender === 'F'" class="img_100" src="/static/images/me/wuman.png"></image>
<image v-if="user_info.gender === 'M'" class="img_100" src="/static/images/me/man.png"></image>
<image v-if="user_info.gender === 'f'" class="img_100" src="/static/images/me/wuman.png"></image>
<image v-if="user_info.gender === 'm'" class="img_100" src="/static/images/me/man.png"></image>
</view>
</view>
<view class="work_number_div">工号{{ user_info.userId }}</view>
@@ -108,6 +110,7 @@ import { getUserInfo } from '@/common/common';
import { onPullDownRefresh } from '@dcloudio/uni-app';
import { loginOut } from '@/api/login.js';
import { queryTraStdyStatisticsSelf } from '@/api/user.js';
const accmTaskCntRef = ref(null);
const accmPointRef = ref(null);
const stdtTmLenRef = ref(null);
@@ -169,7 +172,8 @@ const statistics_data = reactive({
const user_info = reactive({
userName: '',
userId: ''
userId: '',
imageAddr: '',
});
onShow(() => {
+186 -77
View File
@@ -8,14 +8,15 @@
<view class="title font_pf">设置</view>
</view>
<view class="detail-body">
<uv-cell-group>
<uv-cell-group :border="false">
<uv-cell @click="cellCLick" name="avatar" isLink title="头像">
<template #title>
<view class="font_pf">头像</view>
</template>
<template #value>
<view style="width: 60rpx; height: 60rpx; border-radius: 100%; overflow: hidden">
<image style="width: 100%" src="/src/static/images/test/touxiang.png" mode="widthFix"></image>
<view style="width: 42rpx; height: 42rpx;border-radius: 100%; overflow: hidden">
<image-preview style="width: 100%" v-if="userInfo.imageAddr" :src="userInfo.imageAddr"></image-preview>
</view>
</template>
</uv-cell>
@@ -24,98 +25,206 @@
<text class="font_pf">性别</text>
</template>
<template #value>
<picker mode="selector" :value="index" range-key="label" style="width: 100%" :range="sexOptions" @change="sexChange">
<view style="text-align: right">{{ sexOptions.find((item) => item.value == form.gender).label || '' }}</view>
<picker mode="selector" :value="index" range-key="label" style="width: 100%" :range="sexOptions"
@change="sexChange">
<view style="text-align: right">{{showGenderText}}</view>
</picker>
</template>
</uv-cell>
<uv-cell title="形象" :isLink="true" :border="false"></uv-cell>
</uv-cell-group>
</view>
<avatar-cropper v-if="avatarCropperStatus" mode="ratio" :imageUrl="avatarCropperUrl" :width="500" :height="500"
:delay="150" @cancel="onCancel" @confirm="onConfirm"></avatar-cropper>
</view>
</template>
<script setup>
import { reactive, ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import common from '@/common/common';
const index = ref(0);
const form = ref({
gender: 'Y'
});
const sexOptions = [
{ value: 'Y', label: '男' },
{ value: 'M', label: '女' }
];
const cellCLick = (value) => {};
const sexChange = (e) => {
console.log(e);
console.log(sexOptions[e.detail.value].value, 'sexOptions[e.detail.value].value');
form.value.gender = sexOptions[e.detail.value].value;
import {
reactive,
ref,
computed,
nextTick
} from 'vue';
import {
onLoad
} from '@dcloudio/uni-app';
import {
uploadFile
} from '@/api/common'
import { queryCurrentUser} from '@/api/login.js';
import common from '@/common/common';
import {getUserInfo} from '@/common/common';
import {
GENDER
} from '@/enum.js';
import {
updateDfSysUserExtandInfoGender,
updateDfSysUserExtandInfoImageAddr
} from "@/api/user.js"
const index = ref(0);
const avatarCropperUrl = ref('');
const aaa = ref('');
const userInfo = ref({
gender: '',
imageAddr: ''
});
const avatarCropperStatus = ref(true)
const sexOptions = GENDER
const showGenderText = computed(() => {
const item = sexOptions.find((item) => item.value == userInfo.value.gender)
if (item) {
return item.label
} else {
return '未填写'
}
})
const onCancel = (value) => {
avatarCropperStatus.value = false
}
const onConfirm = (file) => {
avatarCropperStatus.value = false
nextTick(async() => {
common.loading('更新头像中')
try{
const data = {
bizScen: 'S3010',
thumbnailFlag: true,
thumbImgSize:100
}
// 上传图片
const res = await uploadFile(file.tempFilePath, data)
// 更新个人信息
await updateDfSysUserExtandInfoImageAddr({imageAddr : res.thumbFileId})
// 更新个人信息
const userData = await queryCurrentUser()
common.msg('修改成功')
console.log(userData);
userInfo.value.imageAddr = getUserInfo('imageAddr')
} catch {
common.msg('修改失败')
}
common.hideLoading()
})
}
console.log(form.value.gender, 'iiii');
};
onLoad((params) => {});
const cellCLick = (value) => {
uni.chooseImage({
count: 1,
sizeType: ["compressed"],
success: (res) => {
avatarCropperUrl.value = res.tempFilePaths[0];
avatarCropperStatus.value = true
},
});
};
const sexChange = (e) => {
userInfo.value.gender = sexOptions[e.detail.value].value;
common.loading("修改中")
updateDfSysUserExtandInfoGender({
gender: userInfo.value.gender
}).then(res => {
common.msg('修改成功')
}).finally(() => {
common.hideLoading()
})
};
onLoad((params) => {
userInfo.value = getUserInfo()
console.log(userInfo.value);
});
</script>
<style lang="scss" scoped>
.detail-main {
background-color: #fff;
}
$bg-margin-left: 50rpx;
.detail-body {
box-sizing: border-box;
min-height: calc(100vh - (var(--status-bar-height)+50rpx));
// padding: 29rpx 37rpx;
width: 100%;
display: flex;
flex-direction: column;
padding-top: 0rpx;
:deep(.uv-cell__title) {
flex: none !important;
}
}
.detail-body {
margin: 30rpx $bg-margin-left 0 $bg-margin-left;
background: #ffffff;
// background: red;
border-radius: 15rpx;
z-index: 101;
overflow: hidden;
.title {
color: #000000;
font-size: 34rpx;
height: 34rpx;
font-weight: 600;
// margin-bottom: 30rpx;
line-height: 34rpx;
}
.fixed_search_div {
padding: calc(10rpx + var(--status-bar-height)) 15rpx 24rpx 30rpx;
display: flex;
align-items: center;
background-color: #f6f7f8;
.back_div {
margin-right: 10rpx;
.back-icon {
position: relative;
width: 40rpx;
height: 40rpx;
cursor: pointer;
display: flex;
align-items: center;
// 为了让线缩进来24单位
:deep(.uv-line) {
width: calc(100% - 48rpx) !important;
margin: 0 24rpx !important;
}
.back-icon::before,
.back-icon::after {
content: '';
position: absolute;
transition: all 0.3s ease;
:deep(.uv-cell__body) {
padding: 12px 15px;
}
.back-icon::after {
top: 25%;
left: 25%;
width: 40%;
height: 40%;
border-top: 4rpx solid #2b2c2e;
border-left: 4rpx solid #2b2c2e;
transform: rotate(-45deg);
:deep(.uv-cell__title) {
flex: none !important;
}
}
}
</style>
.detail-main {
background-color: #F6F8FF;
}
// .detail-body {
// box-sizing: border-box;
// min-height: calc(100vh - (var(--status-bar-height)+50rpx));
// // padding: 29rpx 37rpx;
// width: 100%;
// display: flex;
// flex-direction: column;
// padding-top: 0rpx;
// }
.title {
color: #000000;
font-size: 34rpx;
height: 34rpx;
font-weight: 600;
// margin-bottom: 30rpx;
line-height: 34rpx;
}
.fixed_search_div {
padding: calc(10rpx + var(--status-bar-height)) 15rpx 24rpx 30rpx;
display: flex;
align-items: center;
background-color: #f6f7f8;
.back_div {
margin-right: 10rpx;
.back-icon {
position: relative;
width: 40rpx;
height: 40rpx;
cursor: pointer;
display: flex;
align-items: center;
}
.back-icon::before,
.back-icon::after {
content: '';
position: absolute;
transition: all 0.3s ease;
}
.back-icon::after {
top: 25%;
left: 25%;
width: 40%;
height: 40%;
border-top: 4rpx solid #2b2c2e;
border-left: 4rpx solid #2b2c2e;
transform: rotate(-45deg);
}
}
}
</style>