|
@@ -2,9 +2,9 @@ import OHeader from '@/components/o-header'
|
|
|
import { defineComponent, onMounted, reactive, ref } from 'vue'
|
|
|
import iconStudent from '@common/images/icon_student.png'
|
|
|
import styles from './apply-withdrawal.module.less'
|
|
|
-import { Button, Dialog, Field, Image } from 'vant'
|
|
|
+import { Button, Dialog, Field, Image, showToast } from 'vant'
|
|
|
import OSticky from '@/components/o-sticky'
|
|
|
-import { useRoute } from 'vue-router'
|
|
|
+import { useRoute, useRouter } from 'vue-router'
|
|
|
import request from '@/helpers/request'
|
|
|
import { state } from '@/state'
|
|
|
|
|
@@ -12,6 +12,7 @@ export default defineComponent({
|
|
|
name: 'apply-withdrawal',
|
|
|
setup() {
|
|
|
const route = useRoute()
|
|
|
+ const router = useRouter()
|
|
|
const headColor = reactive({
|
|
|
headBg: 'transparent',
|
|
|
textColor: '#fff'
|
|
@@ -19,27 +20,53 @@ export default defineComponent({
|
|
|
const forms = reactive({
|
|
|
status: false,
|
|
|
reason: null,
|
|
|
- id: route.query.id
|
|
|
+ id: route.query.id,
|
|
|
+ dataInfo: {} as any,
|
|
|
+ isClick: false
|
|
|
})
|
|
|
|
|
|
const getDetails = async () => {
|
|
|
try {
|
|
|
const { data } = await request.post('/api-student/student/getOrchestraDate/' + forms.id)
|
|
|
+ forms.dataInfo = data
|
|
|
} catch {
|
|
|
//
|
|
|
}
|
|
|
}
|
|
|
|
|
|
const onSubmit = async () => {
|
|
|
- // forms.status = true
|
|
|
- await request.post('/api-student/orchestra/leaveOrchestra', {
|
|
|
- data: {
|
|
|
- studentId: state.user.data.account.id,
|
|
|
- orchestraId: forms.id,
|
|
|
- reason: forms.reason
|
|
|
- }
|
|
|
- })
|
|
|
+ if (!forms.reason) {
|
|
|
+ showToast('请输入退团原因')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ forms.status = true
|
|
|
+ }
|
|
|
+
|
|
|
+ //
|
|
|
+ const onConfirm = async () => {
|
|
|
+ try {
|
|
|
+ forms.isClick = true
|
|
|
+ await request.post('/api-student/orchestra/leaveOrchestra', {
|
|
|
+ data: {
|
|
|
+ studentId: forms.dataInfo.studentId,
|
|
|
+ orchestraId: forms.id,
|
|
|
+ reason: forms.reason
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ forms.isClick = false
|
|
|
+ setTimeout(() => {
|
|
|
+ showToast('申请成功')
|
|
|
+ }, 100)
|
|
|
+ setTimeout(() => {
|
|
|
+ router.replace('/my-orchestra')
|
|
|
+ }, 1100)
|
|
|
+ } catch {
|
|
|
+ //
|
|
|
+ forms.isClick = false
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
onMounted(() => {
|
|
|
getDetails()
|
|
|
})
|
|
@@ -54,10 +81,10 @@ export default defineComponent({
|
|
|
/>
|
|
|
|
|
|
<div class={styles.userInfo}>
|
|
|
- <Image src={iconStudent} class={styles.img} />
|
|
|
- <div class={styles.userName}>宋小泽 同学</div>
|
|
|
+ <Image src={forms.dataInfo.studentAvatar || iconStudent} class={styles.img} />
|
|
|
+ <div class={styles.userName}>{forms.dataInfo.studentName} 同学</div>
|
|
|
<div class={styles.timer}>
|
|
|
- 您已在武汉小学2022标小学2022标准团训练<span>142</span>天
|
|
|
+ 您已在{forms.dataInfo.orchestraName}训练<span>{forms.dataInfo.joinDays}</span>天
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -78,7 +105,7 @@ export default defineComponent({
|
|
|
|
|
|
<OSticky position="bottom">
|
|
|
<div class={'btnGroup'}>
|
|
|
- <Button block round size="large" type="primary" onClick={onSubmit}>
|
|
|
+ <Button block round type="primary" onClick={onSubmit} disabled={forms.isClick}>
|
|
|
确定
|
|
|
</Button>
|
|
|
</div>
|
|
@@ -91,9 +118,7 @@ export default defineComponent({
|
|
|
confirmButtonText="确定"
|
|
|
cancelButtonText="取消"
|
|
|
showCancelButton
|
|
|
- onConfirm={() => {
|
|
|
- console.log('223')
|
|
|
- }}
|
|
|
+ onConfirm={() => onConfirm()}
|
|
|
>
|
|
|
{{
|
|
|
title: () => (
|