banben.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <view class="ezy-cjdc-xbb-page">
  3. <view class="icon-title-navBar-box">
  4. <view class="nav-bar-icon" @click="handleBack"></view>
  5. <view class="nav-bar-title">选择版本-L6</view>
  6. </view>
  7. <view class="ezy-page-body">
  8. <template v-if="data.banbenList.length">
  9. <view class="xbb-list-box">
  10. <ezyActiveVue class="ezy-list-item-active xbb-item-box" v-for="item in data.banbenList" :key="item.id"
  11. @aclick="handleSelect(item)">
  12. <text class="book-text">{{item.name}}</text>
  13. <icon class="arrow-icon"></icon>
  14. </ezyActiveVue>
  15. </view>
  16. <view class="ezy-no-more">没有更多</view>
  17. </template>
  18. <template v-else>
  19. <view class="shiti-frame-box">
  20. <view class="ezy-no-sj">
  21. <icon></icon>
  22. <text>暂无数据</text>
  23. </view>
  24. </view>
  25. </template>
  26. </view>
  27. </view>
  28. </template>
  29. <script setup>
  30. import {reactive} from "vue";
  31. import {onLoad} from "@dcloudio/uni-app"
  32. import * as shuxueHttp from "@/api/chanpinShuxue.js"
  33. import cacheManager from "@/utils/cacheManager.js";
  34. import ezyActiveVue from "@/components/ezyActive/ezyActive.vue";
  35. const data = reactive({
  36. dengjiId: null,
  37. banbenList: []
  38. })
  39. function getBanbenList() {
  40. shuxueHttp.getShuxueChanpinBanbenList({dengjiId: data.dengjiId}).then(res => {
  41. data.banbenList = res.data;
  42. })
  43. }
  44. function handleBack() {
  45. uni.switchTab({
  46. url: `/pages/chanpinXuanze/index`
  47. })
  48. }
  49. function handleSelect(item) {
  50. const opt = {
  51. banbenId: item.id,
  52. }
  53. shuxueHttp.getShuxueChanpinBanbenSave(opt).then(res => {
  54. if (!res.data) { return;}
  55. cacheManager.get('contentInfo') && cacheManager.remove('contentInfo');
  56. // 跳转
  57. uni.switchTab({
  58. url: "/pages/chanpinneirong/index"
  59. })
  60. })
  61. }
  62. onLoad((options) => {
  63. data.dengjiId = options.dengjiId;
  64. getBanbenList();
  65. })
  66. </script>
  67. <style>
  68. </style>