collect.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426
  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'">
  41. <view class="btn">重做</view>
  42. </navigator>
  43. <navigator hover-class="none" :url="'/pages2/subject/collectBank?examId='+item.examId+'&explain=1' + '&distinction=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/collectBank?type='+item.type + '&distinction=2'">
  64. <view class="btn">重做</view>
  65. </navigator>
  66. <navigator hover-class="none" :url="'/pages2/subject/collectBank?type='+item.type+'&explain=1' + '&distinction=2'">
  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. this.$api.collectQuestionTypeList({
  163. paperId:this.paperid,
  164. orderGoodsId:this.orderGoodsId
  165. }).then(res => {
  166. this.typeList = res.data
  167. let total = 0;
  168. this.typeList.rows.forEach(item => {
  169. total += item.num;
  170. })
  171. this.total = total
  172. })
  173. },
  174. showSceen(type){
  175. if(this.sceenType == type) {
  176. this.sceenType = null
  177. return;
  178. }
  179. this.sceenType = type
  180. },
  181. /**
  182. * @param {Object} tab切换
  183. */
  184. selectType(type) {
  185. this.type = type;
  186. this.getData();
  187. },
  188. hideSceen(){
  189. this.sceenType = null
  190. },
  191. choseRecord(index) {
  192. this.sceenType = null
  193. this.scennList1.forEach((item,idx)=>{
  194. this.$set(item, 'checked',false)
  195. if(index==idx){
  196. this.goodsid = item.goodsId
  197. this.$set(item, 'checked',true)
  198. }
  199. })
  200. this.getData()
  201. },
  202. choseType(index) {
  203. this.sceenType = null
  204. this.scennList2.forEach((item,idx)=>{
  205. this.$set(item, 'checked',false)
  206. if(index==idx){
  207. this.paperid = item.paperId
  208. this.$set(item, 'checked',true)
  209. }
  210. })
  211. this.getData()
  212. },
  213. }
  214. };
  215. </script>
  216. <style lang="scss">
  217. page {
  218. background: #EAEEF1;
  219. }
  220. </style>
  221. <style scoped lang="scss">
  222. .animals{
  223. transition: all 0.3s;
  224. transform: rotate(180deg);
  225. }
  226. .sceenBox {
  227. width:100%;
  228. height: 80rpx;
  229. background: #FFFFFF;
  230. display: flex;
  231. justify-content: center;
  232. align-items: center;
  233. font-size: 32rpx;
  234. font-family: PingFang SC;
  235. font-weight: 500;
  236. color: #999999;
  237. position: fixed;
  238. z-index: 999;
  239. border-bottom: 1px solid #eee;
  240. .item{
  241. flex:1;
  242. text-align: center;
  243. &.active{
  244. color:#333;
  245. font-weight: bold;
  246. .icon{
  247. transform: rotate(180deg);
  248. }
  249. }
  250. }
  251. }
  252. .sceenModel{
  253. left:0;
  254. bottom:0;
  255. width:100%;
  256. position: fixed;
  257. z-index: 998;
  258. .sceenModelBg{
  259. width:100%;
  260. height:100%;
  261. position: fixed;
  262. background: rgba(0,0,0,.3);
  263. z-index: 998;
  264. }
  265. .sceenMain{
  266. position: relative;
  267. z-index: 999;
  268. background: #fff;
  269. height:80%;
  270. .sceenMainContent {
  271. display: flex;
  272. flex-wrap: wrap;
  273. padding: 8rpx;
  274. justify-content: space-between;
  275. .item{
  276. width: 350rpx;
  277. background: #F5F5F5;
  278. border-radius: 16rpx;
  279. padding: 25rpx 19rpx;
  280. margin: 8rpx;
  281. font-size: 32rpx;
  282. font-family: PingFang SC;
  283. font-weight: bold;
  284. color: #666666;
  285. &.active{
  286. background: #007AFF;
  287. color:#fff;
  288. }
  289. &:first-child{
  290. width:100%;
  291. text-align: center;
  292. }
  293. }
  294. }
  295. }
  296. }
  297. .wrap{
  298. padding:96rpx 16rpx 16rpx;
  299. }
  300. .wrongHead{
  301. background: #FFFFFF;
  302. border-radius: 16px;
  303. padding:24rpx;
  304. .title{
  305. font-size: 30rpx;
  306. font-family: PingFang SC;
  307. font-weight: bold;
  308. color: #333333;
  309. .sub{
  310. font-size: 20rpx;
  311. font-weight: 500;
  312. color: #999999;
  313. }
  314. }
  315. .progress{
  316. width: 180rpx;
  317. height: 180rpx;
  318. line-height: 140rpx;
  319. border: 20rpx solid #EEEEEE;
  320. border-radius: 50%;
  321. margin: 24rpx auto;
  322. font-size: 50rpx;
  323. text-align: center;
  324. }
  325. }
  326. .wrongTab{
  327. display: flex;
  328. margin: 24rpx 0;
  329. .item{
  330. width: 144rpx;
  331. height: 48rpx;
  332. line-height: 48rpx;
  333. text-align: center;
  334. background: #fff;
  335. border-radius: 16px;
  336. font-size: 28rpx;
  337. font-family: PingFang SC;
  338. font-weight: 500;
  339. color: #666666;
  340. margin-left: 15rpx;
  341. &.active{
  342. background: #007AFF;
  343. color: #fff;
  344. }
  345. }
  346. }
  347. .wrongList{
  348. margin-top:20rpx;
  349. .item{
  350. background: #FFFFFF;
  351. border-radius: 16rpx;
  352. padding: 0 30rpx;
  353. margin-bottom: 16rpx;
  354. overflow: hidden;
  355. .title{
  356. font-size: 32rpx;
  357. font-family: PingFang SC;
  358. font-weight: bold;
  359. color: #333333;
  360. margin: 40rpx 0 17rpx;
  361. }
  362. .bt{
  363. display: flex;
  364. justify-content: space-between;
  365. align-items: center;
  366. padding-bottom: 24rpx;
  367. .left{
  368. width: 176rpx;
  369. height: 40rpx;
  370. background: #FFFFFF;
  371. border: 1px solid #EEEEEE;
  372. border-radius: 16rpx;
  373. font-size: 26rpx;
  374. font-family: PingFang SC;
  375. font-weight: 500;
  376. color: #999999;
  377. display: flex;
  378. justify-content: center;
  379. align-items: center;
  380. .num{
  381. font-size: 26rpx;
  382. font-weight: bold;
  383. color: #FF3B30;
  384. margin-left: 16rpx;
  385. }
  386. }
  387. .right{
  388. display: flex;
  389. .btn{
  390. width: 100rpx;
  391. height: 48rpx;
  392. background: #FFFFFF;
  393. border: 1px solid #007AFF;
  394. border-radius: 16px;
  395. font-size: 24rpx;
  396. font-family: PingFang SC;
  397. font-weight: 500;
  398. color: #007AFF;
  399. margin-left:9rpx;
  400. display: flex;
  401. align-items: center;
  402. justify-content: center;
  403. }
  404. }
  405. }
  406. }
  407. }
  408. </style>