|  |  |  | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //便签 | 
|---|
|  |  |  | //秘钥 | 
|---|
|  |  |  | ,note: function(othis){ | 
|---|
|  |  |  | var mobile = admin.screen() < 2 | 
|---|
|  |  |  | ,note = layui.data(setter.tableName).note; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 获取激活状态 | 
|---|
|  |  |  | var activation = false; | 
|---|
|  |  |  | var exprTime; | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/system/activation/auth", | 
|---|
|  |  |  | dataType:'json', | 
|---|
|  |  |  | method: 'GET', | 
|---|
|  |  |  | async: false, | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | activation = true; | 
|---|
|  |  |  | exprTime = res.data; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | events.note.index = admin.popup({ | 
|---|
|  |  |  | title: '便签' | 
|---|
|  |  |  | title: (activation?"已激活(有效期至"+exprTime+")":"Activation Code(未激活)") | 
|---|
|  |  |  | // title: 'license' | 
|---|
|  |  |  | ,shade: 0 | 
|---|
|  |  |  | ,offset: [ | 
|---|
|  |  |  | '41px' | 
|---|
|  |  |  | 
|---|
|  |  |  | ,skin: 'layadmin-note layui-anim layui-anim-upbit' | 
|---|
|  |  |  | ,content: '<textarea placeholder="内容"></textarea>' | 
|---|
|  |  |  | ,resize: false | 
|---|
|  |  |  | ,btn: [(activation?"更新":"立即激活"), '取消'] | 
|---|
|  |  |  | ,success: function(layero, index){ | 
|---|
|  |  |  | var textarea = layero.find('textarea') | 
|---|
|  |  |  | ,value = note === undefined ? '便签中的内容会存储在本地,这样即便你关掉了浏览器,在下次打开时,依然会读取到上一次的记录。是个非常小巧实用的本地备忘录' : note; | 
|---|
|  |  |  | ,value = note === undefined ? '' : note; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | textarea.val(value).focus().on('keyup', function(){ | 
|---|
|  |  |  | layui.data(setter.tableName, { | 
|---|
|  |  |  | key: 'note' | 
|---|
|  |  |  | ,value: this.value | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | // textarea.val(value).focus().on('keyup', function(){ | 
|---|
|  |  |  | //   layui.data(setter.tableName, { | 
|---|
|  |  |  | //     key: 'note' | 
|---|
|  |  |  | //     ,value: this.value | 
|---|
|  |  |  | //   }); | 
|---|
|  |  |  | // }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ,yes: function(index, layero){ | 
|---|
|  |  |  | $.ajax({ | 
|---|
|  |  |  | url: baseUrl+"/system/secret/auth", | 
|---|
|  |  |  | headers: {'token': localStorage.getItem('token')}, | 
|---|
|  |  |  | data: "secret="+$("#LAY_adminNote").children("textarea").val(), | 
|---|
|  |  |  | dataType:'json', | 
|---|
|  |  |  | method: 'POST', | 
|---|
|  |  |  | success: function (res) { | 
|---|
|  |  |  | if (res.code === 200) { | 
|---|
|  |  |  | alert("激活成功"); | 
|---|
|  |  |  | location.reload(); | 
|---|
|  |  |  | // layer.msg(res.msg); | 
|---|
|  |  |  | // layer.close(index); | 
|---|
|  |  |  | } else if (res.code === 403) { | 
|---|
|  |  |  | top.location.href = baseUrl+"/login"; | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | layer.msg(res.msg) | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | ,btn2: function(index, layero){ | 
|---|
|  |  |  | layer.close(index); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|