Procházet zdrojové kódy

Merge branch 'main' of https://gogs.mtavip.com/wangguoyu/uniProject into main

tanxue před 1 měsícem
rodič
revize
e986efb237

+ 24 - 0
api/chengji.js

@@ -0,0 +1,24 @@
+import request from '@/utils/request'
+export function getKaoshichengjiList(data = {}) {
+	return request({
+		'url': '/app/chengji/list',
+		headers: {
+			isToken: true
+		},
+		method: 'post',
+		data,
+		timeout: 20000
+	})
+}
+
+export function getKcchengjiList(data = {}) {
+	return request({
+		'url': '/app/kecheng/chengji/list',
+		headers: {
+			isToken: true
+		},
+		method: 'post',
+		data,
+		timeout: 20000
+	})
+}

+ 226 - 0
components/custom-scroll-list/custom-scroll-list-chengji.vue

@@ -0,0 +1,226 @@
+<template>
+	<!-- 查询区域 -->
+	<uni-search-bar class="uni-mt-10" v-model="name" radius="100" v-if="hasSearcBar" :placeholder="placeholder"
+		:bgColor="searchBarColor" clearButton="auto" cancelButton="none" @confirm="onSearch" @blur="onSearch" />
+	<!-- tab选择区域 -->
+	<view class="lli-status-box" v-if="hasTab">
+		<text :class="['status-item', activeTab === item.value? 'click':'' ]" v-for="item in tabList" :key="item.value"
+			@click="onTavChange(item)">{{item.label}}</text>
+	</view>
+	<!-- 无限滚动区域 -->
+	<scroll-view class="scroll-container" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="triggered"
+		:refresher-threshold="100" refresher-background="#F3F3F4" @refresherrefresh="onRefresh"
+		@scrolltolower="onReachBottom" @refresherrestore="onRestore">
+		<slot :list="list"></slot>
+		<uni-load-more :status="status" :contentText="contentText"></uni-load-more>
+
+		<!-- 		<view style="width: 100%;text-align: center;font-size: 14px;color:#ccc;" key="a333" v-if="isComplete">没有更多啦~
+		</view> -->
+	</scroll-view>
+</template>
+
+<script setup>
+	import {
+		ref,
+		watch,
+		onMounted,
+		computed,
+	} from "vue";
+
+	import {
+		onLoad
+	} from "@dcloudio/uni-app"
+
+	const props = defineProps({
+		refreshFn: {
+			type: Function,
+			required: true
+		},
+		tabData: {
+			type: Object
+		},
+		size: {
+			type: Number,
+			default: 5
+		},
+		hasSearcBar: {
+			type: Boolean,
+			default: true,
+		},
+		searchBarKey: {
+			type: String,
+			default: 'name'
+		},
+		hasTab: {
+			type: Boolean,
+			default: true,
+		},
+		defaultTab: {
+			type: [String, Number]
+		},
+		tabList: {
+			type: Array,
+			default: () => [],
+		},
+		tabKey: {
+			type: String,
+			default: 'status'
+		},
+		placeholder: {
+			type: String,
+			default: '请输入考试名称'
+		},
+		searchBarColor: {
+			type: String,
+			default: "#F3F3F4"
+		},
+		tabData: {
+			type: Object,
+		}
+
+	})
+
+	const Emits = defineEmits(['tabChange']);
+	const page = ref(1);
+	const list = ref([]); // 项目列表
+	const triggered = ref(false); // 是否触发下拉刷新
+	const freshing = ref(false); // 是否加载中
+	const total = ref(0); // 项目总数
+	const name = ref(''); // 查询名
+	const activeTab = ref(props.defaultTab);
+
+	const status = ref('more');
+	const contentText = {
+		contentdown: '查看更多',
+		contentrefresh: '加载中',
+		contentnomore: '没有更多'
+	}
+	const currentRefreshFn = ref(props.refreshFn);
+	watch(
+	  () => props.refreshFn,
+	  (newFn) => {
+	    currentRefreshFn.value = newFn;
+	    reset();
+	    getData("do-search");
+	  }
+	);
+	/**
+	 * 是否已完全加载
+	 */
+	const isComplete = computed(() => {
+		if (total.value === 0) {
+			return false;
+		}
+
+		return total.value === list.value.length
+	})
+
+	// 重置
+	function reset() {
+		list.value = [];
+		page.value = 1;
+		triggered.value = false;
+		freshing.value = false;
+		total.value = 0;
+		status.value = 'more';
+	}
+
+	// 切换tab
+	function onTavChange(item) {
+		activeTab.value = item.value;
+		name.value = "";
+		reset();
+		Emits('tabChange', item)
+	//	getData("do-search");
+	}
+	function tabChangeSearch(item){
+		activeTab.value = item.value;
+		name.value = "";
+		props.refreshFn = item.refreshFn
+		reset();
+		getData("do-search");
+	}
+	// 查询
+	function onSearch({
+		value
+	}) {
+		name.value = value;
+		reset();
+		getData("do-search");
+	}
+
+	// 获取数据
+	function getData(action) {
+		const options = Object.assign({}, {
+			page: page.value,
+			size: props.size,
+		});
+
+		if (props.hasTab) {
+			options[props.tabKey] = activeTab.value;
+		}
+
+		if (props.hasSearcBar) {
+			options[props.searchBarKey] = name.value;
+		}
+		currentRefreshFn.value(options).then(res => {
+			total.value = res.data.total;
+			action === "do-search" && (list.value = res.data.data); // 查询更新
+			action === "pull-down-refresh" && (list.value = res.data.data); // 下拉更新数据
+			action === "reach-buttom" && (list.value = [...list.value, ...res.data.data]); // 无限滚动更新数据
+
+
+
+		}).finally(() => {
+			triggered.value = false;
+			freshing.value = false;
+			if (total.value !== list.value.length) {
+				status.value = 'more';
+			} else {
+				status.value = 'noMore';
+			}
+		})
+	}
+
+	onLoad(() => {
+		freshing.value = false;
+		setTimeout(() => {
+			triggered.value = true
+		}, 50)
+	})
+
+	// 下拉刷新触发
+	function onRefresh() {
+		if (freshing.value) return;
+		status.value = 'loading';
+		freshing.value = true;
+		triggered.value = true;
+		page.value = 1;
+		getData('pull-down-refresh');
+	}
+	// 下拉刷新复位
+	function onRestore() {
+		triggered.value = 'restore'; // 需要重置
+	}
+
+	// 无限滚动
+	function onReachBottom() {
+		if (freshing.value) return;
+		if (isComplete.value) return;
+		freshing.value = true;
+		page.value++;
+		getData('reach-buttom')
+	}
+
+	
+	defineExpose({
+		onRefresh,
+		tabChangeSearch
+	})
+</script>
+
+<style lang="scss">
+	.scroll-container {
+		height: calc(100vh - 220rpx)
+	}
+</style>

+ 92 - 0
components/scroll-list-card-chengji/scroll-list-card-chengji.vue

@@ -0,0 +1,92 @@
+<template>
+	<view class="scroll-list-card mobile-card-box">
+		<view>
+			<img style="width: 100rpx;height: 100rpx;;" :src="data.pic" alt="" />
+		</view>
+		<text>{{data.ksName}}</text>
+		<view class="timeSpan">总分:{{data.ksScore === null ? '': data.ksScore}}</view>
+		<view class="timeSpan">得分:{{data.userScore === null ? '' : data.userScore}}</view>
+		<view class="timeSpan">及格分:{{data.okScore=== null ? '': data.okScore}}</view>
+		<view class="timeSpan">时间:{{data.answerStartTime === null ? '': data.answerStartTime}}</view>
+	</view>
+</template>
+
+<script setup>
+	import {
+		toRefs,
+		ref,
+		computed
+	} from "vue";
+
+	const props = defineProps({
+		data: {
+			type: Object,
+		},
+	});
+	const {
+		data
+	} = toRefs(props);
+</script>
+
+<style lang="scss" scoped>
+	.mobile-card-box {
+		box-sizing: border-box;
+		margin: 0 30rpx 10rpx;
+		border-bottom: 2rpx solid #f2f1f2;
+		padding-bottom: 30rpx;
+	}
+
+	.mobile-card-title {
+		color: #333;
+		font-size: 32rpx;
+		font-weight: 500;
+		margin: 24rpx 0 24rpx 0;
+		text-overflow: ellipsis;
+		-o-text-overflow: ellipsis;
+		overflow: hidden;
+		word-wrap: break-word;
+		display: -webkit-box;
+		white-space: normal;
+		-webkit-box-orient: vertical;
+		text-align: justify;
+		-webkit-line-clamp: 2;
+		line-clamp: 2;
+		line-height: 48rpx;
+	}
+
+	// 行
+	.mobile-card-row {
+		margin-bottom: 32rpx;
+		display: flex;
+		justify-content: space-between;
+		align-items: flex-end;
+
+		text {
+			font-size: 28rpx;
+			line-height: 40rpx;
+		}
+
+		// 得分
+		.mobile-card-score {
+			font-size: 40rpx;
+			color: #f10a0a;
+		}
+
+		// 分数(有最小宽度)
+		.card-score-box {
+			min-width: 240rpx;
+			text-align: left;
+		}
+	}
+
+	// 按钮
+	.mobile-card-btn {
+		width: 60%;
+		height: 80rpx;
+		line-height: 80rpx;
+		margin: 50rpx auto;
+		background: linear-gradient(0deg, #436aff 0%, #234ff7 100%);
+		border-radius: 80rpx;
+		display: block;
+	}
+</style>

+ 90 - 0
components/scroll-list-card-kechengji/scroll-list-card-kechengji.vue

@@ -0,0 +1,90 @@
+<template>
+	<view class="scroll-list-card mobile-card-box">
+		<view>
+			<img style="width: 100rpx;height: 100rpx;;" :src="data.pic" alt="" />
+		</view>
+		<text>{{data.kcName === null ? '':data.kcName}}</text>
+		<view class="timeSpan">时间:{{data.answerStartTime === null ? '': data.answerStartTime}}</view>
+		<view class="timeSpan">总分:{{data.ksScore === null ? '': data.ksScore}}</view>
+	</view>
+</template>
+
+<script setup>
+	import {
+		toRefs,
+		ref,
+		computed
+	} from "vue";
+
+	const props = defineProps({
+		data: {
+			type: Object,
+		},
+	});
+	const {
+		data
+	} = toRefs(props);
+</script>
+
+<style lang="scss" scoped>
+	.mobile-card-box {
+		box-sizing: border-box;
+		margin: 0 30rpx 10rpx;
+		border-bottom: 2rpx solid #f2f1f2;
+		padding-bottom: 30rpx;
+	}
+
+	.mobile-card-title {
+		color: #333;
+		font-size: 32rpx;
+		font-weight: 500;
+		margin: 24rpx 0 24rpx 0;
+		text-overflow: ellipsis;
+		-o-text-overflow: ellipsis;
+		overflow: hidden;
+		word-wrap: break-word;
+		display: -webkit-box;
+		white-space: normal;
+		-webkit-box-orient: vertical;
+		text-align: justify;
+		-webkit-line-clamp: 2;
+		line-clamp: 2;
+		line-height: 48rpx;
+	}
+
+	// 行
+	.mobile-card-row {
+		margin-bottom: 32rpx;
+		display: flex;
+		justify-content: space-between;
+		align-items: flex-end;
+
+		text {
+			font-size: 28rpx;
+			line-height: 40rpx;
+		}
+
+		// 得分
+		.mobile-card-score {
+			font-size: 40rpx;
+			color: #f10a0a;
+		}
+
+		// 分数(有最小宽度)
+		.card-score-box {
+			min-width: 240rpx;
+			text-align: left;
+		}
+	}
+
+	// 按钮
+	.mobile-card-btn {
+		width: 60%;
+		height: 80rpx;
+		line-height: 80rpx;
+		margin: 50rpx auto;
+		background: linear-gradient(0deg, #436aff 0%, #234ff7 100%);
+		border-radius: 80rpx;
+		display: block;
+	}
+</style>

+ 60 - 22
pages/score/index.vue

@@ -1,22 +1,60 @@
-<template>
-	<view class="lli-develop-expect-page">
-		开发中,敬请期侍!
-	</view>
-</template>
-
-<script>
-	export default {
-		data() {
-			return {
-				
-			}
-		},
-		methods: {
-			
-		}
-	}
-</script>
-
-<style>
-
-</style>
+<template>
+	<custom-scroll-list-chengji ref="customChengjiRef" :refreshFn="currentRefreshFn" @tabChange="tabChange"
+		:searchBarKey="searchBarKeyName" :tabList="tabData" :defaultTab="1">
+		<template #default="{list}">
+			<scroll-list-card-chengji v-show="currentTab =='1'" @click="kechengClick(item)" v-for="(item,index) in list"
+				:key="item.ksId" :data="item"></scroll-list-card-chengji>
+			<scroll-list-card-kechengji v-show="currentTab =='2'" @click="kechengClick(item)"
+				v-for="(item,index) in list" :key="item.ksId" :data="item"></scroll-list-card-kechengji>
+		</template>
+	</custom-scroll-list-chengji>
+</template>
+
+<script setup>
+	import {
+		getKaoshichengjiList,
+		getKcchengjiList
+	} from "@/api/chengji.js";
+	import customScrollListChengji from "@/components/custom-scroll-list/custom-scroll-list-chengji.vue";
+	import {
+		onLoad,
+		onReady,
+
+	} from "@dcloudio/uni-app"
+	import {
+		reactive,
+		ref,
+		computed
+	} from "vue";
+	let currentTab = ref('1')
+	let searchBarKeyName = ref('ksName')
+	let customChengjiRef = ref(null)
+	const tabData = [{
+		label: "考试成绩",
+		value: 1,
+	}, {
+		label: "课程成绩",
+		value: 2
+	}]
+const currentRefreshFn = computed(() => 
+  currentTab.value == '1' ? getKaoshichengjiList : getKcchengjiList
+)
+	function tabChange(data) {
+		currentTab.value = data.value
+		if (currentTab.value == 1) {
+			searchBarKeyName.value = 'ksName'
+		} else {
+			searchBarKeyName.value = 'kcName'
+		}
+	//	customChengjiRef.value.tabChangeSearch(data)
+	}
+	const kechengClick = (data) => {
+		uni.navigateTo({
+			url: '/pages/course/kechengInfo?kcId=' + data.kcId + '&name=' + data.name
+		});
+	}
+</script>
+
+<style lang="scss">
+
+</style>

+ 11 - 11
unpackage/dist/cache/.vite/deps/_metadata.json

@@ -1,25 +1,25 @@
 {
-  "hash": "dbe0ab36",
+  "hash": "d5dc56da",
   "configHash": "5978ec27",
-  "lockfileHash": "e3b0c442",
-  "browserHash": "3f38b205",
+  "lockfileHash": "1a6e42c4",
+  "browserHash": "18e26302",
   "optimized": {
+    "crypto-js": {
+      "src": "../../../../../node_modules/crypto-js/index.js",
+      "file": "crypto-js.js",
+      "fileHash": "b3825758",
+      "needsInterop": true
+    },
     "jsencrypt": {
       "src": "../../../../../node_modules/jsencrypt/lib/index.js",
       "file": "jsencrypt.js",
-      "fileHash": "509f5046",
+      "fileHash": "9a788be8",
       "needsInterop": false
     },
     "ts-md5/dist/md5": {
       "src": "../../../../../node_modules/ts-md5/dist/md5.js",
       "file": "ts-md5_dist_md5.js",
-      "fileHash": "52805b5f",
-      "needsInterop": true
-    },
-    "crypto-js": {
-      "src": "../../../../../node_modules/crypto-js/index.js",
-      "file": "crypto-js.js",
-      "fileHash": "0b2d2147",
+      "fileHash": "e451a9a4",
       "needsInterop": true
     }
   },