stuNeed.js 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566
  1. // pages/stuNeed/stuNeed.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. stuName: '', //学生姓名
  8. stuPhoneNum: '', //学生电话号码
  9. stuWeChatNum: '', //学生微信号码
  10. chosedCourse: '', //课程类别(大类)选项
  11. showCourseTitle: false, //课程类别(大类)选项是否展示
  12. courseChosedIndex: '', //选中课程大类的索引
  13. chosedCourseDetail: '', //课程细分选项
  14. showCourseDetail: false, //课程细分选项是否展示
  15. teachPosition: '', //辅导方式
  16. chosedTeachPosition: false, //辅导方式选项是否展示
  17. stuSex: '', //学生性别
  18. salary: '', //学生输入的酬金
  19. stuGoal: '', //学生输入的期望目标或效果
  20. chosedStuSex: false, //学生性别选项是否展示
  21. teacherAttr: '不限', //老师身份默认选项
  22. chosedTeacherAttr: false, //老师身份选项区是否展示
  23. teacherAttrIndex: '', //选中老师身份的索引
  24. teacherEdu: '不限', //老师学历默认选项
  25. showTeachEdu: false, //老师学历选项区是否展示
  26. teacherSex: '不限', //老师性别默认选项
  27. showTeachSex: false, //老师性别选项是否展示
  28. teacherImg: '不限', //老师头像是否上传默认选项
  29. showTeachImg: false, //老师头像是否上传的选项是否展示
  30. toTeacherOtherNeed:'', //对老师的其他需求
  31. // 课程类别
  32. courseList: [{
  33. name: "小学",
  34. choesd: false
  35. },
  36. {
  37. name: "初中",
  38. choesd: false
  39. },
  40. {
  41. name: "高中",
  42. choesd: false
  43. },
  44. {
  45. name: "大学",
  46. choesd: false
  47. },
  48. {
  49. name: "音乐",
  50. choesd: false
  51. },
  52. {
  53. name: "舞蹈",
  54. choesd: false
  55. },
  56. {
  57. name: "语言",
  58. choesd: false
  59. },
  60. {
  61. name: "体育",
  62. choesd: false
  63. },
  64. {
  65. name: "美术",
  66. choesd: false
  67. },
  68. {
  69. name: "书法",
  70. choesd: false
  71. },
  72. {
  73. name: "少儿编程",
  74. choesd: false
  75. },
  76. {
  77. name: "计算机",
  78. choesd: false
  79. },
  80. {
  81. name: "其他",
  82. choesd: false
  83. }
  84. ],
  85. // 课程细分
  86. courseDetail: [
  87. [{
  88. courseName: '小学1-5数学',
  89. choesd: false
  90. },
  91. {
  92. courseName: '小学1-5英语',
  93. choesd: false
  94. },
  95. {
  96. courseName: '小学1-5语文',
  97. choesd: false
  98. },
  99. {
  100. courseName: '小学6数学',
  101. choesd: false
  102. },
  103. {
  104. courseName: '小学6英语',
  105. choesd: false
  106. },
  107. {
  108. courseName: '小学6语文',
  109. choesd: false
  110. },
  111. {
  112. courseName: '小学奥数',
  113. choesd: false
  114. }
  115. ],
  116. [{
  117. courseName: '初一初二语文',
  118. choesd: false
  119. },
  120. {
  121. courseName: '初一初二数学',
  122. choesd: false
  123. },
  124. {
  125. courseName: '初一初二英语',
  126. choesd: false
  127. },
  128. {
  129. courseName: '初一初二物理',
  130. choesd: false
  131. },
  132. {
  133. courseName: '初一初二化学',
  134. choesd: false
  135. },
  136. {
  137. courseName: '初三语文',
  138. choesd: false
  139. },
  140. {
  141. courseName: '初三数学',
  142. choesd: false
  143. },
  144. {
  145. courseName: '初三英语',
  146. choesd: false
  147. },
  148. {
  149. courseName: '初三物理',
  150. choesd: false
  151. },
  152. {
  153. courseName: '初三化学',
  154. choesd: false
  155. },
  156. {
  157. courseName: '初中历史',
  158. choesd: false
  159. },
  160. {
  161. courseName: '初中地理',
  162. choesd: false
  163. },
  164. {
  165. courseName: '初中奥数',
  166. choesd: false
  167. },
  168. {
  169. courseName: '初中生物',
  170. choesd: false
  171. },
  172. {
  173. courseName: '初中预备班',
  174. choesd: false
  175. },
  176. {
  177. courseName: '初中科学',
  178. choesd: false
  179. },
  180. {
  181. courseName: '初中政治',
  182. choesd: false
  183. }
  184. ],
  185. [{
  186. courseName: '高一高二语文',
  187. choesd: false
  188. },
  189. {
  190. courseName: '高一高二数学',
  191. choesd: false
  192. },
  193. {
  194. courseName: '高一高二英语',
  195. choesd: false
  196. },
  197. {
  198. courseName: '高一高二物理',
  199. choesd: false
  200. },
  201. {
  202. courseName: '高一高二化学',
  203. choesd: false
  204. },
  205. {
  206. courseName: '高三语文',
  207. choesd: false
  208. },
  209. {
  210. courseName: '高三数学',
  211. choesd: false
  212. },
  213. {
  214. courseName: '高三英语',
  215. choesd: false
  216. },
  217. {
  218. courseName: '高三物理',
  219. choesd: false
  220. },
  221. {
  222. courseName: '高三化学',
  223. choesd: false
  224. },
  225. {
  226. courseName: '高中历史',
  227. choesd: false
  228. },
  229. {
  230. courseName: '高中地理',
  231. choesd: false
  232. },
  233. {
  234. courseName: '高中政治',
  235. choesd: false
  236. },
  237. {
  238. courseName: '高中生物',
  239. choesd: false
  240. },
  241. {
  242. courseName: '信息科技',
  243. choesd: false
  244. },
  245. {
  246. courseName: 'SAT',
  247. choesd: false
  248. }
  249. ],
  250. [{
  251. courseName: '托福',
  252. choesd: false
  253. },
  254. {
  255. courseName: '雅思',
  256. choesd: false
  257. },
  258. {
  259. courseName: '高等数学',
  260. choesd: false
  261. },
  262. {
  263. courseName: '微观经济学',
  264. choesd: false
  265. },
  266. {
  267. courseName: 'MBA',
  268. choesd: false
  269. },
  270. {
  271. courseName: '成人高考',
  272. choesd: false
  273. },
  274. {
  275. courseName: '国学',
  276. choesd: false
  277. },
  278. {
  279. courseName: '自学考试',
  280. choesd: false
  281. },
  282. {
  283. courseName: '专升本',
  284. choesd: false
  285. },
  286. {
  287. courseName: '考博面试辅导',
  288. choesd: false
  289. },
  290. {
  291. courseName: '考博专业课',
  292. choesd: false
  293. },
  294. {
  295. courseName: '考博英语',
  296. choesd: false
  297. },
  298. {
  299. courseName: '英语四级',
  300. choesd: false
  301. },
  302. {
  303. courseName: '英语六级',
  304. choesd: false
  305. },
  306. {
  307. courseName: '论文指导',
  308. choesd: false
  309. },
  310. {
  311. courseName: '考研专业课',
  312. choesd: false
  313. },
  314. {
  315. courseName: '考研政治',
  316. choesd: false
  317. },
  318. {
  319. courseName: '考研数学',
  320. choesd: false
  321. },
  322. {
  323. courseName: '考研英语',
  324. choesd: false
  325. },
  326. {
  327. courseName: '英语专业四级',
  328. choesd: false
  329. },
  330. {
  331. courseName: '英语专业八级',
  332. choesd: false
  333. },
  334. {
  335. courseName: '课程辅导',
  336. choesd: false
  337. }
  338. ],
  339. [{
  340. courseName: '小提琴',
  341. choesd: false
  342. },
  343. {
  344. courseName: '钢琴',
  345. choesd: false
  346. },
  347. {
  348. courseName: '电子琴',
  349. choesd: false
  350. },
  351. {
  352. courseName: '长笛',
  353. choesd: false
  354. },
  355. {
  356. courseName: '琵琶',
  357. choesd: false
  358. },
  359. {
  360. courseName: '手风琴',
  361. choesd: false
  362. },
  363. {
  364. courseName: '古筝',
  365. choesd: false
  366. },
  367. {
  368. courseName: '练耳歌唱',
  369. choesd: false
  370. },
  371. {
  372. courseName: '大号',
  373. choesd: false
  374. },
  375. {
  376. courseName: '声乐',
  377. choesd: false
  378. },
  379. {
  380. courseName: '萨克斯',
  381. choesd: false
  382. },
  383. {
  384. courseName: '单簧管',
  385. choesd: false
  386. },
  387. {
  388. courseName: '吉他',
  389. choesd: false
  390. },
  391. {
  392. courseName: '小号',
  393. choesd: false
  394. },
  395. {
  396. courseName: '古琴',
  397. choesd: false
  398. },
  399. {
  400. courseName: '二胡',
  401. choesd: false
  402. },
  403. {
  404. courseName: '大提琴',
  405. choesd: false
  406. },
  407. {
  408. courseName: '打击乐',
  409. choesd: false
  410. },
  411. {
  412. courseName: '圆号',
  413. choesd: false
  414. },
  415. {
  416. courseName: '中提琴',
  417. choesd: false
  418. },
  419. {
  420. courseName: '竹笛',
  421. choesd: false
  422. },
  423. {
  424. courseName: '架子鼓',
  425. choesd: false
  426. },
  427. {
  428. courseName: '扬琴',
  429. choesd: false
  430. },
  431. {
  432. courseName: '巴松',
  433. choesd: false
  434. }
  435. ],
  436. [{
  437. courseName: '民族舞',
  438. choesd: false
  439. },
  440. {
  441. courseName: '爵士舞',
  442. choesd: false
  443. },
  444. {
  445. courseName: '拉丁舞',
  446. choesd: false
  447. },
  448. {
  449. courseName: '芭蕾舞',
  450. choesd: false
  451. },
  452. {
  453. courseName: '街舞',
  454. choesd: false
  455. },
  456. {
  457. courseName: '现代舞',
  458. choesd: false
  459. },
  460. {
  461. courseName: '踢踏舞',
  462. choesd: false
  463. }
  464. ],
  465. [{
  466. courseName: '本地方言',
  467. choesd: false
  468. },
  469. {
  470. courseName: '日语',
  471. choesd: false
  472. },
  473. {
  474. courseName: '英语口语',
  475. choesd: false
  476. },
  477. {
  478. courseName: '新概念英语',
  479. choesd: false
  480. },
  481. {
  482. courseName: '牛津英语',
  483. choesd: false
  484. },
  485. {
  486. courseName: '西班牙语',
  487. choesd: false
  488. },
  489. {
  490. courseName: '德语',
  491. choesd: false
  492. },
  493. {
  494. courseName: '商务英语',
  495. choesd: false
  496. },
  497. {
  498. courseName: '法语',
  499. choesd: false
  500. },
  501. {
  502. courseName: '韩语',
  503. choesd: false
  504. },
  505. {
  506. courseName: '意大利语',
  507. choesd: false
  508. },
  509. {
  510. courseName: '汉语',
  511. choesd: false
  512. },
  513. {
  514. courseName: '阿拉伯语',
  515. choesd: false
  516. },
  517. {
  518. courseName: 'SBS英语',
  519. choesd: false
  520. },
  521. {
  522. courseName: '俄语',
  523. choesd: false
  524. },
  525. {
  526. courseName: '葡萄牙语',
  527. choesd: false
  528. },
  529. {
  530. courseName: '初中政治',
  531. choesd: false
  532. }
  533. ],
  534. [{
  535. courseName: '羽毛球',
  536. choesd: false
  537. },
  538. {
  539. courseName: '跆拳道',
  540. choesd: false
  541. },
  542. {
  543. courseName: '游泳',
  544. choesd: false
  545. },
  546. {
  547. courseName: '乒乓球',
  548. choesd: false
  549. },
  550. {
  551. courseName: '网球',
  552. choesd: false
  553. },
  554. {
  555. courseName: '中国象棋',
  556. choesd: false
  557. },
  558. {
  559. courseName: '国际象棋',
  560. choesd: false
  561. },
  562. {
  563. courseName: '围棋',
  564. choesd: false
  565. },
  566. {
  567. courseName: '篮球',
  568. choesd: false
  569. },
  570. {
  571. courseName: '空手道',
  572. choesd: false
  573. }
  574. ],
  575. [{
  576. courseName: '卡通画',
  577. choesd: false
  578. },
  579. {
  580. courseName: '中国画',
  581. choesd: false
  582. },
  583. {
  584. courseName: '素描',
  585. choesd: false
  586. },
  587. {
  588. courseName: '油画',
  589. choesd: false
  590. },
  591. {
  592. courseName: '水彩',
  593. choesd: false
  594. },
  595. {
  596. courseName: '漫画',
  597. choesd: false
  598. }
  599. ],
  600. [{
  601. courseName: '硬笔',
  602. choesd: false
  603. },
  604. {
  605. courseName: '毛笔',
  606. choesd: false
  607. },
  608. {
  609. courseName: '篆刻',
  610. choesd: false
  611. }
  612. ],
  613. [{
  614. courseName: 'Scratch',
  615. choesd: false
  616. },
  617. {
  618. courseName: 'Python',
  619. choesd: false
  620. },
  621. {
  622. courseName: 'C++',
  623. choesd: false
  624. },
  625. {
  626. courseName: 'microbit',
  627. choesd: false
  628. }
  629. ],
  630. [{
  631. courseName: '应用能力初级',
  632. choesd: false
  633. },
  634. {
  635. courseName: '应用能力中级',
  636. choesd: false
  637. },
  638. {
  639. courseName: '基本操作',
  640. choesd: false
  641. }
  642. ],
  643. [{
  644. courseName: '学习习惯',
  645. choesd: false
  646. },
  647. {
  648. courseName: '口才',
  649. choesd: false
  650. },
  651. {
  652. courseName: '心理辅导',
  653. choesd: false
  654. },
  655. {
  656. courseName: '记忆力',
  657. choesd: false
  658. },
  659. {
  660. courseName: '注意力',
  661. choesd: false
  662. }
  663. ]
  664. ],
  665. // 辅导方式
  666. teachPositions: [{
  667. opType: '老师上门',
  668. choesd: false
  669. },
  670. {
  671. opType: '学员上门',
  672. choesd: false
  673. }, {
  674. opType: '线上辅导',
  675. choesd: false
  676. }, {
  677. opType: '老师住家',
  678. choesd: false
  679. },
  680. {
  681. opType: '学员住家',
  682. choesd: false
  683. }
  684. ],
  685. // 学生性别
  686. stuSexList: [{
  687. gender: '男',
  688. choesd: false
  689. },
  690. {
  691. gender: '女',
  692. choesd: false
  693. }
  694. ],
  695. // 老师身份列表
  696. teacherAttrList: [{
  697. 'attr': '不限',
  698. chosed: true
  699. },
  700. {
  701. 'attr': '专职老师',
  702. chosed: false
  703. },
  704. {
  705. 'attr': '在校大学生',
  706. chosed: false
  707. }
  708. ],
  709. // 老师学历列表1
  710. educationList: [
  711. [{
  712. 'edu': '不限',
  713. chosed: true
  714. }],
  715. [{
  716. 'edu': '不限',
  717. chosed: true
  718. },
  719. {
  720. 'edu': '博士毕业',
  721. chosed: false
  722. },
  723. {
  724. 'edu': '硕士毕业',
  725. chosed: false
  726. },
  727. {
  728. 'edu': '本科毕业',
  729. chosed: false
  730. },
  731. {
  732. 'edu': '专科毕业',
  733. chosed: false
  734. }
  735. ],
  736. [{
  737. 'edu': '不限',
  738. chosed: true
  739. },
  740. {
  741. 'edu': '博士在读',
  742. chosed: false
  743. },
  744. {
  745. 'edu': '硕士在读',
  746. chosed: false
  747. },
  748. {
  749. 'edu': '本科在读',
  750. chosed: false
  751. },
  752. {
  753. 'edu': '专科在读',
  754. chosed: false
  755. }
  756. ]
  757. ],
  758. // 老师学历列表2
  759. educationL: [{
  760. 'edu': '不限',
  761. chosed: true
  762. },
  763. {
  764. 'edu': '博士毕业',
  765. chosed: false
  766. },
  767. {
  768. 'edu': '硕士毕业',
  769. chosed: false
  770. },
  771. {
  772. 'edu': '本科毕业',
  773. chosed: false
  774. },
  775. {
  776. 'edu': '专科毕业',
  777. chosed: false
  778. },
  779. {
  780. 'edu': '博士在读',
  781. chosed: false
  782. },
  783. {
  784. 'edu': '硕士在读',
  785. chosed: false
  786. },
  787. {
  788. 'edu': '本科在读',
  789. chosed: false
  790. },
  791. {
  792. 'edu': '专科在读',
  793. chosed: false
  794. }
  795. ],
  796. // 老师性别列表
  797. teachSexList: [{
  798. sex: '不限',
  799. chosed: true
  800. },
  801. {
  802. sex: '男',
  803. chosed: false
  804. },
  805. {
  806. sex: '女',
  807. chosed: false
  808. }
  809. ],
  810. // 是否要求头像上传
  811. teacherImgList: [{
  812. imgUpload: '不限',
  813. choesd: true
  814. },
  815. {
  816. imgUpload: '是',
  817. choesd: false
  818. },
  819. {
  820. imgUpload: '否',
  821. choesd: false
  822. }
  823. ]
  824. },
  825. /**
  826. * 生命周期函数--监听页面加载
  827. */
  828. onLoad(options) {
  829. },
  830. // 获取学生姓名
  831. getStuName(e) {
  832. // console.log(e.detail.value)
  833. this.setData({
  834. stuName: e.detail.value
  835. })
  836. // console.log(this.data.stuName)
  837. },
  838. // 获取学生手机号码
  839. getStuPhone(e) {
  840. this.setData({
  841. stuPhoneNum: e.detail.value
  842. })
  843. },
  844. //获取学生微信号码
  845. getStuWeChat(e) {
  846. this.setData({
  847. stuWeChatNum: e.detail.value
  848. })
  849. },
  850. // 课程类别
  851. // 打开课程类别(大类)选项区
  852. chooseCourseTitle() {
  853. this.setData({
  854. showCourseTitle: true,
  855. chosedCourseDetail: ''
  856. })
  857. },
  858. // 定义退出下拉选区的方法
  859. hiddenCourseTitle() {
  860. this.setData({
  861. showCourseTitle: false
  862. })
  863. },
  864. // 从下拉区选择课程类别内容
  865. onChooseCourseTitle(e) {
  866. let index = e.currentTarget.dataset.index
  867. let courseList = this.data.courseList
  868. for (let i = 0; i < courseList.length; i++) {
  869. if (i == index) {
  870. courseList[i].chosed = !courseList[i].chosed
  871. } else {
  872. courseList[i].chosed = false
  873. }
  874. }
  875. this.setData({
  876. courseList
  877. })
  878. },
  879. // 课程类别(大类)确定按钮的点击事件
  880. confirmCourseTitle() {
  881. let courseList = this.data.courseList
  882. let index
  883. for (let i = 0; i < courseList.length; i++) {
  884. if (courseList[i].chosed) {
  885. index = i
  886. }
  887. }
  888. let chosedCourse = courseList[index]?.name || ''
  889. let courseChosedIndex = index
  890. this.setData({
  891. chosedCourse,
  892. courseChosedIndex
  893. })
  894. // console.log('courseChosedIndex:' + courseChosedIndex)
  895. // let courseDetail = this.data.courseDetail
  896. // console.log('courseDetail:'+courseDetail[courseChosedIndex])
  897. this.hiddenCourseTitle()
  898. },
  899. // 课程细分(小类)选择
  900. // 打开课程细分选项区
  901. toCourseDetail() {
  902. if (!this.data.chosedCourse) {
  903. wx.showToast({
  904. title: '请先选择课程类别',
  905. icon: 'none'
  906. })
  907. return
  908. }
  909. this.setData({
  910. showCourseDetail: true
  911. })
  912. },
  913. // 定义退出课程细分选区的方法
  914. hiddenCourseDetail() {
  915. this.setData({
  916. showCourseDetail: false
  917. })
  918. },
  919. // 从下拉区选择课程细分内容
  920. onChooseCourseDetail(e) {
  921. let index = e.currentTarget.dataset.index
  922. let courseDetail = this.data.courseDetail
  923. let courseChosedIndex = this.data.courseChosedIndex
  924. for (let i = 0; i < courseDetail[courseChosedIndex].length; i++) {
  925. if (i == index) {
  926. courseDetail[courseChosedIndex][i].chosed = !courseDetail[courseChosedIndex][i].chosed
  927. } else {
  928. courseDetail[courseChosedIndex][i].chosed = false
  929. }
  930. }
  931. this.setData({
  932. courseDetail
  933. })
  934. },
  935. // 课程细分(小类)确定按钮的点击事件
  936. confirmCourseDetail() {
  937. let courseDetail = this.data.courseDetail
  938. let courseChosedIndex = this.data.courseChosedIndex
  939. let index
  940. for (let i = 0; i < courseDetail[courseChosedIndex].length; i++) {
  941. if (courseDetail[courseChosedIndex][i].chosed) {
  942. index = i
  943. }
  944. }
  945. let chosedCourseDetail = courseDetail[courseChosedIndex][index]?.courseName || ''
  946. this.setData({
  947. chosedCourseDetail
  948. })
  949. this.hiddenCourseDetail()
  950. },
  951. // 辅导方式
  952. // 打开辅导方式选项区
  953. toTeachPosition() {
  954. this.setData({
  955. chosedTeachPosition: true
  956. })
  957. },
  958. // 关闭辅导方式选项区的方法
  959. hiddenTeachPosition() {
  960. this.setData({
  961. chosedTeachPosition: false
  962. })
  963. },
  964. // 从下拉选区选择辅导方式内容
  965. onTeachPosition(e) {
  966. let index = e.currentTarget.dataset.index
  967. let teachPositions = this.data.teachPositions
  968. for (let i = 0; i < teachPositions.length; i++) {
  969. if (i == index) {
  970. teachPositions[i].chosed = !teachPositions[i].chosed
  971. } else {
  972. teachPositions[i].chosed = false
  973. }
  974. }
  975. this.setData({
  976. teachPositions
  977. })
  978. },
  979. // 辅导方式确定按钮点击事件
  980. confirmTeachPosition() {
  981. let teachPositions = this.data.teachPositions
  982. let index
  983. for (let i = 0; i < teachPositions.length; i++) {
  984. if (teachPositions[i].chosed) {
  985. index = i
  986. }
  987. }
  988. let teachPosition = teachPositions[index]?.opType || ''
  989. this.setData({
  990. teachPosition
  991. })
  992. this.hiddenTeachPosition()
  993. },
  994. // 选择学生性别
  995. // 打开学生性别选项区
  996. chooseStuSex() {
  997. this.setData({
  998. chosedStuSex: true,
  999. stuSex: ''
  1000. })
  1001. // 点击学生性别的选项后,将原来的选项取消,恢复到默认选项
  1002. let stuSexList = this.data.stuSexList
  1003. for (let i = 0; i < stuSexList.length; i++) {
  1004. stuSexList[i].chosed = false
  1005. }
  1006. this.setData({
  1007. stuSexList
  1008. })
  1009. },
  1010. // 关闭学生性别选项区的方法
  1011. hiddenStuSex() {
  1012. this.setData({
  1013. chosedStuSex: false
  1014. })
  1015. },
  1016. // 从下拉选区选择学生性别
  1017. onChosedStuSex(e) {
  1018. let index = e.currentTarget.dataset.index
  1019. let stuSexList = this.data.stuSexList
  1020. for (let i = 0; i < stuSexList.length; i++) {
  1021. if (i == index) {
  1022. stuSexList[i].chosed = !stuSexList[i].chosed
  1023. } else {
  1024. stuSexList[i].chosed = false
  1025. }
  1026. }
  1027. this.setData({
  1028. stuSexList
  1029. })
  1030. },
  1031. // 学生性别确定按钮点击事件
  1032. confirmChosedStuSex() {
  1033. let stuSexList = this.data.stuSexList
  1034. let index
  1035. for (let i = 0; i < stuSexList.length; i++) {
  1036. if (stuSexList[i].chosed) {
  1037. index = i
  1038. }
  1039. }
  1040. let stuSex = stuSexList[index]?.gender || ''
  1041. this.setData({
  1042. stuSex
  1043. })
  1044. this.hiddenStuSex()
  1045. },
  1046. // 获取学生输入的课时费
  1047. getSalary(e) {
  1048. this.setData({
  1049. salary: e.detail.value
  1050. })
  1051. },
  1052. // 获取学生输入的期望达到的目标或效果
  1053. getStuGoal(e) {
  1054. this.setData({
  1055. stuGoal: e.detail.value
  1056. })
  1057. },
  1058. // 选择老师身份
  1059. // 打开老师身份选项区
  1060. chooseTeachAttr() {
  1061. this.setData({
  1062. chosedTeacherAttr: true,
  1063. // teacherAttr: '不限',
  1064. teacherEdu: '不限'
  1065. })
  1066. // 点击老师身份的选项后,将原来的选项取消,恢复到默认选项
  1067. let teacherAttrList = this.data.teacherAttrList
  1068. for (let i = 0; i < teacherAttrList.length; i++) {
  1069. if (i == 0) {
  1070. teacherAttrList[i].chosed = true
  1071. } else {
  1072. teacherAttrList[i].chosed = false
  1073. }
  1074. }
  1075. this.setData({
  1076. teacherAttrList
  1077. })
  1078. // console.log(teacherAttrList)
  1079. let index
  1080. for (let i = 0; i < teacherAttrList.length; i++) {
  1081. if (teacherAttrList[i].chosed) {
  1082. index = i
  1083. }
  1084. }
  1085. let teacherAttr = teacherAttrList[index]?.attr || teacherAttrList[0].attr
  1086. let teacherAttrIndex = index
  1087. this.setData({
  1088. teacherAttr,
  1089. teacherAttrIndex
  1090. })
  1091. // 点击老师身份后,重置老师学历选项为默认值
  1092. let educationList = this.data.educationList
  1093. for (let i = 0; i < educationList.length; i++) {
  1094. for (let j = 0; j < educationList[i].length; j++) {
  1095. if (j == 0) {
  1096. educationList[i][j].chosed = true
  1097. } else {
  1098. educationList[i][j].chosed = false
  1099. }
  1100. }
  1101. }
  1102. this.setData({
  1103. educationList
  1104. })
  1105. let teacherEduIndex
  1106. for (let i = 0; i < educationList[teacherAttrIndex].length; i++) {
  1107. if (educationList[teacherAttrIndex][i].chosed) {
  1108. teacherEduIndex = i
  1109. }
  1110. }
  1111. let teacherEdu = educationList[teacherAttrIndex][teacherEduIndex]?.edu || ''
  1112. this.setData({
  1113. teacherEdu
  1114. })
  1115. },
  1116. // 定义关闭老师身份选项区的方法
  1117. hiddenTeacherAttr() {
  1118. this.setData({
  1119. chosedTeacherAttr: false
  1120. })
  1121. },
  1122. // 从下拉选区选择老师身份
  1123. onChosedTeacherAttr(e) {
  1124. let index = e.currentTarget.dataset.index
  1125. let teacherAttrList = this.data.teacherAttrList
  1126. for (let i = 0; i < teacherAttrList.length; i++) {
  1127. if (i == index) {
  1128. teacherAttrList[i].chosed = !teacherAttrList[i].chosed
  1129. } else {
  1130. teacherAttrList[i].chosed = false
  1131. }
  1132. }
  1133. this.setData({
  1134. teacherAttrList
  1135. })
  1136. },
  1137. // 老师身份的确定按钮点击事件
  1138. confirmTeacherAttr() {
  1139. let teacherAttrList = this.data.teacherAttrList
  1140. let index
  1141. for (let i = 0; i < teacherAttrList.length; i++) {
  1142. if (teacherAttrList[i].chosed) {
  1143. index = i
  1144. }
  1145. }
  1146. let teacherAttr = teacherAttrList[index]?.attr || teacherAttrList[0].attr
  1147. let teacherAttrIndex = index
  1148. this.setData({
  1149. teacherAttr,
  1150. teacherAttrIndex
  1151. })
  1152. this.hiddenTeacherAttr()
  1153. // console.log(teacherAttrIndex)
  1154. },
  1155. // 老师学历(当老师身份不包括“不限”时)
  1156. // 打开老师学历选项区
  1157. chooseTeachEdu() {
  1158. this.setData({
  1159. showTeachEdu: true,
  1160. teacherEdu: '不限'
  1161. })
  1162. let educationList = this.data.educationList
  1163. // console.log(educationList)
  1164. // 点击老师学历的选项后,将原来的选项取消,恢复到默认选项
  1165. for (let i = 0; i < educationList.length; i++) {
  1166. for (let j = 0; j < educationList[i].length; j++) {
  1167. if (j == 0) {
  1168. educationList[i][j].chosed = true
  1169. } else {
  1170. educationList[i][j].chosed = false
  1171. }
  1172. }
  1173. }
  1174. this.setData({
  1175. educationList
  1176. })
  1177. },
  1178. // 关闭老师学历选项区的方法
  1179. hiddenTeachEdu() {
  1180. this.setData({
  1181. showTeachEdu: false
  1182. })
  1183. },
  1184. // 从下拉选区选择老师的学历
  1185. onChosedTeacherEdu(e) {
  1186. let index = e.currentTarget.dataset.index
  1187. let educationList = this.data.educationList
  1188. let teacherAttrIndex = this.data.teacherAttrIndex
  1189. for (let i = 0; i < educationList[teacherAttrIndex].length; i++) {
  1190. if (i == index) {
  1191. educationList[teacherAttrIndex][i].chosed = !educationList[teacherAttrIndex][i].chosed
  1192. } else {
  1193. educationList[teacherAttrIndex][i].chosed = false
  1194. }
  1195. }
  1196. this.setData({
  1197. educationList
  1198. })
  1199. },
  1200. // 老师学历确定按钮点击事件
  1201. confirmTeachEdu() {
  1202. let educationList = this.data.educationList
  1203. let teacherAttrIndex = this.data.teacherAttrIndex
  1204. let index
  1205. for (let i = 0; i < educationList[teacherAttrIndex].length; i++) {
  1206. if (educationList[teacherAttrIndex][i].chosed) {
  1207. index = i
  1208. }
  1209. }
  1210. let teacherEdu = educationList[teacherAttrIndex][index]?.edu || educationList[teacherAttrIndex][0].edu
  1211. this.setData({
  1212. teacherEdu
  1213. })
  1214. this.hiddenTeachEdu()
  1215. },
  1216. // 老师学历2(当老师身份选择“不限”时)
  1217. // 打开老师学历选项区
  1218. chooseTeachEduTwo() {
  1219. this.setData({
  1220. showTeachEdu: true,
  1221. teacherEdu: '不限',
  1222. })
  1223. // 点击老师学历的选项后,将原来的选项取消,恢复到默认选项
  1224. let educationL = this.data.educationL
  1225. for (let i = 0; i < educationL.length; i++) {
  1226. if (i == 0) {
  1227. educationL[i].chosed = true
  1228. } else {
  1229. educationL[i].chosed = false
  1230. }
  1231. }
  1232. this.setData({
  1233. educationL
  1234. })
  1235. },
  1236. // 关闭老师学历选项区的方法
  1237. hiddenTeachEduT() {
  1238. this.setData({
  1239. showTeachEdu: false
  1240. })
  1241. },
  1242. // 从下拉选区选择老师的学历
  1243. onChosedTeacherEduT(e) {
  1244. let index = e.currentTarget.dataset.index
  1245. let educationL = this.data.educationL
  1246. for (let i = 0; i < educationL.length; i++) {
  1247. if (i == index) {
  1248. educationL[i].chosed = !educationL[i].chosed
  1249. } else {
  1250. educationL[i].chosed = false
  1251. }
  1252. }
  1253. this.setData({
  1254. educationL
  1255. })
  1256. },
  1257. // 老师学历确定按钮点击事件
  1258. confirmTeachEduT() {
  1259. let educationL = this.data.educationL
  1260. let index
  1261. for (let i = 0; i < educationL.length; i++) {
  1262. if (educationL[i].chosed) {
  1263. index = i
  1264. }
  1265. }
  1266. let teacherEdu = educationL[index]?.edu || educationL[0].edu
  1267. this.setData({
  1268. teacherEdu
  1269. })
  1270. this.hiddenTeachEduT()
  1271. },
  1272. // 选择老师性别
  1273. // 打开老师性别选项区
  1274. chooseTeachSex() {
  1275. this.setData({
  1276. showTeachSex: true,
  1277. teacherSex: '不限'
  1278. })
  1279. // 点击老师性别的选项后,将原来的选项取消,恢复到默认选项
  1280. let teachSexList = this.data.teachSexList
  1281. for (let i = 0; i < teachSexList.length; i++) {
  1282. if (i == 0) {
  1283. teachSexList[i].chosed = true
  1284. } else {
  1285. teachSexList[i].chosed = false
  1286. }
  1287. }
  1288. this.setData({
  1289. teachSexList
  1290. })
  1291. },
  1292. // 关闭老师性别选区的方法
  1293. hiddenTeachSex() {
  1294. this.setData({
  1295. showTeachSex: false
  1296. })
  1297. },
  1298. // 从下拉选区选择老师性别
  1299. onChosedTeachsex(e) {
  1300. let index = e.currentTarget.dataset.index
  1301. let teachSexList = this.data.teachSexList
  1302. for (let i = 0; i < teachSexList.length; i++) {
  1303. if (i == index) {
  1304. teachSexList[i].chosed = !teachSexList[i].chosed
  1305. } else {
  1306. teachSexList[i].chosed = false
  1307. }
  1308. }
  1309. this.setData({
  1310. teachSexList
  1311. })
  1312. },
  1313. // 老师性别确定按钮点击事件
  1314. confirmTeacherSex() {
  1315. let teachSexList = this.data.teachSexList
  1316. let index
  1317. for (let i = 0; i < teachSexList.length; i++) {
  1318. if (teachSexList[i].chosed) {
  1319. index = i
  1320. }
  1321. }
  1322. let teacherSex = teachSexList[index]?.sex || teachSexList[0].sex
  1323. this.setData({
  1324. teacherSex
  1325. })
  1326. this.hiddenTeachSex()
  1327. },
  1328. // 是否要求老师头像上传
  1329. // 打开老师头像是否上传选项区
  1330. toTeacherImgUpload() {
  1331. this.setData({
  1332. showTeachImg: true,
  1333. teacherImg: '不限'
  1334. })
  1335. // 点击老师头像是否上传的选项后,将原来的选项取消,恢复到默认选项
  1336. let teacherImgList = this.data.teacherImgList
  1337. for (let i = 0; i < teacherImgList.length; i++) {
  1338. if (i == 0) {
  1339. teacherImgList[i].chosed = true
  1340. } else {
  1341. teacherImgList[i].chosed = false
  1342. }
  1343. }
  1344. this.setData({
  1345. teacherImgList
  1346. })
  1347. },
  1348. // 关闭老师头像是否上传选区的方法
  1349. hiddenTeacherImgUpload() {
  1350. this.setData({
  1351. showTeachImg: false
  1352. })
  1353. },
  1354. // 从下拉选区选择老师头像是否上传
  1355. onChosedImgUpload(e) {
  1356. let index = e.currentTarget.dataset.index
  1357. let teacherImgList = this.data.teacherImgList
  1358. for (let i = 0; i < teacherImgList.length; i++) {
  1359. if (i == index) {
  1360. teacherImgList[i].chosed = !teacherImgList[i].chosed
  1361. } else {
  1362. teacherImgList[i].chosed = false
  1363. }
  1364. }
  1365. this.setData({
  1366. teacherImgList
  1367. })
  1368. },
  1369. // 老师头像是否上传确定按钮点击事件
  1370. confirmTeacherImgUpload() {
  1371. let teacherImgList = this.data.teacherImgList
  1372. let index
  1373. for (let i = 0; i < teacherImgList.length; i++) {
  1374. if (teacherImgList[i].chosed) {
  1375. index = i
  1376. }
  1377. }
  1378. let teacherImg = teacherImgList[index]?.imgUpload || teacherImgList[0].imgUpload
  1379. this.setData({
  1380. teacherImg
  1381. })
  1382. this.hiddenTeacherImgUpload()
  1383. },
  1384. // 对老师的其他需求
  1385. getOtherNeed(e){
  1386. // console.log(e)
  1387. this.setData({
  1388. toTeacherOtherNeed:e.detail.value
  1389. })
  1390. },
  1391. // 提交
  1392. toSubmit() {
  1393. //判断姓名是否为空
  1394. let stuName = this.data.stuName
  1395. if(!stuName){
  1396. wx.showToast({
  1397. title: '姓名不能为空',
  1398. icon:'none'
  1399. })
  1400. return
  1401. }
  1402. //判断手机号码是否为空
  1403. let stuPhoneNum = this.data.stuPhoneNum
  1404. if(!stuPhoneNum){
  1405. wx.showToast({
  1406. title: '手机号不能为空',
  1407. icon:'none'
  1408. })
  1409. return
  1410. }
  1411. //判断手机号码是否正确
  1412. let phoneReg = /^1(3|4|5|6|7|8|9)\d{9}$/;
  1413. if (!phoneReg.test(stuPhoneNum)) {
  1414. wx.showToast({
  1415. title: '手机号格式错误',
  1416. icon: 'none'
  1417. })
  1418. return;
  1419. }
  1420. //判断微信号码是否为空
  1421. let stuWeChatNum = this.data.stuWeChatNum
  1422. if(!stuWeChatNum){
  1423. wx.showToast({
  1424. title: '微信号不能为空',
  1425. icon:'none'
  1426. })
  1427. return
  1428. }
  1429. // 判断课程类别(大类)是否选择
  1430. let chosedCourse = this.data.chosedCourse
  1431. if(!chosedCourse){
  1432. wx.showToast({
  1433. title: '课程类别未选',
  1434. icon:'none'
  1435. })
  1436. return
  1437. }
  1438. // 判断课程细分(小类)是否选择
  1439. let chosedCourseDetail = this.data.chosedCourseDetail
  1440. if(!chosedCourseDetail){
  1441. wx.showToast({
  1442. title: '课程细分未选',
  1443. icon:'none'
  1444. })
  1445. return
  1446. }
  1447. // 判断辅导方式是否选择
  1448. let teachPosition = this.data.teachPosition
  1449. if(!teachPosition){
  1450. wx.showToast({
  1451. title: '辅导方式未选',
  1452. icon:'none'
  1453. })
  1454. return
  1455. }
  1456. // 判断学生性别是否选择
  1457. let stuSex = this.data.stuSex
  1458. if(!stuSex){
  1459. wx.showToast({
  1460. title: '学生性别未选',
  1461. icon:'none'
  1462. })
  1463. return
  1464. }
  1465. //判断课时费是否输入
  1466. let salary = this.data.salary
  1467. if(!salary){
  1468. wx.showToast({
  1469. title: '课时费不能为空',
  1470. icon:'none'
  1471. })
  1472. return
  1473. }
  1474. // 存入本地缓存
  1475. wx.setStorageSync('student', {
  1476. stuName: this.data.stuName,
  1477. stuPhoneNum: this.data.stuPhoneNum,
  1478. stuWeChatNum: this.data.stuWeChatNum,
  1479. chosedCourse: this.data.chosedCourse,
  1480. chosedCourseDetail: this.data.chosedCourseDetail,
  1481. teachPosition: this.data.teachPosition,
  1482. stuSex: this.data.stuSex,
  1483. salary: this.data.salary,
  1484. stuGoal: this.data.stuGoal,
  1485. teacherAttr: this.data.teacherAttr,
  1486. teacherEdu: this.data.teacherEdu,
  1487. teacherSex: this.data.teacherSex,
  1488. teacherImg: this.data.teacherImg,
  1489. toTeacherOtherNeed:this.data.toTeacherOtherNeed
  1490. })
  1491. wx.showToast({
  1492. title: '提交成功',
  1493. })
  1494. },
  1495. /**
  1496. * 生命周期函数--监听页面初次渲染完成
  1497. */
  1498. onReady() {
  1499. },
  1500. /**
  1501. * 生命周期函数--监听页面显示
  1502. */
  1503. onShow() {
  1504. },
  1505. /**
  1506. * 生命周期函数--监听页面隐藏
  1507. */
  1508. onHide() {
  1509. },
  1510. /**
  1511. * 生命周期函数--监听页面卸载
  1512. */
  1513. onUnload() {
  1514. },
  1515. /**
  1516. * 页面相关事件处理函数--监听用户下拉动作
  1517. */
  1518. onPullDownRefresh() {
  1519. },
  1520. /**
  1521. * 页面上拉触底事件的处理函数
  1522. */
  1523. onReachBottom() {
  1524. },
  1525. /**
  1526. * 用户点击右上角分享
  1527. */
  1528. onShareAppMessage() {
  1529. }
  1530. })