index_new.vue 9.1 KB

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