Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
mlaj
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
hookehuyr
2025-12-05 09:46:22 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2c864ab2cc245c828308c3c203af4c1f5249ab1c
2c864ab2
1 parent
d8ac2e26
feat(课程详情页): 添加购买流程的微信环境校验
在非开发环境下,对付费课程增加微信内置浏览器环境校验。免费课程跳过校验,非微信环境提示用户并阻止购买流程
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
README.md
src/views/courses/CourseDetailPage.vue
README.md
View file @
2c864ab
...
...
@@ -39,6 +39,12 @@ https://oa-dev.onwall.cn/f/mlaj
-
图片压缩:富文本中若包含
`cdn.ipadbiz.cn`
图片,使用
`?imageMogr2/thumbnail/200x/strip/quality/70`
参数。
-
位置:
`/src/views/courses/CourseDetailPage.vue`
,“咨询弹窗”模板与交互逻辑(
`open_consult_dialog`
、
`close_consult_dialog`
、
`call_phone`
、
`copy_consult_info`
)。
-
购买流程环境校验
-
行为:仅对非免费课程在详情页点击“购买”时进行校验;生产环境下必须为微信内置浏览器(
`wxInfo().isWeiXin`
)。
-
免费课程:跳过微信环境校验,允许直接进入结算流程。
-
非微信环境(付费课):提示“请在微信内打开进行购买”,不进入结算。
-
位置:
`/src/views/courses/CourseDetailPage.vue`
的
`handlePurchase`
中,使用
`wxInfo`
进行环境判断。
-
401拦截策略优化(公开页面不再跳登录)
-
行为:接口返回
`code=401`
时,不再对公开页面(如课程详情
`/courses/:id`
)进行登录重定向;仅当当前路由确实需要登录权限时才跳转至登录页。
-
原理:响应拦截器调用路由守卫
`checkAuth`
判断当前路由是否为受限页面,受限则清理登录信息并附带
`redirect`
重定向至登录页;公开页面保持当前页,由业务自行处理401。
...
...
src/views/courses/CourseDetailPage.vue
View file @
2c864ab
...
...
@@ -377,6 +377,7 @@ import { useRoute, useRouter } from 'vue-router'
import { useCart } from '@/contexts/cart'
import { useAuth } from '@/contexts/auth'
import { useTitle } from '@vueuse/core';
import { wxInfo } from '@/utils/tools';
import { showToast, showDialog, showImagePreview } from 'vant';
import { formatDate } from '@/utils/tools'
import { sharePage } from '@/composables/useShare.js'
...
...
@@ -701,6 +702,17 @@ const handlePurchase = () => {
return
}
// 检查是否在微信环境(生产环境下强制要求)
/**
* 判断是否为微信内置浏览器环境
* 非微信环境提示用户在微信内打开;免费课程跳过校验
*/
const is_free = (course.value?.price === '0.00' || Number(course.value?.price) === 0)
if (!is_free && !import.meta.env.DEV && !wxInfo().isWeiXin) {
showToast('请在微信内打开进行购买')
return
}
if (course.value) {
// 调试日志:检查course.value.form_url的值
console.log('CourseDetailPage - course.value.form_url:', course.value.form_url)
...
...
Please
register
or
login
to post a comment