result.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <view>
  3. <view class="head" catchtouchmove="true" @touchmove.stop.prevent="() => { }">
  4. <My_search :value="content.where.condition" @onSearch="onSearch">
  5. <view class="filtrate" v-if="filtrateList.length" hover-class="navigator-hover" @click="openFiltrate">
  6. 筛选
  7. <text class="iconfont icon-shaixuan" />
  8. </view>
  9. </My_search>
  10. <view class="crumbs">
  11. <view class="crumb" v-for="item in crumbs" :key="item.classname">{{ item.classname }}</view>
  12. </view>
  13. </view>
  14. <view style="height: 1px;" />
  15. <filtrate ref="Filtrate" :filtrateList="filtrateList" @onFiltration="onFiltration" @onInterrupt="onInterrupt" />
  16. <My_listbox ref="List" @getlist="getList">
  17. <view class="list-box">
  18. <navigator class="item" v-for="item in list" :key="item.sat_courseware_testheadid"
  19. :url="'/packageA/exam/detail?id=' + item.sat_courseware_testheadid">
  20. <view class="title u-line-2">{{ item.title || '--' }}</view>
  21. <view class="hr" />
  22. <view class="bottom">
  23. <view>
  24. 分数:<text class="score">{{ item.score }}</text>
  25. </view>
  26. <view>
  27. 答题数:{{ item.answerinfo }}
  28. </view>
  29. </view>
  30. <view class="status" v-if="item.status == '未开始'" style="background:#E3041F;color: #FFFFFF;">
  31. 未开始
  32. </view>
  33. <view class="status" v-else-if="item.status == '进行中'" style="background: #FFF0F2;color: #E3041F;">
  34. 进行中
  35. </view>
  36. <view class="status" v-else-if="item.status == '已完成'" style="background: #EEEEEE;color: #999999;">
  37. 已完成
  38. </view>
  39. </navigator>
  40. </view>
  41. </My_listbox>
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. data() {
  47. return {
  48. crumbs: [],
  49. list: [],
  50. "content": {
  51. "where": {
  52. "condition": "",
  53. "status": "已完成",
  54. "sat_courseware_classids": [[]]
  55. }
  56. },
  57. filtrateList: [],
  58. }
  59. },
  60. onLoad(options) {
  61. this.crumbs = [{
  62. classname: "考试",
  63. parentid: ""
  64. }, {
  65. classname: "全部",
  66. parentid: ''
  67. }]
  68. this.getType()
  69. this.getList(true)
  70. uni.setNavigationBarTitle({
  71. title: '考试成绩',
  72. })
  73. },
  74. onShow() {
  75. this.updateList()
  76. },
  77. methods: {
  78. getType() {
  79. this.$Http.basic({
  80. "id": "20221102143302",
  81. content: {
  82. pageSize: 9999,
  83. parentid: "",
  84. "where": {
  85. "isenable": 1
  86. }
  87. }
  88. }).then(res => {
  89. console.log("获取分类列表", res)
  90. if (this.cutoff(res.msg)) return;
  91. this.filtrateList = [{
  92. title: "一级分类",
  93. key: '一级分类',//提交时返回的Key
  94. showKey: "classname",//显示的key
  95. selected: "sat_courseware_classid",//选择时选择的字段
  96. value: "",//提交时选中的value
  97. defaultVal: "",//返回的默认值
  98. isAll: true,
  99. interrupt: true,
  100. rang: [{ classname: "全部", sat_courseware_classid: "", children: [] }].concat(res.data),//选择的范围
  101. }]
  102. })
  103. },
  104. getList(init = false) {
  105. if (this.paging(this.content, init)) return;
  106. let ids = this.crumbs.map(v => v.parentid).filter(v => v);
  107. this.content.where.sat_courseware_classids = ids.length ? [[ids[ids.length - 1]]] : []
  108. this.$Http.basic({
  109. "id": 20240326133302,
  110. content: this.content
  111. }).then(res => {
  112. this.$refs.List.RefreshToComplete()
  113. console.log("获取成绩列表", res)
  114. if (this.cutoff(res.msg)) return;
  115. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
  116. this.content = this.$refs.List.paging(this.content, res)
  117. })
  118. },
  119. updateList() {
  120. if (this.content.pageNumber && this.content.pageNumber >= 2) {
  121. let content = this.paging(this.content, true, true)
  122. this.$Http.basic({
  123. "id": "20240326133302",
  124. content
  125. }).then(res => {
  126. console.log("更新试卷列表", res)
  127. if (this.cutoff(res.msg)) return;
  128. this.list = res.data;
  129. this.$refs.List.paging(content, res, true)
  130. })
  131. }
  132. },
  133. openFiltrate() {
  134. this.$refs.Filtrate.changeShow();
  135. },
  136. onSearch(condition) {
  137. this.content.where.condition = condition;
  138. this.getList(true)
  139. },
  140. onInterrupt({ item, index, option }) {
  141. let filtrateList = this.$refs.Filtrate.list;
  142. const i = filtrateList.findIndex(v => v.title == '二级分类');
  143. if (option.children.length) {
  144. const obj = {
  145. title: "二级分类",
  146. key: '二级分类',
  147. showKey: "classname",
  148. selected: "sat_courseware_classid",
  149. value: "",
  150. defaultVal: "",
  151. isAll: true,
  152. rang: [{ classname: "全部", sat_courseware_classid: "" }].concat(option.children),
  153. };
  154. i == -1 ? filtrateList.push(obj) : filtrateList[i] = obj;
  155. } else {
  156. i == -1 ? '' : filtrateList.pop();
  157. }
  158. this.$refs.Filtrate.list = filtrateList || JSON.parse(JSON.stringify());
  159. },
  160. onFiltration(e) {
  161. let crumbs = [{
  162. classname: "考试",
  163. parentid: ""
  164. }]
  165. crumbs.push({
  166. classname: e.一级分类.classname,
  167. parentid: e.一级分类.sat_courseware_classid
  168. })
  169. if (e.二级分类) crumbs.push({
  170. classname: e.二级分类.classname,
  171. parentid: e.二级分类.sat_courseware_classid
  172. })
  173. if (e.一级分类 == '') {
  174. crumbs.push({
  175. classname: '全部',
  176. parentid: ''
  177. })
  178. }
  179. this.crumbs = crumbs;
  180. this.getList(true)
  181. },
  182. }
  183. }
  184. </script>
  185. <style lang="scss">
  186. .head {
  187. padding: 10px;
  188. width: 100%;
  189. background: #fff;
  190. box-sizing: border-box;
  191. .filtrate {
  192. line-height: 30px;
  193. padding: 0 10px;
  194. font-family: PingFang SC, PingFang SC;
  195. font-size: 14px;
  196. color: #333333;
  197. border-radius: 3px;
  198. margin-left: 10px;
  199. .iconfont {
  200. margin-left: 3px;
  201. color: #BBBBBB;
  202. }
  203. }
  204. }
  205. .crumbs {
  206. display: flex;
  207. line-height: 17px;
  208. font-family: PingFang SC, PingFang SC;
  209. font-size: 12px;
  210. flex-wrap: wrap;
  211. width: 100%;
  212. margin-top: 10px;
  213. .crumb {
  214. flex-shrink: 0;
  215. }
  216. .crumb::after {
  217. content: ">";
  218. padding: 0 2px;
  219. }
  220. .crumb:last-child {
  221. font-weight: bold;
  222. }
  223. .crumb:last-child::after {
  224. content: "";
  225. }
  226. }
  227. .list-box {
  228. width: 100vw;
  229. padding: 10px;
  230. padding-top: 0;
  231. box-sizing: border-box;
  232. .item {
  233. position: relative;
  234. background: #FFFFFF;
  235. border-radius: 8px;
  236. margin-top: 10px;
  237. padding: 10px;
  238. padding-top: 15px;
  239. .title {
  240. width: 280px;
  241. line-height: 20px;
  242. height: 40px;
  243. font-family: Source Han Sans SC, Source Han Sans SC;
  244. font-weight: bold;
  245. font-size: 14px;
  246. color: #333333;
  247. }
  248. .hr {
  249. width: 100%;
  250. height: 1px;
  251. background: #DDDDDD;
  252. margin-top: 15px;
  253. }
  254. .status {
  255. position: absolute;
  256. top: 10px;
  257. right: 0;
  258. width: 44px;
  259. height: 24px;
  260. line-height: 24px;
  261. border-radius: 12px 0px 0px 12px;
  262. text-align: center;
  263. font-family: Source Han Sans SC, Source Han Sans SC;
  264. font-size: 12px;
  265. color: #FFFFFF;
  266. }
  267. .bottom {
  268. display: flex;
  269. justify-content: space-between;
  270. line-height: 20px;
  271. font-family: Source Han Sans SC, Source Han Sans SC;
  272. font-size: 14px;
  273. color: #666666;
  274. margin-top: 10px;
  275. .score {
  276. color: #E3041F;
  277. font-weight: bold;
  278. }
  279. }
  280. }
  281. }
  282. </style>