test.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <template>
  2. <view class="page">
  3. <u-sticky>
  4. <u-tabs active-color="#EF9944" :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
  5. </u-sticky>
  6. <card1 v-if="current==0"></card1>
  7. <card2 @login="showLogin" v-else></card2>
  8. <login ref="login" @signIn="signIn"></login>
  9. </view>
  10. </template>
  11. <script>
  12. import card1 from "./comps/card1.vue"
  13. import card2 from "./comps/card2.vue"
  14. import login from "@/components/login.vue"
  15. export default {
  16. components:{
  17. card1,card2,login
  18. },
  19. data() {
  20. return {
  21. list: [{
  22. name: '参与活动'
  23. }, {
  24. name: '代理推广'
  25. }],
  26. current: 0
  27. }
  28. },
  29. onLoad(options) {
  30. this.current=options.current || 0
  31. },
  32. mounted() {
  33. },
  34. methods:{
  35. showLogin(){
  36. this.$refs.login.show()
  37. },
  38. showPhoneModal(){
  39. this.$refs.login.showPhoneModal()
  40. },
  41. signIn(resp){
  42. this.judgeAgenterType()
  43. if (!this.vuex_phone) {
  44. this.showPhoneModal()
  45. }
  46. },
  47. change(e){
  48. this.current=e
  49. if (this.current==1 && this.$isEmpty(this.vuex_userId)) {
  50. this.showLogin()
  51. return
  52. }
  53. if (this.current==1 && this.$isEmpty(this.vuex_phone)) {
  54. this.showPhoneModal()
  55. }
  56. },
  57. judgeAgenterType(){
  58. let params={
  59. userId:this.vuex_userId,
  60. enabled:1
  61. }
  62. this.$api.agenter.list(params).then(res=>{
  63. if (!this.$isEmpty(res.data.records)) {
  64. let item=res.data.records[0]
  65. let type=this.$isEmpty(item.agenterTypeId)?1:2
  66. this.$u.vuex('vuex_agenter_type',type)
  67. }
  68. })
  69. }
  70. }
  71. }
  72. </script>
  73. <style lang="scss" scoped>
  74. .page{
  75. background-color: #f6f6f6;
  76. min-height: 100vh;
  77. }
  78. </style>