index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <home-frame @toPath="toPath">
  3. <view class="main">
  4. <view class="one">
  5. <view class="one_1">
  6. <image class="image" :src="logo_url" mode="">
  7. </image>
  8. </view>
  9. <view class="one_2">
  10. <view class="name">
  11. {{userInfo.name}}
  12. </view>
  13. <view class="id">
  14. ID:{{userInfo.account_id}}
  15. </view>
  16. </view>
  17. <view class="one_3" v-if="!userInfo._id">
  18. <button size="mini" @tap="toLogin()">注册/登录</button>
  19. </view>
  20. </view>
  21. <view class="two">
  22. <view class="list" v-for="(item,index) in basicInfo.account_btn" :key="index">
  23. <image class="image" :src="item.img_url&&item.img_url.length>0?item.img_url[0].url:''" mode="">
  24. </image>
  25. <view class="name">
  26. {{item.name}}
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </home-frame>
  32. </template>
  33. <script>
  34. import homeFrame from "../components/home-frame.vue";
  35. export default {
  36. components: {
  37. homeFrame
  38. },
  39. data() {
  40. return {
  41. // 基本信息
  42. basicInfo: {},
  43. // 用户信息
  44. userInfo: {},
  45. // 头像
  46. logo_url: '',
  47. };
  48. },
  49. onLoad() {
  50. },
  51. onShow() {
  52. const that = this;
  53. that.searchBasic();
  54. that.search()
  55. },
  56. methods: {
  57. searchBasic() {
  58. const that = this;
  59. uni.getStorage({
  60. key: 'basicInfo',
  61. success: (res) => {
  62. let data = res.data
  63. that.$set(that, `basicInfo`, data);
  64. }
  65. })
  66. },
  67. search() {
  68. const that = this;
  69. let user = {
  70. _id: '',
  71. name: '自由天空',
  72. account_id: '123456',
  73. logo_url: [ //
  74. {
  75. id: "20230216100918",
  76. name: "头像.jpg",
  77. status: "success",
  78. uid: 1676513358695,
  79. uri: "/files/projectadmin/imgurl/20230216100918.jpg",
  80. url: "http://47.93.34.200/files/projectadmin/imgurl/20230216100918.jpg"
  81. }
  82. ]
  83. }
  84. that.$set(that, `userInfo`, user);
  85. // 判断logo
  86. let logo_url = '';
  87. if (user.logo_url && user.logo_url.length > 0) {
  88. logo_url = user.logo_url[0].url
  89. } else {
  90. logo_url = that.basicInfo.logo_url[0].url
  91. }
  92. that.$set(that, `logo_url`, logo_url)
  93. },
  94. // 注册,登录
  95. toLogin() {
  96. uni.navigateTo({
  97. url: '/pagesAccount/login/index'
  98. })
  99. },
  100. // 跳转页面
  101. toPath(e) {
  102. let url = `/${e.route}`;
  103. if (e.type == '0') uni.navigateTo({
  104. url
  105. })
  106. else if (e.type == '1') uni.redirectTo({
  107. url
  108. })
  109. else if (e.type == '2') uni.reLaunch({
  110. url
  111. })
  112. else if (e.type == '3') uni.switchTab({
  113. url
  114. })
  115. }
  116. },
  117. };
  118. </script>
  119. <style lang="scss">
  120. .main {
  121. background-color: var(--rgb000);
  122. display: flex;
  123. flex-direction: column;
  124. width: 100vw;
  125. height: 92vh;
  126. overflow-y: auto;
  127. .one {
  128. display: flex;
  129. padding: 2vw;
  130. margin: 0 0 10px 0;
  131. .one_1 {
  132. width: 80px;
  133. height: 80px;
  134. overflow: hidden;
  135. margin: 0 2vw 0 0;
  136. .image {
  137. width: 100%;
  138. height: 80px;
  139. overflow: hidden;
  140. border-radius: 90%;
  141. }
  142. }
  143. .one_2 {
  144. flex-grow: 1;
  145. color: var(--rgbfff);
  146. font-size: 16px;
  147. font-weight: bold;
  148. padding: 2vw 0;
  149. overflow: hidden;
  150. .name {
  151. font-size: 18px;
  152. margin: 0 0 1vw 0;
  153. background: linear-gradient(to bottom right, var(--rgbfa4), var(--rgbfff));
  154. color: transparent;
  155. background-clip: text;
  156. -webkit-background-clip: text;
  157. }
  158. }
  159. .one_3 {
  160. padding: 4vw 0;
  161. overflow: hidden;
  162. button {
  163. background-color: var(--rgbfa4);
  164. color: var(--rgbfff);
  165. }
  166. }
  167. }
  168. .two {
  169. display: flex;
  170. // justify-content: space-around;
  171. flex-wrap: wrap;
  172. padding: 0 2vw;
  173. .list {
  174. width: 22%;
  175. height: 74px;
  176. margin: 0 10px 10px 0;
  177. text-align: center;
  178. background: linear-gradient(to bottom right, var(--rgb000), var(--rgbfa4));
  179. border: 1px solid var(--rgb111);
  180. border-radius: 5px;
  181. .image {
  182. width: 20px;
  183. height: 20px;
  184. margin: 3vw 0 2vw 0;
  185. }
  186. .name {
  187. color: var(--rgbfff);
  188. font-size: 14px;
  189. }
  190. }
  191. .list:nth-child(4n) {
  192. margin: 0 0 10px 0;
  193. }
  194. }
  195. }
  196. </style>