Skip to content

Commit 8e1f002

Browse files
committed
重新提交
1 parent f8d2a81 commit 8e1f002

File tree

21 files changed

+23183
-150
lines changed

21 files changed

+23183
-150
lines changed

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
language: node_js
2+
node_js:
3+
- "4.1.2"
4+
5+
script:
6+
- bash ./ci.sh

README.md

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,61 @@
1-
# My Application
1+
# generator-loopback-vue
2+
>当前build,CI状态:
3+
[![Build Status](https://travis-ci.org/qxl1231/generator-loopback-vue.svg?branch=master)](https://travis-ci.org/qxl1231/generator-loopback-vue)
4+
[![CircleCI](https://circleci.com/gh/qxl1231/generator-loopback-vue.svg?style=svg)](https://circleci.com/gh/qxl1231/generator-loopback-vue)
25

3-
The project is generated by [LoopBack](http://loopback.io).
6+
7+
8+
9+
![image](https://cloud.githubusercontent.com/assets/8305742/17387903/810c8b16-5a2a-11e6-862a-9306067bfc34.png)
10+
11+
![image](https://cloud.githubusercontent.com/assets/8305742/17387949/dce5d7d0-5a2a-11e6-9e1d-5fe93b2924b2.png)
12+
13+
The project is generated by [LoopBack](http://loopback.io).+[vue.js](http://vuejs.org).
14+
15+
# 启动:
16+
1. cnpm i
17+
2.npm run watch:js & node .(hot reload)
18+
19+
>遇到问题1:loopback+vue 不能运行
20+
答:1.npm install 2.npm run build:js 3.node .
21+
22+
>问题2:热部署
23+
To use hot reload, please try this command:npm run watch:js & node .
24+
25+
> 启动:$npm run watch:js & node .
26+
27+
28+
>问题3:If you have error, try this:
29+
30+
>npm install
31+
vueify-insert-css vue-hot-reload-api
32+
babel-core babel-preset-es2015
33+
babel-plugin-transform-runtime babel-runtime@5
34+
--save-dev
35+
36+
37+
# Hot reloading detail:
38+
https://github.com/vuejs/vueify
39+
40+
# loopback cmd:
41+
- slc loopback 初始化项目
42+
- slc loopback:datasource
43+
- slc loopback:model
44+
- slc loopback:relation
45+
- slc loopback boot-script
46+
47+
48+
# others:deploy and status
49+
50+
- slc deploy http://usr:pwd@localhost:port
51+
- slpmctl -C http://usr:pwd@localhost:8701 ls
52+
53+
- slpmctl -C http://usr:pwd@domain:8701 status
54+
55+
- pm2 start -n weather app.js
56+
57+
- pm2 start -n app_update_server server.js
58+
59+
# LICENSE
60+
61+
MIT

ci.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
npm i
2+
npm run build:js
3+
4+

circle.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
machine:
2+
node:
3+
version: 5
4+
5+
test:
6+
override:
7+
- bash ./ci.sh

client/bundle.js

Lines changed: 22310 additions & 0 deletions
Large diffs are not rendered by default.

client/index.html

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
7+
<!-- 新 Bootstrap 核心 CSS 文件 -->
8+
<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
9+
10+
<!-- 可选的Bootstrap主题文件(一般不用引入) -->
11+
<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
12+
13+
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
14+
<script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
15+
16+
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
17+
<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
18+
<!--<script src="https://cdn.jsdelivr.net/vue/latest/vue.js"></script>-->
19+
<title>appVersion</title>
20+
</head>
21+
<body>
22+
<login></login>
23+
<app></app>
24+
<version></version>
25+
<script src="bundle.js"></script>
26+
</body>
27+
</html>
28+

client/login.vue

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
<style>
2+
/* Credit to bootsnipp.com for the css for the color graph */
3+
.colorgraph {
4+
height: 5px;
5+
border-top: 0;
6+
background: #c4e17f;
7+
border-radius: 5px;
8+
background-image: -webkit-linear-gradient(left, #c4e17f, #c4e17f 12.5%, #f7fdca 12.5%, #f7fdca 25%, #fecf71 25%, #fecf71 37.5%, #f0776c 37.5%, #f0776c 50%, #db9dbe 50%, #db9dbe 62.5%, #c49cde 62.5%, #c49cde 75%, #669ae1 75%, #669ae1 87.5%, #62c2e4 87.5%, #62c2e4);
9+
background-image: -moz-linear-gradient(left, #c4e17f, #c4e17f 12.5%, #f7fdca 12.5%, #f7fdca 25%, #fecf71 25%, #fecf71 37.5%, #f0776c 37.5%, #f0776c 50%, #db9dbe 50%, #db9dbe 62.5%, #c49cde 62.5%, #c49cde 75%, #669ae1 75%, #669ae1 87.5%, #62c2e4 87.5%, #62c2e4);
10+
background-image: -o-linear-gradient(left, #c4e17f, #c4e17f 12.5%, #f7fdca 12.5%, #f7fdca 25%, #fecf71 25%, #fecf71 37.5%, #f0776c 37.5%, #f0776c 50%, #db9dbe 50%, #db9dbe 62.5%, #c49cde 62.5%, #c49cde 75%, #669ae1 75%, #669ae1 87.5%, #62c2e4 87.5%, #62c2e4);
11+
background-image: linear-gradient(to right, #c4e17f, #c4e17f 12.5%, #f7fdca 12.5%, #f7fdca 25%, #fecf71 25%, #fecf71 37.5%, #f0776c 37.5%, #f0776c 50%, #db9dbe 50%, #db9dbe 62.5%, #c49cde 62.5%, #c49cde 75%, #669ae1 75%, #669ae1 87.5%, #62c2e4 87.5%, #62c2e4);
12+
}
13+
</style>
14+
15+
<template>
16+
<div class="container">
17+
18+
<div class="row" style="margin-top:20px">
19+
<div class="col-xs-12 col-sm-8 col-md-6 col-sm-offset-2 col-md-offset-3">
20+
<!--<form role="form" method="post" action="/" >-->
21+
<fieldset>
22+
<h2>Please Sign In</h2>
23+
<hr class="colorgraph">
24+
<!--<div class="form-group">-->
25+
<!--<input type="username" name="username" id="username" class="form-control input-lg"-->
26+
<!--placeholder="Email Address">-->
27+
<!--</div>-->
28+
<div class="form-group">
29+
<input type="username" name="username" id="username" class="form-control input-lg"
30+
value="qxl1231"
31+
placeholder="username ">
32+
</div>
33+
<div class="form-group">
34+
<input type="password" name="password" id="password" class="form-control input-lg"
35+
placeholder="Password" value="1231">
36+
</div>
37+
<!--<span class="button-checkbox">-->
38+
<!--<button type="button" class="btn" data-color="info">Remember Me</button>-->
39+
<!--<input type="checkbox" name="remember_me" id="remember_me" checked="checked" class="hidden">-->
40+
<!--<a href="" class="btn btn-link pull-right">Forgot Password?</a>-->
41+
<!--</span>-->
42+
<hr class="colorgraph">
43+
<div class="row">
44+
<div class="col-xs-6 col-sm-6 col-md-12">
45+
<input type="button" class="btn btn-lg btn-success btn-block" value="登录" @click="login"
46+
id="hide">
47+
</div>
48+
49+
<!--<div class="col-xs-6 col-sm-6 col-md-6">-->
50+
<!--<a href="" class="btn btn-lg btn-primary btn-block">Register</a>-->
51+
<!--</div>-->
52+
</div>
53+
54+
<div class="alert alert-warning" style="display: none">
55+
<strong>Warning!</strong> 您的用户名或密码不正确!请重新输入.
56+
</div>
57+
58+
</fieldset>
59+
<!--</form>-->
60+
</div>
61+
</div>
62+
63+
</div>
64+
</template>
65+
66+
<script>
67+
$(function () {
68+
$('.button-checkbox').each(function () {
69+
var $widget = $(this),
70+
$button = $widget.find('button'),
71+
$checkbox = $widget.find('input:checkbox'),
72+
color = $button.data('color'),
73+
settings = {
74+
on: {
75+
icon: 'glyphicon glyphicon-check'
76+
},
77+
off: {
78+
icon: 'glyphicon glyphicon-unchecked'
79+
}
80+
};
81+
82+
$button.on('click', function () {
83+
$checkbox.prop('checked', !$checkbox.is(':checked'));
84+
$checkbox.triggerHandler('change');
85+
updateDisplay();
86+
});
87+
88+
$checkbox.on('change', function () {
89+
updateDisplay();
90+
});
91+
92+
function updateDisplay() {
93+
var isChecked = $checkbox.is(':checked');
94+
// Set the button's state
95+
$button.data('state', (isChecked) ? "on" : "off");
96+
97+
// Set the button's icon
98+
$button.find('.state-icon')
99+
.removeClass()
100+
.addClass('state-icon ' + settings[$button.data('state')].icon);
101+
102+
// Update the button's color
103+
if (isChecked) {
104+
$button
105+
.removeClass('btn-default')
106+
.addClass('btn-' + color + ' active');
107+
}
108+
else {
109+
$button
110+
.removeClass('btn-' + color + ' active')
111+
.addClass('btn-default');
112+
}
113+
}
114+
115+
function init() {
116+
updateDisplay();
117+
// Inject the icon if applicable
118+
if ($button.find('.state-icon').length == 0) {
119+
$button.prepend('<i class="state-icon ' + settings[$button.data('state')].icon + '"></i> ');
120+
}
121+
}
122+
123+
init();
124+
});
125+
});
126+
127+
128+
module.exports = {
129+
130+
http: {
131+
root: '/api'
132+
},
133+
data: function () {
134+
return {
135+
user: {
136+
usename: "",
137+
email: "",
138+
pwd: ""
139+
}
140+
}
141+
},
142+
methods: {
143+
login: function () {
144+
var username = $('#username').val();
145+
var password = $('#password').val();
146+
// console.log(username + password)
147+
148+
var settings = {
149+
"async": true,
150+
"crossDomain": true,
151+
"url": "/api/Users/login",
152+
"method": "POST",
153+
"headers": {
154+
"content-type": "application/json",
155+
"accept": "application/json",
156+
"cache-control": "no-cache",
157+
"postman-token": "e5edd675-b902-7711-eba4-2cbab9bc227f"
158+
},
159+
"processData": false,
160+
"data": "{\"username\":\"" + username + "\", \"password\":\"" + password + "\"}"
161+
}
162+
163+
$.ajax(settings).done(function (response) {
164+
self.user = response;
165+
if (response && response.userId) {
166+
$("fieldset").hide();
167+
$(".table").show();
168+
$("#selectid").show();
169+
170+
$("button").show();
171+
172+
}
173+
174+
}).error(function (err) {
175+
$("fieldset").show();
176+
$(".alert").show();
177+
});
178+
}
179+
}
180+
}
181+
182+
</script>

client/main.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
var Vue = require('vue')
2+
var App = require('./table.vue')
3+
var Version = require('./version.vue')
4+
var Login = require('./login.vue')
5+
6+
7+
Vue.use(require('vue-resource'));
8+
9+
new Vue({
10+
el: 'body',
11+
components: {
12+
app: App,
13+
version: Version,
14+
login:Login
15+
}
16+
})

0 commit comments

Comments
 (0)