searchstuDetail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. <template>
  2. <!-- 学生详情 -->
  3. <div class="studentDetail" ref="tabs">
  4. <bar :tit="'学生记录'" :backPage="1"></bar>
  5. <div style="height: 50px;"></div>
  6. <!-- 顶部学生信息开始 -->
  7. <div class="top">
  8. <div class="UserInfo" style="flex: 1;">
  9. <div class="sInfo">
  10. <div class="userName">{{ studentInfo.name }}</div>
  11. </div>
  12. <div class="cla">{{ studentInfo.cname }}</div>
  13. <div class="backPage" v-if="isSelectShow" @click="fuClick1"></div>
  14. <selectStyle
  15. ref="claSel"
  16. @shadeIsShow="shadeIsShow"
  17. @update-search="handleUpdateSearch"
  18. :listCont="termList"
  19. :tit="'请选择学期'"
  20. :choose="termData"
  21. ></selectStyle>
  22. <div class="dataNum">本学期共计{{ TermRecord.length }} 条记录</div>
  23. </div>
  24. </div>
  25. <!-- 顶部学生信息结束 -->
  26. <!-- 观察记录开始 -->
  27. <div style="position: relative;top: -15px;">
  28. <div class="observe_tit">
  29. <div class="left">
  30. <img class="img" src="../../assets/images/eva/Frame (4).png" alt="" />
  31. <div>观察记录</div>
  32. </div>
  33. <img class="img" src="../../assets/images/eva/Frame (5).png" alt="" />
  34. </div>
  35. <div class="observe_box">
  36. <div
  37. class="observe_boxCon"
  38. v-for="(i, index) in filtrate"
  39. @click="addFil(i.id, index)"
  40. :class="{ active: activeItem === index }"
  41. :key="index"
  42. @touchstart="touchStart(index)"
  43. @touchend="touchend(index)"
  44. @touchmove="gtouchmove()"
  45. >
  46. <div class="txt">{{ i.name }}</div>
  47. <div ref="loop" class="loopList">
  48. {{ i.name }}
  49. </div>
  50. </div>
  51. <!-- </div> -->
  52. </div>
  53. <!-- 观察内容开始 -->
  54. <van-swipe-cell
  55. :swipeable="true"
  56. v-show="conList.length"
  57. v-for="(i, index) in conList"
  58. :key="index"
  59. @touchmove.stop="handleTouchMove"
  60. >
  61. <div class="observe_content" @click="recordContinue(i.rid)">
  62. <div class="observe_contentTit">
  63. <!-- {{ i.recordTit }} -->
  64. 观察内容
  65. </div>
  66. <div class="observe_contentBir">
  67. <div>{{ i.username }}</div>
  68. <div>{{ i.recordDate }}</div>
  69. </div>
  70. <div class="observe_contentTxt">
  71. {{ i.recordContent }}
  72. </div>
  73. </div>
  74. <template #right>
  75. <div class="observe_contentDel" @click="delPop(i.rid)">
  76. <img src="../../assets/images/eva/del.png" style="width: 20px;height: 20px;" alt="" />
  77. </div>
  78. <!-- <van-button square text="删除" type="danger" class="delete-button" /> -->
  79. </template>
  80. </van-swipe-cell>
  81. <div v-show="!conList.length" style="width: 100%;height: 10px;background-color: #F0F2F5;"></div>
  82. <div v-show="!conList.length" class="observe_content observe_content2">
  83. <img src="../../assets//images/eva/rqq.png" alt="" />
  84. <div class="tit">暂无内容</div>
  85. <div class="tit2" @click="addRecord">快去添加新记录吧 ></div>
  86. </div>
  87. <!-- 观察内容结束 -->
  88. </div>
  89. <!-- 观察记录结束 -->
  90. <pop v-show="isShowMask">
  91. <template v-slot:tit>确定</template>
  92. <template v-slot:con>确定删除吗</template>
  93. <template v-slot:btn1>
  94. <div class="btn" style="color: rgba(136,136,136,1);" @click="isShowMask = false">取消</div>
  95. </template>
  96. <template v-slot:btn2>
  97. <div class="btn" style="color: rgba(251,67,25,1);" @click="delCon">确认</div>
  98. </template>
  99. </pop>
  100. <!-- 添加记录按钮开始 -->
  101. <div class="addRecord" @click="addRecord">
  102. <img src="../../assets/images/eva/add.png" alt="" />
  103. </div>
  104. <!-- 添加记录按钮结束 -->
  105. </div>
  106. </template>
  107. <script>
  108. import { selectStudentDetail } from '@/api/eva'
  109. // import { selectClassStudent } from '@/api/eva'
  110. import { selectVeiDoo } from '@/api/eva'
  111. import { selectRecord } from '@/api/eva'
  112. import { selectTerm } from '@/api/eva'
  113. // import { selectStuClass } from '@/api/eva'
  114. import { updateRecord } from '@/api/eva'
  115. // 单选
  116. import selectStyle from './components/selectStyle.vue'
  117. import bar from './components/bar.vue'
  118. // 弹窗组件
  119. import pop from './components/pop.vue'
  120. export default {
  121. components: {
  122. bar,
  123. pop,
  124. selectStyle
  125. },
  126. data() {
  127. return {
  128. // 遮罩层
  129. isSelectShow: false,
  130. activeItem: null,
  131. // 观察记录数组
  132. conList: [],
  133. // 筛选项
  134. filtrate: [],
  135. // 学生信息
  136. studentInfo: {},
  137. // 请求筛选条件
  138. fil: [],
  139. // 班级学生列表
  140. stuList: [],
  141. // 学生id
  142. stuId: '',
  143. // 传参班级数据
  144. classInfo: this.$route.query,
  145. num: null,
  146. // 弹窗的
  147. isShowMask: false,
  148. delRid: '',
  149. termList: [],
  150. termData: [],
  151. TermRecord: [],
  152. timeOutEvent: 0,
  153. scorllTaps: null
  154. }
  155. },
  156. methods: {
  157. handleTouchMove(event) {
  158. event.preventDefault()
  159. },
  160. touchStart(e) {
  161. this.timeOutEvent = setTimeout(() => {
  162. this.timeOutEvent = 0
  163. const target = this.$refs.loop[e]
  164. target.style.display = 'block'
  165. if (e % 4 !== 0) {
  166. console.log(0)
  167. target.style.right = '0'
  168. }
  169. }, 500)
  170. return false
  171. },
  172. // 如果手指有移动,则取消所有事件,此时说明用户只是要移动而不是长按
  173. gtouchmove() {
  174. clearTimeout(this.timeOutEvent) // 清除定时器
  175. this.timeOutEvent = 0
  176. // alert('取消了')
  177. },
  178. touchend(e) {
  179. // 清除定时器
  180. clearTimeout(this.timeOutEvent)
  181. if (this.timeOutEvent !== 0) {
  182. // 这里写要执行的内容(尤如onclick事件)
  183. console.log('你这是点击,不是长按')
  184. } else {
  185. setTimeout(() => {
  186. const target = this.$refs.loop[e]
  187. target.style.display = 'none'
  188. }, 1000)
  189. }
  190. },
  191. // 获取基础数据
  192. getData() {
  193. // 获取学生信息
  194. const data = {
  195. uid: this.stuId,
  196. trm: this.termData[0]
  197. }
  198. console.log(data)
  199. selectStudentDetail(data).then(res => {
  200. this.studentInfo = res[0][0]
  201. console.log('获取学生信息', this.studentInfo)
  202. })
  203. // 获取所有学生记录
  204. const data4 = {
  205. uid: this.stuId,
  206. trm: this.termData[0],
  207. txt: ''
  208. }
  209. selectRecord(data4).then(res => {
  210. console.log('获取所有学生记录', res[0])
  211. this.conList = res[0]
  212. })
  213. // 获取筛选框
  214. const data3 = {
  215. oid: this.$store.state.user.userinfo.organizeid
  216. }
  217. selectVeiDoo(data3).then(res => {
  218. this.filtrate = res[0]
  219. })
  220. },
  221. selTerm() {
  222. // 获取学期筛选框
  223. selectTerm().then(res => {
  224. console.log('获取学期筛选框', res)
  225. res[0].forEach(e => {
  226. if (e.defaultC === 1) {
  227. this.termData.push(e.id)
  228. }
  229. })
  230. // console.log('this.termData', this.termData)
  231. this.termList = res[0]
  232. this.getData()
  233. this.getTermRecord()
  234. // console.log('this.termList', this.termList)
  235. })
  236. },
  237. // 删除弹框显示
  238. delPop(e) {
  239. this.delRid = e
  240. this.isShowMask = true
  241. },
  242. // 删除数据
  243. delCon() {
  244. const data = [{ rid: this.delRid }]
  245. updateRecord(data).then(res => {
  246. if (res === 1) {
  247. this.$toast({
  248. message: '删除成功',
  249. type: 'success'
  250. })
  251. this.isShowMask = false
  252. this.getTermRecord()
  253. setTimeout(() => {
  254. this.getData()
  255. }, 500)
  256. } else {
  257. this.$toast({
  258. message: '删除失败',
  259. type: 'fail'
  260. })
  261. }
  262. })
  263. },
  264. // 筛选按钮
  265. addFil(e, index) {
  266. // 同一个点击第二次时取消选择
  267. if (this.activeItem === index) {
  268. this.activeItem = null
  269. e = ''
  270. } else {
  271. this.activeItem = index
  272. }
  273. // this.fil.push(e)
  274. const data4 = {
  275. uid: localStorage.getItem('userId'),
  276. trm: this.termData[0],
  277. txt: e
  278. }
  279. // console.log(data4)
  280. selectRecord(data4).then(res => {
  281. console.log('获取所有学生记录', res)
  282. this.conList = res[0]
  283. })
  284. },
  285. fuClick1() {
  286. this.isSelectShow = false
  287. this.$refs.claSel.close()
  288. },
  289. shadeIsShow() {
  290. console.log(11111)
  291. this.isSelectShow = true
  292. },
  293. // 获取学期学生记录
  294. getTermRecord() {
  295. const data4 = {
  296. uid: localStorage.getItem('userId'),
  297. trm: this.termData[0],
  298. txt: ''
  299. }
  300. // console.log(' 获取所有学生记录aaaaaaaaaaaaaaaaaaaaaaa', data4)
  301. selectRecord(data4).then(res => {
  302. console.log('获取所有学生记录', res)
  303. this.TermRecord = res[0]
  304. })
  305. },
  306. // 子组件调用父组件方法
  307. handleUpdateSearch(e) {
  308. this.isSelectShow = false
  309. // console.log(e)
  310. // 获取筛选学期所有学生记录
  311. const data4 = {
  312. uid: this.stuId,
  313. trm: this.termData[0],
  314. txt: ''
  315. }
  316. // console.log('data4', data4)
  317. selectRecord(data4).then(res => {
  318. console.log('获取所有学生记录', res[0])
  319. this.conList = res[0]
  320. })
  321. this.getTermRecord()
  322. },
  323. // 添加记录按钮跳转
  324. addRecord() {
  325. this.$router.push(`/searchStudentEva?shareShow=${0}&isSea=${0}`)
  326. // this.$router.push(`/searchStudentEva?shareShow=${0}&cid=${this.classInfo.cid}&CName=${this.classInfo.cName}`)
  327. },
  328. // 已经写过的记录卡片点击跳转
  329. recordContinue(e) {
  330. this.$router.push(`/searchStudentEva?shareShow=${1}&rid=${e}&isSea=${0}`)
  331. // this.$router.push(
  332. // `/searchStudentEva?shareShow=${1}&cid=${this.classInfo.cid}&CName=${this.classInfo.cName}&rid=${e}`
  333. // )
  334. }
  335. },
  336. beforeRouteEnter(to, from, next) {
  337. document.addEventListener(
  338. 'touchmove',
  339. function(event) {
  340. event.preventDefault()
  341. },
  342. false
  343. )
  344. next(vm => {})
  345. },
  346. mounted() {},
  347. created() {
  348. this.stuId = localStorage.getItem('userId')
  349. this.selTerm()
  350. }
  351. }
  352. </script>
  353. <style lang="scss" scoped>
  354. .goods-card {
  355. margin: 0;
  356. background-color: #fff;
  357. }
  358. .loopList {
  359. height: 20px;
  360. line-height: 20px;
  361. display: none;
  362. position: absolute;
  363. // min-width: 120px;
  364. text-wrap: nowrap;
  365. font-size: 12px;
  366. border-radius: 5px;
  367. padding: 0 5px;
  368. background-color: #309cd6;
  369. top: -80%;
  370. color: #fff;
  371. // left: 0;
  372. // right: 0;
  373. }
  374. .loopList:nth-child(4n) {
  375. background-color: #e0eafb;
  376. }
  377. .backPage {
  378. // background-color: aquamarine;
  379. position: absolute;
  380. top: 0;
  381. left: 0;
  382. width: 100%;
  383. height: 90vh;
  384. z-index: 99;
  385. }
  386. .delete-button {
  387. height: 100%;
  388. }
  389. .observe_contentDel {
  390. width: 50px;
  391. height: 100%;
  392. display: flex;
  393. justify-content: center;
  394. align-items: center;
  395. background-color: red;
  396. }
  397. .observe_content {
  398. // margin: 0 10px;
  399. width: 100%;
  400. min-height: 95px;
  401. // max-height: 95px;
  402. border-bottom: 1px solid #e7e7e7;
  403. box-sizing: border-box;
  404. padding: 0 10px;
  405. overflow: hidden;
  406. background-color: #fff;
  407. .observe_contentTit {
  408. // line-height: 20px;
  409. box-sizing: border-box;
  410. padding: 8px 0;
  411. font-weight: 550;
  412. color: rgba(16, 16, 16, 1);
  413. font-size: 14px;
  414. text-align: left;
  415. font-family: PingFangSC-regular;
  416. }
  417. .observe_contentBir {
  418. display: flex;
  419. // color: rgba(79, 79, 79, 1);
  420. color: rgba(0, 0, 0, 0.4);
  421. font-size: 10px;
  422. text-align: left;
  423. font-family: PingFangSC-regular;
  424. }
  425. .observe_contentBir :first-child {
  426. margin-right: 10px;
  427. }
  428. .observe_contentTxt {
  429. margin-top: 5px;
  430. // color: rgba(16, 16, 16, 1);
  431. color: rgba(0, 0, 0, 0.6);
  432. font-size: 12px;
  433. text-align: left;
  434. font-family: PingFangSC-regular;
  435. display: -webkit-box;
  436. -webkit-line-clamp: 3;
  437. -webkit-box-orient: vertical;
  438. overflow: hidden;
  439. text-overflow: ellipsis;
  440. }
  441. }
  442. .studentDetail {
  443. width: 100%;
  444. min-height: 100vh;
  445. background-color: #f0f2f5;
  446. overflow: hidden;
  447. // 顶部学生信息开始
  448. .top {
  449. margin: auto;
  450. width: 100vw;
  451. height: 150px;
  452. background-color: #005ccd;
  453. display: flex;
  454. justify-content: space-between;
  455. align-items: center;
  456. box-sizing: border-box;
  457. padding: 0 10px;
  458. color: #fff;
  459. .rig {
  460. display: flex;
  461. width: 40%;
  462. height: 100%;
  463. justify-content: space-around;
  464. .topBtnS {
  465. // flex: 1;
  466. width: 90px;
  467. display: flex;
  468. justify-content: space-between;
  469. align-items: center;
  470. .img {
  471. width: 30px;
  472. height: 30px;
  473. }
  474. }
  475. }
  476. .UserInfo {
  477. display: flex;
  478. flex-direction: column;
  479. // height: 55px;
  480. justify-content: space-between;
  481. .sInfo {
  482. display: flex;
  483. .userName {
  484. width: 120px;
  485. text-overflow: ellipsis;
  486. overflow: hidden;
  487. margin-right: 5px;
  488. height: 20px;
  489. line-height: 20px;
  490. color: #ffffff;
  491. font-size: 20px;
  492. text-align: left;
  493. font-family: PingFangSC-regular;
  494. }
  495. }
  496. .cla {
  497. height: 20px;
  498. line-height: 30px;
  499. font-size: 12px;
  500. color: #ffffff;
  501. }
  502. .dataNum {
  503. // width: 150px;
  504. height: 20px;
  505. line-height: 20px;
  506. color: #fff;
  507. font-size: 16px;
  508. text-align: left;
  509. font-family: PingFangSC-regular;
  510. }
  511. }
  512. }
  513. // 顶部学生信息结束
  514. // 观察记录开始
  515. .observe_tit {
  516. // position: relative;
  517. // top: -15px;
  518. width: 100%;
  519. box-sizing: border-box;
  520. padding: 10px;
  521. display: flex;
  522. line-height: 20px;
  523. color: rgba(16, 16, 16, 1);
  524. font-size: 14px;
  525. text-align: left;
  526. font-family: PingFangSC-regular;
  527. align-items: center;
  528. border-radius: 15px 15px 0 0;
  529. // transform: translate(0, -10px);
  530. background-color: #fff;
  531. justify-content: space-between;
  532. font-weight: bold;
  533. .left {
  534. display: flex;
  535. align-items: center;
  536. }
  537. .img {
  538. width: 26px;
  539. }
  540. }
  541. .observe_box {
  542. width: 100%;
  543. line-height: 20px;
  544. background-color: rgba(255, 255, 255, 1);
  545. color: rgba(16, 16, 16, 1);
  546. font-size: 14px;
  547. text-align: center;
  548. font-family: Roboto;
  549. box-sizing: border-box;
  550. padding: 0 10px;
  551. display: flex;
  552. justify-content: flex-start;
  553. flex-wrap: wrap;
  554. .observe_boxCon {
  555. position: relative;
  556. // width: calc(100% / 5);
  557. width: calc(100% / 4 - (5px * 3));
  558. height: 30px;
  559. line-height: 30px;
  560. border-radius: 4px;
  561. background-color: #fff;
  562. color: rgba(153, 152, 152, 1);
  563. font-size: 12px;
  564. text-align: center;
  565. font-family: Roboto;
  566. box-sizing: border-box;
  567. border: 1px solid rgba(231, 231, 231, 1);
  568. margin-bottom: 8px;
  569. margin-right: 20px;
  570. .txt {
  571. overflow: hidden;
  572. text-overflow: ellipsis;
  573. white-space: nowrap;
  574. }
  575. }
  576. .observe_boxCon:nth-child(4n) {
  577. margin-right: 0;
  578. }
  579. .active {
  580. background-color: #e0eafb;
  581. color: #0061ff;
  582. }
  583. // .observe_boxSelect {
  584. // width: 100%;
  585. // display: flex;
  586. // justify-content: flex-start;
  587. // align-items: center;
  588. // flex-wrap: wrap;
  589. // // height: 100%;
  590. // }
  591. }
  592. // 观察记录结束
  593. // 观察内容开始
  594. .observe_content2 {
  595. margin-top: 10px;
  596. border: none;
  597. height: 250px;
  598. text-align: center;
  599. display: flex;
  600. align-items: center;
  601. flex-direction: column;
  602. justify-content: center;
  603. background-color: #fff;
  604. .tit {
  605. margin: 5px 0;
  606. color: rgba(0, 0, 0, 0.4);
  607. font-family: Microsoft YaHei;
  608. font-size: 14px;
  609. font-style: normal;
  610. font-weight: 700;
  611. }
  612. .tit2 {
  613. color: #3681fc;
  614. font-family: Microsoft YaHei;
  615. font-size: 14px;
  616. font-style: normal;
  617. font-weight: 400;
  618. }
  619. img {
  620. width: 80px;
  621. height: 80px;
  622. }
  623. }
  624. // 观察内容结束
  625. // 添加记录按钮开始
  626. .addRecord {
  627. position: fixed;
  628. bottom: 20px;
  629. right: 10px;
  630. width: 50px;
  631. height: 50px;
  632. border-radius: 50%;
  633. background-color: #fff;
  634. font-size: 14px;
  635. font-family: Microsoft Yahei;
  636. display: flex;
  637. justify-content: center;
  638. align-items: center;
  639. box-shadow: 0px 0px 10px 0px rgba(0, 0, 0, 0.1);
  640. img {
  641. width: 16px;
  642. height: 16px;
  643. }
  644. }
  645. // 添加记录按钮结束
  646. }
  647. </style>