|
@@ -1,4 +1,3 @@
|
|
-
|
|
|
|
<template>
|
|
<template>
|
|
<view>
|
|
<view>
|
|
<view class="icon-title-navBar-box">
|
|
<view class="icon-title-navBar-box">
|
|
@@ -6,83 +5,124 @@
|
|
</view>
|
|
</view>
|
|
<view style="display: flex;justify-content: space-around">
|
|
<view style="display: flex;justify-content: space-around">
|
|
<view v-for="(item,index) in jiaocaiData" :key="index">
|
|
<view v-for="(item,index) in jiaocaiData" :key="index">
|
|
- <view @click="selectNianji(item,index)"
|
|
|
|
- :class="{'active': currentIndex === index}"
|
|
|
|
- >{{item.nianji}}</view>
|
|
|
|
|
|
+ <view @click="selectNianji(item,index)" :class="{'active': currentNianjiName == item.nianji}">
|
|
|
|
+ {{item.nianji}}
|
|
|
|
+ </view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view>
|
|
<view>
|
|
- <view v-for="(item,index) in currentBanbenList" :key="index"
|
|
|
|
- :class="{'active': currentBanbenIndex === index}"
|
|
|
|
- @click="selectBanben(index)"
|
|
|
|
- >
|
|
|
|
|
|
+ <view v-for="(item,index) in currentBanbenList" :key="index" :class="{'active': banbenName == item}"
|
|
|
|
+ @click="selectBanben(item,index)">
|
|
{{item}}
|
|
{{item}}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="grade-line"></view>
|
|
<view class="grade-line"></view>
|
|
- <button class="grade-confirm-btn" @click="handleConfirm"></button>
|
|
|
|
|
|
+ <button class="grade-confirm-btn" @click="handleConfirm">确认</button>
|
|
|
|
+ <banbenConfirmDialog ref="jiaocaiRef" @confirm-btn="jcConfirm" :content="jcContent"></banbenConfirmDialog>
|
|
|
|
+ <CustomTabBar ></CustomTabBar>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
- import { onLoad } from '@dcloudio/uni-app';
|
|
|
|
- import { selectTiku } from '@/api/my.js'
|
|
|
|
- import { ref } from "vue";
|
|
|
|
-
|
|
|
|
|
|
+ import {
|
|
|
|
+ onLoad
|
|
|
|
+ } from '@dcloudio/uni-app';
|
|
|
|
+ import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
|
|
|
|
+ import {
|
|
|
|
+ selectTiku
|
|
|
|
+ } from '@/api/my.js'
|
|
|
|
+ import {
|
|
|
|
+ toast,
|
|
|
|
+ getUserIdentity
|
|
|
|
+ } from "@/utils/common";
|
|
|
|
+ import {
|
|
|
|
+ ref
|
|
|
|
+ } from "vue";
|
|
|
|
+ import banbenConfirmDialog from './banbenConfirmDialog.vue';
|
|
let jiaocaiData = ref(null)
|
|
let jiaocaiData = ref(null)
|
|
let currentBanbenList = ref([])
|
|
let currentBanbenList = ref([])
|
|
- let currentIndex = ref(0)
|
|
|
|
- let currentBanbenIndex = ref(0)
|
|
|
|
- function selectNianji(item,index){
|
|
|
|
- currentIndex.value = index
|
|
|
|
- currentBanbenList.value = item.banbenList
|
|
|
|
- currentBanbenIndex.value = 0
|
|
|
|
|
|
+
|
|
|
|
+ let currentNianjiName = ref(null)
|
|
|
|
+ let currentBanbenIndex = ref(null)
|
|
|
|
+ const banbenName = ref(null)
|
|
|
|
+ const jiaocaiRef = ref(null);
|
|
|
|
+ const jcContent = ref(null);
|
|
|
|
+
|
|
|
|
+ function selectNianji(item, index) {
|
|
|
|
+ currentNianjiName.value = item.nianji
|
|
|
|
+
|
|
|
|
+ currentBanbenList.value = item.banbenList
|
|
|
|
+ banbenName.value = ''
|
|
|
|
+
|
|
}
|
|
}
|
|
- function selectBanben(index) {
|
|
|
|
- currentBanbenIndex.value = index
|
|
|
|
|
|
+
|
|
|
|
+ function jcConfirm() {
|
|
|
|
+ uni.navigateTo({
|
|
|
|
+ url: '/pages/pdfPage/pdfPage?banben=' + banbenName.value + '&nianji=' + currentNianjiName.value
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function selectBanben(item, index) {
|
|
|
|
+
|
|
|
|
+ console.log('item', item);
|
|
|
|
+ if (!currentNianjiName.value) {
|
|
|
|
+ toast("请选择年级")
|
|
|
|
+ return false
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ banbenName.value = item
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
function handleBack() {
|
|
function handleBack() {
|
|
uni.redirectTo({
|
|
uni.redirectTo({
|
|
url: '/pages/my/index'
|
|
url: '/pages/my/index'
|
|
});
|
|
});
|
|
}
|
|
}
|
|
-
|
|
|
|
- function handleConfirm(){
|
|
|
|
|
|
+
|
|
|
|
+ function handleConfirm() {
|
|
// 确认逻辑
|
|
// 确认逻辑
|
|
|
|
+ if (banbenName.value && currentNianjiName.value) {
|
|
|
|
+ jcContent.value = "用户你好,鹅状元将为您随机生成《" + banbenName.value + "》100道试题."
|
|
|
|
+ console.log('jcContent.value', jcContent.value);
|
|
|
|
+ jiaocaiRef.value.handleShow();
|
|
|
|
+ } else {
|
|
|
|
+ toast("请选择年级和对应的教学版本")
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
- function getInfo(){
|
|
|
|
- selectTiku({}).then(res=>{
|
|
|
|
- jiaocaiData.value = [
|
|
|
|
- {
|
|
|
|
|
|
+
|
|
|
|
+ function getInfo() {
|
|
|
|
+ selectTiku({}).then(res => {
|
|
|
|
+ jiaocaiData.value = [{
|
|
"nianji": "L1",
|
|
"nianji": "L1",
|
|
"banbenList": ["人教版"]
|
|
"banbenList": ["人教版"]
|
|
},
|
|
},
|
|
{
|
|
{
|
|
"nianji": "L2",
|
|
"nianji": "L2",
|
|
- "banbenList": ["人教版222","人教版222333"]
|
|
|
|
|
|
+ "banbenList": ["人教版222", "人教版222333"]
|
|
}
|
|
}
|
|
]
|
|
]
|
|
//jiaocaiData.value = res.data
|
|
//jiaocaiData.value = res.data
|
|
// 默认显示第一个年级的版本列表
|
|
// 默认显示第一个年级的版本列表
|
|
- if(jiaocaiData.value && jiaocaiData.value.length > 0){
|
|
|
|
|
|
+ if (jiaocaiData.value && jiaocaiData.value.length > 0) {
|
|
currentBanbenList.value = jiaocaiData.value[0].banbenList
|
|
currentBanbenList.value = jiaocaiData.value[0].banbenList
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
onLoad((options) => {
|
|
onLoad((options) => {
|
|
- if(options.nianjiIndex && options.banbenIndex){
|
|
|
|
- currentIndex.value = Number(options.nianjiIndex)
|
|
|
|
- currentBanbenIndex.value = Number(options.banbenIndex)
|
|
|
|
- }
|
|
|
|
|
|
+ if (options.banben && options.nianji) {
|
|
|
|
+ currentNianjiName.value = options.nianji
|
|
|
|
+ banbenName.value = options.banben
|
|
|
|
+ }
|
|
getInfo()
|
|
getInfo()
|
|
})
|
|
})
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style>
|
|
<style>
|
|
-.active {
|
|
|
|
- background-color: #42b983;
|
|
|
|
- color: #fff;
|
|
|
|
-}
|
|
|
|
-</style>
|
|
|
|
|
|
+ .active {
|
|
|
|
+ background-color: #42b983;
|
|
|
|
+ color: #fff;
|
|
|
|
+ }
|
|
|
|
+</style>
|