share.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. <template>
  2. <view class="container">
  3. <!-- 顶部应用名称 -->
  4. <view class="app-header" style="display: flex; justify-content: space-between; align-items: center;">
  5. <view style="display: flex; align-items: center;">
  6. <image class="logo" src="/static/logo.png" mode="aspectFit"
  7. style="width: 100rpx; height: 100rpx; border-radius: 20rpx; margin-right: 20rpx;"></image>
  8. <view class="app-info">
  9. <text class="app-name">萌创星球</text>
  10. <text class="app-desc">装备角色创作</text>
  11. </view>
  12. </view>
  13. <button class="download-btn-top" style="margin: 0;" @click="downloadApp">立即下载</button>
  14. </view>
  15. <!-- 用户卡片 -->
  16. <view class="user-card">
  17. <image class="cuteverse-logo" src="../static/images/top_bg.png"></image>
  18. <view class="user-info">
  19. <image class="avatar" :src="myinfo.avator" mode="aspectFill"></image>
  20. <text class="user-slogan">{{ myinfo.content }}</text>
  21. <view class="user-stats">
  22. <view class="stat-item">
  23. <text class="stat-num">{{ myinfo.num_attention }}</text>
  24. <text class="stat-label">关注</text>
  25. </view>
  26. <view class="stat-item">
  27. <text class="stat-num">{{ myinfo.num_fans }}</text>
  28. <text class="stat-label">粉丝</text>
  29. </view>
  30. <view class="stat-item">
  31. <text class="stat-num">{{ myinfo.num_like }}</text>
  32. <text class="stat-label">获赞</text>
  33. </view>
  34. </view>
  35. <button class="visit-btn" @click="visitProfile">去看看ta的个人主页吧!</button>
  36. </view>
  37. </view>
  38. <!-- 作品展示 -->
  39. <view class="works-section">
  40. <text class="works-title">ta的作品</text>
  41. <view class="works-grid">
  42. <view class="work-item" v-for="(item, index) in works" :key="index" @click="previewWork(item)">
  43. <image class="work-image" :src="item.images.split('|')[0]" mode="aspectFill"></image>
  44. <text class="work-name">{{ item.title }}</text>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="bottomText">
  49. - 打开萌创星球查看更多作品 -
  50. </view>
  51. <!-- 底部下载按钮 -->
  52. <view class="bottom-actions" v-if="false">
  53. <button class="download-btn-bottom" @click="downloadApp">立即下载应用</button>
  54. <button class="open-btn" @click="openApp">打开应用</button>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. import {
  60. generateSecureUrlParams,
  61. parseSecureUrlParams
  62. } from '@/utils/encryption'
  63. export default {
  64. data() {
  65. return {
  66. myinfo: {
  67. avator: "../static/images/avator.png",
  68. nickname: "",
  69. content: "",
  70. sex_id: 1,
  71. my_level: 1,
  72. num_attention: 0,
  73. num_fans: 0,
  74. num_like: 0,
  75. },
  76. aihao_tags: [],
  77. offset: 0,
  78. hasMore: true,
  79. isLoading: false,
  80. works: [],
  81. id: 0,
  82. from_id: 0,
  83. }
  84. },
  85. onLoad(e) {
  86. console.log(e);
  87. if (e.params) {
  88. var analyzeParameters = parseSecureUrlParams(e.params)
  89. console.log("解析URL参数:", analyzeParameters)
  90. this.id = analyzeParameters.userId || 0
  91. this.from_id = analyzeParameters.from_id || 0
  92. }
  93. // URL参数加密示例
  94. // console.log('===== URL参数加密示例 =====');
  95. // const urlParams = {
  96. // userId: 1,
  97. // action: 'view',
  98. // timestamp: new Date().getTime()
  99. // };
  100. // const secureParams = generateSecureUrlParams(urlParams);
  101. // console.log('安全URL参数:', secureParams);
  102. // console.log('解析URL参数:', parseSecureUrlParams(secureParams));
  103. // 页面加载时执行
  104. this.loadInfo()
  105. this.loadWorksList()
  106. },
  107. methods: {
  108. // 加载用户信息
  109. loadInfo() {
  110. uni.request({
  111. url: this.$apiHost + "/Member/getHomeInfo",
  112. data: {
  113. uuid: getApp().globalData.uuid,
  114. skey: getApp().globalData.skey,
  115. from_id: this.from_id,
  116. user_id: this.id,
  117. },
  118. header: {
  119. "content-type": "application/json",
  120. sign: getApp().globalData.headerSign,
  121. },
  122. success: (res) => {
  123. console.log("用户信息:", JSON.parse(JSON.stringify(res.data)));
  124. if (res.data.need_login == "yes") {
  125. uni.removeStorageSync("wapptoken");
  126. uni.redirectTo({
  127. url: "/pages/login/login",
  128. });
  129. return;
  130. }
  131. if (res.data.aihao) {
  132. this.aihao_tags = res.data.aihao.split(",");
  133. }
  134. this.myinfo = res.data;
  135. },
  136. fail: (e) => {
  137. console.log("获取用户信息失败:", e);
  138. },
  139. });
  140. },
  141. // 加载作品列表
  142. loadWorksList() {
  143. uni.request({
  144. url: this.$apiHost + '/Work/getlist',
  145. data: {
  146. uuid: getApp().globalData.uuid,
  147. skey: getApp().globalData.skey,
  148. type: "other",
  149. offset: 0,
  150. limit: 6,
  151. user_id: this.id,
  152. from_id: this.from_id,
  153. },
  154. header: {
  155. "content-type": "application/json",
  156. sign: getApp().globalData.headerSign,
  157. },
  158. success: (res) => {
  159. console.log("作品列表:", JSON.parse(JSON.stringify(res.data)));
  160. if (res.data.success == "yes" && res.data.list) {
  161. this.works = res.data.list.slice(0, 6);
  162. }
  163. },
  164. fail: (e) => {
  165. console.log("获取作品列表失败:", e);
  166. },
  167. });
  168. },
  169. // 显示下载提示弹窗
  170. showDownloadTip() {
  171. uni.showModal({
  172. title: '下载提示',
  173. content: '请下载萌创星球APP,体验完整功能',
  174. confirmText: '立即下载',
  175. cancelText: '取消',
  176. success: (res) => {
  177. if (res.confirm) {
  178. // #ifdef H5
  179. if (this.$platform.isIOS()) {
  180. window.location.href = this.$config.download.ios
  181. } else {
  182. window.location.href = this.$config.download.android
  183. }
  184. // #endif
  185. }
  186. }
  187. })
  188. },
  189. // 访问用户主页
  190. visitProfile() {
  191. this.showDownloadTip()
  192. },
  193. // 预览作品
  194. previewWork(work) {
  195. this.showDownloadTip()
  196. },
  197. // 下载应用
  198. downloadApp() {
  199. this.showDownloadTip()
  200. },
  201. // 尝试打开App
  202. openApp(path) {
  203. this.showDownloadTip()
  204. }
  205. }
  206. }
  207. </script>
  208. <style scoped lang="scss">
  209. .container {
  210. display: flex;
  211. flex-direction: column;
  212. padding: 0;
  213. background-color: #f8f8f8;
  214. min-height: 100vh;
  215. }
  216. /* 顶部应用名称 */
  217. .app-header {
  218. display: flex;
  219. justify-content: space-between;
  220. align-items: center;
  221. padding: 20rpx 30rpx;
  222. background-color: #fff;
  223. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  224. }
  225. .app-info {
  226. display: flex;
  227. flex-direction: column;
  228. }
  229. .app-name {
  230. font-size: 32rpx;
  231. font-weight: bold;
  232. color: #333;
  233. }
  234. .app-desc {
  235. font-size: 24rpx;
  236. color: #666;
  237. margin-top: 4rpx;
  238. }
  239. .download-btn-top {
  240. background-color: #000;
  241. color: #fff;
  242. font-size: 24rpx;
  243. padding: 10rpx 30rpx;
  244. border-radius: 30rpx;
  245. border: none;
  246. height: 60rpx;
  247. line-height: 40rpx;
  248. }
  249. /* 用户卡片 */
  250. .user-card {
  251. margin: 30rpx;
  252. overflow: hidden;
  253. display: flex;
  254. flex-direction: column;
  255. align-items: center;
  256. justify-content: center;
  257. }
  258. .user-card-header {
  259. position: relative;
  260. padding: 20rpx;
  261. background-color: #e8ffd6;
  262. display: flex;
  263. align-items: center;
  264. }
  265. .cuteverse-logo {
  266. width: 100%;
  267. height: 134rpx;
  268. margin-bottom: 0rpx;
  269. }
  270. .cuteverse-text {
  271. font-size: 28rpx;
  272. font-weight: bold;
  273. color: #333;
  274. }
  275. .brand-name {
  276. font-size: 28rpx;
  277. color: #333;
  278. margin-left: auto;
  279. }
  280. .indicator {
  281. display: flex;
  282. margin-left: 20rpx;
  283. }
  284. .indicator-bar {
  285. width: 12rpx;
  286. height: 30rpx;
  287. background-color: #a8e05f;
  288. margin-left: 6rpx;
  289. }
  290. .user-info {
  291. width: 100%;
  292. height: 522rpx;
  293. padding: 40rpx;
  294. display: flex;
  295. flex-direction: column;
  296. align-items: center;
  297. background-color: #a8e05f;
  298. background: linear-gradient(180deg, #DDFFA8 0%, #FFFFFF 100%);
  299. border-radius: 32rpx;
  300. border: 4rpx solid #1F1F1F;
  301. }
  302. .avatar {
  303. width: 140rpx;
  304. height: 140rpx;
  305. border-radius: 50%;
  306. margin-bottom: 20rpx;
  307. }
  308. .user-slogan {
  309. font-size: 32rpx;
  310. color: #333;
  311. font-weight: 600;
  312. margin-bottom: 30rpx;
  313. }
  314. .user-stats {
  315. display: flex;
  316. width: 100%;
  317. justify-content: space-around;
  318. margin-bottom: 30rpx;
  319. position: relative;
  320. }
  321. .stat-item {
  322. display: flex;
  323. flex-direction: column;
  324. align-items: center;
  325. position: relative;
  326. flex: 1;
  327. }
  328. .stat-item:not(:last-child)::after {
  329. content: '';
  330. position: absolute;
  331. right: 0;
  332. top: 50%;
  333. width: 2rpx;
  334. height: 50%;
  335. background-color: #d8d8d8;
  336. transform: translate(50%, -50%);
  337. }
  338. .stat-num {
  339. font-size: 36rpx;
  340. font-weight: bold;
  341. color: #333;
  342. }
  343. .stat-label {
  344. font-size: 24rpx;
  345. color: #999;
  346. margin-top: 4rpx;
  347. }
  348. .visit-btn {
  349. width: 100%;
  350. background-color: #1F1F1F;
  351. color: #fff;
  352. border-radius: 100rpx;
  353. font-size: 28rpx;
  354. height: 88rpx;
  355. line-height: 88rpx;
  356. padding: 0;
  357. border: none;
  358. font-weight: 400;
  359. box-shadow: 0 4rpx 8rpx rgba(0, 0, 0, 0.1);
  360. color: #ACF934;
  361. }
  362. /* 作品展示 */
  363. .works-section {
  364. padding: 30rpx;
  365. }
  366. .works-title {
  367. font-size: 28rpx;
  368. color: #666;
  369. margin-bottom: 20rpx;
  370. }
  371. .works-grid {
  372. display: flex;
  373. flex-wrap: wrap;
  374. margin: 0 -10rpx;
  375. }
  376. .work-item {
  377. width: 50%;
  378. padding: 10rpx;
  379. box-sizing: border-box;
  380. margin-bottom: 20rpx;
  381. }
  382. .work-image {
  383. width: 100%;
  384. height: 300rpx;
  385. border-radius: 10rpx;
  386. border: 1px dashed #ddd;
  387. }
  388. .work-name {
  389. font-size: 24rpx;
  390. color: #666;
  391. margin-top: 10rpx;
  392. text-align: center;
  393. }
  394. /* 底部下载按钮 */
  395. .bottom-actions {
  396. padding: 30rpx;
  397. margin-top: auto;
  398. }
  399. .download-btn-bottom {
  400. width: 100%;
  401. background-color: #a8e05f;
  402. color: #333;
  403. border-radius: 40rpx;
  404. font-size: 32rpx;
  405. padding: 24rpx 0;
  406. margin-bottom: 20rpx;
  407. font-weight: bold;
  408. border: none;
  409. }
  410. .open-btn {
  411. width: 100%;
  412. background-color: #fff;
  413. color: #333;
  414. border-radius: 40rpx;
  415. font-size: 32rpx;
  416. padding: 24rpx 0;
  417. border: 1px solid #ddd;
  418. }
  419. .bottomText {
  420. font-weight: 400;
  421. font-size: 28rpx;
  422. color: #999999;
  423. text-align: center;
  424. padding-bottom: 50rpx;
  425. }
  426. </style>