diff --git a/share_project/src/main/resources/static/browse.html b/share_project/src/main/resources/static/browse.html index 2d6939a01a059153f15cd345678b36b8b8d1252a..062e425769aeb71aa5665b383b1cf2821c78963a 100644 --- a/share_project/src/main/resources/static/browse.html +++ b/share_project/src/main/resources/static/browse.html @@ -23,7 +23,7 @@
- +
浏览项目
@@ -121,7 +121,7 @@ {{item.publisher}} - + @@ -146,19 +146,19 @@
- + - + - + - + + + + + @@ -214,7 +219,6 @@ \ No newline at end of file diff --git a/share_project/src/main/resources/static/chats.html b/share_project/src/main/resources/static/chats.html index 53dad94cc36086e1c69eb421c89e8e2b78bb8284..14de0c9188e13a2719d8ca5be5bd6738d2ba2677 100644 --- a/share_project/src/main/resources/static/chats.html +++ b/share_project/src/main/resources/static/chats.html @@ -91,7 +91,7 @@
{{item.friendName}}
{{item.lastMessage}}
-
{{item.sendTime}}
+
{{item.sendTime | formateDate}}
diff --git a/share_project/src/main/resources/static/css/browse.css b/share_project/src/main/resources/static/css/browse.css index 3bcc4a7eec718ffaa01edda675bdb37dc8a65b67..8bd22f79c4771adeb49bd6595091dd7cb2102d38 100644 --- a/share_project/src/main/resources/static/css/browse.css +++ b/share_project/src/main/resources/static/css/browse.css @@ -596,7 +596,8 @@ input:-ms-input-placeholder { } .content input[type="submit"], -.content input[type="reset"] { +.content input[type="reset"], +.content input[type="button"] { position: absolute; top: 35px; left: 135px; @@ -612,6 +613,7 @@ input:-ms-input-placeholder { text-align: center; text-indent: 0!important; cursor: pointer; + letter-spacing: 1px; } .content input[type="reset"] { @@ -620,6 +622,12 @@ input:-ms-input-placeholder { color: #666666; } +.content input[type="button"] { + left: 296px; + background: skyblue; + color: #fff; +} + .pjname { width: 320px; height: 21px; @@ -640,6 +648,11 @@ input:-ms-input-placeholder { height: 24px; } +.deadline { + width: 136px; + height: 24px; +} + .pjmsg { width: 470px; height: 60px; @@ -660,20 +673,23 @@ input:-ms-input-placeholder { text-align: center; } - .projectInfo { vertical-align: top; box-sizing: border-box; transition: all .5s; - -webkit-transition: all .5s; /* Safari */ + -webkit-transition: all .5s; + /* Safari */ } .projectInfo:hover { cursor: pointer; transform: scale(1.10); - -ms-transform: scale(1.10); /* IE 9 */ - -moz-transform: scale(1.10); /* Firefox */ - -webkit-transform: scale(1.10); /* Safari 和 Chrome */ + -ms-transform: scale(1.10); + /* IE 9 */ + -moz-transform: scale(1.10); + /* Firefox */ + -webkit-transform: scale(1.10); + /* Safari 和 Chrome */ -o-transform: scale(1.10); } diff --git a/share_project/src/main/resources/static/js/page/browse.js b/share_project/src/main/resources/static/js/page/browse.js index 93e7004ebc2ef3b4d805532835a447dde6334ac8..d7a6ee5f28296c0b299eee50a7d6f89447fa9d66 100644 --- a/share_project/src/main/resources/static/js/page/browse.js +++ b/share_project/src/main/resources/static/js/page/browse.js @@ -66,30 +66,55 @@ const box2 = new Vue({ publisher: '', skill: '', subsidy: '', - type: '' + type: '', + username: 'luo', + // 注意这个isLogin要重新拿到 + isLogin: false + }, + created() { + this.checkIsLogin(); }, methods: { - clickSubmit: function() { - axios({ - //TODO 需要修改username - url: "/share/demand/" + this.operation + "?username=" + this.username, - method: "post", - data: { - - address: this.address, - endTime: this.endTime, - method: this.method, - operation: this.operation, - price: this.price, - projectDesc: this.projectDesc, - projectName: this.projectName, - publisher: this.publisher, - skill: this.skill, - startTime: this.startTime, - subsidy: this.subsidy, - type: this.type + checkIsLogin: function() { + axios.get("/share/user/isLogin").then(response => { + //获取json数据 + let resultInfo = response.data; + + //如果已经登录的话,改变已登录状态 + if (resultInfo.status === 1) { + this.isLogin = true; } + }) + }, + // 如果未登录 需要前往登录页面的代码 + needLogin: function() { + if (!this.isLogin) { + layer.msg("请先登录", { time: 5000 }); + } + }, + clickSubmit: function() { + axios({ + //TODO 需要修改username + url: "/share/demand/" + this.operation + "?username=" + this.username, + method: "post", + data: { + + address: this.address, + endTime: this.endTime, + id: this.id, + method: this.method, + operation: this.operation, + price: this.price, + projectDesc: this.projectDesc, + projectName: this.projectName, + publisher: this.publisher, + skill: this.skill, + startTime: this.startTime, + subsidy: this.subsidy, + type: this.type + } + }) .then( function(res) { if (res.data.status = 200 && res.data.status < 300) { @@ -198,7 +223,7 @@ const box1 = new Vue({ }, // layui 分页 - pageData: function (type) { + pageData: function(type) { //layui分页js layui.use('laypage', () => { @@ -217,7 +242,7 @@ const box1 = new Vue({ this.currentPageIndex = obj.curr; //首次不执行和类型是关键字 - if(!first && type === 'search'){ + if (!first && type === 'search') { this.search(); } @@ -241,11 +266,9 @@ const box1 = new Vue({ if (path.type == 'search') { //声明加载框对象 this.load = layer.load({ time: 2000 }) - // 进行搜索 + // 进行搜索 this.search(); } } -}) - - +}) \ No newline at end of file diff --git a/share_project/src/main/resources/static/js/page/chat.js b/share_project/src/main/resources/static/js/page/chat.js index 654dc2040fc77726515ae9fdd43158aec806de29..14a1739833eafebf290fabb974eeef73b30ffe84 100644 --- a/share_project/src/main/resources/static/js/page/chat.js +++ b/share_project/src/main/resources/static/js/page/chat.js @@ -1,3 +1,26 @@ +// 定义过滤器 +Vue.filter('formateDate', function(msg) { + // 格式化好友列表里面的时间 + function formateDate(end_time) { + var end_str = end_time.replace(/-/g, "/"); + var end_date = new Date(end_str); //将字符串转化为时间 + + var now_str = new Date().toLocaleDateString() + ' 23:59:59'; + var now_date = new Date(now_str); + var num = (now_date - end_date) / (1000 * 3600 * 24); + if (num < 1) { + return end_date.getHours() + ':' + end_date.getMinutes(); + } else if (num >= 1 && num < 2) { + return '昨天'; + } else { + return end_date.toLocaleDateString(); + } + } + + // 执行 + formateDate(msg); +}) + const app = new Vue({ el: "#chat", data: { @@ -151,7 +174,7 @@ const app = new Vue({ }; //监听窗口关闭事件,当窗口关闭时,主动去关闭websocket连接,防止连接还没断开就关闭窗口,server端会抛异常。 - window.onbeforeunload = async() => { + window.onunload = async() => { var url = '/share/chat/resetWindows'; await axios.get(url); }; @@ -248,7 +271,7 @@ const app = new Vue({ //获取当前用户的用户名和头像 getCurrentUserInfo: function() { - axios.get("/share/user/isLogin").then(response =>{ + axios.get("/share/user/isLogin").then(response => { //获取json数据 let resultInfo = response.data; this.username = resultInfo.data.username @@ -260,7 +283,7 @@ const app = new Vue({ getChatList: function() { var url = "/share/chat/getChatList"; // 声明加载框对象 - this.load = layer.load({time: 2000}); + this.load = layer.load({ time: 2000 }); axios.get(url) .then(res => { //获取json数据 @@ -275,8 +298,8 @@ const app = new Vue({ // 当点击用户想要打开对话框时 发送下面两个请求 拿历史记录、建立连接 getHistory: function(friendName) { - this.load = layer.load({time: 2000}); - var url = '/share/chat/getChatRecords/' + friendName +'?startIndex=0&pageSize=6'; + this.load = layer.load({ time: 2000 }); + var url = '/share/chat/getChatRecords/' + friendName + '?startIndex=0&pageSize=6'; axios.get(url).then(res => { if (res.data.status == '1') { layer.close(this.load); @@ -300,7 +323,7 @@ const app = new Vue({ // 当前有多少条记录 var currentIndex = this.currentChatHistory.length; var pageSize = 6; - var url = '/share/chat/getChatRecords/' + this.currentFriendName + '?startIndex=' + currentIndex + '&pageSize=' + pageSize; + var url = '/share/chat/getChatRecords/' + this.currentFriendName + '?startIndex=' + currentIndex + '&pageSize=' + pageSize; var history = await axios.get(url); var tempHistory = history.data.data; this.currentChatHistory = tempHistory.concat(this.currentChatHistory); diff --git a/share_project/src/main/resources/static/js/page/isLogin.js b/share_project/src/main/resources/static/js/page/isLogin.js index f3d202706ee6d603d4243326ec3408e42bc0d067..3c5377adcb6ecb0f9d5ae520b0168ab86aa4f250 100644 --- a/share_project/src/main/resources/static/js/page/isLogin.js +++ b/share_project/src/main/resources/static/js/page/isLogin.js @@ -1,7 +1,8 @@ const header = new Vue({ el: "#nav", data: { - isLogin: false, + // 待会记得改回来 + isLogin: true, username: "", userPicture: "", publishUrl: "", diff --git a/share_project/src/main/resources/static/test.html b/share_project/src/main/resources/static/test.html new file mode 100644 index 0000000000000000000000000000000000000000..622033576a517eda3b08d9f14c9115ba6e5cd0fb --- /dev/null +++ b/share_project/src/main/resources/static/test.html @@ -0,0 +1,34 @@ + + + + + + + + Document + + + + + + + + + \ No newline at end of file
*项目名称*项目名称
*价格*价格
*工作地点*工作地点
*项目类型*项目类型
截止时间
项目描述 @@ -193,6 +197,7 @@ +