question_detail.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  1. <template>
  2. <view>
  3. <view class="top">
  4. <navigator url="/pages2/bank/question_statistics">
  5. <view class="left">
  6. <view class="title">做题统计</view>
  7. <view class="progress">
  8. <view class="item-left">
  9. <view class="desc">
  10. <text>总进度</text>
  11. </view>
  12. <view class="percent">
  13. 68
  14. <text class="per">%</text>
  15. </view>
  16. </view>
  17. <view class="item-right">
  18. <view class='up'>
  19. <text class="orange">58</text>
  20. <text>/100</text>
  21. </view>
  22. <view class='down'>
  23. <text class="orange">已答</text>
  24. <text>/未答</text>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </navigator>
  30. <navigator :url="'/pages2/bank/wrongById?goodsid='+id">
  31. <view class="right">
  32. <view class="title">
  33. 错题集 <u-icon name="arrow-right"></u-icon>
  34. </view>
  35. <view class="number">
  36. {{wrongTotal}}
  37. </view>
  38. </view>
  39. </navigator>
  40. <navigator :url="'/pages2/bank/collectById?goodsid='+id">
  41. <view class="right">
  42. <view class="title">
  43. 收藏集 <u-icon name="arrow-right"></u-icon>
  44. </view>
  45. <view class="number">
  46. {{collectTotal}}
  47. </view>
  48. </view>
  49. </navigator>
  50. </view>
  51. <view class="title-list">
  52. <view class="content">
  53. <view class="list" v-for="(item1,index1) in bankList" :key="index1">
  54. <template v-if="item1.type==1">
  55. <view class="moduleItem" @click="clickModule(item1.majorId,index1)">
  56. <view class="courseName">{{item1.name}}</view>
  57. <view>
  58. <image src="/static/icon/up.png" class="icon_up" v-if="!item1.showList"></image>
  59. <image src="/static/icon/down.png" class="icon_up" v-if="item1.showList"></image>
  60. </view>
  61. </view>
  62. <template v-if="item1.showList">
  63. <view v-for="(item2,index2) in item1.list" :key="index2" >
  64. <view class="section" @click="changeItem(index1,item2.chapterExamId,item1.type)">
  65. <image src="/static/icon/up1.png" class="icon_up" v-if="!item2.showList"></image>
  66. <image src="/static/icon/down1.png" class="icon_up" v-if="item2.showList"></image>
  67. {{item2.name}}
  68. </view>
  69. <view v-if="item2.showList">
  70. <view class="article" :class="{active:index3 == 0}" v-for="(article,index3) in item2.list" :key="index3">
  71. <view class="flex_auto">{{article.examName}}</view>
  72. <navigator :url="'/pages2/bank/questionBank?id='+article.examId+'&goodsid='+goodsData.goodsId">
  73. <view class="btn">做题</view>
  74. </navigator>
  75. </view>
  76. </view>
  77. <u-line></u-line>
  78. </view>
  79. </template>
  80. </template>
  81. <template v-if="item1.type ==2">
  82. <view class="section" @click="changeItem(index1,item1.majorId,item1.type)">
  83. <image src="/static/icon/up1.png" class="icon_up" v-if="!item1.showList"></image>
  84. <image src="/static/icon/down1.png" class="icon_up" v-if="item1.showList"></image>
  85. {{item1.name}}
  86. </view>
  87. <view v-if="item1.showList" >
  88. <view class="article" :class="{active:index2 == 0}" :key="index3" v-for="(article,index2) in item1.list">
  89. <view class="flex_auto">{{item1.name}}</view>
  90. <navigator :url="'/pages2/bank/questionBank?id='+article.majorId+'&goodsid='+goodsData.goodsId">
  91. <view class="btn">做题</view>
  92. </navigator>
  93. </view>
  94. </view>
  95. </template>
  96. <template v-if="item1.type ==3">
  97. <view class="article active" >
  98. <view class="flex_auto">{{item1.name}}</view>
  99. <navigator :url="'/pages2/bank/questionBank?id='+item1.majorId+'&goodsid='+goodsData.goodsId">
  100. <view class="btn">做题</view>
  101. </navigator>
  102. </view>
  103. </template>
  104. </view>
  105. </view>
  106. </view>
  107. </view>
  108. </template>
  109. <script>
  110. import { mapGetters } from 'vuex';
  111. export default {
  112. data() {
  113. return {
  114. goodsData:{},
  115. bankList:[],
  116. id:'',
  117. collectTotal:0,
  118. wrongTotal:0
  119. };
  120. },
  121. onUnload() {
  122. },
  123. computed: { ...mapGetters(['userInfo']) },
  124. onLoad(option) {
  125. this.id = option.id
  126. this.getDetail();
  127. this.goodsBankList();
  128. this.getCollectNum();
  129. this.getWrongNum()
  130. },
  131. onShow() {
  132. },
  133. methods: {
  134. getDetail(){
  135. this.$api.goodsDetail(this.id).then(res => {
  136. console.log(res)
  137. this.goodsData = res.data.data;
  138. })
  139. },
  140. goodsBankList() {
  141. this.$api.goodsBankList({
  142. goodsId:this.id
  143. }).then(res => {
  144. console.log(res)
  145. this.bankList = res.data.data;
  146. })
  147. },
  148. getCollectNum() {
  149. this.$api.goodsCollectExamList({
  150. goodsId:this.id
  151. }).then(res => {
  152. let total = 0;
  153. res.data.rows.forEach(item => {
  154. total += item.questionNum;
  155. })
  156. this.collectTotal = total
  157. })
  158. },
  159. getWrongNum() {
  160. this.$api.wrongRecordList({
  161. goodsId:this.id
  162. }).then(res => {
  163. let total = 0;
  164. res.data.rows.forEach(item => {
  165. total += item.wrongQuestionNum;
  166. })
  167. this.wrongTotal = total
  168. })
  169. },
  170. clickModule(id,index) {
  171. if(this.bankList[index].list) {
  172. this.$set(this.bankList[index],'showList',!this.bankList[index].showList)
  173. return;
  174. }
  175. this.$api.goodsChapterList({
  176. moduleExamId:id
  177. }).then(res => {
  178. this.$set(this.bankList[index],'showList',true)
  179. this.$set(this.bankList[index],'list',res.data.data)
  180. })
  181. },
  182. changeItem(index1,id,type) {
  183. if(type == 1) {
  184. if(this.bankList[index1].list[index2].list) {
  185. this.$set(this.bankList[index1].list[index2],'showList',!this.bankList[index1].list[index2].showList)
  186. return;
  187. }
  188. this.$api.goodsExamList({
  189. chapterExamId:id
  190. }).then(res => {
  191. this.$set(this.bankList[index1].list[index2],'showList',true)
  192. this.$set(this.bankList[index1].list[index2],'list',res.data.data)
  193. })
  194. } else if(type == 2) {
  195. if(this.bankList[index1].list) {
  196. this.$set(this.bankList[index1],'showList',!this.bankList[index1].showList)
  197. return;
  198. }
  199. this.$api.goodsExamList({
  200. chapterExamId:id
  201. }).then(res => {
  202. this.$set(this.bankList[index1],'showList',true)
  203. this.$set(this.bankList[index1],'list',res.data.data)
  204. })
  205. }
  206. }
  207. }
  208. };
  209. </script>
  210. <style >
  211. page{
  212. background-color: #EAEEF1;
  213. }
  214. </style>
  215. <style lang="scss" scope>
  216. .top {
  217. padding:16rpx 16rpx 0;
  218. display: flex;
  219. justify-content: space-between;
  220. .left {
  221. width: 326rpx;
  222. height: 180rpx;
  223. background: #FFFFFF;
  224. box-shadow: 0px 0px 16rpx 4rpx rgba(145, 156, 178, 0.1);
  225. border-radius: 16rpx;
  226. background:#fff;
  227. padding:20rpx;
  228. .title {
  229. font-size: 24rpx;
  230. line-height: 24rpx;
  231. color: #333333;
  232. }
  233. .progress {
  234. margin-top:10rpx;
  235. display: flex;
  236. .item-left {
  237. flex:1;
  238. border-right:1rpx solid #EEEEEE;
  239. .desc {
  240. text {
  241. line-height: 24rpx;
  242. font-size: 24rpx;
  243. color: #999999;
  244. }
  245. }
  246. .percent {
  247. margin-top:10rpx;
  248. line-height: 64rpx;
  249. font-size: 64rpx;
  250. font-weight: bold;
  251. color: #007AFF;
  252. }
  253. .per {
  254. font-size: 30rpx;
  255. color: #007AFF;
  256. }
  257. }
  258. .item-right {
  259. padding-left:10rpx;
  260. flex:1;
  261. text {
  262. line-height: 24rpx;
  263. font-size: 24rpx;
  264. color: #999999;
  265. }
  266. .orange {
  267. line-height: 24rpx;
  268. font-size: 24rpx;
  269. font-weight: bold;
  270. color: #FF9500;
  271. }
  272. .down {
  273. margin-top:40rpx;
  274. }
  275. }
  276. }
  277. }
  278. .right {
  279. width: 180rpx;
  280. height: 180rpx;
  281. background: #FFFFFF;
  282. box-shadow: 0px 0px 16rpx 4rpx rgba(145, 156, 178, 0.1);
  283. background:#fff;
  284. padding:20rpx;
  285. .title {
  286. font-size: 24rpx;
  287. line-height: 24rpx;
  288. color: #333333;
  289. }
  290. .number {
  291. font-weight: bold;
  292. text-align: center;
  293. margin-top:46rpx;
  294. font-size: 64rpx;
  295. line-height: 64rpx;
  296. color: #007AFF;
  297. }
  298. }
  299. }
  300. .courseName{
  301. white-space:nowrap;
  302. overflow:hidden;
  303. text-overflow:ellipsis;
  304. }
  305. .moduleItem{
  306. height: 80rpx;
  307. color: #333333;
  308. font-size: 32rpx;
  309. line-height: 80rpx;
  310. font-weight: bold;
  311. display: flex;
  312. justify-content: space-between;
  313. }
  314. .icon_up{
  315. width: 32rpx;
  316. height: 32rpx;
  317. }
  318. .title-list {
  319. background: #EAEEF1;
  320. padding:16rpx 16rpx 124rpx;
  321. .content {
  322. .list {
  323. background:#fff;
  324. margin-bottom:30rpx;
  325. overflow: hidden;
  326. border-radius: 16rpx;
  327. padding:10rpx 16rpx;
  328. .module {
  329. font-size: 30rpx;
  330. color: #333333;
  331. .icon {
  332. margin-right:10rpx;
  333. }
  334. }
  335. .section {
  336. font-size: 30rpx;
  337. font-family: PingFang SC;
  338. font-weight: bold;
  339. color: #333333;
  340. white-space:nowrap;
  341. overflow:hidden;
  342. text-overflow:ellipsis;
  343. margin: 20rpx 0;
  344. display: flex;
  345. align-items: center;
  346. }
  347. .article {
  348. height:80rpx;
  349. display: flex;
  350. align-items: center;
  351. margin-left:72rpx;
  352. font-size: 24rpx;
  353. color: #666666;
  354. border-bottom: 1rpx solid #EEEEEE;
  355. display: flex;
  356. .flex_auto{
  357. flex:1;
  358. }
  359. &:nth-last-of-type(1) {
  360. border:0;
  361. }
  362. &.active {
  363. color:#007AFF;
  364. .btn {
  365. width: 96rpx;
  366. height: 48rpx;
  367. line-height: 48rpx;
  368. text-align: center;
  369. color:#fff;
  370. font-size: 30rpx;
  371. border-radius:24rpx;
  372. background: #007AFF;
  373. margin-left:36rpx;
  374. border-radius: 24rpx;
  375. }
  376. }
  377. }
  378. }
  379. }
  380. }
  381. </style>