mainLand.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  1. <template>
  2. <view class="main-land-container">
  3. <!-- <view class="scroll-container" @touchstart="touchStart" @touchmove="touchMove" @touchend="touchEnd" >
  4. <view class="background" :style="{ transform: `translateX(${translateX}px)` }">
  5. <image class="island-image" src="/static/island/island.png" mode="heightFix"></image>
  6. </view>
  7. </view> -->
  8. <!-- 第三层:背景 -->
  9. <view class="background-layer"></view>
  10. <!-- 第二层:地图 -->
  11. <view class="map-layer" id="mapLayer" :style="{ transform: `translateX(${translateX}px)` }"
  12. @touchstart="touchStart" @touchmove="touchMove" @touchend="touchEnd" @mousedown="onmousedown"
  13. @mousemove="onmousemove" @mouseup="onmouseup">
  14. <!-- 这里可以放置地图元素(示例:一个方块) -->
  15. <!-- <view style="position: absolute; top: 30%; left: 30%; width: 100px; height: 100px; background: green;"></view> -->
  16. <image class="island-image" src="/static/island/mainLand.png" mode="widthFix"
  17. style="width:2048rpx; bottom: 0rpx;left: 0rpx; position: absolute;"></image>
  18. <!-- <view style="position: absolute;width: 300rpx;left: 280rpx; bottom:230rpx;align-items: center;">
  19. <image class="house-image" src="/static/island/building/4.png" mode="widthFix" style="width:300rpx; position: static;" @click="onHouseClick" :animation="houseAnimationData"> </image>
  20. </view> -->
  21. <view style="position: absolute;width: 360rpx;left:782rpx; bottom:385rpx;align-items: center;">
  22. <image class="farm-image" src="/static/island/building/3.png" mode="widthFix"
  23. style="width:360rpx; position: static;" @click="onFarmClick" :animation="farmAnimationData">
  24. </image>
  25. </view>
  26. <view style="position: absolute;width: 360rpx;left: 335rpx; bottom:835rpx;align-items: center;">
  27. <image class="mine-image" src="/static/island/building/4.png" mode="widthFix"
  28. style="width:360rpx; position: static;"> </image>
  29. </view>
  30. <view style="position: absolute;width: 360rpx;left: 782rpx; bottom:720rpx;align-items: center;">
  31. <image class="hall-image" src="/static/island/building/5.png" mode="widthFix"
  32. style="width:360rpx; position: static;"> </image>
  33. </view>
  34. <view style="position: absolute;width: 360rpx;left: 248rpx; bottom:488rpx;align-items: center;">
  35. <image class="wood-image" src="/static/island/building/6.png" mode="widthFix"
  36. style="width:360rpx; position: static;"> </image>
  37. </view>
  38. <view style="position: absolute;width: 360rpx;left: 910rpx; bottom:108rpx;align-items: center;">
  39. <image class="shop-image" src="/static/island/building/2.png" mode="widthFix"
  40. style="width:360rpx; position: static;" @click="onShopClick" :animation="shopAnimationData">
  41. </image>
  42. </view>
  43. <view style="position: absolute;width: 360rpx;left: 1498rpx; bottom:75rpx;align-items: center;">
  44. <image class="airport-image" src="/static/island/building/7.png" mode="widthFix"
  45. style="width:360rpx; position: static;"> </image>
  46. </view>
  47. <view style="position: absolute;width: 360rpx;left: 1400rpx; bottom:380rpx;align-items: center;">
  48. <image class="house-image" src="/static/island/building/1.png" mode="widthFix"
  49. style="width:360rpx; position: static;" @click="onHouseClick" :animation="houseAnimationData">
  50. </image>
  51. </view>
  52. <!-- 引导箭头 -->
  53. <view class="guide-arrow" v-if="showGuideArrow" :style="{ left: guideArrowPosition.x + 'rpx', bottom: guideArrowPosition.y + 'rpx', transform: `rotate(${guideArrowPosition.r}deg)` }">
  54. <image src="/static/island/arrow.png" mode="aspectFit"></image>
  55. </view>
  56. <!-- 回家箭头 -->
  57. <view class="home-arrow" @click="goHome" :animation="homeArrowAnimation"
  58. :style="{ opacity: homeArrowVisible ? 1 : 0 }">
  59. <!-- <image src="/static/island/home_arrow.png" mode="widthFix" style="width: 100rpx;"></image> -->
  60. <view class="arrow"></view>
  61. <text class="home-text">回家</text>
  62. </view>
  63. </view>
  64. <!-- 第一层:UI -->
  65. <view class="ui-layer">
  66. <view class="ui-content">
  67. <!-- 添加货币计数器 -->
  68. <view class="currency-display">
  69. <view class="currency-item">
  70. <image src="/static/island/UI/wd_icon_coin.png" mode="widthFix" class="currency-icon"></image>
  71. <text class="currency-value">{{userInfo.num_gmd}}</text>
  72. </view>
  73. <view class="currency-item">
  74. <image src="/static/island/UI/wd_icon_xingyuan.png" mode="widthFix" class="currency-icon">
  75. </image>
  76. <text class="currency-value">{{userInfo.num_gmg}}</text>
  77. </view>
  78. </view>
  79. <view class="ui-buttons">
  80. <image src="/static/island/icon_backpack.png" mode="widthFix" style="width:100rpx"
  81. @click="showInventory" class="ui-icon-button"></image>
  82. <!-- <button class="ui-button" @click="showCharacter">角色</button>
  83. <button class="ui-button" @click="showShop">商店</button> -->
  84. </view>
  85. </view>
  86. </view>
  87. <!-- 对话框组件 -->
  88. <backpack-dialog :visible.sync="inventoryVisible" @close="onInventoryClose"></backpack-dialog>
  89. <character-dialog :visible.sync="characterVisible" @close="onCharacterClose"></character-dialog>
  90. <shop-dialog :visible.sync="shopVisible" :shopName="currentShopName" @close="onShopClose" @buy="onShopBuy"></shop-dialog>
  91. <hua-tian :visible.sync="huaTianVisible" @close="onHuaTianClose" ref="huaTian"></hua-tian>
  92. <task-dialog :visible.sync="taskDialogVisible" @close="onTaskDialogClose" type="huatian"></task-dialog>
  93. <!-- 引导对话组件 -->
  94. <talk-guide
  95. v-if="showTalkGuide"
  96. :guide-data="currentTalkData"
  97. :player-name="playerName"
  98. :visible="showTalkGuide"
  99. @talk-complete="onTalkComplete"
  100. ></talk-guide>
  101. <!-- 引导管理器 -->
  102. <guide-manager ref="guideManager"></guide-manager>
  103. </view>
  104. </template>
  105. <script>
  106. import BackpackDialog from '@/components/dialogs/BackpackDialog.vue'
  107. import CharacterDialog from '@/components/dialogs/CharacterDialog.vue'
  108. import ShopDialog from '@/components/dialogs/ShopDialog.vue'
  109. import HuaTian from './HuaTian.vue'
  110. import TaskDialog from './TaskDialog.vue'
  111. import TalkGuide from './talkGuide.vue'
  112. import GuideManager from '@/components/guide/GuideManager.vue'
  113. export default {
  114. components: {
  115. BackpackDialog,
  116. CharacterDialog,
  117. ShopDialog,
  118. HuaTian,
  119. TaskDialog,
  120. TalkGuide,
  121. GuideManager
  122. },
  123. data() {
  124. return {
  125. // // 背景位置控制
  126. translateX: -200,
  127. startX: 0,
  128. currentX: 0,
  129. isDragging: false,
  130. // maxTranslate: 0,
  131. userInfo: {
  132. num_gmd: 0,
  133. num_gmg: 0,
  134. },
  135. moneyTimer: null, // 添加定时器变量
  136. // // 获取屏幕宽度和背景宽度
  137. screenWidth: 0,
  138. backgroundWidth: 0,
  139. islandHeight: 0,
  140. houseAnimationData: {},
  141. farmAnimationData: {},
  142. shopAnimationData: {},
  143. houseAnimating: false,
  144. farmAnimating: false,
  145. shopAnimating: false,
  146. baseTranslate: {
  147. x: -50,
  148. y: 50
  149. },
  150. inventoryVisible: false,
  151. characterVisible: false,
  152. shopVisible: false,
  153. huaTianVisible: false,
  154. taskDialogVisible: false,
  155. homeArrowAnimation: {},
  156. homeArrowAnimating: false,
  157. homeArrowVisible: false,
  158. currentShopName: '商店',
  159. // 引导相关数据
  160. showTalkGuide: false,
  161. currentTalkData: [],
  162. playerName: '梦幻',
  163. // 引导箭头相关
  164. showGuideArrow: false,
  165. guideArrowPosition: { x: 0, y: 0, r: 0 }
  166. }
  167. },
  168. onLoad() {
  169. let self = this;
  170. // 获取屏幕宽度
  171. uni.getSystemInfo({
  172. success: (res) => {
  173. self.screenWidth = res.windowWidth;
  174. console.log('屏幕宽度:', self.screenWidth);
  175. }
  176. });
  177. this.getUserMoney();
  178. // 启动定时器,每2秒更新一次铃钱
  179. this.moneyTimer = setInterval(() => {
  180. this.getUserMoney();
  181. }, 2000);
  182. },
  183. onShow() {
  184. // 检查是否需要显示引导
  185. this.checkAndShowGuide('mainLand');
  186. },
  187. onReady() {
  188. // 在组件渲染完成后获取图片尺寸
  189. setTimeout(() => {
  190. this.getImageSize();
  191. // 延迟1秒后显示箭头并开始动画
  192. setTimeout(() => {
  193. this.homeArrowVisible = true;
  194. this.startHomeArrowAnimation();
  195. }, 1000);
  196. }, 300);
  197. },
  198. onUnload() {
  199. // 清除定时器
  200. if (this.moneyTimer) {
  201. clearInterval(this.moneyTimer);
  202. this.moneyTimer = null;
  203. }
  204. },
  205. methods: {
  206. loadData() {
  207. // 可以在这里加载其他数据
  208. },
  209. getImageSize() {
  210. const query = uni.createSelectorQuery().in(this);
  211. query.select('.island-image').boundingClientRect(data => {
  212. if (data) {
  213. // 获取岛屿图片的宽度和高度
  214. this.backgroundWidth = data.width;
  215. this.islandHeight = data.height;
  216. // this.backgroundWidth = 1536;
  217. // this.islandHeight = 1024;
  218. // 设置背景高度为岛屿高度的两倍(在CSS中实现)
  219. // 计算最大可移动距离
  220. this.maxTranslate = this.backgroundWidth - this.screenWidth;
  221. // 初始位置居中
  222. // this.translateX = -this.maxTranslate / 2;
  223. // 打印调试信息
  224. // console.log('屏幕宽度:', this.screenWidth);
  225. // console.log('背景宽度:', this.backgroundWidth);
  226. // console.log('岛屿高度:', this.islandHeight);
  227. // console.log('屏幕宽度:',this.screenWidth);
  228. // console.log('最大可移动距离:',this.maxTranslate);
  229. // console.log('岛屿data:', data);
  230. } else {
  231. console.error('未能获取岛屿图片的尺寸');
  232. }
  233. }).exec();
  234. },
  235. // 触摸开始
  236. touchStart(e) {
  237. // console.log('----------- touchStart');
  238. this.startX = e.touches[0].clientX;
  239. this.currentX = this.translateX;
  240. console.log('this.startX =', this.startX);
  241. console.log('this.currentX =', this.currentX);
  242. },
  243. // 触摸移动
  244. touchMove(e) {
  245. console.log('----------- touchMove');
  246. const moveX = e.touches[0].clientX - this.startX;
  247. let newTranslateX = this.currentX + moveX;
  248. // 限制移动范围,不让背景两侧露出
  249. if (newTranslateX > 0) {
  250. newTranslateX = 0;
  251. } else if (newTranslateX < -this.maxTranslate) {
  252. newTranslateX = -this.maxTranslate;
  253. }
  254. this.translateX = newTranslateX;
  255. console.log('moveX =', moveX);
  256. console.log('this.translateX =', this.translateX);
  257. },
  258. // 触摸结束
  259. touchEnd() {
  260. console.log('----------- touchEnd');
  261. this.currentX = this.translateX;
  262. console.log('this.currentX =', this.currentX);
  263. },
  264. onmousedown(e) {
  265. console.log('----------- onmousedown');
  266. console.log('----------- e', e);
  267. this.isDragging = true;
  268. this.startX = e.clientX;
  269. this.currentX = this.translateX;
  270. mapLayer.style.cursor = 'grabbing';
  271. },
  272. onmousemove(e) {
  273. if (this.isDragging) {
  274. console.log('----------- onmousemove');
  275. const moveX = e.clientX - this.startX;
  276. let newTranslateX = this.currentX + moveX;
  277. //限制移动范围,不让背景两侧露出
  278. if (newTranslateX > 0) {
  279. newTranslateX = 0;
  280. } else if (newTranslateX < -this.maxTranslate) {
  281. newTranslateX = -this.maxTranslate;
  282. }
  283. this.translateX = newTranslateX;
  284. console.log('moveX =', moveX);
  285. console.log('this.translateX =', this.translateX);
  286. }
  287. },
  288. onmouseup(e) {
  289. console.log('----------- onmouseup');
  290. this.isDragging = false;
  291. mapLayer.style.cursor = 'grab';
  292. },
  293. onHouseClick(event) {
  294. if (this.houseAnimating) return;
  295. // 处理点击事件
  296. console.log('house clicked!');
  297. // 播放房屋的点击动画
  298. this.playAnimation('house');
  299. // 设置商店名称为"房屋商店"
  300. this.currentShopName = '材料商店';
  301. this.shopVisible = true;
  302. },
  303. onFarmClick(event) {
  304. if (this.farmAnimating) return;
  305. // 处理点击事件
  306. console.log('farm clicked!111');
  307. // 播放大厅的点击动画
  308. this.playAnimation('farm');
  309. // 打开花田对话框
  310. this.huaTianVisible = true;
  311. // 将mainLand传递给HuaTian组件
  312. this.$refs.huaTian && this.$refs.huaTian.setMainLand(this);
  313. // 检查是否需要显示引导
  314. this.checkAndShowGuide('mainLand_farm');
  315. },
  316. onShopClick(event) {
  317. if (this.shopAnimating) return;
  318. // 处理点击事件
  319. console.log('shop clicked!');
  320. // 播放商店的点击动画
  321. this.playAnimation('shop');
  322. // 设置商店名称为"花店"
  323. this.currentShopName = '花店';
  324. // 打开商店对话框
  325. this.shopVisible = true;
  326. },
  327. playAnimation(type) {
  328. let self = this;
  329. // 根据类型设置对应的动画状态
  330. if (type === 'house') {
  331. this.houseAnimating = true;
  332. } else if (type === 'farm') {
  333. this.farmAnimating = true;
  334. } else if (type === 'shop') {
  335. this.shopAnimating = true;
  336. }
  337. // 创建动画实例
  338. const animation = uni.createAnimation({
  339. duration: 400,
  340. timingFunction: 'ease',
  341. });
  342. // 定义果冻动画序列
  343. animation.scale(0.95).step({
  344. duration: 100
  345. })
  346. .scale(1.05).step({
  347. duration: 100
  348. })
  349. .scale(0.98).step({
  350. duration: 100
  351. })
  352. .scale(1).step({
  353. duration: 100
  354. });
  355. // 根据类型应用动画到对应的元素
  356. if (type === 'house') {
  357. this.houseAnimationData = animation.export();
  358. } else if (type === 'farm') {
  359. this.farmAnimationData = animation.export();
  360. } else if (type === 'shop') {
  361. this.shopAnimationData = animation.export();
  362. }
  363. // 动画结束后重置状态
  364. setTimeout(() => {
  365. if (type === 'house') {
  366. self.houseAnimating = false;
  367. } else if (type === 'farm') {
  368. self.farmAnimating = false;
  369. } else if (type === 'shop') {
  370. self.shopAnimating = false;
  371. }
  372. }, 800);
  373. },
  374. showInventory() {
  375. console.log('Opening inventory...')
  376. this.inventoryVisible = true
  377. },
  378. onInventoryClose() {
  379. console.log('Closing inventory...')
  380. this.inventoryVisible = false
  381. },
  382. showCharacter() {
  383. console.log('Opening character...')
  384. this.characterVisible = true
  385. },
  386. onCharacterClose() {
  387. console.log('Closing character...')
  388. this.characterVisible = false
  389. },
  390. showShop() {
  391. console.log('Opening shop...')
  392. this.shopVisible = true
  393. },
  394. onShopClose() {
  395. console.log('Closing shop...')
  396. this.shopVisible = false
  397. },
  398. onShopBuy(item) {
  399. console.log('Buying item:', item)
  400. },
  401. onHuaTianClose() {
  402. console.log('Closing hua tian dialog...')
  403. this.huaTianVisible = false
  404. },
  405. startHomeArrowAnimation() {
  406. if (this.homeArrowAnimating) return;
  407. this.homeArrowAnimating = true;
  408. const animation = uni.createAnimation({
  409. duration: 1000,
  410. timingFunction: 'ease-in-out',
  411. });
  412. const animate = () => {
  413. if (!this.homeArrowAnimating) return;
  414. animation.translateY(-20).step({
  415. duration: 1000
  416. });
  417. this.homeArrowAnimation = animation.export();
  418. setTimeout(() => {
  419. animation.translateY(0).step({
  420. duration: 1000
  421. });
  422. this.homeArrowAnimation = animation.export();
  423. setTimeout(() => {
  424. if (this.homeArrowAnimating) {
  425. animate();
  426. }
  427. }, 1000);
  428. }, 1000);
  429. };
  430. animate();
  431. },
  432. goHome() {
  433. uni.navigateTo({
  434. url: '/pages/isLand/homeLand'
  435. });
  436. },
  437. // 打开任务对话框
  438. onTaskClick() {
  439. console.log('Opening task dialog...')
  440. this.taskDialogVisible = true
  441. },
  442. // 关闭任务对话框
  443. onTaskDialogClose() {
  444. console.log('Closing task dialog...')
  445. this.taskDialogVisible = false
  446. },
  447. // 获取用户铃钱
  448. getUserMoney() {
  449. uni.request({
  450. url: this.$apiHost + '/User/getinfo',
  451. method: 'GET',
  452. data: {
  453. uuid: getApp().globalData.uuid
  454. },
  455. header: {
  456. 'Content-Type': 'application/x-www-form-urlencoded',
  457. 'sign': getApp().globalData.headerSign,
  458. },
  459. success: (res) => {
  460. if (res.data) {
  461. console.log("res.getUserMoney", res.data)
  462. this.userInfo = res.data;
  463. }
  464. }
  465. })
  466. },
  467. // 检查并显示引导
  468. checkAndShowGuide(stageId) {
  469. console.log('checkAndShowGuide stageId :', stageId);
  470. // 延迟执行以确保DOM已经渲染
  471. setTimeout(() => {
  472. if (this.$refs.guideManager) {
  473. const hasGuide = this.$refs.guideManager.startGuide(stageId);
  474. console.log('checkAndShowGuide hasGuide :', hasGuide);
  475. if (hasGuide) {
  476. this.currentTalkData = this.$refs.guideManager.getCurrentTalkData();
  477. console.log('checkAndShowGuide currentTalkData :', this.currentTalkData);
  478. if (this.currentTalkData) {
  479. this.showTalkGuide = true;
  480. // 检查是否需要显示引导箭头
  481. this.checkAndShowGuideArrow();
  482. }else{
  483. console.log('currentTalkData err:', this.currentTalkData);
  484. }
  485. }
  486. }
  487. }, 200);
  488. },
  489. // 对话完成回调
  490. onTalkComplete() {
  491. // 调用引导管理器的下一步
  492. console.log('----------- onTalkComplete');
  493. this.$refs.guideManager && this.$refs.guideManager.nextStep();
  494. // 获取新的对话数据
  495. const newTalkData = this.$refs.guideManager.getCurrentTalkData();
  496. console.log('----------- onTalkComplete newTalkData:', newTalkData);
  497. if (newTalkData) {
  498. // 先隐藏对话组件
  499. this.showTalkGuide = false;
  500. // 更新对话数据
  501. this.currentTalkData = newTalkData;
  502. // 使用 nextTick 确保数据更新后再显示对话组件
  503. this.$nextTick(() => {
  504. this.showTalkGuide = true;
  505. // 检查是否需要显示引导箭头
  506. this.checkAndShowGuideArrow();
  507. });
  508. } else {
  509. // 如果没有新的对话数据,隐藏对话组件
  510. this.showTalkGuide = false;
  511. }
  512. },
  513. // 检查并显示引导箭头
  514. checkAndShowGuideArrow() {
  515. if (this.$refs.guideManager) {
  516. const arrowPosition = this.$refs.guideManager.getCurrentArrowPosition();
  517. console.log('----------- checkAndShowGuideArrow arrowPosition:', arrowPosition);
  518. if (arrowPosition) {
  519. // 显示引导箭头
  520. this.showGuideArrow = true;
  521. // 设置箭头位置
  522. this.guideArrowPosition = {
  523. x: arrowPosition.x,
  524. y: arrowPosition.y,
  525. r: arrowPosition.r || 0
  526. };
  527. console.log('----------- guideArrowPosition:', this.guideArrowPosition);
  528. console.log('----------- showGuideArrow:', this.showGuideArrow);
  529. } else {
  530. // 隐藏引导箭头
  531. this.showGuideArrow = false;
  532. }
  533. }
  534. }
  535. }
  536. }
  537. </script>
  538. <style lang="scss" scoped>
  539. @import './mainLand.scss';
  540. .ui-layer {
  541. position: fixed;
  542. top: 0;
  543. left: 0;
  544. right: 0;
  545. bottom: 0;
  546. pointer-events: none;
  547. z-index: 100;
  548. .ui-content {
  549. position: absolute;
  550. top: 20rpx;
  551. right: 20rpx;
  552. pointer-events: auto;
  553. z-index: 101;
  554. }
  555. .ui-buttons {
  556. display: flex;
  557. flex-direction: column;
  558. gap: 20rpx;
  559. .ui-icon-button {
  560. transition: transform 0.2s ease;
  561. &:active {
  562. transform: scale(0.9);
  563. opacity: 0.8;
  564. }
  565. }
  566. .ui-button {
  567. // background: rgba(255, 255, 255, 0.9);
  568. // border: none;
  569. width: 120rpx;
  570. padding: 16rpx 32rpx;
  571. border-radius: 8rpx;
  572. font-size: 28rpx;
  573. color: #333;
  574. // box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
  575. min-width: 120rpx;
  576. &:active {
  577. opacity: 0.8;
  578. transform: scale(0.95);
  579. }
  580. }
  581. .backpack-button {
  582. background-image: url('/static/island/icon_backpack.png');
  583. background-size: cover;
  584. background-position: center;
  585. background-repeat: no-repeat;
  586. }
  587. }
  588. }
  589. .map-layer {
  590. position: relative;
  591. z-index: 1;
  592. cursor: grab;
  593. &:active {
  594. cursor: grabbing;
  595. }
  596. }
  597. .guide-arrow {
  598. position: absolute;
  599. z-index: 10;
  600. width: 100rpx;
  601. height: 100rpx;
  602. display: flex;
  603. justify-content: center;
  604. align-items: center;
  605. pointer-events: none; /* 防止箭头阻挡点击事件 */
  606. image {
  607. width: 100rpx;
  608. height: 100rpx;
  609. animation: pulse 1.5s infinite; /* 添加脉冲动画 */
  610. }
  611. }
  612. @keyframes pulse {
  613. 0% {
  614. transform: scale(1);
  615. opacity: 1;
  616. }
  617. 50% {
  618. transform: scale(1.2);
  619. opacity: 0.8;
  620. }
  621. 100% {
  622. transform: scale(1);
  623. opacity: 1;
  624. }
  625. }
  626. .home-arrow {
  627. // background: rgba(255, 255, 255, 0.9);
  628. position: absolute;
  629. left: 40rpx; // 调整到左边位置
  630. bottom: 460rpx;
  631. display: flex;
  632. flex-direction: column;
  633. align-items: center;
  634. cursor: pointer;
  635. z-index: 10;
  636. transition: opacity 0.5s ease-in-out; // 添加淡入效果
  637. .arrow {
  638. content: '';
  639. display: block;
  640. width: 60rpx;
  641. height: 60rpx;
  642. background: url('/static/island/arrow.png') no-repeat center center;
  643. background-size: contain;
  644. transform: rotate(90deg);
  645. }
  646. .home-text {
  647. color: #ffffff;
  648. font-size: 32rpx;
  649. text-shadow: 2rpx 2rpx 4rpx rgba(0, 0, 0, 0.5);
  650. margin-top: 10rpx;
  651. }
  652. }
  653. </style>