123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- // import '../../css/bootstrap.less';
- // import 'bootstrap/dist/js/bootstrap.js';
- import 'css/newMenu/public.css';
- import 'css/newMenu/header.css'
- import '../../css/main_banner.css';
- import '../../js/public.js';
- import '../../js/main_banner.js';
- import '../../css/technologyTrading/demandDetail.css';
- import 'js/newMenu/publicComment';
- (function(){
- var isIntereste=$("#isInterester").attr("isInterester");
- if(isIntereste==0){
- $(".loves>span:first-child").removeClass("box_love").addClass("bj_love");
- }else if(isIntereste==1){
- $(".loves>span:first-child").removeClass("bj_love").addClass("box_love");
- }
- $(".fine").on('click', 'div.pointer', function () {
- var theId = $(this).children("p.demandId").html();
- var thetype=$(this).children("p.demandTyp").html();
- window.open(globalConfig.context + '/portal/technologyTrading/demandDetail?id=' + theId+'&type='+thetype );
- });
- $(".main_introduce ul").on("click","li",function(){
- var theId = $(this).children("div").children("p.demandId").html();
- var thetype=$(this).children("div").children("p.demandTyp").html();
- window.open(globalConfig.context + '/portal/technologyTrading/demandDetail?id=' + theId+'&type='+thetype );
- })
- //收藏
- $('.collection p').eq(0).click(function () {
- window.location.hash='jump';
- let heart = $('.heart');
- if (heart.hasClass('active')) {
- collectionApi(0) //取消收藏
- } else {
- collectionApi(1) //收藏
- }
- })
- let hash = window.location.search,
- hashArr =hash.split('&'),
- idArr = hashArr[0].split('='),
- ids =idArr[1];
- function collectionApi(index) {
- let url = index?'/api/user/portal/demandInterest':'/api/user/portal/demandCancelInterest'
- $.ajax({
- method: "post",
- dataType: "json",
- url: globalConfig.context + url,
- data: {
- id:ids
- },
- success: function (data) {
- if (data.error && data.error.length) {
- $('#msg').val(data.error[0].message);
- msg();
- }else{
- if(!index){
- $('.heart').removeClass('active');
- }else{
- $('.heart').addClass('active');
- }
- $('#msg').val(index?'收藏成功,请至个人中心查看.':'撤销收藏');
- msg();
- }
- }
- })
- }
- //点击感兴趣
- var t=0;
- $('.basic .loves').click(function(){
- var theId=$("#demand_id").attr("val");
- var islogin=$("#isLogin").attr("islogin");
- if(islogin=="true"){
- $(".head_login").click();
- }
- if($(this).find('span:first-child').hasClass('box_love')&&islogin=="false"){
- t=$('.dem_number').text();
- $('.dem_number').text(parseInt(t)+1);
- $(this).find('span:first-child').addClass('bj_love').removeClass('box_love');
- $.ajax({
- method: "post",
- dataType: "json",
- url: globalConfig.context + "/api/user/portal/demandInterest",
- data: {
- id:theId
- },
- success: function (data) {
- }
- });
- return false;
- }
- if($(this).find('span:first-child').hasClass('bj_love')&&islogin=="false"){
- t=$('.dem_number').text();
- $('.dem_number').text(parseInt(t)-1)
- $(this).find('span:first-child').addClass('box_love').removeClass('bj_love')
- $.ajax({
- method: "post",
- dataType: "json",
- url: globalConfig.context + "/api/user/portal/demandCancelInterest",
- data: {
- id:theId
- },
- success: function (data) {
- }
- });
- }
- })
- $("#purchase").click(function(){
- var isLogin=$("#isLogin").attr("islogin");
- var theId = $("#Id_").attr('val');
- var thetype=$("#ownerType_").attr('typ');
- if(isLogin=="false"){
- window.open(globalConfig.context + '/portal/technologyTrading/demandOrder?id=' + theId+'&type='+thetype );
- }else{
- $(".head_login").click();
- }
- });
- //提示框渐隐函数
- function msg() {
- if($('.smg').hasClass('active')){
- return ;
- }
- $('.smg').addClass('active')
- setTimeout(function () {
- $('.smg').removeClass('active')
- $('#msg').val('');
- }, 2000)
- }
- })();
|