1.列表标题与内容均居中对齐,列中配置为:
headerAttributes: { style: "text-align:center" },
attributes: { style: "text-align:center" },
2.对DateTime时间格式,列中配置:
type: "date",
format: "{0: yyyy-MM-dd HH:mm:ss}",
比如:
{ field: "CreateTime", title: "@T("Admin.Common.CreateTime")", width: 150, type: "date", format: "{0: yyyy-MM-dd HH:mm:ss}", headerAttributes: { style: "text-align:center" }, attributes: { style: "text-align:center" }, },
3.列表中"是"、"否"使用icon替代的template配置,针对是否发布:
{ field: "IsRealse", title: "@T("Admin.Common.IsRealse")", width: 150, headerAttributes: { style: "text-align:center" }, attributes: { style: "text-align:center" }, template: '# if(IsRealse) {# <i class="fa fa-check true-icon"></i> #} else {# <i class="fa fa-close false-icon"></i> #} #', },
4.注册、或添加用户时生成密码
(1)产生新用户(指定使用手机号码登录数据库设计是新增StuPhone字段)
var customer = new Customer { CustomerGuid = Guid.NewGuid(), Email = model.Phone + "@139.com", StuPhone = model.Phone,// RegisteredInStoreId = _storeContext.CurrentStore.Id, Active = true,//启用 CreatedOnUtc = DateTime.UtcNow, LastActivityDateUtc = DateTime.UtcNow, }; _customerService.InsertCustomer(customer);
(2)为该用户生成密码
var customerPassword = new CustomerPassword { Customer = customer, PasswordFormat = 0,//是否加密,根据自己的业务来,此处为不加密 Password ="123456",//密码根据自己的业务来 CreatedOnUtc = DateTime.UtcNow }; _customerService.InsertCustomerPassword(customerPassword);
5.修改系统用户的密码
(1)通过某种条件查询出用户,比如使用手机号
var customer = _customerService.GetAllCustomers().FirstOrDefault(c => c.StuPhone == model.Phone);
(2)调用接口,更新密码
扫描二维码关注公众号,回复:
5112823 查看本文章
var currentPassword = _customerService.GetCurrentPassword(customer.Id); currentPassword.Password ="123456";//更新密码(根据自己要求来) currentPassword.PasswordFormat = 0;//不加密(根据自己要求来) _customerService.UpdateCustomerPassword(currentPassword);//更新密码