banben.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. <ezyActiveVue class="ezy-list-item-active xbb-item-box" v-for="item in data.banbenList" :key="item.id"
  10. @aclick="handleSelect(item)">
  11. <!-- 封面 -->
  12. <image class="item-img-box" :src="item.cover" mode=""></image>
  13. <view class="item-content-box">
  14. <!-- 名称+等级 -->
  15. <view class="item-name">{{ item.chanpinName }} {{ item.dengjiName }}</view>
  16. <!-- 版本名称 -->
  17. <view class="item-bb">{{ item.name }}</view>
  18. </view>
  19. <view class="item-play-btn"></view>
  20. </ezyActiveVue>
  21. </template>
  22. <template v-else>
  23. <view class="shiti-frame-box">
  24. <view class="ezy-no-sj">
  25. <icon></icon>
  26. <text>暂无数据</text>
  27. </view>
  28. </view>
  29. </template>
  30. </view>
  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 cacheManager from "@/utils/cacheManager.js";
  38. import ezyActiveVue from "@/components/ezyActive/ezyActive.vue";
  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. const opt = {
  55. banbenId: item.id,
  56. }
  57. shuxueHttp.getShuxueChanpinBanbenSave(opt).then(res => {
  58. if (!res.data) { return;}
  59. cacheManager.get('neirong') && cacheManager.remove('neirong');
  60. // 跳转
  61. uni.switchTab({
  62. url: "/pages/chanpinneirong/index"
  63. })
  64. })
  65. }
  66. onLoad((options) => {
  67. data.dengjiId = options.dengjiId;
  68. getBanbenList();
  69. })
  70. </script>
  71. <style>
  72. </style>