chooseRole.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view class="u-page">
  3. <navigation-bar title="选择角色" background-color="#fff" front-color="#000000" />
  4. <u-list :scrollable="false" height="500px">
  5. <u-list-item v-for="(item, index) in roles" :key="index" >
  6. <!-- <u-button class="custom-style" size="lager" type="primary" shape="circle" :text="`我是${item.roleName}`" @click="choose(item.id)"></u-button> -->
  7. <u-button :class="item.id==current?'active-custom-style':'custom-style'" size="lager" type="primary" shape="circle" @click="choose(item)">
  8. <text>我是{{item.roleName}}</text>
  9. </u-button>
  10. </u-list-item>
  11. </u-list>
  12. <!-- <u-button type="error" shape="circle" text="下一步" @click="next()"></u-button> -->
  13. </view>
  14. </template>
  15. <script>
  16. export default {
  17. data() {
  18. return {
  19. roles: [],
  20. current: 1,
  21. }
  22. },
  23. created() {
  24. this.getList()
  25. },
  26. methods: {
  27. choose(data) {
  28. for (let i = 0; i < this.roles.length; i++) {
  29. if (this.roles[i].roleName == data.roleName) {
  30. this.current = data.id;
  31. }
  32. }
  33. var that = this
  34. setTimeout(function() {
  35. that.$common.to('/pages/login/register?type='+this.current);
  36. }, 1000)
  37. },
  38. getList(){
  39. this.$api.getIdentifyList().then(res => {
  40. console.log(res)
  41. this.roles = res.data
  42. })
  43. },
  44. next(){
  45. // uni.navigateTo({
  46. // url:"/pages/login/register?type="+this.current
  47. // })
  48. this.$common.to('/pages/login/register?type='+this.current);
  49. }
  50. }
  51. }
  52. </script>
  53. <style lang="scss">
  54. page {
  55. padding: 30px;
  56. }
  57. .custom-style {
  58. margin-bottom: 20px;
  59. width: 80%;
  60. height: 70px;
  61. font-size: 26px;
  62. font-family: serif;
  63. background-color: #87CEFA;
  64. border: #87CEFA;
  65. }
  66. .active-custom-style {
  67. margin-bottom: 20px;
  68. width: 80%;
  69. height: 70px;
  70. font-size: 28px;
  71. background-color: #00BFFF;
  72. border: #00BFFF;
  73. }
  74. .r-role {
  75. font-size: 34px;
  76. display: flex;
  77. align-items: center;
  78. justify-content: center;
  79. }
  80. .l-role {
  81. // margin-left: 10px;
  82. // position: absolute;
  83. // right: 10px;
  84. // bottom: 10px;
  85. }
  86. </style>