123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- import '../../css/bootstrap.less';
- import 'bootstrap/dist/js/bootstrap.js';
- import 'css/newMenu/public.css';
- import 'css/newMenu/header.css';
- import '../../js/public.js';
- import '../../css/thinkTank/thinkerDetail.css';
- import {
- message
- } from '../tools.js';
- var addConsultorder = function () {
- let userId = $('#userId').val();
- $.ajax({
- method: "post",
- dataType: "json",
- crossDomain: false,
- url: globalConfig.context + '/api/user/consultorder/add',
- data: {
- toUserId: userId
- },
- success: function (data) {
- if (data.error && data.error.length) {
- message(data.error[0].message);
- } else {
- message('提交会员服务订单成功!');
- setTimeout("window.location.href = globalConfig.context + '/user/account/index.html#consultList'", 3000);
- };
- }.bind(this)
- });
- };
- var consultClick = function () {
- $.ajax({
- method: "get",
- dataType: "json",
- url: globalConfig.context + "/api/user/consultorder/price"
- }).done(function (data) {
- if (data.error && data.error.length) {
- message(data.error[0].message);
- } else {
- $('#modal-content').empty();
- $('#modal-content').append("预约该专家的线下咨询需要支付 " + data.data + " 元的咨询费,是否确认提交预约订单?");
- $('#myModal').modal('show');
- }
- });
- };
- $(function () {
- //收藏
- $('.collection p').eq(0).click(function () {
- 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/expertInterest':'/api/user/portal/expertCancelInterest'
- $.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();
- }
- }
- })
- }
- $('#submitOrder').click(function () {
- addConsultorder()
- });
- $("#consultBtn").click(function(){
- var isLogin=$("#isLogin").attr("islogin");
- if(isLogin=="true"){
- $(".head_login").click();
- }else{
- var theId = $(".right_btn").attr('val');
- $.ajax({
- method: "post",
- dataType: "json",
- url: globalConfig.context + "/api/user/consultorder/add",
- data: {
- toUserId:theId
- },
- success: function (data) {
- if (data.error && data.error.length) {
- msg(data.error[0].message);
- }else if(data.error==""){
- window.open(globalConfig.context+ '/user/account/index.html#consultList');
- }else{
- return;
- }
- }
- });
- }
- });
- $(".achieve_cont>a>div>span").click(function(){
- var biaozhi=$(this).attr("val");
- if(!biaozhi){
- var p_width=$(this).siblings("p").height();
- $(this).addClass("active").attr("val","yes").parent().animate({"height":p_width},500);
- }else if(biaozhi=="yes"){
- $(this).removeClass("active").attr("val","").parent().animate({"height":45},500);
- }
- });
- //提示框渐隐函数
- function msg() {
- if($('.smg').hasClass('active')){
- return ;
- }
- $('.smg').addClass('active')
- setTimeout(function () {
- $('.smg').removeClass('active')
- $('#msg').val('');
- }, 2000)
- }
- })
|