This commit is contained in:
Pengxiansen
2025-02-14 16:01:48 +08:00
parent 02a51af4f9
commit f3abd92d23
13 changed files with 559 additions and 9 deletions

16
.hbuilderx/launch.json Normal file
View File

@@ -0,0 +1,16 @@
{ // launch.json 配置了启动调试时相关设置configurations下节点名称可为 app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtype项可配置值为local或remote, local代表前端连本地云函数remote代表前端连云端云函数
"version": "0.0",
"configurations": [{
"default" :
{
"launchtype" : "local"
},
"h5" :
{
"launchtype" : "local"
},
"type" : "uniCloud"
}
]
}

16
api/modules/growth.js Normal file
View File

@@ -0,0 +1,16 @@
/**
* 课程的操作,课程的添加,修改,列表查询,课程的审核发布等操作。
* 针对于管理员,教师的功能
*
**/
import ajax from '@/utils/growthXajax.js'
/*
专业力必修课程
*/
const baseUrl = '/growth';
// const baseUrl = ''
export const studentGrowthList = function (data) {
return ajax.get(baseUrl + '/professional/student/studentGrowthList', data);
}

View File

@@ -1,5 +1,6 @@
/**系统的一些全局配置变量*/
let apiBaseUrl = '';
let growthBaseUrl="https://u-pre.boe.com";
let oldApiBaseUrl ='/uboeApi';
let manageApiBaseUrl ='/manageApi';
let statApiBaseUrl='/statApi';
@@ -78,5 +79,6 @@ export default {
loginPathLogin:loginPathLogin,
fileUrl:fileUrl,
version:version,
scormPlayer:scormPlayer
scormPlayer:scormPlayer,
growthBaseUrl:growthBaseUrl
}

View File

@@ -73,15 +73,24 @@
"devServer" : {
"https" : false,
"proxy" : {
"/growth" : {
// "target" : "https://u.boe.com",
"target" : " https://u-pre.boe.com",
"changeOrigin" : true,
"secure" : false,
"pathRewrite" : {}
},
"/systemapi" : {
"target" : "https://u.boe.com",
// "target" : "https://u.boe.com",
"target" : " https://u-pre.boe.com",
"changeOrigin" : true,
"secure" : false,
"pathRewrite" : {}
},
// "^/systemapi" : ""
"/userbasic" : {
"target" : "https://u.boe.com",
// "target" : "https://u.boe.com",
"target" : " https://u-pre.boe.com",
"changeOrigin" : true,
"secure" : false,
"pathRewrite" : {
@@ -89,7 +98,8 @@
}
},
"/manageApi" : {
"target" : "https://u.boe.com",
// "target" : "https://u.boe.com",
"target" : " https://u-pre.boe.com",
"changeOrigin" : true,
"secure" : false,
"pathRewrite" : {
@@ -97,7 +107,8 @@
}
},
"/uboeApi" : {
"target" : "https://u.boe.com",
// "target" : "https://u.boe.com",
"target" : " https://u-pre.boe.com",
"changeOrigin" : true,
"secure" : false,
"pathRewrite" : {
@@ -106,7 +117,8 @@
},
"/statApi" : {
// 目标代理服务器地址
"target" : "https://u.boe.com",
// "target" : "https://u.boe.com",
"target" : " https://u-pre.boe.com",
"changeOrigin" : true,
"logLevel" : "debug",
"secure" : false,
@@ -115,7 +127,8 @@
// "^/statApi" : ""
"/socialApi" : {
// 目标代理服务器地址
"target" : "https://u.boe.com",
// "target" : "https://u.boe.com",
"target" : " https://u-pre.boe.com",
"changeOrigin" : true,
"logLevel" : "debug",
"secure" : false,

View File

@@ -32,6 +32,7 @@
{"path" : "pages/news/index","style" : {"navigationBarTitleText": "消息","enablePullDownRefresh": false}},
{"path" : "pages/my/index","style" : {"navigationBarTitleText": "我的","enablePullDownRefresh": false}},
{"path" : "pages/my/myub","style" : {"navigationBarTitleText": "我的u币","enablePullDownRefresh": false}},
{"path" : "pages/my/growth","style" : {"navigationBarTitleText": "专业力必修","enablePullDownRefresh": false}},
{"path" : "pages/my/myubrules","style" : {"navigationBarTitleText": "u币规则","enablePullDownRefresh": false}},
{"path" : "pages/my/message","style" : {"navigationBarTitleText": "消息列表","enablePullDownRefresh": false}},
{"path" : "pages/my/myAnswers","style" : {"navigationBarTitleText": "我回答的","enablePullDownRefresh": false}},

View File

@@ -51,8 +51,8 @@
mounted() {
//对cookies进行操作这里是写
//document.cookie = "mytest=qweqwe131231; path=/; max-age=" + 30*24*60*60;
//console.log('process.env.NODE_ENV',process.env.NODE_ENV);
//console.log('process.env.ENV_TYPE',process.env.ENV_TYPE);
console.log('process.env.NODE_ENV',process.env.NODE_ENV);
console.log('process.env.ENV_TYPE',process.env.ENV_TYPE);
},
methods: {
submitLogin(){

325
pages/my/growth.vue Normal file
View File

@@ -0,0 +1,325 @@
<template>
<view class="growth">
<page-title :showBack="true">专业力必修</page-title>
<view class="title">
<view class="title-text" @click="openTip">
<view style="margin-right: 8rpx">专业力必修</view>
<u-icon name="question-circle-fill" color="#686868" size="20"></u-icon>
</view>
<view v-if="selectData" class="select" @click="show = true">
<image src="../../static/images/icon/qiehuan.jpg"></image>
<view>切换</view>
</view>
</view>
<!-- 有数据 -->
<template v-if="selectData">
<view class="container">
<view class="growth-name">{{ selectData.growthName }}</view>
<view class="growth-state">
<view>学习状态</view>
<view
:style="{
color:
selectData.learningState === 0
? '#fe9400'
: selectData.learningState === 1
? '#6ba158'
: '#0079ee',
}"
>{{
selectData.learningState === 0
? "未开始"
: selectData.learningState === 1
? "已完成"
: "进行中"
}}</view
>
</view>
<view class="growth-tip">
<view class="tip-title">
<image src="../../static/images/shuoming.jpg" />
<view>说明</view>
</view>
<view class="tip-text">
{{ selectData.description || "暂无说明" }}
</view>
</view>
<view class="growth-progress">
<view class="progress-title">
<image src="../../static/images/jindu.jpg" />
<view>学习进度</view>
</view>
<view class="progress-text">
<view class="total">总任务{{ selectData.totalTaskNum }}</view>
<view class="progress-item">
<view class="label"> 必修进度</view>
<view class="value">
<u-line-progress
active-color="#2979ff"
:showText="false"
inactive-color="#a6d0f9"
:percentage="requiredTaskCompletionRate"
height="20rpx"
></u-line-progress>
</view>
<view class="text">{{ requiredTaskCompletionRate }}%</view>
</view>
<view class="progress-item">
<view class="label"> 选修进度</view>
<view class="value">
<u-line-progress
active-color="#2979ff"
:showText="false"
inactive-color="#a6d0f9"
:percentage="electiveTaskCompletionRate"
height="20rpx"
></u-line-progress>
</view>
<view class="text">{{ electiveTaskCompletionRate }}%</view>
</view>
<view class="progress-item">
<view class="label"> 总进度</view>
<view class="value">
<u-line-progress
active-color="#2979ff"
:showText="false"
inactive-color="#a6d0f9"
:percentage="totalTaskCompletionRate"
height="20rpx"
></u-line-progress>
</view>
<view class="text">{{ totalTaskCompletionRate }}%</view>
</view>
</view>
</view>
<view class="confirm" @click="loaddetail">
<view>学习</view>
</view>
</view>
</template>
<!-- 无数据 -->
<template v-else>
<u-empty marginTop="200rpx" mode="data"> </u-empty>
</template>
<u-picker
:show="show"
:columns="[list]"
keyName="growthName"
@cancel="show = false"
@confirm="select"
></u-picker>
</view>
</template>
<script>
import { studentGrowthList } from "@/api/modules/growth";
export default {
data() {
return {
selectData: null,
list: [],
// 是否展示选框
show: false,
};
},
computed: {
// 完成进度
totalTaskCompletionRate() {
if (
this.selectData.totalTaskCompletedNum &&
this.selectData.totalTaskNum
) {
let num =
this.selectData.totalTaskCompletedNum / this.selectData.totalTaskNum;
num = num * 100;
num = num.toFixed(0);
return Number(num);
} else {
return 0;
}
},
// 选修进度
electiveTaskCompletionRate() {
if (
this.selectData.electiveTaskCompletedNum &&
this.selectData.electiveTaskNum
) {
let num =
this.selectData.electiveTaskCompletedNum /
this.selectData.electiveTaskNum;
num = num * 100;
num = num.toFixed(0);
return Number(num);
} else {
return 0;
}
},
// 必修进度
requiredTaskCompletionRate() {
if (
this.selectData.requiredTaskCompletedNum &&
this.selectData.requiredTaskNum
) {
let num =
this.selectData.requiredTaskCompletedNum /
this.selectData.requiredTaskNum;
num = num * 100;
num = num.toFixed(0);
return Number(num);
} else {
return 0;
}
},
},
onLoad: function (options) {
// 获取专业力必修
studentGrowthList().then((res) => {
this.list = res.data;
this.selectData = this.list[0];
});
},
methods: {
// 切换任务
select({ value }) {
this.selectData = value[0];
this.show = false;
},
openTip() {
uni.showModal({
showCancel: false,
content:
"根据您所在的组织、标准岗位、任职资格等级,已为您匹配专业力必修任务,抓紧时间学习吧~",
});
},
// 学习任务跳转详情
loaddetail(task) {
let taskUrl = "";
if (this.selectData.template == 1) {
//路径图
let params = encodeURIComponent("routerId=" + this.selectData.id);
// "/pages/forward?to=/fe-student-h5-release/growthPath&params=" + params;
taskUrl = "/pages/forward?to=/student-h5/growthPath&params=" + params;
} else {
//任务列表
let params = encodeURIComponent("routerId=" + this.selectData.id);
taskUrl =
"/pages/forward?to=/student-h5/growthDetails&params=" + params;
}
uni.navigateTo({
url: taskUrl,
});
},
},
};
</script>
<style lang="scss" scoped>
page {
background-color: #fff;
}
.growth {
.container {
margin: 0 20rpx;
background-image: linear-gradient(to bottom, #e2eefd 0rpx, #fff 200rpx);
border: 1rpx solid #e2eefd;
border-radius: 20rpx 20rpx 0 0;
padding: 16rpx 28rpx;
.confirm {
display: flex;
justify-content: center;
padding: 45rpx 0 30rpx 0;
view {
width: 190rpx;
height: 64rpx;
border-radius: 10rpx;
background-color: #0079ee;
box-sizing: border-box;
color: #ffffff;
display: flex;
justify-content: center;
align-items: center;
}
}
.progress-item {
display: flex;
align-items: center;
margin-bottom: 28rpx;
.label {
width: 160rpx;
}
.value {
flex: 1;
}
.text {
color: #0079ee;
margin-left: 8rpx;
}
}
.progress-title {
margin-top: 34rpx;
}
.progress-text {
padding-left: 14rpx;
.total {
margin: 64rpx 0 56rpx 0;
}
}
.tip-title,
.progress-title {
display: flex;
align-items: center;
image {
width: 44rpx;
height: 44rpx;
}
view {
font-weight: 650;
color: #333333;
margin-left: 10rpx;
}
}
.tip-text {
margin-top: 28rpx;
color: #333333;
line-height: 60rpx;
}
.growth-name {
font-size: 28rpx;
color: #0079ee;
white-space: nowrap; /* 防止文本换行 */
overflow: hidden; /* 隐藏溢出的内容 */
text-overflow: ellipsis; /* 显示省略符号来代表被修剪的文本 */
}
.growth-state {
display: flex;
align-items: center;
font-size: 28rpx;
justify-content: end;
margin-top: 40rpx;
color: #333333;
}
}
.title {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx 40rpx;
}
.title-text {
display: flex;
align-items: center;
}
.select {
display: flex;
flex-direction: column;
font-size: 20rpx;
align-items: center;
image {
width: 30rpx;
height: 30rpx;
}
}
}
</style>

View File

@@ -276,6 +276,16 @@
</view>
</view>
</u-grid-item>
<u-grid-item>
<view class="one" @click="navigateTo('growth')">
<view class="one-img">
<img src="../../static/images/center/growth.jpg">
</view>
<view class="one-text">
专业力必修
</view>
</view>
</u-grid-item>
<!-- <u-grid-item>
<view class="one" @click="navigateTo('setting')">
<view class="one-img">

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 B

BIN
static/images/jindu.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
static/images/shuoming.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

167
utils/growthXajax.js Normal file
View File

@@ -0,0 +1,167 @@
import config from '../config/index.js'
import {toLogin} from '@/utils/tologin.js'
import {getToken,removeToken} from '@/utils/token.js'
import qs from 'qs'
const ReLoginUrl="/login";
const formatUrl=function(url){
return url;
}
const formRequest=function(method,url,data){
let token=getToken();
if(!token){
token='';
}
let headers={
'content-type':'application/x-www-form-urlencoded',
'XBOE-Access-Token':token
}
let reUrl=formatUrl(url);
return new Promise(function(resolve, reject){
uni.request({
url: reUrl,
method,
data: data,
xhrFields: {withCredentials: true},
dataType: 'json',
header: headers,
success:function(rs,statusCode){
if(rs.statusCode==200){
if(rs.data.status==401 || rs.data.status==402){
removeToken();
toLogin(reUrl);
// let loginPath=config.loginPath;
// if(loginPath.startsWith('http')){
// // #ifdef APP-PLUS
// plus.runtime.openURL(loginPath) //这里默认使用外部浏览器打开而不是内部web-view组件打开
// // #endif
// // #ifdef H5
// //window.open(loginPath)
// let returnUrl=window.location.protocol+'//'+window.location.host+config.context;
// location.href=config.loginPath+"?returnUrl="+encodeURIComponent(returnUrl+'/pages/login/loading');
// // #endif
// }else{
// uni.redirectTo({
// url:loginPath
// })
// }
}else{
resolve(rs.data);
}
}else{
reject("API请求错误");
}
},
fail:function(err){
reject(err);
}
});
});
}
const jsonRequest=function(method,url,data){
let token=getToken();
if(!token){
token='';
}
let headers={
'XBOE-Access-Token':token
}
let reUrl=formatUrl(url);
return new Promise(function(resolve, reject){
uni.request({
url: reUrl,
method,
data: data,
xhrFields: {withCredentials: true},
dataType: 'json',
header: headers,
success:function(rs,statusCode){
if(rs.statusCode==200){
if(rs.data.status==401 || rs.data.status==402){
removeToken();
toLogin(reUrl);
// let loginPath=config.loginPath;
// if(loginPath.startsWith('http')){
// // #ifdef APP-PLUS
// plus.runtime.openURL(loginPath) //这里默认使用外部浏览器打开而不是内部web-view组件打开
// // #endif
// // #ifdef H5
// //window.open(loginPath)
// let returnUrl=window.location.protocol+'//'+window.location.host+config.context;
// location.href=config.loginPath+"?returnUrl="+encodeURIComponent(returnUrl+'/pages/login/loading');
// // #endif
// }else{
// uni.redirectTo({
// url:loginPath
// })
// }
}else{
resolve(rs.data);
}
}else{
reject("API请求错误");
}
},
fail:function(err){
reject(err);
}
});
});
}
//get请求
const get=function(url){
return formRequest('GET',url,'');
}
//post请求
const post=function(url,data){
if(data){
data=qs.stringify(data);
}
return formRequest('POST',url,data);
}
//postJson请求
const postJson=function(url,json){
return jsonRequest('POST',url,json);
}
//put请求
const put=function(url,data){
if(data){
data=qs.stringify(data);
}
return formRequest('PUT',url,data);
}
//putJson请求
const putJson=function(url,json){
return jsonRequest('PUT',url,json);
}
//patch请求
const patch=function(url,data){
if(data){
data=qs.stringify(data);
}
return formRequest('PATCH',url,data);
}
//patchJson请求
const patchJson=function(url,json){
return jsonRequest('PATCH',url,json);
}
//delete请求
const del=function(url,data){
if(data){
data=qs.stringify(data);
}
return formRequest('DELETE',url,data);
}
export default {
get,
post,
postJson,
put,
putJson,
patch,
patchJson,
del
}