设置页

This commit is contained in:
李泉德
2025-06-25 13:58:37 +08:00
parent 7cd537912a
commit 32b304bc15
5 changed files with 451 additions and 305 deletions
+2 -2
View File
@@ -9,8 +9,8 @@ ENV = 'development'
# VITE_APP_BASE_API_Url = 'http://25.64.16.133:9786' # VITE_APP_BASE_API_Url = 'http://25.64.16.133:9786'
VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001' # VITE_APP_BASE_API_Url = 'https://aitstest.jlbank.com.cn:7001'
app入口 app入口
# VITE_APP_BASE_API_Url = 'http://25.18.122.65:7001' VITE_APP_BASE_API_Url = 'http://25.18.122.65:7001'
+9
View File
@@ -27,6 +27,15 @@
} }
} }
}, },
{
"path": "pages/setting/index",
"style": {
"navigationBarTitleText": "设置",
"app-plus": {
"titleNView": false
}
}
},
{ {
"path": "pages/study/index", "path": "pages/study/index",
"style": { "style": {
+287 -303
View File
@@ -14,19 +14,14 @@
<view class="personal_information_data"> <view class="personal_information_data">
<view class="name_sex_div"> <view class="name_sex_div">
<view class="name"> <view class="name">
{{user_info.userName}} {{ user_info.userName }}
</view> </view>
<view class="sex"> <view class="sex">
<image v-if="user_info.gender === 'F'" class="img_100" <image v-if="user_info.gender === 'F'" class="img_100" src="/static/images/me/wuman.png"></image>
src="/static/images/me/wuman.png"> <image v-if="user_info.gender === 'M'" class="img_100" src="/static/images/me/man.png"></image>
</image>
<image v-if="user_info.gender === 'M'" class="img_100" src="/static/images/me/man.png">
</image>
</view> </view>
</view> </view>
<view class="work_number_div"> <view class="work_number_div">工号{{ user_info.userId }}</view>
工号{{user_info.userId}}
</view>
<view class="fl1"></view> <view class="fl1"></view>
</view> </view>
</view> </view>
@@ -35,22 +30,31 @@
<view class="item"> <view class="item">
<view class="top">累计学习时长</view> <view class="top">累计学习时长</view>
<view class="bottom"> <view class="bottom">
<uv-count-to :startVal="statistics_data['startAccmPoint']" :endVal="statistics_data['accmPoint']" <uv-count-to
:useEasing="true" :decimals="1" ref="accmPointRef"></uv-count-to>h :startVal="statistics_data['startAccmPoint']"
:endVal="statistics_data['accmPoint']"
:useEasing="true"
:decimals="1"
ref="accmPointRef"
></uv-count-to>
h
</view> </view>
</view> </view>
<view class="item"> <view class="item">
<view class="top">累计完成任务</view> <view class="top">累计完成任务</view>
<view class="bottom"> <view class="bottom">
<uv-count-to :startVal="statistics_data['startAccmTaskCnt']" <uv-count-to
:endVal="statistics_data['accmTaskCnt']" :useEasing="true" ref="accmTaskCntRef"></uv-count-to> :startVal="statistics_data['startAccmTaskCnt']"
:endVal="statistics_data['accmTaskCnt']"
:useEasing="true"
ref="accmTaskCntRef"
></uv-count-to>
</view> </view>
</view> </view>
<view class="item"> <view class="item">
<view class="top">累计获得积分</view> <view class="top">累计获得积分</view>
<view class="bottom"> <view class="bottom">
<uv-count-to :startVal="statistics_data['startStdtTmLen']" :endVal="statistics_data['stdtTmLen']" <uv-count-to :startVal="statistics_data['startStdtTmLen']" :endVal="statistics_data['stdtTmLen']" :useEasing="true" ref="stdtTmLenRef"></uv-count-to>
:useEasing="true" ref="stdtTmLenRef"></uv-count-to>
</view> </view>
</view> </view>
</view> </view>
@@ -79,18 +83,17 @@
</view> </view>
<view class="cell_div"> <view class="cell_div">
<uv-cell-group :border="false"> <uv-cell-group :border="false">
<uv-cell title='消息通知' :isLink="true"></uv-cell> <uv-cell title="消息通知" :isLink="true"></uv-cell>
<uv-cell title='排行榜' :isLink="true"></uv-cell> <uv-cell title="排行榜" :isLink="true"></uv-cell>
<uv-cell title='问答记录' :isLink="true"></uv-cell> <uv-cell title="问答记录" :isLink="true"></uv-cell>
<uv-cell title='竞赛记录' :isLink="true" :clickable="false" :border="false"></uv-cell> <uv-cell title="竞赛记录" :isLink="true" :clickable="false" :border="false"></uv-cell>
</uv-cell-group> </uv-cell-group>
</view> </view>
<view class="cell_div"> <view class="cell_div">
<uv-cell-group :border="false"> <uv-cell-group :border="false">
<uv-cell title='设置' :isLink="true"></uv-cell> <uv-cell title="设置" :isLink="true" @click="common.navigateTo('/pages/setting/index')"></uv-cell>
<uv-cell title='客服' :isLink="true"></uv-cell> <uv-cell title="客服" :isLink="true"></uv-cell>
<uv-cell title='退出登录' :isLink="true" :clickable="false" :border="false" <uv-cell title="退出登录" :isLink="true" :clickable="false" :border="false" @click="click_loginout()"></uv-cell>
@click="click_loginout()"></uv-cell>
</uv-cell-group> </uv-cell-group>
</view> </view>
<tabbar-shadow></tabbar-shadow> <tabbar-shadow></tabbar-shadow>
@@ -98,310 +101,291 @@
</template> </template>
<script setup> <script setup>
import { import { ref, computed, reactive } from 'vue';
ref, import { onShow } from '@dcloudio/uni-app';
computed, import common from '@/common/common';
reactive import { getUserInfo } from '@/common/common';
} from 'vue'; import { onPullDownRefresh } from '@dcloudio/uni-app';
import { import { loginOut } from '@/api/login.js';
onShow import { queryTraStdyStatisticsSelf } from '@/api/user.js';
} from '@dcloudio/uni-app' const accmTaskCntRef = ref(null);
import common from '@/common/common' const accmPointRef = ref(null);
import { const stdtTmLenRef = ref(null);
getUserInfo const statistics_data = reactive({
} from '@/common/common' stdtTmLen: 0, // 累计学习时长
import { accmTaskCnt: 0, // 累计完成任务
onPullDownRefresh accmPoint: 0, // 累计获得积分
} from '@dcloudio/uni-app' startStdtTmLen: 0, // 起始累计学习时长
import { startAccmTaskCnt: 0, // 起始累计完成任务
loginOut startAccmPoint: 0, // 起始累计获得积分
} from '@/api/login.js' request_time: 0, // 上次请求时间
import { init: function () {
queryTraStdyStatisticsSelf // 初始化统计数据
} from '@/api/user.js' const me_statistics_data = common.getValue('me_statistics_data'); // 获取缓存
const accmTaskCntRef = ref(null) if (me_statistics_data) {
const accmPointRef = ref(null) this.stdtTmLen = me_statistics_data.stdtTmLen;
const stdtTmLenRef = ref(null) this.accmTaskCnt = me_statistics_data.accmTaskCnt;
const statistics_data = reactive({ this.accmPoint = me_statistics_data.accmPoint;
'stdtTmLen': 0, // 累计学习时长
'accmTaskCnt': 0, // 累计完成任务
'accmPoint': 0, // 累计获得积分
'startStdtTmLen': 0, // 起始累计学习时长
'startAccmTaskCnt': 0, // 起始累计完成任务
'startAccmPoint': 0, // 起始累计获得积分
'request_time': 0, // 上次请求时间
"init": function() { // 初始化统计数据
const me_statistics_data = common.getValue('me_statistics_data') // 获取缓存
if (me_statistics_data) {
this.stdtTmLen = me_statistics_data.stdtTmLen;
this.accmTaskCnt = me_statistics_data.accmTaskCnt;
this.accmPoint = me_statistics_data.accmPoint;
}
},
"get_statistics_data": async function() {
try {
const time_now = Date.now();
if (time_now - this.request_time > 300 ) {
this.request_time = time_now;
// 获取最新数据
const res = await queryTraStdyStatisticsSelf();
common.setValue('me_statistics_data', res.body)
const accmPoint = res.body.accmPoint
const accmTaskCnt = res.body.accmTaskCnt
const stdtTmLen = res.body.stdtTmLen
if (accmPoint != this.accmPoint) { // 不相等就执行
this.startAccmPoint = this.accmPoint
this.accmPoint = accmPoint
accmPointRef.value.start()
}
if (accmTaskCnt != this.accmTaskCnt) { // 不相等就执行
this.startAccmTaskCnt = this.accmTaskCnt
this.accmTaskCnt = accmTaskCnt
accmTaskCntRef.value.start()
}
if (stdtTmLen != this.stdtTmLen) { // 不相等就执行
this.startStdtTmLen = this.stdtTmLen
this.stdtTmLen = stdtTmLen
stdtTmLenRef.value.start()
}
console.log('统计数据已更新');
} else {
console.log('时间没到无需更新');
}
} catch (error) {
console.error('获取统计数据失败:', error);
}
} }
}); },
get_statistics_data: async function () {
const user_info = reactive({ try {
userName: '', const time_now = Date.now();
userId: '' if (time_now - this.request_time > 300) {
}); this.request_time = time_now;
// 获取最新数据
const res = await queryTraStdyStatisticsSelf();
common.setValue('me_statistics_data', res.body);
onShow(() => { const accmPoint = res.body.accmPoint;
const user_info_cache = getUserInfo() const accmTaskCnt = res.body.accmTaskCnt;
Object.assign(user_info, user_info_cache) const stdtTmLen = res.body.stdtTmLen;
statistics_data['get_statistics_data']() // 获取统计数据 if (accmPoint != this.accmPoint) {
}) // 不相等就执行
this.startAccmPoint = this.accmPoint;
const click_loginout = () => { this.accmPoint = accmPoint;
common.show('确定退出登录?').then(async (res) => { accmPointRef.value.start();
console.log(res); }
if (!res) return; if (accmTaskCnt != this.accmTaskCnt) {
try { // 不相等就执行
common.loading('正在退出登录') this.startAccmTaskCnt = this.accmTaskCnt;
await loginOut() this.accmTaskCnt = accmTaskCnt;
} catch (e) { accmTaskCntRef.value.start();
}
if (stdtTmLen != this.stdtTmLen) {
// 不相等就执行
this.startStdtTmLen = this.stdtTmLen;
this.stdtTmLen = stdtTmLen;
stdtTmLenRef.value.start();
}
console.log('统计数据已更新');
} else {
console.log('时间没到无需更新');
} }
common.hideLoading() } catch (error) {
// 主动退出登录后,再次登录应该进首页 console.error('获取统计数据失败:', error);
common.reLaunch('/pages/login/login') }
})
} }
});
onPullDownRefresh(() => { const user_info = reactive({
console.log('下拉刷新'); userName: '',
uni.stopPullDownRefresh(); userId: ''
}) });
onShow(() => {
const user_info_cache = getUserInfo();
Object.assign(user_info, user_info_cache);
statistics_data['get_statistics_data'](); // 获取统计数据
});
const click_loginout = () => {
common.show('确定退出登录?').then(async (res) => {
console.log(res);
if (!res) return;
try {
common.loading('正在退出登录');
await loginOut();
} catch (e) {}
common.hideLoading();
// 主动退出登录后,再次登录应该进首页
common.reLaunch('/pages/login/login');
});
};
onPullDownRefresh(() => {
console.log('下拉刷新');
uni.stopPullDownRefresh();
});
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
$bg-margin-left: 50rpx; $bg-margin-left: 50rpx;
// 下方单元格
.cell_div {
margin: 30rpx $bg-margin-left 0 $bg-margin-left;
background: #FFFFFF;
border-radius: 15rpx;
z-index: 101;
overflow: hidden;
// 为了让线缩进来24单位
:deep(.uv-line) {
width: calc(100% - 48rpx) !important;
margin: 0 24rpx !important;
}
:deep(.uv-cell__body) {
padding: 12px 15px;
}
// 下方单元格
.cell_div {
margin: 30rpx $bg-margin-left 0 $bg-margin-left;
background: #ffffff;
border-radius: 15rpx;
z-index: 101;
overflow: hidden;
// 为了让线缩进来24单位
:deep(.uv-line) {
width: calc(100% - 48rpx) !important;
margin: 0 24rpx !important;
} }
// 快捷导航栏 :deep(.uv-cell__body) {
.navigation_div { padding: 12px 15px;
margin: 30rpx $bg-margin-left 0 $bg-margin-left; }
padding: 24rpx 0 20rpx 0; }
background-color: #FFFFFF;
border-radius: 23rpx; // 快捷导航栏
.navigation_div {
margin: 30rpx $bg-margin-left 0 $bg-margin-left;
padding: 24rpx 0 20rpx 0;
background-color: #ffffff;
border-radius: 23rpx;
display: flex;
flex-direction: column;
justify-content: space-around;
z-index: 101;
.group {
display: flex;
justify-content: space-around;
}
.item {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: space-around; justify-content: center;
z-index: 101; align-items: center;
.group { // background-color: red;
.icon {
width: 88rpx;
height: 86rpx;
}
.title {
margin-top: 10rpx;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 25rpx;
color: #323e57;
line-height: 35rpx;
text-align: left;
font-style: normal;
}
}
}
.bg_div {
display: flex;
flex-direction: column;
position: relative;
padding: 0 $bg-margin-left;
z-index: 50;
.bg_img {
position: absolute;
top: 0;
left: 0;
width: 100%;
z-index: -1;
height: 858rpx;
}
// 个人信息
.user_data_div {
margin-top: 158rpx;
background: linear-gradient(180deg, rgba(241, 245, 255, 0.5) 0%, #f6f9fe 50%, #ffffff 100%);
border-radius: 14rpx;
border: 2rpx solid #ffffff;
box-shadow: #f6f8ff 0 0 2rpx;
.personal_information {
padding: 20rpx 18rpx 0 26rpx;
display: flex;
// 个人头像框框
.profile {
border-radius: 100%;
border: 2px solid #ffffff;
width: 108rpx;
height: 108rpx;
overflow: hidden;
}
// 头像右边的信息
.personal_information_data {
flex: 1;
display: flex;
flex-direction: column;
margin-left: 26rpx;
overflow: hidden;
// 上边的姓名性别盒子
.name_sex_div {
display: flex;
margin-top: 6rpx;
.name {
font-family: PingFangSC;
font-weight: 600;
font-size: 28rpx;
color: #000000;
line-height: 40rpx;
}
.sex {
margin-left: 10rpx;
width: 30rpx;
height: 30rpx;
}
}
.work_number_div {
font-family: PingFangSC;
font-weight: 400;
font-size: 25rpx;
color: #666666;
line-height: 38rpx;
text-align: left;
font-style: normal;
white-space: nowrap;
text-overflow: ellipsis;
}
}
}
.study_information {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
} z-index: 20;
margin: 30rpx 50rpx;
.item { .item {
display: flex; flex: 1;
flex-direction: column;
justify-content: center;
align-items: center;
// background-color: red;
.icon {
width: 88rpx;
height: 86rpx;
}
.title {
margin-top: 10rpx;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 25rpx;
color: #323E57;
line-height: 35rpx;
text-align: left;
font-style: normal;
}
}
}
.bg_div {
display: flex;
flex-direction: column;
position: relative;
padding: 0 $bg-margin-left;
z-index: 50;
.bg_img {
position: absolute;
top: 0;
left: 0;
width: 100%;
z-index: -1;
height: 858rpx;
}
// 个人信息
.user_data_div {
margin-top: 158rpx;
background: linear-gradient(180deg, rgba(241, 245, 255, .5) 0%, #F6F9FE 50%, #FFFFFF 100%);
border-radius: 14rpx;
border: 2rpx solid #ffffff;
box-shadow: #F6F8FF 0 0 2rpx;
.personal_information {
padding: 20rpx 18rpx 0 26rpx;
display: flex; display: flex;
flex-direction: column;
// 个人头像框框 justify-content: center;
.profile {
border-radius: 100%; .top {
border: 2px solid #ffffff; font-family: PingFangSC, PingFang SC;
width: 108rpx; font-weight: 400;
height: 108rpx; font-size: 25rpx;
overflow: hidden; color: #666666;
line-height: 35rpx;
text-align: center;
font-style: normal;
} }
// 头像右边的信息 .bottom {
.personal_information_data { margin-top: 5%;
flex: 1; font-weight: bold;
display: flex; font-size: 50rpx;
flex-direction: column; color: #000000;
margin-left: 26rpx; line-height: 58rpx;
overflow: hidden; text-align: left;
font-style: normal;
text-align: center;
// 上边的姓名性别盒子 // 数字滚动组件
.name_sex_div { :deep(.uv-count-num) {
display: flex; font-weight: bold !important;
margin-top: 6rpx; font-size: 50rpx !important;
.name { color: #000000 !important;
font-family: PingFangSC;
font-weight: 600;
font-size: 28rpx;
color: #000000;
line-height: 40rpx;
}
.sex {
margin-left: 10rpx;
width: 30rpx;
height: 30rpx;
}
}
.work_number_div {
font-family: PingFangSC;
font-weight: 400;
font-size: 25rpx;
color: #666666;
line-height: 38rpx;
text-align: left;
font-style: normal;
white-space: nowrap;
text-overflow: ellipsis;
} }
} }
} }
.study_information {
display: flex;
justify-content: space-around;
z-index: 20;
margin: 30rpx 50rpx;
.item {
flex: 1;
display: flex;
flex-direction: column;
justify-content: center;
.top {
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 25rpx;
color: #666666;
line-height: 35rpx;
text-align: center;
font-style: normal;
}
.bottom {
margin-top: 5%;
font-weight: bold;
font-size: 50rpx;
color: #000000;
line-height: 58rpx;
text-align: left;
font-style: normal;
text-align: center;
// 数字滚动组件
:deep(.uv-count-num) {
font-weight: bold !important;
font-size: 50rpx !important;
color: #000000 !important;
}
}
}
}
} }
} }
}
.main_div { .main_div {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background-color: #F6F8FF; background-color: #f6f8ff;
} }
</style> </style>
+144
View File
@@ -0,0 +1,144 @@
<template>
<view class="max_page detail-main">
<nav-bar :is_seat="false"></nav-bar>
<view class="fixed_search_div">
<view class="back_div" @click="common.navigateBack()">
<view class="back-icon"></view>
</view>
<view class="title font_pf">设置</view>
</view>
<view class="detail-body">
<uv-cell-group>
<uv-cell title="头像"></uv-cell>
<uv-cell title="名字"></uv-cell>
</uv-cell-group>
</view>
<view class="btn-box font_pf">
<uv-button type="primary" @click="submit">提交评价</uv-button>
</view>
</view>
</template>
<script setup>
import { reactive, ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
import { publishCrsEvaluation } from '@/api/courseDetail.js';
import common from '@/common/common';
const formData = reactive({
crsNum: null,
imgIdList: [], // 发表图片ID列表,文件ID集
bbsGrade: 10, // 综合评分(最高10分)
bbsTag: 'SUG', // 评价标签 (SUG 建议 ASK 提问 )
bbsContent: '' // 评价内容
});
const submit = () => {
if (formData.bbsContent === '') {
if (formData.bbsTag == 'SUG') {
return common.msg('请输入你的建议');
} else {
return common.msg('请输入你的问题');
}
}
publishCrsEvaluation(formData).then((res) => {
common.msg('发表成功');
setTimeout(() => common.navigateBack(), 500);
});
};
onLoad((params) => {
formData.crsNum = params.crsNum;
});
</script>
<style lang="scss" scoped>
.detail-main {
background-color: #fff;
}
.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;
}
.body-content {
flex: 1;
background-color: #ffffff;
border-radius: 15rpx;
padding: 36rpx;
padding-top: 0rpx;
}
.btn-box {
position: fixed;
bottom: 0;
// height: 187rpx;
width: 100%;
display: flex;
padding-bottom: 30rpx;
justify-content: space-evenly;
:deep(.uv-button) {
border-radius: 14rpx;
width: 616rpx;
height: 80rpx;
}
}
.c-666 {
color: #666666;
}
.c-000 {
font-weight: 600;
color: #000;
}
.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>
+9
View File
@@ -26,6 +26,15 @@
"titleNView": false "titleNView": false
} }
} }
},
{
"path": "pages/setting/index",
"style": {
"navigationBarTitleText": "设置",
"app-plus": {
"titleNView": false
}
}
} }
], ],
"tabBar": { "tabBar": {