index.vue 4.1 KB

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