list.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. <template>
  2. <view class="phone-list-page">
  3. <view class="phone-navBar-box border-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" @scrolltolower="onScrolltolower"
  26. class="admin-phone-tabbar-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. dialogSearchReset();
  117. data.userName = searchData.value;
  118. break;
  119. }
  120. onRefresh();
  121. }
  122. const toggle = (data, index) => {
  123. searchDialogRef.value.handleShow();
  124. }
  125. function goUpPage() {
  126. uni.redirectTo({
  127. url: '/pages/admin/ShouYe/shouye'
  128. })
  129. }
  130. function handleSearch() {
  131. data.page = 0;
  132. refreshData();
  133. }
  134. function checkKecheng(item) {
  135. uni.navigateTo({
  136. url: `/pages/admin/Chengji/ksScoreShijuan?hisId=${item.hisId}`
  137. })
  138. }
  139. function onScrolltolower() {
  140. getMore()
  141. }
  142. function onRefresh() {
  143. if (data.loading) return;
  144. data.page = 0;
  145. data.list = [];
  146. data.loading = true;
  147. refreshData();
  148. }
  149. function refreshData() {
  150. const opt = {
  151. page: 1,
  152. size: 10, // 固定查询10条
  153. userName: data.userName,
  154. realName: data.realName
  155. }
  156. data.list = [];
  157. // 数学
  158. data.state = 'loading';
  159. data.page++;
  160. opt.page = data.page;
  161. kaoshiApi.getAdminKsChengjiList(opt).then(res => {
  162. data.list = data.list.concat(res.data.data);
  163. data.loading = false;
  164. if (res.data.total > data.list.length) {
  165. data.state = 'more';
  166. data.loading = false;
  167. } else {
  168. data.state = 'no-more';
  169. data.loading = false;
  170. }
  171. }).catch(err => {
  172. data.state = 'more';
  173. data.loading = false;
  174. })
  175. }
  176. function getMore() {
  177. const opt = {
  178. page: 1,
  179. size: 10, // 固定查询10条
  180. userName: data.userName,
  181. realName: data.realName
  182. }
  183. if (data.state == 'no-more') return;
  184. data.state = 'loading';
  185. data.page++;
  186. opt.page = data.page;
  187. kaoshiApi.getAdminKsChengjiList(opt).then(res => {
  188. data.list = data.list.concat(res.data.data);
  189. data.loading = false;
  190. if (res.data.total > data.list.length) {
  191. data.state = 'more';
  192. data.loading = false;
  193. } else {
  194. data.state = 'no-more';
  195. data.loading = false;
  196. }
  197. }).catch(err => {
  198. data.state = 'more';
  199. data.loading = false;
  200. })
  201. }
  202. onLoad(() => {
  203. getMore()
  204. })
  205. </script>
  206. <style lang="scss" scoped>
  207. .phone-kecheng-page {
  208. background-color: #ccc;
  209. box-sizing: border-box;
  210. }
  211. .phone-search-content {
  212. position: relative;
  213. background-color: #fff;
  214. height: 42px;
  215. .search-input {
  216. height: 42px;
  217. line-height: 40px;
  218. border-radius: 20px;
  219. border: 1px solid #ccc;
  220. padding: 0 70px 0 20px;
  221. }
  222. .search-icon {
  223. position: absolute;
  224. right: 5px;
  225. top: 4px;
  226. padding: 6px;
  227. background-color: #ccc;
  228. border-radius: 20px;
  229. width: 50px;
  230. text-align: center;
  231. }
  232. }
  233. </style>