banben.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. <view class="ezy-no-more">没有更多</view>
  22. </template>
  23. <template v-else>
  24. <view class="shiti-frame-box">
  25. <view class="ezy-no-sj">
  26. <icon></icon>
  27. <text>暂无数据</text>
  28. </view>
  29. </view>
  30. </template>
  31. </view>
  32. </view>
  33. </template>
  34. <script setup>
  35. import {reactive} from "vue";
  36. import {onLoad} from "@dcloudio/uni-app"
  37. import * as pinduHttp from "@/api/chanpinZiRanPinDu.js"
  38. import cacheManager from "@/utils/cacheManager.js";
  39. import ezyActiveVue from "@/components/ezyActive/ezyActive.vue";
  40. const data = reactive({
  41. dengjiId: null,
  42. banbenList: []
  43. })
  44. function getBanbenList() {
  45. pinduHttp.getPinduChanpinBanbenList({dengjiId: data.dengjiId}).then(res => {
  46. data.banbenList = res.data;
  47. })
  48. }
  49. function handleBack() {
  50. uni.switchTab({
  51. url: `/pages/chanpinXuanze/index`
  52. })
  53. }
  54. function handleSelect(item) {
  55. const opt = {
  56. banbenId: item.id,
  57. }
  58. pinduHttp.getPinduChanpinBanbenSave(opt).then(res => {
  59. if (!res.data) { return;}
  60. cacheManager.get('contentInfo') && cacheManager.remove('contentInfo');
  61. // 跳转
  62. uni.switchTab({
  63. url: "/pages/chanpinneirong/index"
  64. })
  65. })
  66. }
  67. onLoad((options) => {
  68. data.dengjiId = options.dengjiId;
  69. getBanbenList();
  70. })
  71. </script>
  72. <style>
  73. </style>