diff --git a/.vscode/settings.json b/.vscode/settings.json index 39be7d4..f47ed3e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -51,6 +51,7 @@ "cSpell.words": [ "dcloudio", "iconfont", + "JSAPI", "persistedstate", "pinia", "VITE", diff --git a/package.json b/package.json index a01fd4c..26859e8 100644 --- a/package.json +++ b/package.json @@ -2,12 +2,13 @@ "name": "xuexiaole-mobile", "version": "0.1.0", "scripts": { + "dev": "uni --mode dev", + "dev:h5": "uni --mode dev", + "dev:mp": "uni --mode mp", "dev:app": "uni -p app", "dev:app-android": "uni -p app-android", "dev:app-ios": "uni -p app-ios", "dev:custom": "uni -p", - "dev:h5": "uni --mode dev", - "dev:h5-mp": "uni --mode mp", "dev:h5:ssr": "uni --ssr", "dev:mp-alipay": "uni -p mp-alipay", "dev:mp-baidu": "uni -p mp-baidu", diff --git a/src/components/manual-bind-child/index.vue b/src/components/manual-bind-child/index.vue new file mode 100644 index 0000000..5b18b4c --- /dev/null +++ b/src/components/manual-bind-child/index.vue @@ -0,0 +1,58 @@ + + + + + diff --git a/src/pages/academic-report/components/exerciseStatistics.vue b/src/pages/academic-report/components/exerciseStatistics.vue index af4b81a..4d42f7d 100644 --- a/src/pages/academic-report/components/exerciseStatistics.vue +++ b/src/pages/academic-report/components/exerciseStatistics.vue @@ -100,25 +100,24 @@ diff --git a/src/pages/home/index.vue b/src/pages/home/index.vue index a62055d..088a8ed 100644 --- a/src/pages/home/index.vue +++ b/src/pages/home/index.vue @@ -9,6 +9,7 @@ import router from '@/router/router' import { useBadgeStore } from '@/store/badge' import { manualBindApi } from '@/api' import { useDeviceStore } from '@/store/device' +import ManualBindChild from '@/components/manual-bind-child/index.vue' const { getUserInfo } = useUserStore() const deviceStore = useDeviceStore() @@ -25,7 +26,6 @@ const defaultAvatar = `${OSS_URL}/urm/default_avatar.png` // 手动绑定弹框相关 const showHandBindPopup = ref(false) -const childAccount = ref('') const functionList = reactive([ { @@ -72,30 +72,6 @@ function scanBind() { // 手动绑定 function handBind() { showHandBindPopup.value = true - childAccount.value = '' -} - -// 确认手动绑定 -function confirmHandBind() { - if (!childAccount.value.trim()) { - hud.error('请输入孩子账号') - return - } - - hud.load({ - task: async () => { - const res = Number(await manualBindApi(childAccount.value)) - if (res === 1) { - hud.success('绑定成功') - } else if (res === 0) { - hud.error('绑定失败') - } else if (res === 2) { - hud.success('已向管理员发送绑定请求') - } - showHandBindPopup.value = false - }, - option: '绑定', - }) } // 底部点击 @@ -225,14 +201,7 @@ onMounted(() => { - - - + diff --git a/src/pages/mine/Components/recharge/index.vue b/src/pages/mine/Components/recharge/index.vue index 135ac2e..52e359a 100644 --- a/src/pages/mine/Components/recharge/index.vue +++ b/src/pages/mine/Components/recharge/index.vue @@ -57,9 +57,48 @@ async function ok() { return } - // 生成订单 - const data = await createRechargeOrderApi(money) - console.log(data) + hud.load({ + task: async () => { + const data = await createRechargeOrderApi(money) + const params = data.prepayResponse + if (!params) { + hud.error('生成订单失败') + return + } + // 发起支付 + WeixinJSBridge.invoke( + 'getBrandWCPayRequest', + { + appId: params.appId, // 公众号ID,由商户传入 + timeStamp: params.timeStamp, // 时间戳,自1970年以来的秒数 + nonceStr: params.nonceStr, // 随机串 + package: params.packageVal, + signType: params.signType, // 微信签名方式: + paySign: params.paySign, + }, + (res: any) => { + if (res.err_msg === 'get_brand_wcpay_request:ok') { + hud.success('支付成功') + emit('update:modelValue', false) + } else { + hud.error('支付失败: ' + res.err_msg) + } + }, + ) + // wxPayJSAPI({ + // bridge: WeixinJSBridge, + // params: payParams, + // success: () => { + // hud.success('支付成功') + // emit('update:modelValue', false) + // }, + // error: (err: any) => { + // hud.error('支付失败: ' + err) + // }, + // }) + }, + option: '生成订单', + }) } diff --git a/src/pages/parents/supervisionService/buyService.vue b/src/pages/parents/supervisionService/buyService.vue index 71a9310..fe6e1a0 100644 --- a/src/pages/parents/supervisionService/buyService.vue +++ b/src/pages/parents/supervisionService/buyService.vue @@ -193,43 +193,43 @@