question_detail.vue 8.6 KB

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