index_new.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  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.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. console.log(this.termId, '000000')
  145. },
  146. // 点击筛选俩字
  147. shaixuanBtn(){
  148. this.list=[]
  149. this.page = 1
  150. this.last = false
  151. this.getList()
  152. },
  153. // 搜索事件
  154. searchBtn(e){
  155. this.searchName = e
  156. console.log(e, "搜索触发000")
  157. },
  158. changeName(e){
  159. this.searchName = e
  160. console.log(e, "搜索内容变化时")
  161. },
  162. //获取我的学生列表
  163. getList() {
  164. let data = {
  165. page:this.page,
  166. term_id: this.termId,
  167. student_name: this.searchName,
  168. }
  169. this.$u.get('/mentor/subscribe-student', data).then(res => {
  170. let data = res.data.list
  171. if (this.page > 1 && data.length == 0) {
  172. uni.showToast({
  173. title: '暂无更多',
  174. icon: 'none'
  175. })
  176. this.last = true
  177. } else {
  178. this.list = this.list.concat(data)
  179. }
  180. })
  181. },
  182. //跳转学生详情
  183. student_detail(id) {
  184. uni.navigateTo({
  185. url: './details?id=' + id
  186. })
  187. }
  188. }
  189. }
  190. </script>
  191. <style lang="scss" >
  192. page{
  193. background-color: #F7F7F7;
  194. border-top: 0.5px solid rgba(0, 0, 0, 0.1);
  195. padding-bottom: 70px;
  196. }
  197. .list {
  198. .enptyStatus{
  199. display: flex;
  200. margin-top: 100px;
  201. justify-content: center;
  202. align-items: center;
  203. flex-direction: column;
  204. padding: 30px 10px;
  205. image{
  206. width: 80px;
  207. height: 120px;
  208. }
  209. .words{
  210. color: #ffae21;
  211. font-size: 14px;
  212. padding-top: 10px;
  213. }
  214. }
  215. // .colorWord{
  216. // color: #000000;
  217. // }
  218. // padding: 0 15px;
  219. .list_head{
  220. padding: 0 10px 0 10px;
  221. display: flex;
  222. align-items: center;
  223. height: 44px;
  224. // background-color: #FFFFFF;
  225. background-color: #FFFFFF;
  226. .list_select{
  227. margin: 0 10px 0 0;
  228. // color: #b9b9b9;
  229. // color: red !important;
  230. background: #F7F7F7;
  231. width: 140px;
  232. display: flex;
  233. justify-content: space-around;
  234. align-items: center;
  235. image{
  236. margin-right: 5px;
  237. width: 13px;
  238. height: 18px;
  239. transform: rotate(90deg);
  240. }
  241. height: 28px;
  242. // border: 1px solid red;
  243. }
  244. .list_search{
  245. // color: #138E57;
  246. color: red;
  247. // color: #b9b9b9;
  248. // opacity: 0.25;
  249. height: 28px;
  250. // border: 1px solid blue;
  251. // border-radius: 1px;
  252. }
  253. .list_btn{
  254. width: 30px;
  255. margin-left: 9px;
  256. color: #138E57;
  257. font-size: 15px;
  258. cursor: pointer;
  259. }
  260. }
  261. .list_content{
  262. margin: 0 15px;
  263. margin-top: 15px;
  264. width: 345px;
  265. height: 174px;
  266. background-color: #FFFFFF;
  267. border-radius: 5px;
  268. box-shadow: 0px -0.5px 0px #DDDDDD;
  269. .top{
  270. display: flex;
  271. height: 111px;
  272. width: 100%;
  273. .headimg{
  274. margin: 13px 10px 5px 14px;
  275. height: 91px;
  276. width: 83px;
  277. image{
  278. height: 85px;
  279. width: 80px;
  280. }
  281. // .image1{
  282. // height: 85px;
  283. // width: 80px;
  284. // background: url(../../static/images/stu_nan.png) no-repeat;
  285. // background-position: center;
  286. // background-size: cover;
  287. // }
  288. // .image{
  289. // height: 85px;
  290. // width: 80px;
  291. // background: url(../../static/images/stu_nv.png) no-repeat;
  292. // background-position: center;
  293. // background-size: cover;
  294. // }
  295. }
  296. .message{
  297. margin-top: 13px;
  298. margin-left: 5px;
  299. .name{
  300. color: #0C0C0C;
  301. font-style: normal;
  302. font-weight: 500;
  303. font-size: 15px;
  304. line-height: 18px;
  305. }
  306. .same{
  307. display: flex;
  308. margin-top: 10px;
  309. align-items: center;
  310. height: 14px;
  311. .circle{
  312. flex-shrink: 0;
  313. margin-right: 8px;
  314. width: 5px;
  315. height: 5px;
  316. border-radius: 50%;
  317. background: #F1A321;
  318. }
  319. .ding{
  320. flex-shrink: 0;
  321. width: 52px;
  322. font-size: 13px;
  323. color: #666666;
  324. opacity: 0.8;
  325. }
  326. .words{
  327. overflow: hidden; //超出部分隐藏
  328. text-overflow: ellipsis; //超出部分使用省略号
  329. display: -webkit-box;//布局
  330. -webkit-line-clamp: 1;
  331. line-clamp: 1;//设置两行显示
  332. -webkit-box-orient: vertical;
  333. word-break: break-all;
  334. color: #222222;
  335. font-style: normal;
  336. opacity: 0.8;
  337. font-size: 13px;
  338. line-height: 14px;
  339. }
  340. }
  341. }
  342. }
  343. .bottom{
  344. border-top: 0.5px solid #DDDDDD;
  345. display: flex;
  346. height: 63px;
  347. line-height: 20px;
  348. margin: 6px 15px;
  349. padding: 10px 0;
  350. .left{
  351. width: 40px;
  352. color: #666666;
  353. font-size: 13px;
  354. opacity: 0.8
  355. }
  356. .right{
  357. width: 260px;
  358. overflow: hidden; //超出部分隐藏
  359. text-overflow: ellipsis; //超出部分使用省略号
  360. display: -webkit-box;//布局
  361. -webkit-line-clamp: 2;
  362. line-clamp: 2;//设置两行显示
  363. -webkit-box-orient: vertical;
  364. word-break: break-all;
  365. }
  366. }
  367. }
  368. }
  369. </style>