123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <template>
- <view class="u-page">
- <navigation-bar title="选择角色" background-color="#fff" front-color="#000000" />
- <u-list :scrollable="false" height="500px">
- <u-list-item v-for="(item, index) in roles" :key="index" >
- <!-- <u-button class="custom-style" size="lager" type="primary" shape="circle" :text="`我是${item.roleName}`" @click="choose(item.id)"></u-button> -->
- <u-button :class="item.id==current?'active-custom-style':'custom-style'" size="lager" type="primary" shape="circle" @click="choose(item)">
- <text>我是{{item.roleName}}</text>
- </u-button>
- </u-list-item>
- </u-list>
- <!-- <u-button type="error" shape="circle" text="下一步" @click="next()"></u-button> -->
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- roles: [],
- current: 1,
- }
- },
- created() {
- this.getList()
- },
- methods: {
- choose(data) {
- for (let i = 0; i < this.roles.length; i++) {
- if (this.roles[i].roleName == data.roleName) {
- this.current = data.id;
- }
- }
- var that = this
- setTimeout(function() {
- that.$common.to('/pages/login/register?type='+that.current);
- }, 500)
- },
- getList(){
- this.$api.getIdentifyList().then(res => {
- console.log(res)
- this.roles = res.data
- })
- },
- next(){
- // uni.navigateTo({
- // url:"/pages/login/register?type="+this.current
- // })
- this.$common.to('/pages/login/register?type='+this.current);
- }
- }
- }
- </script>
- <style lang="scss">
- page {
- padding: 30px;
- }
- .custom-style {
- margin-bottom: 20px;
- width: 80%;
- height: 70px;
- font-size: 26px;
- font-family: serif;
- background-color: #87CEFA;
- border: #87CEFA;
- }
-
- .active-custom-style {
- margin-bottom: 20px;
- width: 80%;
- height: 70px;
- font-size: 28px;
- background-color: #00BFFF;
- border: #00BFFF;
- }
-
- .r-role {
- font-size: 34px;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .l-role {
- // margin-left: 10px;
- // position: absolute;
- // right: 10px;
- // bottom: 10px;
- }
- </style>
|