studentRegistration.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. //index.js
  2. //获取应用实例
  3. // const app = require('../../utils/util.js');
  4. Page({
  5. data: {
  6. nameIsTrue: false, //名字是否填写
  7. cultureIsTrue: false, //文化是否填写
  8. graduationIsTrue: false, //毕业学校
  9. majorIsTrue: false, //所有专业
  10. postIsTrue: false, //现任职务
  11. renzhishijianIsTrue :false,
  12. phoneIsTrue: false, //电话
  13. peixunshijianTrue :false, // 培训时间
  14. nameMessage: '',
  15. zaizhiTime:'',//在线时间
  16. peixunTime:'', //培训时间
  17. headmasterText: '请选择任职时间', //
  18. peixunText:'请选择培训时间',
  19. radio: '1',
  20. parameter: [{
  21. id: 1,
  22. name: '男',
  23. checked: false
  24. }, {
  25. id: 2,
  26. name: '女',
  27. checked: false
  28. }],
  29. renzhiDate: '',
  30. postshow: false,
  31. postshow1: false,
  32. errorIsTrue: false,
  33. currentDate: new Date().getTime(),
  34. currentDate1: new Date().getTime(),
  35. minDate: new Date().getTime ,
  36. formatter(type, value) {
  37. if (type === 'year') {
  38. return `${value}年`;
  39. } else if (type === 'month') {
  40. return `${value}月`;
  41. }
  42. return value;
  43. },
  44. },
  45. onChange(event) {
  46. this.setData({
  47. radio: event.detail,
  48. });
  49. },
  50. share() {
  51. this.setData({
  52. show: true
  53. });
  54. },
  55. onClose() {
  56. console.log("11111111111111");
  57. this.setData({
  58. postshow: false
  59. });
  60. },
  61. onClose1() {
  62. console.log("11111111111111");
  63. this.setData({
  64. postshow1: false
  65. });
  66. },
  67. onInput(event) {
  68. console.log("000");
  69. this.setData({
  70. currentDate: event.detail,
  71. });
  72. },
  73. onInput1(event) {
  74. console.log("000");
  75. this.setData({
  76. currentDate1: event.detail,
  77. });
  78. },
  79. formatDate(date) {
  80. date = new Date(date);
  81. return `${date.getFullYear()-1}/${date.getMonth() + 1}/${date.getDate()}`;
  82. },
  83. share1() {
  84. this.setData({
  85. postshow: true
  86. });
  87. },
  88. share() {
  89. this.setData({
  90. postshow1: true
  91. });
  92. },
  93. formatDate(date) {
  94. date = new Date(date);
  95. return `${date.getFullYear()-1}/${date.getMonth() + 1}/${date.getDate()}`;
  96. },
  97. onConfirm(event) {
  98. console.log(event, "0000");
  99. let timeValue = this.timeFormat(new Date(event.detail), "yyyy-MM-dd");
  100. this.setData({
  101. zaizhiTime: timeValue,
  102. postshow :false,
  103. headmasterText :''
  104. });
  105. },
  106. onConfirm1(event) {
  107. console.log(event, "0000");
  108. let timeValue = this.timeFormat(new Date(event.detail), "yyyy-MM-dd");
  109. this.setData({
  110. peixunTime: timeValue,
  111. postshow1 :false,
  112. peixunText :''
  113. });
  114. },
  115. parameterTap: function (e) { //e是获取e.currentTarget.dataset.id所以是必备的,跟前端的data-id获取的方式差不多
  116. let that = this
  117. let this_checked = e.currentTarget.dataset.id
  118. let parameterList = this.data.parameter //获取Json数组
  119. for (let i = 0; i < parameterList.length; i++) {
  120. if (parameterList[i].id == this_checked) {
  121. parameterList[i].checked = true; //当前点击的位置为true即选中
  122. } else {
  123. parameterList[i].checked = false; //其他的位置为false
  124. }
  125. }
  126. that.setData({
  127. parameter: parameterList
  128. })
  129. },
  130. formSubmit(e) {
  131. console.log(e.detail.value, "000000000000000");
  132. if (!e.detail.value.username) {
  133. this.setData({
  134. nameIsTrue: true
  135. })
  136. } else {
  137. this.setData({
  138. nameIsTrue: false
  139. })
  140. }
  141. let sex = '';
  142. if (this.data.parameter[0].checked) {
  143. sex = this.data.parameter[0].name
  144. this.setData({
  145. errorIsTrue: false
  146. })
  147. } else if (this.data.parameter[1].checked) {
  148. sex = this.data.parameter[1].name
  149. this.setData({
  150. errorIsTrue: false
  151. })
  152. } else {
  153. this.setData({
  154. errorIsTrue: true
  155. })
  156. }
  157. if (!e.detail.value.work) {
  158. this.setData({
  159. workIsTrue: true
  160. })
  161. } else {
  162. this.setData({
  163. workIsTrue: false
  164. })
  165. }
  166. if (!e.detail.value.culture) {
  167. this.setData({
  168. cultureIsTrue: true
  169. })
  170. } else {
  171. this.setData({
  172. cultureIsTrue: false
  173. })
  174. }
  175. if (!e.detail.value.graduation) {
  176. this.setData({
  177. graduationIsTrue: true
  178. })
  179. } else {
  180. this.setData({
  181. graduationIsTrue: false
  182. })
  183. }
  184. if (!e.detail.value.major) {
  185. this.setData({
  186. majorIsTrue: true
  187. })
  188. } else {
  189. this.setData({
  190. majorIsTrue: false
  191. })
  192. }
  193. if (!e.detail.value.post) {
  194. this.setData({
  195. postIsTrue: true
  196. })
  197. } else {
  198. this.setData({
  199. postIsTrue: false
  200. })
  201. }
  202. if (!e.detail.value.phone) {
  203. this.setData({
  204. phoneIsTrue: true
  205. })
  206. } else {
  207. this.setData({
  208. phoneIsTrue: false
  209. })
  210. }
  211. if (!this.data.zaizhiTime) {
  212. this.setData({
  213. renzhishijianIsTrue: true
  214. })
  215. } else {
  216. this.setData({
  217. renzhishijianIsTrue: false
  218. })
  219. }
  220. if (!this.data.peixunTime) {
  221. this.setData({
  222. peixunshijianTrue: true
  223. })
  224. } else {
  225. this.setData({
  226. peixunshijianTrue: false
  227. })
  228. }
  229. console.log(this.data.zaizhiTime,"在职时间000");
  230. console.log(this.data.peixunTime,"培训时间000");
  231. console.log(sex,"性别的");
  232. e.detail.value.zaizhiTime = this.data.zaizhiTime;
  233. e.detail.value.peixunTime = this.data.peixunTime;
  234. e.detail.value.sex = sex;
  235. console.log(e.detail.value,"我是合并后的锕");
  236. },
  237. timeFormat(date, fmt) {
  238. let o = {
  239. "M+": date.getMonth() + 1, //月份   
  240. "d+": date.getDate(), //日
  241. "h+": date.getHours(), //小时   
  242. "m+": date.getMinutes(), //分   
  243. "s+": date.getSeconds(), //秒   
  244. "q+": Math.floor((date.getMonth() + 3) / 3), //季度   
  245. "S": date.getMilliseconds() //毫秒   
  246. };
  247. if (/(y+)/.test(fmt))
  248. fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
  249. for (let k in o)
  250. if (new RegExp("(" + k + ")").test(fmt))
  251. fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  252. return fmt;
  253. },
  254. onReady: function () {},
  255. onLoad: function () {
  256. },
  257. })