banben.vue 2.8 KB

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