wangguoyu před 2 měsíci
rodič
revize
a3d8842267
3 změnil soubory, kde provedl 298 přidání a 0 odebrání
  1. 10 0
      pages.json
  2. 18 0
      pages/my/index.vue
  3. 270 0
      pages/my/xuexishichang.vue

+ 10 - 0
pages.json

@@ -89,6 +89,16 @@
 			"style": {
 				"navigationStyle": "custom"
 			}
+		},{
+			"path": "pages/my/xuexishichang",
+			"style": {
+				"navigationStyle": "custom"
+			}
+		},{
+			"path": "pages/my/yingyongshezhi",
+			"style": {
+				"navigationStyle": "custom"
+			}
 		},
 		{
 			"path": "pages/unitTest/index",

+ 18 - 0
pages/my/index.vue

@@ -46,6 +46,10 @@
 			<view v-if="loginFlag" class="list-row" @click="xxjlClick">
 				<icon class="list-icon sxtk-icon"></icon>
 				<text>学习记录</text>
+			</view>	
+			<view v-if="loginFlag" class="list-row" @click="xxscClick">
+				<icon class="list-icon sxtk-icon"></icon>
+				<text>学习时长</text>
 			</view>
 			<view v-if="appleCode=='true'&&currentPlatform=='ios'" class="list-row" @click="duihuamaDuihuan">
 				<icon class="list-icon duihuanma-icon"></icon>
@@ -71,6 +75,10 @@
 				<icon class="list-icon login-out-icon"></icon>
 				<text>退出登录</text>
 			</view>
+			<view class="list-row" @click="yingyongshezhi">
+				<icon class="list-icon login-out-icon"></icon>
+				<text>应用设置</text>
+			</view>
 		</view>
 		<CustomTabBar :levelId="levelId" :currentTabNumber="3" :typeId="typeId" :subjectId="subjectId"
 			:tipFlag="tipFlag">
@@ -259,6 +267,11 @@
 		uni.redirectTo({
 			url: '/pages/login/index'
 		});
+	}
+	function yingyongshezhi() {
+		uni.redirectTo({
+			url: '/pages/my/yingyongshezhi'
+		});
 	}
 
 	// 手机号码
@@ -306,6 +319,11 @@
 		uni.redirectTo({
 			url: '/pages/my/xuexiJilu'
 		});
+	}
+	function xxscClick() {
+		uni.redirectTo({
+			url: '/pages/my/xuexishichang'
+		});
 	}
 	// 产品商城
 	function cpscClick() {

+ 270 - 0
pages/my/xuexishichang.vue

@@ -0,0 +1,270 @@
+<template>
+	<view class="ezy-cuoti-page">
+		<view class="icon-title-navBar-box">
+			<view @click="handleBack" class="nav-bar-icon"></view>
+			<text class="nav-bar-title">关于我们</text>
+		</view>
+		<text>学习时长</text>
+		<CustomTabBar></CustomTabBar>
+	</view>
+</template>
+
+<script setup>
+	import {
+		reactive,
+		ref
+	} from "vue";
+	import {
+		getWrongData
+	} from "@/api/wrong";
+	import {
+		onLoad
+	} from "@dcloudio/uni-app";
+	import cuoti from "@/components/chengji/chengji.vue";
+	import {
+		getWrongInfo
+	} from "@/api/wrong";
+	import CustomTabBar from '@/components/custom-tabbar/custom-tabbar.vue';
+
+	const zhangId = ref(null);
+	const nianji = ref(null);
+	const subjectId = ref(null);
+
+	const wrongRef = ref(null);
+
+	const data = reactive({
+		items: ['数学', '英语'],
+		current: 0,
+		shuxue: {
+			page: 0,
+			list: [],
+			loading: false,
+			state: 'more',
+			contentText: {
+				contentdown: '查看更多',
+				contentrefresh: '加载中',
+				contentnomore: '没有更多'
+			}
+
+		},
+		yingyu: {
+			page: 0,
+			list: [],
+			loading: false,
+			state: 'more',
+			contentText: {
+				contentdown: '查看更多',
+				contentrefresh: '加载中',
+				contentnomore: '没有更多'
+			}
+		},
+		wrongList: [],
+	})
+	subjectId.value = data.current+1;
+	function handleBack() {
+		uni.redirectTo({
+			url: '/pages/my/index'
+		})
+	}
+
+	function handleBackFromCuoti() {
+		wrongRef.value.closePopup();
+		uni.$emit('back-outpage')
+	}
+
+	function onChangeTab(e) {
+		if (data.current !== e.currentIndex) {
+			data.current = e.currentIndex;
+			subjectId.value = data.current+1;
+			if (data.current == 0) {
+				data.shuxue.page = 0
+			} else if (data.current == 1) {
+				data.yingyu.page = 0
+			}
+			refreshData(data.current);
+		}
+	}
+
+	function refreshData(code) {
+		const opt = {
+			page: 1,
+			size: 10, // 固定查询10条
+			subjectId: data.current + 1 // 前台索引加1为学科cardId
+		}
+
+		if (code == 0) {
+			data.shuxue.list = [];
+			// 数学
+			data.shuxue.state = 'loading';
+			data.shuxue.page++;
+			opt.page = data.shuxue.page;
+		} else if (code == 1) {
+			data.yingyu.list = [];
+			// 英语
+			data.yingyu.state = 'loading';
+			data.yingyu.page++;
+			opt.page = data.yingyu.page;
+		}
+		getWrongData(opt).then(res => {
+			if (code == 0) {
+				data.shuxue.list = data.shuxue.list.concat(res.data.data);
+				data.shuxue.loading = false;
+			} else if (code == 1) {
+				data.yingyu.list = data.yingyu.list.concat(res.data.data);
+				data.yingyu.loading = false;
+			}
+			if (code == 0) {
+				if (res.data.total > data.shuxue.list.length) {
+					// 数学
+					data.shuxue.state = 'more';
+					data.shuxue.loading = false;
+				} else {
+					// 数学
+					data.shuxue.state = 'no-more';
+					data.shuxue.loading = false;
+				
+				}
+			} else if (code == 1) {
+				if (res.data.total > data.yingyu.list.length) {
+					// 英语
+					data.yingyu.state = 'more';
+					data.yingyu.loading = false;
+				} else {
+					// 英语
+					data.yingyu.state = 'no-more';
+					data.yingyu.loading = false;
+				}
+			}
+		}).catch(err => {
+			if (code == 0) {
+				// 数学
+				data.shuxue.state = 'more';
+				data.shuxue.loading = false;
+			} else if (code == 1) {
+				// 英语
+				data.yingyu.state = 'more';
+				data.yingyu.loading = false;
+			}
+		})
+	}
+
+	function getMore(code) {
+		const opt = {
+			page: 1,
+			size: 10, // 固定查询10条
+			subjectId: data.current + 1 // 前台索引加1为学科cardId
+		}
+
+		if (code == 0) {
+			if (data.shuxue.state == 'no-more') return;
+			// 数学
+			data.shuxue.state = 'loading';
+			data.shuxue.page++;
+			opt.page = data.shuxue.page;
+		} else if (code == 1) {
+			// 英语
+			if (data.yingyu.state == 'no-more') return;
+			data.yingyu.state = 'loading';
+			data.yingyu.page++;
+			opt.page = data.yingyu.page;
+		}
+		getWrongData(opt).then(res => {
+			if (code == 0) {
+				data.shuxue.list = data.shuxue.list.concat(res.data.data);
+				data.shuxue.loading = false;
+			} else if (code == 1) {
+				data.yingyu.list = data.yingyu.list.concat(res.data.data);
+				data.yingyu.loading = false;
+			}
+			if (code == 0) {
+				if (res.data.total > data.shuxue.list.length) {
+					// 数学
+					data.shuxue.state = 'more';
+					data.shuxue.state_text = '加载更多';
+					data.shuxue.loading = false;
+				} else {
+					// 数学
+					data.shuxue.state = 'no-more';
+					data.shuxue.state_text = '没有更多啦';
+				
+					data.shuxue.loading = false;
+				}
+			} else if (code == 1) {
+				if (res.data.total > data.yingyu.list.length) {
+					// 英语
+					data.yingyu.state = 'more';
+					data.yingyu.state_text = '加载更多';
+					data.yingyu.loading = false;
+				} else {
+					// 英语
+					data.yingyu.state = 'no-more';
+					data.yingyu.state_text = '没有更多啦';
+			
+					data.yingyu.loading = false;
+				}
+			}
+		}).catch(err => {
+			if (code == 0) {
+				// 数学
+				data.shuxue.state = 'more';
+				data.shuxue.state_text = '加载更多';
+				data.shuxue.loading = false;
+			} else if (code == 1) {
+				// 英语
+				data.yingyu.state = 'more';
+				data.yingyu.state_text = '加载更多';
+				data.yingyu.loading = false;
+			}
+		})
+	}
+
+	function formatListToUse(list) {
+		list.forEach((item, index) => {
+			item.mta_show = false;
+			if (item.type == 3) {
+				item.result = JSON.parse(item.result);
+				item.placeholders = item.result.map((item, cindex) => `[bank${cindex+1}]`)
+				item.reply = item.reply ? JSON.parse(item.reply) : item.result.map(() => '');
+			}
+
+      if (item.type == 4) {
+        // 特殊题型英语题
+        const audioList = item.audios ? item.audios.split(',') : [];
+        item.placeholders = audioList.map((item, cindex) => `[yingyu${cindex+1}]`)
+        item.audioList = audioList;
+      }
+		})
+	}
+
+	function getCuotiData(item) {
+		getWrongInfo({
+			subjectId: data.current + 1,
+			cdate: item.cdate
+		}).then(res => {
+			formatListToUse(res.data)
+			data.wrongList = res.data;
+			wrongRef.value.showPopup();
+		})
+	}
+
+	function onRefresh() {
+		if (data.current == 0) {
+			data.shuxue.page = 0;
+			data.shuxue.list = [];
+			data.shuxue.loading = true;
+		} else if (data.current == 1) {
+			data.yingyu.page = 0;
+			data.yingyu.list = [];
+			data.yingyu.loading = true;
+		}
+		refreshData(data.current);
+	}
+
+	onLoad(() => {
+		getMore(data.current);
+	})
+</script>
+
+<style>
+
+</style>