diff --git a/app.js b/app.js index d4b3bbd..d69a84c 100644 --- a/app.js +++ b/app.js @@ -11,11 +11,28 @@ app.use(express.static('static')); //临时存储数据 var data = { name: '默认方案', components: [] }; +var acc = 'tonkia'; +var pwd = '123'; - -//主页加载 +//主页加载:登录页面 app.get('/', function (req, res) { - res.sendFile(__dirname + "/views/createScheme.html"); + res.sendFile(__dirname + "/views/login.html"); +}); + +//登录 +app.post('/', function (req, res) { + var account = req.body.account; + var password = req.body.password; + //用户验证 + if (account == acc && password == pwd) { + res.send('登录成功'); + } else { + res.send('登录失败'); + } +}); + +app.get('/home', function (req, res) { + res.sendFile(__dirname + "/views/home.html"); }); //接受文件上传,并且返回文件名 diff --git a/static/img/webbg.jpg b/static/img/webbg.jpg new file mode 100644 index 0000000..51d7e70 Binary files /dev/null and b/static/img/webbg.jpg differ diff --git a/static/js/createScheme.js b/static/js/createScheme.js index e706f58..24bd045 100644 --- a/static/js/createScheme.js +++ b/static/js/createScheme.js @@ -81,10 +81,10 @@ function freshModelList() { for (var index in data.components[componentIndex].models) { if (index == data.components[componentIndex].modelIndex) { data.components[componentIndex].models[index].modelObj.visible = true; - $('#modelList').append("" + data.components[componentIndex].models[index].name + ""); + $('#modelList').append("" + data.components[componentIndex].models[index].name + ""); } else { data.components[componentIndex].models[index].modelObj.visible = false; - $('#modelList').append("" + data.components[componentIndex].models[index].name + ""); + $('#modelList').append("" + data.components[componentIndex].models[index].name + ""); } } } @@ -106,6 +106,20 @@ function delModelItem(index) { event.stopPropagation(); } +//点击事件:修改模型名称 +function changeModelName(index) { + $('#modelName').val(data.components[componentIndex].models[index].name); + $('#changeModelNameModal').modal('show'); + $('#changeModelName').unbind('click'); + $('#changeModelName').click(function () { + if ($('#modelName').val().trim().length > 0) { + data.components[componentIndex].models[index].name = $('#modelName').val(); + $('#changeModelNameModal').modal('hide'); + freshModelList(); + } + }); +} + //刷新贴图列表 function freshTextureList() { $('#textureList').empty(); @@ -113,7 +127,6 @@ function freshTextureList() { var fileName = data.components[componentIndex].textures[index].name; var fileId = data.components[componentIndex].textures[index].fileId; $('#textureList').append(" "); - } } @@ -329,9 +342,6 @@ function initEvent() { type: 'post', url: "/upload", data: formData, - cache: false, - processData: false, - contentType: false, success: function (fileData) { //上传成功后加载模型 //加载是异步的 @@ -360,9 +370,6 @@ function initEvent() { type: 'post', url: "/upload", data: formData, - cache: false, - processData: false, - contentType: false, success: function (fileData) { //上传成功后加载模型 //加载是异步的 diff --git a/views/createScheme.html b/views/createScheme.html index 15cbade..7273585 100644 --- a/views/createScheme.html +++ b/views/createScheme.html @@ -146,6 +146,31 @@ + + +
diff --git a/views/home.html b/views/home.html new file mode 100644 index 0000000..0fffbdf --- /dev/null +++ b/views/home.html @@ -0,0 +1,23 @@ + + + +
+ + + +
+ + +
+ +