提交 d4b3e4f6 authored 作者: 刘旭's avatar 刘旭

更新ui设计

上级 0bbece9b
{
"vue3snippets.enable-compile-vue-file-on-did-save-code": true
}
<script setup lang="ts">
import { onLaunch, onShow, onHide } from '@dcloudio/uni-app';
import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
</script>
<style lang="scss">
@import './static/iconfont.css';
@import './scss/common.scss';
@import "./static/iconfont.css";
@import "./scss/common.scss";
@import "vk-uview-ui/index.scss";
.uni-tabbar {
max-width: 420px;
margin: 0 auto;
border-left: #f6f6f6 solid 1px;
border-right: #f6f6f6 solid 1px;
}
page {
background: #f5f5f5;
background: #fbfcff;
font-family: PingFang SC-Medium, PingFang SC;
}
</style>
import request from "@/utils/request"
import request from "@/utils/request";
/**
* @brief 查询我的课程
......@@ -11,7 +11,7 @@ export const getCourse = (data?: any) =>
"/LQKJ.K3.PeiXunSystem.WebApi.WebApiService.CourseDetail,LQKJ.K3.PeiXunSystem.WebApi.common.kdsvc",
"POST",
data
)
);
/**
* @brief 查询讲师介绍和课程介绍
......@@ -24,7 +24,7 @@ export const getTeachDetail = (data?: any) =>
"/LQKJ.K3.PeiXunSystem.WebApi.WebApiService.TeachDetail,LQKJ.K3.PeiXunSystem.WebApi.common.kdsvc",
"POST",
data
)
);
/**
* @brief 签到签退
......@@ -36,16 +36,16 @@ export const signInAndOut = (data?: any) =>
"/LQKJ.K3.PeiXunSystem.WebApi.WebApiEditService.ClockId,LQKJ.K3.PeiXunSystem.WebApi.common.kdsvc",
"POST",
data
)
);
/**
* @brief 查看附件
* @param data
* @return
*/
export const geFileList = (data?: any) =>
export const getFileList = (data?: any) =>
request(
"/LQKJ.K3.PeiXunSystem.WebApi.WebApiService.FilePDF,LQKJ.K3.PeiXunSystem.WebApi.common.kdsvc",
"POST",
data
)
);
import request from "@/utils/request"
import request from "@/utils/request";
/**
* @brief 静默登录
......@@ -10,7 +10,7 @@ export const login = (data: any) =>
"/LQKJ.K3.PeiXunSystem.WebApi.WebApiEditService.User,LQKJ.K3.PeiXunSystem.WebApi.common.kdsvc",
"POST",
data
)
);
/**
* @brief 学员注册
......@@ -22,7 +22,7 @@ export const register = (data: any) =>
"/LQKJ.K3.PeiXunSystem.WebApi.WebApiEditService.Login,LQKJ.K3.PeiXunSystem.WebApi.common.kdsvc",
"POST",
data
)
);
/**
* @brief 发送验证码
......@@ -34,7 +34,7 @@ export const verification = (Phone: any) =>
"/LQKJ.K3.PeiXunSystem.WebApi.WebApiEditService.Verification,LQKJ.K3.PeiXunSystem.WebApi.common.kdsvc",
"POST",
{ Phone }
)
);
/**
* @brief 手机验证码登录
......@@ -46,4 +46,4 @@ export const loginCode = (Phone: any) =>
"/LQKJ.K3.PeiXunSystem.WebApi.WebApiEditService.LoginCode,LQKJ.K3.PeiXunSystem.WebApi.common.kdsvc",
"POST",
{ Phone }
)
);
<template>
<u-navbar back-text="" :title="title" :is-back="isBack" :back-icon-name="backIconName" title-color="#000000"
:background="{ background }" title-width="400" height="48" back-icon-color="#000000"
@click-left="handleLeftIconClick">
<template #default>
<u-icon :name="backIconName" :size="22" color="#000000" style="padding: 14rpx 14rpx 14rpx 24rpx;"
@tap="handleLeftIconClick" />
</template>
<template #right>
<u-icon :name="iconName" :size="22" color="#000000" style="padding: 14rpx 14rpx 14rpx 24rpx;"
@tap="handleRight" />
</template>
</u-navbar>
<u-action-sheet :list="sheetState.list" v-model="sheetState.show" @click="onConfirm" />
<u-navbar
back-text=""
:title="title"
:is-back="isBack"
:back-icon-name="backIconName"
title-color="#000000"
:background="{ background }"
title-width="400"
height="48"
back-icon-color="#000000"
@click-left="handleLeftIconClick"
>
<template #default>
<u-icon
:name="backIconName"
:size="22"
color="#000000"
style="padding: 14rpx 14rpx 14rpx 24rpx"
@tap="handleLeftIconClick"
/>
</template>
<template #right>
<u-icon
:name="iconName"
:size="22"
color="#000000"
style="padding: 14rpx 14rpx 14rpx 24rpx"
@tap="handleRight"
/>
</template>
</u-navbar>
<u-action-sheet
:list="sheetState.list"
v-model="sheetState.show"
@click="onConfirm"
/>
</template>
<script setup lang='ts'>
<script setup lang="ts">
const props = defineProps({
title: {
type: String,
default: '',
},
backIconName: {
type: String,
default: 'arrow-left',
},
iconName: {
type: String,
default: 'more-dot-fill',
},
background: {
type: String,
default: '#eeeeee',
},
sheetList: {
type: Object,
default: [],
},
isBack: {
type: Boolean,
default: false,
},
})
const props = defineProps({
title: {
type: String,
default: ''
},
backIconName: {
type: String,
default: 'arrow-left'
},
iconName: {
type: String,
default: 'more-dot-fill'
},
background: {
type: String,
default: '#eeeeee'
},
sheetList: {
type: Object,
default: []
},
isBack: {
type: Boolean,
default: false
}
})
const emits = defineEmits(['handleRight', 'goback'])
const emits = defineEmits(['handleRight', 'goback'])
const handleRight = () => {
sheetState.show = true
// emits('handleRight')
}
const handleRight = () => {
sheetState.show = true
// emits('handleRight')
}
// 点击左侧返回图标
const handleLeftIconClick = () => {
uni.navigateBack()
}
// 点击左侧返回图标
const handleLeftIconClick = () => {
uni.navigateBack()
}
const sheetState = reactive({
list: [
{
text: '点赞',
color: 'blue',
fontSize: 28,
subText: '感谢您的点赞',
},
{
text: '分享',
},
{
text: '评论',
},
],
show: false,
})
const sheetState = reactive({
list: [{
text: '点赞',
color: 'blue',
fontSize: 28,
subText: '感谢您的点赞'
}, {
text: '分享'
}, {
text: '评论'
}],
show: false
})
const onConfirm = (index: number) => {
const item = sheetState.list[index]
// console.log(item);
// switch (item.options.operate) {
// case 'save':
const onConfirm = (index: number) => {
const item = sheetState.list[index]
console.log(item);
// switch (item.options.operate) {
// case 'save':
// break;
// }
}
// break;
// }
}
</script>
<style lang = "scss" scoped>
:deep(.u-line-1) {
font-weight: bold !important;
font-size: 16px !important;
}
:deep(.u-icon__icon) {
font-size: 20px !important;
font-weight: bold !important;
}
</style>
\ No newline at end of file
<style lang="scss" scoped>
:deep(.u-line-1) {
font-weight: bold !important;
font-size: 16px !important;
}
:deep(.u-icon__icon) {
font-size: 20px !important;
font-weight: bold !important;
}
</style>
......@@ -21,19 +21,23 @@
<u-loadmore :status="status" icon-type="flower" />
</view>
</view>
<view v-else class="empty">
<u-empty text="暂无数据" mode="list"></u-empty>
</view>
<u-empty
v-else
text="暂无数据~"
icon-size="506"
:margin-top="220"
src="../../static/img/noData.png"
></u-empty>
</view>
</template>
<script setup lang="ts">
// import headers from "@/components/header/index.vue"
import addressBookItem from "./components/addressBookItem.vue"
import { getClassBook } from "@/api/class"
import { useGlobalStore } from "@/store/useStore"
import addressBookItem from "./components/addressBookItem.vue";
import { getClassBook } from "@/api/class";
import { useGlobalStore } from "@/store/useStore";
const globalStore = useGlobalStore()
const globalStore = useGlobalStore();
const listQuery = reactive({
Phone: globalStore.infoData.FMOBILE,
classId: "",
......@@ -42,46 +46,46 @@ const listQuery = reactive({
total: 0,
type: 2,
Name: "",
})
const status = ref("loadmore")
const addressBookList = ref([] as any)
});
const status = ref("loadmore");
const addressBookList = ref([] as any);
onLoad((options: any) => {
listQuery.classId = options.classId
init()
})
listQuery.classId = options.classId;
init();
});
const search = (val: any) => {
listQuery.Name = val.value
init()
}
listQuery.Name = val.value;
init();
};
const clear = () => {
addressBookList.value = []
listQuery.Name = ""
init()
}
addressBookList.value = [];
listQuery.Name = "";
init();
};
const init = async () => {
status.value = "loading"
const { data: res } = await getClassBook(listQuery)
status.value = "loading";
const { data: res } = await getClassBook(listQuery);
if (res.code == 200) {
if (res.total > 10) status.value = "loadmore"
else status.value = "nomore"
addressBookList.value = [...addressBookList.value, ...res.data]
listQuery.total = res.total
if (res.total > 10) status.value = "loadmore";
else status.value = "nomore";
addressBookList.value = [...addressBookList.value, ...res.data];
listQuery.total = res.total;
}
}
};
// 上拉加载数据
onReachBottom(() => {
// 判断是否还有下一页数据
if (listQuery.pageIndex * listQuery.pageSize >= listQuery.total)
return (status.value = "nomore")
return (status.value = "nomore");
// // 判断是否正在请求其它数据,如果是,则不发起额外的请求
if (status.value === "loading") return
listQuery.pageIndex += 1
init()
})
if (status.value === "loading") return;
listQuery.pageIndex += 1;
init();
});
</script>
<style lang="scss" scoped>
......
<template>
<div class="address-book-container">
<u-card :show-head="false" :show-foot="false" margin="0" border-radius="20">
<view class="address-book-container">
<u-card :show-head="false" :show-foot="false" margin="0" border-radius="16">
<template #body>
<view class="address-book-content">
<view class="left">
<u-image
width="160rpx"
height="160rpx"
width="92rpx"
height="92rpx"
shape="circle"
:src="baseUrl + '/' + addressBookItem.proPhoto"
></u-image>
<view class="content">
<h4>{{ addressBookItem.stuName }}</h4>
<text class="tel">{{ addressBookItem.Phone }}</text>
<text>单位: {{ addressBookItem.stuUnit }}</text>
<text>单位:{{ addressBookItem.stuUnit }}</text>
</view>
</view>
<u-button size="mini" type="primary" @tap="contact">联系TA</u-button>
</view>
</template>
</u-card>
</div>
</view>
</template>
<script setup lang="ts">
import { baseUrl } from "@/utils/request"
import { baseUrl } from "@/utils/request";
const props = defineProps({
addressBookItem: {
type: Array,
default: () => [],
} as any,
})
});
const contact = () => {
location.href = "tel:" + props.addressBookItem.Phone
}
location.href = "tel:" + props.addressBookItem.Phone;
};
</script>
<style lang="scss" scoped>
.address-book-container {
margin-bottom: 32rpx;
height: 200rpx;
// height: 200rpx;
:deep(.u-card__body) {
padding: 16rpx 32rpx !important;
}
.address-book-content {
display: flex;
......@@ -49,15 +52,27 @@ const contact = () => {
.left {
display: flex;
align-items: center;
.content {
display: flex;
flex-direction: column;
justify-content: flex-end;
margin-left: 20rpx;
color: #909399;
font-size: 26rpx;
h4 {
font-size: 28rpx;
font-weight: 500;
color: #000000;
}
.tel {
margin: 20rpx 0;
margin: 8rpx 0 4rpx;
font-size: 24rpx;
font-weight: 400;
color: rgba(34, 34, 34, 0.5);
}
}
}
......
<template>
<view class="arrange-item-container">
<h3>
&nbsp;{{ dayjs(arrangeItem.startDate).format("YYYY-MM-DD") }}&nbsp;&nbsp;
<view class="opening-time">
开课时间: &nbsp;{{
dayjs(arrangeItem.startDate).format("YYYY-MM-DD")
}}&nbsp;&nbsp;
{{
dateFormat(arrangeItem.startDate) +
"~" +
dateFormat(arrangeItem.endDate)
}}
</h3>
</view>
<u-card :show-head="false" margin="0">
<template #body>
<view class="arrange-header">
<h3>{{ arrangeItem.courseName }}</h3>
<u-button size="mini" plain :type="arrangeStatus.type">{{
arrangeStatus.detail
}}</u-button>
</view>
<view class="item">
<u-icon name="account" />
<text v-for="(item, i) in arrangeItem.Teachs" :key="i">
&nbsp;{{ item.teachName }}&nbsp;
</text>
</view>
<view class="item">
<u-icon name="map" />
<text>&nbsp;{{ arrangeItem.classArea }}&nbsp;</text>
</view>
</template>
<template #foot>
<view class="arrange-footer" @tap="openInfo">
<u-icon name="order" />
<text>课件资料</text>
<view class="body">
<view>
<view class="arrange-header">
<h3>{{ arrangeItem.courseName }}</h3>
</view>
<view class="item" style="margin: 32rpx 0 24rpx">
<u-icon size="32" name="account" />
<text v-for="(item, i) in arrangeItem.Teachs" :key="i">
&nbsp;{{ item.teachName }}&nbsp;
</text>
</view>
<view class="item">
<u-icon size="32" name="map" />
<text>&nbsp;{{ arrangeItem.classArea }}&nbsp;</text>
</view>
</view>
<view class="courseware">
<view>
<u-badge
type="error"
size="mini"
:count="arrangeItem.FileCount"
:offset="[-4, -4]"
></u-badge>
<u-icon
name="file-text-fill"
color="#05a8ff"
size="40"
class="courseware-icon"
@tap="openInfo"
></u-icon>
</view>
<view class="desc">课程资料</view>
</view>
<view
:type="arrangeStatus.type"
:class="arrangeStatus.type"
class="body-right"
>
{{ arrangeStatus.detail }}
</view>
</view>
</template>
<!-- <template #foot>
<view class="courseware" @tap="openInfo">
<u-icon name="order" />
<text>课程资料</text>
</view>
</template> -->
</u-card>
</view>
<infoPopup
......@@ -43,87 +71,113 @@
</template>
<script setup lang="ts">
import infoPopup from "@/pages/course/components/infoPopup.vue"
import dayjs from "dayjs"
import infoPopup from "@/pages/course/components/infoPopup.vue";
import dayjs from "dayjs";
const props = defineProps({
arrangeItem: {
type: Array,
default: () => [],
} as any,
})
});
const show = ref(false)
const infoRef = ref()
const arrangeDetail = ["上课中", "未开始", "已下课"]
const show = ref(false);
const infoRef = ref();
const arrangeDetail = ["上课中", "未开始", "已下课"];
const arrangeStatus = computed(() => {
const statusObj = {
type: "",
detail: "",
}
color: "",
};
switch (props.arrangeItem.courseType) {
case 0:
statusObj.type = "primary"
break
statusObj.type = "success";
break;
case 1:
statusObj.type = "warning"
break
statusObj.type = "primary";
break;
case 2:
statusObj.type = "info"
break
statusObj.type = "info";
break;
}
statusObj.detail = arrangeDetail[props.arrangeItem.courseType]
return statusObj
})
statusObj.detail = arrangeDetail[props.arrangeItem.courseType];
return statusObj;
});
const dateFormat = (dateStr: string) => {
// 创建一个日期对象,传入特定日期和时间
const date = new Date(dateStr)
const date = new Date(dateStr);
// 获取小时和分钟
const hours = ("0" + date.getHours()).slice(-2)
const minutes = ("0" + date.getMinutes()).slice(-2)
const hours = ("0" + date.getHours()).slice(-2);
const minutes = ("0" + date.getMinutes()).slice(-2);
// 构建时间字符串
const time = hours + ":" + minutes
return time
}
const time = hours + ":" + minutes;
return time;
};
const openInfo = () => {
show.value = true
infoRef.value.init()
}
show.value = true;
infoRef.value.init();
};
</script>
<style lang="scss" scoped>
.arrange-item-container {
h3 {
margin-bottom: 32rpx;
.opening-time {
margin-bottom: 24rpx;
font-size: 28rpx;
font-weight: 400;
color: rgba(0, 0, 0, 0.6);
}
.arrange-header {
.body {
position: relative;
display: flex;
justify-content: space-between;
align-items: center;
h3 {
margin: 0;
.arrange-header {
display: flex;
justify-content: space-between;
align-items: center;
h3 {
margin: 0;
font-size: 34rpx;
font-weight: 500;
color: #222222;
}
uni-button {
margin: 0;
}
}
uni-button {
margin: 0;
.body-right {
position: absolute;
bottom: -29rpx;
right: -29rpx;
text-align: center;
font-size: 24rpx;
color: #2979ff;
background: #e4e4e4;
border-radius: 24rpx 0rpx 24rpx 0rpx;
padding: 4rpx 16rpx;
}
.info {
color: #82848a;
background-color: #e4e4e4;
}
.success {
color: #19be6b;
background-color: #deffd9;
}
}
.item {
margin: 20rpx 0;
}
.arrange-footer {
text-align: end;
text {
color: #2979ff;
}
font-size: 28rpx;
font-weight: 400;
color: rgba(34, 34, 34, 0.9);
}
}
</style>
<template>
<div class="class-item-container">
<view class="class-item-container">
<u-card :show-head="false" margin="0" border-radius="20">
<template #body>
<view class="calss-header">
<h3>{{ classItem.className }}</h3>
<u-button
<view
v-show="current == 2 && !classItem.iEevaluate"
size="mini"
type="primary"
@tap="toEvaluate"
>去评价</u-button
style="color: #04a7ff"
>
<u-button
去评价<u-icon name="arrow-right-double" style="margin-left: 8rpx" />
</view>
<!-- <view
v-show="current == 2 && classItem.iEevaluate"
size="mini"
type="primary"
@tap="toEvaluate"
>查看评价</u-button
style="color: #04a7ff"
>
查看评价<u-icon
name="arrow-right-double"
style="margin-left: 8rpx"
/>
</view> -->
</view>
<view class="item">
<text>课程时间:</text>
......@@ -28,42 +31,71 @@
<text>{{ classItem.classArea }}</text>
</view>
<view> </view>
<view class="progress item">
<view class="class-progress item">
<text>课程进度:</text>
<u-line-progress
active-color="#2979ff"
active-color="#5363FF"
:percent="percent ? percent : 0"
:height="25"
:show-percent="false"
:height="20"
style="margin-top: 10rpx"
/>
<view class="progress">
{{
(props.classItem.coursePro[0]?.SumPro
? props.classItem.coursePro[0]?.SumPro
: "0") +
"/" +
props.classItem.courseSum[0]?.Sum
}}
</view>
</view>
<view class="class-teacher item">
<text>班主任:</text>
<u-tag
v-for="(item, index) in classItem.Management"
:key="index"
:text="item.teachName"
shape="circle"
/>
<view>
<view
v-for="(item, index) in classItem.Management"
:key="index"
class="btn"
@tap="contact(item.teacPhone)"
>
<u-image src="../../../static/img/phone.png" />
<view>{{ item.teachName }}</view>
</view>
</view>
</view>
</template>
<template #foot>
<view class="class-footer">
<u-button size="mini" plain @tap="toAddressBook">班级通讯录</u-button>
<u-button size="mini" plain @tap="classQrCode">班级二维码</u-button>
<u-button type="primary" size="mini" plain @tap="toCourseArrange"
<u-button size="mini" shape="circle" @tap="toAddressBook"
>班级通讯录</u-button
>
<u-button size="mini" shape="circle" @tap="classQrCode"
>班级二维码</u-button
>
<u-button
size="mini"
shape="circle"
hover-class="background-color: #04a7ff; color: #ffffff"
style="background-color: #04a7ff; color: #ffffff"
@tap="toCourseArrange"
>课程安排</u-button
>
</view>
</template>
</u-card>
</div>
</view>
<saveQrCode v-model="show" :Url="classItem.Url" />
<saveQrCode
v-model="show"
:Url="classItem.Url"
:title="classItem.className"
/>
</template>
<script setup lang="ts">
import saveQrCode from "./saveQrCode.vue"
import saveQrCode from "./saveQrCode.vue";
const props = defineProps({
classItem: {
......@@ -74,30 +106,30 @@ const props = defineProps({
type: Number,
default: 0,
},
})
});
const show = ref(false)
const show = ref(false);
const percent = computed(
() =>
(props.classItem.coursePro[0]?.SumPro / props.classItem.courseSum[0].Sum) *
(props.classItem.coursePro[0]?.SumPro / props.classItem.courseSum[0]?.Sum) *
100
)
);
const classQrCode = () => {
show.value = true
}
show.value = true;
};
const toAddressBook = () => {
uni.navigateTo({
url: "/pages/class/addressBook?classId=" + props.classItem.classId,
})
}
});
};
const toCourseArrange = () => {
uni.navigateTo({
url: "/pages/class/courseArrange?classId=" + props.classItem.classId,
})
}
});
};
const toEvaluate = () => {
uni.navigateTo({
......@@ -110,22 +142,33 @@ const toEvaluate = () => {
props.classItem.classId +
"&ItemNumber=" +
props.classItem.ItemNumber,
})
}
});
};
const contact = (tel: string) => {
location.href = "tel:" + tel;
};
</script>
<style lang="scss" scoped>
.class-item-container {
margin-bottom: 20rpx;
margin-bottom: 32rpx;
:deep(.u-card__body) {
padding: 40rpx 32rpx !important;
}
.calss-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16rpx;
margin-bottom: 32rpx;
h3 {
margin: 0;
font-size: 34rpx;
font-weight: 500;
color: #222222;
}
uni-button {
......@@ -136,11 +179,13 @@ const toEvaluate = () => {
.item {
display: flex;
align-items: flex-start;
margin-bottom: 24rpx;
text {
display: block;
padding: 12rpx 0;
font-size: 28rpx;
font-weight: 400;
color: rgba(34, 34, 34, 0.9);
}
text:first-child {
......@@ -152,10 +197,19 @@ const toEvaluate = () => {
}
}
.progress {
.class-progress {
display: flex;
align-items: center;
.progress {
margin-left: 10px;
margin-top: 8rpx;
}
.u-progress {
margin-left: 20rpx;
}
text {
white-space: nowrap;
}
......@@ -169,9 +223,23 @@ const toEvaluate = () => {
.class-teacher {
display: flex;
align-items: center;
margin-top: 16rpx;
.u-tag {
margin-right: 20rpx;
.btn {
height: 56rpx;
padding: 14rpx 36rpx 14rpx 14rpx;
background: #04a7ff;
border-radius: 112rpx;
color: #ffffff;
display: flex;
align-items: center;
justify-content: center;
.u-image {
margin-right: 6rpx;
width: 50rpx !important;
height: 46rpx !important;
}
}
}
......@@ -180,9 +248,9 @@ const toEvaluate = () => {
display: flex;
justify-content: flex-end;
uni-button {
margin-left: 30rpx;
margin-right: 0;
.u-btn {
height: 56rpx;
margin: 0 16rpx 0 0;
}
}
}
......
......@@ -7,14 +7,9 @@
width="80%"
>
<view class="qrcode">
<view class="title">班级二维码</view>
<view class="title">{{ title }}</view>
<view class="image">
<u-image
width="100%"
height="500rpx"
:src="baseUrl + '/' + Url"
ref="canvasRef"
/>
<u-image width="100%" height="500rpx" :src="baseUrl + '/' + Url" />
</view>
</view>
<!-- <view class="footer">
......@@ -26,14 +21,13 @@
</template>
<script setup lang="ts">
import { baseUrl } from "@/utils/request"
import { baseUrl } from "@/utils/request";
const props = defineProps({
show: Boolean,
Url: String,
})
const canvasRef = ref()
title: String,
});
</script>
<style lang="scss" scoped>
......
<template>
<!-- <headers title="课程安排" /> -->
<view class="course-arrange-container">
<view class="progress">
<text>课程进</text>
<view class="course-arrange-progress">
<text>课程进</text>
<u-line-progress
active-color="#2979ff"
active-color="#5363ff"
:percent="percent ? percent : 0"
:height="25"
:show-percent="false"
:height="20"
style="margin-top: 10rpx"
/>
<view class="progress">
{{
(totalPercentage ? totalPercentage : "0") + "/" + arrangeList.length
}}
</view>
</view>
<view v-if="arrangeList.length">
<u-time-line>
<u-time-line-item v-for="(item, index) in arrangeList" :key="index">
<template #node>
<view class="u-node">
<view class="u-dot"></view>
</view>
<u-icon name="clock-fill" color="#909399" />
</template>
<template #content>
<arrangeItem :arrangeItem="item" />
......@@ -33,14 +38,14 @@
</template>
<script setup lang="ts">
// import headers from "@/components/header/index.vue"
import arrangeItem from "./components/arrangeItem.vue"
import { getCourse } from "@/api/course"
import { useGlobalStore } from "@/store/useStore"
import arrangeItem from "./components/arrangeItem.vue";
import { getCourse } from "@/api/course";
import { useGlobalStore } from "@/store/useStore";
const arrangeList = ref([] as any)
const globalStore = useGlobalStore()
const percent = ref()
const arrangeList = ref([] as any);
const globalStore = useGlobalStore();
const percent = ref();
const totalPercentage = ref();
const listQuery = reactive({
Phone: globalStore.infoData.FMOBILE,
pageIndex: 1,
......@@ -49,58 +54,66 @@ const listQuery = reactive({
type: 5,
classId: "",
Name: "",
})
});
const status = ref("loadmore")
const status = ref("loadmore");
onLoad((options: any) => {
listQuery.classId = options.classId
init()
})
listQuery.classId = options.classId;
init();
});
// 上拉加载数据
onReachBottom(() => {
// 判断是否还有下一页数据
if (listQuery.pageIndex * listQuery.pageSize >= listQuery.total)
return (status.value = "nomore")
return (status.value = "nomore");
// // 判断是否正在请求其它数据,如果是,则不发起额外的请求
if (status.value === "loading") return
listQuery.pageIndex += 1
init()
})
if (status.value === "loading") return;
listQuery.pageIndex += 1;
init();
});
const init = async () => {
status.value = "loading"
const { data: res } = await getCourse(listQuery)
status.value = "loading";
const { data: res } = await getCourse(listQuery);
if (res.code == 200) {
if (res.total > 10) status.value = "loadmore"
else status.value = "nomore"
arrangeList.value = [...arrangeList.value, ...res.data]
listQuery.total = res.total
let num: number = res.data.filter(
if (res.total > 10) status.value = "loadmore";
else status.value = "nomore";
arrangeList.value = [...arrangeList.value, ...res.data];
listQuery.total = res.total;
totalPercentage.value = res.data.filter(
(item: any) => item.courseType === 2
).length
percent.value = (num / res.total) * 100
).length;
percent.value = (totalPercentage.value / res.total) * 100;
// console.log(arrangeList.value)
}
}
};
</script>
<style lang="scss" scoped>
.course-arrange-container {
padding: 0 20rpx;
// padding: 0 20rpx;
padding-right: 32rpx;
margin-left: 32rpx;
.progress {
.course-arrange-progress {
display: flex;
align-items: center;
justify-content: center;
padding: 26rpx 10rpx 50rpx 30rpx;
padding: 32rpx 0 56rpx;
width: 90%;
.progress {
margin-left: 10px;
margin-top: 8rpx;
}
text {
display: block;
padding: 12rpx 0;
font-size: 32rpx;
white-space: nowrap;
font-size: 28rpx;
font-weight: 400;
color: rgba(34, 34, 34, 0.9);
margin-top: 6rpx;
}
.registered {
......@@ -108,14 +121,6 @@ const init = async () => {
color: #3b99fc;
}
}
.u-dot {
height: 22rpx;
width: 22rpx;
border-radius: 3.125rem;
background: #2979ff;
box-shadow: 0 0 10px rgba(0, 0, 0.6, 0.412);
}
}
:deep(uni-modal) {
z-index: 99999 !important;
......
......@@ -5,7 +5,13 @@
:list="tabsState.list"
:is-scroll="false"
v-model="tabsState.current"
bg-color="#f5f5f5"
:active-item-style="{ fontSize: '34rpx', color: '#000000' }"
font-size="28"
bar-width="72"
bar-height="6"
bg-color="#fbfcff"
inactive-color="#cecfcf"
active-color="#05a8ff"
@change="tabsChange"
/>
<!-- 搜索 -->
......@@ -19,9 +25,7 @@
/>
<!-- 内容 -->
<view v-if="classList.length">
<text style="margin-bottom: 20rpx; display: block"
>为你找到{{ listQuery.total }}个的班级</text
>
<text class="fund">为你找到{{ listQuery.total }}个的班级</text>
<block v-for="(item, index) in classList" :key="index">
<classItem :classItem="item" :current="tabsState.current" />
......@@ -30,19 +34,23 @@
<u-loadmore :status="status" icon-type="flower" />
</view>
</view>
<view v-else class="empty">
<u-empty text="暂无数据" mode="list"></u-empty>
</view>
<u-empty
v-else
text="暂无数据~"
icon-size="506"
:margin-top="220"
src="../../static/img/noData.png"
></u-empty>
</view>
</template>
<script setup lang="ts">
// import headers from "@/components/header/index.vue"
import classItem from "./components/classItem.vue"
import { getClassDetail } from "@/api/class"
import { useGlobalStore } from "@/store/useStore"
import classItem from "./components/classItem.vue";
import { getClassDetail } from "@/api/class";
import { useGlobalStore } from "@/store/useStore";
const globalStore = useGlobalStore()
const globalStore = useGlobalStore();
const tabsState = reactive({
list: [
......@@ -57,9 +65,9 @@ const tabsState = reactive({
},
],
current: 0,
})
});
const classList = ref([] as any)
const classList = ref([] as any);
const listQuery = reactive({
Phone: globalStore.infoData.FMOBILE,
......@@ -69,74 +77,69 @@ const listQuery = reactive({
total: 0,
type: 0,
Name: "",
})
});
const status = ref("loadmore")
const status = ref("loadmore");
const tabsChange = (index: number) => {
classList.value = []
classList.value = [];
switch (index) {
case 0:
listQuery.type = 0
break
listQuery.type = 0;
break;
case 1:
listQuery.type = 1
break
listQuery.type = 1;
break;
default:
listQuery.type = 2
break
listQuery.type = 2;
break;
}
init()
}
init();
};
const search = (val: any) => {
listQuery.Name = val.value
tabsChange(tabsState.current)
}
listQuery.Name = val.value;
tabsChange(tabsState.current);
};
const clear = () => {
listQuery.Name = ""
tabsChange(tabsState.current)
}
listQuery.Name = "";
tabsChange(tabsState.current);
};
// 上拉加载数据
onReachBottom(() => {
// 判断是否还有下一页数据
if (listQuery.pageIndex * listQuery.pageSize >= listQuery.total)
return (status.value = "nomore")
return (status.value = "nomore");
// // 判断是否正在请求其它数据,如果是,则不发起额外的请求
if (status.value === "loading") return
listQuery.pageIndex += 1
init()
})
if (status.value === "loading") return;
listQuery.pageIndex += 1;
init();
});
const init = async () => {
status.value = "loading"
const { data: res } = await getClassDetail(listQuery)
status.value = "loading";
const { data: res } = await getClassDetail(listQuery);
if (res.code == 200) {
if (res.total > 10) status.value = "loadmore"
else status.value = "nomore"
classList.value = [...classList.value, ...res.data]
listQuery.total = res.total
console.log(classList.value)
if (res.total > 10) status.value = "loadmore";
else status.value = "nomore";
classList.value = [...classList.value, ...res.data];
listQuery.total = res.total;
// console.log(classList.value);
}
}
};
onShow(() => {
classList.value = []
listQuery.pageIndex = 1
listQuery.pageSize = 10
init()
})
classList.value = [];
listQuery.pageIndex = 1;
listQuery.pageSize = 10;
init();
});
</script>
<style lang="scss" scoped>
.class-container {
padding: 0 30rpx 30rpx;
.uni-searchbar {
padding: 0;
margin: 20rpx 0;
}
}
</style>
......@@ -3,40 +3,57 @@
v-model="props.show"
mode="bottom"
closeable
safe-area-inset-bottom
height="40%"
border-radius="30"
@close="handeClose"
>
<view class="info">
<block v-if="infoList.length">
<text class="title">课件资料</text>
<view v-for="(item, i) in infoList" :key="i" class="item">
<view>
<u-icon name="order" size="50"></u-icon>
<text>{{ item.name }}</text>
</view>
<view>
<u-icon
name="eye-fill"
size="50"
style="margin-right: 30rpx"
@tap="pdfView(item)"
></u-icon>
<u-icon name="download" size="50" @tap="downLoadPdf(item)"></u-icon>
<view style="width: 100%">
<view class="title">课程资料</view>
<view v-if="infoList.length">
<view v-for="(item, i) in infoList" :key="i" class="item">
<view>
<u-image
src="../../../static/img/PDF.png"
width="35"
height="40"
></u-image>
<view class="pdf-name">{{ item.name }}</view>
</view>
<view>
<u-image
src="../../../static/img/Check.png"
width="35"
height="40"
style="margin-right: 30rpx"
@tap="pdfView(item)"
></u-image>
<u-image
src="../../../static/img/download.png"
width="35"
height="40"
@tap="downLoadPdf(item)"
></u-image>
</view>
</view>
</view>
</block>
<view v-else class="empty">
<u-empty text="暂无资料" mode="list" />
<u-empty
v-else
text="暂无数据~"
icon-size="300"
:margin-top="100"
src="../../static/img/noData.png"
></u-empty>
</view>
</view>
</u-popup>
</template>
<script setup lang="ts">
import { zconfirm } from "@/utils/util"
import { geFileList } from "@/api/course"
import { baseUrl } from "@/utils/request"
import { zconfirm } from "@/utils/util";
import { getFileList } from "@/api/course";
import { baseUrl } from "@/utils/request";
const props = defineProps({
show: {
......@@ -47,9 +64,9 @@ const props = defineProps({
type: String,
default: "",
},
})
});
const emits = defineEmits(["update:show"])
const emits = defineEmits(["update:show"]);
const pdfView = (item: any) => {
uni.navigateTo({
......@@ -58,38 +75,37 @@ const pdfView = (item: any) => {
item.name +
"&url=" +
encodeURIComponent(baseUrl + "/" + item.url),
})
}
});
};
const infoList = ref([] as any)
const infoList = ref([] as any);
const downLoadPdf = (item: any) => {
zconfirm("确定下载课资料?", (result: boolean) => {
zconfirm("确定下载课资料?", (result: boolean) => {
if (result) {
const url = baseUrl + "/" + item.url
const a = document.createElement("a")
a.href = url
a.download = item.name
a.click()
const url = baseUrl + "/" + item.url;
const a = document.createElement("a");
a.href = url;
a.download = item.name;
a.click();
}
})
}
});
};
const handeClose = () => {
emits("update:show", false)
}
emits("update:show", false);
};
const init = async () => {
const { data: res } = await geFileList({ courseNumber: props.courseNumber })
const { data: res } = await getFileList({ courseNumber: props.courseNumber });
if (res.code == 200) {
console.log(res)
infoList.value = res.data
infoList.value = res.data;
}
}
};
defineExpose({
init,
})
});
</script>
<style lang="scss" scoped>
......@@ -97,19 +113,18 @@ defineExpose({
display: flex;
flex-direction: column;
align-items: center;
padding: 0 30rpx;
padding: 0 32rpx;
.title {
// position: sticky;
// top: 0;
// left: 0;
height: 90rpx;
line-height: 90rpx;
font-size: 32rpx;
font-weight: bolder;
color: $u-main-color;
text-align: center;
width: 100%;
margin-bottom: 48rpx;
margin-top: 30rpx;
height: 48rpx;
font-size: 34rpx;
font-weight: 500;
color: #222222;
line-height: 40rpx;
}
.item {
......@@ -117,30 +132,37 @@ defineExpose({
display: flex;
justify-content: space-between;
align-items: center;
background-color: $u-type-info-light;
width: 100%;
height: 100rpx;
padding: 30rpx;
padding: 20rpx 40rpx;
border-radius: 10rpx;
margin-bottom: 20rpx;
// height: 88rpx;
background: #ffffff;
box-shadow: 0rpx 8rpx 60rpx 0rpx rgba(0, 0, 0, 0.05);
border-radius: 16rpx;
view {
display: flex;
align-items: center;
text {
margin-left: 10rpx;
display: block;
font-size: 32rpx;
color: #000000;
.pdf-name {
margin-left: 22rpx;
font-size: 28rpx;
font-weight: 400;
color: rgba(34, 34, 34, 0.9);
}
}
}
}
</style>
<style>
<style lang="scss" scoped>
:deep(uni-modal) {
z-index: 19999 !important;
}
:deep(.uni-scroll-view-content) {
background-color: #fbfcff;
}
</style>
<template>
<!-- <headers title="培训评价" /> -->
<view class="evaluate-container">
<u-card :show-head="false" :show-foot="false" margin="0" border-radius="20">
<u-card :show-head="false" :show-foot="false" margin="0" border-radius="24">
<template #body>
<h4>尊敬的各位学员:</h4>
<h4 style="font-weight: bolder; color: #000000; font-size: 28rpx">
尊敬的各位学员:
</h4>
<text class="detail">
感谢您参加本次培训班!请各位学员对此次授课老师及教学安排进行满意度评价,同时我们也欢迎您提出意见和建议,您的感受及观点对我们非常重要谢谢!
</text>
</template>
</u-card>
<u-card :show-head="false" :show-foot="false" margin="0" border-radius="20">
<view class="courseEvaluation">
<view class="half-circle"></view>
课程评价
</view>
<u-card :show-head="false" :show-foot="false" margin="0" border-radius="24">
<template #body>
<view>
<view class="rateItem">
......@@ -17,56 +22,64 @@
<u-rate
:count="5"
v-model="evaluateData.parmeters.Model.FContent"
size="42"
size="44"
active-color="#F7BA2A"
:disabled="disabled"
/>
<view class="rate">
{{ evaluateStr(evaluateData.parmeters.Model.FContent) }}
</view>
</view>
<view class="rateItem">
<h4>授课讲师</h4>
<u-rate
:count="5"
v-model="evaluateData.parmeters.Model.FLecturer"
size="42"
v-model="evaluateData.parmeters.Model.FClassService"
size="44"
active-color="#F7BA2A"
:disabled="disabled"
/>
<view class="rate">
{{ evaluateStr(evaluateData.parmeters.Model.FClassService) }}
</view>
</view>
</view>
</template>
</u-card>
<u-card :show-head="false" :show-foot="false" margin="0" border-radius="20">
<template #body>
<text style="margin-top: 40rpx"> 您的培训收获与意见建议: </text>
<view class="evaluate-textarea last">
<view class="evaluate-item">
<view class="title">您的培训收获与意见建议:</view>
<u-card
:show-head="false"
:show-foot="false"
margin="0"
border-radius="24"
>
<template #body>
<u-input
v-model="evaluateData.parmeters.Model.FOpinion"
type="textarea"
placeholder-style="background-color: #f5f5f5;font-size: 24rpx;overflow-y: auto;"
height="160"
placeholder-style="font-size: 24rpx;font-weight: 400;color: #BCBCBC;"
maxlength="1400"
:auto-height="false"
placeholder="快来说说您的想法~"
:disabled="disabled"
/>
</view>
</template>
</u-card>
</template>
</u-card>
</view>
<view class="submit" v-show="!disabled">
<u-button type="primary" @tap="submit">确定提交</u-button>
<u-button @tap="submit">确定提交</u-button>
</view>
</view>
</template>
<script setup lang="ts">
// import headers from "@/components/header/index.vue"
import { remarkOn, remarkDetail } from "@/api/class"
import { useGlobalStore } from "@/store/useStore"
import { toast, zconfirm } from "@/utils/util"
import { remarkOn, remarkDetail } from "@/api/class";
import { useGlobalStore } from "@/store/useStore";
import { toast, zconfirm, evaluateStr } from "@/utils/util";
const globalStore = useGlobalStore()
const disabled = ref(false)
const globalStore = useGlobalStore();
const disabled = ref(false);
const evaluateData = reactive({
parmeters: {
NeedReturnFields: ["FID"],
......@@ -95,12 +108,12 @@ const evaluateData = reactive({
FClassService: 0, //班主任服务
},
},
})
});
onLoad(async (options: any) => {
evaluateData.parmeters.Model.FClass.FNUMBER = options.classNumber
evaluateData.parmeters.Model.FCourse.FNUMBER = options.courseNumber
evaluateData.parmeters.Model.FTrainingPro.FNUMBER = options.ItemNumber
evaluateData.parmeters.Model.FClass.FNUMBER = options.classNumber;
evaluateData.parmeters.Model.FCourse.FNUMBER = options.courseNumber;
evaluateData.parmeters.Model.FTrainingPro.FNUMBER = options.ItemNumber;
if (options.iEvaluate != "false") {
let data = {
classId: "",
......@@ -108,37 +121,37 @@ onLoad(async (options: any) => {
studentId: globalStore.infoData.FSTUDENTID,
pageIndex: 1,
pageSize: 10,
}
const { data: res } = await remarkDetail(data)
};
const { data: res } = await remarkDetail(data);
if (res.code == 200) {
evaluateData.parmeters.Model.FClassService = res.data[0].FCLASSSERVICE
evaluateData.parmeters.Model.FContent = res.data[0].FCONTENT
evaluateData.parmeters.Model.FLecturer = res.data[0].LECTURER
evaluateData.parmeters.Model.FPostService = res.data[0].FPOSTSERVICE
evaluateData.parmeters.Model.FHighlights = res.data[0].FHIGHLIGHTS
evaluateData.parmeters.Model.FSupplement = res.data[0].FSUPPLEMENT
evaluateData.parmeters.Model.FOpinion = res.data[0].FOPINION
disabled.value = true
evaluateData.parmeters.Model.FClassService = res.data[0].FCLASSSERVICE;
evaluateData.parmeters.Model.FContent = res.data[0].FCONTENT;
evaluateData.parmeters.Model.FLecturer = res.data[0].LECTURER;
evaluateData.parmeters.Model.FPostService = res.data[0].FPOSTSERVICE;
evaluateData.parmeters.Model.FHighlights = res.data[0].FHIGHLIGHTS;
evaluateData.parmeters.Model.FSupplement = res.data[0].FSUPPLEMENT;
evaluateData.parmeters.Model.FOpinion = res.data[0].FOPINION;
disabled.value = true;
}
}
})
});
const submit = () => {
zconfirm("确定提交评价?", async (result: boolean) => {
if (result) {
const { data: res } = await remarkOn(evaluateData)
const { data: res } = await remarkOn(evaluateData);
if (res.code == 200) {
uni.navigateBack()
toast("评价成功")
uni.navigateBack();
toast("评价成功");
}
}
})
}
});
};
</script>
<style lang="scss" scoped>
.evaluate-container {
padding: 30rpx;
padding: 30rpx 30rpx 110rpx 30rpx;
.u-card {
margin-bottom: 10rpx !important;
......@@ -151,7 +164,9 @@ const submit = () => {
text-indent: 2em;
display: block;
font-size: 28rpx;
margin-top: 10rpx;
margin-top: 20rpx;
font-weight: 400;
color: rgba(34, 34, 34, 0.8);
}
.rateItem {
......@@ -167,23 +182,45 @@ const submit = () => {
h4 {
width: 140rpx;
margin-right: 20rpx;
font-size: 28rpx;
font-weight: 500;
color: rgba(34, 34, 34, 0.9);
}
}
.evaluate-textarea {
background-color: #f5f5f5;
padding: 0 10rpx;
box-sizing: border-box;
margin: 20rpx 0;
}
.evaluate-item {
margin-top: 40rpx;
.title {
font-size: 28rpx;
font-weight: 400;
color: rgba(0, 0, 0, 0.9);
margin-bottom: 24rpx;
}
.last {
margin-bottom: 0;
:deep(.u-card__body) {
padding: 20rpx 24rpx !important;
}
:deep(.uni-textarea-placeholder, .u-input__textarea) {
background-color: #ffffff !important;
}
:deep(.uni-textarea-compute) {
font-size: 24rpx;
font-weight: 400;
color: rgba(0, 0, 0, 0.6);
}
:deep(.uni-textarea-textarea) {
overflow-y: auto !important;
}
}
}
.submit {
margin: 40rpx 40rpx 0;
margin: 64rpx 184rpx 0;
.u-btn {
width: 320rpx;
height: 96rpx;
background: #05a8ff;
border-radius: 12rpx;
color: #ffffff;
}
}
</style>
......@@ -5,12 +5,18 @@
:list="tabsState.list"
:is-scroll="false"
v-model="tabsState.current"
bg-color="#f5f5f5"
:active-item-style="{ fontSize: '34rpx', color: '#000000' }"
font-size="28"
bar-width="72"
bar-height="6"
bg-color="#fbfcff"
inactive-color="#cecfcf"
active-color="#05a8ff"
@change="tabsChange"
/>
<!-- 搜索 -->
<uni-search-bar
v-show="tabsState.current"
v-show="tabsState.current !== 0"
placeholder="班级名称"
bgColor="#ffffff"
clearButton="auto"
......@@ -20,12 +26,9 @@
/>
<!-- 内容 -->
<view v-if="courseList.length">
<text
v-if="tabsState.current"
style="margin-bottom: 20rpx; display: block"
<text v-show="tabsState.current" class="fund"
>为你找到{{ listQuery.total }}个的班级</text
>
<!-- <view v-if="tabsState.current" class="tag">
<u-tag
v-for="(item, i) in tagList"
......@@ -49,20 +52,24 @@
<u-loadmore :status="status" icon-type="flower" />
</view>
</view>
<view v-else class="empty">
<u-empty text="暂无数据" mode="list" />
</view>
<u-empty
v-else
text="暂无数据~"
icon-size="506"
:margin-top="220"
src="../../static/img/noData.png"
></u-empty>
</view>
</template>
<script setup lang="ts">
// import headers from "@/components/header/index.vue"
import courseItem from "./components/courseItem.vue"
import useQqMaps from "@/utils/QqMaps"
import { getCourse } from "@/api/course"
import { useGlobalStore } from "@/store/useStore"
import courseItem from "./components/courseItem.vue";
import useQqMaps from "@/utils/QqMaps";
import { getCourse } from "@/api/course";
import { useGlobalStore } from "@/store/useStore";
const globalStore = useGlobalStore()
const globalStore = useGlobalStore();
const tabsState = reactive({
list: [
......@@ -77,7 +84,7 @@ const tabsState = reactive({
},
],
current: 0,
})
});
const tagList = ref([
{ type: "primary", name: "全部" },
......@@ -85,9 +92,9 @@ const tagList = ref([
{ type: "info", name: "缺勤" },
{ type: "info", name: "请假" },
{ type: "info", name: "补签" },
])
]);
const status = ref("loadmore")
const status = ref("loadmore");
const listQuery = reactive({
Phone: globalStore.infoData.FMOBILE,
......@@ -97,80 +104,86 @@ const listQuery = reactive({
total: 0,
classId: "",
Name: "",
})
});
const courseList: any = ref([] as any)
const courseList: any = ref([] as any);
const { initQqMaps } = useQqMaps()
const { initQqMaps } = useQqMaps();
//点击标签
const tabsChange = (index: number) => {
courseList.value = []
listQuery.pageIndex = 1
listQuery.pageSize = 10
courseList.value = [];
listQuery.pageIndex = 1;
listQuery.pageSize = 10;
switch (index) {
case 0:
listQuery.type = 0
break
listQuery.type = 0;
break;
case 1:
listQuery.type = 1
break
listQuery.type = 1;
break;
default:
listQuery.type = 2
break
listQuery.type = 2;
break;
}
init()
}
init();
};
const search = (val: any) => {
listQuery.Name = val.value
tabsChange(tabsState.current)
}
listQuery.Name = val.value;
tabsChange(tabsState.current);
};
const clear = () => {
listQuery.Name = ""
tabsChange(tabsState.current)
}
listQuery.Name = "";
tabsChange(tabsState.current);
};
const changeTagType = (index: number) => {
tagList.value.map((item: any, i: number) => {
if (index === i) item.type = "primary"
else item.type = "info"
})
}
if (index === i) item.type = "primary";
else item.type = "info";
});
};
// 上拉加载数据
onReachBottom(() => {
// 判断是否还有下一页数据
if (listQuery.pageIndex * listQuery.pageSize >= listQuery.total)
return (status.value = "nomore")
return (status.value = "nomore");
// // 判断是否正在请求其它数据,如果是,则不发起额外的请求
if (status.value === "loading") return
listQuery.pageIndex += 1
init()
})
if (status.value === "loading") return;
listQuery.pageIndex += 1;
init();
});
const init = async () => {
status.value = "loading"
const { data: res } = await getCourse(listQuery)
status.value = "loading";
const { data: res } = await getCourse(listQuery);
if (res.code == 200) {
if (res.total > 10) status.value = "loadmore"
else status.value = "nomore"
courseList.value = [...courseList.value, ...res.data]
listQuery.total = res.total
if (res.total > 10) status.value = "loadmore";
else status.value = "nomore";
courseList.value = [...courseList.value, ...res.data];
listQuery.total = res.total;
}
}
};
onMounted(async () => {
await initQqMaps()
})
await initQqMaps();
await uni.$on("refresh", (data: any) => {
if (data.refresh) {
tabsState.current = 2;
init();
}
});
});
onShow(() => {
courseList.value = []
listQuery.pageIndex = 1
listQuery.pageSize = 10
init()
})
courseList.value = [];
listQuery.pageIndex = 1;
listQuery.pageSize = 10;
init();
});
</script>
<style lang="scss" scoped>
......@@ -178,11 +191,6 @@ onShow(() => {
padding: 0 30rpx 30rpx;
padding-top: 20rpx;
.uni-searchbar {
padding: 0;
margin: 20rpx 0;
}
.tag .u-tag {
margin-right: 20rpx;
}
......
<template>
<!-- <headers :title="pdfState.title" /> -->
<view class="pdf-container">
<web-view class="webview" :src="pdfState.pdfUrl"></web-view>
<view class="down" @tap="downLoadPdf">
<u-image
src="../../static/img/download.png"
width="50"
height="50"
></u-image>
<view style="margin-left: 10rpx">点击下载</view>
</view>
</view>
</template>
<script setup lang="ts">
// import headers from "@/components/header/index.vue"
import { zconfirm } from "@/utils/util";
const pdfState = reactive({
title: "",
pdfUrl: "",
viewerUrl: "/static/pdf/web/viewer.html",
})
url: "",
});
const downLoadPdf = () => {
zconfirm("确定下载课程资料?", (result: boolean) => {
if (result) {
const a = document.createElement("a");
a.href = pdfState.url;
a.download = pdfState.title;
a.click();
}
});
};
onLoad((options: any) => {
pdfState.title = options.name
pdfState.title = options.name;
pdfState.url = options.url;
pdfState.pdfUrl =
pdfState.viewerUrl + "?file=" + encodeURIComponent(options.url)
})
pdfState.viewerUrl + "?file=" + encodeURIComponent(options.url);
});
onReady(() => {
uni.setNavigationBarTitle({
title: pdfState.title,
})
})
});
});
onBackPress(() => {
uni.$emit("refresh", { refresh: true });
});
</script>
<style lang="scss" scoped>
.pdf-container {
width: 100vw;
height: 100vh;
position: relative;
.webview {
height: 90%;
}
.down {
position: absolute;
bottom: 15%;
z-index: 999;
right: 0;
background-color: #ffffff;
padding: 10rpx;
display: flex;
align-items: center;
border-radius: 10rpx 0 0 10rpx;
color: #04a7ff;
}
}
</style>
<template>
<!-- <headers title='西部人力培训中心' backIconName="close" /> -->
<view class="bg-header">
<u-image src="../../static/img/background.png" width="100%" height="100%" />
</view>
<view class="home-container">
<!-- 用户信息部分 -->
<view class="user-info">
<u-image
width="260rpx"
height="260rpx"
width="240rpx"
height="240rpx"
:src="baseUrl + '/' + globalStore.infoData?.FIMAGEFILESERVER"
border-radius="30"
border-radius="24"
/>
<text v-show="globalStore.infoData.FMOBILE" class="name">{{
globalStore.infoData?.FNAME
}}</text>
<view v-if="!globalStore.infoData.FMOBILE" class="info">
<text class="name">{{ globalStore.infoData?.FNAME }}</text>
<!-- <view v-if="!globalStore.infoData.FMOBILE" class="info">
<text @tap="toLogin" style="color: #2979ff; font-weight: bolder"
>登录</text
>
<!-- <text>&nbsp;&nbsp;/&nbsp;&nbsp;</text>
<text @tap="toRegister">注册</text> -->
</view>
<view v-else class="info">
</view> -->
<view class="info">
<text>{{ globalStore.infoData?.FWORKUNIT1 }}</text>
<u-line
color="#eee"
color="rgba(34, 34, 34, 0.9)"
direction="col"
length="30rpx"
:hair-line="false"
......@@ -32,185 +31,235 @@
</view>
</view>
<view class="menu-title">
<view class="half-circle"></view>
<view class="title">服务功能</view>
</view>
<view class="user-menu">
<text class="menu-title">服务功能</text>
<view class="content">
<u-grid :col="3">
<u-grid-item @tap="toTrainRegistration">
<!-- <u-badge count="2" :offset="[20, 20]"></u-badge> -->
<u-icon name="man-add-fill" :size="53"></u-icon>
<view class="grid-text">培训报名</view>
</u-grid-item>
<u-grid-item @tap="toCourse">
<u-icon name="grid-fill" :size="53"></u-icon>
<view class="grid-text">我的课程</view>
</u-grid-item>
<u-grid-item @tap="toClass">
<!-- <u-badge count="3" :offset="[20, 20]"></u-badge> -->
<u-icon name="list-dot" :size="53"></u-icon>
<view class="grid-text">我的班级</view>
</u-grid-item>
<u-grid-item @tap="toMy">
<u-icon name="home-fill" :size="53"></u-icon>
<view class="grid-text">我的</view>
</u-grid-item>
</u-grid>
<view
class="menu-item"
v-for="item in menuList"
:key="item.id"
@tap="gridChange(item.id)"
>
<!-- Ribbon2 Ribbon5 -->
<u-image :src="item.src" width="120rpx" height="120rpx" />
<text>{{ item.name }}</text>
</view>
</view>
</view>
<view class="bg-footer">
<u-image src="../../static/img/mask_group.png" width="100%" height="100%" />
</view>
</template>
<script setup lang="ts">
import { getUrlCode } from "@/utils/util"
import { login } from "@/api/login"
import { baseUrl } from "@/utils/request"
import { useGlobalStore } from "@/store/useStore"
import { getUrlCode } from "@/utils/util";
import { login } from "@/api/login";
import { baseUrl } from "@/utils/request";
import { useGlobalStore } from "@/store/useStore";
const globalStore = useGlobalStore()
const code = ref()
const globalStore = useGlobalStore();
const code = ref();
const menuList = [
{
id: 0,
src: "../../static/img/Ribbon10@2x.png",
name: "培训报名",
},
{
id: 1,
src: "../../static/img/Ribbon2.png",
name: "我的课程",
},
{
id: 2,
src: "../../static/img/Ribbon5.png",
name: "我的班级",
},
];
const toTrainRegistration = () => {
if (!globalStore.infoData.FMOBILE)
return uni.navigateTo({
url: "/pages/login/index",
})
});
uni.navigateTo({
url: "/pages/trainRegistration/index",
})
}
});
};
const toCourse = () => {
if (!globalStore.infoData.FMOBILE)
return uni.navigateTo({
url: "/pages/login/index",
})
});
uni.navigateTo({
url: "/pages/course/index",
})
}
});
};
const toClass = () => {
if (!globalStore.infoData.FMOBILE)
return uni.navigateTo({
url: "/pages/login/index",
})
});
uni.navigateTo({
url: "/pages/class/index",
})
}
});
};
const toMy = () => {
if (!globalStore.infoData.FMOBILE)
return uni.navigateTo({
url: "/pages/login/index",
})
});
uni.navigateTo({
url: "/pages/my/index",
})
}
});
};
const toLogin = () => {
uni.navigateTo({
url: "/pages/login/index",
})
}
});
};
const toRegister = () => {
uni.navigateTo({
url: "/pages/login/register",
})
}
});
};
const gridChange = (type: number) => {
switch (type) {
case 0:
toTrainRegistration();
break;
case 1:
toCourse();
break;
default:
toClass();
break;
}
};
onMounted(async () => {
code.value = getUrlCode().code
// 获取微信公众号跳转h5获取code
code.value = getUrlCode().code;
// alert("获取的code值:" + code.value);
if (code.value) {
const data = {
code: code.value,
type: 1,
}
};
try {
const { data: res } = await login(data)
const { data: res } = await login(data);
if (res.code == 200) {
if (res.msg.split(":")[1]) {
globalStore.setInfoData(res.data[0])
globalStore.setOpenId(res.msg.split(":")[1])
globalStore.setInfoData(res.data[0]);
globalStore.setOpenId(res.msg.split(":")[1]);
}
} else if (res.code == 501) {
globalStore.setOpenId(res.data.split(":")[1])
} else if (res.code == 501 && !globalStore.infoData?.FSTUDENTID) {
// 新用户,跳转到注册页面
globalStore.setOpenId(res.data.split(":")[1]);
uni.navigateTo({
url: "/pages/login/register",
})
});
}
} catch (error) {
console.error("登录失败", error)
console.error("登录失败", error);
}
} else {
// 如果无code跳转到登录页面
if (!globalStore.openId && !globalStore.infoData.FMOBILE)
uni.navigateTo({
url: "/pages/login/index",
})
});
}
})
});
</script>
<style lang="scss" scoped>
page {
background-image: url("https://img2.baidu.com/it/u=460732253,1892860896&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=888");
background-size: auto;
background-color: #ffffff;
}
.bg-header {
position: relative;
}
.home-container {
position: absolute;
top: 3%;
width: 100%;
height: calc(100% - 48px);
.user-info {
margin: 40rpx 0 100rpx 0;
padding-top: 96rpx;
width: 100%;
height: 30%;
// height: 362rpx;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
margin-bottom: 76rpx;
.name {
font-size: 36rpx;
font-weight: bold;
padding: 20rpx 0;
color: #000;
font-size: 34rpx;
font-weight: 500;
color: #222222;
margin-top: 24rpx;
}
.info {
// z-index: 99;
display: flex;
justify-content: center;
align-items: center;
margin-top: 20rpx;
font-size: 24rpx;
font-weight: 400;
color: rgba(34, 34, 34, 0.9);
margin-top: 16rpx;
}
}
.menu-title {
margin: 0 32rpx;
width: 100%;
display: flex;
margin-bottom: 68rpx;
.title {
font-size: 34rpx;
font-weight: 600;
color: #222222;
line-height: 40rpx;
}
}
.user-menu {
// height: 238rpx;
margin: 0 32rpx;
padding: 48rpx;
background: #ffffff;
box-shadow: 0rpx 8rpx 60rpx 0rpx rgba(0, 0, 0, 0.05);
border-radius: 24rpx;
display: flex;
flex-direction: column;
flex-wrap: wrap;
box-sizing: border-box;
margin: 16rpx;
border-radius: 8rpx;
// border: 1px solid #e4e7ed;
background-color: #ffffff;
overflow: hidden;
color: #303133;
transition: 0.3s;
box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.05);
.menu-title {
box-sizing: border-box;
width: 100%;
font-size: 36rpx;
font-weight: bold;
padding: 32rpx 0 32rpx 50rpx;
background: linear-gradient(to right, #f4f8ff, #cce3fe);
.menu-item {
text-align: center;
flex-basis: calc((100% - 96rpx) / 3);
// height: 200rpx;
display: flex;
flex-direction: column;
align-items: center;
margin-right: 48rpx;
margin-bottom: 24rpx;
}
.content {
padding: 30rpx 0 80rpx 0;
& .menu-item:nth-child(3n) {
margin-right: 0;
}
}
}
......
<template>
<view class="login-container">
<u-form :model="data.formData" ref="form" label-width="150">
<u-form-item label="手机号" prop="phone"
><u-input v-model="data.formData.phone" placeholder="请出输入手机号"
/></u-form-item>
<u-form-item label="验证码" prop="code"
><u-input
v-model="data.formData.code"
placeholder="请输入验证码"
:disabled="data.codeDisabled"
/>
<template #right>
<u-verification-code
seconds="60"
@end="end"
@start="start"
ref="uCode"
@change="codeChange"
></u-verification-code>
<u-button
@tap="getCode"
type="primary"
size="mini"
:disabled="data.codeDisabled"
>{{ data.tips }}</u-button
<view style="position: relative">
<view class="bg-header">
<u-image
src="../../static/img/background.png"
width="100%"
height="100%"
/>
</view>
<view class="logo">
<u-image src="../../static/img/logo.png" width="100%" height="240rpx" />
<view class="logo-detail">培训系统</view>
</view>
<view class="container">
<view class="content">
<u-form :model="data.formData" ref="form" label-width="150">
<u-form-item
prop="phone"
left-icon="../../static/img/icon_user.png"
:left-icon-style="data.leftIconStyle"
>
</template>
</u-form-item>
</u-form>
<view class="footer">
<u-button @click="submit" size="medium" type="primary">{{
data.type ? "保存" : "登录"
}}</u-button>
<u-input v-model="data.formData.phone" placeholder="请出输入手机号"
/></u-form-item>
<view class="yanzhenma">
<u-form-item
prop="code"
left-icon="../../static/img/icon_yanzhenma.png"
:left-icon-style="data.leftIconStyle"
><u-input
v-model="data.formData.code"
placeholder="请输入验证码"
:disabled="data.codeDisabled"
/>
</u-form-item>
<u-verification-code
seconds="60"
@end="end"
ref="uCode"
@change="codeChange"
></u-verification-code>
<view @tap="getCode" :disabled="data.codeDisabled" class="code">
{{ data.tips }}
</view>
</view>
</u-form>
<view class="footer">
<u-button @click="submit" type="primary">登录</u-button>
<view class="register">
<text style="border-bottom: 1rpx solid #05a8ff" @tap="toRegister"
>立即注册</text
>
</view>
</view>
</view>
</view>
<view v-if="hideshow" class="bg-footer">
<u-image
src="../../static/img/mask_group.png"
width="100%"
height="100%"
/>
</view>
</view>
</template>
<script setup lang="ts">
import { toast } from "@/utils/util"
import { loginCode, verification, register } from "@/api/login"
import { useGlobalStore } from "@/store/useStore"
import { toast } from "@/utils/util";
import { loginCode, verification, register } from "@/api/login";
import { useGlobalStore } from "@/store/useStore";
const globalStore = useGlobalStore()
const form = ref()
const uniA: any = uni
const globalStore = useGlobalStore();
const form = ref();
const uniA: any = uni;
const data = reactive({
formData: {
phone: "",
......@@ -60,7 +87,7 @@ const data = reactive({
{
// 自定义验证函数,见上说明
validator: (rule: any, value: any, callback: any) => {
return uniA.$u.test.mobile(value)
return uniA.$u.test.mobile(value);
},
message: "手机号码不正确",
// 触发器可以同时用blur和change
......@@ -79,60 +106,85 @@ const data = reactive({
codeDisabled: true,
codeValue: "",
type: 0,
})
leftIconStyle: {
width: "40rpx",
height: "40rpx",
display: "flex",
},
});
const uCode = ref()
const uCode = ref();
const showHeight = ref();
const hideshow = ref(true);
const docmHeight = document.documentElement.clientHeight;
watch(
() => data.formData.phone,
(newVal: string) => {
if (newVal && uniA.$u.test.mobile(newVal)) {
data.codeDisabled = false
} else data.codeDisabled = true
data.codeDisabled = false;
} else data.codeDisabled = true;
}
)
);
onLoad((options: any) => {
if (options?.type) {
data.type = options?.type
data.type = options?.type;
}
// screenHeight.value = uni.getSystemInfoSync().windowHeight + "px";
// alert(screenHeight.value);
window.onresize = () => {
return (() => {
showHeight.value = document.body.clientHeight;
})();
};
});
watch(
() => showHeight.value,
() => {
if (docmHeight > showHeight.value) {
hideshow.value = false;
} else {
hideshow.value = true;
}
}
})
);
const getCode = async () => {
if (uCode.value.canGetCode) {
// 模拟向后端请求验证码
const { data: res } = await verification(data.formData.phone)
const { data: res } = await verification(data.formData.phone);
if (res.code == 200) {
data.codeValue = res.data
data.codeValue = res.data;
uni.showLoading({
title: "正在获取验证码",
})
});
setTimeout(() => {
uni.hideLoading()
uni.hideLoading();
// 这里此提示会被this.start()方法中的提示覆盖
toast("验证码已发送")
toast("验证码已发送");
// 通知验证码组件内部开始倒计时
uCode.value.start()
}, 2000)
uCode.value.start();
}, 2000);
}
} else {
toast("倒计时结束后再发送")
}
}
};
const end = () => {
data.codeValue = ""
}
data.codeValue = "";
};
const codeChange = (text: string) => {
data.tips = text
}
const start = () => {
console.log("开始计时")
}
data.tips = text;
};
onReady(() => {
form.value.setRules(data.rules)
})
form.value.setRules(data.rules);
});
const toRegister = () => {
uni.navigateTo({ url: "/pages/login/register" });
};
const submit = () => {
form.value.validate(async (valid: boolean) => {
......@@ -164,47 +216,75 @@ const submit = () => {
FSTUDENTID: globalStore.infoData.FSTUDENTID,
},
},
}
const { data: res } = await register(state)
};
const { data: res } = await register(state);
if (res.code == 200) {
globalStore.setInfoData(res.data[0])
uni.navigateBack()
toast("修改成功")
globalStore.setInfoData(res.data[0]);
uni.navigateBack();
toast("修改成功");
}
} else {
const { data: res } = await loginCode(data.formData.phone)
const { data: res } = await loginCode(data.formData.phone);
if (res.code == 200) {
globalStore.setInfoData(res.data[0])
uni.reLaunch({ url: "/pages/home/index" })
toast("登录成功")
globalStore.setInfoData(res.data[0]);
uni.reLaunch({ url: "/pages/home/index" });
toast("登录成功");
// 修改手机号的
}
}
}
})
}
});
};
</script>
<style lang="scss" scoped>
page {
background-image: url("https://img2.baidu.com/it/u=460732253,1892860896&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=888");
background-size: cover;
/* 背景图片自适应屏幕大小 */
/* 其他样式设置 */
}
.login-container {
padding: 30rpx;
.container {
position: absolute;
top: 25%;
left: 5%;
width: 90vw;
background-color: #fff;
border-radius: 15rpx;
top: 500rpx;
left: 12%;
z-index: 99;
width: 568rpx;
.content {
width: 568rpx;
height: 372rpx;
.yanzhenma {
display: flex;
align-items: center;
margin-top: 48rpx;
.u-form-item {
width: 392rpx;
}
}
.footer {
display: flex;
margin-top: 30rpx;
:deep(.u-form-item) {
position: relative;
// margin-bottom: 48rpx;
background: #ffffff;
padding: 10rpx 36rpx;
box-shadow: 0rpx 8rpx 100rpx 0rpx rgba(0, 0, 0, 0.05);
border-radius: 16rpx;
height: 90rpx;
}
:deep(.u-form-item__message) {
padding-left: 0 !important;
margin-top: 20rpx;
}
.footer {
height: 84rpx;
margin-top: 64rpx;
.u-btn {
width: 100%;
height: 100%;
background-color: #04a7ff;
}
.register {
text-align: center;
font-size: 26rpx;
margin: 20rpx 0;
color: #07a9ff;
}
}
}
}
</style>
<template>
<div class="train-item-container card">
<h3>{{ trainItem.className }}</h3>
<text
>培训日期:{{ dayjs(trainItem.startDate).format("YYYY-MM-DD") }}
{{ dayjs(trainItem.endDate).format("YYYY-MM-DD") }}</text
>
<text>培训地点:{{ trainItem.classArea }}</text>
<view v-show="!current" class="train-progress">
<text style="">报名进度:培训名额 {{ trainItem.planCount }}</text>
<text class="registered">已报名 {{ trainItem.subCount }}</text>
</view>
<text v-show="!current"
>截止时间:{{
dayjs(trainItem.endDate).format("YYYY-MM-DD HH:mm:ss")
}}</text
>
<view class="train-button">
<u-button :type="trainStatus.type" @tap="registerTrain">{{
trainStatus.detail
}}</u-button>
</view>
</div>
<view class="train-item-container">
<u-card :show-head="false" margin="0">
<template #body>
<view class="body">
<h3>{{ trainItem.className }}</h3>
<text
>培训日期:{{ dayjs(trainItem.startDate).format("YYYY-MM-DD") }}
{{ dayjs(trainItem.endDate).format("YYYY-MM-DD") }}</text
>
<text>培训地点:{{ trainItem.classArea }}</text>
<view v-show="!current" class="train-progress">
<text style="white-space: nowrap">报名进度:</text>
<u-line-progress
active-color="#5363ff"
:percent="percent ? percent : 0"
:show-percent="false"
height="20"
style="margin-top: 10rpx"
></u-line-progress>
<view class="progress">
{{ trainItem.subCount + "/" + trainItem.planCount }}
</view>
</view>
<text v-show="!current"
>截止时间:{{ dayjs(trainItem.endDate).format("YYYY-MM-DD") }}</text
>
<view
class="train-button"
v-show="trainItem.classType != 3 && trainItem.classType != 4"
>
<u-button
:type="trainStatus.type"
:style="{
backgroundColor: !trainItem.classType ? '#05a8ff' : '',
}"
@tap="registerTrain"
>{{ trainStatus.detail }}</u-button
>
</view>
<view v-show="trainItem.classType == 3" class="body-right info">
{{ trainStatus.detail }}
</view>
<view v-show="trainItem.classType == 4" class="body-right">
{{ trainStatus.detail }}
</view>
</view>
</template>
</u-card>
</view>
<applicationPupop
v-model="show"
......@@ -33,13 +61,13 @@
</template>
<script setup lang="ts">
import dayjs from "dayjs"
import applicationPupop from "./applicationPopup.vue"
import { getInFormAtion, quit, signUp } from "@/api/trainRegistration"
import { toast, zconfirm } from "@/utils/util"
import { useGlobalStore } from "@/store/useStore"
import dayjs from "dayjs";
import applicationPupop from "./applicationPopup.vue";
import { getInFormAtion, quit, signUp } from "@/api/trainRegistration";
import { toast, zconfirm } from "@/utils/util";
import { useGlobalStore } from "@/store/useStore";
const globalStore = useGlobalStore()
const globalStore = useGlobalStore();
const props = defineProps({
trainItem: {
......@@ -47,42 +75,45 @@ const props = defineProps({
default: () => [],
} as any,
current: Number,
})
const emits = defineEmits(["initTrain"])
});
const emits = defineEmits(["initTrain"]);
const show = ref(false)
const selectList = ref()
const show = ref(false);
const selectList = ref();
const trainDetail = [
"报名培训", // 0
"培训名额已满", // 1
"退出培训", // 2
"结束", // 3
"培训结束", // 3
"培训中", // 4
]
];
const percent = computed(
() => (props.trainItem.subCount / props.trainItem.planCount) * 100
);
const trainStatus = computed(() => {
const statusObj = {
type: "",
detail: "",
}
};
switch (props.trainItem.classType) {
case 0:
case 4:
statusObj.type = "primary"
break
statusObj.type = "primary";
break;
case 1:
case 3:
statusObj.type = "info"
break
statusObj.type = "info";
break;
case 2:
statusObj.type = "error"
break
statusObj.type = "error";
break;
}
statusObj.detail = trainDetail[props.trainItem.classType]
return statusObj
})
statusObj.detail = trainDetail[props.trainItem.classType];
return statusObj;
});
const registerTrain = () => {
switch (props.trainItem.classType) {
......@@ -97,8 +128,8 @@ const registerTrain = () => {
props.trainItem.fisFillInfo !== "false" ||
props.trainItem.fsFillRiding !== "false"
) {
initInFormAtion()
show.value = true
initInFormAtion();
show.value = true;
} else {
const data: any = {
classId: props.trainItem.classId,
......@@ -141,18 +172,18 @@ const registerTrain = () => {
],
},
},
}
const { data: res } = await signUp(data)
};
const { data: res } = await signUp(data);
if (res.code == 200) {
initTrain()
toast("报名成功")
initTrain();
toast("报名成功");
}
}
}
},
"报名培训"
)
break
);
break;
case 2:
zconfirm(
"确认退出本期培训?",
......@@ -163,68 +194,104 @@ const registerTrain = () => {
classId: props.trainItem.classId,
Phone: globalStore.infoData.FMOBILE,
},
}
const { data: res } = await quit(data)
};
const { data: res } = await quit(data);
if (res.code == 200) {
await initTrain()
await toast("退出培训成功")
await initTrain();
await toast("退出培训成功");
}
}
},
"退出培训"
)
break
);
break;
default:
break
break;
}
}
};
const initInFormAtion = async () => {
const { data: res } = await getInFormAtion()
const { data: res } = await getInFormAtion();
selectList.value = [
{ FDATAVALUE: "所属街道", FNUMBER: 0, children: [] },
{ FDATAVALUE: "所属党委", FNUMBER: 1, children: [] },
{ FDATAVALUE: "自定义内容", FNUMBER: 2, children: [] },
] as any
] as any;
if (res.code == 200) {
res.data.map((item: any) => {
if (!item.Type) selectList.value[0].children.push(item)
else selectList.value[1].children.push(item)
})
console.log(selectList.value)
if (!item.Type) selectList.value[0].children.push(item);
else selectList.value[1].children.push(item);
});
// console.log(selectList.value)
}
}
};
const initTrain = () => {
emits("initTrain", props.current)
}
emits("initTrain", props.current);
};
</script>
<style lang="scss" scoped>
.train-item-container {
margin-bottom: 20rpx;
margin-bottom: 32rpx;
.body {
position: relative;
.body-right {
position: absolute;
top: -29rpx;
right: -29rpx;
padding: 10rpx;
text-align: center;
line-height: 30rpx;
font-size: 24rpx;
color: #05a8ff;
background: #ddf3ff;
border-radius: 0rpx 24rpx 0rpx 24rpx;
}
.info {
color: #82848a;
background-color: #e4e4e4;
}
}
h3 {
margin-bottom: 16rpx;
height: 48rpx;
font-size: 34rpx;
font-weight: 500;
color: #222222;
line-height: 40rpx;
margin-bottom: 32rpx;
}
text {
display: block;
padding: 12rpx 0;
font-size: 32rpx;
font-size: 28rpx;
font-weight: 400;
color: rgba(34, 34, 34, 0.9);
line-height: 33rpx;
}
.train-progress {
display: flex;
align-items: center;
.registered {
margin-left: 30rpx;
color: #3b99fc;
}
.progress {
margin-left: 10px;
margin-top: 8rpx;
}
}
.train-button {
padding: 0 50rpx;
// padding: 0 50rpx;
margin-top: 30rpx;
}
}
......
......@@ -6,7 +6,13 @@
:list="tabsState.list"
:is-scroll="false"
v-model="tabsState.current"
bg-color="#f5f5f5"
:active-item-style="{ fontSize: '34rpx', color: '#000000' }"
font-size="28"
bar-width="72"
bar-height="6"
bg-color="#fbfcff"
inactive-color="#cecfcf"
active-color="#05a8ff"
@change="tabsChange"
/>
<!-- 搜索 -->
......@@ -21,7 +27,7 @@
/>
<!-- 内容 -->
<view v-if="trainList.length">
<text style="margin-bottom: 20rpx; display: block"
<text class="fund"
>为你找到{{
tabsState.current ? registeredQuery.total : listQuery.total
}}个可报名的培训</text
......@@ -37,19 +43,26 @@
<u-loadmore :status="status" icon-type="flower" />
</view>
</view>
<view v-else class="empty">
<u-empty text="暂无数据" mode="list"></u-empty>
</view>
<u-empty
v-else
text="暂无数据~"
icon-size="506"
:margin-top="220"
src="../../static/img/noData.png"
></u-empty>
</view>
<!-- <view class="circle circle-primary">
<view class="details">开始签到</view>
</view> -->
</template>
<script setup lang="ts">
// import headers from "@/components/header/index.vue"
import trainItem from "./components/trainItem.vue"
import { getTrainAll, getTrainList } from "@/api/trainRegistration"
import { useGlobalStore } from "@/store/useStore"
import trainItem from "./components/trainItem.vue";
import { getTrainAll, getTrainList } from "@/api/trainRegistration";
import { useGlobalStore } from "@/store/useStore";
const globalStore = useGlobalStore()
const globalStore = useGlobalStore();
const tabsState = reactive({
list: [
......@@ -61,15 +74,15 @@ const tabsState = reactive({
},
],
current: 0,
})
const Name = ref()
});
const Name = ref();
const listQuery = reactive({
Phone: globalStore.infoData.FMOBILE,
pageIndex: 1,
pageSize: 10,
total: 0,
Name: "",
})
});
const registeredQuery = reactive({
FSTUDENTID: globalStore.infoData.FSTUDENTID,
......@@ -77,52 +90,52 @@ const registeredQuery = reactive({
pageSize: 10,
total: 0,
Name: "",
})
});
const status = ref("loadmore")
const status = ref("loadmore");
const trainList = ref([] as any)
const trainList = ref([] as any);
const tabsChange = (index: number) => {
trainList.value = []
trainList.value = [];
if (index) {
Name.value = registeredQuery.Name
initRegistered()
Name.value = registeredQuery.Name;
initRegistered();
} else {
Name.value = listQuery.Name
init()
Name.value = listQuery.Name;
init();
}
}
};
const search = (val: any) => {
if (tabsState.current) {
registeredQuery.Name = val.value
registeredQuery.Name = val.value;
} else {
listQuery.Name = val.value
listQuery.Name = val.value;
}
tabsChange(tabsState.current)
}
tabsChange(tabsState.current);
};
const clear = (val: any) => {
if (tabsState.current) {
registeredQuery.Name = ""
registeredQuery.Name = "";
} else {
listQuery.Name = ""
listQuery.Name = "";
}
tabsChange(tabsState.current)
}
tabsChange(tabsState.current);
};
const initRegistered = async () => {
status.value = "loading"
const { data: res } = await getTrainList(registeredQuery)
status.value = "loading";
const { data: res } = await getTrainList(registeredQuery);
if (res.code == 200) {
if (res.total > 10) status.value = "loadmore"
else status.value = "nomore"
trainList.value = [...trainList.value, ...res.data]
registeredQuery.total = res.total
console.log(trainList.value)
if (res.total > 10) status.value = "loadmore";
else status.value = "nomore";
trainList.value = [...trainList.value, ...res.data];
registeredQuery.total = res.total;
// console.log(trainList.value)
}
}
};
// 上拉加载数据
onReachBottom(() => {
......@@ -132,45 +145,107 @@ onReachBottom(() => {
registeredQuery.pageIndex * registeredQuery.pageSize >=
registeredQuery.total
)
return (status.value = "nomore")
return (status.value = "nomore");
// // 判断是否正在请求其它数据,如果是,则不发起额外的请求
if (status.value === "loading") return
registeredQuery.pageIndex += 1
initRegistered()
if (status.value === "loading") return;
registeredQuery.pageIndex += 1;
initRegistered();
} else {
// 判断是否还有下一页数据
if (listQuery.pageIndex * listQuery.pageSize >= listQuery.total)
return (status.value = "nomore")
return (status.value = "nomore");
// // 判断是否正在请求其它数据,如果是,则不发起额外的请求
if (status.value === "loading") return
listQuery.pageIndex += 1
init()
if (status.value === "loading") return;
listQuery.pageIndex += 1;
init();
}
})
});
const init = async () => {
status.value = "loading"
const { data: res } = await getTrainAll(listQuery)
status.value = "loading";
const { data: res } = await getTrainAll(listQuery);
if (res.code == 200) {
if (res.total > 10) status.value = "loadmore"
else status.value = "nomore"
trainList.value = [...trainList.value, ...res.data]
listQuery.total = res.total
if (res.total > 10) status.value = "loadmore";
else status.value = "nomore";
trainList.value = [...trainList.value, ...res.data];
listQuery.total = res.total;
}
}
};
onMounted(() => {
init()
})
init();
});
</script>
<style lang="scss" scoped>
.train-container {
padding: 0 30rpx 30rpx;
padding: 0 32rpx 32rpx;
}
.uni-searchbar {
padding: 0;
margin: 20rpx 0;
.circle {
position: relative;
width: 325rpx;
height: 325rpx;
border-radius: 50%;
margin: 20px auto;
// background: radial-gradient(circle farthest-side at top, #e6e6e6 0%, #dddddd 20%, #d4d5d5 40%, #bebec0 60%, #b1b1b3 100%);
.details {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 36rpx;
font-weight: 400;
}
}
.circle-info {
background: radial-gradient(
circle farthest-side at top,
#e6e6e6 0%,
#dddddd 20%,
#d4d5d5 40%,
#bebec0 60%,
#bbbbbd 80%,
#b1b1b3 100%
);
color: #ffffff;
}
.circle-sueccss {
background: radial-gradient(
circle farthest-side at top,
#dafdd3 0%,
#c7f2bc 20%,
#a5e090 40%,
#8ad06e 60%,
#6ebf49 80%,
#58b12f 100%
);
color: #ffffff;
}
.circle-primary {
background: radial-gradient(
circle farthest-side at top,
#dfeffc 0%,
#aadfff 20%,
#8ad3fe 40%,
#5ac4ff 60%,
#33b5ff 80%,
#0ba9ff 100%
);
color: #ffffff;
}
.dd {
width: 750rpx;
height: 624rpx;
background: rgba(255, 255, 255, 0.08);
border-radius: 0rpx 0rpx 0rpx 0rpx;
opacity: 1;
}
/*定义渐变*/
</style>
.card {
box-sizing: border-box;
// margin: 16rpx;
padding: 16rpx 16rpx 30rpx 16rpx;
border-radius: 8rpx;
border: 1px solid #e4e7ed;
.uni-tabbar {
max-width: 420px;
margin: 0 auto;
border-left: #f6f6f6 solid 1px;
border-right: #f6f6f6 solid 1px;
}
.uni-searchbar {
padding: 0 !important;
margin: 32rpx 0 48rpx;
// box-shadow: 0px 0px 6rpx rgba(0, 0, 0, 0.12) !important;
// border-radius: 30rpx;
width: 686rpx;
height: 72rpx;
background: #ffffff;
box-shadow: 0rpx 8rpx 60rpx 0rpx rgba(0, 0, 0, 0.05) !important;
border-radius: 24rpx;
opacity: 1;
:deep(.uni-searchbar__box) {
border-radius: 30rpx !important;
}
}
.u-card {
border-radius: 20rpx;
background-color: #ffffff;
overflow: hidden;
color: #303133;
transition: 0.3s;
box-shadow: 0px 0px 12px rgba(0, 0, 0, 0.05);
box-shadow: 0rpx 8rpx 60rpx 0rpx rgba(0, 0, 0, 0.05) !important;
border-radius: 24rpx;
}
.card-text {
.logo {
position: absolute;
top: 128rpx;
left: 270rpx;
width: 212rpx;
height: 316rpx;
.logo-detail {
width: 100%;
height: 44rpx;
font-size: 34rpx;
font-family: PingFang SC-Medium, PingFang SC;
font-weight: 500;
color: #222222;
line-height: 44rpx;
margin-top: 32rpx;
text-align: center;
}
}
.half-circle {
width: 20rpx;
height: 40rpx;
border-radius: 0 20rpx 20rpx 0;
background-color: #04a7ff;
line-height: 40rpx;
margin-right: 20rpx;
}
.fund {
margin-bottom: 32rpx;
display: block;
}
.courseEvaluation {
margin: 48rpx 0 32rpx;
font-weight: bolder;
display: flex;
align-items: center;
font-size: 34rpx;
color: #222222;
}
.rate {
margin-left: 30rpx;
color: #c8c9cc;
font-size: 24rpx;
}
.code {
color: #07a9ff;
font-size: 28rpx;
}
.courseware {
display: flex;
flex-direction: column;
align-items: center;
.courseware-icon {
padding: 20rpx;
border-radius: 50%;
background-color: #ddf3ff;
}
.grid-text {
font-size: 28rpx;
margin-top: 4rpx;
color: #303133;
padding: 0 10rpx;
white-space: "nowrap";
text-overflow: "ellipsis";
overflow: "hidden";
.desc {
margin-top: 10rpx;
font-size: 24rpx;
font-weight: 400;
color: rgba(34, 34, 34, 0.5);
}
}
.card {
// height: 730rpx;
background: #ffffff;
box-shadow: 0rpx 8rpx 38rpx 0rpx rgba(0, 0, 0, 0.05);
border-radius: 24rpx;
padding: 18rpx 32rpx 48rpx;
}
.empty {
margin-top: 100rpx;
margin-top: 220rpx;
}
.bg-header {
position: absolute;
top: 0;
width: 100%;
height: 624rpx;
}
.bg-footer {
position: fixed;
bottom: 0;
width: 100%;
height: 482rpx;
// z-index: -99;
}
.prompt {
width: 100%;
margin-top: 28rpx;
.prompt-title {
height: 44rpx;
font-size: 32rpx;
font-weight: 400;
color: #222222;
line-height: 38rpx;
margin-bottom: 16rpx;
}
.prompt-detail {
height: 152rpx;
font-size: 28rpx;
font-weight: 400;
color: #999999;
line-height: 48rpx;
}
}
.active {
color: #ffffff !important;
background: #05a8ff !important;
}
.code {
width: 190rpx;
height: 40rpx;
font-size: 28rpx;
font-family: PingFang SC-Regular, PingFang SC;
text-align: right;
font-weight: 400;
color: #05a8ff;
line-height: 33rpx;
}
......@@ -976,7 +976,7 @@ const PDFViewerApplication = {
let scrollMode = _app_options.AppOptions.get("scrollModeOnLoad");
let spreadMode = _app_options.AppOptions.get("spreadModeOnLoad");
if (stored?.page && viewOnLoad !== ViewOnLoad.INITIAL) {
hash = `page=${stored.page}&zoom=${zoom || stored.zoom},` + `${stored.scrollLeft},${stored.scrollTop}`;
hash = `page=${stored.page}&zoom=${zoom || stored.zoom},` + `${stored.scrollLeft},${stored?.scrollTop}`;
rotation = parseInt(stored.rotation, 10);
if (sidebarView === _ui_utils.SidebarView.UNKNOWN) {
sidebarView = stored.sidebarView | 0;
......@@ -1618,7 +1618,7 @@ const PDFViewerApplication = {
if (scaleDiff !== 0) {
const [top, left] = pdfViewer.containerTopLeft;
pdfViewer.container.scrollLeft += (x - left) * scaleDiff;
pdfViewer.container.scrollTop += (y - top) * scaleDiff;
pdfViewer.container?.scrollTop += (y - top) * scaleDiff;
}
},
_unblockDocumentLoadEvent() {
......@@ -2571,7 +2571,7 @@ function scrollIntoView(element, spot, scrollMatches = false) {
parent.scrollLeft = offsetX;
}
}
parent.scrollTop = offsetY;
parent?.scrollTop = offsetY || 0;
}
function watchScroll(viewAreaElement, callback) {
const debounceScroll = function (evt) {
......@@ -2586,7 +2586,7 @@ function watchScroll(viewAreaElement, callback) {
state.right = currentX > lastX;
}
state.lastX = currentX;
const currentY = viewAreaElement.scrollTop;
const currentY = viewAreaElement?.scrollTop || 0;
const lastY = state.lastY;
if (currentY !== lastY) {
state.down = currentY > lastY;
......@@ -2598,8 +2598,8 @@ function watchScroll(viewAreaElement, callback) {
const state = {
right: true,
down: true,
lastX: viewAreaElement.scrollLeft,
lastY: viewAreaElement.scrollTop,
lastX: viewAreaElement.scrollLeft || 0,
lastY: viewAreaElement.scrollTop || 0,
_eventHandler: debounceScroll
};
let rAF = null;
......@@ -2726,7 +2726,7 @@ function getVisibleElements({
horizontal = false,
rtl = false
}) {
const top = scrollEl.scrollTop,
const top = scrollEl.scrollTop || 0,
bottom = top + scrollEl.clientHeight;
const left = scrollEl.scrollLeft,
right = left + scrollEl.clientWidth;
......@@ -4441,7 +4441,7 @@ class GrabToPan {
}
}
this.scrollLeftStart = this.element.scrollLeft;
this.scrollTopStart = this.element.scrollTop;
this.scrollTopStart = this.element.scrollTop || 0;
this.clientXStart = event.clientX;
this.clientYStart = event.clientY;
this.document.addEventListener("mousemove", this._onMouseMove, true);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
import { PersistedStateOptions } from 'pinia-plugin-persistedstate'
import { PersistedStateOptions } from "pinia-plugin-persistedstate";
const piniaPersistOption = (key: string, paths?: any[]) => {
const persist: PersistedStateOptions = {
key,
storage: localStorage,
paths
}
return persist
}
const persist: PersistedStateOptions = {
key,
storage: sessionStorage,
paths,
};
return persist;
};
export default piniaPersistOption
\ No newline at end of file
export default piniaPersistOption;
......@@ -6,7 +6,7 @@
<tr v-if="noData" class="uni-table-loading">
<td class="uni-table-text" :class="{ 'empty-border': border }">{{ emptyText }}</td>
</tr>
<view v-if="loading" class="uni-table-mask" :class="{ 'empty-border': border }"><div class="uni-table--loader"></div></view>
<view v-if="loading" class="uni-table-mask" :class="{ 'empty-border': border }"><view class="uni-table--loader"></view></view>
</table>
<!-- #endif -->
<!-- #ifndef H5 -->
......@@ -15,7 +15,7 @@
<view v-if="noData" class="uni-table-loading">
<view class="uni-table-text" :class="{ 'empty-border': border }">{{ emptyText }}</view>
</view>
<view v-if="loading" class="uni-table-mask" :class="{ 'empty-border': border }"><div class="uni-table--loader"></div></view>
<view v-if="loading" class="uni-table-mask" :class="{ 'empty-border': border }"><view class="uni-table--loader"></view></view>
</view>
<!-- #endif -->
</view>
......
import { hLoading, jsonp, sLoading } from "./util"
import { hLoading, jsonp, sLoading } from './util'
const mapsInfo = reactive({
lat: 0, // 纬度
lng: 0, // 经度
addr: "", // 地址
lat: 0, // 纬度
lng: 0, // 经度
addr: '', // 地址
})
const windows: any = window
const useQqMaps = () => {
const geolocation = new windows.qq.maps.Geolocation(
"3M5BZ-SFCRJ-AHSF7-XRA5Q-Y6NIJ-DXBH4",
"XBRLPX"
)
const geolocation = new windows.qq.maps.Geolocation(
'3M5BZ-SFCRJ-AHSF7-XRA5Q-Y6NIJ-DXBH4',
'XBRLPX'
)
const initQqMaps = () => {
// 获取当前所在地理位置
sLoading()
geolocation.getLocation(showPosition, showErr)
}
const initQqMaps = () => {
// 获取当前所在地理位置
sLoading()
geolocation.getLocation(showPosition, showErr)
}
// 监听位置信息的改变
const watchPosition = () => {
geolocation.watchPosition(updatePosition)
}
// 监听位置信息的改变
const watchPosition = () => {
geolocation.watchPosition(updatePosition)
}
// 清除监听
const clearWatch = () => {
geolocation.clearWatch()
}
// 清除监听
const clearWatch = () => {
geolocation.clearWatch()
}
const showPosition = (position: any) => {
let url = "https://apis.map.qq.com/ws/geocoder/v1/"
mapsInfo.lat = position.lat
mapsInfo.lng = position.lng
jsonp(url, {
key: "3M5BZ-SFCRJ-AHSF7-XRA5Q-Y6NIJ-DXBH4",
output: "jsonp",
// 需要传入的参数
location: position.lat + "," + position.lng,
get_poi: 1,
}).then((res: any) => {
hLoading()
mapsInfo.addr = res.result.address
// console.log(mapsInfo)
})
}
const showPosition = (position: any) => {
let url = 'https://apis.map.qq.com/ws/geocoder/v1/'
mapsInfo.lat = position.lat
mapsInfo.lng = position.lng
jsonp(url, {
key: '3M5BZ-SFCRJ-AHSF7-XRA5Q-Y6NIJ-DXBH4',
output: 'jsonp',
// 需要传入的参数
location: position.lat + ',' + position.lng,
get_poi: 1,
}).then((res: any) => {
hLoading()
mapsInfo.addr = res.result.address
// console.log(mapsInfo)
})
}
const updatePosition = (data: any) => {
console.log(data)
}
const showErr = () => {}
const updatePosition = (data: any) => {
console.log(data)
}
const showErr = () => {}
// 计算距离
const calculateDistance = (
lat1: number,
lon1: number,
lat2: number,
lon2: number
) => {
const point1 = new windows.qq.maps.LatLng(lat1, lon1)
const point2 = new windows.qq.maps.LatLng(lat2, lon2)
// 使用 computeDistanceBetween 方法计算距离
var distance = windows.qq.maps.geometry.spherical.computeDistanceBetween(
point1,
point2
)
// 计算距离
const calculateDistance = (
lat1: number,
lon1: number,
lat2: number,
lon2: number
) => {
const point1 = new windows.qq.maps.LatLng(lat1, lon1)
const point2 = new windows.qq.maps.LatLng(lat2, lon2)
// 使用 computeDistanceBetween 方法计算距离
var distance = windows.qq.maps.geometry.spherical.computeDistanceBetween(
point1,
point2
)
return distance // 返回距离,单位为米
}
return {
initQqMaps,
watchPosition,
clearWatch,
calculateDistance,
mapsInfo,
}
return distance // 返回距离,单位为米
}
return {
initQqMaps,
watchPosition,
clearWatch,
calculateDistance,
mapsInfo,
}
}
export default useQqMaps
import { useGlobalStore } from "@/store/useStore"
import { hLoading, sLoading, toast } from "./util"
import { useGlobalStore } from "@/store/useStore";
import { hLoading, sLoading, toast } from "./util";
export const baseUrl = "/k3cloud"
export const baseUrl = "/k3cloud";
// 部署到iis上用的
// export const baseUrl = "https://weixin.lingqingkeji.com:86/k3cloud"
// export const baseUrl = "/XiBU"
const globalStore = useGlobalStore()
const globalStore = useGlobalStore();
// 封装公共申请办法
function request(
url: string,
......@@ -15,19 +15,20 @@ function request(
responseType?: string
) {
return new Promise<any>(function (resolve, reject) {
let header: any
sLoading()
let pages = getCurrentPages()
let page = pages[pages.length - 1] // 当前页面
let header: any;
sLoading();
let pages = getCurrentPages();
let page = pages[pages.length - 1]; // 当前页面
if (
page.route !== "pages/login/index" &&
page.route !== "pages/login/register" &&
JSON.stringify(globalStore.infoData) === "{}"
page.route !== "pages/home/index" &&
JSON.stringify(globalStore.infoData) === "{}"
) {
uni.reLaunch({ url: "/pages/login/index" })
uni.reLaunch({ url: "/pages/login/index" });
}
header = { "Content-Type": "application/json" }
url = baseUrl + url
header = { "Content-Type": "application/json" };
url = baseUrl + url;
uni.request({
url,
......@@ -36,29 +37,29 @@ function request(
header,
responseType,
success(res: any) {
hLoading()
hLoading();
if (res.data.code == 200 || res.data.code == 501) {
resolve(res)
resolve(res);
} else if (res.data.code == 500 || res.data.code === 401) {
toast(res.data.msg)
reject(res)
toast(res.data.msg);
reject(res);
} else {
console.log(res, "非200错误")
console.log(res, "非200错误");
//其余异样
reject(res)
reject(res);
}
},
fail(err: any) {
hLoading()
hLoading();
//申请失败
uni.showToast({
title: "连接服务器失败",
icon: "none",
})
reject(err)
});
reject(err);
},
})
})
});
});
}
export default request
export default request;
......@@ -9,13 +9,13 @@ export const zconfirm = (msg: string, callBackFun?: any, title?: string) => {
content: msg,
success(res) {
if (res.confirm) {
callBackFun(true)
callBackFun(true);
} else if (res.cancel) {
callBackFun(false)
callBackFun(false);
}
},
})
}
});
};
export const zalert = (msg: string, callBackFun?: any) => {
uni.showModal({
......@@ -24,11 +24,11 @@ export const zalert = (msg: string, callBackFun?: any) => {
showCancel: false,
success() {
if (callBackFun) {
callBackFun()
callBackFun();
}
},
})
}
});
};
export const toast = (msg: string) => {
uni.showToast({
......@@ -36,87 +36,121 @@ export const toast = (msg: string) => {
duration: 2000,
mask: false,
icon: "none",
})
}
});
};
export const sLoading = (msg: string = "加载中...") => {
uni.showLoading({
title: msg,
mask: true,
})
}
});
};
export const hLoading = () => {
uni.hideLoading()
}
uni.hideLoading();
};
// 防抖
interface DebounceFunc<T extends (...args: any[]) => any> {
(this: ThisParameterType<T>, ...args: Parameters<T>): ReturnType<T>
(this: ThisParameterType<T>, ...args: Parameters<T>): ReturnType<T>;
}
export function debounce<T extends (...args: any[]) => any>(
fn: T,
delay = 300
): DebounceFunc<T> {
let timer: number | null
let timer: number | null;
return function (this: ThisParameterType<T>, ...args: Parameters<T>) {
if (timer) clearTimeout(timer)
if (timer) clearTimeout(timer);
timer = setTimeout(() => {
fn.call(this, ...args)
}, delay)
} as DebounceFunc<T>
fn.call(this, ...args);
}, delay);
} as DebounceFunc<T>;
}
export const jsonp = function (url: any, data: any) {
return new Promise((resolve, reject) => {
// 1.初始化url
let dataString = url.indexOf("?") === -1 ? "?" : "&"
let callbackName: any = `jsonpCB_${Date.now()}`
url += `${dataString}callback=${callbackName}`
let dataString = url.indexOf("?") === -1 ? "?" : "&";
let callbackName: any = `jsonpCB_${Date.now()}`;
url += `${dataString}callback=${callbackName}`;
if (data) {
// 2.有请求参数,依次添加到url
for (let k in data) {
url += `&${k}=${data[k]}`
url += `&${k}=${data[k]}`;
}
}
let scriptNode = document.createElement("script")
scriptNode.src = url
const windows: any = window
let scriptNode = document.createElement("script");
scriptNode.src = url;
const windows: any = window;
// 3. callback
windows[callbackName] = (result: any) => {
result ? resolve(result) : reject("没有返回数据")
delete window[callbackName]
document.body.removeChild(scriptNode)
}
result ? resolve(result) : reject("没有返回数据");
delete window[callbackName];
document.body.removeChild(scriptNode);
};
// 4. 异常情况
scriptNode.addEventListener(
"error",
() => {
reject("接口返回数据失败")
delete window[callbackName]
document.body.removeChild(scriptNode)
reject("接口返回数据失败");
delete window[callbackName];
document.body.removeChild(scriptNode);
},
false
)
);
// 5. 开始请求
document.body.appendChild(scriptNode)
})
}
document.body.appendChild(scriptNode);
});
};
// 截取url中的code方法
export const getUrlCode = () => {
const url = location.search
const theRequest: any = new Object()
const url = location.search;
const theRequest: any = new Object();
if (url.indexOf("?") != -1) {
const str = url.substr(1)
const strs = str.split("&")
const str = url.substr(1);
const strs = str.split("&");
for (let i: any = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = strs[i].split("=")[1]
theRequest[strs[i].split("=")[0]] = strs[i].split("=")[1];
}
}
return theRequest
}
\ No newline at end of file
return theRequest;
};
export const evaluateStr = (num: number) => {
let str = "";
switch (num) {
// case 0:
case 1:
str = "很不满意";
break;
case 2:
str = "不满意";
break;
case 3:
str = "一般";
break;
case 4:
str = "满意";
break;
case 5:
str = "很满意";
break;
}
return str;
};
export const hidePhoneNumber = (phoneNumber: string) => {
if (phoneNumber.length === 11) {
const prefix = phoneNumber.substring(0, 3);
const suffix = phoneNumber.substring(7);
return prefix + "****" + suffix;
} else {
// 手机号码不合法,不进行隐藏处理
return phoneNumber;
}
};
import { defineConfig } from "vite"
import { defineConfig } from "vite";
// import pxtovw from 'postcss-px-to-viewport'
import { resolve } from "path"
import { createSvgIconsPlugin } from "vite-plugin-svg-icons"
import uni from "@dcloudio/vite-plugin-uni"
import AutoImport from "unplugin-auto-import/vite"
import Components from "unplugin-vue-components/vite"
import mkcert from "vite-plugin-mkcert"
import { resolve } from "path";
import { createSvgIconsPlugin } from "vite-plugin-svg-icons";
import uni from "@dcloudio/vite-plugin-uni";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import mkcert from "vite-plugin-mkcert";
export default defineConfig({
plugins: [
......@@ -62,12 +62,11 @@ export default defineConfig({
https: true, // 默认用http方式
proxy: {
"/k3cloud": {
target: "https://weixin.lingqingkeji.com:86/",
// target: 'https://weixin.lingqingkeji.com:86/',
target: "http://192.168.1.168/",
// target: 'http://192.168.1.61/',
secure: false,
},
"/XiBU": {
target: "http://192.168.1.12",
},
},
},
})
});
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论