.
This commit is contained in:
176
root/content/create.html
Normal file
176
root/content/create.html
Normal file
@@ -0,0 +1,176 @@
|
||||
<row class="content-create">
|
||||
<div class="modal-body" style="text-align: left">
|
||||
<form class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label for="queryId" class="col-sm-1 required">内容类型</label>
|
||||
<div class="col-md-2 col-sm-11">
|
||||
<select class="form-control" v-model="row.type">
|
||||
<option value="1">微动态</option>
|
||||
<option value="2">游戏说</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="form-group" v-show="row.type == 2">
|
||||
<label for="queryId" class="col-sm-1 required">游戏说标题</label>
|
||||
<div class="col-md-6 col-sm-5">
|
||||
<input v-model="row.name" class="form-control" id="queryId" placeholder="请输入 游戏说标题">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" v-show="row.type == 2">
|
||||
<label for="queryId" class="col-sm-1 required">关联的游戏ID</label>
|
||||
<div class="col-md-6 col-sm-5">
|
||||
<input v-model="row.gameids" class="form-control" id="gameids" placeholder="请输入 关联的游戏ID">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" v-show="row.type == 2">
|
||||
<label for="editor" class="col-md-1">游戏说内容</label>
|
||||
<div class="col-md-11">
|
||||
<div id="editor">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" v-show="row.type == 1">
|
||||
<label for="editor" class="col-md-1">微动态内容</label>
|
||||
<div class="col-md-11">
|
||||
<textarea v-model="row.content" class="form-control layui-code" rows="10" id="content" placeholder="请输入 微动态内容" > </textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<div class="col-md-11">
|
||||
<div id='myUploader' class="uploader"><!--data-ride="uploader"-->
|
||||
<div class="uploader-message text-center">
|
||||
<div class="content"></div>
|
||||
<button type="button" class="close">×</button>
|
||||
</div>
|
||||
<div class="uploader-files file-list file-list-grid"></div>
|
||||
<div>
|
||||
<hr class="divider">
|
||||
<div class="uploader-status pull-right text-muted"></div>
|
||||
<button type="button" class="btn btn-link uploader-btn-browse" v-show="row.type == 1"><i class="icon icon-plus"></i> 选择微动态图片</button>
|
||||
<button type="button" class="btn btn-link uploader-btn-browse" v-show="row.type == 2"><i class="icon icon-plus"></i> 选择封面</button>
|
||||
<button type="button" class="btn btn-link uploader-btn-start"><i class="icon icon-cloud-upload"></i> 上传图片 </button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button @click="saveTable()" type="button" class="btn btn-primary">确定</button>
|
||||
</div>
|
||||
</row>
|
||||
|
||||
<link href="/res/zui/lib/uploader/zui.uploader.min.css" rel="stylesheet">
|
||||
<script src="/res/zui/lib/uploader/zui.uploader.min.js"></script>
|
||||
|
||||
<script src="/res/wangEditor/wangEditor.min.js"></script>
|
||||
<script>
|
||||
let {saveData} = tmp
|
||||
let vm = new Vue({
|
||||
el: ".content-create",
|
||||
data: {
|
||||
row: {
|
||||
type:2,
|
||||
files: [],
|
||||
cover: ""
|
||||
},
|
||||
vediter : {}
|
||||
|
||||
},
|
||||
watch: {
|
||||
|
||||
},
|
||||
methods: {
|
||||
saveTable() {
|
||||
let html = this.vediter.txt.html()
|
||||
if(vm.row['type'] == 2) {
|
||||
this.row['content'] = html
|
||||
}
|
||||
saveData({bean: this.row}).then(res => {
|
||||
if (res.retcode == 0) {
|
||||
red.showOk("保存成功");
|
||||
setTimeout(function () {
|
||||
location.reload();
|
||||
}, 600)
|
||||
|
||||
} else {
|
||||
red.showError(res.retinfo);
|
||||
}
|
||||
})
|
||||
},
|
||||
buildEditer(key){
|
||||
let E = window.wangEditor
|
||||
let editor = new E('#editor')
|
||||
editor.customConfig.uploadImgServer = '/upload/editor?cate=editor'
|
||||
|
||||
let cache_key = key+"_" + $("input[name='contentid']").val()
|
||||
let html = localStorage.getItem(cache_key)
|
||||
|
||||
editor.customConfig.onblur = function (html) {
|
||||
localStorage.setItem(cache_key, html)
|
||||
}
|
||||
|
||||
editor.create()
|
||||
|
||||
//if (html) editor.txt.html(html)//缓存的内容
|
||||
|
||||
return editor
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
this.vediter = this.buildEditer("11");
|
||||
$('#myUploader').uploader({
|
||||
url: '/upload/x',
|
||||
responseHandler: function (res, f) {
|
||||
let file = JSON.parse(res.response)["body"][0];
|
||||
let filepath = file["filePath"]
|
||||
console.log(file)
|
||||
if (vm.row['type'] == 2) {
|
||||
vm.row['cover'] = filepath
|
||||
} else {
|
||||
vm.row.files.push(filepath)
|
||||
}
|
||||
},
|
||||
lang: 'zh_cn'
|
||||
/*filters: {
|
||||
mime_types: [
|
||||
{title: 'Excel文件', extensions: ''},
|
||||
],
|
||||
prevent_duplicates: true
|
||||
}*/
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
/*function buildEditer(key){
|
||||
let E = window.wangEditor
|
||||
let editor = new E('#editor')
|
||||
editor.customConfig.uploadImgServer = '/upload/img'
|
||||
|
||||
let cache_key = key+"_" + $("input[name='contentid']").val()
|
||||
let html = localStorage.getItem(cache_key)
|
||||
|
||||
editor.customConfig.onblur = function (html) {
|
||||
localStorage.setItem(cache_key, html)
|
||||
}
|
||||
|
||||
editor.create()
|
||||
|
||||
if (html) editor.txt.html(html)//缓存的内容
|
||||
|
||||
return editor
|
||||
}*/
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user