index_new.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  1. <template>
  2. <view class="list">
  3. <!-- <u-picker :show="true" :columns="termList" keyName="name"></u-picker> -->
  4. <view class="list_head">
  5. <view class="list_select" @click="openTerm" >
  6. <!-- <u-picker :defaultIndex="[0]" :show="true" :columns="termList" keyName="name" @cancel="cancel" @confirm="confirm" @change="changeTerm">
  7. {{this.termName}}
  8. </u-picker> -->
  9. <picker @change="bindPickerChange" :value="index" :range-key="'name'" :range="termList">
  10. <view class="uni-input" style="font-size: 12px;">{{termList[index].name}}</view>
  11. </picker>
  12. <view class='neirong'>
  13. </view>
  14. <image src="../../static/more.png" mode=""></image>
  15. </view>
  16. <u-search @change="changeName" @search="searchBtn" class="list_search" shape="square" placeholder="请输入学生姓名" placeholder-color="#b9b9b9" searchIconColor="#b9b9b9" :showAction="false" bgColor="#F7F7F7"></u-search>
  17. <view class="list_btn" @click="shaixuanBtn">
  18. 筛选
  19. </view>
  20. </view>
  21. <!-- 判断是否为空 -->
  22. <view v-if="list.length > 0">
  23. <view class="list_content" v-for="(item,index) in list" :key='index' @click="student_detail(item.id)">
  24. <view class="top">
  25. <view class="headimg" >
  26. <image :src="item.headimg" mode="aspectFill"></image>
  27. </view>
  28. <view class="message">
  29. <view class="name">
  30. {{item.truename}}
  31. </view>
  32. <!-- <view class="same">
  33. <view class="circle">
  34. </view>
  35. <view class="ding">手机号:</view><view class="words">{{item.mobile ? item.mobile : '--'}}</view>
  36. </view> -->
  37. <view class="same">
  38. <view class="circle">
  39. </view>
  40. <view class="ding">
  41. 班级:
  42. </view><view class="words">{{item.grade ? item.grade.name : '--'}}</view>
  43. </view>
  44. <view class="same">
  45. <view class="circle">
  46. </view>
  47. <view class="ding">
  48. 学号:
  49. </view><view class="words">{{item.account}}</view>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="bottom">
  54. <view class="left">
  55. 需求:
  56. </view>
  57. <view class="right">
  58. {{item.demand}}
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. <view class="enptyStatus" v-else>
  64. <image src="../../static/empty.png" mode=""></image>
  65. <view class="words">
  66. 暂无学生
  67. </view>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. export default {
  73. data() {
  74. return {
  75. term:'请选择',
  76. showTerm: true,
  77. list: [],
  78. page: 1,
  79. last: false,
  80. termList:[{
  81. id:'',
  82. name:''
  83. }],
  84. termId:'',
  85. termName:'',
  86. searchName:'',
  87. index:0,
  88. }
  89. },
  90. onShow() {
  91. if(this.is_weixin()){
  92. this.navTitle()
  93. }
  94. this.page = 1
  95. this.list = []
  96. this.last = false
  97. let nowDate = new Date()
  98. let month = nowDate.getMonth() + 1
  99. // if (month >= 9) {
  100. // this.term = 1
  101. // } else {
  102. // this.term = 2
  103. // }
  104. this.getList()
  105. this.getTerm()
  106. },
  107. onReachBottom() {
  108. if (!this.last) {
  109. this.page++
  110. }
  111. console.log(this.page)
  112. this.getList()
  113. },
  114. methods: {
  115. //判断是否是微信
  116. is_weixin() {
  117. let ua = navigator.userAgent.toLowerCase();
  118. return ua.indexOf('micromessenger') != -1;
  119. },
  120. navTitle() {
  121. let navTitle = document.getElementsByTagName('uni-page-head');
  122. navTitle[0].style.display = 'none'
  123. },
  124. // 拿取学期
  125. getTerm(){
  126. this.$u.get('/mentor/term-select-options').then(res => {
  127. // this.termList = res.data.map(item=>{
  128. // return item.name
  129. // })
  130. this.termList = res.data
  131. console.log(this.termList, '学期数据')
  132. })
  133. },
  134. // 触发picker弹窗时间
  135. openTerm(){
  136. this.showTerm = true
  137. console.log(this.termList,"搜索触发111")
  138. },
  139. bindPickerChange(e){
  140. console.log(e, '********')
  141. this.index = e.target.value
  142. this.termId = this.termList[this.index].id
  143. console.log(this.termId, '000000')
  144. },
  145. // 点击筛选俩字
  146. shaixuanBtn(){
  147. this.list=[]
  148. this.page = 1
  149. this.last = false
  150. this.getList()
  151. },
  152. // 搜索事件
  153. searchBtn(e){
  154. this.searchName = e
  155. console.log(e, "搜索触发000")
  156. },
  157. changeName(e){
  158. this.searchName = e
  159. console.log(e, "搜索内容变化时")
  160. },
  161. //获取我的学生列表
  162. getList() {
  163. let data = {
  164. page:this.page,
  165. term_id: this.termId,
  166. student_name: this.searchName,
  167. }
  168. this.$u.get('/mentor/subscribe-student', data).then(res => {
  169. let data = res.data.list
  170. if (this.page > 1 && data.length == 0) {
  171. uni.showToast({
  172. title: '暂无更多',
  173. icon: 'none'
  174. })
  175. this.last = true
  176. } else {
  177. this.list = this.list.concat(data)
  178. }
  179. })
  180. },
  181. //跳转学生详情
  182. student_detail(id) {
  183. uni.navigateTo({
  184. url: './details?id=' + id
  185. })
  186. }
  187. }
  188. }
  189. </script>
  190. <style lang="scss" scoped>
  191. page{
  192. background-color: #F7F7F7;
  193. border-top: 0.5px solid rgba(0, 0, 0, 0.1);
  194. }
  195. .list {
  196. .enptyStatus{
  197. display: flex;
  198. margin-top: 100px;
  199. justify-content: center;
  200. align-items: center;
  201. flex-direction: column;
  202. padding: 30px 10px;
  203. image{
  204. width: 80px;
  205. height: 120px;
  206. }
  207. .words{
  208. color: #ffae21;
  209. font-size: 14px;
  210. padding-top: 10px;
  211. }
  212. }
  213. // .colorWord{
  214. // color: #000000;
  215. // }
  216. // padding: 0 15px;
  217. .list_head{
  218. padding: 0 10px 0 10px;
  219. display: flex;
  220. align-items: center;
  221. height: 44px;
  222. // background-color: #FFFFFF;
  223. background-color: #FFFFFF;
  224. .list_select{
  225. margin: 0 10px 0 0;
  226. // color: #b9b9b9;
  227. // color: red !important;
  228. background: #F7F7F7;
  229. width: 140px;
  230. display: flex;
  231. justify-content: space-around;
  232. align-items: center;
  233. image{
  234. margin-right: 5px;
  235. width: 13px;
  236. height: 18px;
  237. transform: rotate(90deg);
  238. }
  239. height: 28px;
  240. // border: 1px solid red;
  241. }
  242. .list_search{
  243. // color: #138E57;
  244. color: red;
  245. // color: #b9b9b9;
  246. // opacity: 0.25;
  247. height: 28px;
  248. // border: 1px solid blue;
  249. // border-radius: 1px;
  250. }
  251. .list_btn{
  252. width: 30px;
  253. margin-left: 9px;
  254. color: #D12727;
  255. font-size: 15px;
  256. cursor: pointer;
  257. }
  258. }
  259. .list_content{
  260. margin: 0 15px;
  261. margin-top: 15px;
  262. width: 345px;
  263. height: 174px;
  264. background-color: #FFFFFF;
  265. border-radius: 5px;
  266. box-shadow: 0px -0.5px 0px #DDDDDD;
  267. .top{
  268. display: flex;
  269. height: 111px;
  270. width: 100%;
  271. .headimg{
  272. margin: 13px 10px 5px 14px;
  273. height: 91px;
  274. width: 83px;
  275. image{
  276. height: 85px;
  277. width: 80px;
  278. }
  279. // .image1{
  280. // height: 85px;
  281. // width: 80px;
  282. // background: url(../../static/images/stu_nan.png) no-repeat;
  283. // background-position: center;
  284. // background-size: cover;
  285. // }
  286. // .image{
  287. // height: 85px;
  288. // width: 80px;
  289. // background: url(../../static/images/stu_nv.png) no-repeat;
  290. // background-position: center;
  291. // background-size: cover;
  292. // }
  293. }
  294. .message{
  295. margin-top: 13px;
  296. margin-left: 5px;
  297. .name{
  298. color: #0C0C0C;
  299. font-style: normal;
  300. font-weight: 500;
  301. font-size: 15px;
  302. line-height: 18px;
  303. }
  304. .same{
  305. display: flex;
  306. margin-top: 10px;
  307. align-items: center;
  308. height: 14px;
  309. .circle{
  310. flex-shrink: 0;
  311. margin-right: 8px;
  312. width: 5px;
  313. height: 5px;
  314. border-radius: 50%;
  315. background: #F1A321;
  316. }
  317. .ding{
  318. flex-shrink: 0;
  319. width: 52px;
  320. font-size: 13px;
  321. color: #666666;
  322. opacity: 0.8;
  323. }
  324. .words{
  325. overflow: hidden; //超出部分隐藏
  326. text-overflow: ellipsis; //超出部分使用省略号
  327. display: -webkit-box;//布局
  328. -webkit-line-clamp: 1;
  329. line-clamp: 1;//设置两行显示
  330. -webkit-box-orient: vertical;
  331. word-break: break-all;
  332. color: #222222;
  333. font-style: normal;
  334. opacity: 0.8;
  335. font-size: 13px;
  336. line-height: 14px;
  337. }
  338. }
  339. }
  340. }
  341. .bottom{
  342. border-top: 0.5px solid #DDDDDD;
  343. display: flex;
  344. height: 63px;
  345. line-height: 20px;
  346. margin: 6px 15px;
  347. padding: 10px 0;
  348. .left{
  349. width: 40px;
  350. color: #666666;
  351. font-size: 13px;
  352. opacity: 0.8
  353. }
  354. .right{
  355. width: 260px;
  356. overflow: hidden; //超出部分隐藏
  357. text-overflow: ellipsis; //超出部分使用省略号
  358. display: -webkit-box;//布局
  359. -webkit-line-clamp: 2;
  360. line-clamp: 2;//设置两行显示
  361. -webkit-box-orient: vertical;
  362. word-break: break-all;
  363. }
  364. }
  365. }
  366. }
  367. </style>