searchstuDetail.vue 16 KB

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