banben.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. <view class="ezy-text-tab-box">
  9. <view class="text-item active" @click="data.isShangce = true">上册</view>
  10. <view class="text-item" @click="data.isShangce = false">下册</view>
  11. </view>
  12. <template v-if="data.isShangce">
  13. <template v-if="data.banbenList.length">
  14. <view class="xbb-list-box">
  15. <ezyActiveVue class="ezy-list-item-active xbb-item-box" v-for="item in data.banbenList" :key="item.id"
  16. @aclick="handleSelect(item)">
  17. <text class="xbb-item-text">{{item.name}}</text>
  18. <icon class="arrow-icon"></icon>
  19. </ezyActiveVue>
  20. <view class="ezy-no-more xbb-list-no-more">没有更多</view>
  21. </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. </template>
  32. <template v-else>
  33. <template v-if="data.banbenList2.length">
  34. <view class="xbb-list-box">
  35. <ezyActiveVue class="ezy-list-item-active xbb-item-box" v-for="item in data.banbenList" :key="item.id"
  36. @aclick="handleSelect(item)">
  37. <text class="xbb-item-text">{{item.name}}</text>
  38. <icon class="arrow-icon"></icon>
  39. </ezyActiveVue>
  40. <view class="ezy-no-more xbb-list-no-more">没有更多</view>
  41. </view>
  42. </template>
  43. <template v-else>
  44. <view class="shiti-frame-box">
  45. <view class="ezy-no-sj">
  46. <icon></icon>
  47. <text>暂无数据</text>
  48. </view>
  49. </view>
  50. </template>
  51. </template>
  52. </view>
  53. </view>
  54. </template>
  55. <script setup>
  56. import {reactive} from "vue";
  57. import {onLoad} from "@dcloudio/uni-app"
  58. import * as danciHttp from "@/api/chaojidanci.js"
  59. import cacheManager from "@/utils/cacheManager.js";
  60. import ezyActiveVue from "@/components/ezyActive/ezyActive.vue";
  61. const data = reactive({
  62. dengjiId: null,
  63. banbenList: [],
  64. banbenList2: [],
  65. isShangce: true,
  66. })
  67. function getBanbenList() {
  68. danciHttp.getDanciChanpinBanbenList({dengjiId: data.dengjiId}).then(res => {
  69. data.banbenList = res.data.banbenList1;
  70. data.banbenList2 = res.data.banbenList2;
  71. })
  72. }
  73. function handleBack() {
  74. uni.switchTab({
  75. url: `/pages/chanpinXuanze/index`
  76. })
  77. }
  78. function handleSelect(item) {
  79. const opt = {
  80. banbenId: item.id,
  81. }
  82. danciHttp.getDanciChanpinBanbenSave(opt).then(res => {
  83. if (!res.data) { return;}
  84. cacheManager.get('contentInfo') && cacheManager.remove('contentInfo');
  85. // 跳转
  86. uni.switchTab({
  87. url: "/pages/chanpinneirong/index"
  88. })
  89. })
  90. }
  91. onLoad((options) => {
  92. data.dengjiId = options.dengjiId;
  93. getBanbenList();
  94. })
  95. </script>
  96. <style>
  97. </style>