video.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. // 调用编辑器
  2. var ue = UE.getEditor('editor');
  3. layui.use(['form', 'layedit', 'laydate', 'upload'], function(){
  4. var $ = layui.jquery
  5. var form = layui.form
  6. ,layer = layui.layer
  7. ,layedit = layui.layedit
  8. ,laydate = layui.laydate
  9. ,upload = layui.upload;
  10. //普通图片上传
  11. var uploadInst = upload.render({
  12. elem: '#test1'
  13. ,url: '/upload/'
  14. ,before: function(obj){
  15. //预读本地文件示例,不支持ie8
  16. obj.preview(function(index, file, result){
  17. $('#demo1').attr('src', result); //图片链接(base64)
  18. });
  19. }
  20. ,done: function(res){
  21. //如果上传失败
  22. if(res.code > 0){
  23. return layer.msg('上传失败');
  24. }
  25. //上传成功
  26. }
  27. ,error: function(){
  28. //演示失败状态,并实现重传
  29. var demoText = $('#demoText');
  30. demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
  31. demoText.find('.demo-reload').on('click', function(){
  32. uploadInst.upload();
  33. });
  34. }
  35. });
  36. //日期
  37. laydate.render({
  38. elem: '#date'
  39. });
  40. laydate.render({
  41. elem: '#date1'
  42. });
  43. //监听提交
  44. form.on('submit(demo1)', function(data){
  45. layer.alert(JSON.stringify(data.field), {
  46. title: '最终的提交信息'
  47. })
  48. return false;
  49. });
  50. var html = "";
  51. $.ajax({
  52. url: "video.json",
  53. type: "GET",
  54. dataType: "json",
  55. success: function(data) {
  56. $.each(data.markerArr, function (i, data) { //左边楼盘列表
  57. html+= '<option value="'+data.addressValue+'">';
  58. html+= data.address;
  59. html+= '</option>';
  60. })
  61. $("select[name='address']").append(html);
  62. // console.log(html)
  63. form.render('select');
  64. }
  65. });
  66. });