补充招生数据获取

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": [
{
"path": "pages/index/index",
"style": {
// #ifndef H5
"navigationStyle": "custom",
// #endif
// #ifdef H5
"navigationBarTitleText": "首页"
// #endif
}
},
{
"path": "pages/user/user",
"style": {
// #ifndef H5
"navigationStyle": "custom",
// #endif
// #ifdef H5
"navigationBarTitleText": "个人中心"
// #endif
}
},
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录"
},
"meta": {
"white": true
}
},
{
"path": "pages/register/register",
"style": {
"navigationBarTitleText": "注册"
},
"meta": {
"white": true
}
},
{
"path": "pages/pre_registration/pre_registration",
"style": {
"navigationBarTitleText": "预报名"
}
},
{
"path": "pages/submit_success/submit_success",
"style": {
"navigationBarTitleText": "提交成功"
}
},
{
"path": "pages/my_recruitment/my_recruitment",
"style": {
"navigationBarTitleText": "我的招生",
"navigationStyle": "custom"
}
},
{
"path": "pages/user_data/user_data",
"style": {
"navigationBarTitleText": "个人资料"
}
},
{
"path": "pages/change_password/change_password",
"style": {
"navigationBarTitleText": "修改密码"
}
},
{
"path": "pages/payment/payment",
"style": {
"navigationBarTitleText": "缴费"
}
}
],
"globalStyle": {
"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"
}
}
{
"pages": [
{
"path": "pages/index/index",
"style": {
// #ifndef H5
"navigationStyle": "custom",
// #endif
// #ifdef H5
"navigationBarTitleText": "首页"
// #endif
}
},
{
"path": "pages/user/user",
"style": {
// #ifndef H5
"navigationStyle": "custom",
// #endif
// #ifdef H5
"navigationBarTitleText": "个人中心"
// #endif
}
},
{
"path": "pages/login/login",
"style": {
"navigationBarTitleText": "登录"
},
"meta": {
"white": true
}
},
{
"path": "pages/register/register",
"style": {
"navigationBarTitleText": "注册"
},
"meta": {
"white": true
}
},
{
"path": "pages/pre_registration/pre_registration",
"style": {
"navigationBarTitleText": "预报名"
}
},
{
"path": "pages/submit_success/submit_success",
"style": {
"navigationBarTitleText": "提交成功"
}
},
{
"path": "pages/my_recruitment/my_recruitment",
"style": {
"navigationBarTitleText": "我的招生",
"navigationStyle": "custom"
}
},
{
"path": "pages/user_data/user_data",
"style": {
"navigationBarTitleText": "个人资料"
}
},
{
"path": "pages/change_password/change_password",
"style": {
"navigationBarTitleText": "修改密码"
}
},
{
"path": "pages/payment/payment",
"style": {
"navigationBarTitleText": "缴费"
}
},
{
"path": "pages/payment_result/payment_result",
"style": {
"navigationBarTitleText": "支付结果"
}
},
{
"path": "pages/webview/webview",
"style": {
"navigationBarTitleText": "支付"
}
}
],
"globalStyle": {
"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) {
console.log('首页获取招生统计teacherId:', teacherId)
const res = await getEnrollmentStatistical(teacherId)
if (res && res.totalEnrollCount !== undefined) {
console.log('招生统计接口返回:', res)
if (res && res.total_enroll_count !== undefined) {
stats.value = {
total: res.totalEnrollCount,
today: res.todayEnrollCount,
week: res.weekEnrollCount
total: res.total_enroll_count,
today: res.today_enroll_count,
week: res.week_enroll_count
}
}
} else {

View File

@ -65,14 +65,21 @@
</template>
<script setup lang="ts">
import { ref, shallowRef } from 'vue'
import { ref, shallowRef, computed } from 'vue'
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 { ensureStorageConfig } from '@/utils/configUtils'
const list = ref<any[]>([])
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'))
@ -87,10 +94,17 @@ const initImageSources = async () => {
const queryList = async (pageNo: number, pageSize: number) => {
console.log('=== queryList 开始执行 ===', pageNo, pageSize)
try {
const teacherId = currentTeacherId.value
if (!teacherId) {
console.log('未找到 teacherId跳过获取招生列表')
paging.value.complete([])
return
}
const params = {
page: pageNo,
limit: pageSize,
studentStatus: -1
studentStatus: -1,
recruitmentTeacherId: teacherId
}
console.log('请求参数:', params)
const res = await getPreRegistrationList(params)
@ -112,8 +126,24 @@ const goBack = () => {
uni.navigateBack()
}
onLoad(() => {
onLoad(async () => {
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)
})
</script>

View File

@ -312,21 +312,59 @@ const alipayJspayPay = async () => {
amountFen: Math.round(parseFloat(String(amount.value)) * 100),
body: remark.value || '缴费支付',
studentId: Number(studentId.value),
buyerLogonId: '',
buyerLogonId: userStore.userInfo?.mobile || '',
includeRawResponse: false
})
// AjaxResult.data
if (res && res.status === '0' && res.resultCode === '0') {
outTradeNo.value = res.outTradeNo || ''
// #ifdef H5
if (res.payUrl) {
window.location.href = res.payUrl
// AjaxResult data
console.log('支付接口响应:', res)
// : { code: 1, msg: "", data: { status: "0", resultCode: "0", ... } }
const payData = res.code === 1 && res.data ? res.data : res
console.log('支付数据:', payData)
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
}
// #endif
const payInfo = JSON.parse(res.payInfo || '{}')
const payInfo = JSON.parse(payData.payInfo || '{}')
console.log('payInfo:', payInfo)
if (payInfo.tradeNO) {
// #ifdef APP-PLUS
@ -345,6 +383,24 @@ const alipayJspayPay = async () => {
})
// #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
if (typeof AlipayJSBridge !== 'undefined') {
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) => {
uni.redirectTo({

View File

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

View File

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