collect.vue 8.5 KB

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