design.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. var diyMemberInfoHtml = '<div></div>';
  2. Vue.component("diy-member-info-sources", {
  3. template: diyMemberInfoHtml,
  4. data: function () {
  5. return {
  6. data: this.$parent.data,
  7. styleList: [
  8. {text: '样式一', value: 1},
  9. {text: '样式二', value: 2},
  10. {text: '样式三', value: 3},
  11. {text: '样式四', value: 4}
  12. ]
  13. };
  14. },
  15. created: function () {
  16. this.$parent.data.ignore = ['componentAngle'];//加载忽略内容 -- 其他设置中的属性设置
  17. this.$parent.data.ignoreLoad = true; // 等待忽略数组赋值后加载
  18. // 组件所需的临时数据
  19. this.$parent.data.tempData = {
  20. styleList: this.styleList,
  21. baseColor: diyMemberInfoSystemColor.main_color,
  22. methods: {
  23. getBgStyle: this.getBgStyle
  24. },
  25. };
  26. },
  27. watch:{
  28. "data.style": function(val){
  29. this.data.theme = "default";
  30. if(val == 3){
  31. this.data.theme = "diy";
  32. this.data.bgColorStart = "#f9e6df";
  33. this.data.bgColorEnd = "#f6f8f9";
  34. }
  35. }
  36. },
  37. methods: {
  38. verify: function (index) {
  39. var res = {code: true, message: ""};
  40. return res;
  41. },
  42. getBgStyle() {
  43. let style = {},
  44. img = "",
  45. backSize = "contain";
  46. if (this.data.style == 4) {
  47. img = ns.img(memberInfoRelativePath + '/img/style_4_bg.png');
  48. backSize = "cover";
  49. } else if(this.data.style != 3) {
  50. img = ns.img('public/static/img/diy_view/member_info_bg.png')
  51. }
  52. if (this.data.theme == 'default') {
  53. style.background = `url('${img}') no-repeat bottom / ${backSize}, linear-gradient(${this.data.gradientAngle}deg, ${diyMemberInfoSystemColor.main_color} 0%, ${diyMemberInfoSystemColor.main_color} 100%)`;
  54. } else {
  55. style.background = `url('${img}') no-repeat bottom / ${backSize},linear-gradient(${this.data.gradientAngle}deg, ${this.data.bgColorStart} 0%, ${this.data.bgColorEnd} 100%)`;
  56. }
  57. return style;
  58. }
  59. }
  60. });