collectById.vue 7.5 KB

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