teacher.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. <template>
  2. <view>
  3. <view class="head">
  4. <uni-row>
  5. <uni-col :span="3">
  6. <image src="../../static/teachers.png"></image>
  7. </uni-col>
  8. <uni-col :span="21">
  9. <view class="title-head">
  10. <uni-title type="h4" title="找老师"></uni-title>
  11. <uni-icons :type="iconType" size="20" @click="switchIcon"></uni-icons>
  12. </view>
  13. </uni-col>
  14. </uni-row>
  15. <view v-if="content">
  16. <view class="content">
  17. <uni-data-select v-model="queryObject.course" :localdata="educations" placeholder="课程详情"/>
  18. <uni-data-select v-model="queryObject.identify" :localdata="identifies" placeholder="老师身份" />
  19. <uni-data-select v-model="queryObject.education" :localdata="educations" placeholder="老师学历" />
  20. </view>
  21. <view class="content, content2">
  22. <uni-data-select v-model="queryObject.sex" :localdata="sexs" placeholder="老师性别" />
  23. <uni-data-select v-model="queryObject.school" :localdata="schools" placeholder="毕业学校" />
  24. <uni-data-select v-model="queryObject.mode" :localdata="modes" placeholder="老师照片" />
  25. </view>
  26. </view>
  27. </view>
  28. <!-- 筛选区与老师列表区之间的间隔 -->
  29. <view class="interval"></view>
  30. <view v-if="!isSearch">没有找到符合条件的信息</view>
  31. <view v-if="isSearch">
  32. <view class="teachInfo" bindtap="toTeachDetail" v-for="(item, index) in teacherList" :key="index" >
  33. <image class="teachImg" mode="widthFix" src="../../static/zly.jpeg"></image>
  34. <view class="introduce">
  35. <text class="teachName">{{item.name}}老师</text>
  36. <text class="attribute">{{item.teacherType}}</text>
  37. <text class="day">{{item.datetime}}</text>
  38. <view class="ageContainer">
  39. <text class="teachAgeIcon">龄</text>
  40. <text class="teachYears">{{item.teachAge}}年教龄</text>
  41. </view>
  42. <view class="transactionContainer">
  43. <text class="transaction">成</text>
  44. <text class="transactionTotal">{{item.count || '0'}}条家教记录</text>
  45. </view>
  46. <view class="transactionList">
  47. <text>最新接单:</text>
  48. <text>{{item.latest || '无'}}</text>
  49. </view>
  50. <view class="courseList">
  51. <text>可授课科目:</text>
  52. <text>{{item.subject}}</text>
  53. </view>
  54. <view class="introduceDetail">
  55. <view>自我介绍:</view>
  56. <text>{{item.introduce || '无'}}</text>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </template>
  63. <script>
  64. export default {
  65. data() {
  66. return {
  67. isLoading: false,
  68. iconType: 'bottom',
  69. content: false,
  70. isSearch: true,
  71. // 老师列表
  72. teacherList: [],
  73. // 查询总数量
  74. total: 0,
  75. // 查询对象
  76. queryObject: {
  77. pageNum: 1,
  78. pageSize: 10,
  79. course: '',
  80. identify: '',
  81. education: '',
  82. sex: '',
  83. school: '',
  84. mode: ''
  85. },
  86. educations: [{
  87. value: '专科在读',
  88. text: '专科在读'
  89. }, {
  90. value: '专科毕业',
  91. text: '专科毕业'
  92. }, {
  93. value: '本科在读',
  94. text: '本科在读'
  95. }, {
  96. value: '本科毕业',
  97. text: '本科毕业'
  98. }, {
  99. value: '硕士在读',
  100. text: '硕士在读'
  101. }, {
  102. value: '硕士毕业',
  103. text: '硕士毕业'
  104. }, {
  105. value: '博士在读',
  106. text: '博士在读'
  107. }, {
  108. value: '博士毕业',
  109. text: '博士毕业'
  110. }],
  111. // 单选老师身份
  112. identifies: [{
  113. text: '专职老师',
  114. value: '专职老师'
  115. }, {
  116. text: '在校大学生',
  117. value: '在校大学生'
  118. }],
  119. // 单选性别数据源
  120. sexs: [{
  121. text: '男',
  122. value: '男'
  123. }, {
  124. text: '女',
  125. value: '女'
  126. }],
  127. schools: [{
  128. text: '四川大学',
  129. value: '四川大学'
  130. }, {
  131. text: '电子科技大学',
  132. value: '电子科技大学'
  133. }, {
  134. text: '西南交通大学',
  135. value: '西南交通大学'
  136. }, {
  137. text: '四川师范大学',
  138. value: '四川师范大学'
  139. }, {
  140. text: '成都大学',
  141. value: '成都大学'
  142. }],
  143. modes: [{
  144. text: '老师上门',
  145. value: '老师上门'
  146. }, {
  147. text: '学员上门',
  148. value: '学员上门'
  149. }, {
  150. text: '线上辅导',
  151. value: '线上辅导'
  152. }],
  153. }
  154. },
  155. created() {
  156. this.getTeacherList()
  157. },
  158. methods: {
  159. // 展开搜索栏
  160. switchIcon() {
  161. if (this.iconType === 'bottom') {
  162. this.iconType = 'top'
  163. this.content = true
  164. } else {
  165. this.iconType = 'bottom'
  166. this.content = false
  167. }
  168. },
  169. // 获取老师列表
  170. async getTeacherList(cb) {
  171. // 打开节流阀
  172. this.isLoading = true
  173. const { data: result } = await uni.$http.post('/education/teacher-courses/showCourse', this.queryObject)
  174. this.isLoading = false
  175. console.log(result)
  176. this.teacherList = [...this.teacherList, ...result.data.course]
  177. },
  178. // 触底事件
  179. onReachBottom() {
  180. // 判断是否有下一页的数据
  181. if (this.queryObject.pageNum * this.queryObject.pageSize >= this.total) return uni.$showMsg('数据加载完毕!')
  182. // 判断是否正在请求其他数据
  183. if (this.isLoading) return
  184. this.queryObject.pageNum += 1
  185. // 重新获取数据
  186. }
  187. }
  188. }
  189. </script>
  190. <style scoped lang="scss">
  191. .head {
  192. position: sticky;
  193. top: 0;
  194. z-index: 999;
  195. image {
  196. // display: block;
  197. width: 80rpx;
  198. height: 80rpx;
  199. }
  200. .title-head {
  201. display: flex;
  202. justify-content: space-between;
  203. align-items: center;
  204. }
  205. .content {
  206. display: flex;
  207. justify-content: space-around;
  208. }
  209. .content2 {
  210. margin-top: 20rpx;
  211. }
  212. }
  213. /* 搜索区下方的隔离区 */
  214. .interval{
  215. height: 5rpx;
  216. margin-top: 20rpx;
  217. background-color: gray;
  218. }
  219. /* 老师列表 */
  220. .teachInfo {
  221. width: 96%;
  222. display: flex;
  223. margin-top: 20rpx;
  224. margin-left: 10rpx;
  225. padding: 10rpx 0;
  226. /* border: 1rpx solid red; */
  227. border-bottom: 1rpx solid gray;
  228. }
  229. /* 老师头像 */
  230. .teachImg {
  231. width: 20%;
  232. margin: 0 10rpx;
  233. border-radius: 20rpx;
  234. }
  235. /* 老师介绍外容器 */
  236. .introduce {
  237. width: 70%;
  238. /* height: 400rpx; */
  239. /* border: 1rpx solid red; */
  240. padding: 10rpx;
  241. }
  242. /* 老师名字 */
  243. .teachName {
  244. font-weight: bold;
  245. }
  246. /* 老师资质 */
  247. .attribute {
  248. margin-left: 20rpx;
  249. color: rgb(12, 182, 12);
  250. font-size: 26rpx;
  251. }
  252. /* 日期 */
  253. .day {
  254. float: right;
  255. color: pink;
  256. font-size: 28rpx;
  257. }
  258. /* 成交记录 */
  259. .transactionContainer {
  260. margin-top: 10rpx;
  261. display: flex;
  262. }
  263. /* 教龄和成交记录的标签 */
  264. .teachAgeIcon,
  265. .transaction {
  266. /* margin: 10rpx; */
  267. padding: 2rpx;
  268. border: 1rpx solid;
  269. border-radius: 10rpx;
  270. font-size: 26rpx;
  271. color: white;
  272. }
  273. /* 教龄标签的背景色 */
  274. .teachAgeIcon {
  275. background-color: rgba(255, 0, 0, .6);
  276. }
  277. /* 成交记录标签的背景色 */
  278. .transaction {
  279. background-color: rgba(0, 128, 0, .6);
  280. }
  281. /* 教龄和成交记录标签后的文字 */
  282. .teachYears,
  283. .transactionTotal {
  284. font-size: 24rpx;
  285. margin-left: 10rpx;
  286. }
  287. /* 最新接单 */
  288. .transactionList {
  289. margin-top: 10rpx;
  290. color: green;
  291. font-size: 24rpx;
  292. }
  293. /* 可授课科目 */
  294. .courseList {
  295. margin-top: 10rpx;
  296. font-size: 30rpx;
  297. }
  298. /* 自我介绍 */
  299. .introduceDetail {
  300. margin-top: 10rpx;
  301. font-size: 28rpx;
  302. }
  303. /* 自我介绍的内容 */
  304. .introduceDetail text {
  305. overflow: hidden;
  306. text-overflow: ellipsis;
  307. display: -webkit-box;
  308. /*设置对齐模式*/
  309. -webkit-box-orient: vertical;
  310. /*设置多行的行数,本例为两行*/
  311. -webkit-line-clamp: 4;
  312. }
  313. </style>