|
@@ -10,7 +10,10 @@ import Mix from './components/mix.uvue'
|
|
|
import Game from './components/game.uvue'
|
|
import Game from './components/game.uvue'
|
|
|
import Exchange from './components/exchange.uvue'
|
|
import Exchange from './components/exchange.uvue'
|
|
|
import MathModal from './components/math.uvue'
|
|
import MathModal from './components/math.uvue'
|
|
|
-
|
|
|
|
|
|
|
+import { bindWechatOpenId } from "@/services/user";
|
|
|
|
|
+import { useUi } from "@/uni_modules/cool-ui";
|
|
|
|
|
+import { exchangeCode } from '@/services/user'
|
|
|
|
|
+const ui = useUi();
|
|
|
const menuList = computed(() => {
|
|
const menuList = computed(() => {
|
|
|
return [
|
|
return [
|
|
|
...dict.getChildrenList('index_subject_id'),
|
|
...dict.getChildrenList('index_subject_id'),
|
|
@@ -52,15 +55,38 @@ function handlePage(val: any) {
|
|
|
selected.value = val.code
|
|
selected.value = val.code
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
-onMounted(() => {
|
|
|
|
|
- console.log(menuList.value)
|
|
|
|
|
-})
|
|
|
|
|
-function handleView(url) {
|
|
|
|
|
- router.push({ path: url })
|
|
|
|
|
-}
|
|
|
|
|
const userInfo = computed(() => user.info.value?.userInfo)
|
|
const userInfo = computed(() => user.info.value?.userInfo)
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
const visible = ref(false)
|
|
const visible = ref(false)
|
|
|
const visible2 = ref(false)
|
|
const visible2 = ref(false)
|
|
|
|
|
+const visible3 = ref(false)
|
|
|
|
|
+onMounted(async () => {
|
|
|
|
|
+ if (!userInfo.value.wxOpenId) {
|
|
|
|
|
+ ui.showConfirm({
|
|
|
|
|
+ title: "提示",
|
|
|
|
|
+ message: "您当前未绑定微信,是否绑定微信?",
|
|
|
|
|
+ confirmText: "绑定",
|
|
|
|
|
+ cancelText: "取消",
|
|
|
|
|
+ callback: async (action) => {
|
|
|
|
|
+ if (action === "confirm") {
|
|
|
|
|
+ await handleBind()
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ userInfo.value.wxOpenId = true
|
|
|
|
|
+ }
|
|
|
|
|
+ if (userInfo.value.memberLevel === 'default') {
|
|
|
|
|
+ visible3.value = true
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ });
|
|
|
|
|
+ return
|
|
|
|
|
+ } else if (userInfo.value.memberLevel === 'default') {
|
|
|
|
|
+ visible3.value = true
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+})
|
|
|
function copyUrl() {
|
|
function copyUrl() {
|
|
|
uni.setClipboardData({
|
|
uni.setClipboardData({
|
|
|
data: 'www.xiaoxiongcode.com',
|
|
data: 'www.xiaoxiongcode.com',
|
|
@@ -72,7 +98,46 @@ function copyUrl() {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+const handleBind = async () => {
|
|
|
|
|
+ uni.login({
|
|
|
|
|
+ provider: 'weixin',
|
|
|
|
|
+ success: async (res) => {
|
|
|
|
|
+ await bindWechatOpenId({ code: res.code })
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '授权成功,请重新登录'
|
|
|
|
|
+ })
|
|
|
|
|
+ await user.get()
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+const code = ref<string>('')
|
|
|
|
|
|
|
|
|
|
+async function handleExchange() {
|
|
|
|
|
+ if (!code.value) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '请输入兑换码',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ })
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ try {
|
|
|
|
|
+ await exchangeCode({
|
|
|
|
|
+ exchangeCode: code.value,
|
|
|
|
|
+ subjectId: dict.getValueByLabelMapByType('index_subject_id')['物理'],
|
|
|
|
|
+ })
|
|
|
|
|
+ await user.get()
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '兑换成功',
|
|
|
|
|
+ icon: 'success'
|
|
|
|
|
+ })
|
|
|
|
|
+ visible3.value = false
|
|
|
|
|
+ } catch (err: any) {
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: err.message,
|
|
|
|
|
+ icon: 'error'
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
</script>
|
|
</script>
|
|
|
<template>
|
|
<template>
|
|
|
<cl-page :backTop="false">
|
|
<cl-page :backTop="false">
|
|
@@ -91,7 +156,7 @@ function copyUrl() {
|
|
|
|
|
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
- <cl-float-view :left="20" :bottom="100">
|
|
|
|
|
|
|
+ <cl-float-view :left="20" :bottom="100" v-if="!userInfo.roleCodes?.includes('show_time')">
|
|
|
<view
|
|
<view
|
|
|
class="flex flex-col items-center p-1 px-4 justify-center gap-1 w-[40px] h-[40px] transition-all duration-300"
|
|
class="flex flex-col items-center p-1 px-4 justify-center gap-1 w-[40px] h-[40px] transition-all duration-300"
|
|
|
@tap="visible = true">
|
|
@tap="visible = true">
|
|
@@ -124,7 +189,9 @@ function copyUrl() {
|
|
|
<view class="text-center " v-if="userInfo?.memberLevel !== 'default'">
|
|
<view class="text-center " v-if="userInfo?.memberLevel !== 'default'">
|
|
|
<cl-text class="text-center" color="#999" :size="14">账号:小程序登录手机账号 </cl-text>
|
|
<cl-text class="text-center" color="#999" :size="14">账号:小程序登录手机账号 </cl-text>
|
|
|
<cl-text class="text-center" color="#999" :size="14"> 密码:初始密码为123456 </cl-text>
|
|
<cl-text class="text-center" color="#999" :size="14"> 密码:初始密码为123456 </cl-text>
|
|
|
- <cl-text class="text-center" color="#999" :size="14">少儿编程网址: www.xiaoxiongcode.com </cl-text>
|
|
|
|
|
|
|
+ <cl-text class="text-center" v-if="!userInfo.roleCodes?.includes('show_time')" color="#999"
|
|
|
|
|
+ :size="14">少儿编程网址: www.xiaoxiongcode.com </cl-text>
|
|
|
|
|
+ <cl-text class="text-center" v-else color="#999" :size="14">少儿编程网址: ************* </cl-text>
|
|
|
<cl-button type="primary" size="small" @tap="copyUrl"> 复制网址 </cl-button>
|
|
<cl-button type="primary" size="small" @tap="copyUrl"> 复制网址 </cl-button>
|
|
|
</view>
|
|
</view>
|
|
|
<view class="text-center " v-else>
|
|
<view class="text-center " v-else>
|
|
@@ -132,6 +199,18 @@ function copyUrl() {
|
|
|
</view>
|
|
</view>
|
|
|
</view>
|
|
</view>
|
|
|
</cl-popup>
|
|
</cl-popup>
|
|
|
|
|
+ <cl-popup v-model="visible3" showClose :size="400" :show-header="false" direction="center">
|
|
|
|
|
+ <view class="flex flex-col items-center justify-center gap-4 py-7 bg-slate-50">
|
|
|
|
|
+ <cl-text class="text-center " color="#333" :size="25"> ——激活会员—— </cl-text>
|
|
|
|
|
+
|
|
|
|
|
+ <input
|
|
|
|
|
+ class="w-[200px] h-[40px] bg-[#F5F5F5] border-[1px] border-[#333] border-solid rounded-[20px] px-[10px]"
|
|
|
|
|
+ v-model="code" placeholder="请输入兑换码"></input>
|
|
|
|
|
+
|
|
|
|
|
+ <cl-button class="mt-4" size="large" type="primary" block @tap="handleExchange"> 兑换 </cl-button>
|
|
|
|
|
+
|
|
|
|
|
+ </view>
|
|
|
|
|
+ </cl-popup>
|
|
|
<Physics v-if="selected === 'physics'" />
|
|
<Physics v-if="selected === 'physics'" />
|
|
|
<Chinese v-else-if="selected === 'chinese'" />
|
|
<Chinese v-else-if="selected === 'chinese'" />
|
|
|
<English v-else-if="selected === 'english'" />
|
|
<English v-else-if="selected === 'english'" />
|
|
@@ -158,4 +237,8 @@ function copyUrl() {
|
|
|
-1px 1px 0 #000,
|
|
-1px 1px 0 #000,
|
|
|
1px 1px 0 #000;
|
|
1px 1px 0 #000;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+.check {
|
|
|
|
|
+ background: linear-gradient(0deg, #FBD00E 0%, #FBEC92 100%);
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|