company_main.js 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. var selectLocation = ["Canada", "China", "France", "Germany"];
  2. var selectLocation2 = ["China"];
  3. $(function(){
  4. $(".dropdown").mouseover(function () {
  5. $(this).addClass("open");
  6. });
  7. $(".dropdown").mouseleave(function(){
  8. $(this).removeClass("open");
  9. })
  10. var selectDisciplines = [" Masterplanning"," Architecture"," Interiors", "Lighting"," Landscape"," AV & Acoustics"," MEP"," Art work & Accessories"," Graphics & Signage"," Branding"," Furniture, Lighting"];
  11. var newestList = window.localStorage.getItem("newestList")
  12. var resentlist = window.localStorage.getItem("resentlist")
  13. var trendinglist = [
  14. "Interior", "Architecture", "Masterplanning", "Lighting", "Landscape", "Acoustics", "MEP",
  15. "Art work & Accessories",
  16. ]
  17. if(newestList==null){
  18. newestList=[...selectDisciplines]
  19. window.localStorage.setItem("newestList", JSON.stringify(newestList))
  20. }else{
  21. newestList = JSON.parse(newestList)
  22. }
  23. addlistNewest(".newest-list-pro",newestList)
  24. addlistBtn(".trendinglist", trendinglist)
  25. if (resentlist) {
  26. resentlist = JSON.parse(resentlist)
  27. addlistBtn(".resentlist", resentlist)
  28. } else {
  29. resentlist = []
  30. }
  31. $(".newest-list-pro").on("click", '.newest-item-x', function() {
  32. var name=$(this).parent().find(".query").text()
  33. var k2=newestList.indexOf(name)
  34. if (k2 != -1) {
  35. newestList.splice(k2, 1)
  36. }
  37. window.localStorage.setItem("newestList", JSON.stringify(newestList))
  38. $(this).parent().remove()
  39. })
  40. $(".search-item").on("click", '.querybtnli', function() {
  41. var value = $(this).text()
  42. $(".landingpage_search").val(value);
  43. $(".querybtn").click()
  44. })
  45. $(".querybtn").click(function() {
  46. resentlistAdd($(".landingpage_search").val())
  47. })
  48. $(".querybtn2").click(function() {
  49. resentlistAdd($(".landingpage_search").val())
  50. })
  51. function resentlistAdd(name) {
  52. if (name) {
  53. var k = resentlist.indexOf(name)
  54. var k2=newestList.indexOf(name)
  55. if (k != -1) {
  56. resentlist.splice(k, 1)
  57. }
  58. if (k2 != -1) {
  59. newestList.splice(k2, 1)
  60. }
  61. var i = resentlist.unshift(name)
  62. newestList.unshift(name)
  63. var num = 4
  64. if (i > num) {
  65. resentlist = resentlist.slice(0, num)
  66. }
  67. window.localStorage.setItem("resentlist", JSON.stringify(resentlist))
  68. window.localStorage.setItem("newestList", JSON.stringify(newestList))
  69. }
  70. addlistNewest(".newest-list-pro",newestList)
  71. addlistBtn(".resentlist", resentlist)
  72. $("#project-photo-row").empty();
  73. $.getJSON("../../assets/js/landingpage_photos.json", function(data) {
  74. data = data.sort(() => {
  75. return Math.random() > 0.5 ? -1 : 1
  76. })
  77. const tmphtml = template("flow-photos", {
  78. photos: data
  79. });
  80. $("#project-photo-row").append(tmphtml);
  81. });
  82. }
  83. addlistSelect(".selectDisciplines", selectDisciplines)
  84. addlistSelect(".selectLocation", selectLocation)
  85. function addlistNewest(name, list) {
  86. $(name).empty()
  87. list.forEach(function(item) {
  88. var btn = $('<div class="newest-item "> <span class="query">' + item + '</span><span class="newest-item-x" >x</span></div>')
  89. $(name).append(btn)
  90. })
  91. }
  92. function addlistBtn(name, list) {
  93. $(name).empty()
  94. list.forEach(function(item) {
  95. var btn = $('<button class="btn btn-lg querybtnli">' + item + '</button>')
  96. $(name).append(btn)
  97. })
  98. }
  99. $(".query").click(function() {
  100. resentlistAdd($(this).text())
  101. })
  102. $('.selectpicker').selectpicker({
  103. template: {
  104. caret: '<span class="sel-icon glyphicon glyphicon-menu-down"></span>'
  105. }
  106. });
  107. $('#filter-select').on('changed.bs.select', function (e, clickedIndex, isSelected, prestate,currentVal) {
  108. });
  109. var look =(window.location.search?0:1)
  110. $.getJSON("../../assets/js/landingpage_photos.json", function (data) {
  111. const tmphtml=template("flow-photos",{photos:data,look:look});
  112. $("#project-photo-row").append(tmphtml);
  113. });
  114. $(".query").click(function(){
  115. $("#project-photo-row").empty();
  116. $.getJSON("../../assets/js/landingpage_photos.json", function (data) {
  117. data=data.sort(()=>{
  118. return Math.random()>0.5?-1:1
  119. })
  120. const tmphtml=template("flow-photos",{photos:data,look:look});
  121. $("#project-photo-row").append(tmphtml);
  122. });
  123. })
  124. $("#project-photo-row").on("click",".imgoptionspan.like",function(){
  125. var value=$(this).attr("islike");
  126. if("1"==value){
  127. $(this).css("background-image","url(../../assets/img/unlike_heart.png )")
  128. $(this).attr("islike","0");
  129. }else{
  130. $(this).css("background-image","url(../../assets/img/like_heart.png )")
  131. $(this).attr("islike","1");
  132. }
  133. });
  134. $("#project-photo-row").on("click",".imgoptionspan.edit",function(){
  135. window.location.href=("../company/postproject.html?1=1");
  136. });
  137. $("#project-photo-row").on("click",".imgoptionspan.del",function(){
  138. var submitlogo = $("#uploadButtonInput").val();
  139. var successTitle = $(".head_success").val();
  140. var cancelTitle = $(".head_cancel").val();
  141. var warning = $(".head_tips").val();
  142. var warning1 = $(".signin_warning").val()
  143. var _this=this;
  144. zeroModal.alert({
  145. unique: '1',
  146. opacity: 0.8,
  147. content: warning,
  148. contentDetail: warning1,
  149. width: '300px',
  150. height: '280px',
  151. cancel:true,
  152. ok: true,
  153. cancelTitle:cancelTitle,
  154. okTitle:successTitle,
  155. okFn: function() {
  156. $(_this).parent() .parent().parent().remove()
  157. },
  158. onClosed: function() {
  159. ; //location.href='../signin/signin.html'
  160. },
  161. onComplete: function(evn) {
  162. console.log('onComplete')
  163. // setTimeout(function() {
  164. // zeroModal.close('1');
  165. // }, 3000);
  166. }
  167. })
  168. });
  169. $(".contact-btn").on("click",function(){
  170. window.open("../company/company_contact.html");
  171. });
  172. //trigger search by enter
  173. $(".landingpage_search").on("keyup",function(event){
  174. var e = event || window.event;
  175. if(e && e.keyCode==13 && this.value.length>0){
  176. resentlistAdd($(".landingpage_search").val());
  177. }
  178. });
  179. });
  180. function selectOnchang(obj){
  181. console.log(obj.selectedIndex)
  182. if(obj.selectedIndex==1){
  183. addlistSelect(".selectpicker.selectLocation", selectLocation2)
  184. }else{
  185. addlistSelect(".selectpicker.selectLocation", selectLocation)
  186. }
  187. $(".selectpicker.selectLocation").selectpicker('refresh');
  188. }
  189. function addlistSelect(name, list) {
  190. $(name).empty()
  191. list.forEach(function(item) {
  192. var btn = $('<option>' + item + '</option>')
  193. $(name).append(btn)
  194. })
  195. }