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.
 
 
 
 
 
 

304 rivejä
7.3 KiB

  1. <template>
  2. <view class="page">
  3. <view class="mainpage" :class="sideOpen ? 'show' : ''" style="padding-top: 40px;">
  4. <!-- 顶部条目/分页信息栏 -->
  5. <l-customlist-banner @buttonClick="sideOpen = true">{{
  6. tips
  7. }}</l-customlist-banner>
  8. <!-- <view class="records">共 {{ records }} 条数据</view> -->
  9. <l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="data">
  10. <l-customlist :tips="loadState" showTips>
  11. <view class="pageBox customlist-item" showDelete="true" v-for="(item, ind) in data" :key="item.Id"
  12. @click="tapClick(item)">
  13. <view class="">
  14. <text>学年:</text>
  15. {{ item.AcademicYearNo }}
  16. </view>
  17. <view class="">
  18. <text>学期:</text>
  19. {{ item.Semester }}
  20. </view>
  21. <view class="">
  22. <text>课程编号:</text>
  23. {{ item.LessonNo }}
  24. </view>
  25. <view class="">
  26. <text>课程名称:</text>
  27. {{ item.LessonName }}
  28. </view>
  29. <view class="">
  30. <text>建课教师:</text>
  31. {{ item.EmpNo }}
  32. </view>
  33. <view class="">
  34. <text>建课学校:</text>
  35. {{ item.F_SchoolId }}
  36. </view>
  37. <view class="">
  38. <text>已报人数:</text>
  39. {{ item.StuNumOfApply }}
  40. </view>
  41. <view class="pageType">
  42. <text>报名状态:</text>
  43. {{ typePd(item.Status) }}
  44. </view>
  45. <view class="delbtn" v-if="item.Status == 1" @click.stop="delTap(item)">取消报名</view>
  46. </view>
  47. </l-customlist>
  48. </l-scroll-list>
  49. </view>
  50. <!-- 关闭侧边抽屉按钮 -->
  51. <view @click="sideOpen = false" :class="sideOpen ? 'show' : ''" class="sideclose">
  52. <l-icon type="pullright" color="blue" />
  53. </view>
  54. <!-- 侧边栏,用于设置查询条件 -->
  55. <scroll-view :class="sideOpen ? 'show' : ''" class="sidepage" scroll-y>
  56. <view v-if="ready" class="padding">
  57. <l-input v-model="queryData.LessonNo" @change="searchChange" title="课程编号" placeholder="按课程编号查询" />
  58. <l-input v-model="queryData.LessonName" @change="searchChange" title="课程名称" placeholder="按课程名称查询" />
  59. <!-- 重置查询条件按钮 -->
  60. <view class="padding-tb">
  61. <l-button @click="reset" line="orange" class="block" block>重置查询条件</l-button>
  62. </view>
  63. </view>
  64. </scroll-view>
  65. </view>
  66. </template>
  67. <script>
  68. import pickBy from "lodash/pickBy";
  69. import mapValues from "lodash/mapValues";
  70. export default {
  71. data() {
  72. return {
  73. weekChina: ['一', '二', '三', '四', '五', '六', '日'],
  74. user: null,
  75. data: [],
  76. total: 1,
  77. records: 0,
  78. ready: false,
  79. page: 1,
  80. rows: 10,
  81. multipleData: null,
  82. sideOpen: false,
  83. tips: "加载中...",
  84. loadState: '向下翻以加载更多',
  85. // 数据源
  86. dataSource: {
  87. F_SchoolId: []
  88. },
  89. // 查询条件
  90. searchData: {},
  91. defaultQueryData: {},
  92. queryData: {
  93. LessonNo: "",
  94. LessonName: "",
  95. },
  96. };
  97. },
  98. onUnload() {
  99. this.OFF('LessonInfoOfElectiveOnline');
  100. },
  101. onShow() {
  102. if (this.data.length) {
  103. this.pullDown()
  104. }
  105. },
  106. methods: {
  107. init() {
  108. this.ON('LessonInfoOfElectiveOnline', this.refreshList);
  109. // 拉取加载列表和数据源
  110. Promise.all([
  111. this.FETCH_DATASOURCE('company').then(result => {
  112. this.dataSource.F_SchoolId = result.data.map(t => ({
  113. text: t.f_fullname,
  114. value: t.f_companyid
  115. }))
  116. }),
  117. () => {},
  118. ]);
  119. // var _this = this;
  120. this.user = this.GET_GLOBAL('loginUser');
  121. this.fetchList();
  122. // 初始化查询条件
  123. this.defaultQueryData = this.COPY(this.queryData);
  124. this.ready = true;
  125. },
  126. // 拉取列表
  127. async fetchList() {
  128. if (this.page > this.total) {
  129. return;
  130. }
  131. // let _this = this;
  132. this.searchData.StuNo = this.user.account;
  133. this.searchData.StuMajorNo = this.user.majorno;
  134. this.searchData.StuGrade = this.user.grade;
  135. let _postParam = {
  136. pagination: {
  137. rows: this.rows,
  138. page: this.page,
  139. sidx: 'AcademicYearNo DESC, Semester DESC, LessonNo ASC',
  140. sord: 'asc'
  141. },
  142. //queryJson: '{}'
  143. queryJson: JSON.stringify(this.searchData),
  144. };
  145. this.LOADING('加载数据中…')
  146. this.HTTP_GET('learun/LessonInfoOfElectiveOnline/pagelist', _postParam, '加载数据时出错').then(res => {
  147. this.HIDE_LOADING();
  148. this.data = this.data.concat(res.rows);
  149. this.total = res.total;
  150. this.records = res.records;
  151. this.page = res.page + 1;
  152. this.loadState = res.page >= res.total ? '已加载所有项目' : '向下翻以加载更多';
  153. this.tips = `已加载 ${Math.min(res.page, res.total)} / ${
  154. res.total
  155. } 页,共 ${res.records} 项`;
  156. // console.log(_this.data);
  157. });
  158. },
  159. // 列表下拉
  160. pullDown() {
  161. this.refreshList().then(() => {
  162. this.$refs.data.stopPullDown();
  163. });
  164. },
  165. async refreshList() {
  166. this.page = 1;
  167. this.total = 1;
  168. this.data = [];
  169. this.fetchList();
  170. },
  171. tapClick(data) {
  172. this.NAV_TO('./from', {
  173. keyValue: data.Id,
  174. Status: data.Status
  175. }, true);
  176. },
  177. delTap(item) {
  178. // console.log(item)
  179. // let this = this;
  180. this.CONFIRM('数字化校园提示', '确定要取消报名吗?', true).then(res => {
  181. if (res) {
  182. let _postData = {
  183. keyValue: item.Id,
  184. StuNo: this.user.account
  185. }
  186. this.LOADING('正在取消报名…')
  187. this.HTTP_POST(
  188. 'learun/LessonInfoOfElectiveOnline/Cancel',
  189. _postData,
  190. '加载数据时出错'
  191. ).then(data => {
  192. this.HIDE_LOADING()
  193. // console.log(data)
  194. if (data) { // 成功
  195. this.TOAST('取消报名成功!');
  196. this.refreshList()
  197. }
  198. })
  199. }
  200. })
  201. },
  202. // 设置搜索条件
  203. async searchChange() {
  204. const result = {};
  205. // 将其他查询项添加到查询 JSON 中
  206. const queryObj = pickBy(this.queryData, (t) =>
  207. Array.isArray(t) ? t.length > 0 : t
  208. );
  209. Object.assign(
  210. result,
  211. mapValues(queryObj, (t) => (Array.isArray(t) ? t.join(",") : t))
  212. );
  213. this.searchData = result;
  214. this.refreshList();
  215. },
  216. // 点击「清空查询条件」按钮
  217. reset() {
  218. this.queryData = this.COPY(this.defaultQueryData);
  219. this.searchChange();
  220. },
  221. },
  222. computed: {
  223. typePd() {
  224. return num => {
  225. let txt = '';
  226. if (num == 1) {
  227. txt = '审核中';
  228. } else if (num == 2) {
  229. txt = '报名成功';
  230. } else if (num == 3) {
  231. txt = '报名失败';
  232. } else {
  233. txt = '未报名';
  234. }
  235. return txt;
  236. };
  237. }
  238. },
  239. created() {
  240. this.init();
  241. }
  242. };
  243. </script>
  244. <style lang="less" scoped>
  245. @import '~@/common/css/sidepage.less';
  246. @import '~@/common/css/customlist.less';
  247. .page {
  248. background-color: #fff;
  249. }
  250. .page-content {
  251. margin-top: 39px;
  252. }
  253. .records {
  254. color: #8f8f94;
  255. background: #ffffff;
  256. padding: 10px 12px;
  257. width: 100%;
  258. vertical-align: middle;
  259. border-bottom: 0.5px solid #ddd;
  260. position: fixed;
  261. top: var(--window-top);
  262. z-index: 1024;
  263. border-bottom: 0.5px solid #ddd;
  264. height: 40px;
  265. width: 100%;
  266. box-shadow: 0 0.5px 3px rgba(0, 0, 0, 0.1);
  267. // background: #f1f1f1;
  268. }
  269. .pageBox {
  270. // margin-top: 34px;
  271. padding: 5px 15px;
  272. line-height: 24px;
  273. border-bottom: 5px solid #f5f5f5;
  274. }
  275. .delbtn {
  276. position: absolute;
  277. right: 15px;
  278. bottom: 7px;
  279. padding: 3px 10px;
  280. background: #dd524d;
  281. color: #fff;
  282. border-radius: 3px;
  283. }
  284. </style>