补充提交二维码跳转

This commit is contained in:
Yu 2026-04-02 10:29:58 +08:00
parent 431f24418a
commit 8b320a0f18
10 changed files with 91 additions and 45 deletions

View File

@ -2,7 +2,7 @@ const config = {
terminal: 1, //终端
title: '后台管理系统', //网站默认标题
version: '1.9.1', //版本号
baseUrl: `${import.meta.env.VITE_APP_BASE_URL || 'http://192.168.123.111:8082'}/`, //请求接口域名 localhost
baseUrl: `${import.meta.env.VITE_APP_BASE_URL || 'http://localhost:8082'}/`, //请求接口域名 localhost
urlPrefix: 'adminapi', //请求默认前缀
timeout: 10 * 1000 //请求超时时长
}

View File

@ -48,7 +48,7 @@ public class IndexServiceImpl implements IIndexService {
console.put("version", version);
// 招生统计数据
Map<String, Object> enrollmentStats = enrollmentStaticService.buildEnrollmentStats();
Map<String, Object> enrollmentStats = enrollmentStaticService.buildEnrollmentStats(null);
console.put("today", enrollmentStats);
// 招生趋势数据带筛选条件

View File

@ -10,7 +10,7 @@ import java.io.Serializable;
@Data
@ApiModel("岗位关联表实体")
@TableName("la-admin_jobs")
@TableName("la_admin_jobs")
public class AdminJobs implements Serializable {
private static final long serialVersionUID = 1L;

View File

@ -88,7 +88,9 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherMapper, Teacher> impl
@Override
public AjaxResult<Object> getTeacherInfo(TeacherSearchValidate searchValidate) {
if (searchValidate.getTeacherId() == null && StringUtils.isBlank(searchValidate.getInvitationCode())) {
if (searchValidate.getTeacherId() == null
&& StringUtils.isBlank(searchValidate.getInvitationCode())
&& StringUtils.isBlank(searchValidate.getTeacherCode())) {
return AjaxResult.failed("教师参数缺失!");
}
@ -99,6 +101,9 @@ public class TeacherServiceImpl extends ServiceImpl<TeacherMapper, Teacher> impl
if (StringUtils.isNotBlank(searchValidate.getInvitationCode())) {
queryWrapper.eq("invitation_code", searchValidate.getInvitationCode());
}
if (StringUtils.isNotBlank(searchValidate.getTeacherCode())) {
queryWrapper.eq("teacher_code", searchValidate.getTeacherCode());
}
Teacher teacher = teacherMapper.selectOne(queryWrapper.last("limit 1"));
if (teacher == null) {

View File

@ -6,7 +6,7 @@ const envBaseUrl = import.meta.env.VITE_APP_BASE_URL || ''
//#ifdef MP-WEIXIN
// 微信小程序:如果环境变量为空,使用默认开发地址
let baseUrl = envBaseUrl ? `${envBaseUrl}/` : 'http://192.168.123.123:8084/'
let baseUrl = envBaseUrl ? `${envBaseUrl}/` : 'http://8.153.111.6:8084/'
//#endif
//#ifndef MP-WEIXIN

View File

@ -133,6 +133,7 @@ import { useUserStore } from '@/stores/user'
import { storeToRefs } from 'pinia'
import { getAliyunImageUrl } from '@/utils/imageUtils'
import { ensureStorageConfig } from '@/utils/configUtils'
import cache from '@/utils/cache'
// #ifdef MP
import MpPrivacyPopup from './component/mp-privacy-popup.vue'
@ -185,19 +186,15 @@ const getStats = async () => {
}
try {
// teacherId
let teacherId: number | undefined = undefined
// userInfo
if (userInfo.value?.teacherId) {
teacherId = userInfo.value.teacherId
} else {
// userInfo getTeacherInfo
} else if (userInfo.value?.account) {
try {
const teacherRes = await getTeacherInfo({ id: userInfo.value.id })
const teacherRes = await getTeacherInfo({ teacher_code: userInfo.value.account })
if (teacherRes && teacherRes.code === 1 && teacherRes.data) {
teacherId = teacherRes.data.teacherId
// userInfo
teacherId = teacherRes.data.teacher_id
userInfo.value.teacherId = teacherId
}
} catch (error) {
@ -208,7 +205,6 @@ const getStats = async () => {
if (teacherId) {
console.log('首页获取招生统计teacherId:', teacherId)
const res = await getEnrollmentStatistical(teacherId)
// code
if (res && res.total_enroll_count !== undefined) {
stats.value = {
total: res.total_enroll_count,
@ -279,23 +275,32 @@ onLoad((options: any) => {
if (options.scene) {
const invitationCode = decodeURIComponent(options.scene)
if (isLogin.value) {
uni.navigateTo({
url: `/pages/pre_registration/pre_registration?invitationCode=${invitationCode}`
})
} else {
uni.navigateTo({
url: `/pages/login/login?invitationCode=${invitationCode}`
})
}
cache.set('INVITATION_CODE', invitationCode)
}
})
onShow(async () => {
//
await new Promise(resolve => setTimeout(resolve, 100))
//
const invitationCode = cache.get('INVITATION_CODE')
if (invitationCode) {
console.log('首页 onShow 检测到邀请码:', invitationCode)
cache.remove('INVITATION_CODE')
if (isLogin.value) {
//
uni.navigateTo({
url: `/pages/pre_registration/pre_registration?invitationCode=${invitationCode}`
})
} else {
//
cache.set('INVITATION_CODE', invitationCode)
uni.navigateTo({
url: '/pages/login/login'
})
}
return
}
if (!isLogin.value) {
return
}

View File

@ -391,8 +391,10 @@ const loginHandle = async (data: any) => {
uni.hideLoading()
const invitationCode = cache.get('INVITATION_CODE')
if (invitationCode) {
cache.remove('INVITATION_CODE')
router.reLaunch(`/pages/pre_registration/pre_registration?invitationCode=${invitationCode}`)
console.log('登录后检测到邀请码,跳转到预报名页面:', invitationCode)
uni.reLaunch({
url: `/pages/pre_registration/pre_registration?invitationCode=${invitationCode}`
})
cache.remove(BACK_URL)
return
}

View File

@ -193,6 +193,7 @@ import { reactive, ref, onMounted, watch, toRaw } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { useRouter } from 'uniapp-router-next'
import { getMajorList, addStudent, getTeacherInfo } from '@/api/app'
import cache from '@/utils/cache'
const router = useRouter()
@ -237,11 +238,19 @@ const getTeacherData = async (teacherId: string) => {
console.log('teacherId:', teacherId)
try {
console.log('开始调用 getTeacherInfo...')
const res = await getTeacherInfo({ teacherId: Number(teacherId) })
console.log('getTeacherInfo 返回:', res)
const res = await getTeacherInfo({ teacher_id: Number(teacherId) })
console.log('getTeacherInfo 完整返回:', JSON.stringify(res))
console.log('getTeacherInfo res.code:', res.code)
console.log('getTeacherInfo res.data:', res.data)
if (res.code === 1 && res.data) {
console.log('res.data.teacher_name:', res.data.teacher_name)
console.log('res.data.teacher_id:', res.data.teacher_id)
formData.teacher = res.data.teacher_name
formData.recruitmentTeacherId = res.data.teacher_id
console.log('赋值后 formData.teacher:', formData.teacher)
console.log('赋值后 formData.recruitmentTeacherId:', formData.recruitmentTeacherId)
} else {
console.log('res.code !== 1 或 res.data 为空')
}
} catch (error) {
console.error('获取老师信息失败:', error)
@ -252,11 +261,20 @@ const getTeacherDataByInvitationCode = async (invitationCode: string) => {
console.log('=== getTeacherDataByInvitationCode 被调用 ===')
console.log('invitationCode:', invitationCode)
try {
const res = await getTeacherInfo({ invitationCode: invitationCode })
console.log('getTeacherInfo 返回:', res)
console.log('开始调用 getTeacherInfo...')
const res = await getTeacherInfo({ invitation_code: invitationCode })
console.log('getTeacherInfo 完整返回:', JSON.stringify(res))
console.log('getTeacherInfo res.code:', res.code)
console.log('getTeacherInfo res.data:', res.data)
if (res.code === 1 && res.data) {
console.log('res.data.teacher_name:', res.data.teacher_name)
console.log('res.data.teacher_id:', res.data.teacher_id)
formData.teacher = res.data.teacher_name
formData.recruitmentTeacherId = res.data.teacher_id
console.log('赋值后 formData.teacher:', formData.teacher)
console.log('赋值后 formData.recruitmentTeacherId:', formData.recruitmentTeacherId)
} else {
console.log('res.code !== 1 或 res.data 为空')
}
} catch (error) {
console.error('获取老师信息失败:', error)
@ -460,13 +478,28 @@ onMounted(() => {
})
onLoad((options: any) => {
console.log('=== 预报名页面 onLoad ===')
console.log('=== 预报名页面 onLoad 被触发 ===')
console.log('options:', options)
if (options.teacherId) {
getTeacherData(options.teacherId)
} else if (options.id) {
// 使 id
getTeacherData(options.id)
} else if (options.invitationCode) {
getTeacherDataByInvitationCode(options.invitationCode)
} else if (options.scene) {
const invitationCode = decodeURIComponent(options.scene)
getTeacherDataByInvitationCode(invitationCode)
} else {
const cachedCode = cache.get('INVITATION_CODE')
if (cachedCode) {
console.log('从缓存中获取到 INVITATION_CODE:', cachedCode)
cache.remove('INVITATION_CODE')
getTeacherDataByInvitationCode(cachedCode)
} else {
console.log('没有获取到任何参数或缓存')
}
}
})
</script>

View File

@ -465,29 +465,27 @@ onShow(async () => {
if (isLogin.value && userInfo.value) {
console.log('条件满足,开始获取教师信息')
console.log('userInfo.value.id:', userInfo.value.id)
console.log('userInfo.value.account:', userInfo.value.account)
//
let teacherIdForQrcode: number | undefined = undefined
try {
console.log('准备调用 getTeacherInfo, 参数:', { id: userInfo.value.id })
const teacherRes = await getTeacherInfo({ id: userInfo.value.id })
console.log('准备调用 getTeacherInfo, 参数:', { teacher_code: userInfo.value.account })
const teacherRes = await getTeacherInfo({ teacher_code: userInfo.value.account })
console.log('getTeacherInfo 返回:', teacherRes)
console.log('teacherRes 类型:', typeof teacherRes)
console.log('teacherRes.code:', teacherRes?.code)
console.log('teacherRes.data:', teacherRes?.data)
// : { code: 1, msg: '', data: { teacherId, teacherName, ... } }
if (teacherRes && teacherRes.code === 1 && teacherRes.data) {
const teacherData = teacherRes.data
console.log('teacherData:', teacherData)
console.log('teacherData.teacherId:', teacherData.teacherId)
// userInfo
userInfo.value.teacherId = teacherData.teacherId
teacherIdForQrcode = teacherData.teacherId
currentTeacherId.value = teacherData.teacherId
console.log('设置 teacherId:', teacherData.teacherId)
console.log('教师姓名:', teacherData.teacherName)
console.log('学院:', teacherData.collegeName)
console.log('二维码URL:', teacherData.qrcodeUrl)
console.log('teacherData.teacher_id:', teacherData.teacher_id)
userInfo.value.teacherId = teacherData.teacher_id
teacherIdForQrcode = teacherData.teacher_id
currentTeacherId.value = teacherData.teacher_id
console.log('设置 teacherId:', teacherData.teacher_id)
console.log('教师姓名:', teacherData.teacher_name)
console.log('学院:', teacherData.college_name)
console.log('二维码URL:', teacherData.qrcode_url)
} else {
console.log('获取教师信息失败或返回格式异常:', teacherRes)
}

View File

@ -18,6 +18,9 @@ const requestHooks: RequestHooks = {
const { urlPrefix, baseUrl, withToken, isAuth } = config
options.header = options.header ?? {}
// 设置默认 Content-Type
options.header['Content-Type'] = options.header['Content-Type'] || 'application/json'
console.log('【Request拦截器】原始请求URL:', options.url)
console.log('【Request拦截器】urlPrefix:', urlPrefix)
console.log('【Request拦截器】baseUrl:', baseUrl)