补充招生数据获取

This commit is contained in:
Yu 2026-04-10 16:27:58 +08:00
parent b112065efe
commit 535e7954c3
6 changed files with 285 additions and 126 deletions

View File

@ -1,97 +1,109 @@
{ {
"pages": [ "pages": [
{ {
"path": "pages/index/index", "path": "pages/index/index",
"style": { "style": {
// #ifndef H5 // #ifndef H5
"navigationStyle": "custom", "navigationStyle": "custom",
// #endif // #endif
// #ifdef H5 // #ifdef H5
"navigationBarTitleText": "首页" "navigationBarTitleText": "首页"
// #endif // #endif
} }
}, },
{ {
"path": "pages/user/user", "path": "pages/user/user",
"style": { "style": {
// #ifndef H5 // #ifndef H5
"navigationStyle": "custom", "navigationStyle": "custom",
// #endif // #endif
// #ifdef H5 // #ifdef H5
"navigationBarTitleText": "个人中心" "navigationBarTitleText": "个人中心"
// #endif // #endif
} }
}, },
{ {
"path": "pages/login/login", "path": "pages/login/login",
"style": { "style": {
"navigationBarTitleText": "登录" "navigationBarTitleText": "登录"
}, },
"meta": { "meta": {
"white": true "white": true
} }
}, },
{ {
"path": "pages/register/register", "path": "pages/register/register",
"style": { "style": {
"navigationBarTitleText": "注册" "navigationBarTitleText": "注册"
}, },
"meta": { "meta": {
"white": true "white": true
} }
}, },
{ {
"path": "pages/pre_registration/pre_registration", "path": "pages/pre_registration/pre_registration",
"style": { "style": {
"navigationBarTitleText": "预报名" "navigationBarTitleText": "预报名"
} }
}, },
{ {
"path": "pages/submit_success/submit_success", "path": "pages/submit_success/submit_success",
"style": { "style": {
"navigationBarTitleText": "提交成功" "navigationBarTitleText": "提交成功"
} }
}, },
{ {
"path": "pages/my_recruitment/my_recruitment", "path": "pages/my_recruitment/my_recruitment",
"style": { "style": {
"navigationBarTitleText": "我的招生", "navigationBarTitleText": "我的招生",
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{ {
"path": "pages/user_data/user_data", "path": "pages/user_data/user_data",
"style": { "style": {
"navigationBarTitleText": "个人资料" "navigationBarTitleText": "个人资料"
} }
}, },
{ {
"path": "pages/change_password/change_password", "path": "pages/change_password/change_password",
"style": { "style": {
"navigationBarTitleText": "修改密码" "navigationBarTitleText": "修改密码"
} }
}, },
{ {
"path": "pages/payment/payment", "path": "pages/payment/payment",
"style": { "style": {
"navigationBarTitleText": "缴费" "navigationBarTitleText": "缴费"
} }
} },
], {
"globalStyle": { "path": "pages/payment_result/payment_result",
"navigationBarTextStyle": "black", "style": {
"navigationBarTitleText": "商城", "navigationBarTitleText": "支付结果"
"navigationBarBackgroundColor": "#FFFFFF", }
"backgroundColor": "#F8F8F8", },
"h5": { {
"navigationStyle": "custom" "path": "pages/webview/webview",
} "style": {
}, "navigationBarTitleText": "支付"
"easycom": { }
"custom": { }
"router-navigate": "uniapp-router-next/components/router-navigate/router-navigate.vue", ],
"^(?!z-paging-refresh|z-paging-load-more)z-paging(.*)": "z-paging/components/z-paging$1/z-paging$1.vue", "globalStyle": {
"^w-(.*)": "@/components/widgets/$1/$1.vue" "navigationBarTextStyle": "black",
} "navigationBarTitleText": "商城",
} "navigationBarBackgroundColor": "#FFFFFF",
"backgroundColor": "#F8F8F8",
"h5": {
"navigationStyle": "custom"
}
},
"easycom": {
"custom": {
"router-navigate": "uniapp-router-next/components/router-navigate/router-navigate.vue",
"^(?!z-paging-refresh|z-paging-load-more)z-paging(.*)": "z-paging/components/z-paging$1/z-paging$1.vue",
"^w-(.*)": "@/components/widgets/$1/$1.vue"
}
}
} }

View File

@ -205,11 +205,12 @@ const getStats = async () => {
if (teacherId) { if (teacherId) {
console.log('首页获取招生统计teacherId:', teacherId) console.log('首页获取招生统计teacherId:', teacherId)
const res = await getEnrollmentStatistical(teacherId) const res = await getEnrollmentStatistical(teacherId)
if (res && res.totalEnrollCount !== undefined) { console.log('招生统计接口返回:', res)
if (res && res.total_enroll_count !== undefined) {
stats.value = { stats.value = {
total: res.totalEnrollCount, total: res.total_enroll_count,
today: res.todayEnrollCount, today: res.today_enroll_count,
week: res.weekEnrollCount week: res.week_enroll_count
} }
} }
} else { } else {

View File

@ -65,14 +65,21 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, shallowRef } from 'vue' import { ref, shallowRef, computed } from 'vue'
import { onLoad } from '@dcloudio/uni-app' import { onLoad } from '@dcloudio/uni-app'
import { getPreRegistrationList } from '@/api/app' import { useUserStore } from '@/stores/user'
import { storeToRefs } from 'pinia'
import { getPreRegistrationList, getTeacherInfo } from '@/api/app'
import { getAliyunImageUrl } from '@/utils/imageUtils' import { getAliyunImageUrl } from '@/utils/imageUtils'
import { ensureStorageConfig } from '@/utils/configUtils' import { ensureStorageConfig } from '@/utils/configUtils'
const list = ref<any[]>([]) const list = ref<any[]>([])
const paging = shallowRef() const paging = shallowRef()
const userStore = useUserStore()
const { userInfo } = storeToRefs(userStore)
// ID
const currentTeacherId = ref<number | undefined>(undefined)
// //
const recruitmentBgImageSrc = ref(getAliyunImageUrl('static/yubaoming/recruitment_3.png')) const recruitmentBgImageSrc = ref(getAliyunImageUrl('static/yubaoming/recruitment_3.png'))
@ -87,10 +94,17 @@ const initImageSources = async () => {
const queryList = async (pageNo: number, pageSize: number) => { const queryList = async (pageNo: number, pageSize: number) => {
console.log('=== queryList 开始执行 ===', pageNo, pageSize) console.log('=== queryList 开始执行 ===', pageNo, pageSize)
try { try {
const teacherId = currentTeacherId.value
if (!teacherId) {
console.log('未找到 teacherId跳过获取招生列表')
paging.value.complete([])
return
}
const params = { const params = {
page: pageNo, page: pageNo,
limit: pageSize, limit: pageSize,
studentStatus: -1 studentStatus: -1,
recruitmentTeacherId: teacherId
} }
console.log('请求参数:', params) console.log('请求参数:', params)
const res = await getPreRegistrationList(params) const res = await getPreRegistrationList(params)
@ -112,8 +126,24 @@ const goBack = () => {
uni.navigateBack() uni.navigateBack()
} }
onLoad(() => { onLoad(async () => {
initImageSources() initImageSources()
// teacherId
if (userInfo.value?.teacherId) {
currentTeacherId.value = userInfo.value.teacherId
} else if (userInfo.value?.account) {
try {
const teacherRes = await getTeacherInfo({ teacherCode: userInfo.value.account })
if (teacherRes && teacherRes.code === 1 && teacherRes.data) {
currentTeacherId.value = teacherRes.data.teacherId
userInfo.value.teacherId = teacherRes.data.teacherId
}
} catch (error) {
console.error('获取教师信息失败:', error)
}
}
queryList(1, 10) queryList(1, 10)
}) })
</script> </script>

View File

@ -312,21 +312,59 @@ const alipayJspayPay = async () => {
amountFen: Math.round(parseFloat(String(amount.value)) * 100), amountFen: Math.round(parseFloat(String(amount.value)) * 100),
body: remark.value || '缴费支付', body: remark.value || '缴费支付',
studentId: Number(studentId.value), studentId: Number(studentId.value),
buyerLogonId: '', buyerLogonId: userStore.userInfo?.mobile || '',
includeRawResponse: false includeRawResponse: false
}) })
// AjaxResult.data // AjaxResult data
if (res && res.status === '0' && res.resultCode === '0') { console.log('支付接口响应:', res)
outTradeNo.value = res.outTradeNo || '' // : { code: 1, msg: "", data: { status: "0", resultCode: "0", ... } }
// #ifdef H5 const payData = res.code === 1 && res.data ? res.data : res
if (res.payUrl) { console.log('支付数据:', payData)
window.location.href = res.payUrl
if (payData && payData.status === '0' && payData.resultCode === '0') {
outTradeNo.value = payData.outTradeNo || ''
// payUrl使 payUrl
console.log('payUrl:', payData.payUrl)
if (payData.payUrl) {
const payUrlStr = String(payData.payUrl).trim()
console.log('准备跳转 payUrl:', payUrlStr)
// loading
uni.hideLoading()
// 使 web-view
console.log('微信小程序环境,使用 web-view 打开')
uni.navigateTo({
url: `/pages/webview/webview?url=${encodeURIComponent(payUrlStr)}`,
success: () => {
console.log('打开 web-view 成功')
startPayStatusCheck()
},
fail: (err) => {
console.error('打开 web-view 失败:', err)
//
uni.setClipboardData({
data: payUrlStr,
success: () => {
uni.showModal({
title: '提示',
content: '支付链接已复制,请在浏览器中打开完成支付',
showCancel: false,
success: () => {
startPayStatusCheck()
}
})
}
})
}
})
return return
} }
// #endif
const payInfo = JSON.parse(res.payInfo || '{}') const payInfo = JSON.parse(payData.payInfo || '{}')
console.log('payInfo:', payInfo)
if (payInfo.tradeNO) { if (payInfo.tradeNO) {
// #ifdef APP-PLUS // #ifdef APP-PLUS
@ -345,6 +383,24 @@ const alipayJspayPay = async () => {
}) })
// #endif // #endif
// #ifdef MP-ALIPAY
//
my.tradePay({
tradeNO: payInfo.tradeNO,
success: (result: any) => {
if (result.resultCode === '9000') {
checkPayResult()
} else {
goToResult(false)
}
},
fail: (err: any) => {
console.error('支付宝小程序支付失败:', err)
goToResult(false)
}
})
// #endif
// #ifdef H5 // #ifdef H5
if (typeof AlipayJSBridge !== 'undefined') { if (typeof AlipayJSBridge !== 'undefined') {
AlipayJSBridge.call( AlipayJSBridge.call(
@ -553,6 +609,60 @@ const fallbackCheckPayResult = async () => {
} }
} }
//
let payStatusCheckTimer: any = null
const startPayStatusCheck = () => {
//
if (payStatusCheckTimer) {
clearInterval(payStatusCheckTimer)
}
// 32060
let checkCount = 0
const maxCheckCount = 20
payStatusCheckTimer = setInterval(async () => {
checkCount++
console.log(`${checkCount}次检查支付状态`)
try {
if (!outTradeNo.value) {
clearInterval(payStatusCheckTimer)
return
}
const res = await bankFeeTradeQuery({ outTradeNo: outTradeNo.value })
if (res && res.status === '0' && res.resultCode === '0') {
const tradeState = res.tradeState
if (tradeState === 'SUCCESS') {
//
clearInterval(payStatusCheckTimer)
goToResult(true)
} else if (tradeState === 'CLOSED' || tradeState === 'REVOKED' || tradeState === 'PAYERROR') {
//
clearInterval(payStatusCheckTimer)
goToResult(false)
}
// NOTPAY USERPAYING
}
//
if (checkCount >= maxCheckCount) {
clearInterval(payStatusCheckTimer)
uni.showModal({
title: '提示',
content: '支付检查超时,请手动查询支付结果',
showCancel: false
})
}
} catch (error) {
console.error('检查支付状态失败:', error)
}
}, 3000)
}
// //
const goToResult = (success: boolean) => { const goToResult = (success: boolean) => {
uni.redirectTo({ uni.redirectTo({

View File

@ -480,6 +480,7 @@ onMounted(() => {
onLoad((options: any) => { onLoad((options: any) => {
console.log('=== 预报名页面 onLoad 被触发 ===') console.log('=== 预报名页面 onLoad 被触发 ===')
console.log('options:', options) console.log('options:', options)
console.log('【调试】二维码参数:', { teacherId: options.teacherId, id: options.id, invitationCode: options.invitationCode, scene: options.scene })
if (options.teacherId) { if (options.teacherId) {
getTeacherData(options.teacherId) getTeacherData(options.teacherId)

View File

@ -313,17 +313,17 @@ const getStats = async (teacherId?: number) => {
console.log('正在调用 getEnrollmentStatistical, teacherId:', teacherId) console.log('正在调用 getEnrollmentStatistical, teacherId:', teacherId)
const res = await getEnrollmentStatistical(teacherId) const res = await getEnrollmentStatistical(teacherId)
console.log('接口返回结果:', res) console.log('接口返回结果:', res)
// code //
if (res && res.totalEnrollCount !== undefined) { if (res && res.total_enroll_count !== undefined) {
console.log('totalEnrollCount:', res.totalEnrollCount) console.log('total_enroll_count:', res.total_enroll_count)
console.log('todayEnrollCount:', res.todayEnrollCount) console.log('today_enroll_count:', res.today_enroll_count)
console.log('weekEnrollCount:', res.weekEnrollCount) console.log('week_enroll_count:', res.week_enroll_count)
console.log('monthEnrollCount:', res.monthEnrollCount) console.log('month_enroll_count:', res.month_enroll_count)
recruitmentStats.value = { recruitmentStats.value = {
total: res.totalEnrollCount, total: res.total_enroll_count,
today: res.todayEnrollCount, today: res.today_enroll_count,
week: res.weekEnrollCount, week: res.week_enroll_count,
month: res.monthEnrollCount month: res.month_enroll_count
} }
console.log('更新后的 recruitmentStats:', recruitmentStats.value) console.log('更新后的 recruitmentStats:', recruitmentStats.value)
} else { } else {
@ -338,9 +338,14 @@ const getStats = async (teacherId?: number) => {
const openQrcodeModal = async () => { const openQrcodeModal = async () => {
showQrcodeModal.value = true showQrcodeModal.value = true
if (!qrcodeUrl.value) { if (!qrcodeUrl.value) {
console.log('openQrcodeModal: 使用默认 teacherId = 8 获取二维码') const teacherId = currentTeacherId.value || userInfo.value?.teacherId
const defaultTeacherId = 8 if (teacherId) {
await getQrcode(defaultTeacherId) console.log('openQrcodeModal: 使用 teacherId =', teacherId, '获取二维码')
await getQrcode(teacherId)
} else {
console.log('openQrcodeModal: 未找到 teacherId无法获取二维码')
uni.$u.toast('无法获取二维码,请先登录')
}
} }
} }