chooseRole.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <view class="list animated fadeInDown">
  3. <view class="item" :class="{ active: current == index }" v-for="(item, index) in roles" :key="index" @click="current = index">
  4. <view class="title">我是{{ item.roleName }}</view>
  5. <image src="../../static/images/role/sh.png" mode="widthFix" v-if="index == 0"></image>
  6. <image src="../../static/images/role/sj.png" mode="widthFix" v-if="index == 1"></image>
  7. <image src="../../static/images/role/sgs.png" mode="widthFix" v-if="index == 2"></image>
  8. <image src="../../static/images/role/zz.png" mode="widthFix" v-if="index == 3"></image>
  9. <image src="../../static/images/role/bm.png" mode="widthFix" v-if="index == 4"></image>
  10. <view class="clear"></view>
  11. </view>
  12. <button class="btn" @click="next()" :disabled="current == -1">下一步</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. getList() {
  28. this.http.request({
  29. url: '/sp-admin/app/AppRole/getList',
  30. success: res => {
  31. this.roles = res.data.data;
  32. }
  33. });
  34. },
  35. next() {
  36. uni.navigateTo({ url: '/pages/login/register?type=' + this.roles[this.current].id });
  37. }
  38. }
  39. };
  40. </script>
  41. <style lang="scss">
  42. page {
  43. background-color: $pg;
  44. }
  45. .list {
  46. padding: 20px;
  47. .item {
  48. margin-top: 15px;
  49. background-color: white;
  50. height: 100px;
  51. position: relative;
  52. border-radius: 12px;
  53. &.active {
  54. border: 2px solid $main-color;
  55. }
  56. .title {
  57. float: left;
  58. line-height: 96px;
  59. padding-left: 20px;
  60. font-weight: bold;
  61. color: $font-c;
  62. font-size: 20px;
  63. }
  64. image {
  65. position: absolute;
  66. right: 23px;
  67. top: 15px;
  68. width: 50px;
  69. }
  70. }
  71. .btn {
  72. margin-top: 30px;
  73. }
  74. }
  75. </style>