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.
 
 
 
 
 
 

250 lines
5.8 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.StuNumOfApply }}
  49. </view>
  50. <view class="pageType">{{ typePd(item.Status) }}</view>
  51. <view class="delbtn" v-if="item.Status == 1" @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. onShow() {
  79. if(this.data.length){
  80. this.pullDown()
  81. }
  82. },
  83. methods: {
  84. init() {
  85. this.ON('OpenLessonPlanOfElectiveStudent', this.refreshList);
  86. // 拉取加载列表和数据源
  87. Promise.all([() => {}]);
  88. // var _this = this;
  89. this.user = this.GET_GLOBAL('loginUser');
  90. console.log(this.user)
  91. this.fetchList();
  92. this.ready = true;
  93. },
  94. // 拉取列表
  95. async fetchList() {
  96. if (this.page > this.total) {
  97. return;
  98. }
  99. // let _this = this;
  100. let _postParam = {
  101. pagination: {
  102. rows: this.rows,
  103. page: this.page,
  104. sidx: 'LessonNo',
  105. sord: 'asc'
  106. },
  107. queryJson: '{}'
  108. };
  109. if (true) {
  110. _postParam.queryJson = JSON.stringify({
  111. StuNo: this.user.account,
  112. StuMajorNo: this.user.majorno,
  113. StuGrade: this.user.grade,
  114. });
  115. }
  116. this.LOADING('加载数据中…')
  117. this.HTTP_GET('learun/OpenLessonPlanOfElectiveStudent/pagelist', _postParam, '加载数据时出错').then(res => {
  118. this.HIDE_LOADING();
  119. this.data = this.data.concat(res.rows);
  120. this.total = res.total;
  121. this.records = res.records;
  122. this.page = res.page + 1;
  123. this.loadState = res.page >= res.total ? '已加载所有项目' : '向下翻以加载更多';
  124. // console.log(_this.data);
  125. });
  126. },
  127. // 列表下拉
  128. pullDown() {
  129. this.refreshList().then(() => {
  130. this.$refs.data.stopPullDown();
  131. });
  132. },
  133. async refreshList() {
  134. this.page = 1;
  135. this.total = 1;
  136. this.data = [];
  137. this.fetchList();
  138. },
  139. tapClick(data) {
  140. this.NAV_TO('./from', data.Id, true);
  141. },
  142. delTap(item) {
  143. // console.log(item)
  144. // let this = this;
  145. this.CONFIRM('数字化校园提示', '确定要取消报名吗?', true).then(res => {
  146. if (res) {
  147. let _postData = {
  148. keyValue: item.Id,
  149. StuNo: this.user.account
  150. }
  151. this.LOADING('正在取消报名…')
  152. this.HTTP_POST(
  153. 'learun/OpenLessonPlanOfElectiveStudent/Cancel',
  154. _postData,
  155. '加载数据时出错'
  156. ).then(data => {
  157. this.HIDE_LOADING()
  158. // console.log(data)
  159. if (data) { // 成功
  160. this.TOAST('取消报名成功!');
  161. this.refreshList()
  162. }
  163. })
  164. }
  165. })
  166. }
  167. },
  168. computed: {
  169. jieci() {
  170. return str => {
  171. let ls = '';
  172. if (str.indexOf(',') == -1) ls = '星期' + this.weekChina[str.slice(0, 1) - 1] + '第' + str.slice(1) +
  173. '节';
  174. else ls = '星期' + this.weekChina[str.slice(0, 1) - 1] + '第' + str.slice(1, 2) + '、' + str.slice(4) +
  175. '节';
  176. return ls;
  177. };
  178. },
  179. typePd() {
  180. return num => {
  181. let txt = '';
  182. if (num == 1) {
  183. txt = '审核中';
  184. } else if (num == 2) {
  185. txt = '报名成功';
  186. } else if (num == 3) {
  187. txt = '报名失败';
  188. } else {
  189. txt = '未报名';
  190. }
  191. return txt;
  192. };
  193. }
  194. },
  195. created() {
  196. this.init();
  197. }
  198. };
  199. </script>
  200. <style lang="less" scoped>
  201. @import '~@/common/css/sidepage.less';
  202. @import '~@/common/css/customlist.less';
  203. .page {
  204. background-color: #fff;
  205. }
  206. .page-content {
  207. margin-top: 39px;
  208. }
  209. .records {
  210. color: #8f8f94;
  211. background: #ffffff;
  212. padding: 10px 12px;
  213. width: 100%;
  214. vertical-align: middle;
  215. border-bottom: 0.5px solid #ddd;
  216. position: fixed;
  217. top: var(--window-top);
  218. z-index: 1024;
  219. border-bottom: 0.5px solid #ddd;
  220. height: 40px;
  221. width: 100%;
  222. box-shadow: 0 0.5px 3px rgba(0, 0, 0, 0.1);
  223. // background: #f1f1f1;
  224. }
  225. .pageBox {
  226. // margin-top: 34px;
  227. padding: 5px 15px;
  228. line-height: 24px;
  229. border-bottom: 5px solid #f5f5f5;
  230. }
  231. .delbtn {
  232. position: absolute;
  233. right: 15px;
  234. bottom: 7px;
  235. padding: 3px 10px;
  236. background: #dd524d;
  237. color: #fff;
  238. border-radius: 3px;
  239. }
  240. </style>