fillTeamInfo.vue 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. title:'',
  14. type:'',
  15. next:'',
  16. questionnaireId:'',
  17. confirmText:'下一步'
  18. }
  19. },
  20. onLoad(options) {
  21. this.title = options.title||'';
  22. this.type = options.type;
  23. this.questionnaireId = options.questionnaireId||'';
  24. this.confirmText = options.type?'确定':'下一步';
  25. this.next = options.next;
  26. if(this.next) this.confirmText = '下一步';
  27. },
  28. methods:{
  29. handleConfirm(team){
  30. team.questionnaireId = this.questionnaireId;
  31. team.coachId = JSON.parse(uni.getStorageSync('userInfo')).id;
  32. this.$api.post('/core/user/team',team).then(({data:res})=>{
  33. if(res.code!==0) return this.$showToast(res.msg)
  34. if(this.next){
  35. this.$api.post('/core/team/questionnaire/publish',{
  36. answerSetting:1,
  37. coachId:JSON.parse(uni.getStorageSync('userInfo')).id,
  38. startTime:new Date().Format('yyyy-MM-dd hh:mm:ss'),
  39. endTime:new Date(new Date().setDate(new Date().getDate()+30)).Format('yyyy-MM-dd hh:mm:ss'),
  40. questionnaireId:this.questionnaireId,
  41. teamId:res.data.teamId,
  42. type:1
  43. }).then(({data:res2})=>{
  44. if(res2.code!==0) return this.$showToast(res2.msg)
  45. this.$showToast('保存成功,即将填写问卷')
  46. setTimeout(()=>{
  47. uni.removeStorageSync('newUser')
  48. uni.navigateTo({
  49. url:'/pagesPublish/questionnaireFill?teamQuestionnaireId='+res2.data+'&teamId='+res.data.teamId+'&type='+this.type+'&title='+this.title
  50. })
  51. },1500)
  52. })
  53. }else{
  54. this.$showToast('团队新增成功')
  55. setTimeout(()=>{
  56. this.getOpenerEventChannel().emit('saveTeamInfo')
  57. uni.navigateBack()
  58. },1500)
  59. }
  60. })
  61. }
  62. }
  63. }
  64. </script>
  65. <style scoped lang="scss">
  66. .default_page{
  67. box-sizing: border-box;
  68. }
  69. </style>