boss.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <view class="center">
  3. <view class="info">
  4. <view class="avatar"></view>
  5. <view class="name">城攻闪拓</view>
  6. </view>
  7. <view class="bottom" @click="bd()">成为老板</view>
  8. </view>
  9. </template>
  10. <script>
  11. import { mapState, mapMutations } from 'vuex';
  12. import { interceptor } from '@/utils/loginUtils';
  13. import { setAdmin } from '@/api/coupon.js';
  14. export default {
  15. data() {
  16. return {
  17. id: ''
  18. };
  19. },
  20. computed: {
  21. ...mapState(['userInfo', 'orderInfo', 'hasLogin'])
  22. },
  23. onLoad(option) {
  24. if (!this.hasLogin) {
  25. interceptor();
  26. } else {
  27. this.id = option.scene;
  28. this.loadData();
  29. }
  30. },
  31. methods: {
  32. bd() {
  33. setAdmin({
  34. fuck: this.userInfo.uid,
  35. fuck_name: 'setAdmin'
  36. }).then(e => {
  37. this.$api.msg('加入成功');
  38. setTimeout(function() {
  39. uni.switchTab({
  40. url: '/pages/index/index'
  41. });
  42. }, 1000);
  43. });
  44. }
  45. }
  46. };
  47. </script>
  48. <style lang="scss">
  49. .avatar {
  50. margin: 20rpx auto 0;
  51. width: 120rpx;
  52. height: 120rpx;
  53. border-radius: 50%;
  54. image {
  55. width: 100%;
  56. height: 100%;
  57. border-radius: 50%;
  58. }
  59. }
  60. .name {
  61. margin-top: 10rpx;
  62. text-align: center;
  63. font-size: 30rpx;
  64. font-family: PingFang SC;
  65. font-weight: 500;
  66. }
  67. .bottom {
  68. position: absolute;
  69. left: 0;
  70. right: 0;
  71. bottom: 100rpx;
  72. margin: 0 auto;
  73. width: 560rpx;
  74. background: linear-gradient(90deg, #fe6f61 0%, #ff4343 100%);
  75. color: #ffffff;
  76. text-align: center;
  77. padding: 26rpx 0rpx;
  78. border-radius: 50rpx;
  79. }
  80. </style>