fillTeamInfo.vue 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <template>
  2. <view class="default_page" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='填写所在团队信息'></cus-header>
  4. <cus-team-info-fill @handleConfirm="handleConfirm" :confirmText="confirmText"></cus-team-info-fill>
  5. </view>
  6. </template>
  7. <script>
  8. import CusTeamInfoFill from '@/components/CusTeamInfoFill/index.vue'
  9. export default {
  10. components:{ CusTeamInfoFill },
  11. data(){
  12. return {
  13. type:'',
  14. questionnaireId:'',
  15. confirmText:'下一步'
  16. }
  17. },
  18. onLoad(options) {
  19. this.type = options.type||''
  20. this.questionnaireId = options.questionnaireId||''
  21. this.confirmText = options.type?'确定':'下一步'
  22. },
  23. methods:{
  24. handleConfirm(team){
  25. if(!this.type){
  26. team.questionnaireId = this.questionnaireId;
  27. team.coachId = JSON.parse(uni.getStorageSync('userInfo')).id;
  28. this.$api.post('/core/user/team',team).then(({data:res})=>{
  29. if(res.code!==0) return this.$showToast(res.msg)
  30. this.$showToast('保存成功,即将填写问卷')
  31. setTimeout(()=>{
  32. uni.removeStorageSync('newUser')
  33. uni.navigateTo({
  34. url:'/pagesPublish/questionnaireFill?questionnaireId='+this.questionnaireId
  35. })
  36. },1500)
  37. })
  38. }else{
  39. this.getOpenerEventChannel().emit('saveTeamInfo',111)
  40. uni.navigateBack()
  41. }
  42. }
  43. }
  44. }
  45. </script>
  46. <style scoped lang="scss">
  47. .default_page{
  48. box-sizing: border-box;
  49. }
  50. </style>