|
|
<style>
|
|
|
.btn-long {
|
|
|
width: 120px;
|
|
|
height: 37px;
|
|
|
line-height: 37px;
|
|
|
font-size: 15px;
|
|
|
color: white;
|
|
|
border-radius: 5px;
|
|
|
display: inline-block;
|
|
|
cursor: pointer;
|
|
|
text-align: center;
|
|
|
}
|
|
|
.btn-long:hover {
|
|
|
opacity: 0.9;
|
|
|
}
|
|
|
|
|
|
.tag{
|
|
|
display: block;
|
|
|
float: left;
|
|
|
padding: 2px 5px;
|
|
|
background: #1caf9a;
|
|
|
margin-right: 5px;
|
|
|
margin-bottom: 5px;
|
|
|
margin-top: 5px;
|
|
|
-moz-border-radius: 2px;
|
|
|
-webkit-border-radius: 2px;
|
|
|
border-radius: 2px;
|
|
|
font-size: 13px;
|
|
|
}
|
|
|
.goodTag{
|
|
|
display: block;
|
|
|
float: right;
|
|
|
font-size: 18px;
|
|
|
}
|
|
|
|
|
|
</style>
|
|
|
<link rel="stylesheet" href="/pfcms/js/emoji/emojionearea.css">
|
|
|
<script type="text/javascript" src="/pfcms/js/emoji/emojionearea.js"></script>
|
|
|
|
|
|
<div region="center" id="labelGroupList" style="margin-left: 20px;width: 100%">
|
|
|
<div id="tt" class="easyui-layout" style="margin-right:20px;height:100%;overflow-y: scroll">
|
|
|
<form name="publishArticleForm" id="publishArticleForm" method="post">
|
|
|
<input type="hidden" name="sort" id="sort" value="4">
|
|
|
<div style="margin-top: 20px;margin-left: 30px">
|
|
|
<table border="0" style="width:95%;margin-top:5px;line-height:30px;" id="tab">
|
|
|
|
|
|
<tr style="height: 60px">
|
|
|
<td style="width:100% ">
|
|
|
<div style="float: left;width:700px;" >
|
|
|
<span style="color:red">*</span><label style="font-size: 14px;">选择用户</label> <br>
|
|
|
<input id="articleUid" name="authorUid" style="width:600px " class="easyui-textbox" />
|
|
|
<a id="userBotton" class="btn btn-small" style="font-size: 18px; " >确认</a>
|
|
|
<br>
|
|
|
<span style="color:red"> 必填项,选择某个用户身份后,才能发布</span>
|
|
|
</div>
|
|
|
<div id="userInfo" style="float: left;margin-left: 30px;">
|
|
|
</div>
|
|
|
</td>
|
|
|
</tr>
|
|
|
|
|
|
<tr style="height: 60px">
|
|
|
<td style="width:100%; word-wrap:break-word;" >
|
|
|
<span style="color:red">*</span><label style="font-size: 14px;">文字内容(必填项,内容不能为空)</label> <br>
|
|
|
|
|
|
<div style="width:600px; word-wrap:break-word;float: left;position: relative" >
|
|
|
<textarea rows="5" id="content" style="width:60%; white-space: pre-wrap;" name = "content" class="form-control" placeholder="请在这里输入1-500字的笔记" required="" maxlength="500"></textarea>
|
|
|
<div style="position: absolute;bottom:0;right:-50px"> <span id="content-count">0</span>/500</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<!--<div style="clear: both;"> <span id="content-count">0</span>/500</div>-->
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr style="height: 60px">
|
|
|
<td style="width:100%;">
|
|
|
<label style="font-size: 14px;">上传视频</label> <br>
|
|
|
<a href="javascript:void(0);" class="btn btn-default" @click="videoAdd">选择视频</a><span style="margin-left: 20px; height: 30px; width: 30px; border-radius: 30px; line-height: 30px; text-align: center; background: #aaa; display: inline-block">{{videoUploaderInfo.progress * 100}}%</span><br>
|
|
|
<span style="color:red"> 请上传比例为16:9横版或9:16竖版视频素材,大小不超过200M,时长不超过90s</span><br>
|
|
|
<input id="videoUrl" type="text" name="videoUrl" v-model="videoUploaderInfo.videoUrl" style="padding: 0; border: 1px solid #333; width: 350px;height: 30px; line-height: 30px;"><a style="height: 30px; line-height: 30px; border: 1px solid #333; color: #000; text-decoration: none; padding: 0px 15px; display: inline-block; border-left: 0px;" href="javascript:(0);" data-clipboard-action="copy" class="copy" data-clipboard-target="#videoUrl">复制</a>
|
|
|
<form ref="vExample">
|
|
|
<input type="file" style="display:none;" ref="videoFile" @change="videoUpload" />
|
|
|
</form>
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr style="height: 60px">
|
|
|
<td style="width:100%;">
|
|
|
<label style="font-size: 14px;">上传封面</label><br>
|
|
|
<template v-if="videoUploaderInfo.coverUrl">
|
|
|
<img :src="videoUploaderInfo.coverUrl" width="150"><br>
|
|
|
<input id="imgs" name="articleImages" :value="videoUploaderInfo.coverUrl" hidden="hidden"/>
|
|
|
<input name="url" :value="videoUploaderInfo.coverUrl" hidden="hidden"/>
|
|
|
</template>
|
|
|
|
|
|
<input type="file" @change="videoCoverUpload" ref="videoCoverFile">
|
|
|
</td>
|
|
|
</tr>
|
|
|
|
|
|
<tr style="height: 60px">
|
|
|
<td style="width:100%;">
|
|
|
<label style="font-size: 14px;">选择标签</label> <br>
|
|
|
<input id="labelId" name="labelId" class="easyui-combobox" style="width:600px; "/><br>
|
|
|
<span style="color:red">至多添加5个标签,非必填项</span><label></label>
|
|
|
|
|
|
<input id="labelIds" name="labelIds" hidden="hidden"/>
|
|
|
<div id="labelList">
|
|
|
|
|
|
</div>
|
|
|
</td>
|
|
|
</tr>
|
|
|
|
|
|
<tr style="height: 60px">
|
|
|
<td style="width:100%;">
|
|
|
<label style="font-size: 14px;">选择话题</label> <br>
|
|
|
<input id="topicGroupId" name="topicGroupId" class="easyui-combobox" style="width:300px; "/>
|
|
|
<input id="topicId" name="topicId" class="easyui-combobox" style="width:300px; "/><br>
|
|
|
<span style="color:red">至多添加1个话题,非必填项</span><label></label>
|
|
|
|
|
|
<input id="topicIds" name="topicIds" hidden="hidden"/>
|
|
|
<div id="topicList">
|
|
|
|
|
|
</div>
|
|
|
</td>
|
|
|
</tr>
|
|
|
|
|
|
<tr style="height: 60px">
|
|
|
<td>
|
|
|
<label style="font-size: 14px;">关联商品</label> <br>
|
|
|
<span style="color:red">1.支持商品编号(SKN&SKUP)查询商品;   
|
|
|
2.至多添加10个商品,非必填项</span><label></label><br>
|
|
|
<a id="addSkn" class="btn btn-primary" style="font-size: 15px">选择商品+</a>
|
|
|
<!--<input id="skns" name="articleSkns" hidden="hidden"/>-->
|
|
|
<!--<input id="sknType" name="sknType" hidden="hidden"/>-->
|
|
|
<span id ="products"></span>
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
<tr style="height: 60px">
|
|
|
<td id="goodstd">
|
|
|
<div id="good0" style="float: left;margin-left: 30px;width: 150px;">
|
|
|
|
|
|
</div>
|
|
|
</td>
|
|
|
</tr>
|
|
|
<tr>
|
|
|
<td valign="bottom">
|
|
|
<input id="draftBotton" class="btn btn-primary" style="font-size: 16px; height: 36px;" value="保存到草稿箱"/>
|
|
|
<input id="timerBotton" class="btn btn-primary" style="font-size: 16px; height: 36px;" value="定时发布"/>
|
|
|
<input id="subBotton" class="btn btn-primary" style="font-size: 16px; margin-left: 30px; height: 36px;" value="立即发布"/>
|
|
|
<span style="color:red">*运营平台发布的内容,均免审核,直接发布。</span><label></label><br>
|
|
|
</td>
|
|
|
</tr>
|
|
|
</table>
|
|
|
</div>
|
|
|
</form>
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
<script src="/pfcms/js/tencent/vod-js-sdk-v6.js"></script>
|
|
|
<script src="/pfcms/js/axios.min.js"></script>
|
|
|
<script src="/pfcms/js/vue/vue-2.3.4.js"></script>
|
|
|
<script src="/pfcms/js/utils/clipboard.min.js"></script>
|
|
|
|
|
|
|
|
|
<script>
|
|
|
var checkedItems = [];
|
|
|
var checkedItemsObj = {};
|
|
|
var searchType = 1;
|
|
|
var checkType = 1;
|
|
|
var data = paramObject.mkData;
|
|
|
$(function () {
|
|
|
|
|
|
console.log(data);
|
|
|
if(data && data.editFlag == 1){
|
|
|
$("#draftBotton").hide();
|
|
|
$("#timerBotton").hide();
|
|
|
$("#operateType").val(1);
|
|
|
}
|
|
|
|
|
|
if (data){
|
|
|
$("#articleUid").textbox("setValue", data.authorUid);
|
|
|
$("#draftArticleId").val(data.articleId);
|
|
|
|
|
|
// $("#content").val(data.articleContent);
|
|
|
$("#content").emojioneArea()[0].emojioneArea.setText(data.articleContent);
|
|
|
/*字数限制提示*/
|
|
|
if(data.articleContent !=null && data.articleContent !=''){
|
|
|
var count = data.articleContent.length;
|
|
|
$("#content-count").text(count);
|
|
|
}
|
|
|
|
|
|
var labelIds = [];
|
|
|
if(data.labelList!=null && data.labelList.length>0){
|
|
|
for (var i=0;i<data.labelList.length;i++){
|
|
|
labelIds.push(data.labelList[i].id);
|
|
|
}
|
|
|
}
|
|
|
$("#labelId").combobox('setValues',labelIds);
|
|
|
if(data.topicGroupId !=null && data.topicId!=null){
|
|
|
$("#topicGroupId").combobox('setValue',data.topicGroupId);
|
|
|
$("#topicId").combobox('setValue',data.topicId);
|
|
|
}
|
|
|
|
|
|
htmlTopic(data.topicName);
|
|
|
|
|
|
if(data.sknList!=null && data.sknList.length>0){
|
|
|
checkedItems =data.sknList;
|
|
|
}
|
|
|
if(data.yohoList!=null && data.yohoList.length>0){
|
|
|
initGoods(data.yohoList,1);
|
|
|
}
|
|
|
if(data.ufoList!=null && data.ufoList.length>0){
|
|
|
initGoods(data.ufoList,2);
|
|
|
}
|
|
|
initGoodsDiv();
|
|
|
}
|
|
|
|
|
|
// 复制链接
|
|
|
new ClipboardJS('.copy');
|
|
|
|
|
|
$("#content").emojioneArea({
|
|
|
// options
|
|
|
autoHideFilters: true,
|
|
|
autocomplete : false,
|
|
|
search :false,
|
|
|
recentEmojis: false,
|
|
|
tones: false,
|
|
|
filters: {
|
|
|
// see in source file
|
|
|
animals_nature : true,
|
|
|
food_drink :true,
|
|
|
activity: true,
|
|
|
travel_places :true,
|
|
|
objects:true,
|
|
|
symbols: true,
|
|
|
flags:true
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
$("#addImage").linkbutton({
|
|
|
iconCls : "icon-search",
|
|
|
onClick : function() {
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$("#addSkn").linkbutton({
|
|
|
iconCls : "icon-search",
|
|
|
onClick : function() {
|
|
|
getEditDialog();
|
|
|
}
|
|
|
});
|
|
|
$("#userBotton").linkbutton({
|
|
|
iconCls : "icon-search",
|
|
|
onClick : function() {
|
|
|
//发送请求
|
|
|
$.ajax({
|
|
|
type: "POST",
|
|
|
url: serverContextPath + "/grassArticle/getUserInfo", //提交到后端的url
|
|
|
dataType: 'json',
|
|
|
data:{
|
|
|
uid : $("#articleUid").textbox("getValue")
|
|
|
},
|
|
|
success: function (result) {
|
|
|
if(result.code == 200) {
|
|
|
if(result.data !=null && result.data !=''){
|
|
|
var headIco = result.data.headIco.substring(0, result.data.headIco.indexOf("?"));
|
|
|
var html = '';
|
|
|
html += "<span style='font-size: 18px;'>  <img src='"+headIco+"' width='60px;' height='60px;'></span>    ";
|
|
|
html += "<span style='font-size: 15px;'>  <label>"+result.data.nickName+"</label></span>";
|
|
|
$("#userInfo").html(html);
|
|
|
}else{
|
|
|
var html = '<span style="color:red;font-size: 15px;">获取用户信息失败,请检查uid输入是否正确</span>';
|
|
|
$("#userInfo").html(html);
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
var html = '<span style="color:red;font-size: 15px;">获取用户信息失败,请稍后重试</span>';
|
|
|
$("#userInfo").html(html);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$("#timerBotton").linkbutton({
|
|
|
iconCls : "icon-search",
|
|
|
onClick : function() {
|
|
|
getTimeDialog();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$("#articleUid").textbox({
|
|
|
required: true,
|
|
|
missingMessage: "发布用户不能为空",
|
|
|
prompt: "请输入发布用户",
|
|
|
onChange: function () {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$("#content").emojioneArea()[0].emojioneArea.on("keyup change",function (edite,event) {
|
|
|
|
|
|
var $this = $(this);
|
|
|
var count = $this[0].getText().length;
|
|
|
var content = $this[0].getText();
|
|
|
if(count>500){
|
|
|
$this[0].setText(content.substring(0,500));
|
|
|
count = $this[0].getText().length;
|
|
|
}
|
|
|
$("#content-count").text(count);
|
|
|
});
|
|
|
|
|
|
$("#labelId").combobox({
|
|
|
prompt: "请选择标签",
|
|
|
required: false,
|
|
|
selectOnNavigation : true,
|
|
|
valueField: 'id',
|
|
|
textField: 'labelName',
|
|
|
multiple:true,
|
|
|
url : serverContextPath + "/grassLabelManage/getAllGrassLabelInfo",
|
|
|
loadFilter: function (data) {
|
|
|
return defaultLoadFilter(data);
|
|
|
},
|
|
|
onChange:function (data) {
|
|
|
var arr = $(this).combobox("getValues");
|
|
|
var textarr = $(this).combobox("getData");
|
|
|
if(arr.length > 5 ){
|
|
|
$(this).combobox("unselect",arr[arr.length-1]);
|
|
|
// $.messager.alert("提示","标签最多只能选择5个", "info");
|
|
|
arr = $(this).combobox("getValues");
|
|
|
}
|
|
|
var labelList='';
|
|
|
|
|
|
for (var i=0; i<arr.length;i++){
|
|
|
var text = '';
|
|
|
for (var j=0; j< textarr.length;j++){
|
|
|
if(arr[i] == textarr[j].id){
|
|
|
text=textarr[j].labelName;
|
|
|
}
|
|
|
}
|
|
|
labelList+='<span class="tag"><span>'+text+'</span><a href="#" class="labelTag" data-index="'+i+'">x</a></span>   '
|
|
|
}
|
|
|
$("#labelList").html(labelList);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$("#topicGroupId").combobox({
|
|
|
prompt: "选择话题分组",
|
|
|
required: false,
|
|
|
selectOnNavigation : true,
|
|
|
valueField: 'id',
|
|
|
textField: 'groupName',
|
|
|
url : serverContextPath + "/topicGroupManage/getAllTopicGroupInfo",
|
|
|
loadFilter: function (data) {
|
|
|
return defaultLoadFilter(data);
|
|
|
},
|
|
|
onChange:function (data) {
|
|
|
$('#topicId').combobox('reload',serverContextPath + "/grassTopicManage/grassTopicByGroupId?groupId="+data);
|
|
|
|
|
|
// 清空业务线
|
|
|
$("#topicId").combobox("setValue",'');
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$("#topicId").combobox({
|
|
|
prompt: "选择话题",
|
|
|
required: false,
|
|
|
selectOnNavigation : true,
|
|
|
valueField: 'id',
|
|
|
textField: 'topicName',
|
|
|
url : serverContextPath + "/grassTopicManage/grassTopicByGroupId",
|
|
|
loadFilter: function (data) {
|
|
|
return defaultLoadFilter(data);
|
|
|
},
|
|
|
onChange:function (data) {
|
|
|
var arr = $(this).combobox("getValue");
|
|
|
var textarr = $(this).combobox("getData");
|
|
|
var html='';
|
|
|
|
|
|
var text = '';
|
|
|
for (var j=0; j< textarr.length;j++){
|
|
|
if( arr == textarr[j].id){
|
|
|
text=textarr[j].topicName;
|
|
|
}
|
|
|
}
|
|
|
if(text !=''){
|
|
|
html+='<span class="tag"><span>'+text+'</span><a href="#" class="topicTag" ">x</a></span>   '
|
|
|
}
|
|
|
$("#topicList").html(html);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$(document).on("click", ".labelTag", function () {
|
|
|
var index = $(this).attr("data-index");
|
|
|
var arr = $("#labelId").combobox("getValues");
|
|
|
$("#labelId").combobox("unselect",arr[index]);
|
|
|
});
|
|
|
|
|
|
$(document).on("click", ".topicTag", function () {
|
|
|
$("#topicId").combobox("setValue","");
|
|
|
});
|
|
|
|
|
|
$(document).on("click", ".goodTag", function () {
|
|
|
|
|
|
var product_skn = $(this).attr("data-index");
|
|
|
removeSingleItemById(product_skn);
|
|
|
var skns = '';
|
|
|
// for (var i = 0; i < checkedItems.length; i++) {
|
|
|
// if( i == checkedItems.length -1){
|
|
|
// skns = skns+ checkedItems[i]
|
|
|
// }else{
|
|
|
// skns = skns+ checkedItems[i] +","
|
|
|
// }
|
|
|
// }
|
|
|
// $("#skns").val(skns);
|
|
|
var div= $(this).parent("span").parent("div");
|
|
|
div.remove();
|
|
|
});
|
|
|
|
|
|
$("#subBotton").linkbutton({
|
|
|
iconCls: "icon-save",
|
|
|
width:200,
|
|
|
onClick: function () {
|
|
|
$("#publishArticleForm").form("submit",{
|
|
|
url : serverContextPath+"/grassArticle/publishArticle",
|
|
|
onSubmit : function(param) {
|
|
|
;
|
|
|
if (!$("#publishArticleForm").form("validate")) {
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
var content = $("#content").val();
|
|
|
if(content == '' || content.length<=0){
|
|
|
$.messager.alert("发布失败", "请输入文字内容", "error");
|
|
|
return false;
|
|
|
}
|
|
|
if(content.length>500){
|
|
|
$.messager.alert("发布失败", "内容长度超过500,请重新输入", "error");
|
|
|
return false;
|
|
|
}
|
|
|
var imgs = '';
|
|
|
var imageCount = 0;
|
|
|
$("input[name='url']").each(function(j,item){
|
|
|
var url = item.value;
|
|
|
if(imgs == ''){
|
|
|
imgs = url;
|
|
|
}else{
|
|
|
imgs = imgs + ","+url;
|
|
|
}
|
|
|
imageCount++;
|
|
|
});
|
|
|
$("#imgs").val(imgs);
|
|
|
if(imageCount > 9){
|
|
|
$.messager.alert("发布失败", "最多只能选择9张图片", "error");
|
|
|
return false;
|
|
|
}
|
|
|
if(imageCount < 1){
|
|
|
$.messager.alert("发布失败", "请选择至少一张图片", "error");
|
|
|
return false;
|
|
|
}
|
|
|
var labels = '';
|
|
|
$("input[name='labelId']").each(function(j,item){
|
|
|
|
|
|
var id = item.value;
|
|
|
if(labels == ''){
|
|
|
labels = id;
|
|
|
}else{
|
|
|
labels = labels + ","+id;
|
|
|
}
|
|
|
});
|
|
|
$("#labelIds").val(labels);
|
|
|
var html = '';
|
|
|
for (var i = 0; i < checkedItems.length; i++) {
|
|
|
html += "<input name='products["+i+"].productSkn' hidden value='"+checkedItems[i].productSkn+"'/><br>";
|
|
|
html += "<input name='products["+i+"].productType' hidden value='"+checkedItems[i].productType+"'/>";
|
|
|
}
|
|
|
$("#products").html(html);
|
|
|
|
|
|
return true;
|
|
|
},
|
|
|
success : function(data) {
|
|
|
if (data) {
|
|
|
data = $.parseJSON(data);
|
|
|
if (data.code == 200) {
|
|
|
$.messager.alert("提示","发布成功", "info", function(){window.location.reload()});
|
|
|
// alert("保存成功");
|
|
|
|
|
|
|
|
|
} else {
|
|
|
$.messager.alert("保存失败", data.message, "error");
|
|
|
}
|
|
|
} else {
|
|
|
$.messager.alert("保存失败", data.message, "error");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$("#draftBotton").linkbutton({
|
|
|
iconCls: "icon-save",
|
|
|
width:200,
|
|
|
onClick: function () {
|
|
|
$("#publishArticleForm").form("submit",{
|
|
|
url : serverContextPath+"/grassArticle/saveArticleDraft",
|
|
|
onSubmit : function(param) {
|
|
|
;
|
|
|
if (!$("#publishArticleForm").form("validate")) {
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
var content = $("#content").val();
|
|
|
if(content == '' || content.length<=0){
|
|
|
$.messager.alert("保存失败", "请输入文字内容", "error");
|
|
|
return false;
|
|
|
}
|
|
|
if(content.length>500){
|
|
|
$.messager.alert("发布失败", "内容长度超过500,请重新输入", "error");
|
|
|
return false;
|
|
|
}
|
|
|
var imgs = '';
|
|
|
var imageCount = 0;
|
|
|
$("input[name='url']").each(function(j,item){
|
|
|
|
|
|
var url = item.value;
|
|
|
if(imgs == ''){
|
|
|
imgs = url;
|
|
|
}else{
|
|
|
imgs = imgs + ","+url;
|
|
|
}
|
|
|
imageCount++;
|
|
|
});
|
|
|
$("#imgs").val(imgs);
|
|
|
if(imageCount > 9){
|
|
|
$.messager.alert("保存失败", "最多只能选择9张图片", "error");
|
|
|
return false;
|
|
|
}
|
|
|
var labels = '';
|
|
|
$("input[name='labelId']").each(function(j,item){
|
|
|
|
|
|
var id = item.value;
|
|
|
if(labels == ''){
|
|
|
labels = id;
|
|
|
}else{
|
|
|
labels = labels + ","+id;
|
|
|
}
|
|
|
});
|
|
|
$("#labelIds").val(labels);
|
|
|
var html = '';
|
|
|
for (var i = 0; i < checkedItems.length; i++) {
|
|
|
html += "<input name='products["+i+"].productSkn' hidden value='"+checkedItems[i].productSkn+"'/><br>";
|
|
|
html += "<input name='products["+i+"].productType' hidden value='"+checkedItems[i].productType+"'/>";
|
|
|
}
|
|
|
$("#products").html(html);
|
|
|
return true;
|
|
|
},
|
|
|
success : function(data) {
|
|
|
if (data) {
|
|
|
data = $.parseJSON(data);
|
|
|
if (data.code == 200) {
|
|
|
$.messager.alert("提示","保存成功", "info", function(){window.location.reload()});
|
|
|
// alert("保存成功");
|
|
|
|
|
|
|
|
|
} else {
|
|
|
$.messager.alert("保存失败", data.message, "error");
|
|
|
}
|
|
|
} else {
|
|
|
$.messager.alert("保存失败", data.message, "error");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 定时 选择时间
|
|
|
function getTimeDialog(data,id, status){
|
|
|
var timeChoose = $("<div id='timeChoose'>").appendTo($(document.body));
|
|
|
var title = "选择时间";
|
|
|
var textVar = "确认";
|
|
|
|
|
|
window.self.paramObject.mkData = data;
|
|
|
$(timeChoose).myDialog({
|
|
|
title: title,
|
|
|
width: "20%",
|
|
|
height: "30%",
|
|
|
resizable:false,
|
|
|
buttons:[{
|
|
|
id : "saveBtn",
|
|
|
text:textVar,
|
|
|
iconCls : "icon-save",
|
|
|
handler:function(){
|
|
|
;
|
|
|
var time=''
|
|
|
if($("#publishTimeStr").datetimebox('getValue') !=null && $("#publishTimeStr").datetimebox('getValue') !=''){
|
|
|
time = parseInt(new Date($("#publishTimeStr").datetimebox('getValue')).getTime() );
|
|
|
}else {
|
|
|
$.messager.alert("发布失败", "请选择时间", "error");
|
|
|
return;
|
|
|
}
|
|
|
$("#publishArticleForm").form("submit",{
|
|
|
url : serverContextPath+"/grassArticle/timerPublish",
|
|
|
onSubmit : function(param) {
|
|
|
;
|
|
|
if (!$("#publishArticleForm").form("validate")) {
|
|
|
return false;
|
|
|
}
|
|
|
var content = $("#content").val();
|
|
|
if(content == '' || content.length<=0){
|
|
|
$.messager.alert("保存失败", "请输入文字内容", "error");
|
|
|
return false;
|
|
|
}
|
|
|
if(content.length>500){
|
|
|
$.messager.alert("发布失败", "内容长度超过500,请重新输入", "error");
|
|
|
return false;
|
|
|
}
|
|
|
param.publishTime =time;
|
|
|
var imgs = '';
|
|
|
var imageCount = 0;
|
|
|
$("input[name='url']").each(function(j,item){
|
|
|
|
|
|
var url = item.value;
|
|
|
if(imgs == ''){
|
|
|
imgs = url;
|
|
|
}else{
|
|
|
imgs = imgs + ","+url;
|
|
|
}
|
|
|
imageCount++;
|
|
|
});
|
|
|
$("#imgs").val(imgs);
|
|
|
if(imageCount > 9){
|
|
|
$.messager.alert("发布失败", "最多只能选择9张图片", "error");
|
|
|
return false;
|
|
|
}
|
|
|
if(imageCount < 1){
|
|
|
$.messager.alert("发布失败", "请选择至少一张图片", "error");
|
|
|
return false;
|
|
|
}
|
|
|
var labels = '';
|
|
|
$("input[name='labelId']").each(function(j,item){
|
|
|
|
|
|
var id = item.value;
|
|
|
if(labels == ''){
|
|
|
labels = id;
|
|
|
}else{
|
|
|
labels = labels + ","+id;
|
|
|
}
|
|
|
});
|
|
|
$("#labelIds").val(labels);
|
|
|
var html = '';
|
|
|
for (var i = 0; i < checkedItems.length; i++) {
|
|
|
html += "<input name='products["+i+"].productSkn' hidden value='"+checkedItems[i].productSkn+"'/><br>";
|
|
|
html += "<input name='products["+i+"].productType' hidden value='"+checkedItems[i].productType+"'/>";
|
|
|
}
|
|
|
$("#products").html(html);
|
|
|
return true;
|
|
|
},
|
|
|
success : function(data) {
|
|
|
if (data) {
|
|
|
data = $.parseJSON(data);
|
|
|
if (data.code == 200) {
|
|
|
$.messager.alert("提示","发布成功", "info", function(){window.location.reload()});
|
|
|
// alert("保存成功");
|
|
|
} else {
|
|
|
$.messager.alert("保存失败", data.message, "error");
|
|
|
}
|
|
|
} else {
|
|
|
$.messager.alert("保存失败", data.message, "error");
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
$(timeChoose).dialog("close");
|
|
|
}
|
|
|
}, {
|
|
|
text: "关闭",
|
|
|
iconCls: "icon-cancel",
|
|
|
handler: function () {
|
|
|
$.messager.confirm("确认", "确认关闭吗?", function (flag) {
|
|
|
if(flag){
|
|
|
$(timeChoose).dialog("close");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}],
|
|
|
modal: true,
|
|
|
href: contextPath + "/html/grass/article/chooseTime.html"
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 选择商品
|
|
|
function getEditDialog(data){
|
|
|
var labelGroupList = $("<div id='labelGroupList'>").appendTo($(document.body));
|
|
|
var title = "选择商品";
|
|
|
var textVar = "确认";
|
|
|
var msgVar = "确认新增吗?";
|
|
|
|
|
|
window.self.paramObject.mkData = data;
|
|
|
$(labelGroupList).myDialog({
|
|
|
title: title,
|
|
|
width: "70%",
|
|
|
height: "80%",
|
|
|
resizable:false,
|
|
|
buttons:[{
|
|
|
id : "saveBtn",
|
|
|
text:textVar,
|
|
|
iconCls : "icon-save",
|
|
|
handler:function(){
|
|
|
;
|
|
|
|
|
|
$("#goodstd").html("<div id=\"good0\" style=\"float: left;margin-left: 30px;width: 300px\">\n" +
|
|
|
" </div>");
|
|
|
var skns = '';
|
|
|
for (var i = 0; i < checkedItems.length; i++) {
|
|
|
buildgood(i,checkedItems[i]);
|
|
|
}
|
|
|
|
|
|
$(labelGroupList).dialog("close");
|
|
|
}
|
|
|
}, {
|
|
|
text: "关闭",
|
|
|
iconCls: "icon-cancel",
|
|
|
handler: function () {
|
|
|
$.messager.confirm("确认", "确认关闭吗?", function (flag) {
|
|
|
if(flag){
|
|
|
$(labelGroupList).dialog("close");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}],
|
|
|
modal: true,
|
|
|
href: contextPath + "/html/grass/article/chooseSkns.html"
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function buildgood(index,obj) {
|
|
|
|
|
|
var data = checkedItemsObj[obj.productSkn];
|
|
|
$("#good"+index).html(gooddiv(data));
|
|
|
$div = $("#good"+(index+1));
|
|
|
$("#good"+index).after('<div id="good'+(index+1)+'"style="float: left;margin-left: 30px;width: 300px"> </div>');
|
|
|
}
|
|
|
function gooddiv(data) {
|
|
|
|
|
|
return " <span>商品图:<img width=\"120\" height=\"60\" src="+getImageUrl(data.default_images)+
|
|
|
" /> <a href=\"#\" class=\"goodTag\" data-index=\""+data.product_skn+"\">x</a></span>" +
|
|
|
"<h5 style=\"margin-top: 0px;margin-bottom: 0px\">商品名:"+ data.product_name +"</h5>\n" +
|
|
|
"<h5 style=\"margin-top: 0px;margin-bottom: 0px\">价格:"+data.sales_price+"</h5>"
|
|
|
}
|
|
|
|
|
|
function getImageUrl(image) {
|
|
|
var result='';
|
|
|
if (image) {
|
|
|
if(image.indexOf('http://') == 0){
|
|
|
result = image.split("?")[0];
|
|
|
}else{
|
|
|
var fileMode = image.substring(15, 17);
|
|
|
if(fileMode=='01'){
|
|
|
result= "http://"+"img11.static.yhbimg.com"+"/goodsimg"+image;
|
|
|
}
|
|
|
if(fileMode=='02'){
|
|
|
result= "http://"+"img12.static.yhbimg.com"+"/goodsimg"+image;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
result = ""
|
|
|
}
|
|
|
if (result) {
|
|
|
return result + "?imageMogr2/thumbnail/320x320/extent/320x320/background/d2hpdGU=/position/center/quality/90";
|
|
|
} else {
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
function findCheckedItem(ID) {
|
|
|
for (var i = 0; i < checkedItems.length; i++) {
|
|
|
if (checkedItems[i].productSkn == ID) return i;
|
|
|
}
|
|
|
return -1;
|
|
|
}
|
|
|
function addcheckItem() {
|
|
|
// if(searchType != checkType && checkedItems.length>0){
|
|
|
// checkedItems=[];
|
|
|
// }
|
|
|
checkType = searchType;
|
|
|
var i=0;
|
|
|
$("input[type='checkbox'][name='product_skn']:checked").each(function () {
|
|
|
if(i > 9){
|
|
|
alert("最多只能选择10个商品");
|
|
|
return false;
|
|
|
}
|
|
|
var k = findCheckedItem($(this).val());
|
|
|
if (k == -1) {
|
|
|
var product = {};
|
|
|
product.productSkn = $(this).val();
|
|
|
product.productType = checkType;
|
|
|
checkedItems.push(product);
|
|
|
}
|
|
|
i++;
|
|
|
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function removeAllItem(rows) {
|
|
|
$("input[type='checkbox'][name='product_skn']").each(function () {
|
|
|
if (!this.checked) {
|
|
|
var k = findCheckedItem($(this).val());
|
|
|
if (k != -1) {
|
|
|
checkedItems.splice(k, 1);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
function resetSelectedCheckBox(data){
|
|
|
$("input[type='checkbox'][name='product_skn']").each(function () {
|
|
|
var cb=$(this);
|
|
|
$.each(checkedItems,function(index,value){
|
|
|
if(value.productSkn==cb.val()){
|
|
|
cb.attr("checked",true);
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
function removeSingleItem(rowIndex, rowData) {
|
|
|
var k = findCheckedItem(rowData.product_skn);
|
|
|
if (k != -1) {
|
|
|
checkedItems.splice(k, 1);
|
|
|
}
|
|
|
}
|
|
|
function removeSingleItemById(id) {
|
|
|
debugger
|
|
|
var k = findCheckedItem(id);
|
|
|
if (k != -1) {
|
|
|
checkedItems.splice(k, 1);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
function initGoods(skns,type) {
|
|
|
debugger
|
|
|
var url=serverContextPath+"/grassArticle/queryGoods";
|
|
|
// var url = contextPath+"/search/queryGoods";
|
|
|
var query ='';
|
|
|
var params ='';
|
|
|
for (var i=0;i<skns.length;i++){
|
|
|
if(query==''){
|
|
|
query = skns[i];
|
|
|
}else{
|
|
|
query = query+","+skns[i];
|
|
|
}
|
|
|
}
|
|
|
if(type==1){
|
|
|
params = "?query="+query;
|
|
|
}
|
|
|
if(type==2){
|
|
|
params = "?query="+query+"&type=UFO";
|
|
|
}
|
|
|
$.ajax({
|
|
|
type : "post",
|
|
|
url : url+params,
|
|
|
async : false,
|
|
|
success : function(data){
|
|
|
debugger
|
|
|
if(data.code == 200){
|
|
|
for (var i=0; i<data.data.list.length;i++){
|
|
|
var rowdata = data.data.list[i]
|
|
|
checkedItemsObj[rowdata.product_skn] = rowdata;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
}
|
|
|
function initGoodsDiv() {
|
|
|
for (var i = 0; i < checkedItems.length; i++) {
|
|
|
buildgood(i,checkedItems[i].productSkn);
|
|
|
}
|
|
|
}
|
|
|
function htmlTopic(text){
|
|
|
var html='';
|
|
|
if(text !='' && text!=null){
|
|
|
html+='<span class="tag"><span>'+text+'</span><a href="#" class="topicTag" ">x</a></span>   '
|
|
|
}
|
|
|
$("#topicList").html(html);
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<script>
|
|
|
function getSignature() {
|
|
|
return axios.post("/pfcms/grassArticle/getTencentSignature").then(function (res) {
|
|
|
return res.data.data;
|
|
|
}).catch(function (error) {
|
|
|
console.log(error);
|
|
|
});
|
|
|
}
|
|
|
|
|
|
new Vue({
|
|
|
el: '#tt',
|
|
|
// state
|
|
|
data () {
|
|
|
return {
|
|
|
videoUploaderInfo: {
|
|
|
progress: 0,
|
|
|
videoUrl: data.videoUrl || "",
|
|
|
coverUrl: data.coverUrl || "",
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
created: function () {
|
|
|
this.tcVod = new TcVod.default({
|
|
|
getSignature: getSignature
|
|
|
})
|
|
|
},
|
|
|
// actions
|
|
|
methods: {
|
|
|
videoAdd: function () {
|
|
|
this.$refs.videoFile.click()
|
|
|
},
|
|
|
videoUpload: function () {
|
|
|
var self = this;
|
|
|
var mediaFile = this.$refs.videoFile.files[0]
|
|
|
var uploader = this.tcVod.upload({
|
|
|
mediaFile: mediaFile,
|
|
|
})
|
|
|
self.videoUploaderInfo = {
|
|
|
videoInfo: uploader.videoInfo,
|
|
|
isVideoUploadSuccess: false,
|
|
|
isVideoUploadCancel: false,
|
|
|
progress: 0,
|
|
|
fileId: '',
|
|
|
videoUrl: '',
|
|
|
cancel: function() {
|
|
|
self.videoUploaderInfo.isVideoUploadCancel = true;
|
|
|
uploader.cancel()
|
|
|
},
|
|
|
}
|
|
|
uploader.on('media_progress', function (info) {
|
|
|
self.videoUploaderInfo.progress = info.percent;
|
|
|
})
|
|
|
uploader.on('media_upload', function (info) {
|
|
|
self.videoUploaderInfo.isVideoUploadSuccess = true;
|
|
|
})
|
|
|
|
|
|
uploader.done().then(function(doneResult) {
|
|
|
self.videoUploaderInfo.fileId = doneResult.fileId;
|
|
|
self.videoUploaderInfo.videoUrl = doneResult.video.url;
|
|
|
})
|
|
|
},
|
|
|
|
|
|
videoCoverUpload: function () {
|
|
|
console.log("videoCoverUpload");
|
|
|
var self = this;
|
|
|
var coverFile = this.$refs.videoCoverFile.files[0];
|
|
|
var uploader = this.tcVod.upload({
|
|
|
coverFile: coverFile,
|
|
|
fileId: self.videoUploaderInfo.fileId
|
|
|
})
|
|
|
|
|
|
uploader.on('cover_upload', function (info) {
|
|
|
self.videoUploaderInfo.coverUrl = "https://v.yohobuy.com/" + info.Key;
|
|
|
self.$forceUpdate()
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
|
|
|
</script> |
|
|
\ No newline at end of file |
...
|
...
|
|