collectById.vue 7.8 KB

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