You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

244 lines
5.7 KiB

  1. <template>
  2. <view class="page">
  3. <view class="mainpage" :class="sideOpen ? 'show' : ''" style="padding-top: 40px;">
  4. <!-- <l-customlist-banner></l-customlist-banner> -->
  5. <view class="records">共 {{ records }} 条数据</view>
  6. <l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="data">
  7. <l-customlist :tips="loadState" showTips>
  8. <view class="pageBox customlist-item" showDelete="true" v-for="(item, ind) in data"
  9. :key="item.MakeDate" @click="tapClick(item)">
  10. <view class="">
  11. <text>学年:</text>
  12. {{ item.AcademicYearNo }}
  13. </view>
  14. <view class="">
  15. <text>学期:</text>
  16. {{ item.Semester }}
  17. </view>
  18. <view class="">
  19. <text>课程名称:</text>
  20. {{ item.LessonName }}
  21. </view>
  22. <view class="">
  23. <text>上课节次:</text>
  24. {{ jieci(item.LessonSection) }}
  25. </view>
  26. <view class="">
  27. <text>上课时间:</text>
  28. {{ item.LessonTime }}
  29. </view>
  30. <view class="">
  31. <text>学分:</text>
  32. {{ item.StudyScore }}
  33. </view>
  34. <view class="">
  35. <text>教师姓名:</text>
  36. {{ item.EmpName }}
  37. </view>
  38. <view class="">
  39. <text>教室名称:</text>
  40. {{ item.ClassRoomNo }}
  41. </view>
  42. <view class="">
  43. <text>人数上限:</text>
  44. {{ item.StuNumMax }}
  45. </view>
  46. <view class="">
  47. <text>已报名人数:</text>
  48. {{ item.StuNumOfApplyPre }}
  49. </view>
  50. <view class="pageType">{{ typePd(item.StatusPre) }}</view>
  51. <view class="delbtn" @click.stop="delTap(item)">取消报名</view>
  52. </view>
  53. </l-customlist>
  54. </l-scroll-list>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. export default {
  60. data() {
  61. return {
  62. weekChina: ['一', '二', '三', '四', '五', '六', '日'],
  63. user: null,
  64. data: [],
  65. total: 1,
  66. records: 0,
  67. ready: false,
  68. page: 1,
  69. rows: 10,
  70. multipleData: null,
  71. sideOpen: false,
  72. loadState: '向下翻以加载更多'
  73. };
  74. },
  75. onUnload() {
  76. this.OFF('OpenLessonPlanOfElectiveStudent');
  77. },
  78. methods: {
  79. init() {
  80. this.ON('OpenLessonPlanOfElectiveStudent', this.refreshList);
  81. // 拉取加载列表和数据源
  82. Promise.all([() => {}]);
  83. var _this = this;
  84. this.user = this.GET_GLOBAL('loginUser');
  85. this.fetchList();
  86. this.ready = true;
  87. },
  88. // 拉取列表
  89. async fetchList() {
  90. if (this.page > this.total) {
  91. return;
  92. }
  93. let _this = this;
  94. let _postParam = {
  95. pagination: {
  96. rows: _this.rows,
  97. page: _this.page,
  98. sidx: 'LessonNo',
  99. sord: 'asc'
  100. },
  101. queryJson: '{}'
  102. };
  103. if (true) {
  104. _postParam.queryJson = JSON.stringify({
  105. StuNo: _this.user.account,
  106. StuMajorNo: _this.user.majorno,
  107. StuGrade: _this.user.grade,
  108. });
  109. }
  110. _this.LOADING('加载数据中…')
  111. _this.HTTP_GET('learun/OpenLessonPlanOfElectiveStudent/pagelist', _postParam, '加载数据时出错').then(res => {
  112. _this.HIDE_LOADING();
  113. this.data = this.data.concat(res.rows);
  114. _this.total = res.total;
  115. _this.records = res.records;
  116. this.page = res.page + 1;
  117. this.loadState = res.page >= res.total ? '已加载所有项目' : '向下翻以加载更多';
  118. // console.log(_this.data);
  119. });
  120. },
  121. // 列表下拉
  122. pullDown() {
  123. this.refreshList().then(() => {
  124. this.$refs.data.stopPullDown();
  125. });
  126. },
  127. async refreshList() {
  128. this.page = 1;
  129. this.total = 1;
  130. this.data = [];
  131. this.fetchList();
  132. },
  133. tapClick(data) {
  134. this.NAV_TO('./from', data.Id, true);
  135. },
  136. delTap(item) {
  137. // console.log(item)
  138. let _this = this;
  139. this.CONFIRM('数字化校园提示', '确定要取消报名吗?', true).then(res => {
  140. if (res) {
  141. let _postData = {
  142. keyValue: item.Id,
  143. StuNo: _this.user.account
  144. }
  145. _this.LOADING('正在取消报名…')
  146. _this.HTTP_POST(
  147. 'learun/OpenLessonPlanOfElectiveStudent/Cancel',
  148. _postData,
  149. '加载数据时出错'
  150. ).then(data => {
  151. _this.HIDE_LOADING()
  152. // console.log(data)
  153. if (data) { // 成功
  154. this.TOAST('取消报名成功!');
  155. this.refreshList()
  156. }
  157. })
  158. }
  159. })
  160. }
  161. },
  162. computed: {
  163. jieci() {
  164. return str => {
  165. let ls = '';
  166. if (str.indexOf(',') == -1) ls = '星期' + this.weekChina[str.slice(0, 1) - 1] + '第' + str.slice(1) +
  167. '节';
  168. else ls = '星期' + this.weekChina[str.slice(0, 1) - 1] + '第' + str.slice(1, 2) + '、' + str.slice(4) +
  169. '节';
  170. return ls;
  171. };
  172. },
  173. typePd() {
  174. return num => {
  175. let txt = '';
  176. if (num == 1) {
  177. txt = '审核中';
  178. } else if (num == 2) {
  179. txt = '报名成功';
  180. } else if (num == 3) {
  181. txt = '报名失败';
  182. } else {
  183. txt = '未报名';
  184. }
  185. return txt;
  186. };
  187. }
  188. },
  189. created() {
  190. this.init();
  191. }
  192. };
  193. </script>
  194. <style lang="less" scoped>
  195. @import '~@/common/css/sidepage.less';
  196. @import '~@/common/css/customlist.less';
  197. .page {
  198. background-color: #fff;
  199. }
  200. .page-content {
  201. margin-top: 39px;
  202. }
  203. .records {
  204. color: #8f8f94;
  205. background: #ffffff;
  206. padding: 10px 12px;
  207. width: 100%;
  208. vertical-align: middle;
  209. border-bottom: 0.5px solid #ddd;
  210. position: fixed;
  211. top: var(--window-top);
  212. z-index: 1024;
  213. border-bottom: 0.5px solid #ddd;
  214. height: 40px;
  215. width: 100%;
  216. box-shadow: 0 0.5px 3px rgba(0, 0, 0, 0.1);
  217. // background: #f1f1f1;
  218. }
  219. .pageBox {
  220. // margin-top: 34px;
  221. padding: 5px 15px;
  222. line-height: 24px;
  223. border-bottom: 5px solid #f5f5f5;
  224. }
  225. .delbtn {
  226. position: absolute;
  227. right: 15px;
  228. bottom: 7px;
  229. padding: 3px 10px;
  230. background: #dd524d;
  231. color: #fff;
  232. border-radius: 3px;
  233. }
  234. </style>