banben.vue 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <template>
  2. <view class="ezy-xbb-page">
  3. <view class="icon-title-navBar-box">
  4. <view class="nav-bar-icon" @click="handleBack"></view>
  5. <view class="nav-bar-title">选择版本</view>
  6. </view>
  7. <view class="xbb-list-box">
  8. <template v-if="data.banbenList.length">
  9. <view class="xbb-item-box" v-for="item in data.banbenList" :key="item.id" @click="handleSelect(item)">
  10. <!-- 封面 -->
  11. <image class="item-img-box" :src="item.cover" mode=""></image>
  12. <view class="item-content-box">
  13. <!-- 名称+等级 -->
  14. <view class="item-name">{{item.chanpinName}} {{item.dengjiName}}</view>
  15. <!-- 版本名称 -->
  16. <view class="item-bb">{{item.name}}</view>
  17. </view>
  18. <view class="item-play-btn"></view>
  19. </view>
  20. </template>
  21. <template v-else>
  22. <view class="shiti-frame-box">
  23. <view class="ezy-no-sj">
  24. <icon></icon>
  25. <text>暂无数据</text>
  26. </view>
  27. </view>
  28. </template>
  29. </view>
  30. <!-- <CustomTabBar :currentTabNumber="0"></CustomTabBar> -->
  31. </view>
  32. </template>
  33. <script setup>
  34. import {reactive} from "vue";
  35. import {onLoad} from "@dcloudio/uni-app"
  36. import * as shuxueHttp from "@/api/chanpinShuxue.js"
  37. // import CustomTabBar from "@/components/custom-tabbar/custom-tabbar.vue";
  38. import cacheManager from "@/utils/cacheManager.js";
  39. const data = reactive({
  40. dengjiId: null,
  41. banbenList: []
  42. })
  43. function getBanbenList() {
  44. shuxueHttp.getShuxueChanpinBanbenList({dengjiId: data.dengjiId}).then(res => {
  45. data.banbenList = res.data;
  46. })
  47. }
  48. function handleBack() {
  49. uni.switchTab({
  50. url: `/pages/chanpinXuanze/index`
  51. })
  52. }
  53. function handleSelect(item) {
  54. if (cacheManager.get('xuexi-shuxue')) {
  55. console.log('清除xuexi-shuxuexuexi-shuxue');
  56. cacheManager.remove("xuexi-shuxue")
  57. }
  58. /* uni.redirectTo({
  59. url: `/pages/chanpinneirong/index?banbenId=${item.id}&danyuanId=1&customType=3&chanpinId=${item.chanpinId}&dengjiId=${item.dengjiId}`
  60. }) */
  61. const opt = {
  62. banbenId: item.id,
  63. danyuanId:1, // 测试需要固定为 1
  64. chanpinId:item.chanpinId,
  65. dengjiId: item.dengjiId
  66. }
  67. cacheManager.updateObject("auth",{
  68. banbenId:item.id,
  69. chanpinId:item.chanpinId,
  70. dengjiId:item.dengjiId,
  71. })
  72. // 跳转
  73. uni.switchTab({
  74. url: "/pages/chanpinneirong/index"
  75. })
  76. }
  77. onLoad((options) => {
  78. data.dengjiId = options.dengjiId;
  79. getBanbenList();
  80. })
  81. </script>
  82. <style>
  83. </style>