product.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. IsIPhoneX:app.globalData.IsIPhoneX,
  7. ProgramName:app.globalData.ProgramName,
  8. Version:app.globalData.Version,
  9. },
  10. onLoad: function (options) {
  11. let that = this;
  12. that.setData({
  13. Containnerheight: main.getWindowHeight(),
  14. });
  15. },
  16. onReady:function(){
  17. let that = this;
  18. main.getData('GetProgramList', function (data) {
  19. if (data) {
  20. for(let i=0;i<data.length;i++){
  21. if (data[i].ID==app.globalData.ProgramID){
  22. wx.setNavigationBarColor({
  23. frontColor: data[i].FColor,
  24. backgroundColor: data[i].BGColor,
  25. });
  26. wx.setBackgroundColor({
  27. backgroundColorTop: data[i].BGColor,
  28. backgroundColorBottom: data[i].BGColor,
  29. })
  30. that.setData({
  31. BGColor:data[i].BGColor,
  32. FColor:data[i].FColor,
  33. ProgramList:data,
  34. });
  35. break;
  36. }
  37. }
  38. }
  39. });
  40. },
  41. goto: function (e) {
  42. let that=this;
  43. var url=e.currentTarget.dataset.url;
  44. wx.navigateTo({
  45. url: url,
  46. });
  47. },
  48. gotoRedirectTo: function (e) {
  49. let that=this;
  50. var url=e.currentTarget.dataset.url;
  51. wx.redirectTo({
  52. url: url,
  53. });
  54. },
  55. switchProgram:function(e) {
  56. var list = this.data.ProgramList;
  57. for(let i=0;i<list.length;i++){
  58. if (list[i].ID==e.currentTarget.dataset.id){
  59. wx.navigateToMiniProgram({
  60. appId: list[i].AppID,
  61. path: list[i].PathUrl+"?SourceID="+app.globalData.ProgramID,
  62. });
  63. break;
  64. }
  65. }
  66. },
  67. onShareAppMessage: function () {
  68. return {
  69. title: app.globalData.ShareTitle,
  70. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  71. imageUrl: app.globalData.ShareImage,
  72. }
  73. },
  74. })