123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- /*
- * @author:liting
- * @update:2018/06/20
- *
- */
- import 'css/bootstrap.less';
- import 'bootstrap/dist/js/bootstrap.js';
- import 'css/newMenu/public.css';
- import 'css/newMenu/header.css'
- import 'css/newMenu/serviceDetails.css';
- import 'js/public.js';
- "use strict";
- $(function () {
- init();
- function init(){
- heightF();
- }
- $('.collection p').eq(0).click(function () {
- let heart = $('.heart');
- if (heart.hasClass('active')) {
- collectionApi(0) //取消收藏
- } else {
- collectionApi(1) //收藏
- }
- })
- function collectionApi(index) {
- $.ajax({
- method: "get",
- dataType: "json",
- //url: globalConfig.context + "/portal/search/achievementList",
- url: "https://www.apiopen.top/satinApi",
- data: {
- name:index
- },
- success: function (data) {
- if (data.error && data.error.length) {
- $('#msg').val(data.error);
- msg();
- }else{
- if(!index){
- $('.heart').removeClass('active');
- }else{
- $('.heart').addClass('active');
- }
- $('#msg').val(index?'收藏成功,请至个人中心查看.':'撤销收藏');
- msg();
- }
- }
- })
- }
- //价值
- function heightF(){
- let het = $('.serviceDetailsList .value div').height();
- console.log(het);
- $('.serviceDetailsList .value h4').css({
- height:(het+20)+'px',
- lineHeight:(het+20)+'px'
- })
- }
- //提示框渐隐函数
- function msg() {
- if($('.smg').hasClass('active')){
- return ;
- }
- $('.smg').addClass('active')
- var lit = $('#msg').val();
- setTimeout(function () {
- $('.smg').removeClass('active')
- $('#msg').val('');
- }, 2000)
- }
-
- })
|