鸿宇研学生前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

140 lines
2.9 KiB

  1. <template>
  2. <view class="page__view">
  3. <navbar title="选择角色" leftClick @leftClick="$utils.navigateBack" bgColor="transparent" color="#191919" />
  4. <view class="main">
  5. <view class="card">
  6. <view class="card-header">角色信息</view>
  7. <view class="card-content">
  8. <uv-radio-group v-model="role" placement="column" activeColor="#00A9FF">
  9. <view class="flex option" v-for="item in roleOptions" :key="item.id" @click="onSelect(item.value)">
  10. <view>
  11. <uv-radio :name="item.value"></uv-radio>
  12. </view>
  13. <view>{{ item.label }}</view>
  14. </view>
  15. </uv-radio-group>
  16. </view>
  17. </view>
  18. </view>
  19. <view class="flex bottom">
  20. <view class="flex bar">
  21. <button class="btn" @click="onConfirm">确定</button>
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. export default {
  28. data() {
  29. return {
  30. role: null,
  31. roleOptions: [],
  32. }
  33. },
  34. onLoad() {
  35. this.roleOptions = [
  36. { id: '001', label: '家长', value: '0' },
  37. { id: '002', label: '学生', value: '1' },
  38. ]
  39. this.role = this.roleOptions[0].value
  40. },
  41. methods: {
  42. onSelect(val) {
  43. this.role = val
  44. },
  45. async onConfirm() {
  46. try {
  47. await this.$fetch('updateInfo', params, false)
  48. uni.showToast({
  49. icon: 'success',
  50. title: '保存成功',
  51. });
  52. this.$store.commit('getUserInfo')
  53. setTimeout(() => {
  54. uni.reLaunch({
  55. url:'/pages/index/index'
  56. })
  57. }, 800)
  58. } catch (err) {
  59. }
  60. },
  61. },
  62. }
  63. </script>
  64. <style scoped lang="scss">
  65. .page__view {
  66. background-image: linear-gradient(#DAF3FF, #F3F3F3 200rpx, #F3F3F3);
  67. }
  68. .main {
  69. padding: 24rpx 40rpx;
  70. }
  71. .card {
  72. width: 100%;
  73. height: 100%;
  74. padding: 32rpx 32rpx 450rpx 32rpx;
  75. box-sizing: border-box;
  76. background: #FFFFFF;
  77. border-radius: 24rpx;
  78. &-header {
  79. font-size: 32rpx;
  80. font-weight: 500;
  81. color: #181818;
  82. }
  83. }
  84. .option {
  85. margin-top: 32rpx;
  86. width: 100%;
  87. height: 252rpx;
  88. justify-content: flex-start;
  89. column-gap: 24rpx;
  90. padding: 24rpx;
  91. box-sizing: border-box;
  92. background: #F5F8FF;
  93. border-radius: 24rpx;
  94. &:nth-child(2n) {
  95. background: #F9F9F9;
  96. }
  97. }
  98. .bottom {
  99. position: fixed;
  100. left: 0;
  101. bottom: 0;
  102. width: 100vw;
  103. height: 146rpx;
  104. padding-bottom: env(safe-area-inset-bottom);
  105. background: #FFFFFF;
  106. .bar {
  107. width: 100%;
  108. padding: 0 40rpx;
  109. box-sizing: border-box;
  110. }
  111. .btn {
  112. width: 100%;
  113. padding: 16rpx 0;
  114. box-sizing: border-box;
  115. font-size: 36rpx;
  116. color: #FFFFFF;
  117. background-image: linear-gradient(to right, #21FEEC, #019AF9);
  118. border: 2rpx solid $uni-color;
  119. border-radius: 42rpx;
  120. }
  121. }
  122. </style>