"express-ws": "^3.0.0",

"devDependencies": {
    "socket.io": "^2.0.4"
  }

message.js

router.get('/current', function(req, res, next) {
console.log("current:----------");
var userid=req.session.loginUser.id;
var usrname= req.session.loginUser.usrname;
console.log("userid:"+userid+",usrname:"+usrname);
var sqlstr= "SELECT count(1) FROM message where username ='" +usrname+"' and readed=0";
console.log(sqlstr);
var connection=myCreateCon();
connection.connect();
//原来就是select * from
connection.query(sqlstr, function(err, rows, fields) {
if (err) throw err;
console.log('查询结果为: ', rows);
//res.send(rows);
res.json({ret_code: 0, data: rows});
});
connection.end();
}); router.get('/', function(req, res, next) {
var userid=req.session.loginUser.id;
var usrname= req.session.loginUser.usrname;
console.log("userid:"+userid+",usrname:"+usrname);
var sqlstr= "SELECT c.* FROM message c where c.username ='" +usrname+"'";

FindPerson.vue

<small v-html='room.roominfo'></small>

Messages.vue

 getRows(){
var gvue=this;
this.$ajax({
method: 'get',
url: 'api/message/?time='+new Date().getTime(),
}).then(function (response) {
console.log(response.data.rows);
debugger;
if(response.data.count>0){
var messages = new Array(response.data.rows.length);
//var messages = response.data.ret_msg;
for (var x=0;x<response.data.rows.length;x++)
{
var msg={};
msg.liid=response.data.rows[x].id;
msg.posttime=response.data.rows[x].time;
msg.areaname=response.data.rows[x].text;
messages[x]=msg; }
gvue.tableData=messages;
}else

myMenu.vue

      msgcount:'',
logined_prop:true
};
},
mounted:function () {
this.getLoginStatus();
setInterval(this.getUsrCurMsgCount,50000)
// this.getUsrCurMsgCount();
},
methods: {
getUsrCurMsgCount(){
var gvue=this;
this.$ajax({
method: 'get',
url: 'api/message/current?time='+new Date().getTime(),
/*
data: {
usrname: this.ruleForm2.usrname,
pass: this.ruleForm2.pass
}*/
}).then(function (response) {
//alert("11");
//debugger;
console.log(response);
if(response.data.ret_code==0){
console.log(response.data);
//gvue.$store.state.logined=true;
//gvue.$store.state.identification=response.data.ret_msg.identification; gvue.msgcount=response.data.data[0]['count(1)'];
}
})
.catch(function (error) {
console.log(error);
});
},

Mapsearch.Vue

<template>
<el-row id="Homepan" :gutter="10">
<el-col :xs="0" :sm="1" :md="2" :lg="2">.</el-col>
<el-col :xs="24" :sm="22" :md="20" :lg="20">. <el-row :gutter="10">
<el-col :xs="0" :sm="1" :md="2" :lg="2">.
</el-col>
<el-col :xs="24" :sm="22" :md="20" :lg="20"> <div class="am-list-news-bd">
<ul class="am-list">
<li v-for="room in rooms" class=" am-list-item-desced am-list-item-thumbed am-list-item-thumb-left">
<el-row :gutter="10">
<el-col :xs="17" :sm="17" :md="17" :lg="17" >
<div class=" am-list-main" >
<el-row :gutter="10">
<el-col :xs="15" :sm="15" :md="14" :lg="12">
<h4 class="" style="margin-top: 1.1em;margin-bottom: 0.5em;"><router-link :to="'/findperson/'+room.id">
{{room.areaname}}--{{room.courtname}}<small></small> </router-link>
</h4>
</el-col>
<el-col :xs="9" :sm="9" :md="10" :lg="12">
<h5 style="margin-top: 1.5em;margin-bottom: 0.5em;">
</h5>
</el-col>
</el-row>
<div class="am-list-item-text" style="margin-top: 0.3em;">
<el-row :gutter="10">
<el-col :xs="17" :sm="17" :md="17" :lg="17" class="hidden-sm-and-down">
<small style="padding-top: 30px;" v-html="room.roominfo"></small>
</el-col>
</el-row>
<el-row style="margin-top: 1.2em;margin-bottom: 0.3em;" :gutter="10">
<el-col :xs="12" :sm="12" :md="12" :lg="12" class="hidden-sm-and-down">
<small> <small>{{room.posttime}} wang</small></small>
</el-col>
<el-col :xs="12" :sm="12" :md="12" :lg="12" >
<i style="padding-right: 1em" class="el-icon-news">2</i>
</el-col>
</el-row>
</div>
</div>
</el-col>
<el-col :xs="6" :sm="6" :md="6" :lg="6" class="hidden-sm-and-down">
.<img src='/api/150_dd.JPG' style="margin-top: 5%;margin-bottom:5%;height: 80px; "/>
</el-col>
</el-row>
</li>
</ul>
</div>
</el-col>
</el-row>
<div class="block">
<span class="demonstration"></span>
<!--
<el-pagination
layout="prev, pager, next"
:total="50">
</el-pagination>
-->
<el-pagination style="text-align: center;"
@current-change="handleCurrentChange"
:current-page.sync="currentPage1"
:page-size.sync="pagesize"
layout="total, prev, pager, next"
:total.sync="total">
</el-pagination>
</div>
</el-col>
<el-col :xs="0" :sm="1" :md="2" :lg="2">.</el-col>
</el-row>
</template>
<style type="text/css">
#Homepan {
text-align:left;
/*float: left;*/
}
#Homepan img{
width:auto;
height:auto;
max-width:90%;
max-height:90%;
margin-top: 8%;
margin-bottom: 6%;
} #Homepan .am-panel-default {
border-color: #ddd;
}
#Homepan .am-panel {
margin-bottom: 20px;
background-color: #fff;
border: 1px solid transparent;
border-radius: 0;
-webkit-box-shadow: 0 1px 1px rgba(0,0,0,.05);
box-shadow: 0 1px 1px rgba(0,0,0,.05);
}
#Homepan .am-list-news-default {
margin: 10px;
}
#Homepan .am-list{
padding-left: 0.1em;
padding-right: 0.1em;
}
#Homepan .am-list-news-hd {
padding-top: 1.2rem;
padding-bottom: .4rem;
}
#Homepan .am-list-news-default .am-list .am-list-item-desced .am-list-item-text {
margin-top: .5rem;
color: #757575;
}
#Homepan .am-list li {
position: relative;
display: block;
margin-bottom: -1px;
background-color: #fff;
border: 1px solid #dedede;
border-width: 1px 0;
}
#Homepan .am-list-news-default .am-list .am-list-item-text {
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.1em;
max-height: 2.6em;
}
#Homepan.am-list-item-text {
line-height: 1.3;
font-size: 1.1rem;
color: #999;
margin: 0;
}
#Homepan.am-list-news-default .am-list .am-list-item-thumb-left .am-list-thumb {
padding-left: 0;
}
#Homepan.am-list .am-list-item-desced a, .am-list .am-list-item-thumbed a {
padding-right: 0;
}
#Homepan a {
color: #0e90d2;
}
#Homepan a, ins {
text-decoration: none;
}
#Homepan a {
background-color: transparent;
}
</style>
<script> export default {
data() {
return {
value3: true,
rooms:[ {
areaname:'雨花台',
courtname:'双龙嘉园',
acreage:'',
price:'',
decoration:'',
orientation:'',
identification:'',
rentmethod:'',
roomnum:'',
tingnum:'',
washroomnum:'',
surroundinginfo:'',
roominfo:''
}
],
areaname: '*',
currentPage1: 1,
total:20,
pagesize:10,
my:1
}
},
mounted:function () {
this.handleChangeValue();
},
methods: {
handleCurrentChange(val) {
this.handleChangeValue();
},
handleChangeValue(){
var url ="&areaname="+this.areaname+"&currentpage="+this.currentPage1+"&pagesize="+this.pagesize;
this.getRooms(url);
},
formatTooltip(val) {
return val ;
}, getRooms(url){
Object.assign(this.$data.my, 100);
this.my=99;
var gvue=this;
this.$ajax({
method: 'get',
url: 'api/roommate/all?time='+new Date().getTime(),
changeOrigin:true,
}).then(function (response) {
console.log(response);
var Things = response.data.rows;
gvue.rooms=Things;
gvue.total=response.data.count;
})
.catch(function (error) {
console.log(error);
});
}
}
} </script>

AddPerson.vue

<template>
<el-row id="AddRoom">
<el-col :span="5">.</el-col>
<el-col :span="14">
<el-card class="box-card">
<div slot="header" class="clearfix">
<el-breadcrumb separator-class="el-icon-arrow-right">
<el-breadcrumb-item :to="{ path: '/' }">找室友信息</el-breadcrumb-item>
<el-breadcrumb-item>{{action}}</el-breadcrumb-item>
</el-breadcrumb> </div>
<div class="text item">
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form-item label="位置" required>
<el-col :span="10">
<el-form-item prop="areaname">
<el-select v-model="form.areaname" placeholder="所在区(如朝阳)" >
<el-option label="建邺" value="建邺"></el-option>
<el-option label="玄武" value="玄武"></el-option>
<el-option label="江宁" value="江宁"></el-option>
</el-select>
</el-form-item>
</el-col>
<el-col :span="4"><el-form-item label="位置" required></el-form-item></el-col>
<el-col :span="10">
<el-form-item prop="courtname">
<el-input v-model="form.courtname" placeholder="输入期待租房位置(如万达附近)" ></el-input>
</el-form-item>
</el-col>
</el-form-item> <el-form-item label="标签" required>
<el-col :span="7">
<el-form-item prop="tag1">
<el-input v-model="form.tag1" placeholder="可输年龄信息(如80后、90后)"></el-input>
</el-form-item>
</el-col> <el-col :span="1">.</el-col>
<el-col :span="7">
<el-form-item prop="tag2">
<el-input v-model="form.tag2" placeholder="可输职业信息(如it、金融等)"></el-input>
</el-form-item>
</el-col>
<el-col :span="1">.</el-col>
<el-col :span="8">
<el-form-item prop="tag3">
<el-input v-model="form.tag3" placeholder="其他标签"></el-input>
</el-form-item>
</el-col>
</el-form-item> </el-form-item> <el-form-item label="小区周边" require prop="surroundinginfo">
<el-radio-group v-model="form.identification">
<el-radio label="0">无房共同找</el-radio>
<el-radio label="1">有房求室友</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="首段" require prop="roominfo">
<el-input type="textarea" placeholder="介绍一下自己和期待租房的价位、位置、装修、室友要求等..." v-model="form.roominfo"></el-input> <!-- <button v-on:click="getContent">查看内容</button> --> </el-form-item>
<el-form-item label="正文" require prop="roominfo">
<div id="editorElem" style="text-align:left"></div>
<el-button type="primary" @click="submitForm('form')">{{gonext}}</el-button>
<el-button @click="resetForm('form')">重置</el-button>
</el-form-item>
</el-form> </div>
</el-card>
</el-col>
<el-col :span="5">.</el-col>
</el-row>
</template>
<style>
.text {
font-size: 14px;
} .item {
margin-bottom: 18px;
} .clearfix:before,
.clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both
}
.box-card{
margin-top:30px;
} #AddRoom {
text-align: left;
} </style> <script>
import E from 'wangeditor'
var editor = new E('#editorElem')
export default {
data() {
return {
editorContent: '',
radio: '1',
action:"添加",
gonext:"立即创建",
form: {
areaname:'',
courtname:'',
tag1:'',
tag2:'',
tag3:'',
identification:'0',
surroundinginfo:'',
},
rules: {
courtname: [
{ required: true, message: '请输入位置', trigger: 'blur' },
{ min: 2, max: 15, message: '长度在 2 到 15 个字符', trigger: 'blur' }
],
areaname: [
{ required: true, message: '请选择所在区', trigger: 'change' }
],
tag1: [
{ required: true, message: '请输入标签', trigger: 'change' }
],
tag2: [
{ required: true, message: '请输入标签', trigger: 'change' }
],
tag3: [
{ required: true, message: '请输入标签', trigger: 'change' }
],
identification: [
{ required: true, message: '请选择', trigger: 'change' }
],
roominfo: [
{ required: true, message: '请输入正文', trigger: 'blur' }
]
}
}
},
mounted:function () {
editor.customConfig.onchange = (html) => {
this.editorContent = html
}
editor.create()
if(this.$route.params.id)
this.getRoom();
},
methods: {
getContent: function () {
alert(this.editorContent)
},
cancelForm(){
this.$router.push("/postrooms");
},
resetForm(formName) {
this.$refs[formName].resetFields();
},
getRoom(){
var id=this.$route.params.id;
//alert(id);
//alert(this.dynamicSegment);
this.editorContent='111';
var gvue=this;
this.$ajax({
method: 'get',
url: 'api/room/'+id+'?time='+new Date().getTime(),
changeOrigin:true,
}).then(function (response) {
console.log(response.data);
gvue.form=response.data[0];
gvue.form.identification=response.data[0].identification+'';
gvue.action="编辑 (房间号:"+id+")";
gvue.gonext="立即修改";
gvue.editorContent=response.data[0].roominfo;
editor.txt.html(response.data[0].roominfo);
})
.catch(function (error) {
console.log(error);
});
},
submitForm(form) {//2表示是求组
console.log('submit!');
this.$refs[form].validate((valid) => {
if (valid) {
//alert('submit!');
var url = 'api/roommate/add?time='+new Date().getTime();
if(this.$route.params.id)
url = 'api/room/edit?time='+new Date().getTime();
var gvue=this;
this.form.roominfo=this.editorContent;
this.$ajax({
method: 'post',
url:url ,
changeOrigin:true,
data: this.form//"courtname="+this.form.courtname+"&areaname="+this.form.areaname
}).then(function (response) {
console.log(response);
if(response.data.ret_code===0){
gvue.$message({
showClose: true,
message: response.data.ret_msg+',操作成功1',
type: 'success'
});
//gvue.$router.push("/addroom2/"+response.data.ret_roomid);
gvue.$router.push("/postrooms");
} })
.catch(function (error) {
console.log(error);
}); } else {
console.log('error submit!!');
return false;
}
});
}
}
}
</script>

n2的更多相关文章

  1. C#:String.Format数字格式化输出 {0:N2} {0:D2} {0:C2}等等

    int a = 12345678; //格式为sring输出//   Label1.Text = string.Format("asdfadsf{0}adsfasdf",a); / ...

  2. 二叉树节点个数题目[n0,n1,n2]

    若完全二叉树的节点个数为2N-1,则叶节点个数为()    A)N-1        B)2×N        C)2N-1        D)2N解析:    结点拥有的子树数为结点的度    证明 ...

  3. 非空二叉树的一个有趣的性质:n0 = n2 + 1

    对任何非空二叉树T,若n0 表示叶结点的个数.n2 表示度为2 的非叶结点的个数,那么两者满足关系n0 = n2 + 1. 这个性质很有意思,下面我们来证明它. 证明:首先,假设该二叉树有N 个节点, ...

  4. String.Format数字格式化输出 {0:N2} {0:D2} {0:C2

    //格式为sring输出 //   Label1.Text = string.Format("asdfadsf{0}adsfasdf",a); //   Label2.Text = ...

  5. About gpref O(n2) --> O(1)

    http://www.ibm.com/developerworks/cn/linux/l-gperf.html 命令行处理和 gperf 的作用 命令行处理一直以来都是软件开发中最容易被忽视的领域.几 ...

  6. 把内表 itab1 的 n1 到 n2 行内容附加到 itab2 内表中去.

    语法:append lines of itab1 [ from n1 ] [ to n2 ] to itab2. DATA:BEGIN OF gt_00 OCCURS 0,        l_01   ...

  7. 新手讲树:证明任意二叉树度为零的节点n0,永远比度为2的节点n2多1个

    证明:   设度为1的节点个数为n1,因为二叉树的所有节点的度都小于等于2, 所以n=n0+n1+n2; 又因为二叉树中,除了根节点所有的节点都有一个进入节点的分支,假设B为所有的分支,那么n=B+1 ...

  8. 【转】C# String.Format数字格式化输出各种转换{0:N2} {0:D2} {0:C2}...

    ; //格式为sring输出 // Label1.Text = string.Format("asdfadsf{0}adsfasdf",a); // Label2.Text = & ...

  9. 10个男孩和n个女孩共买了n2+8n+2本书,已知他们每人买的书本的数量是相同的,且女孩人数多于南海人数,问女孩人数是多少?(整除原理1.1.3)

    10个男孩和n个女孩共买了n2+8n+2本书,已知他们每人买的书本的数量是相同的,且女孩人数多于南海人数,问女孩人数是多少? 解: 因为,每个人买的书本的数量是相同的, 所以,10|n2+8n+2 所 ...

  10. Thinking in scala (7)---- f(n)=f(n-1)+2f(n-2)+3f(n-3)

    <计算机程序的构造和解释>中的练习1.11: 函数f,如果n<3,那么f(n) = n;如果n>=3,那么 f(n)=f(n-1)+2f(n-2)+3f(n-3) 有了上面的公 ...

随机推荐

  1. [转]ERROR: http://rancherserver/v1 is not accessible

    本文转自:http://securityer.lofter.com/post/1d0f3ee7_10c465cc 安装rancher agent时出现以下报错 [root@localhost ~]# ...

  2. element-ui el-input只显示下划线

    只需要增加样式 .el-input__inner { width: 220px; border-top-width: 0px; border-left-width: 0px; border-right ...

  3. Git Extensions 和 Tortoisegit 到底是什么?Git For VS(Git For Visual Studio)(Visual Studio 中使用 Git)

    前言: 我们使用 Git 作为版本控制的朋友们,一定都熟悉 Git Extensions 和 Tortoisegit 两款工具,但是对于初学者,可能就不那么了解了. 当然如果有幸,你接触过 SVN , ...

  4. mybatis笔记02

    目录 0. 文章目录 1. Mybatis映射文件 1.1 输入映射 1.2 输出映射 1.3 resultMap 2. 动态SQL 2.1 if和where 2.2 foreach循环 2.3 sq ...

  5. python中的协程

    目录 协程是啥 协程和线程差异 简单实现协程 greenlet 安装方式 gevent 安装 1. gevent的使用 2. gevent切换执行 3. 给程序打补丁 进程.线程.协程对比 请仔细理解 ...

  6. 【Redis】2、CentOS 7 上安装 redis3.2.3安装与配置

    一.redis源码安装 [更正]现在最新稳定的版本已经到了3.2.8 截至到2016.8.11,redis最新稳定版本为3.2.3.本篇文章我们就以此版本为基础,进行相关的讲解. 下载redis源码, ...

  7. C#设计模式之十五迭代器模式(Iterator Pattern)【行为型】

    一.引言 今天我们开始讲“行为型”设计模式的第三个模式,该模式是[迭代器模式],英文名称是:Iterator Pattern.还是老套路,先从名字上来看看.“迭代器模式”我第一次看到这个名称,我的理解 ...

  8. Spring的xml解析原理分析【转载】

    一:前言 二:spring的配置文件 三:依赖的第三方库.使用技术.代码布局 四:Document实现 五:获取Element的实现 六:解析Element元素 七:Bean创造器 八:Ioc容器的创 ...

  9. unable to locate nuget.exe

    今日使用vs 从github fork 一份代码到本地之后,提示项目 unable to locate nuget.exe. 原因:代码托管时未提交 nuget.exe 或其他原因丢失 解决方法:在解 ...

  10. CSS 定位与Z-index

    position: static   Z-index 固定是0 position: absolute/relative/fixed   Z-index 有效 在层叠显示上,所有static定位元素看作 ...