anxiao_web/pages/newIndex/js/pop/popUpdateSystemName.js

55 lines
1.8 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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}