Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
quantum-blocks
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
quantum-blocks
Commits
b69eb087
Commit
b69eb087
authored
Jan 05, 2021
by
郝聪敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature: 添加登陆功能
parent
54b11246
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
358 additions
and
62 deletions
+358
-62
editor.ts
app/controller/editor.ts
+12
-2
router.ts
app/router.ts
+2
-0
editor.api.ts
app/web/api/editor.api.ts
+4
-1
user.api.ts
app/web/api/user.api.ts
+17
-0
index.ts
app/web/component/layout/editor/index.ts
+7
-0
index.vue
app/web/component/layout/editor/index.vue
+13
-1
index.ts
app/web/component/layout/login/index.ts
+24
-0
index.vue
app/web/component/layout/login/index.vue
+31
-0
dev.config.ts
app/web/config/dev.config.ts
+4
-0
index.ts
app/web/config/index.ts
+1
-1
prod.config.ts
app/web/config/prod.config.ts
+4
-0
api.ts
app/web/lib/Form/api/api.ts
+3
-7
index.vue
app/web/lib/Form/index.vue
+42
-28
config.ts
app/web/lib/config.ts
+4
-1
index.ts
app/web/page/activity/view/activity/index.ts
+0
-1
index.ts
app/web/page/editor/router/index.ts
+14
-2
index.ts
app/web/page/editor/view/dashboard/index.ts
+4
-1
index.ts
app/web/page/editor/view/home/index.ts
+6
-1
index.vue
app/web/page/editor/view/myPage/index.vue
+7
-3
index.vue
app/web/page/editor/view/pageList/index.vue
+8
-5
index.vue
app/web/page/editor/view/template/index.vue
+1
-0
index.vue
app/web/page/login/index.vue
+141
-0
http.service.ts
app/web/service/http.service.ts
+5
-3
server.js
bin/server.js
+1
-1
package.json
package.json
+2
-2
webpack.config.js
webpack.config.js
+1
-2
No files found.
app/controller/editor.ts
View file @
b69eb087
...
...
@@ -3,6 +3,10 @@ import { trim, omitBy } from 'lodash';
export
default
class
EditorController
extends
Controller
{
public
async
login
(
ctx
:
Context
)
{
await
ctx
.
renderClient
(
'
login.js
'
,
{});
}
public
async
home
(
ctx
:
Context
)
{
await
ctx
.
renderClient
(
'
editor.js
'
,
{});
}
...
...
@@ -30,12 +34,13 @@ export default class EditorController extends Controller {
let
where
=
omitBy
({
author
:
author
&&
{
like
:
`%
${
author
}
%`
},
pageName
:
pageName
&&
{
like
:
`%
${
pageName
}
%`
},
isPublish
isPublish
,
enable
:
1
},
v
=>
!
trim
(
v
));
if
(
type
===
'
list
'
)
{
where
=
{
...
where
,
isPublish
:
1
};
}
else
if
(
type
===
'
my
'
)
{
where
=
{
...
where
,
author
:
'
congmin.hao
'
};
where
=
{
...
where
};
}
else
if
(
type
===
'
template
'
)
{
where
=
{
...
where
,
isTemplate
:
1
};
}
...
...
@@ -48,4 +53,9 @@ export default class EditorController extends Controller {
const
list
=
await
ctx
.
model
.
PageInfo
.
findAll
({
where
:
{
isTemplate
:
1
}
});
ctx
.
body
=
ctx
.
helper
.
ok
(
list
);
}
public
async
delete
(
ctx
:
Context
)
{
const
pageInfo
=
await
ctx
.
model
.
PageInfo
.
update
({
enable
:
0
},
{
where
:
{
id
:
+
ctx
.
params
.
pageId
}});
ctx
.
body
=
ctx
.
helper
.
ok
(
pageInfo
);
}
}
\ No newline at end of file
app/router.ts
View file @
b69eb087
...
...
@@ -8,6 +8,8 @@ export default (application: Application) => {
router
.
get
(
'
/editor/get/list
'
,
controller
.
editor
.
getList
);
router
.
get
(
'
/editor/get/template
'
,
controller
.
editor
.
getTemplateList
);
router
.
get
(
'
/editor/get/:pageId
'
,
controller
.
editor
.
get
);
router
.
delete
(
'
/editor/:pageId
'
,
controller
.
editor
.
delete
);
router
.
get
(
'
/editor/login
'
,
controller
.
editor
.
login
);
router
.
get
(
'
/editor
'
,
controller
.
editor
.
home
);
router
.
get
(
'
/editor/*
'
,
controller
.
editor
.
home
);
router
.
get
(
'
/activity/:id
'
,
controller
.
activity
.
home
);
...
...
app/web/api/editor.api.ts
View file @
b69eb087
import
http
from
'
../service/http.service
'
;
import
config
from
'
../config
'
;
const
testReq
=
0
;
export
default
{
getPageList
(
params
)
{
return
http
.
get
(
'
editor/get/list
'
,
{
params
});
...
...
@@ -8,6 +8,9 @@ export default {
getPageById
(
params
)
{
return
http
.
get
(
`editor/get/
${
params
.
pageId
}
`
);
},
delPageById
(
pageId
)
{
return
http
.
delete
(
`editor/
${
pageId
}
`
);
},
updatePage
(
params
)
{
return
http
.
post
(
`editor/update`
,
params
);
},
...
...
app/web/api/user.api.ts
0 → 100644
View file @
b69eb087
import
qs
from
'
qs
'
;
import
http
from
'
../service/http.service
'
;
import
config
from
'
../config
'
;
const
{
opapiHost
}
=
config
;
export
function
getCaptcha
()
{
return
`
${
opapiHost
}
/user/captcha`
;
}
export
function
login
(
params
)
{
return
http
.
post
(
`
${
opapiHost
}
/backStms/prologue/login`
,
qs
.
stringify
(
params
));
}
export
function
getUserInfo
()
{
return
http
.
get
(
`
${
opapiHost
}
/backStms/oauth/currentuserinfo`
);
}
\ No newline at end of file
app/web/component/layout/editor/index.ts
View file @
b69eb087
...
...
@@ -2,6 +2,7 @@ import { Vue, Component, Prop, Watch } from 'vue-property-decorator';
import
iView
from
'
iview
'
;
import
cherryUi
from
'
@qg/cherry-ui
'
;
import
VueContextMenu
from
'
@editor/component/Contextmenu/index
'
;
import
localStorage
from
'
@/service/localStorage.service
'
;
import
'
iview/dist/styles/iview.css
'
;
import
'
@qg/cherry-ui/dist/cherry.css
'
;
...
...
@@ -14,6 +15,7 @@ Vue.use(VueContextMenu);
})
export
default
class
Layout
extends
Vue
{
activeName
:
string
=
'
list
'
;
user
:
string
=
localStorage
.
get
(
'
user
'
);
get
isDashboard
()
{
return
this
.
activeName
===
'
detail
'
;
...
...
@@ -30,6 +32,11 @@ export default class Layout extends Vue {
});
}
logOut
()
{
localStorage
.
clear
();
window
.
location
.
href
=
'
/editor/login
'
;
}
created
()
{
console
.
log
(
'
>>EASY_ENV_IS_NODE create
'
,
EASY_ENV_IS_NODE
);
}
...
...
app/web/component/layout/editor/index.vue
View file @
b69eb087
...
...
@@ -11,12 +11,16 @@
</i-col>
<i-col
:span=
"21"
class=
"layout-menu-right"
>
<div
class=
"layout-header"
>
<div
class=
"avator"
>
<span>
{{
user
.
name
}}
</span>
<span
@
click=
"logOut"
style=
"cursor: pointer;"
>
退出
</span>
</div>
</div>
<div
class=
"layout-content"
>
<slot></slot>
</div>
<div
class=
"layout-copy"
>
2014-202
0
©
QuantGroup
2014-202
1
©
QuantGroup
</div>
</i-col>
</Row>
...
...
@@ -122,6 +126,14 @@
opacity: 0;
}
.avator {
float: right;
width: 120px;
height: 45px;
line-height: 45px;
font-size: 14px;
}
body {
/deep/ .cr-popup {
z-index: 1111;
...
...
app/web/component/layout/login/index.ts
0 → 100644
View file @
b69eb087
import
{
Vue
,
Component
,
Prop
}
from
'
vue-property-decorator
'
;
// import cherryUi from '../../../../../node_modules/@qg/cherry-ui/src/index';
import
cherryUi
from
'
@qg/cherry-ui
'
;
import
iView
from
'
iview
'
;
import
'
@qg/cherry-ui/dist/cherry.css
'
;
import
'
iview/dist/styles/iview.css
'
;
Vue
.
use
(
iView
);
Vue
.
use
(
cherryUi
);
@
Component
({
name
:
'
Layout
'
})
export
default
class
Layout
extends
Vue
{
@
Prop
({
type
:
String
,
default
:
'
egg
'
})
title
?:
string
;
@
Prop
({
type
:
String
,
default
:
'
Vue TypeScript Framework, Server Side Render
'
})
description
?:
string
;
@
Prop
({
type
:
String
,
default
:
'
Vue,TypeScript,Isomorphic
'
})
keywords
?:
string
;
isNode
:
boolean
=
EASY_ENV_IS_NODE
;
created
()
{
console
.
log
(
'
>>EASY_ENV_IS_NODE create
'
,
EASY_ENV_IS_NODE
);
}
}
\ No newline at end of file
app/web/component/layout/login/index.vue
0 → 100644
View file @
b69eb087
<
template
>
<html
v-if=
"isNode"
>
<head>
<title>
{{
title
}}
</title>
<meta
name=
"keywords"
:content=
"keywords"
>
<meta
name=
"description"
:content=
"description"
>
<meta
http-equiv=
"content-type"
content=
"text/html;charset=utf-8"
>
<meta
name=
"viewport"
content=
"initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui"
>
<link
rel=
"shortcut icon"
href=
"/favicon.ico"
type=
"image/x-icon"
/>
<link
rel=
"stylesheet"
href=
"/public/asset/css/reset.css"
>
<link
rel=
"stylesheet"
href=
""
>
</head>
<body>
<div
id=
"app"
><slot></slot></div>
</body>
</html>
<div
v-else-if=
"!isNode"
id=
"app"
><slot></slot></div>
</
template
>
<
style
>
html
{
font-size
:
10vw
;
}
#app
{
position
:
absolute
;
top
:
0
;
bottom
:
0
;
width
:
100%
;
min-width
:
740px
;
}
</
style
>
<
script
lang=
"ts"
src=
"./index.ts"
></
script
>
\ No newline at end of file
app/web/config/dev.config.ts
View file @
b69eb087
const
protocol
=
window
.
location
.
protocol
;
export
default
{
apiHost
:
`http://localhost:7001/`
,
qiniuHost
:
`https://appsync.lkbang.net/`
,
shenceUrl
:
`
${
protocol
}
//bn.xyqb.com/sa?project=default`
,
opapiHost
:
`
${
protocol
}
//opapi.q-gp.com`
,
};
app/web/config/index.ts
View file @
b69eb087
import
prod
from
'
./prod.config
'
;
import
dev
from
'
./dev.config
'
;
export
default
process
.
env
.
EGG_SERVER_ENV
===
'
prod
'
?
prod
:
dev
;
export
default
process
.
env
.
NODE_ENV
===
'
production
'
?
prod
:
dev
;
app/web/config/prod.config.ts
View file @
b69eb087
const
protocol
=
window
.
location
.
protocol
;
export
default
{
apiHost
:
`http://172.20.3.77:80/`
,
qiniuHost
:
`https://appsync.lkbang.net/`
,
shenceUrl
:
`
${
protocol
}
//bn.xyqb.com/sa?project=production`
,
opapiHost
:
`
${
protocol
}
//opapi.q-gp.com`
};
app/web/lib/Form/api/api.ts
View file @
b69eb087
import
Http
from
'
@/service/http.service.ts
'
;
import
Cookies
from
'
@/service/cookieStorage.service.ts
'
;
import
localStorage
from
'
@/service/localStorage.service.ts
'
;
import
{
getParameterByName
}
from
'
@/service/utils.service.ts
'
;
import
qs
from
'
qs
'
;
const
ApiBaseUrl
=
'
http://passportapi.q-gp.com
'
;
...
...
@@ -11,28 +10,25 @@ export default {
getCaptcha
()
{
return
Http
.
post
(
ApiBaseUrl
+
'
/api/captcha
'
);
},
sendVcode
(
phone
,
captcha
,
captchaId
,
flowFrom
)
{
sendVcode
(
phone
,
captcha
,
captchaId
)
{
const
params
=
{
phoneNo
:
phone
,
captchaId
,
captchaValue
:
captcha
,
};
if
(
flowFrom
)
{
params
.
smsMerchant
=
flowFrom
;
}
return
Http
.
post
(
ApiBaseUrl
+
'
/api/sms/send_login_code_new_forH5
'
,
qs
.
stringify
(
params
));
},
sendGtVcode
(
gt
)
{
return
Http
.
post
(
ApiBaseUrl
+
'
/api/sms/send_login_code_new_forH5
'
,
qs
.
stringify
(
gt
));
},
fastLogin
(
phone
,
vcode
,
clickId
,
uniqueKey
)
{
fastLogin
(
phone
,
vcode
,
clickId
,
uniqueKey
,
registerFrom
=
1
)
{
const
headers
=
{
Authorization
:
'
Verification
'
+
btoa
(
phone
+
'
:
'
+
vcode
),
};
const
params
=
{
channelId
:
1
,
createdFrom
:
getParameterByName
(
'
registerFrom
'
)
||
1
,
createdFrom
:
registerFrom
,
key
:
'
xyqb
'
,
btRegisterChannelId
:
''
,
dimension
:
''
,
...
...
app/web/lib/Form/index.vue
View file @
b69eb087
...
...
@@ -55,13 +55,12 @@
</template>
<
script
>
// import sa from 'sa-sdk-javascript
';
import
Vue
from
'
vue
'
;
import
Storage
from
'
@/service/localStorage.service.ts
'
;
import
Cookies
from
'
@/service/cookieStorage.service.ts
'
;
import
{
isPhone
}
from
'
@/service/utils.service.ts
'
;
import
Api
from
'
./api/api.ts
'
;
import
{
getParameterByName
}
from
'
@/service/utils.service.ts
'
;
// import './jy/jy.js';
import
config
from
'
@/config/index
'
;
const
validOptions
=
[
[
...
...
@@ -123,33 +122,52 @@ export default {
}
},
mounted
()
{
console
.
log
(
'
mounted
'
);
require
(
'
./jy/jy.ts
'
);
sa
=
()
=>
import
(
'
sa-sdk-javascript
'
);
this
.
initSa
(
);
this
.
verifyMode
();
},
methods
:
{
initSa
()
{
sa
=
require
(
'
sa-sdk-javascript
'
);
//神策数据埋点
sa
.
init
({
server_url
:
config
.
shenceUrl
,
heatmap
:
{
//是否开启点击图,默认 default 表示开启,自动采集 $WebClick 事件,可以设置 'not_collect' 表示关闭
clickmap
:
'
default
'
,
//是否开启触达注意力图,默认 default 表示开启,自动采集 $WebStay 事件,可以设置 'not_collect' 表示关闭
scroll_notice_map
:
'
default
'
,
//判断外层是否有 App 的 SDK ,如果有的话,会往 App 的 SDK 发数据。如果没有,就正常发送数据。
// use_app_track: true,
},
show_log
:
process
.
env
.
NODE_ENV
!==
'
production
'
});
//添加公共属性
sa
.
registerPage
({
platformType
:
'
H5
'
});
this
.
$nextTick
(()
=>
{
sa
.
quick
(
"
autoTrackSinglePage
"
);
});
},
async
verifyMode
()
{
const
res
=
await
Api
.
verifyMode
(
this
.
gt
.
clientType
,
this
.
formData
.
phoneNo
);
this
.
uniqueKey
=
res
.
uniqueKey
;
this
.
uniqueKey
=
res
?
.
uniqueKey
;
if
(
res
?.
verifyType
===
'
gt
'
)
{
this
.
getJyParam
(
res
);
}
else
{
this
.
getCaptcha
();
}
},
getJyParam
(
res
)
{
getJyParam
(
{
gt
,
challenge
,
success
}
)
{
var
vm
=
this
;
initGeetest
(
{
width
:
"
100%
"
,
gt
:
res
.
gt
,
challenge
:
res
.
challenge
,
offline
:
!
res
.
success
,
gt
:
gt
,
challenge
:
challenge
,
offline
:
!
success
,
product
:
"
bind
"
},
function
(
captchaObj
)
{
console
.
log
(
this
);
vm
.
$refs
.
sendVcode
.
addEventListener
(
'
click
'
,
function
()
{
if
(
!
isPhone
(
vm
.
formData
.
phoneNo
))
{
vm
.
$notify
({
type
:
"
warning
"
,
message
:
"
请填写正确的手机号码
"
});
...
...
@@ -158,7 +176,6 @@ export default {
if
(
vm
.
showCount
)
return
;
captchaObj
.
verify
();
});
// captchaObj.appendTo("#captcha-box");
captchaObj
.
onSuccess
(
function
()
{
var
result
=
captchaObj
.
getValidate
();
vm
.
gt
.
geetest_challenge
=
result
.
geetest_challenge
;
...
...
@@ -167,7 +184,7 @@ export default {
vm
.
getCode
(
captchaObj
);
});
captchaObj
.
onError
(
function
()
{
this
.
$toast
(
"
尝试过多,请点击重试
"
);
vm
.
$toast
(
"
尝试过多,请点击重试
"
);
});
}
);
...
...
@@ -187,8 +204,6 @@ export default {
await
this
.
sendCode
();
this
.
smsCount
();
this
.
$notify
({
type
:
"
success
"
,
message
:
"
短信验证码已发送,请注意查收
"
});
}
catch
(
e
)
{
console
.
log
(
e
);
}
finally
{
this
.
resetJyState
(
captchaObj
);
}
...
...
@@ -218,29 +233,21 @@ export default {
if
(
captchaObj
)
captchaObj
.
reset
();
},
async
login
()
{
const
regcode
=
getParameterByName
(
'
registerFrom
'
)
||
''
;
let
le_is_login_success
=
false
;
try
{
const
{
phoneNo
,
verifyCode
}
=
this
.
formData
;
const
{
token
,
uuid
}
=
await
Api
.
fastLogin
(
phoneNo
,
verifyCode
,
null
,
this
.
uniqueKey
);
Storage
.
set
(
'
token
'
,
token
);
Cookies
.
set
(
'
phoneNo
'
,
phoneNo
);
if
(
uuid
)
{
Cookies
.
set
(
'
userid
'
,
uuid
);
sa
.
login
(
user
.
uuid
);
}
const
user
=
await
Api
.
fastLogin
(
phoneNo
,
verifyCode
,
null
,
this
.
uniqueKey
,
this
.
registerFrom
);
this
.
saveInfo
(
user
);
le_is_login_success
=
true
;
}
catch
(
e
)
{
console
.
log
(
e
);
this
.
goNext
();
}
finally
{
sa
.
track
(
'
LoginEvent
'
,
{
le_login_action
:
'
注册/登录
'
,
le_login_type
:
'
验证码登录
'
,
le_is_login_success
,
le_channel_code
:
regcode
,
le_channel_code
:
this
.
registerFrom
,
});
}
this
.
goNext
();
},
async
goNext
()
{
const
extData
=
{
redirectURL
:
null
,
productId
:
1
};
...
...
@@ -257,6 +264,14 @@ export default {
onFormFailed
(
errorInfo
)
{
const
{
errors
}
=
errorInfo
;
this
.
$notify
({
type
:
"
warning
"
,
message
:
errors
[
0
].
message
});
},
saveInfo
({
token
,
phoneNo
,
uuid
})
{
Storage
.
set
(
'
token
'
,
token
);
Cookies
.
set
(
'
phoneNo
'
,
phoneNo
);
if
(
uuid
)
{
Cookies
.
set
(
'
userid
'
,
uuid
);
sa
.
login
(
uuid
);
}
}
},
};
...
...
@@ -264,7 +279,6 @@ export default {
<
style
lang=
"less"
>
@import './jy/jy.less';
// @import "../style/var.less";
.login-form {
padding: 0 20px;
width: 100%;
...
...
app/web/lib/config.ts
View file @
b69eb087
...
...
@@ -18,6 +18,7 @@ export const basicComponents = [
{
eleName
:
'
cr-button
'
,
title
:
'
按钮
'
,
h
:
42
,
config
:
[
{
key
:
'
color
'
,
...
...
@@ -39,6 +40,7 @@ export const basicComponents = [
{
eleName
:
'
cr-field
'
,
title
:
'
输入框
'
,
h
:
48
,
config
:
[
{
key
:
'
placeholder
'
,
...
...
@@ -60,6 +62,7 @@ export const basicComponents = [
{
eleName
:
'
cr-image
'
,
title
:
'
图片
'
,
h
:
140
,
config
:
[
{
key
:
'
width
'
,
...
...
@@ -144,4 +147,4 @@ export const businessComponents = [
},
commonStyle
:
{}
}
];
\ No newline at end of file
];
app/web/page/activity/view/activity/index.ts
View file @
b69eb087
...
...
@@ -6,7 +6,6 @@ import GridLayout from '../../component/VueGridLayout/GridLayout.vue';
import
GridItem
from
'
../../component/VueGridLayout/GridItem.vue
'
;
import
LoginForm
from
'
@/lib/Form/index.vue
'
;
import
DownloadGuide
from
'
@/lib/DownloadGuide/index.vue
'
;
import
{
Getter
,
State
}
from
'
vuex-class
'
;
@
Component
({
components
:
{
FreedomContainer
,
GridLayout
,
GridItem
,
LoginForm
,
DownloadGuide
},
name
:
'
Activity
'
})
...
...
app/web/page/editor/router/index.ts
View file @
b69eb087
import
Vue
from
'
vue
'
;
import
VueRouter
from
'
vue-router
'
;
import
Dashboard
from
'
../view/dashboard/index.vue
'
;
import
PageList
from
'
../view/pageList/index.vue
'
;
import
myPage
from
'
../view/myPage/index.vue
'
;
import
template
from
'
../view/template/index.vue
'
;
import
localStorage
from
'
@/service/localStorage.service
'
;
Vue
.
use
(
VueRouter
);
...
...
@@ -17,7 +17,7 @@ VueRouter.prototype.replace = function push(location) {
};
export
default
function
createRouter
()
{
return
new
VueRouter
({
const
router
=
new
VueRouter
({
mode
:
'
history
'
,
base
:
'
/editor/
'
,
routes
:
[
...
...
@@ -47,4 +47,16 @@ export default function createRouter() {
},
]
});
router
.
beforeEach
(
async
(
to
,
from
,
next
)
=>
{
if
(
to
.
path
!==
'
/login
'
)
{
if
(
!
localStorage
.
get
(
'
token
'
))
{
return
next
(
'
/login
'
);
}
}
next
();
});
return
router
;
}
app/web/page/editor/view/dashboard/index.ts
View file @
b69eb087
...
...
@@ -12,6 +12,7 @@ import { ContextMenu } from '@editor/mixins/contextMenu.mixin';
import
BasicPageForm
from
'
@editor/component/BasicPageForm/index.vue
'
;
import
{
basicComponents
,
businessComponents
}
from
'
@/lib/config
'
;
import
config
from
'
@/config/index
'
;
import
localStorage
from
'
@/service/localStorage.service
'
;
@
Component
({
components
:
{
DynamicComponent
,
FreedomContainer
,
DynamicForm
,
GridLayout
:
VueGridLayout
.
GridLayout
,
GridItem
:
VueGridLayout
.
GridItem
,
LoginForm
,
DownloadGuide
,
BasicPageForm
},
name
:
'
DashBoard
'
})
...
...
@@ -44,6 +45,7 @@ export default class DashBoard extends Mixins(ContextMenu) {
async
created
()
{
const
{
pageId
,
templateId
}
=
this
.
$route
.
params
;
console
.
log
(
pageId
,
templateId
);
console
.
log
(
'
env
'
,
process
.
env
);
this
.
resetPageData
();
if
(
pageId
)
{
this
.
getPageDate
({
pageId
});
...
...
@@ -75,12 +77,13 @@ export default class DashBoard extends Mixins(ContextMenu) {
}
async
save
(
type
,
pageConfig
)
{
const
user
=
localStorage
.
get
(
'
user
'
);
if
(
!
type
)
{
this
.
showSubmitPopup
=
true
;
}
else
{
this
.
pageData
.
elements
.
sort
((
a
,
b
)
=>
a
.
point
.
y
-
b
.
point
.
y
);
const
{
pageName
,
pageDescribe
,
coverImage
,
isPublish
,
isTemplate
}
=
pageConfig
;
const
pageInfo
=
{
page
:
JSON
.
stringify
(
this
.
pageData
),
author
:
'
congmin.hao
'
,
isPublish
,
pageName
,
pageDescribe
,
coverImage
,
isTemplate
};
const
pageInfo
=
{
page
:
JSON
.
stringify
(
this
.
pageData
),
author
:
user
?.
account
,
isPublish
,
pageName
,
pageDescribe
,
coverImage
,
isTemplate
};
if
(
+
this
.
pageId
)
{
pageInfo
.
id
=
this
.
pageId
;
}
await
this
.
savePageData
(
pageInfo
);
this
.
showSubmitPopup
=
false
;
...
...
app/web/page/editor/view/home/index.ts
View file @
b69eb087
import
{
Vue
,
Component
,
Emit
}
from
'
vue-property-decorator
'
;
import
Layout
from
'
component/layout/editor/index.vue
'
;
@
Component
({
components
:
{
Layout
}
})
export
default
class
Home
extends
Vue
{
export
default
class
Home
extends
Vue
{}
\ No newline at end of file
created
()
{
console
.
log
(
'
created进来了
'
);
}
}
\ No newline at end of file
app/web/page/editor/view/myPage/index.vue
View file @
b69eb087
<
template
>
<div>
<QGTable
ref=
"qgTable"
:columns=
"columns"
:request=
"query"
@
newBtnClick=
"addPage"
...
...
@@ -12,6 +13,7 @@
import
editorApi
from
'
@api/editor.api
'
;
import
QGTable
from
'
@editor/component/QgTable/index.vue
'
;
import
config
from
'
@/config/index
'
;
import
localStorage
from
'
@/service/localStorage.service
'
;
export
default
{
components
:
{
QGTable
,
...
...
@@ -106,8 +108,9 @@ export default {
...
style
,
},
on
:
{
'
on-ok
'
:
()
=>
{
console
.
log
(
'
删除
'
)
'
on-ok
'
:
async
()
=>
{
await
editorApi
.
delPageById
(
params
.
row
.
id
);
this
.
$refs
.
qgTable
.
query
();
},
},
},
...
...
@@ -139,7 +142,8 @@ export default {
methods
:
{
async
query
(
data
)
{
console
.
log
(
data
);
return
editorApi
.
getPageList
({
type
:
'
my
'
,
isPublish
:
0
,
isTemplate
:
0
,
...
data
});
const
user
=
localStorage
.
get
(
'
user
'
);
return
editorApi
.
getPageList
({
type
:
'
my
'
,
isPublish
:
0
,
isTemplate
:
0
,
author
:
user
?.
account
,
...
data
});
},
addPage
()
{
this
.
$router
.
push
(
'
/detail
'
);
...
...
app/web/page/editor/view/pageList/index.vue
View file @
b69eb087
<
template
>
<div>
<QGTable
:columns=
"columns"
:request=
"query"
@
newBtnClick=
"addPage"
ref=
"qgTable"
:columns=
"columns"
:request=
"query"
@
newBtnClick=
"addPage"
>
</QGTable>
</div>
...
...
@@ -73,6 +74,7 @@ export default {
{
key
:
'
id
'
,
title
:
'
链接
'
,
hideSearch
:
true
,
render
:
(
h
,
params
)
=>
{
return
h
(
'
span
'
,
`
${
config
.
apiHost
}
activity/
${
params
.
row
.
id
}
`
)
}
...
...
@@ -129,8 +131,9 @@ export default {
...
style
,
},
on
:
{
'
on-ok
'
:
()
=>
{
console
.
log
(
'
删除
'
)
'
on-ok
'
:
async
()
=>
{
await
editorApi
.
delPageById
(
params
.
row
.
id
);
this
.
$refs
.
qgTable
.
query
();
},
},
},
...
...
app/web/page/editor/view/template/index.vue
View file @
b69eb087
...
...
@@ -73,6 +73,7 @@ export default {
{
key
:
'
id
'
,
title
:
'
链接
'
,
hideSearch
:
true
,
render
:
(
h
,
params
)
=>
{
return
h
(
'
span
'
,
`
${
config
.
apiHost
}
activity/
${
params
.
row
.
id
}
`
)
}
...
...
app/web/page/login/index.vue
0 → 100644
View file @
b69eb087
<
template
>
<layout>
<div
class=
"wrapper"
>
<h1>
低代码平台
</h1>
<div
class=
"login"
>
<i-form
ref=
"formMail"
:model=
"formMail"
:rules=
"ruleFormMail"
>
<FormItem
prop=
"usernameMail"
>
<i-input
v-model=
"formMail.usernameMail"
placeholder=
"Username"
>
<Icon
type=
"ios-person-outline"
slot=
"prepend"
></Icon>
<span
slot=
"append"
>
@quantgroup.cn
</span>
</i-input>
</FormItem>
<FormItem
prop=
"passwordMail"
>
<i-input
type=
"password"
v-model=
"formMail.passwordMail"
placeholder=
"Password"
>
<Icon
type=
"ios-locked-outline"
slot=
"prepend"
></Icon>
</i-input>
</FormItem>
<FormItem>
<i-button
@
click=
"login(formMail)"
type=
"primary"
long
>
登录
</i-button>
</FormItem>
</i-form>
<div
style=
"color: #98a6ad; text-align: center; margin-bottom: 50px;"
>
量化派 ©
{{
this
.
year
}}
</div>
</div>
</div>
</layout>
</
template
>
<
script
>
import
{
Form
,
Input
,
FormItem
,
Icon
,
Button
}
from
'
iview
'
;
import
localStorage
from
'
@/service/localStorage.service
'
;
import
{
login
,
getUserInfo
,
getCaptcha
}
from
'
@api/user.api
'
;
import
layout
from
'
@component/layout/login/index.vue
'
;
const
defaultCaptcha
=
getCaptcha
();
export
default
{
data
()
{
return
{
showTips
:
true
,
tips
:
'
为提升各位同学使用体验,内部在用系统后续将统一迁移至量星球,请提前做好准备~
'
,
formMail
:
{
usernameMail
:
undefined
,
passwordMail
:
undefined
,
captcha
:
undefined
,
},
ruleFormMail
:
{
usernameMail
:
[{
required
:
true
,
message
:
'
请输入用户名
'
,
trigger
:
'
blur
'
}],
passwordMail
:
[{
required
:
true
,
message
:
'
请输入密码
'
,
trigger
:
'
blur
'
}],
captcha
:
[{
required
:
true
,
message
:
'
请输入验证码
'
,
trigger
:
'
blur
'
}],
},
year
:
new
Date
().
getFullYear
(),
captcha
:
defaultCaptcha
,
};
},
components
:
{
'
i-form
'
:
Form
,
'
i-input
'
:
Input
,
FormItem
,
Icon
,
'
i-button
'
:
Button
,
layout
},
created
()
{
this
.
getCaptcha
();
},
methods
:
{
login
(
param1
)
{
this
.
$refs
[
'
formMail
'
].
validate
(
async
valid
=>
{
if
(
valid
)
{
let
newParam1
=
{
username
:
param1
.
usernameMail
.
trim
(),
password
:
param1
.
passwordMail
.
trim
(),
captcha
:
param1
.
captcha
,
};
const
longinInfo
=
await
login
(
newParam1
);
localStorage
.
set
(
'
token
'
,
longinInfo
.
accessToken
);
localStorage
.
set
(
'
refreshToken
'
,
longinInfo
.
refreshToken
);
const
userInfo
=
await
getUserInfo
();
localStorage
.
set
(
'
user
'
,
userInfo
);
window
.
location
.
href
=
'
/editor/list
'
;
}
});
},
async
getCaptcha
()
{
this
.
captcha
=
`
${
defaultCaptcha
}
?v=
${
new
Date
().
getTime
()}
`
;
},
},
};
</
script
>
<
style
lang=
"less"
scoped
>
.marquee-box {
position: absolute;
top: 10px;
display: flex;
align-items: center;
justify-content: center;
width: 100%;
height: 30px;
line-height: 30px;
font-size: 18px;
color: #fff;
background-color: #ff9900;
.marquee-box-marquee {
flex: 1;
}
.marquee-box-icon {
padding: 0 10px;
}
}
.wrapper {
position: relative;
width: 100%;
height: 100%;
padding-top: 200px;
padding-bottom: 200px;
background: #001529;
}
.wrapper > h1 {
text-align: center;
vertical-align: middle;
margin-bottom: 20px;
color: #fff;
}
.login {
margin: 0 auto;
padding-top: 15px;
width: 360px;
height: 100%;
}
.captcha {
display: flex;
justify-content: space-between;
align-items: center;
.ivu-input-wrapper {
width: 180px;
}
}
</
style
>
app/web/service/http.service.ts
View file @
b69eb087
...
...
@@ -60,9 +60,10 @@ instance.interceptors.request.use(
}
config
.
cancelToken
=
new
CancelToken
(
c
=>
(
pending
[
config
.
url
as
string
]
=
c
));
// 添加token
const
token
=
localStorage
.
get
(
'
T
oken
'
);
const
token
=
localStorage
.
get
(
'
t
oken
'
);
if
(
token
)
{
config
.
headers
[
'
x-auth-token
'
]
=
token
;
config
.
headers
[
'
X-Auth-Token
'
]
=
token
;
config
.
headers
[
'
Access-Token
'
]
=
token
;
}
return
config
;
...
...
@@ -79,7 +80,8 @@ instance.interceptors.response.use(
// afterRequest();
delete
pending
[
response
.
config
.
url
as
string
];
if
(
response
.
data
.
code
===
'
0000
'
&&
response
.
data
.
businessCode
===
'
0000
'
)
{
return
response
.
data
.
data
;
}
const
codeArr
=
[
'
0000
'
,
2000
];
if
(
codeArr
.
includes
(
response
.
data
.
code
))
{
return
response
.
data
.
data
;
}
// 后端返回异常信息时提出警告
if
(
response
.
data
.
code
&&
response
.
data
.
msg
)
{
notifyType
=
'
warning
'
;
}
...
...
bin/server.js
View file @
b69eb087
...
...
@@ -3,7 +3,7 @@
"
use strict
"
;
const
npm
=
require
(
"
npm
"
);
npm
.
load
(()
=>
{
npm
.
run
(
"
build
"
);
npm
.
run
(
"
start
"
);
});
\ No newline at end of file
package.json
View file @
b69eb087
...
...
@@ -3,12 +3,12 @@
"version"
:
"0.0.1"
,
"description"
:
"低代码平台"
,
"scripts"
:
{
"start"
:
"egg-scripts start --port 80 --daemon --workers
4
"
,
"start"
:
"egg-scripts start --port 80 --daemon --workers
1
"
,
"stop"
:
"egg-scripts stop"
,
"backend"
:
"nohup egg-scripts start --port 7001 --workers 4"
,
"dev"
:
"egg-bin dev -r egg-ts-helper/register"
,
"debug"
:
"egg-bin debug -r egg-ts-helper/register"
,
"build"
:
"easy build
&& npm run start
"
,
"build"
:
"easy build"
,
"tsc"
:
"ets && tsc -p tsconfig.json"
,
"clean"
:
"ets clean"
,
"kill"
:
"easy kill"
,
...
...
webpack.config.js
View file @
b69eb087
...
...
@@ -3,8 +3,7 @@ const path = require('path');
const
resolve
=
filepath
=>
path
.
resolve
(
__dirname
,
filepath
);
module
.
exports
=
{
entry
:
{
// 'admin/login': 'app/web/page/admin/login/login.vue',
// 'admin/home': 'app/web/page/admin/home/index.ts',
'
login
'
:
'
app/web/page/login/index.vue
'
,
'
editor
'
:
'
app/web/page/editor/index.ts
'
,
'
activity
'
:
'
app/web/page/activity/index.ts
'
,
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment