banben.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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">选择版本-L{{ data.dengjiId }}</view>
  6. </view>
  7. <view class="ezy-page-body">
  8. <view class="ezy-text-tab-box">
  9. <ezyActiveVue class="text-item" @click="handleSelectShangce" :class="{active: data.isShangce}">上册</ezyActiveVue>
  10. <ezyActiveVue class="text-item" @click="handleSelectXiace" :class="{active: !data.isShangce}">下册</ezyActiveVue>
  11. </view>
  12. <template v-if="data.isShangce" >
  13. <template v-if="data.banbenList.length">
  14. <view class="xbb-list-box" key="1">
  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" key="2">
  35. <ezyActiveVue class="ezy-list-item-active xbb-item-box" v-for="item in data.banbenList2" :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 handleSelectShangce() {
  68. data.isShangce = true;
  69. uni.showLoading({
  70. title: '加载中',
  71. mask: true
  72. })
  73. setTimeout(function () {
  74. uni.hideLoading();
  75. }, 200);
  76. }
  77. function handleSelectXiace() {
  78. data.isShangce = false
  79. uni.showLoading({
  80. title: '加载中',
  81. mask: true
  82. })
  83. setTimeout(function () {
  84. uni.hideLoading();
  85. }, 200);
  86. }
  87. function getBanbenList() {
  88. danciHttp.getDanciChanpinBanbenList({dengjiId: data.dengjiId}).then(res => {
  89. data.banbenList = res.data.banbenList1;
  90. data.banbenList2 = res.data.banbenList2;
  91. })
  92. }
  93. function handleBack() {
  94. uni.switchTab({
  95. url: `/pages/chanpinXuanze/index`
  96. })
  97. }
  98. function handleSelect(item) {
  99. const opt = {
  100. banbenId: item.id,
  101. }
  102. danciHttp.getDanciChanpinBanbenSave(opt).then(res => {
  103. if (!res.data) { return;}
  104. cacheManager.get('contentInfo') && cacheManager.remove('contentInfo');
  105. // 跳转
  106. uni.switchTab({
  107. url: "/pages/chanpinneirong/index"
  108. })
  109. })
  110. }
  111. onLoad((options) => {
  112. data.dengjiId = options.dengjiId;
  113. getBanbenList();
  114. })
  115. </script>
  116. <style>
  117. </style>