contact.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <view class="app-page flex flex-col felx-center bg-white">
  3. <!-- 信息 -->
  4. <view class="profile flex flex-col flex-center pa-36">
  5. <view class="avatar"><image class="avatar-img" :src="bloggerInfo.avatar" mode="aspectFill"></image></view>
  6. <view class="nickname mt-24 text-weight-b text-size-g">{{ bloggerInfo.nickname }}</view>
  7. <view class="desc mt-24 text-size-m text-grey-darken-3">{{ bloggerInfo.description || '这个博主很懒,竟然没写介绍~' }}</view>
  8. <!-- 联系图标 -->
  9. <view class="mt-24 contact-icons">
  10. <!-- 放全部:似乎显得有点拥挤 -->
  11. <!-- <block v-for="(item, index) in result" :key="index"><text v-if="item.value" class="halocoloricon" :class="[item.icon, { 'ml-12': index != 0 }]"></text></block> -->
  12. <!-- 考虑放几个常用的就行 -->
  13. <text class="halocoloricon halocoloricon-qq"></text>
  14. <text class="ml-12 halocoloricon halocoloricon-wechat"></text>
  15. <text class="ml-12 halocoloricon halocoloricon-GitHub"></text>
  16. <text class="ml-12 halocoloricon halocoloricon-gitee"></text>
  17. <text class="ml-12 halocoloricon halocoloricon-ic_email_round"></text>
  18. </view>
  19. <view v-if="false" class="mt-24 ">
  20. <tm-button theme="bg-gradient-light-blue-accent" size="m" openType="contact">在线客服联系</tm-button>
  21. <tm-button theme="bg-gradient-orange-accent" size="m" @click="fnOnToWeb">访问PC端博客</tm-button>
  22. </view>
  23. </view>
  24. <!-- 社交联系方式列表 -->
  25. <view class="contact ma-50 mt-0 pt-12">
  26. <block v-for="(item, index) in result" :key="index">
  27. <view v-if="item.value" class="item mt-24 flex" @click="fnOnClick(item)">
  28. <view class="left">
  29. <text class="icon halocoloricon" :class="[item.icon]"></text>
  30. <text class="name">{{ item.name }}</text>
  31. </view>
  32. <view class="right flex-1">{{ item.value }}</view>
  33. </view>
  34. </block>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import tmSkeleton from '@/tm-vuetify/components/tm-skeleton/tm-skeleton.vue';
  40. import tmButton from '@/tm-vuetify/components/tm-button/tm-button.vue';
  41. export default {
  42. components: {
  43. tmSkeleton,
  44. tmButton
  45. },
  46. data() {
  47. return {
  48. loading: 'loading',
  49. queryParams: {
  50. size: 10,
  51. page: 0
  52. },
  53. result: [
  54. {
  55. key: 'qq',
  56. icon: 'halocoloricon-qq',
  57. name: '企鹅号',
  58. value: ''
  59. },
  60. {
  61. key: 'wechat',
  62. icon: 'halocoloricon-wechat',
  63. name: '微信号',
  64. value: ''
  65. },
  66. {
  67. key: 'github',
  68. icon: 'halocoloricon-GitHub',
  69. name: 'Github',
  70. value: ''
  71. },
  72. {
  73. key: 'gitee',
  74. icon: 'halocoloricon-gitee',
  75. name: 'Gitee',
  76. value: ''
  77. },
  78. {
  79. key: 'bilibili',
  80. icon: 'halocoloricon-bilibili',
  81. name: 'Bilibili',
  82. value: ''
  83. },
  84. {
  85. key: 'csdn',
  86. icon: 'halocoloricon-csdn1',
  87. name: 'CSDN',
  88. value: ''
  89. },
  90. {
  91. key: 'blog',
  92. icon: 'halocoloricon-url-monitor',
  93. name: '博客地址',
  94. value: ''
  95. },
  96. {
  97. key: 'juejin',
  98. icon: 'halocoloricon-juejin',
  99. name: '掘金地址',
  100. value: ''
  101. },
  102. {
  103. key: 'weibo',
  104. icon: 'halocoloricon-social-weibo',
  105. name: '微博地址',
  106. value: ''
  107. },
  108. {
  109. key: 'email',
  110. icon: 'halocoloricon-ic_email_round',
  111. name: '邮箱地址',
  112. value: ''
  113. }
  114. ]
  115. };
  116. },
  117. computed: {
  118. // 获取博主信息
  119. bloggerInfo() {
  120. let blogger = this.$tm.vx.getters().getBlogger;
  121. blogger.avatar = this.$utils.checkAvatarUrl(blogger.avatar, true);
  122. return blogger;
  123. }
  124. },
  125. onLoad() {
  126. this.fnSetPageTitle('联系博主');
  127. },
  128. created() {
  129. this.fnGetData();
  130. },
  131. methods: {
  132. fnGetData() {
  133. for (let key in this.$haloConfig.social) {
  134. this.result.find(x => x.key == key).value = this.$haloConfig.social[key];
  135. }
  136. },
  137. fnOnToWeb() {
  138. uni.navigateTo({
  139. url:
  140. '/pagesC/website/website?data=' +
  141. JSON.stringify({
  142. title: this.$haloConfig.title,
  143. url: this.$haloConfig.social.blog
  144. })
  145. });
  146. },
  147. fnOnClick(item) {
  148. if (this.globalAppSettings.contact.isLinkCopy && this.$utils.checkIsUrl(item.value)) {
  149. uni.navigateTo({
  150. url:
  151. '/pagesC/website/website?data=' +
  152. JSON.stringify({
  153. title: item.name,
  154. url: item.value
  155. })
  156. });
  157. } else {
  158. this.$utils.copyText(item.value, item.name + ' 已复制!');
  159. }
  160. }
  161. }
  162. };
  163. </script>
  164. <style lang="scss" scoped>
  165. .app-page {
  166. width: 100vw;
  167. min-height: 100vh;
  168. box-sizing: border-box;
  169. padding-top: 160rpx;
  170. }
  171. .profile {
  172. .avatar {
  173. width: 170rpx;
  174. height: 170rpx;
  175. position: relative;
  176. box-sizing: border-box;
  177. border-radius: 50%;
  178. border: 6rpx solid #fff;
  179. box-shadow: 0rpx 2rpx 24rpx rgba(0, 0, 0, 0.07);
  180. overflow: hidden;
  181. &-img {
  182. width: 100%;
  183. height: 100%;
  184. }
  185. }
  186. .nickname {
  187. font-size: 38rpx;
  188. }
  189. }
  190. .contact-icons {
  191. .halocoloricon {
  192. font-size: 42rpx;
  193. }
  194. }
  195. .contact {
  196. box-sizing: border-box;
  197. border-top: 2rpx solid #f2f2f2;
  198. .item {
  199. box-sizing: border-box;
  200. border-radius: 12rpx;
  201. background-color: #fafafa;
  202. // background-color: rgba(0, 0, 0, 0.05);
  203. // padding-bottom: 12rpx;
  204. // border-bottom: 2rpx solid #eee;
  205. padding: 16rpx;
  206. .left {
  207. position: relative;
  208. width: 140rpx;
  209. display: flex;
  210. align-items: center;
  211. box-sizing: border-box;
  212. // background-color: rgba(0, 0, 0, 0.03);
  213. border-radius: 12rpx 0 0 12rpx;
  214. &::after {
  215. display: none;
  216. content: ':';
  217. position: absolute;
  218. right: 18rpx;
  219. top: 50%;
  220. transform: translateY(-50%);
  221. font-size: 24rpx;
  222. color: #666;
  223. }
  224. .icon {
  225. font-size: 24rpx;
  226. }
  227. .name {
  228. margin-left: 10rpx;
  229. color: #555;
  230. font-size: 24rpx;
  231. }
  232. }
  233. .right {
  234. width: 0;
  235. display: flex;
  236. align-items: center;
  237. flex-wrap: wrap;
  238. box-sizing: border-box;
  239. word-wrap: break-word;
  240. word-break: break-all;
  241. font-size: 24rpx;
  242. box-sizing: border-box;
  243. padding-left: 12rpx;
  244. }
  245. }
  246. }
  247. </style>