collect.vue 8.1 KB

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