Merge branch 'YOUFANGAPP1.1' of 192.168.0.27:dev0/youfang-app into xh-youfangApp1.1

This commit is contained in:
xuhe@fangjia.com
2018-03-30 18:22:14 +08:00
4 changed files with 37 additions and 8 deletions
+34 -2
View File
@@ -16,6 +16,7 @@
<style>
.list-block .item-text{-webkit-line-clamp:unset;}
.content-padded img {width: auto;}
</style>
</head>
@@ -123,7 +124,7 @@ $.config = {router: false}
<script type="text/javascript" src="../../js/shara/sharaMine.js" ></script>
<script>
document.addEventListener('plusready', onPlusReady, false);
var id//= "183627425584775168";
var id;//= "186182250936643584";
var shareUrl = BASE_PATH+"/news/newDetail?newsId=";
var sharehrefTitle = "停车坐爱枫林晚,霜叶红于二月花";
var sharehrefDes = "客观里面请!";
@@ -479,10 +480,21 @@ $(".praise").on("click", function () {
//收藏
$(".collection").on("click", function () {
//doCollect();
collect();
});
function doCollect() {
if (localStorage.getItem("user_token") == null || localStorage.getItem("user_token") == "") {
clicked('../user/codeSms.html',true,false,{},{},function(){
doCollect();
})
return;
} else {
collect();
}
}
function collect(){
axios.post("/rest/news/collect",{newsId : id}).then(function (response) {
var msg = response.data.message
@@ -532,6 +544,7 @@ $(".commentReleaseBox a").on("click", function () {
function addComment(){
var content = $(".commentReleaseBox input").val();
content = utf16toEntities(content);
axios.post("/rest/comment/add",{commentObjId : id, content:content, commentUserProvince:province, commentUserCity:city}).then(function (response) {
var msg = response.data.message
if(msg){
@@ -546,6 +559,25 @@ function addComment(){
});
}
function utf16toEntities(str) {
var patt = /[\ud800-\udbff][\udc00-\udfff]/g; // 检测utf16字符正则
str = str.replace(patt, function(char) {
var H, L, code;
if (char.length === 2) {
H = char.charCodeAt(0);
// 取出高位
L = char.charCodeAt(1);
// 取出低位
code = (H - 0xD800) * 0x400 + 0x10000 + L - 0xDC00;
//转换算法
return "&#" + code + ";";
} else {
return char;
}
});
return str;
}
$(function() {
$('#commentInput').on('click', function () {
var target = this;