index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. <template>
  2. <view>
  3. <nav-bar title="模考预约" class="nav"></nav-bar>
  4. <view class="tabs">
  5. <view class="tab" :class="{ active: index == 2 }" data-index="2">
  6. <view class="dateRange">
  7. <picker mode="date" :value="dateFrom" :start="startDate" :end="endDate" @change="bindDateFromChange">
  8. <view class="uni-input">{{dateFrom}}</view>
  9. </picker>
  10. -
  11. <picker mode="date" :value="dateTo" :start="startDate" :end="endDate" @change="bindDateToChange">
  12. <view class="uni-input">{{dateTo}}</view>
  13. </picker></view>
  14. <u-icon class="icon" name="calendar"></u-icon>
  15. </view>
  16. <view class="tab" :class="{ active: index == 1 }" data-index="1" @click="tab(1)">
  17. <view>全部</view>
  18. <u-icon class="icon" :class="index ==1? 'animals':''" name="arrow-down"></u-icon>
  19. </view>
  20. </view>
  21. <view class="record">
  22. <view class="item" v-for="(item,index) in 5" :key="index">
  23. <view class="item__header">
  24. <view class="note">
  25. <image src="../static/living.png" mode="widthFix"></image>
  26. 直播中
  27. </view>
  28. <image class="img" src="/static/questionBank.png" ></image>
  29. </view>
  30. <view class="item__body">
  31. <view class="title">
  32. 二建模考-法律讲解直播-三级标题
  33. </view>
  34. <view class="desc">直播时间</view>
  35. <view class="desc">2022/4/15 20:00-21:00 </view>
  36. </view>
  37. </view>
  38. </view>
  39. <view class="modal" :style="{top:modalTop+'px'}" v-if="index == 1">
  40. <view class="content">
  41. <scroll-view scroll-y="true" style="height:100%">
  42. <view class="top" :class="activeIndex === 0 ? 'activesty' : ''" @click="testClick(3)">全部</view>
  43. <view class="list">
  44. <view class="item" :class="activeIndex == listItem.goodsId ? 'activesty' : ''" v-for="(listItem,listIndex) in list" :key="listIndex" @click="testClick(listItem)">
  45. {{ listItem.goodsName }}
  46. </view>
  47. </view>
  48. </scroll-view>
  49. </view>
  50. <view class="modal_wrap" @click="index = 0"></view>
  51. </view>
  52. <view class="notice_modal" :style="{top:modalTop+'px'}" v-if="index == 2">
  53. <view class="content">
  54. <scroll-view scroll-y="true" style="height:100%">
  55. <view class="top" :class="typeIndex === 0 ? 'activesty' : ''" @click="paperClick(3)">全部试卷类型</view>
  56. <view class="list">
  57. <view class="item" :class="typeIndex == listItem.paperId ? 'activesty' : ''" v-for="(listItem,listIndex) in list1" :key="listIndex" @click="paperClick(listItem)">{{ listItem.paperName }}</view>
  58. </view>
  59. </scroll-view>
  60. </view>
  61. <view class="modal_wrap" @click="index = 0"></view>
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. export default {
  67. data() {
  68. return {
  69. openAppoint:false,
  70. appointModal:false,
  71. noticeModal:false,
  72. index: 0,
  73. list: [],
  74. list1: [],
  75. recordList: [],
  76. goodsData: {},
  77. param: {
  78. pageNum: 1,
  79. pageSize: 10
  80. },
  81. dateFrom:'',
  82. dateTo:'',
  83. isRepeat:false,
  84. total: 0,
  85. activeIndex: 0,
  86. typeIndex:0,
  87. itemIndex:'',
  88. modalTop:0,
  89. endDate:'',
  90. };
  91. },
  92. onLoad(option) {
  93. this.dateFrom = this.$method.timestampToTime(new Date().getTime() / 1000).replace(/-/g,'/');
  94. this.dateTo = this.$method.timestampToTime(new Date().getTime() / 1000).replace(/-/g,'/');
  95. this.endDate = this.$method.timestampToTime(new Date().getTime() / 1000).replace(/-/g,'/');
  96. uni.getSystemInfo({
  97. success:(e) => {
  98. let info = uni.createSelectorQuery().select(".nav");
  99. info.boundingClientRect((navData) => { //data - 各种参数
  100. let info = uni.createSelectorQuery().select(".tabs");
  101. info.boundingClientRect((tabData) => { //data - 各种参数
  102. this.modalTop = navData.height + tabData.height
  103. console.log(navData) // 获取元素宽度
  104. console.log(tabData) // 获取元素宽度
  105. }).exec()
  106. }).exec()
  107. }
  108. })
  109. },
  110. onPullDownRefresh() {
  111. let that = this;
  112. this.param = {
  113. pageNum: 1,
  114. pageSize: 10
  115. };
  116. this.getExamRecordList();
  117. setTimeout(function() {
  118. uni.stopPullDownRefresh();
  119. }, 500);
  120. },
  121. onReachBottom() {
  122. if (this.recordList.length < this.total) {
  123. this.param.pageNum++;
  124. this.getExamRecordList();
  125. }
  126. },
  127. onShow() {
  128. if(this.isRepeat) {
  129. this.addRecord();
  130. } else {
  131. if(this.itemIndex !== '') {
  132. this.refreshByIndex();
  133. }
  134. }
  135. },
  136. methods: {
  137. refreshByIndex() {
  138. this.$api.examRecordGroupList({
  139. pageNum: this.itemIndex+1,
  140. pageSize: 1
  141. }).then(res => {
  142. this.$set(this.recordList,this.itemIndex,res.data.rows[0])
  143. this.itemIndex = ''
  144. });
  145. },
  146. appoint(item) {
  147. this.appointModal = true;
  148. },
  149. tab(index) {
  150. console.log(index,this.index)
  151. if(this.index == index) {
  152. this.index = 0;
  153. return;
  154. }
  155. this.index = index;
  156. console.log(this.index);
  157. },
  158. bindDateFromChange(e) {
  159. this.dateFrom = e.detail.value
  160. },
  161. bindDateToChange(e) {
  162. this.dateTo = e.detail.value
  163. }
  164. }
  165. };
  166. </script>
  167. <style>
  168. page {
  169. background: #eaeef1;
  170. }
  171. </style>
  172. <style lang="scss" scope>
  173. .animals{
  174. transition: all 0.3s;
  175. transform: rotate(180deg);
  176. }
  177. .tabs {
  178. position: fixed;
  179. padding:18rpx 0;
  180. left: 0;
  181. width: 100%;
  182. display: flex;
  183. z-index: 10;
  184. background: #ffffff;
  185. .tab {
  186. padding:0 18rpx;
  187. flex: 1;
  188. display: flex;
  189. justify-content: space-between;
  190. background: #ffffff;
  191. font-size: 24rpx;
  192. color: #999999;
  193. &:nth-of-type(1) {
  194. border-right:1px solid #EEEEEE;
  195. }
  196. .dateRange {
  197. display: flex;
  198. justify-content: space-between;
  199. }
  200. &.active {
  201. color: #333333;
  202. .icon{
  203. transform: rotate(180deg);
  204. }
  205. }
  206. }
  207. }
  208. .record {
  209. margin-top:80rpx;
  210. padding: 16rpx 16rpx;
  211. display: flex;
  212. flex-wrap: wrap;
  213. .item {
  214. margin-bottom: 16rpx;
  215. width:351rpx;
  216. background: #ffffff;
  217. border-radius: 16rpx;
  218. position: relative;
  219. &:nth-of-type(2n) {
  220. margin-left:16rpx;
  221. }
  222. &__header {
  223. width: 100%;
  224. height: 170rpx;
  225. position:relative;
  226. .note {
  227. position:absolute;
  228. left:0;
  229. top:0;
  230. width: 136rpx;
  231. height: 40rpx;
  232. background: linear-gradient(90deg, #B37FEB, #722ED1);
  233. box-shadow: 3rpx 3rpx 6rpx 0rpx rgba(239, 219, 255, 0.6);
  234. border-radius: 16rpx 0rpx 8rpx 0rpx;
  235. text-align: center;
  236. color:#fff;
  237. image {
  238. width:24rpx;
  239. vertical-align: middle;
  240. }
  241. }
  242. .img {
  243. width:100%;
  244. height:100%;
  245. }
  246. }
  247. &__body {
  248. padding:16rpx;
  249. .title {
  250. font-size: 30rpx;
  251. color: #333333;
  252. line-height: 48rpx;
  253. font-weight: bold;
  254. }
  255. .desc {
  256. margin-top:10rpx;
  257. font-size: 24rpx;
  258. color: #666666;
  259. line-height: 36rpx;
  260. }
  261. .btn {
  262. margin-top:30rpx;
  263. background: #FFFFFF;
  264. border-radius: 16rpx;
  265. height: 64rpx;
  266. line-height: 62rpx;
  267. text-align: center;
  268. font-size: 28rpx;
  269. border: 1px solid #D9D9D9;
  270. color:#D9D9D9;
  271. &.active {
  272. border: 1px solid #007AFF;
  273. color:#007AFF;
  274. }
  275. }
  276. }
  277. }
  278. }
  279. .notice {
  280. position:fixed;
  281. right:0;
  282. top:50%;
  283. width: 48rpx;
  284. height: 200rpx;
  285. background: #52C41A;
  286. box-shadow: 0px 3rpx 16rpx 0rpx rgba(44, 121, 7, 0.5);
  287. border-radius: 24rpx;
  288. display: flex;
  289. flex-direction: column;
  290. align-items: center;
  291. justify-content: center;
  292. padding:10rpx 0;
  293. .text {
  294. flex:1;
  295. color:#fff;
  296. text-align: center;
  297. }
  298. }
  299. .modal {
  300. bottom:0;
  301. z-index: 199999999;
  302. position: fixed;
  303. left: 0;
  304. width: 100%;
  305. .content {
  306. height:80%;
  307. overflow: hidden;
  308. position: relative;
  309. z-index: 10;
  310. background: #fff;
  311. padding: 8rpx 12rpx 20rpx;
  312. display: flex;
  313. flex-wrap: wrap;
  314. .top {
  315. margin: 0 auto;
  316. width: 726rpx;
  317. height: 80rpx;
  318. background: #f5f5f5;
  319. color: #666666;
  320. border-radius: 16rpx;
  321. text-align: center;
  322. line-height: 80rpx;
  323. font-size: 32rpx;
  324. }
  325. .list {
  326. width:100%;
  327. margin-top: 16rpx;
  328. display: flex;
  329. flex-wrap: wrap;
  330. justify-content: space-between;
  331. .item {
  332. padding: 25rpx 20rpx;
  333. width: 49%;
  334. background: #f5f5f5;
  335. border-radius: 16rpx;
  336. font-size: 32rpx;
  337. color: #666666;
  338. margin: 8rpx 0;
  339. }
  340. }
  341. }
  342. .modal_wrap {
  343. position: absolute;
  344. left: 0;
  345. width: 100%;
  346. top: 0;
  347. height: 100%;
  348. background: rgba(0, 0, 0, 0.3);
  349. }
  350. }
  351. .activesty {
  352. background: #007aff !important;
  353. color: #fff !important;
  354. }
  355. </style>