tanxue 8 часов назад
Родитель
Сommit
1fe0cbf017

Разница между файлами не показана из-за своего большого размера
+ 0 - 1001
common/styles/global/pages.scss


+ 1 - 8
pages.json

@@ -27,13 +27,6 @@
 			}
 			}
 		},
 		},
 		{
 		{
-			"path" : "pages/chanpinZiliao/index",
-			"style" : 
-			{
-				"navigationStyle": "custom"
-			}
-		},
-		{
 			"path" : "pages/chanpinZiliao/ziliaoInfo",
 			"path" : "pages/chanpinZiliao/ziliaoInfo",
 			"style" : 
 			"style" : 
 			{
 			{
@@ -41,7 +34,7 @@
 			}
 			}
 		},
 		},
 		{
 		{
-			"path": "pages/game/index",
+			"path": "pages/chanpinZiliao/index",
 			"style": {
 			"style": {
 				"navigationStyle": "custom",
 				"navigationStyle": "custom",
 				"app-plus": {
 				"app-plus": {

+ 0 - 40
pages/game/components/constantConfig.js

@@ -1,40 +0,0 @@
-// 食物种类列表
-export const foodSpeciesList = [{
-		id: 100,
-		imgUrl: '/static/images/game/food-img1.png',
-		credit: 30
-	},
-	{
-		id: 300,
-		imgUrl: '/static/images/game/food-img2.png',
-		credit: 100
-	},
-	{
-		id: 600,
-		imgUrl: '/static/images/game/food-img3.png',
-		credit: 300
-	}
-]
-
-// 大鹅成长阶段
-export const gooseGrowthTypeList = [{
-		id: 0,
-		imgUrl: '/static/images/game/game-img1.gif',
-		range: [0,1000]
-	},
-	{
-		id: 1,
-		imgUrl: '/static/images/game/game-img2.gif',
-		range: [1000,3000]
-	},
-	{
-		id: 2,
-		imgUrl: '/static/images/game/game-img3.gif',
-		range: [3000,7000]
-	},
-	{
-		id: 3,
-		imgUrl: '/static/images/game/game-img4.gif',
-		range: [7000]
-	}
-]

+ 0 - 19
pages/game/components/food.vue

@@ -1,19 +0,0 @@
-<template>
-	<image v-if="imgUrl" :src="imgUrl"></image>
-</template>
-
-<script setup>
-	import {foodSpeciesList} from './constantConfig';
-	import { ref,computed } from "vue";
-	const props = defineProps({
-		shiwuId: [String,Number]
-	})
-	
-	const imgUrl = computed(() => {
-		const active = foodSpeciesList.find(item => item.credit == props.shiwuId)
-		return active ? active.imgUrl: ''
-	})
-</script>
-
-<style>
-</style>

+ 0 - 64
pages/game/components/foodSelect.vue

@@ -1,64 +0,0 @@
-<template>
-	<!-- 食物图标按钮 -->
-	<view @click="handleOpen" class="food-btn-box"></view>
-	<uni-popup ref="popupRef" type="bottom">
-		<view class="game-popup-box">
-			<view class="game-popup-head">
-				<view class="game-popup-title"></view>
-				<view class="jf-btn-box">
-					<!-- 积分 -->
-					<view class="ezy-jf-box game-popup-jf">
-						<icon class="jf-icon"></icon>
-						<text class="jf-text" >{{credit}}</text>
-					</view>
-					<!-- 关闭按钮 -->
-					<icon class="popup-close-btn" @click="handleClose"></icon>
-				</view>
-			</view>
-			<view class="food-list-box">
-				<view v-for="item in foodSpeciesList" :key="item.id" @click="handleSelectFood(item)" class="food-item-box">
-					<image :src="item.imgUrl" class="food-image"/>
-					<view class="food-item-jf">
-						<icon class="jf-icon"></icon>
-						<text class="jf-text" >{{item.id}}</text>
-					</view>
-				</view>
-			</view>
-			
-		</view>
-	</uni-popup>
-</template>
-
-<script setup>
-	import {foodSpeciesList} from './constantConfig';
-	import {ref} from "vue";
-	const emits = defineEmits(['weishi'])
-	const props = defineProps({
-		shiwuId: {
-			type: [String,Number]
-		},
-		credit: {
-			type: [String,Number]
-		}
-	})
-	
-	const popupRef = ref(null);
-
-	function handleOpen() {
-		popupRef.value.open();
-    uni.$emit('food-select-open')
-  }
-	function handleClose() {
-		popupRef.value.close();
-	}
-	function handleSelectFood(shiwu) {
-		emits('weishi',shiwu);
-	}
-	
-	defineExpose({
-		handleClose
-	})
-</script>
-
-<style>
-</style>

+ 0 - 71
pages/game/components/goose.vue

@@ -1,71 +0,0 @@
-<template>
-	<view>
-		<up-line-progress v-if="growthType!==3" :percentage="progress" :showText="false" activeColor="#54e1fe"
-			class="game-progress-box"></up-line-progress>
-<!-- 		<text v-if="growthType!==3" class="game-progress-text">成长值:{{progress}}%</text> -->
-		<text v-if="growthType!==3" class="game-progress-text">{{growth}}/{{growthTotal}}</text>
-		<image :src="imgUrl" class="goose-img-box" @click="handleTouch"></image>
-	</view>
-</template>
-
-<script setup>
-	import {
-		ref,
-		computed,
-		watch,
-		toRefs
-	} from "vue";
-	import upLineProgress from "uview-plus/components/u-line-progress/u-line-progress.vue";
-	import {
-		useAudio,
-		useHuDong
-	} from "./useAudio.js"
-	const props = defineProps({
-		growthType: {
-			type: [String, Number]
-		},
-		progress: {
-			type: [String, Number],
-			default: 0
-		},
-		growth: {
-			type: [String, Number],
-			default: 0
-		},
-		growthTotal: {
-			type: [String, Number],
-			default: 0
-		}
-	})
-	const {growthType} = toRefs(props);
-	const Emits = defineEmits(['onPlay','onEnd'])
-	
-	
-
-	const {
-		init,
-		doTouch,
-		imgUrl
-	} = useHuDong(props);
-	const {
-		innerAudioContext,
-		handlePlay
-	} = useAudio(growthType);
-
-	init();
-	
-	watch(growthType, () => {
-		init();
-	})
-
-	function handleTouch() {
-		if (!innerAudioContext.value.paused) {
-			return;
-		}
-		doTouch(handlePlay);
-	}
-
-</script>
-
-<style>
-</style>

+ 0 - 156
pages/game/components/useAudio.js

@@ -1,156 +0,0 @@
-import {ref, watch,computed} from "vue";
-import {gooseGrowthTypeList} from "./constantConfig.js";
-import {onHide,onUnload} from "@dcloudio/uni-app"
-
-const audioList = {
-	0: [
-		'/static/mp3/dan/01.MP3',
-		'/static/mp3/dan/02.MP3',
-		'/static/mp3/dan/03.MP3',
-	],
-	1: [
-		'/static/mp3/xiaoe/01.MP3',
-		'/static/mp3/xiaoe/02.MP3',
-		'/static/mp3/xiaoe/03.MP3',
-		'/static/mp3/xiaoe/04.MP3',
-	],
-	2: [
-		'/static/mp3/zhonge/01.MP3',
-		'/static/mp3/zhonge/02.MP3',
-		'/static/mp3/zhonge/03.MP3',
-		'/static/mp3/zhonge/04.MP3',
-	],
-	3: [
-		'/static/mp3/dae/01.MP3',
-		'/static/mp3/dae/02.MP3',
-		'/static/mp3/dae/03.MP3',
-		'/static/mp3/dae/04.MP3',
-	],
-}
-
-const imageList = {
-	0: ['/static/images/game/game-img1.gif', '/static/images/game/game-eat-img1.gif'],
-	1: ['/static/images/game/game-img2.gif', '/static/images/game/game-eat-img2.gif'],
-	2: ['/static/images/game/game-img3.gif', '/static/images/game/game-eat-img3.gif'],
-	3: ['/static/images/game/game-img4.gif', '/static/images/game/game-eat-img4.gif'],
-}
-
-
-export function useAudio (grouthType) {
-	const defaultGrouthType = ref(''); // 成长状态历史
-	const audioIndex = ref(0); // 播放序列
-	const innerAudioContext = ref(null);
-	function createAudio() {
-		const innerAudioContext = uni.createInnerAudioContext();
-		innerAudioContext.autoplay = false;
-		innerAudioContext.src = audioList[grouthType.value][audioIndex.value];
-		innerAudioContext.onPlay(() => {
-			// 播放
-			uni.$emit('play-audio');
-		});
-		innerAudioContext.onError((res) => {
-		  audioIndex.value = 0;
-		  uni.$emit('play-error')
-		  console.log(res.errMsg);
-		  console.log(res.errCode);
-		});
-		innerAudioContext.onEnded(() => {
-			// 播放结束
-			uni.$emit('play-audio-ended')
-			// 计算播放音频序列
-			const list = audioList[grouthType.value];
-			if (audioIndex.value >= list.length-1) {
-				audioIndex.value = 0;
-			} else {
-				audioIndex.value = audioIndex.value+1;
-			}
-			// 更新音频源
-			changeSource(list[audioIndex.value]);
-		})
-		return innerAudioContext;
-	}
-	function changeSource(url) {
-		innerAudioContext.src= url;
-		innerAudioContext.currentTime = 0;
-	}
-	
-	onHide(() => {
-		innerAudioContext.value.stop();
-	})
-	
-	onUnload(() => {
-		innerAudioContext.value.stop();
-	})
-	
-
-	// 展开食物停止播放
-	uni.$on('food-select-open', () => {
-		innerAudioContext.value.stop();
-		audioIndex.value = 0;
-	})
-	
-	innerAudioContext.value = createAudio();
-	
-	function handlePlay() {
-		innerAudioContext.value.destroy();
-		innerAudioContext.value = null;
-		innerAudioContext.value = createAudio();
-		innerAudioContext.value.play()
-	}
-	
-	watch(grouthType, () => {
-		if (defaultGrouthType.value != grouthType.value) {
-			const list = audioList[grouthType.value];
-			// 当鹅成长状态变更时重置播放序列
-			audioIndex.value = 0;
-			defaultGrouthType.value = grouthType.value;
-			changeSource(audioList[grouthType.value][0]);
-		}
-	})
-	
-	return {
-		innerAudioContext,
-		handlePlay
-	}
-}
-
-
-export function useHuDong(props) {
-	const imgUrl = ref('');
-	
-	function getDefaultImg() {
-		const active = gooseGrowthTypeList.find(item => item.id == props.growthType);
-		return active ? active.imgUrl: ''
-	}
-
-	// 初始化
-	function init() {
-		imgUrl.value = getDefaultImg();
-	}
-
-	function doTouch(handlePlay) {
-		handlePlay();
-	}
-	
-	// 播放开始切换动画
-	uni.$on('play-audio', () => {
-		imgUrl.value = imageList[props.growthType][1]
-	})
-	// 播放结束恢复默认
-	uni.$on('play-audio-ended', () => {
-		imgUrl.value = imageList[props.growthType][0]
-	})
-	// 展开食物恢复默认
-	uni.$on('food-select-open', () => {
-		imgUrl.value = imageList[props.growthType][0]
-	})
-	uni.$on('play-error',() => {
-		imgUrl.value = imageList[props.growthType][0]
-	})
-	return {
-		init,
-		doTouch,
-		imgUrl
-	}
-	
-}

+ 0 - 98
pages/game/index.vue

@@ -1,98 +0,0 @@
-<!-- 游戏页面 -->
-<template>
-	<view class="ezy-game-page">
-		<!-- 返回按钮 -->
-		<!-- <view class="ezy-nav-bar-icon" @click="handleBack"></view> -->
-		<!-- 积分 -->
-		<view class="ezy-jf-box game-jf-box">
-			<icon class="jf-icon"></icon>
-			<text class="jf-text" >{{credit}}</text>
-		</view>
-		<!-- 桌面食物 -->
-		<foodVue :shiwuId="shiwuId" class="food-img-box" :class="'food-img'+shiwuId"></foodVue>
-		<!-- 大鹅 4阶段 -->
-		<gooseVue :growth="growth" :growthType="growthType" :progress="progress"   :growthTotal="growthTotal"
-		class="game-goose-box" :class="'game-goose-box'+ growthType"></gooseVue>
-		<!-- 食物选择 -->
-		<foodSelectVue :credit="credit" ref="foodSelectRef" :shiwuId="shiwuId" @weishi="onWeiShi"></foodSelectVue>
-		<!-- 游戏说明 -->
-		<view class="yxsm-btn" @click="showTishi"></view>
-		<!-- 游戏说明 -->
-		<commonDialogVue ref="dlRef">
-			<view class="yxsm-popup-box">
-				<view class="yxsm-popup-title">陪伴宠物鹅系统详细说明</view>
-				<view class="yxsm-item-box">
-					<view v-for="(item, index) in yxsmContent" :key="index">
-						<view class="item-title">{{item.title}}</view>
-						<text class="item-content">{{item.content}}</text>
-					</view>
-				</view>
-				<icon @click="handleClose" class="yxsm-close-btn"></icon>
-			</view>
-		</commonDialogVue>
-    <!--  导航  -->
-    <CustomTabBar :current-index="2"></CustomTabBar>
-	
-	</view>
-</template>
-
-<script setup>
-	import {
-		onLoad,
-		onShow
-	} from "@dcloudio/uni-app"
-	import {ref,reactive} from "vue";
-	import foodVue from "./components/food.vue";
-	import gooseVue from "./components/goose.vue";
-	import foodSelectVue from "./components/foodSelect.vue";
-	import commonDialogVue from "@/components/dialog/commonDialog.vue";
-  	import CustomTabBar from "@/components/custom-tabbar/index.vue";
-	import {
-		toast,
-		getUserIdentity
-	} from "@/utils/common";
-	import { useGame } from "./useGame";
-	const {	credit,growth,growthType,progress,shiwuId ,handleWeishi ,growthTotal } = useGame();
-	const yxsmContent = reactive([{
-			title: '宠物鹅获取',
-			content: '学生首次注册并登录 APP 时,系统自动发放一颗宠物鹅蛋,开启养鹅之旅。每个账号有且仅有一次领取鹅蛋的机会,确保公平性,这颗蛋便是学生与宠物鹅相伴成长的起点。',
-	},{
-			title: '成长阶段',
-			content: `1. 破壳期(初始状态):刚获得的鹅蛋代表宠物鹅的初始形态,成长值为 0,静静等待成长契机。
-					2. 幼年期:当学生通过学习积累的成长值达到 1000 时,鹅蛋孵化,宠物鹅进入幼年期,模样娇小可爱,开启成长新篇。
-					3. 青年期:随着学习推进,成长值累计至 3000,幼鹅成长为青年鹅,体型增大,羽毛渐丰,活力更足。
-					4. 成年期:若学生持之以恒学习,使成长值攀升至 7000,青年鹅将进化为成年鹅,外形成熟矫健,成为学生学习路上的暖心陪伴。`,
-	},{
-			title: '积分规则',
-			content: `1. 学习课程积分:APP 提供丰富视频课程,学生首次完整学完一门课程,就能获得 100 积分。系统会记录学习情况,重复学习同一课程不再积分,激励学生探索新内容。
-					2. 答题积分:各章节配有单元测试,学生首次答题,每答对一题获 20 积分,答错无积分。重复测试以首次答题结果为准,促使学生认真对待初次测试。
-					3. 蛋糕兑换积分:学生可用积分兑换成长值蛋糕,100 积分换 30 成长值蛋糕、300 积分换 100 成长值蛋糕、600 积分换 300 成长值蛋糕,为宠物鹅成长助力。`,
-	}]);
-	const foodSelectRef = ref(null);
-	const dlRef = ref(null);
-
-	function handleClose() {
-		dlRef.value.handleClose();
-	}
-
-  function handleBack() {
-    uni.navigateBack();
-  }
-	
-	function showTishi() {
-		dlRef.value.handleShow();
-	}
-	
-	function onWeiShi(data) {
-		handleWeishi(data, () => {
-			toast("已投喂");
-			foodSelectRef.value.handleClose();
-		})
-	}
-	onLoad((options) => {
-		uni.hideTabBar()
-	})
-</script>
-
-<style>
-</style>

+ 0 - 90
pages/game/useGame.js

@@ -1,90 +0,0 @@
-import {
-	reactive,
-	ref,
-	getCurrentInstance,
-	onMounted,
-	toRefs
-} from "vue";
-import {
-	onLoad
-} from '@dcloudio/uni-app';
-import {toast,getUserIdentity,catchError} from "@/utils/common";
-import {getYouxiInfo, getYouxiWeishi} from "@/api/game.js";
-import cacheManager from "@/utils/cacheManager.js"
-
-
-export function useGame() {
-	const UserCode = getUserIdentity();
-	const auth = cacheManager.get('auth');
-	const data = reactive({
-			credit: 0, // 当前积分
-			growth: 0, // 成长值
-			growthType:0, // 成长类型
-			growthTotal:0, // 成长类型
-			progress:0, // 当前进度
-			shiwuId:null // 上一次食物
-	})
-	if (auth) {
-		data.growthType = auth.growthType;
-	}
-	async function getGameInfo() {
-		const [err, info] = await catchError(getYouxiInfo());
-		if (err) {
-
-			toast("请求异常,请稍后尝试");
-			return;
-		}
-		const {
-			credit,growth,growthTotal,growthType,progress,shiwuId
-		} = info;
-		data.credit = credit;
-		data.growthTotal = growthTotal;
-		data.growth = growth;
-		data.growthType = growthType;
-		data.progress = progress;
-		data.shiwuId = shiwuId;
-	}
-	
-	async function handleWeishi({id:cShiwuId,credit:cCredit}, doFinish) {
-		const [err, info] = await catchError(getYouxiWeishi({shiwuId:cCredit,credit:cShiwuId }));
-		if (err) {
-			toast("请求异常,请稍后尝试");
-			return;
-		}
-		const {
-			credit,growth,growthType,progress,shiwuId,growthTotal
-		} = info;
-		
-		data.credit = credit;
-		data.growthTotal = growthTotal;
-		data.growthType = growthType;
-		data.growth = growth;
-		data.progress = progress;
-		data.shiwuId = shiwuId;
-		
-		// 更新成长状态
-		updateCachegrowthType(growthType);
-		
-		doFinish && doFinish();
-	}
-	
-	// 更新缓存 大鹅成长值
-	function updateCachegrowthType(growthType) {
-		cacheManager.updateObject('auth', { growthType })
-	}
-	
-
-	onLoad(async (options) => {
-		if (UserCode !== "Visitor") {
-			getGameInfo();
-		} else {}
-	})
-	
-	return {
-		...toRefs(data),
-		UserCode,
-		handleWeishi,
-	}
-	
-}
-

BIN
static/images/game/food-bj.png


BIN
static/images/game/food-box-bj.png


BIN
static/images/game/food-common-img.png


BIN
static/images/game/food-img1.png


BIN
static/images/game/food-img2.png


BIN
static/images/game/food-img3.png


BIN
static/images/game/food-jf-bj.png


BIN
static/images/game/food-time.png


BIN
static/images/game/food-title.png


BIN
static/images/game/game-bj.png


BIN
static/images/game/game-eat-img1.gif


BIN
static/images/game/game-eat-img2.gif


BIN
static/images/game/game-eat-img3.gif


BIN
static/images/game/game-eat-img4.gif


BIN
static/images/game/game-img1.gif


BIN
static/images/game/game-img2.gif


BIN
static/images/game/game-img3.gif


BIN
static/images/game/game-img4.gif


BIN
static/images/game/jf-bj.png


BIN
static/images/game/yxsm-btn-img.png


Некоторые файлы не были показаны из-за большого количества измененных файлов