import { defineComponent, reactive, ref, onMounted } from 'vue'
import styles from './teacher-attendDetail.module.less'
import clockIcon from '../images/clock-icon.png'
import errorIcon from '../images/error-icon.png'
import successIcon from '../images/success-icon.png'
import defaultIcon from '@/school/images/default-icon.png'
import sendmsgIcon from '@/school/images/sendmsg-icon.png'
import phoneIcon from '@/school/images/phone-icon.png'
import OHeader from '@/components/o-header'
import msgIcon from '@/school/images/msg-icon.png'
import { Icon, ActionSheet, showToast } from 'vant'
import dayjs from 'dayjs'
import { useRoute, useRouter } from 'vue-router'
import { state as globalState } from '@/state'
import request from '@/helpers/request'
import { postMessage } from '@/helpers/native-message'
import { teacherAttType } from '@/constant/index'
export default defineComponent({
props: ['item'],
name: 'teacher-attendDetail',
setup(props) {
const router = useRouter()
const route = useRoute()
const gotoStudentDetail = () => {
// router.push({ path: '/student-att-day', query: { time: teacherAttInfo.value.time } })
}
const attendanceScope = ref(0)
const teacherAttInfo = ref({} as any)
const platformApi = ref(globalState.platformApi)
console.log(platformApi.value)
const showContact = ref(false)
const startContact = () => {
showContact.value = true
}
const closeSheet = () => {
showContact.value = false
}
const postMsg = async () => {
try {
await postMessage({
api: 'joinChatGroup',
content: {
type: 'single', // single 单人 multi 多人
id: teacherAttInfo.value.imUserId
}
})
closeSheet()
} catch (e) {
showToast('发起聊天失败')
closeSheet()
}
}
const callPhone = async () => {
try {
await postMessage({
api: 'callPhone',
content: {
phone: teacherAttInfo.value.teacherPhone
}
})
closeSheet()
} catch (e) {
showToast('拨号失败')
closeSheet()
}
}
const getCourseAtt = async () => {
try {
const res = await request.post(
`${platformApi.value}/courseSchedule/teacherAttendance/course/${route.query.courseScheduleId}`,
{}
)
teacherAttInfo.value = res.data
// res.data.sysParamConfigs.forEach((item: any) => {
// if (item.paramName == 'scope_of_attendance') {
// attendanceScope.value = item.paramValue
// }
// })
} catch (e) {
console.log(e)
}
}
onMounted(() => {
getCourseAtt()
})
const setAddress = async (myPoint: string) => {
if (!myPoint) {
// showToast('当前暂无定位')
return
}
try {
await postMessage({
api: 'sourseMapApi',
content: {
type: 'display',
orginPoint: teacherAttInfo.value.schoolLongitudeLatitude,
myPoint: myPoint,
limitDistance: teacherAttInfo.value.scopeOfAttendance
}
})
} catch (e) {
console.log(e)
}
}
return () => (
<>
{dayjs(teacherAttInfo.value?.startTime).format('YYYY-MM-DD HH:mm')} {'~'} {dayjs(teacherAttInfo.value?.endTime).format('HH:mm')}
{teacherAttInfo.value?.classGroupName}-{teacherAttInfo.value?.teacherName}
{teacherAttInfo.value?.orchestraName}
{teacherAttInfo.value?.signInTime ? (
{teacherAttInfo.value?.signInLongitudeLatitudeStatus === 'NORMAL' ? '考勤范围内' : '考勤范围外'}
) : (暂无定位
)} {teacherAttInfo.value.signInLongitudeLatitude ? (
查看定位
下课时间 {dayjs(teacherAttInfo.value?.endTime).format('HH:mm')}
{teacherAttInfo.value?.signOutTime ? ( <>
{' '} {teacherAttInfo.value?.signOutLongitudeLatitudeStatus === 'NORMAL' ? '考勤范围内' : '考勤范围外'}
查看定位
暂无定位
> )}联系方式
发送消息
拨打电话