collect.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430
  1. <template>
  2. <view class="safeArea">
  3. <nav-bar title="收藏集" class="nav"></nav-bar>
  4. <view class="sceenBox">
  5. <view :class="['item', {'active':sceenType===1} ]" @click="showSceen(1)">全部题库记录<u-icon class="icon" :class="sceenType ===1 ? 'animals':''" name="arrow-down"></u-icon></view>
  6. <view :class="['item', {'active':sceenType===2} ]" @click="showSceen(2)">全部试卷类型<u-icon class="icon" :class="sceenType ===2 ? 'animals':''" name="arrow-down"></u-icon></view>
  7. </view>
  8. <view class="sceenModel" v-if="sceenType" :style="{top:modalTop+'px'}" >
  9. <view class="sceenModelBg" @click="hideSceen"></view>
  10. <view class="sceenMain" >
  11. <scroll-view scroll-y="true" style="height:100%">
  12. <div class="sceenMainContent">
  13. <template v-if="sceenType===1">
  14. <view :class="['item',{'active':item.checked}]" v-for="(item, index) in scennList1" :key="index" @click="choseRecord(index)">{{item.goodsName}}</view>
  15. </template>
  16. <template v-if="sceenType===2">
  17. <view :class="['item',{'active':item.checked}]" v-for="(item, index) in scennList2" :key="index" @click="choseType(index)">{{item.paperName}}</view>
  18. </template>
  19. </div>
  20. </scroll-view>
  21. </view>
  22. </view>
  23. <view class="wrap">
  24. <view class="wrongTab">
  25. <view class="item" :class="{active:type == 1}" @click="selectType(1)">试卷归类</view>
  26. <view class="item" :class="{active:type == 2}" @click="selectType(2)">题型归类</view>
  27. </view>
  28. <view class="wrongHead">
  29. <view class="title">收藏统计</view>
  30. <view class="progress">
  31. <text>{{total}}</text>
  32. </view>
  33. </view>
  34. <view class="wrongList" v-if="type == 1">
  35. <view class="item" v-for="(item,index) in testList.rows" :key="index">
  36. <view class="title">{{item.examName}}</view>
  37. <view class="bt">
  38. <view class="left">收藏数<text class="num">{{item.questionNum}}</text></view>
  39. <view class="right">
  40. <navigator hover-class="none" :url="'/pages2/subject/collectBank?id='+item.examId">
  41. <view class="btn">重做</view>
  42. </navigator>
  43. <navigator hover-class="none" :url="'/pages2/subject/collectBank?id='+item.examId+'&explain=1'">
  44. <view class="btn">解析</view>
  45. </navigator>
  46. <!-- <view class="btn">解析</view> -->
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <view class="wrongList" v-if="type == 2">
  52. <view class="item" v-for="(item,index) in typeList.rows" :key="index">
  53. <view class="title">
  54. <text v-if="item.type==1">单选题</text>
  55. <text v-if="item.type==2">多选题</text>
  56. <text v-if="item.type==3">判断题</text>
  57. <text v-if="item.type==4">案例题</text>
  58. <text v-if="item.type==5">简答题</text>
  59. </view>
  60. <view class="bt">
  61. <view class="left">收藏数<text class="num">{{item.num}}</text></view>
  62. <view class="right">
  63. <navigator hover-class="none" :url="'/pages2/subject/collectTypeBank?type='+item.type">
  64. <view class="btn">重做</view>
  65. </navigator>
  66. <navigator hover-class="none" :url="'/pages2/subject/collectTypeBank?type='+item.type+'&explain=1'">
  67. <view class="btn">解析</view>
  68. </navigator>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </view>
  75. </template>
  76. <script>
  77. import { mapGetters } from 'vuex';
  78. export default {
  79. components: {},
  80. data() {
  81. return {
  82. sceenType: null,
  83. scennList1:[
  84. {goodsId: '', goodsName: '全部题库记录', checked: true}
  85. ],
  86. scennList2:[
  87. {paperId: '', paperName: '全部试卷类型', checked: true}
  88. ],
  89. type:1,
  90. total:0,
  91. modalTop:0,
  92. testList:[],
  93. typeList:[],
  94. goodsid:'',
  95. orderGoodsId:'',
  96. businessId:'',
  97. educationTypeId:'',
  98. projectId:'',
  99. paperid:''
  100. };
  101. },
  102. onPullDownRefresh() {},
  103. onLoad(option) {
  104. this.businessId = option.businessId || ''
  105. this.educationTypeId = option.educationId || ''
  106. this.projectId = option.projectId || '';
  107. this.orderGoodsId = option.orderGoodsId || '';
  108. this.listGoodsUserQuestion();
  109. this.examaperList();
  110. this.getData();
  111. uni.getSystemInfo({
  112. success:(e) => {
  113. let info = uni.createSelectorQuery().select(".nav");
  114. info.boundingClientRect((navData) => { //data - 各种参数
  115. let info = uni.createSelectorQuery().select(".sceenBox");
  116. info.boundingClientRect((tabData) => { //data - 各种参数
  117. this.modalTop = navData.height + tabData.height
  118. console.log(navData) // 获取元素宽度
  119. console.log(tabData) // 获取元素宽度
  120. }).exec()
  121. }).exec()
  122. }
  123. })
  124. },
  125. methods: {
  126. getData() {
  127. if(this.type == 1) {
  128. this.goodsCollectExamList()
  129. } else if(this.type == 2) {
  130. this.collectQuestionTypeList();
  131. }
  132. },
  133. examaperList() {
  134. this.$api.examaperList({
  135. }).then(res => {
  136. this.scennList2 = [...this.scennList2,...res.data.rows];
  137. })
  138. },
  139. listGoodsUserQuestion() {
  140. this.$api.listGoodsUserQuestion({
  141. }).then(res => {
  142. this.scennList1 = [...this.scennList1,...res.data.rows];
  143. })
  144. },
  145. goodsCollectExamList() {
  146. this.$api.goodsCollectExamList({
  147. paperId:this.paperid,
  148. goodsId:this.goodsid,
  149. orderGoodsId:this.orderGoodsId,
  150. businessId:this.businessId,
  151. educationTypeId:this.educationTypeId,
  152. projectId:this.projectId
  153. }).then(res => {
  154. this.testList = res.data
  155. let total = 0;
  156. this.testList.rows.forEach(item => {
  157. total += item.questionNum;
  158. })
  159. this.total = total
  160. })
  161. },
  162. collectQuestionTypeList() {
  163. this.$api.collectQuestionTypeList({
  164. paperId:this.paperid,
  165. businessId:this.businessId,
  166. educationTypeId:this.educationTypeId,
  167. projectId:this.projectId,
  168. orderGoodsId:this.orderGoodsId
  169. }).then(res => {
  170. this.typeList = res.data
  171. let total = 0;
  172. this.typeList.rows.forEach(item => {
  173. total += item.num;
  174. })
  175. this.total = total
  176. })
  177. },
  178. showSceen(type){
  179. if(this.sceenType == type) {
  180. this.sceenType = null
  181. return;
  182. }
  183. this.sceenType = type
  184. },
  185. /**
  186. * @param {Object} tab切换
  187. */
  188. selectType(type) {
  189. this.type = type;
  190. this.getData();
  191. },
  192. hideSceen(){
  193. this.sceenType = null
  194. },
  195. choseRecord(index) {
  196. this.sceenType = null
  197. this.scennList1.forEach((item,idx)=>{
  198. this.$set(item, 'checked',false)
  199. if(index==idx){
  200. this.goodsid = item.goodsId
  201. this.$set(item, 'checked',true)
  202. }
  203. })
  204. this.getData()
  205. },
  206. choseType(index) {
  207. this.sceenType = null
  208. this.scennList2.forEach((item,idx)=>{
  209. this.$set(item, 'checked',false)
  210. if(index==idx){
  211. this.paperid = item.paperId
  212. this.$set(item, 'checked',true)
  213. }
  214. })
  215. this.getData()
  216. },
  217. }
  218. };
  219. </script>
  220. <style lang="scss">
  221. page {
  222. background: #EAEEF1;
  223. }
  224. </style>
  225. <style scoped lang="scss">
  226. .animals{
  227. transition: all 0.3s;
  228. transform: rotate(180deg);
  229. }
  230. .sceenBox {
  231. width:100%;
  232. height: 80rpx;
  233. background: #FFFFFF;
  234. display: flex;
  235. justify-content: center;
  236. align-items: center;
  237. font-size: 32rpx;
  238. font-family: PingFang SC;
  239. font-weight: 500;
  240. color: #999999;
  241. position: fixed;
  242. z-index: 999;
  243. border-bottom: 1px solid #eee;
  244. .item{
  245. flex:1;
  246. text-align: center;
  247. &.active{
  248. color:#333;
  249. font-weight: bold;
  250. .icon{
  251. transform: rotate(180deg);
  252. }
  253. }
  254. }
  255. }
  256. .sceenModel{
  257. left:0;
  258. bottom:0;
  259. width:100%;
  260. position: fixed;
  261. z-index: 998;
  262. .sceenModelBg{
  263. width:100%;
  264. height:100%;
  265. position: fixed;
  266. background: rgba(0,0,0,.3);
  267. z-index: 998;
  268. }
  269. .sceenMain{
  270. position: relative;
  271. z-index: 999;
  272. background: #fff;
  273. height:80%;
  274. .sceenMainContent {
  275. display: flex;
  276. flex-wrap: wrap;
  277. padding: 8rpx;
  278. justify-content: space-between;
  279. .item{
  280. width: 350rpx;
  281. background: #F5F5F5;
  282. border-radius: 16rpx;
  283. padding: 25rpx 19rpx;
  284. margin: 8rpx;
  285. font-size: 32rpx;
  286. font-family: PingFang SC;
  287. font-weight: bold;
  288. color: #666666;
  289. &.active{
  290. background: #007AFF;
  291. color:#fff;
  292. }
  293. &:first-child{
  294. width:100%;
  295. text-align: center;
  296. }
  297. }
  298. }
  299. }
  300. }
  301. .wrap{
  302. padding:96rpx 16rpx 16rpx;
  303. }
  304. .wrongHead{
  305. background: #FFFFFF;
  306. border-radius: 16px;
  307. padding:24rpx;
  308. .title{
  309. font-size: 30rpx;
  310. font-family: PingFang SC;
  311. font-weight: bold;
  312. color: #333333;
  313. .sub{
  314. font-size: 20rpx;
  315. font-weight: 500;
  316. color: #999999;
  317. }
  318. }
  319. .progress{
  320. width: 180rpx;
  321. height: 180rpx;
  322. line-height: 140rpx;
  323. border: 20rpx solid #EEEEEE;
  324. border-radius: 50%;
  325. margin: 24rpx auto;
  326. font-size: 50rpx;
  327. text-align: center;
  328. }
  329. }
  330. .wrongTab{
  331. display: flex;
  332. margin: 24rpx 0;
  333. .item{
  334. width: 144rpx;
  335. height: 48rpx;
  336. line-height: 48rpx;
  337. text-align: center;
  338. background: #fff;
  339. border-radius: 16px;
  340. font-size: 28rpx;
  341. font-family: PingFang SC;
  342. font-weight: 500;
  343. color: #666666;
  344. margin-left: 15rpx;
  345. &.active{
  346. background: #007AFF;
  347. color: #fff;
  348. }
  349. }
  350. }
  351. .wrongList{
  352. margin-top:20rpx;
  353. .item{;
  354. background: #FFFFFF;
  355. border-radius: 16rpx;
  356. padding: 0 30rpx;
  357. margin-bottom: 16rpx;
  358. overflow: hidden;
  359. .title{
  360. font-size: 32rpx;
  361. font-family: PingFang SC;
  362. font-weight: bold;
  363. color: #333333;
  364. margin: 40rpx 0 17rpx;
  365. }
  366. .bt{
  367. display: flex;
  368. justify-content: space-between;
  369. align-items: center;
  370. padding-bottom: 24rpx;
  371. .left{
  372. width: 176rpx;
  373. height: 40rpx;
  374. background: #FFFFFF;
  375. border: 1px solid #EEEEEE;
  376. border-radius: 16rpx;
  377. font-size: 26rpx;
  378. font-family: PingFang SC;
  379. font-weight: 500;
  380. color: #999999;
  381. display: flex;
  382. justify-content: center;
  383. align-items: center;
  384. .num{
  385. font-size: 26rpx;
  386. font-weight: bold;
  387. color: #FF3B30;
  388. margin-left: 16rpx;
  389. }
  390. }
  391. .right{
  392. display: flex;
  393. .btn{
  394. width: 100rpx;
  395. height: 48rpx;
  396. background: #FFFFFF;
  397. border: 1px solid #007AFF;
  398. border-radius: 16px;
  399. font-size: 24rpx;
  400. font-family: PingFang SC;
  401. font-weight: 500;
  402. color: #007AFF;
  403. margin-left:9rpx;
  404. display: flex;
  405. align-items: center;
  406. justify-content: center;
  407. }
  408. }
  409. }
  410. }
  411. }
  412. </style>