index.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">{{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" v-model="searchName" clearabled 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=""></image>
  27. <!-- <image v-if="item.sex == 1" src="../../static/images/stu_nan.png" mode=""></image>
  28. <image v-else src="../../static/images/stu_nv.png" mode=""></image> -->
  29. </view>
  30. <view class="message">
  31. <view class="name">
  32. {{item.truename}}
  33. </view>
  34. <view class="same">
  35. <view class="circle">
  36. </view>
  37. <view class="ding">手机号:</view><view class="words">{{item.mobile ? item.mobile : '--'}}</view>
  38. </view>
  39. <view class="same">
  40. <view class="circle">
  41. </view>
  42. <view class="ding">
  43. 班级:
  44. </view><view class="words">{{item.class ? item.class : '--'}}</view>
  45. </view>
  46. <view class="same">
  47. <view class="circle">
  48. </view>
  49. <view class="ding">
  50. 学号:
  51. </view><view class="words">{{item.account}}</view>
  52. </view>
  53. </view>
  54. </view>
  55. <view class="bottom">
  56. <view class="left">
  57. 需求:
  58. </view>
  59. <view class="right">
  60. {{item.demand}}
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. <view class="enptyStatus" v-else>
  66. <image src="../../static/empty.png" mode=""></image>
  67. <view class="words">
  68. 暂无学生
  69. </view>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. export default {
  75. data() {
  76. return {
  77. term:'请选择',
  78. showTerm: true,
  79. list: [],
  80. page: 1,
  81. last: false,
  82. termList:[{
  83. id:'',
  84. name:''
  85. }],
  86. termId:'',
  87. termName:'',
  88. searchName:'',
  89. index:0,
  90. }
  91. },
  92. onShow() {
  93. if(this.is_weixin()){
  94. this.navTitle()
  95. }
  96. this.page = 1
  97. this.list = []
  98. this.last = false
  99. let nowDate = new Date()
  100. let month = nowDate.getMonth() + 1
  101. // if (month >= 9) {
  102. // this.term = 1
  103. // } else {
  104. // this.term = 2
  105. // }
  106. this.getList()
  107. this.getTerm()
  108. },
  109. onReachBottom() {
  110. if (!this.last) {
  111. this.page++
  112. }
  113. console.log(this.page)
  114. this.getList()
  115. },
  116. methods: {
  117. //判断是否是微信
  118. is_weixin() {
  119. let ua = navigator.userAgent.toLowerCase();
  120. return ua.indexOf('micromessenger') != -1;
  121. },
  122. navTitle() {
  123. let navTitle = document.getElementsByTagName('uni-page-head');
  124. navTitle[0].style.display = 'none'
  125. },
  126. // 拿取学期
  127. getTerm(){
  128. this.$u.get('/mentor/term-select-options').then(res => {
  129. // this.termList = res.data.map(item=>{
  130. // return item.name
  131. // })
  132. this.termList = res.data
  133. console.log(this.termList, '学期数据')
  134. })
  135. },
  136. // 触发picker弹窗时间
  137. openTerm(){
  138. this.showTerm = true
  139. console.log(this.termList,"搜索触发111")
  140. },
  141. bindPickerChange(e){
  142. console.log(e, '********')
  143. this.index = e.target.value
  144. this.termId = this.termList[this.index].id
  145. console.log(this.termId, '000000')
  146. },
  147. // 点击筛选俩字
  148. shaixuanBtn(){
  149. this.list=[]
  150. this.page = 1
  151. this.last = false
  152. this.getList()
  153. },
  154. // clear(){
  155. // console.log(999)
  156. // this.searchName = ''
  157. // },
  158. // 搜索事件
  159. searchBtn(e){
  160. this.searchName = e
  161. console.log(e, "搜索触发000")
  162. },
  163. changeName(e){
  164. this.searchName = e
  165. console.log(e, "搜索内容变化时")
  166. },
  167. //获取我的学生列表
  168. getList() {
  169. let data = {
  170. page:this.page,
  171. term_id: this.termId,
  172. per_page:15,
  173. student_name: this.searchName,
  174. }
  175. this.$u.get('/mentor/subscribe-student', data).then(res => {
  176. let data = res.data.list
  177. if (this.page > 1 && data.length == 0) {
  178. uni.showToast({
  179. title: '暂无更多',
  180. icon: 'none'
  181. })
  182. this.last = true
  183. } else {
  184. this.list = this.list.concat(data)
  185. }
  186. })
  187. },
  188. //跳转学生详情
  189. student_detail(id) {
  190. uni.navigateTo({
  191. url: './details?id=' + id
  192. })
  193. }
  194. }
  195. }
  196. </script>
  197. <style lang="scss" scoped>
  198. page{
  199. background-color: #F7F7F7;
  200. border-top: 0.5px solid rgba(0, 0, 0, 0.1);
  201. }
  202. .uni-input{
  203. font-size: 14px;
  204. text-align: center;
  205. }
  206. .list {
  207. .enptyStatus{
  208. display: flex;
  209. margin-top: 100px;
  210. justify-content: center;
  211. align-items: center;
  212. flex-direction: column;
  213. padding: 30px 10px;
  214. image{
  215. width: 120px;
  216. height: 150px;
  217. margin-top: 100px;
  218. }
  219. .words{
  220. color: #ffae21;
  221. font-size: 18px;
  222. padding-top: 18px;
  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. padding: 15px;
  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. padding-bottom: 10px;
  283. width: 100%;
  284. .headimg{
  285. // margin: 13px 10px 5px 14px;
  286. margin-right: 20px;
  287. height: 90px;
  288. width: 90px;
  289. image{
  290. height: 90px;
  291. width: 90px;
  292. // background-color: #18B566;
  293. }
  294. }
  295. .message{
  296. .name{
  297. color: #0C0C0C;
  298. font-style: normal;
  299. font-weight: 500;
  300. font-size: 15px;
  301. line-height: 18px;
  302. }
  303. .same{
  304. display: flex;
  305. margin-top: 10px;
  306. align-items: center;
  307. height: 14px;
  308. .circle{
  309. flex-shrink: 0;
  310. margin-right: 8px;
  311. width: 5px;
  312. height: 5px;
  313. border-radius: 50%;
  314. background: #F1A321;
  315. }
  316. .ding{
  317. flex-shrink: 0;
  318. width: 52px;
  319. font-size: 13px;
  320. color: #666666;
  321. opacity: 0.8;
  322. }
  323. .words{
  324. overflow: hidden; //超出部分隐藏
  325. text-overflow: ellipsis; //超出部分使用省略号
  326. display: -webkit-box;//布局
  327. -webkit-line-clamp: 1;
  328. line-clamp: 1;//设置两行显示
  329. -webkit-box-orient: vertical;
  330. word-break: break-all;
  331. color: #222222;
  332. font-style: normal;
  333. opacity: 0.8;
  334. font-size: 13px;
  335. line-height: 14px;
  336. }
  337. }
  338. }
  339. }
  340. .bottom{
  341. border-top: 0.5px solid #DDDDDD;
  342. display: flex;
  343. // height: 63px;
  344. line-height: 20px;
  345. margin: 6px 0;
  346. padding: 10px 0 0 0;
  347. .left{
  348. width: 40px;
  349. color: #666666;
  350. font-size: 13px;
  351. opacity: 0.8;
  352. flex-shrink: 0;
  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>