|
|
@@ -1,38 +1,38 @@
|
|
|
<template>
|
|
|
<view class="ezy-jstx-ziliao-page">
|
|
|
<view class="icon-title-navBar-box">
|
|
|
+ <view @click="handleBack" class="nav-bar-icon"></view>
|
|
|
<text class="nav-bar-title">{{data.ziliaoName}}</text>
|
|
|
</view>
|
|
|
- <!--<view class="ezy-page-body">
|
|
|
- <scroll-view scroll-y="true" class="level-list-container">
|
|
|
- <view v-for="(item, index) in data.dengjiList" :key="item.dengjiId" class="level-item">
|
|
|
- <view class="level-item-content">
|
|
|
- <!– 图标 –>
|
|
|
- <view @click="selectDjBtn(item)"
|
|
|
- :class="{active: item.dengjiId == data.dengjiActiveSelect}">{{ item.dengjiName }}</view>
|
|
|
-
|
|
|
- <view>
|
|
|
- <view class="ziliao-card-box">
|
|
|
- <!– <img/> –>
|
|
|
- <!– 内容区 –>
|
|
|
- <view class="content-box">
|
|
|
- <text class="title">{{ ziliaoName }}</text>
|
|
|
- <text class="version">{{ getFirstVersion(item.banbenList) }}</text>
|
|
|
- </view>
|
|
|
-
|
|
|
- <!– PDF 按钮 –>
|
|
|
- <view class="pdf-btn">
|
|
|
- <icon>PDF</icon>
|
|
|
- </view>
|
|
|
- </view>
|
|
|
-
|
|
|
- </view>
|
|
|
-
|
|
|
+ <view class="ezy-page-body jstx-body">
|
|
|
+ <view class="jstx-body-title"></view>
|
|
|
+ <!-- 资料等级标签切换 -->
|
|
|
+ <view class="jstx-tab-box">
|
|
|
+ <view v-if="data.dengjiList.length > 0" v-for="(item, index) in data.dengjiList" :key="item.dengjiId" @click="zldjBtn(item,index)"
|
|
|
+ class="tab-item" :class="{active: item.dengjiId == data.dengjiActiveSelect}">{{ item.dengjiName }}</view>
|
|
|
+ </view>
|
|
|
+ <!-- 版本卡片列表 -->
|
|
|
+ <view v-if="data.banbenList.length > 0" class="jstx-card-list">
|
|
|
+ <view v-for="(bbItem, index) in data.banbenList" :key="bbItem.banbenId"
|
|
|
+ @click="cardBtn(bbItem)" class="ziliao-card-box">
|
|
|
+ <!-- <img/> -->
|
|
|
+ <img :src="bbItem.cover" class="card-img"/>
|
|
|
+ <!-- 内容区 -->
|
|
|
+ <view class="card-content-box">
|
|
|
+ <view class="ziliao-name">{{ bbItem.ziliaoName }}</view>
|
|
|
+ <view class="banben-name">{{ bbItem.banbenName}}</view>
|
|
|
</view>
|
|
|
+ <icon class="card-icon"></icon>
|
|
|
</view>
|
|
|
- </scroll-view>
|
|
|
- </view>-->
|
|
|
- <!--<jstxDownDialog ref="jiaocaiRef" @confirm-btn="jcConfirm" :content="jcContent"></jstxDownDialog>-->
|
|
|
+ </view>
|
|
|
+ <!-- 无数据提示 -->
|
|
|
+ <view class="ezy-no-sj" v-else>
|
|
|
+ <icon></icon>
|
|
|
+ <text>暂无数据</text>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ <!-- 下载弹窗 -->
|
|
|
+ <jstxDownDialog ref="jstxDownRef" @confirm-btn="jstxDialogConfirm" :content="data.jcContent"></jstxDownDialog>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -46,33 +46,88 @@ const data = reactive({
|
|
|
ziliaoName: '',
|
|
|
dengjiList: [],
|
|
|
dengjiActiveSelect: '',
|
|
|
+ dengjiActiveSelectName: '',
|
|
|
+ banbenList: [],
|
|
|
+ banbenId: '',
|
|
|
+ jcContent: '',
|
|
|
})
|
|
|
+const jstxDownRef = ref(null);
|
|
|
|
|
|
+function handleBack() {
|
|
|
+ uni.switchTab({
|
|
|
+ url: '/pages/chanpinZiliao/index'
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
// jisuantexun Info data
|
|
|
function getJisuanInfo() {
|
|
|
jisuanInfo({ziliaoId:data.id}).then(res => {
|
|
|
data.ziliaoName = res.data.ziliaoName;
|
|
|
data.dengjiList = res.data.dengjiList;
|
|
|
- // 默认为等级list中第一个
|
|
|
- data.dengjiActiveSelect = res.data.dengjiList[0].dengjiId;
|
|
|
+ // 默认加载第一个资料等级的数据
|
|
|
+ const firstLevel = data.dengjiList[0];
|
|
|
+ data.dengjiActiveSelect = firstLevel.dengjiId;
|
|
|
+ data.dengjiActiveSelectName = firstLevel.dengjiName;
|
|
|
+ data.banbenList = firstLevel.banbenList || [];
|
|
|
+ }).catch(err => {
|
|
|
+ uni.showToast({ title: '加载失败,请稍后重试', icon: 'none' });
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-// 获取第一个版本名称
|
|
|
-function getFirstVersion(banbenList) {
|
|
|
- if (banbenList && banbenList.length > 0) {
|
|
|
- return banbenList[0].banbenName;
|
|
|
- }
|
|
|
- return '未知版本';
|
|
|
+// tab切换资料登记
|
|
|
+function zldjBtn(item,index){
|
|
|
+ data.dengjiActiveSelect = item.dengjiId;
|
|
|
+ data.dengjiActiveSelectName = item.dengjiName;
|
|
|
+ data.banbenList = data.dengjiList[index].banbenList;
|
|
|
}
|
|
|
|
|
|
-function selectDjBtn(item){
|
|
|
- data.dengjiActiveSelect = item.dengjiId
|
|
|
+// card点击
|
|
|
+function cardBtn(bbItem) {
|
|
|
+ // 确认逻辑
|
|
|
+ data.banbenId = bbItem.banbenId;
|
|
|
+ data.jcContent = "鹅状元将为您随机生成"+ data.dengjiActiveSelectName +"《" + bbItem.banbenName + "》100道试题。"
|
|
|
+ jstxDownRef.value.handleShow();
|
|
|
}
|
|
|
|
|
|
+// 弹窗确认
|
|
|
+function jstxDialogConfirm() {
|
|
|
+ uni.showLoading({ title: '正在生成试题...' });
|
|
|
+ jisuanPdf({
|
|
|
+ banbenId:data.banbenId,
|
|
|
+ }).then(res1 => {
|
|
|
+ const url = res1.data;
|
|
|
+ if (!url) {
|
|
|
+ uni.showToast({ title: '未获取到文件地址', icon: 'none' });
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ uni.downloadFile({
|
|
|
+ url,
|
|
|
+ success: function (res) {
|
|
|
+ var filePath = res.tempFilePath;
|
|
|
+ uni.openDocument({
|
|
|
+ filePath: filePath,
|
|
|
+ showMenu: true,
|
|
|
+ success: function (res) {
|
|
|
+ jstxDownRef.value.handleClose();
|
|
|
+ },
|
|
|
+ fail: () => {
|
|
|
+ uni.showToast({ title: '无法打开文件', icon: 'none' });
|
|
|
+ },
|
|
|
+ complete: () => {
|
|
|
+ uni.hideLoading();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }).catch(err => {
|
|
|
+ uni.showToast({ title: '生成失败,请稍后重试', icon: 'none' });
|
|
|
+ uni.hideLoading();
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
onLoad((options) => {
|
|
|
data.id = options.ziliaoId;
|
|
|
- console.log('options',options);
|
|
|
getJisuanInfo()
|
|
|
})
|
|
|
</script>
|