真的不想在这里重复。
我在用
http://fengyuanchen.github.io/cropper/0.7.9/
我参考了这些帖子:
画布和图像新手,很抱歉问这个问题是否微不足道。
我的环境是JS、MVC
我的目标
我正在尝试将裁剪图像的结果以 base64 字符串保存到数据库中。
我已将其发布并保存,但图像与原始图像相同。
我需要将其转换为 Blob 吗?真的不知道那是做什么的。
我是否需要先创建画布,然后获取数据...不知道该怎么做?
我的代码如下
// cropper
function loadCropper() {
//var console = window.console || { log: function () { } };
var $body = $('body');
var $image = $('.img-container > img');
var $actions = $('.docs-actions');
var $dataX = $('#dataX');
var $dataY = $('#dataY');
var $dataHeight = $('#dataHeight');
var $dataWidth = $('#dataWidth');
var $dataRotate = $('#dataRotate');
var $dataScaleX = $('#dataScaleX');
var $dataScaleY = $('#dataScaleY');
var …Run Code Online (Sandbox Code Playgroud) 我正在尝试更新 localstorage 中的属性。我不想循环并重置整个事情。这可能吗?
var aR = [
{ "id": 1, "width": 500 },
{ "id": 2, "width": 400 }
]
localStorage.setItem('test', JSON.stringify(aR));
// need to update property
localStorage['test'][1]['width'] = '720';
Run Code Online (Sandbox Code Playgroud) 我试图将两个LIKE对象组合在一起并删除重复项.
这是我的对象[简单]
public class LabelItem
{
public string LabelName { get; set; }
public string LabelValue { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我的数据调用返回相同的对象类型
public static List<LabelItem> ReturnControlLabelList(Enums.LanguageType languageType, string labelList = "")
Run Code Online (Sandbox Code Playgroud)
我将此传递给方法
string[] LABELLIST = new string[] { "foxLabel", "commonLabel" };
var helper = new LabelHelper(, LABELLIST);
Run Code Online (Sandbox Code Playgroud)
这是我得到null的地方
public LabelHelper(Enums.LanguageType languageType, string[] labelListName)
{
if (labelListName != null)
{
List<LabelItem> labels = new List<LabelItem>();
this.LabelList = new List<LabelItem>();
foreach (var name in labelListName)
{
labels = DBCommon.ReturnControlLabelList(languageType, name); …Run Code Online (Sandbox Code Playgroud) 我试图对MVC控制器进行2次不同的调用.第一个返回一系列数据,第二个返回局部视图.在萤火虫中,我看到结果和状态都是"成功".
我试图传递一个回调来处理一个常见的AJAX方法的结果.首先是dataType'Json',第二个是dataType'HTML'.同样,如果我单独触发它们它们都可以工作但它们似乎在第二次调用时相互覆盖.
这是我的全局参数,它被附加在对象内部:
var ajaxOptions = {
data: '',
params: {},
callback: "ajaxafter",
url: "",
ishtml: false,
tag: 0,
success: false
};
...
// get ajax options
me.getAjaxOptions = function () {
return ajaxOptions;
}
p.AJAX = (function ($, me) {
'use strict';
var child = {};
function returnAJAXDefault(o) {
var dataType = (o.ishtml) ? "html" : "json";
$.ajax({
url: o.url,
data: JSON.stringify(o.params),
type: 'POST',
dataType: dataType,
contentType: 'application/json; charset=utf-8'
}).done(function (data) {
o.data = data;
o.success = true;
console.dir(o) …Run Code Online (Sandbox Code Playgroud) 我使用MVC 4,并将一些逻辑移到了授权过滤器中。我正在尝试基于未授权重定向到错误页面。我想设置最后一个页面路由和其他一些属性来捕获错误。
以下是我的替代
// handle unauthorized
protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
{
filterContext.Controller.ViewBag.LastRoute = filterContext.RouteData;
filterContext.Controller.ViewBag.Issue = "put...val here";
var routeValues = new RouteValueDictionary(new
{
controller = "Error",
action = "Oops"
});
filterContext.Result = new RedirectToRouteResult(routeValues);
}
Run Code Online (Sandbox Code Playgroud)
控制者
[AllowAnonymous]
public ActionResult Oops()
{
var m = new Core.Models.ErrorModel();
var v = ViewBag.Issue; // == null
return View("~/Views/Error/Oops.cshtml", m);
}
Run Code Online (Sandbox Code Playgroud)
我尝试了如何为action过滤器在actionfilterattribute asp mvc 5中为viewbag设置值,并且它有效
任何帮助,将不胜感激。
编辑:
抱歉,当我到达控制器的值时:ViewBag.Issue = null。
我不确定如何设置属性并保留其值。
javascript ×4
jquery ×4
ajax ×1
asp.net-mvc ×1
c# ×1
canvas ×1
image ×1
jquery-ui ×1
json ×1
linq ×1