teacher.vue 7.6 KB

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