Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pptist
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
viitto
pptist
Commits
66680f8e
Commit
66680f8e
authored
May 22, 2024
by
zhengke
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'router' of
http://gitlab.oytour.com/viitto/pptist
into router
parents
268ce60f
70343bb6
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
298 deletions
+66
-298
axios.ts
src/configs/axios.ts
+14
-2
UserService.ts
src/services/UserService.ts
+7
-3
user.ts
src/store/user.ts
+34
-17
AutoLogin.vue
src/views/Auth/AutoLogin.vue
+11
-11
Index copy.vue
src/views/Index copy.vue
+0
-265
No files found.
src/configs/axios.ts
View file @
66680f8e
import
{
useUserStore
}
from
'@/store'
;
import
Axios
,
{
AxiosResponse
,
InternalAxiosRequestConfig
,
AxiosError
,
}
from
'axios'
;
import
{
ElMessage
}
from
'element-plus'
;
// import { domainManager } from '@/utils/domainManager'
let
datas
:
AxiosResponse
...
...
@@ -11,6 +14,7 @@ export enum ApiResult{
'FAILED'
=
0
,
'TOKEN_INVALID'
=
10000
,
'TOKEN_ILLEGAL'
=
10001
,
'REMOTE_LOGIN'
=
10010
}
export
enum
VipType
{
...
...
@@ -106,8 +110,16 @@ service.interceptors.response.use(
/** 请求有响应 */
async
(
response
:
AxiosResponse
)
=>
{
if
(
response
.
status
===
200
)
{
if
(
response
.
data
.
resultCode
==
ApiResult
.
TOKEN_ILLEGAL
||
response
.
data
.
resultCode
==
ApiResult
.
TOKEN_INVALID
){
if
(
response
.
data
.
resultCode
==
ApiResult
.
TOKEN_ILLEGAL
||
response
.
data
.
resultCode
==
ApiResult
.
TOKEN_INVALID
||
response
.
data
.
resultCode
==
ApiResult
.
REMOTE_LOGIN
){
ElMessage
.
error
({
message
:
response
.
data
.
message
})
setTimeout
(()
=>
{
useUserStore
().
setUserLoginOut
()
},
1000
);
}
if
(
response
.
data
.
attach
){
if
(
response
.
data
.
attach
.
userinfo
){
useUserStore
().
setOnlyUserInfo
(
response
.
data
.
attach
.
userinfo
)
}
}
datas
=
response
return
Promise
.
resolve
(
datas
)
...
...
src/services/UserService.ts
View file @
66680f8e
...
...
@@ -3,9 +3,9 @@ import Api,{ HttpResponse, Result } from './../utils/request';
class
UserServices
{
static
async
AutoLoginAsync
(
userId
:
number
):
Promise
<
HttpResponse
>
{
let
msg
=
{
EmployeeId
:
userId
}
return
Api
.
Post
(
"
admin_get_GetErpLoginInfoByUid
"
,
msg
)
static
async
AutoLoginAsync
(
t
:
string
):
Promise
<
HttpResponse
>
{
let
msg
=
{
t
}
return
Api
.
Post
(
"
travel_auto_login
"
,
msg
)
}
static
async
PasswordLoginAsync
(
account
:
string
,
pwd
:
string
,
tid
:
string
=
''
):
Promise
<
HttpResponse
>
{
...
...
@@ -62,5 +62,9 @@ class UserServices{
let
msg
=
{}
return
Api
.
Post
(
"travel_sample_count"
,
msg
)
}
static
async
CreateTemplateTokenAsync
():
Promise
<
HttpResponse
>
{
let
msg
=
{}
return
Api
.
Post
(
"travel_temp_token"
,
msg
)
}
}
export
default
UserServices
;
\ No newline at end of file
src/store/user.ts
View file @
66680f8e
...
...
@@ -23,6 +23,10 @@ export interface UserLoginResult {
status
:
'ERROR'
|
'CHOSEN'
|
'SUCCESS'
,
data
?:
any
[]
}
export
interface
AutoLoginResult
{
isSuccess
:
boolean
,
message
:
string
}
export
const
useUserStore
=
defineStore
(
'user'
,
{
state
:()
=>
({
...
...
@@ -46,34 +50,38 @@ export const useUserStore = defineStore('user', {
},
},
actions
:{
async
setUserAutoLoginAsync
(
userId
:
number
)
{
async
setUserAutoLoginAsync
(
tempToken
:
string
):
Promise
<
AutoLoginResult
>
{
try
{
let
response
=
await
UserService
.
AutoLoginAsync
(
userId
)
const
response
=
await
UserService
.
AutoLoginAsync
(
tempToken
)
if
(
response
.
data
.
resultCode
==
ApiResult
.
SUCCESS
)
{
const
d
=
response
.
data
.
data
// d.nickname=d.emName
// d.photo = d.Icon
// d.company = d.GroupName
// d.logo = d.GroupPic
// d.isTemplate = d.IsEditTripTemplate
// d.ia = 0
// d.it = true
// d.expire = d.Expire
// d.ic = d.IsGroupCreate
// d.id = d.DisplayId
// d.iv = 0
this
.
token
=
d
.
token
d
.
nickname
=
d
.
emName
d
.
photo
=
d
.
Icon
d
.
company
=
d
.
GroupName
d
.
logo
=
d
.
GroupPic
d
.
isTemplate
=
d
.
IsEditTripTemplate
d
.
ia
=
0
d
.
it
=
true
d
.
expire
=
d
.
Expire
d
.
ic
=
d
.
IsGroupCreate
d
.
id
=
d
.
DisplayId
d
.
iv
=
0
this
.
userInfo
=
d
this
.
userInfo
=
d
.
userinfo
if
(
!
this
.
userInfo
.
photo
||
!
this
.
userInfo
.
photo
.
includes
(
'http://'
)
||
!
this
.
userInfo
.
photo
.
includes
(
'https://'
)){
this
.
userInfo
.
photo
=
USER_DEFAULT_HEADER
}
if
(
!
this
.
userInfo
.
logo
||
!
this
.
userInfo
.
logo
.
includes
(
'http://'
)
||
!
this
.
userInfo
.
logo
.
includes
(
'https://'
)){
this
.
userInfo
.
logo
=
ENTERPRISE_DEFAULT_HEADER
}
return
true
return
{
isSuccess
:
true
,
message
:
''
}
}
else
{
return
{
isSuccess
:
false
,
message
:
response
.
data
.
message
}
}
}
catch
(
error
)
{}
return
false
}
catch
(
error
)
{
return
{
isSuccess
:
false
,
message
:
'登录异常,请刷新页面重试'
}
}
},
setUserLoginOut
(){
this
.
token
=
''
...
...
@@ -90,6 +98,15 @@ export const useUserStore = defineStore('user', {
this
.
userInfo
.
logo
=
ENTERPRISE_DEFAULT_HEADER
}
},
setOnlyUserInfo
(
userinfo
:
any
){
this
.
userInfo
=
userinfo
if
(
!
this
.
userInfo
.
photo
||
!
this
.
userInfo
.
photo
.
includes
(
'http://'
)
||
!
this
.
userInfo
.
photo
.
includes
(
'https://'
)){
this
.
userInfo
.
photo
=
USER_DEFAULT_HEADER
}
if
(
!
this
.
userInfo
.
logo
||
!
this
.
userInfo
.
logo
.
includes
(
'http://'
)
||
!
this
.
userInfo
.
logo
.
includes
(
'https://'
)){
this
.
userInfo
.
logo
=
ENTERPRISE_DEFAULT_HEADER
}
},
async
setUserPasswordLoginAsync
(
account
:
string
,
pwd
:
string
,
tid
:
string
=
''
)
{
try
{
let
response
=
await
UserService
.
PasswordLoginAsync
(
account
,
pwd
,
tid
)
...
...
src/views/Auth/AutoLogin.vue
View file @
66680f8e
<
template
>
<div
class=
"full-height column flex-center items-center"
v-if=
"
!result
"
>
<el-empty
:image-size=
"200"
description=
"抱歉,你的账户信息不存在
"
/>
<div
class=
"full-height column flex-center items-center"
v-if=
"
result && !result.isSuccess
"
>
<el-empty
:image-size=
"200"
:description=
"result.message
"
/>
</div>
</
template
>
<
script
setup
lang=
"ts"
>
import
{
useUserStore
}
from
'@/store/user'
;
import
{
AutoLoginResult
,
useUserStore
}
from
'@/store/user'
;
import
{
query
}
from
'@/utils/common'
;
import
{
ElLoading
}
from
'element-plus'
;
import
{
ref
}
from
'vue'
;
...
...
@@ -14,16 +14,16 @@ import { useRouter } from 'vue-router';
const
router
=
useRouter
();
const
forword
=
decodeURIComponent
(
router
.
currentRoute
.
value
.
query
.
forword
)
const
param
=
query
(
forword
)
const
result
=
ref
(
true
)
const
result
=
ref
<
AutoLoginResult
|
null
>
(
null
)
const
userLoginHandler
=
async
()
=>
{
const
loading
=
ElLoading
.
service
({
fullscreen
:
true
,
lock
:
true
})
if
(
param
.
uid
){
let
response
=
await
useUserStore
().
setUserAutoLoginAsync
(
parseInt
(
param
.
uid
)
)
if
(
response
){
if
(
param
.
uid
&&
param
.
uid
!=
''
){
const
response
=
await
useUserStore
().
setUserAutoLoginAsync
(
param
.
uid
)
if
(
response
.
isSuccess
){
if
(
param
.
model
==
'0'
)
{
router
.
push
({
path
:
`/team_editor/
${
param
.
ConfigId
}
`
...
...
@@ -37,11 +37,11 @@ const userLoginHandler = async ()=>{
path
:
"/space"
})
}
return
}
}
result
.
value
=
false
result
.
value
=
response
}
else
result
.
value
=
{
isSuccess
:
false
,
message
:
'无法获取到令牌信息'
}
loading
.
close
()
}
userLoginHandler
()
</
script
>
...
...
src/views/Index copy.vue
deleted
100644 → 0
View file @
268ce60f
<
template
>
<div
v-if=
"isFinish"
style=
"height: 100vh;background: rgb(243, 246, 251);"
>
<!--
<Screen
v-if=
"screening"
/>
-->
<PreviewCustomSlider
v-if=
"model==448963"
></PreviewCustomSlider>
<Market
v-else-if=
"(market&&model!=2&&!query().ViewSlideshow)||(market&&SalesEditor>0&&!query().ViewSlideshow)"
></Market>
<Workspace
v-else-if=
"model==2&&SalesEditor==0"
/>
<Editor
v-else-if=
"_isPC"
/>
<Mobile
v-else
/>
</div>
<el-result
v-if=
"loading"
title=
"404"
:sub-title=
"ShareTips"
>
<template
#
icon
></
template
>
<
template
#
extra
></
template
>
</el-result>
</template>
<
script
lang=
"ts"
setup
>
import
{
ApiResult
}
from
'@/configs/axios'
;
import
{
onMounted
,
ref
,
provide
}
from
'vue'
import
{
storeToRefs
}
from
'pinia'
import
{
useScreenStore
,
useMainStore
,
useSnapshotStore
,
useFontStore
,
useSellTemplateStore
,
useSlidesStore
}
from
'@/store'
import
{
LOCALSTORAGE_KEY_DISCARDED_DB
}
from
'@/configs/storage'
import
{
deleteDiscardedDB
}
from
'@/utils/database'
import
{
isPC
,
query
}
from
'@/utils/common'
import
{
useUserStore
}
from
'@/store/user'
import
{
injectKeyTemplate
}
from
'@/types/injectKey'
import
ConfigService
from
'@/services/ConfigService'
import
{
domainManager
}
from
'@/utils/domainManager'
import
{
enterFullscreen
,
exitFullscreen
,
isFullscreen
}
from
'@/utils/fullscreen'
import
{
VIEWPORT_SIZE
,
VIEWPORT_VER_SIZE
}
from
'@/configs/canvas'
import
Editor
from
'./Editor/index.vue'
import
Screen
from
'./Screen/index.vue'
import
Mobile
from
'./Mobile/index.vue'
import
Market
from
'./Market/Index.vue'
import
PreviewCustomSlider
from
'./Preview/PreviewCustomSlider.vue'
import
SellTemplate
from
'./SellTemplate/index.vue'
import
Workspace
from
'./SellTemplate/Workspace.vue'
import
{
ElMessage
,
ElMessageBox
}
from
'element-plus'
const
searchData
=
ref
({}
as
any
)
provide
(
injectKeyTemplate
,
searchData
)
const
autoSave
=
ref
(
0
)
provide
(
"SellTravelSave"
,
autoSave
)
const
isFinish
=
ref
(
false
)
const
loading
=
ref
(
false
)
const
ShareTips
=
ref
(
''
)
const
_isPC
=
isPC
()
const
mainStore
=
useMainStore
()
const
snapshotStore
=
useSnapshotStore
()
const
modelStore
=
useScreenStore
()
const
ConfigIdStore
=
useScreenStore
()
const
marketStore
=
useScreenStore
()
const
isModelStore
=
useScreenStore
()
const
TempIdStore
=
useScreenStore
()
const
ScreenStore
=
useScreenStore
()
const
SellTemplateStore
=
useSellTemplateStore
()
const
slidesStore
=
useSlidesStore
()
const
{
databaseId
}
=
storeToRefs
(
mainStore
)
const
{
screening
,
market
,
model
,
ConfigId
}
=
storeToRefs
(
useScreenStore
())
const
{
userInfo
}
=
storeToRefs
(
useUserStore
())
const
{
SalesEditor
,
SalesTripId
}
=
storeToRefs
(
useSellTemplateStore
())
const
{
slides
}
=
storeToRefs
(
useSlidesStore
())
const
{
enterScreeningFromStart
}
=
storeToRefs
(
useScreenStore
())
const
userLoginHandler
=
async
()
=>
{
let
param
=
query
()
let
userId
=
0
let
ConfigId
=
0
// 9117
let
model
=
0
let
SalesTripId
=
''
await
useFontStore
().
loadAllFonts
()
if
(
param
.
uid
)
userId
=
parseInt
(
param
.
uid
)
if
(
param
.
ConfigId
)
ConfigId
=
parseInt
(
param
.
ConfigId
)
if
(
param
.
model
)
model
=
parseInt
(
param
.
model
)
if
(
param
.
SalesTripId
)
{
SalesTripId
=
param
.
SalesTripId
SellTemplateStore
.
setSalesTripId
(
SalesTripId
)
try
{
await
sellShareTemplate
()
}
catch
(
error
)
{}
}
ConfigIdStore
.
setConfigId
(
ConfigId
)
modelStore
.
setModel
(
model
)
try
{
if
(
param
.
uid
)
await
useUserStore
().
setUserAutoLoginAsync
(
userId
)
if
(
ConfigId
>
0
&&
model
!=
2
)
await
GetTripConfig
(
ConfigId
)
}
catch
(
error
)
{}
if
(
userId
>
0
)
isFinish
.
value
=
true
if
(
param
.
ViewSlideshow
)
{
searchData
.
value
.
ViewSlideshow
=
param
.
ViewSlideshow
try
{
await
sellHistoryTripTemplate
(
param
.
sellId
,
param
.
LogId
)
}
catch
(
error
)
{}
}
if
(
!
ConfigId
&&!
model
&&
(
param
.
SalesTripId
&&
param
.
SalesTripId
==
''
))
ElMessageBox
.
confirm
(
'当前没有权限进行任何操作,请联系管理员!'
,
'提示'
,
{
confirmButtonText
:
'确定'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
}
).
then
(()
=>
{})
.
catch
(()
=>
{})
}
// 销售历史版本模版数据
const
sellHistoryTripTemplate
=
async
(
sellId
:
any
,
LogId
:
any
)
=>
{
const
loadingObj
=
ElLoading
.
service
({
text
:
'正在渲染数据'
,
lock
:
true
})
try
{
let
queryMsg
let
dataRes
if
(
!
LogId
){
queryMsg
=
{
Id
:
sellId
,
Status
:
searchData
.
value
.
ViewSlideshow
==
1
?
1
:
0
}
// 行程广告浏览记录
if
(
queryMsg
.
Status
==
0
)
await
ConfigService
.
SetTripBrowse
({
FileId
:
sellId
});
dataRes
=
await
ConfigService
.
sellGetTemplateDetails
(
queryMsg
);
}
else
{
queryMsg
=
{
LogId
:
LogId
,
FileId
:
sellId
,
}
dataRes
=
await
ConfigService
.
GetHistoryInfo
(
queryMsg
);
}
if
(
dataRes
.
data
.
resultCode
==
ApiResult
.
SUCCESS
)
{
loadingObj
.
close
()
loading
.
value
=
false
isFinish
.
value
=
true
let
dataObj
=
dataRes
.
data
.
data
let
viewportRatios
=
0
if
(
dataObj
.
TemplateType
!=
2
)
{
viewportRatios
=
1.414
if
(
dataObj
.
TempType
==
1
)
viewportRatios
=
0.7069
}
if
(
dataObj
.
TemplateType
==
2
&&
dataObj
.
Width
&&
dataObj
.
Height
)
{
viewportRatios
=
dataObj
.
Height
/
dataObj
.
Width
}
if
(
dataObj
.
Width
&&
dataObj
.
Height
)
{
VIEWPORT_SIZE
.
Value
=
dataObj
.
Height
VIEWPORT_VER_SIZE
.
Value
=
dataObj
.
Width
}
else
{
VIEWPORT_SIZE
.
Value
=
1754
VIEWPORT_VER_SIZE
.
Value
=
1240
}
slidesStore
.
setViewportRatio
(
viewportRatios
)
let
SlidesData
=
JSON
.
parse
(
dataObj
.
TempData
)
let
newSlides
=
[]
await
SlidesData
.
forEach
((
x
,
i
)
=>
{
newSlides
.
push
(
x
)
})
slidesStore
.
setSlides
(
newSlides
)
ScreenStore
.
setScreening
(
true
)
enterScreeningFromStart
slidesStore
.
updateSlideIndex
(
0
)
}
else
{
loading
.
value
=
true
ShareTips
.
value
=
dataRes
.
data
.
message
loadingObj
.
close
()
}
}
catch
(
error
)
{
}
}
// 销售分享模版数据
const
sellShareTemplate
=
async
()
=>
{
const
loadingObj
=
ElLoading
.
service
({
text
:
'正在渲染数据'
,
lock
:
true
})
try
{
let
queryMsg
=
{
Code
:
SalesTripId
.
value
}
const
slidesData
=
slides
.
value
let
dataRes
=
await
ConfigService
.
GetTripOtherByCode
(
queryMsg
);
if
(
dataRes
.
data
.
resultCode
==
ApiResult
.
SUCCESS
)
{
loadingObj
.
close
()
loading
.
value
=
false
isFinish
.
value
=
true
let
dataObj
=
dataRes
.
data
.
data
let
viewportRatios
=
0
if
(
dataObj
.
TemplateType
!=
2
)
{
viewportRatios
=
1.414
if
(
dataObj
.
TempType
==
1
)
viewportRatios
=
0.7069
}
if
(
dataObj
.
TemplateType
==
2
&&
dataObj
.
Width
&&
dataObj
.
Height
)
{
viewportRatios
=
dataObj
.
Height
/
dataObj
.
Width
}
if
(
dataObj
.
Width
&&
dataObj
.
Height
)
{
VIEWPORT_SIZE
.
Value
=
dataObj
.
Height
VIEWPORT_VER_SIZE
.
Value
=
dataObj
.
Width
}
else
{
VIEWPORT_SIZE
.
Value
=
1754
VIEWPORT_VER_SIZE
.
Value
=
1240
}
slidesStore
.
setViewportRatio
(
viewportRatio
)
let
SlidesData
=
JSON
.
parse
(
dataObj
.
TempData
)
let
newSlides
=
[]
await
SlidesData
.
forEach
((
x
,
i
)
=>
{
newSlides
.
push
(
x
)
})
slidesStore
.
setSlides
(
newSlides
)
slidesStore
.
updateSlideIndex
(
0
)
ScreenStore
.
setScreening
(
true
)
enterScreeningFromStart
}
else
{
loading
.
value
=
true
ShareTips
.
value
=
dataRes
.
data
.
message
loadingObj
.
close
()
}
}
catch
(
error
)
{
loading
.
value
=
true
ShareTips
.
value
=
error
loadingObj
.
close
()
}
}
/**
* 根据团期配置编号获取行程详情
*/
const
GetTripConfig
=
async
(
ConfigId
)
=>
{
try
{
let
queryMsg
=
{
ConfigId
:
ConfigId
}
let
datasRes
=
await
ConfigService
.
triptemplateGetTripConfig
(
queryMsg
);
if
(
datasRes
.
data
.
resultCode
==
ApiResult
.
SUCCESS
&&
datasRes
.
data
.
data
)
{
let
dataObj
=
datasRes
.
data
.
data
if
(
dataObj
.
TempId
==
0
){
return
window
.
parent
.
postMessage
(
`暂无行程数据`
,
`
${
domainManager
().
notificationUrl
}
`
);
}
isModelStore
.
setIsModel
(
true
)
marketStore
.
setMarket
(
!
market
)
TempIdStore
.
setTempId
(
dataObj
.
TempId
)
}
}
catch
(
error
)
{
}
}
userLoginHandler
()
</
script
>
<
style
lang=
"scss"
>
#app
{
height
:
100%
;
}
.el-overlay
{
}
</
style
>
\ No newline at end of file
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