collect.vue 10 KB

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