index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <!--
  2. * @Author: PoJun
  3. * @Date: 2023-05-15 19:59:55
  4. * @LastEditors: PoJun
  5. * @LastEditTime: 2024-05-09 20:56:10
  6. * @Message: Nothing
  7. -->
  8. <template>
  9. <view class="index">
  10. <view v-if="vuex_userInfo && vuex_userInfo.attr.BusinessRole">
  11. <view class="index-banner">
  12. <uv-image :src="BannerImg" height="300px" width="100%">
  13. <template v-slot:loading>
  14. <uv-loading-icon></uv-loading-icon>
  15. </template>
  16. </uv-image>
  17. </view>
  18. <!-- 管理员角色 -->
  19. <view class="content" v-if="vuex_userInfo.attr.BusinessRole == 'orgMember'">
  20. <!-- 排名 -->
  21. <view class="content-container">
  22. <supplier-list></supplier-list>
  23. </view>
  24. <!-- 统计图 -->
  25. <view class="content-container">
  26. <home-chart :times="times"></home-chart>
  27. </view>
  28. </view>
  29. <!-- 供应商角色 -->
  30. <view class="content" v-else-if="vuex_userInfo.attr.BusinessRole == 'supplier'">
  31. <!-- 合作记录 -->
  32. <view class="content-container">
  33. <records-list></records-list>
  34. </view>
  35. <!-- 产品目录 -->
  36. <view class="content-container">
  37. <products-list :times="times"></products-list>
  38. </view>
  39. </view>
  40. </view>
  41. <!-- 未登录和未认证角色 -->
  42. <no-auth v-else :title="!vuex_userInfo ? '没有检测到您的登录状态' : '角色认证尚未完成'">
  43. <uv-button
  44. v-if="!vuex_userInfo || vuex_userInfo.attr.auditState != 1"
  45. :text="!vuex_userInfo ? '去登录' : '去认证'"
  46. @click="toLogin"
  47. size="small"
  48. :hairline="false"
  49. plain
  50. throttleTime="100"
  51. shape="circle"
  52. ></uv-button>
  53. </no-auth>
  54. </view>
  55. </template>
  56. <script>
  57. import { checkAppUpdate } from "@/utils/utils.js";
  58. import supplierList from "./components/supplier-list.vue";
  59. import homeChart from "./components/home-chart.vue";
  60. import recordsList from "./components/records-list.vue";
  61. import productsList from "./components/products-list.vue";
  62. import NoAuth from "@/components/no-auth/index.vue";
  63. import BannerImg from "@/static/banner.png";
  64. export default {
  65. components: {
  66. supplierList,
  67. homeChart,
  68. recordsList,
  69. productsList,
  70. NoAuth,
  71. },
  72. data() {
  73. return {
  74. BannerImg,
  75. times: 0, //图形的渲染有时候会出问题.
  76. };
  77. },
  78. onLoad() {
  79. checkAppUpdate();
  80. },
  81. onShow() {
  82. this.times++;
  83. },
  84. methods: {
  85. toLogin() {
  86. if (!this.vuex_userInfo) {
  87. uni.$uv.route("/pages/login/index");
  88. } else {
  89. uni.$uv.route("/subpkg/setting/authentication");
  90. }
  91. },
  92. },
  93. };
  94. </script>
  95. <style lang="scss">
  96. page {
  97. background-color: $uni-bg-color-grey;
  98. }
  99. .index {
  100. .banner {
  101. height: 300px;
  102. min-height: 300px;
  103. }
  104. .content {
  105. padding: 24rpx;
  106. transform: translateY(-40px);
  107. /* 增加个边距吧具体放下来 */
  108. margin-bottom: -50px;
  109. &-container {
  110. background-color: #fff;
  111. border-radius: 14rpx;
  112. margin-top: 24rpx;
  113. overflow: hidden;
  114. }
  115. }
  116. }
  117. </style>