query.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. <template>
  2. <view class="regbox pt80 " :style="froms=='login'?'':'background-color: #f5f5f5'">
  3. <block v-if="froms=='login'">
  4. <image :src="sucimg" class="titimg"></image>
  5. <view class="search">
  6. <view class="f15 co16 fw mb10">手机号码</view>
  7. <input placeholder="请输手机号码" v-model="phonenumber"/>
  8. </view>
  9. <view class="apllytxt"><text>*</text>请输入您注册时填写的手机号码进行查询</view>
  10. <view class="rbtn mt40" @click="getQueryLogin">查询</view>
  11. </block>
  12. <pop-up :type='type' :regdat="regdat" @getregfn="getregfn" @getClose="getClose"></pop-up>
  13. <view v-if="showflag||froms=='mine'" class="mt15">
  14. <sh-list :datalist='list' :zhtype="zhtype" @getUpdate="getUpdate" :froms="froms"></sh-list>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import popUp from "@/components/popup/popup.vue"
  20. import shList from "@/components/shlist/list.vue"
  21. import {getqueryFn} from "@/api/mine/register.js"
  22. export default {
  23. data(){
  24. return{
  25. sucimg:require("@/mine/static/mine/success.png"),
  26. type:0,
  27. list:[],
  28. zhtype:7,
  29. froms:'login',
  30. regdat:{},
  31. phonenumber:'',
  32. showflag:false
  33. }
  34. },
  35. components:{popUp,shList},
  36. onUnload(){
  37. uni.$off('refreshstulist')
  38. },
  39. onLoad: function(e) {
  40. uni.$on('refreshstulist', (e) => {
  41. if(this.froms='mine'){
  42. this.reachflag = true;
  43. this.pageNum = 1;
  44. this.list = [];
  45. this.getQuery();
  46. }
  47. })
  48. if(e.from&&e.from=='mine'){
  49. this.froms=e.from;
  50. this.getQuery();
  51. }
  52. },
  53. methods:{
  54. getUpdate(e){
  55. // 个人中心才能去修改
  56. var id=e.id;
  57. var from=this.froms;
  58. if(e.zctype=='school'){
  59. this.$tab.navigateTo(`/mine/pages/mine/applyregister?type=update&id=${id}&from=${from}`)
  60. }else if(e.zctype=='teacher'){
  61. this.$tab.navigateTo(`/mine/pages/mine/applyteacher?type=update&id=${id}&from=${from}`)
  62. }else if(e.zctype=='parents'){
  63. this.$tab.navigateTo(`/mine/pages/mine/applyparent?type=update&id=${id}&from=${from}`)
  64. }
  65. },
  66. getQueryLogin(){
  67. if(!this.phonenumber){
  68. this.$toast('请输入手机号')
  69. return
  70. }
  71. let regphone = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
  72. if(!regphone.test(this.phonenumber)){
  73. this.$toast('请输入正确的手机号')
  74. return
  75. }
  76. var params={
  77. phonenumber:this.phonenumber
  78. }
  79. var that=this;
  80. that.list=[];
  81. getqueryFn(params).then(res=>{
  82. if(res.code==200){
  83. var a,b,c,isPass;
  84. var dat=res.data;
  85. if(dat.parents||dat.school||dat.teacher){
  86. Object.keys(dat).some((key) => {
  87. if(dat[key]&&dat[key].isPass){
  88. if (dat[key].isPass == 2) {
  89. a=1
  90. }
  91. if (dat[key].isPass == 3) {
  92. b=1
  93. }
  94. if (dat[key].isPass == 1) {
  95. c=1
  96. }
  97. }
  98. })
  99. if(b){
  100. //只要有一个拒绝 就展示列表
  101. // 展示列表
  102. var newArr=[];
  103. Object.keys(dat).some((key) => {
  104. if(key=='parents'){
  105. var nArr=dat[key].registerParentsStudentList;
  106. if(nArr&&nArr.length>0){
  107. nArr.forEach(ite=>{
  108. var newObja=ite;
  109. newObja.zctype=key;
  110. newArr.push(newObja)
  111. })
  112. }
  113. }else if(key=='school'){
  114. var newObjb=dat[key];
  115. if(newObjb.isPass){
  116. newObjb.zctype=key;
  117. newArr.push(newObjb)
  118. }
  119. }else if(key=='teacher'){
  120. var newObjc=dat[key];
  121. if(newObjc.isPass){
  122. newObjc.zctype=key;
  123. newArr.push(newObjc)
  124. }
  125. }
  126. })
  127. that.showflag=true;
  128. that.list=JSON.parse(JSON.stringify(newArr))
  129. }else if(a){
  130. // 通过
  131. var regdat={
  132. tit:'注册成功',txt:'您提交的注册申请已通过 可前去登录',btn:'去登录',type:2
  133. }
  134. that.regdat=regdat;
  135. that.type=4;
  136. }else if(c){
  137. var regdat={
  138. tit:'注册审核',txt:'您提交的注册申请待审核 请耐心等待',btn:'取消',type:1
  139. }
  140. that.regdat=regdat;
  141. that.type=4;
  142. }else{
  143. this.$toast("您还未申请,请先去申请")
  144. }
  145. }else{
  146. this.$toast("您还未申请,请先去申请")
  147. }
  148. }
  149. })
  150. },
  151. getQuery(){
  152. var phonenumber=this.$store.state.user.phonenumber;
  153. var params={
  154. phonenumber:phonenumber
  155. }
  156. var that=this;
  157. getqueryFn(params).then(res=>{
  158. if(res.code==200){
  159. that.typeflag=false;
  160. var a,b,c,isPass;
  161. var nobj=res.data;
  162. var newArr=[];
  163. Object.keys(nobj).some((key) => {
  164. if(key=='parents'){
  165. if(nobj[key].isPass){
  166. var nArr=nobj[key].registerParentsStudentList;
  167. nArr.forEach(ite=>{
  168. var newObja=ite;
  169. newObja.zctype=key;
  170. newArr.push(newObja)
  171. })
  172. }
  173. }else if(key=='school'){
  174. if(nobj[key].isPass){
  175. var newObjb=nobj[key];
  176. newObjb.zctype=key;
  177. newArr.push(newObjb)
  178. }
  179. }else if(key=='teacher'){
  180. if(nobj[key].isPass){
  181. var newObjc=nobj[key];
  182. newObjc.zctype=key;
  183. newArr.push(newObjc)
  184. }
  185. }
  186. this.list=JSON.parse(JSON.stringify(newArr))
  187. })
  188. }
  189. })
  190. },
  191. getLogin(){
  192. this.$tab.reLaunch(`/pages/login`)
  193. },
  194. getregfn(data){
  195. if(data==2){
  196. this.type = 0;
  197. this.$tab.reLaunch(`/pages/login`)
  198. }else{
  199. this.type = 0
  200. }
  201. },
  202. getClose(){
  203. this.type=0
  204. },
  205. getConfirm(){
  206. }
  207. },
  208. }
  209. </script>
  210. <style lang="scss" scoped>
  211. // .regbox{padding: 100rpx 86rpx;background-color: #f5f5f5;
  212. .regbox{padding:24rpx 36rpx;background-color: #ffffff;
  213. .titimg{width: 210rpx;height: 210rpx;margin: 0 auto 28rpx;}
  214. .search{
  215. input{width: 100%;height: 80rpx;background: #FFFFFF;border: 2rpx solid #FFB132;border-radius: 36rpx;box-sizing: border-box;padding: 0rpx 40rpx;font-size: 30rpx;color: #161616;display: flex;align-items: center;}
  216. }
  217. .apllytxt{text-align: left;font-size: 26rpx;}
  218. }
  219. </style>