55 lines
1.8 KiB
JavaScript
55 lines
1.8 KiB
JavaScript
|
import { layuiObj } from "../index.js";
|
|||
|
import { stationurl } from "../../../../public/js/url.js";
|
|||
|
function updateSystemName(systemName){
|
|||
|
layuiObj["layer"].open({
|
|||
|
type:1,
|
|||
|
title:"系统信息", //不显示标题栏
|
|||
|
area:['500px', '160px'],
|
|||
|
id:new Date().getTime(), //设定一个id,防止重复弹出
|
|||
|
resize:false,
|
|||
|
content:`<div class="popUpdateSystem">
|
|||
|
<input type="text" name="title" value='${systemName}' class="layui-input systemNameTitle" >
|
|||
|
<button type="button" class="layui-btn" lay-submit id="systemNameUpdateBtn">保存</button>
|
|||
|
</div>`
|
|||
|
})
|
|||
|
|
|||
|
//修改系统名称
|
|||
|
$("#systemNameUpdateBtn").click(function(){
|
|||
|
var systemName=$(".systemNameTitle").val();
|
|||
|
updateSystemReq(systemName);
|
|||
|
})
|
|||
|
}
|
|||
|
|
|||
|
function updateSystemReq(systemName){
|
|||
|
var unameInfo=JSON.parse(sessionStorage.getItem("unameInfoStr"));//获取用户登录信息
|
|||
|
var updateSystemUrl=stationurl+"/common/client/user/update";
|
|||
|
var updateInfo={
|
|||
|
"name":unameInfo['user_name'],
|
|||
|
"theme":JSON.stringify({
|
|||
|
"title":systemName
|
|||
|
})
|
|||
|
|
|||
|
}
|
|||
|
axios({
|
|||
|
method:'post',
|
|||
|
url:updateSystemUrl,
|
|||
|
data: updateInfo
|
|||
|
}).then(res=>{
|
|||
|
var code=res["data"]["code"];
|
|||
|
if(code==0){
|
|||
|
layuiObj.layer.confirm('系统名称修改成功,请重新登录', {
|
|||
|
btn: ['确定'],
|
|||
|
cancel:function(index, layero){
|
|||
|
window.location.href = "../../login.html";
|
|||
|
}
|
|||
|
}, function(index, layero) {
|
|||
|
window.location.href = "../../login.html";
|
|||
|
});
|
|||
|
|
|||
|
}else{
|
|||
|
layuiObj.layer.msg("修改失败")
|
|||
|
}
|
|||
|
})
|
|||
|
}
|
|||
|
|
|||
|
export {updateSystemName}
|