chooseRole.vue 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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="index==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. // console.log("选择角色");
  29. // console.log(data);
  30. for (let i = 1; i <= this.roles.length; i++) {
  31. if (this.roles[i].roleName == data.roleName) {
  32. this.current = i;
  33. }
  34. }
  35. this.isNext = true
  36. },
  37. getList(){
  38. this.$api.getIdentifyList().then(res => {
  39. console.log(res)
  40. this.roles = res.data
  41. })
  42. this.$common.to('/pages/login/register?type='+data.id);
  43. },
  44. next(){
  45. uni.navigateTo({
  46. url:"/pages/login/register?type="+this.current
  47. })
  48. }
  49. }
  50. }
  51. </script>
  52. <style lang="scss">
  53. page {
  54. padding: 30px;
  55. }
  56. .custom-style {
  57. margin-bottom: 20px;
  58. width: 80%;
  59. height: 70px;
  60. font-size: 26px;
  61. font-family: serif;
  62. background-color: #87CEFA;
  63. border: #87CEFA;
  64. }
  65. .active-custom-style {
  66. margin-bottom: 20px;
  67. width: 80%;
  68. height: 70px;
  69. font-size: 28px;
  70. background-color: #00BFFF;
  71. border: #00BFFF;
  72. }
  73. .r-role {
  74. font-size: 34px;
  75. display: flex;
  76. align-items: center;
  77. justify-content: center;
  78. }
  79. .l-role {
  80. // margin-left: 10px;
  81. // position: absolute;
  82. // right: 10px;
  83. // bottom: 10px;
  84. }
  85. </style>