video.js 842 Bytes
'use strict';
var $ = require('jquery'),
	common = require('../../common/common');


NETSALEEDIT.on('validate', function() {
	var val = $.trim($('#videofile').attr('value'));
	if (val == '') {
		return '请上传视频'
	}

	return true;
});

var videoTemp = '<input id="videofile" name="videofile" type="file" bucket="goodsvideo" value="[[vedioUrl]]" extend="mp4,rmvb,avi,mov">',
	videoHtml = common.util.__template2(videoTemp, NETSALEDATA.productExtBo);

$('.video-file-wrap').html(videoHtml);

$('#saveVideo').on('click', function() {
	NETSALEEDIT.submit('/goods/product/saveNetSaleVideo', function(option) {
		option.success = function(res) {
			res = res.data;
			if (res.code == '200') {
				NETSALEEDIT.$tip(res.message, function() {}, 'growl-success');
			} else {
				NETSALEEDIT.$tip(res.message);
			}
			return false;
		}
	});
});