banben.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template>
  2. <view>
  3. <view class="icon-title-navBar-box">
  4. <view @click="handleBack"><</view>
  5. <view class="nav-bar-title">选择版本</view>
  6. </view>
  7. <view v-for="item in data.banbenList" :key="item.id">
  8. <!-- 封面 -->
  9. <image :src="item.cover" mode=""></image>
  10. <!-- 名称+等级 -->
  11. <view>{{item.chanpinName}} {{item.dengjiName}}</view>
  12. <!-- 版本名称 -->
  13. <view>{{item.name}}</view>
  14. <view @click="handleSelect(item)">播放按钮</view>
  15. </view>
  16. <CustomTabBar :currentTabNumber="0"></CustomTabBar>
  17. </view>
  18. </template>
  19. <script setup>
  20. import {reactive} from "vue";
  21. import {onLoad} from "@dcloudio/uni-app"
  22. import * as shuxueHttp from "@/api/chanpinShuxue.js"
  23. import CustomTabBar from "@/components/custom-tabbar/custom-tabbar.vue";
  24. const data = reactive({
  25. dengjiId: null,
  26. banbenList: []
  27. })
  28. function getBanbenList() {
  29. shuxueHttp.getShuxueChanpinBanbenList({dengjiId: data.dengjiId}).then(res => {
  30. data.banbenList = res.data;
  31. })
  32. }
  33. function handleBack() {
  34. uni.navigateBack()
  35. }
  36. function handleSelect(item) {
  37. uni.redirectTo({
  38. url: `/pages/chanpinXuanze/xuexi?banbenId=${item.id}`
  39. })
  40. }
  41. onLoad((options) => {
  42. data.dengjiId = options.dengjiId;
  43. getBanbenList();
  44. })
  45. </script>
  46. <style>
  47. </style>