展品维保小程序前端代码接口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.7 KiB

2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
2 weeks ago
  1. export default {
  2. data() {
  3. return {
  4. containerHeight: 0
  5. }
  6. },
  7. methods: {
  8. // 自定义分享内容
  9. mixinCustomShare() {
  10. return {
  11. }
  12. },
  13. // 计算容器高度
  14. calculateContainerHeight() {
  15. const systemInfo = uni.getSystemInfoSync();
  16. const statusBarHeight = systemInfo.statusBarHeight || 0;
  17. const navigationBarHeight = 44; // 默认导航栏高度
  18. this.containerHeight = 2 * (systemInfo.windowHeight - statusBarHeight - navigationBarHeight);
  19. console.log('最后的容器高度为', this.containerHeight/2 + 'px', '状态栏高度:', statusBarHeight + 'px', 'nav导航栏高度:', navigationBarHeight + 'px');
  20. },
  21. },
  22. computed: {
  23. // 获取全局配置的文本
  24. configParamText() {
  25. return key => this.$store.state.configList[key]?.paramText || '默认文本'
  26. },
  27. // 获取全局配置的图片
  28. configParamImage() {
  29. return key => this.$store.state.configList[key]?.paramImage || '/static/默认图片.png'
  30. },
  31. // 获取全局配置的富文本
  32. configParamTextarea() {
  33. return key => this.$store.state.configList[key]?.paramTextarea || '默认富文本'
  34. },
  35. // 默认的全局分享参数
  36. GShare() {
  37. return {
  38. title: this.configParamText('app_name'),
  39. desc: this.configParamText('share_desc'),
  40. imageUrl: this.configParamImage('app_logo'),
  41. path: '/pages/index/index'
  42. }
  43. }
  44. },
  45. onShareAppMessage() {
  46. return {
  47. ...this.GShare,
  48. ...this.mixinCustomShare()
  49. }
  50. },
  51. onShareTimeline() {
  52. return {
  53. ...this.GShare,
  54. ...this.mixinCustomShare()
  55. }
  56. },
  57. onLoad() {
  58. // this.calculateContainerHeight();
  59. }
  60. }