list.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <view class="phone-list-page">
  3. <view class="phone-navBar-box">
  4. <view @click="goUpPage" class="nav-bar-icon"></view>
  5. <text class="nav-bar-title">成绩</text>
  6. <view class="nav-bar-icon-box">
  7. <uni-icons class="nav-bar-right-icon" type="search" size="22" color="#666"
  8. @click="toggle('top')"></uni-icons>
  9. </view>
  10. </view>
  11. <!-- 查询职业 -->
  12. <!-- <view class="phone-search-box">
  13. <input class="search-input" placeholder="请输入职业名称" v-model="data.zyName" />
  14. <view class="search-icon" @click="handleSearch">
  15. <uni-icons type="search" size="24" color="#fff"></uni-icons>
  16. </view>
  17. </view> -->
  18. <view>
  19. <search-dialog ref="searchDialogRef"
  20. @search-btn="dialogSearchBtn"
  21. @reset-search="dialogSearchReset"></search-dialog>
  22. </view>
  23. <!-- 课程列表 -->
  24. <scroll-view scroll-y="true" refresher-enabled="true" :refresher-triggered="data.loading"
  25. :refresher-threshold="50" refresher-background="transparent" @refresherrefresh="onRefresh"
  26. class="phone-scroll-view">
  27. <uni-list class="admin-list-box">
  28. <uni-list-item v-for="item in data.list" class="admin-list-item-box">
  29. <template v-slot:body>
  30. <view class="item-card-row">
  31. <!-- 数量 -->
  32. <view class="ks-item-top">
  33. <view class="ks-name">{{item.ksName}}</view>
  34. <view class="ks-zyLevelName">{{item.zyLevelName}}</view>
  35. </view>
  36. <view class="ks-totalTm-row">
  37. <view class="ks-totalTm">
  38. <icon class="phone-user-icon" />姓名:{{item.realName}}
  39. </view>
  40. <view class="ks-totalTm">
  41. <icon class="phone-tel-icon" />手机号:{{item.userName}}
  42. </view>
  43. </view>
  44. <view class="ks-totalTm">
  45. <icon class="phone-time-icon" />{{item.answerStartTime}} - {{item.answerEndTime}}
  46. </view>
  47. <!-- <view class="ks-totalTm">
  48. <icon class="phone-time-icon" /> {{item.userScore}} / {{item.okScore}}/{{item.ksScore}}
  49. </view> -->
  50. <!-- 分数 -->
  51. <view class="ks-score-content">
  52. <view class="ks-score">
  53. <icon class="phone-zongfen-icon" />总分:<text>{{item.ksScore}}</text>
  54. </view>
  55. <view class="ks-okScore cj-okScore">
  56. <icon class="phone-jigefen-icon" />及格分:<text>{{item.okScore}}</text>
  57. </view>
  58. <view class="ks-getScore">
  59. <icon class="phone-defen-icon" />得分:<text>{{item.userScore}}</text>
  60. </view>
  61. </view>
  62. <button @click="checkKecheng(item)" type="primary" size="mini"
  63. class="item-view-btn">查看内容</button>
  64. </view>
  65. </template>
  66. </uni-list-item>
  67. <uni-load-more :status="data.state" @click="getMore(0)"
  68. :contentText="data.contentText"></uni-load-more>
  69. </uni-list>
  70. </scroll-view>
  71. <!-- 页面底端 -->
  72. <customTabbarAdminVue :current-tab="0"></customTabbarAdminVue>
  73. </view>
  74. </template>
  75. <script setup>
  76. import customTabbarAdminVue from "@/components/custom-tabbar/custom-tabbar-admin.vue";
  77. import {
  78. ref,
  79. reactive
  80. } from "vue";
  81. import {
  82. onLoad
  83. } from "@dcloudio/uni-app";
  84. import * as kaoshiApi from "@/api/kaoshi.js"
  85. import {
  86. formatDuration
  87. } from "@/utils/common.js"
  88. import searchDialog from "@/pages/admin/jiazheng/common/search.vue";
  89. const data = reactive({
  90. zyName: '', // 职业名称
  91. list: [], // 考试列表
  92. loading: false,
  93. page: 0,
  94. size: 10,
  95. state: 'more',
  96. contentText: {
  97. contentdown: '查看更多',
  98. contentrefresh: '加载中',
  99. contentnomore: '没有更多'
  100. },
  101. userName: '',
  102. realName: '',
  103. })
  104. const searchDialogRef = ref(null);
  105. function dialogSearchReset() {
  106. data.userName = '';
  107. data.realName = '';
  108. }
  109. function dialogSearchBtn(name, searchData) {
  110. switch (name) {
  111. case '姓名':
  112. dialogSearchReset();
  113. data.realName = searchData.value;
  114. break;
  115. case '手机号':
  116. data.userName = searchData.value;
  117. break;
  118. }
  119. onRefresh();
  120. }
  121. const toggle = (data, index) => {
  122. searchDialogRef.value.handleShow();
  123. }
  124. function goUpPage() {
  125. uni.redirectTo({
  126. url: '/pages/admin/ShouYe/shouye'
  127. })
  128. }
  129. function handleSearch() {
  130. data.page = 0;
  131. refreshData();
  132. }
  133. function checkKecheng(item) {
  134. uni.navigateTo({
  135. url: `/pages/admin/Chengji/ksScoreShijuan?hisId=${item.hisId}`
  136. })
  137. }
  138. function onRefresh() {
  139. data.page = 0;
  140. data.list = [];
  141. data.loading = true;
  142. refreshData();
  143. }
  144. function refreshData() {
  145. const opt = {
  146. page: 1,
  147. size: 10, // 固定查询10条
  148. userName: data.userName,
  149. realName: data.realName
  150. }
  151. data.list = [];
  152. // 数学
  153. data.state = 'loading';
  154. data.page++;
  155. opt.page = data.page;
  156. kaoshiApi.getAdminKsChengjiList(opt).then(res => {
  157. data.list = data.list.concat(res.data.data);
  158. data.loading = false;
  159. if (res.data.total > data.list.length) {
  160. data.state = 'more';
  161. data.loading = false;
  162. } else {
  163. data.state = 'no-more';
  164. data.loading = false;
  165. }
  166. }).catch(err => {
  167. data.state = 'more';
  168. data.loading = false;
  169. })
  170. }
  171. function getMore() {
  172. const opt = {
  173. page: 1,
  174. size: 10, // 固定查询10条
  175. userName: data.userName,
  176. realName: data.realName
  177. }
  178. if (data.state == 'no-more') return;
  179. data.state = 'loading';
  180. data.page++;
  181. opt.page = data.page;
  182. kaoshiApi.getAdminKsChengjiList(opt).then(res => {
  183. data.list = data.list.concat(res.data.data);
  184. data.loading = false;
  185. if (res.data.total > data.list.length) {
  186. data.state = 'more';
  187. data.loading = false;
  188. } else {
  189. data.state = 'no-more';
  190. data.loading = false;
  191. }
  192. }).catch(err => {
  193. data.state = 'more';
  194. data.loading = false;
  195. })
  196. }
  197. onLoad(() => {
  198. getMore()
  199. })
  200. </script>
  201. <style lang="scss" scoped>
  202. .phone-kecheng-page {
  203. background-color: #ccc;
  204. box-sizing: border-box;
  205. }
  206. .phone-search-content {
  207. position: relative;
  208. background-color: #fff;
  209. height: 42px;
  210. .search-input {
  211. height: 42px;
  212. line-height: 40px;
  213. border-radius: 20px;
  214. border: 1px solid #ccc;
  215. padding: 0 70px 0 20px;
  216. }
  217. .search-icon {
  218. position: absolute;
  219. right: 5px;
  220. top: 4px;
  221. padding: 6px;
  222. background-color: #ccc;
  223. border-radius: 20px;
  224. width: 50px;
  225. text-align: center;
  226. }
  227. }
  228. </style>