wangguoyu 19 小時之前
父節點
當前提交
adc6ba448b
共有 4 個文件被更改,包括 116 次插入1 次删除
  1. 11 0
      api/my.js
  2. 6 0
      pages.json
  3. 11 1
      pages/my/index.vue
  4. 88 0
      pages/my/sxtkPage.vue

+ 11 - 0
api/my.js

@@ -55,4 +55,15 @@ export function commonCardList(data = {}) {
     data,
     timeout: 20000
   })
+}
+export function selectTiku(data = {}) {
+  return request({
+    'url': '/app/user/my/tiku/type',
+    headers: {
+      isToken: true
+    },
+    method: 'post',
+    data,
+    timeout: 20000
+  })
 }

+ 6 - 0
pages.json

@@ -78,6 +78,12 @@
 			"style": {
 				"navigationStyle": "custom"
 			}
+		},	
+		{
+			"path": "pages/my/sxtkPage",
+			"style": {
+				"navigationStyle": "custom"
+			}
 		},
 		{
 			"path" : "pages/unitTest/index",

+ 11 - 1
pages/my/index.vue

@@ -38,6 +38,10 @@
 			<view class="list-row" @click="cpscClick">
 				<icon class="list-icon cpsc-icon"></icon>
 				<text>产品商城</text>
+			</view>
+			<view v-if="loginFlag" class="list-row" @click="sxtkClick">
+				<icon class="list-icon cpsc-icon"></icon>
+				<text>数学题库</text>
 			</view>
 			<view v-if="appleCode=='true'&&currentPlatform=='ios'" class="list-row" @click="duihuamaDuihuan">
 				<icon class="list-icon duihuanma-icon"></icon>
@@ -269,7 +273,13 @@
 			});
 		}
 	}
-
+
+
+	function sxtkClick(){
+		uni.redirectTo({
+			url: '/pages/my/sxtkPage'
+		});
+	}
 	// 产品商城
 	function cpscClick() {
 

+ 88 - 0
pages/my/sxtkPage.vue

@@ -0,0 +1,88 @@
+
+<template>
+	<view>
+		<view class="icon-title-navBar-box">
+			<view class="nav-bar-icon" @click="handleBack"></view>
+		</view>
+		<view style="display: flex;justify-content: space-around">
+			<view v-for="(item,index) in jiaocaiData" :key="index">
+				<view @click="selectNianji(item,index)"
+				:class="{'active': currentIndex === index}"
+				>{{item.nianji}}</view>
+			</view>
+		</view>
+		<view>
+			<view v-for="(item,index) in currentBanbenList" :key="index"
+				:class="{'active': currentBanbenIndex === index}"
+					@click="selectBanben(index)"
+			>
+				{{item}}
+			</view>
+		</view>
+		<view class="grade-line"></view>
+		<button class="grade-confirm-btn" @click="handleConfirm"></button>
+	</view>
+</template>
+
+<script setup>
+	import { onLoad } from '@dcloudio/uni-app';
+	import { selectTiku } from '@/api/my.js'
+	import { ref } from "vue";
+	
+	let jiaocaiData = ref(null)
+	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
+	}
+		function selectBanben(index) {
+			currentBanbenIndex.value = index
+		}
+	function handleBack() {
+		uni.redirectTo({
+			url: '/pages/my/index'
+		});
+	}
+	
+	function handleConfirm(){
+		// 确认逻辑
+	}
+	
+	function getInfo(){
+		selectTiku({}).then(res=>{
+			jiaocaiData.value = [
+				{
+					"nianji": "L1",
+					"banbenList": ["人教版"]
+				},
+				{
+					"nianji": "L2",
+					"banbenList": ["人教版222","人教版222333"]
+				}
+			]
+			//jiaocaiData.value = res.data
+			// 默认显示第一个年级的版本列表
+			if(jiaocaiData.value && jiaocaiData.value.length > 0){
+				currentBanbenList.value = jiaocaiData.value[0].banbenList
+			}
+		})
+	}
+	
+	onLoad((options) => {
+		if(options.nianjiIndex && options.banbenIndex){
+					currentIndex.value = Number(options.nianjiIndex)
+					currentBanbenIndex.value = Number(options.banbenIndex)
+				}
+		getInfo()
+	})
+</script>
+
+<style>
+.active {
+	background-color: #42b983;
+	color: #fff;
+}
+</style>