searchstuDetail.vue 17 KB

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