collect.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  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. paperid:''
  96. };
  97. },
  98. onPullDownRefresh() {},
  99. onLoad(option) {
  100. this.listGoodsUserQuestion();
  101. this.examaperList();
  102. this.getData();
  103. uni.getSystemInfo({
  104. success:(e) => {
  105. let info = uni.createSelectorQuery().select(".nav");
  106. info.boundingClientRect((navData) => { //data - 各种参数
  107. let info = uni.createSelectorQuery().select(".sceenBox");
  108. info.boundingClientRect((tabData) => { //data - 各种参数
  109. this.modalTop = navData.height + tabData.height
  110. console.log(navData) // 获取元素宽度
  111. console.log(tabData) // 获取元素宽度
  112. }).exec()
  113. }).exec()
  114. }
  115. })
  116. },
  117. methods: {
  118. getData() {
  119. if(this.type == 1) {
  120. this.goodsCollectExamList()
  121. } else if(this.type == 2) {
  122. this.collectQuestionTypeList();
  123. }
  124. },
  125. examaperList() {
  126. this.$api.examaperList({
  127. }).then(res => {
  128. this.scennList2 = [...this.scennList2,...res.data.rows];
  129. })
  130. },
  131. listGoodsUserQuestion() {
  132. this.$api.listGoodsUserQuestion({
  133. }).then(res => {
  134. this.scennList1 = [...this.scennList1,...res.data.rows];
  135. })
  136. },
  137. goodsCollectExamList() {
  138. this.$api.goodsCollectExamList({
  139. paperId:this.paperid,
  140. goodsId:this.goodsid
  141. }).then(res => {
  142. this.testList = res.data
  143. let total = 0;
  144. this.testList.rows.forEach(item => {
  145. total += item.questionNum;
  146. })
  147. this.total = total
  148. })
  149. },
  150. collectQuestionTypeList() {
  151. this.$api.collectQuestionTypeList({
  152. paperId:this.paperid,
  153. goodsId:this.goodsid
  154. }).then(res => {
  155. this.typeList = res.data
  156. let total = 0;
  157. this.typeList.rows.forEach(item => {
  158. total += item.num;
  159. })
  160. this.total = total
  161. })
  162. },
  163. showSceen(type){
  164. if(this.sceenType == type) {
  165. this.sceenType = null
  166. return;
  167. }
  168. this.sceenType = type
  169. },
  170. /**
  171. * @param {Object} tab切换
  172. */
  173. selectType(type) {
  174. this.type = type;
  175. this.getData();
  176. },
  177. hideSceen(){
  178. this.sceenType = null
  179. },
  180. choseRecord(index) {
  181. this.sceenType = null
  182. this.scennList1.forEach((item,idx)=>{
  183. this.$set(item, 'checked',false)
  184. if(index==idx){
  185. this.goodsid = item.goodsId
  186. this.$set(item, 'checked',true)
  187. }
  188. })
  189. this.getData()
  190. },
  191. choseType(index) {
  192. this.sceenType = null
  193. this.scennList2.forEach((item,idx)=>{
  194. this.$set(item, 'checked',false)
  195. if(index==idx){
  196. this.paperid = item.paperId
  197. this.$set(item, 'checked',true)
  198. }
  199. })
  200. this.getData()
  201. },
  202. }
  203. };
  204. </script>
  205. <style lang="scss">
  206. page {
  207. background: #EAEEF1;
  208. }
  209. </style>
  210. <style scoped lang="scss">
  211. .animals{
  212. transition: all 0.3s;
  213. transform: rotate(180deg);
  214. }
  215. .sceenBox {
  216. width:100%;
  217. height: 80rpx;
  218. background: #FFFFFF;
  219. display: flex;
  220. justify-content: center;
  221. align-items: center;
  222. font-size: 32rpx;
  223. font-family: PingFang SC;
  224. font-weight: 500;
  225. color: #999999;
  226. position: fixed;
  227. z-index: 999;
  228. border-bottom: 1px solid #eee;
  229. .item{
  230. flex:1;
  231. text-align: center;
  232. &.active{
  233. color:#333;
  234. font-weight: bold;
  235. .icon{
  236. transform: rotate(180deg);
  237. }
  238. }
  239. }
  240. }
  241. .sceenModel{
  242. left:0;
  243. bottom:0;
  244. width:100%;
  245. position: fixed;
  246. z-index: 998;
  247. .sceenModelBg{
  248. width:100%;
  249. height:100%;
  250. position: fixed;
  251. background: rgba(0,0,0,.3);
  252. z-index: 998;
  253. }
  254. .sceenMain{
  255. position: relative;
  256. z-index: 999;
  257. background: #fff;
  258. height:80%;
  259. .sceenMainContent {
  260. display: flex;
  261. flex-wrap: wrap;
  262. padding: 8rpx;
  263. justify-content: space-between;
  264. .item{
  265. width: 350rpx;
  266. background: #F5F5F5;
  267. border-radius: 16rpx;
  268. padding: 25rpx 19rpx;
  269. margin: 8rpx;
  270. font-size: 32rpx;
  271. font-family: PingFang SC;
  272. font-weight: bold;
  273. color: #666666;
  274. &.active{
  275. background: #007AFF;
  276. color:#fff;
  277. }
  278. &:first-child{
  279. width:100%;
  280. text-align: center;
  281. }
  282. }
  283. }
  284. }
  285. }
  286. .wrap{
  287. padding:96rpx 16rpx 16rpx;
  288. }
  289. .wrongHead{
  290. background: #FFFFFF;
  291. border-radius: 16px;
  292. padding:24rpx;
  293. .title{
  294. font-size: 30rpx;
  295. font-family: PingFang SC;
  296. font-weight: bold;
  297. color: #333333;
  298. .sub{
  299. font-size: 20rpx;
  300. font-weight: 500;
  301. color: #999999;
  302. }
  303. }
  304. .progress{
  305. width: 180rpx;
  306. height: 180rpx;
  307. line-height: 140rpx;
  308. border: 20rpx solid #EEEEEE;
  309. border-radius: 50%;
  310. margin: 24rpx auto;
  311. font-size: 50rpx;
  312. text-align: center;
  313. }
  314. }
  315. .wrongTab{
  316. display: flex;
  317. margin: 24rpx 0;
  318. .item{
  319. width: 144rpx;
  320. height: 48rpx;
  321. line-height: 48rpx;
  322. text-align: center;
  323. background: #fff;
  324. border-radius: 16px;
  325. font-size: 28rpx;
  326. font-family: PingFang SC;
  327. font-weight: 500;
  328. color: #666666;
  329. margin-left: 15rpx;
  330. &.active{
  331. background: #007AFF;
  332. color: #fff;
  333. }
  334. }
  335. }
  336. .wrongList{
  337. margin-top:20rpx;
  338. .item{;
  339. background: #FFFFFF;
  340. border-radius: 16rpx;
  341. padding: 0 30rpx;
  342. margin-bottom: 16rpx;
  343. overflow: hidden;
  344. .title{
  345. font-size: 32rpx;
  346. font-family: PingFang SC;
  347. font-weight: bold;
  348. color: #333333;
  349. margin: 40rpx 0 17rpx;
  350. }
  351. .bt{
  352. display: flex;
  353. justify-content: space-between;
  354. align-items: center;
  355. padding-bottom: 24rpx;
  356. .left{
  357. width: 176rpx;
  358. height: 40rpx;
  359. background: #FFFFFF;
  360. border: 1px solid #EEEEEE;
  361. border-radius: 16rpx;
  362. font-size: 26rpx;
  363. font-family: PingFang SC;
  364. font-weight: 500;
  365. color: #999999;
  366. display: flex;
  367. justify-content: center;
  368. align-items: center;
  369. .num{
  370. font-size: 26rpx;
  371. font-weight: bold;
  372. color: #FF3B30;
  373. margin-left: 16rpx;
  374. }
  375. }
  376. .right{
  377. display: flex;
  378. .btn{
  379. width: 100rpx;
  380. height: 48rpx;
  381. background: #FFFFFF;
  382. border: 1px solid #007AFF;
  383. border-radius: 16px;
  384. font-size: 24rpx;
  385. font-family: PingFang SC;
  386. font-weight: 500;
  387. color: #007AFF;
  388. margin-left:9rpx;
  389. display: flex;
  390. align-items: center;
  391. justify-content: center;
  392. }
  393. }
  394. }
  395. }
  396. }
  397. </style>