@@ -111,3 +111,27 @@ export function registerOn(mobile) { | |||||
data: mobile | data: mobile | ||||
}) | }) | ||||
} | } | ||||
// 春耕app登录: 用户 | |||||
export function chungengUserLogin(code) { | |||||
return request({ | |||||
url: '/chungeng/userLogin', | |||||
method: 'post', | |||||
data: {code}, | |||||
headers: { | |||||
isToken: false | |||||
} | |||||
}) | |||||
} | |||||
// 春耕app登录: 农户 | |||||
export function chungengFarmerLogin(code) { | |||||
return request({ | |||||
url: '/chungeng/farmerLogin', | |||||
method: 'post', | |||||
data: {code}, | |||||
headers: { | |||||
isToken: false | |||||
} | |||||
}) | |||||
} |
@@ -19,6 +19,8 @@ const whiteList = [ | |||||
'/notice/inviteTendersDetail', | '/notice/inviteTendersDetail', | ||||
'/notice/winTheBiddingDetail', | '/notice/winTheBiddingDetail', | ||||
'/project/projectNeedsDetail', | '/project/projectNeedsDetail', | ||||
'/chungeng/userSSOLogin', | |||||
'/chungeng/farmerSSOLogin', | |||||
'/supply/index', | '/supply/index', | ||||
'/interaction/index', | '/interaction/index', | ||||
@@ -3335,6 +3335,24 @@ export const constantRoutes = [ | |||||
}, | }, | ||||
component: (resolve) => require(['@/views/zjdLogin'], resolve) | component: (resolve) => require(['@/views/zjdLogin'], resolve) | ||||
}, | }, | ||||
{ | |||||
path: '/chungeng/userSSOLogin', | |||||
name: 'chungengUserSSOLogin', | |||||
meta: { | |||||
title: '春耕App用户登录入口', | |||||
hidden: true, | |||||
}, | |||||
component: (resolve) => require(['@/views/chungengUserSSOLogin'], resolve) | |||||
}, | |||||
{ | |||||
path: '/chungeng/farmerSSOLogin', | |||||
name: 'chungengFarmerSSOLogin', | |||||
meta: { | |||||
title: '春耕App农户登录入口', | |||||
hidden: true, | |||||
}, | |||||
component: (resolve) => require(['@/views/chungengFarmerSSOLogin'], resolve) | |||||
}, | |||||
{ | { | ||||
path: '/onlineHome/arbitrationList', | path: '/onlineHome/arbitrationList', | ||||
name: 'arbitrationList', | name: 'arbitrationList', | ||||
@@ -1,4 +1,4 @@ | |||||
import { login, logout, getInfo, smsLogin } from '@/api/login'; | |||||
import {login, logout, getInfo, smsLogin, chungengUserLogin, chungengFarmerLogin} from '@/api/login'; | |||||
import { registerOn } from "@/api/register"; | import { registerOn } from "@/api/register"; | ||||
import { getToken, setToken, removeToken } from '@/utils/auth' | import { getToken, setToken, removeToken } from '@/utils/auth' | ||||
import { getSystemAttachmentUrl } from '@/api/system/config' | import { getSystemAttachmentUrl } from '@/api/system/config' | ||||
@@ -171,6 +171,33 @@ const user = { | |||||
// 更新用户信息 | // 更新用户信息 | ||||
// 春耕App用户登录 | |||||
ChungengLogin({ commit }, userInfo) { | |||||
const code = userInfo.code; | |||||
return new Promise((resolve, reject) => { | |||||
chungengUserLogin(code).then(res => { | |||||
setToken(res.token) | |||||
commit('SET_TOKEN', res.token) | |||||
Cookies.set("_Login_url", window.location.href); | |||||
resolve(res.data) | |||||
}).catch(error => { | |||||
reject(error) | |||||
}) | |||||
}) | |||||
}, | |||||
// 春耕App用户登录 | |||||
ChungengFarmerLogin({ commit }, userInfo) { | |||||
const code = userInfo.code; | |||||
return new Promise((resolve, reject) => { | |||||
chungengFarmerLogin(code).then(res => { | |||||
Cookies.set("user", res.data, { expires: 30 }); | |||||
resolve(res.data) | |||||
}).catch(error => { | |||||
reject(error) | |||||
}) | |||||
}) | |||||
}, | |||||
} | } | ||||
} | } | ||||
@@ -0,0 +1,68 @@ | |||||
<template> | |||||
<div class="app-container"> | |||||
</div> | |||||
</template> | |||||
<script> | |||||
import {Dialog} from "vant"; | |||||
import Cookies from "js-cookie"; | |||||
const TEST = 0; | |||||
export default { | |||||
name: "ChungengFarmerSSOLogin", | |||||
data() { | |||||
return { | |||||
}; | |||||
}, | |||||
created() { | |||||
this.Login(); | |||||
}, | |||||
methods: { | |||||
GetToken() { | |||||
if(TEST) | |||||
{ | |||||
if(!this.$route.query.s) | |||||
return this.$route.query.s; | |||||
let name = '6a4634036f90c1985122c4919d8ecb99'; | |||||
let idcard = 'e49446695d1e82935bbc0cc7e440a8f739f2c015dc029dccb15380b896e7f71b'; | |||||
// idcard = '8feee543fdf8c9cdca7928c9b501908b0b353515cbd0da854519651dafea96c8'; | |||||
// name = '6e067f6d57682232cc32096e86487c5e'; | |||||
let ts = '525e902f509a7147ad92e602139bd267'; | |||||
return name + '#' + idcard + '#' + ts; | |||||
} | |||||
else | |||||
return this.$route.query.s; | |||||
}, | |||||
ShowToast(content, title) { | |||||
return Dialog.alert({ | |||||
title: title, | |||||
message: content, | |||||
theme: 'round-button', | |||||
}); | |||||
}, | |||||
Login() { | |||||
let code = this.GetToken(); | |||||
if(!code) | |||||
{ | |||||
this.ShowToast('请从春耕App进入登录').then(() => { | |||||
history.back(); | |||||
}); | |||||
return false; | |||||
} | |||||
this.$store.dispatch("ChungengFarmerLogin", {code}) | |||||
.then((data) => { | |||||
Cookies.set('deptId', data.deptId, { expires: 30 }); | |||||
this.$router.push({path:'/sunVillage_info/index_code_rights'}); | |||||
}) | |||||
.catch((error) => { | |||||
this.ShowToast(error || '春耕App农户登录失败').then(() => { | |||||
history.back(); | |||||
}); | |||||
}); | |||||
}, | |||||
}, | |||||
}; | |||||
</script> | |||||
<style scoped lang="scss"> | |||||
</style> |
@@ -0,0 +1,64 @@ | |||||
<template> | |||||
<div class="app-container"> | |||||
</div> | |||||
</template> | |||||
<script> | |||||
import {Dialog} from "vant"; | |||||
const TEST = 0; | |||||
export default { | |||||
name: "ChungengUserSSOLogin", | |||||
data() { | |||||
return { | |||||
}; | |||||
}, | |||||
created() { | |||||
this.Login(); | |||||
}, | |||||
methods: { | |||||
GetToken() { | |||||
if(TEST) | |||||
{ | |||||
if(!this.$route.query.s) | |||||
return this.$route.query.s; | |||||
let phone = '704d238d95b61f8304ce9e9c2d70e0bf'; | |||||
//phone = '525e902f509a7147ad92e602139bd267' | |||||
let ts = '525e902f509a7147ad92e602139bd267'; | |||||
return phone + '#' + ts; | |||||
} | |||||
else | |||||
return this.$route.query.s; | |||||
}, | |||||
ShowToast(content, title) { | |||||
return Dialog.alert({ | |||||
title: title, | |||||
message: content, | |||||
theme: 'round-button', | |||||
}); | |||||
}, | |||||
Login() { | |||||
let code = this.GetToken(); | |||||
if(!code) | |||||
{ | |||||
this.ShowToast('请从春耕App进入登录').then(() => { | |||||
history.back(); | |||||
}); | |||||
return false; | |||||
} | |||||
this.$store.dispatch("ChungengLogin", {code}) | |||||
.then(() => { | |||||
this.$router.push({ path: "/yinnong/doneCompleted/completed" }); | |||||
}) | |||||
.catch((error) => { | |||||
this.ShowToast(error || '春耕App用户登录失败').then(() => { | |||||
history.back(); | |||||
}); | |||||
}); | |||||
}, | |||||
}, | |||||
}; | |||||
</script> | |||||
<style scoped lang="scss"> | |||||
</style> |
@@ -75,12 +75,16 @@ | |||||
created() { | created() { | ||||
this.deptId = Cookies.get('deptId') | this.deptId = Cookies.get('deptId') | ||||
this.bookId = Cookies.get('bookId') | this.bookId = Cookies.get('bookId') | ||||
bookInfo(this.bookId).then((res) => { | |||||
if (res.code == 200) { | |||||
this.deptName = res.data.deptName; | |||||
this.bookName = res.data.bookName; | |||||
} | |||||
}); | |||||
console.log(this.bookId); | |||||
if(this.bookId) | |||||
{ | |||||
bookInfo(this.bookId).then((res) => { | |||||
if (res.code == 200) { | |||||
this.deptName = res.data.deptName; | |||||
this.bookName = res.data.bookName; | |||||
} | |||||
}); | |||||
} | |||||
if(Cookies.get('user')){ | if(Cookies.get('user')){ | ||||
this.userName = JSON.parse(Cookies.get('user')).memberName | this.userName = JSON.parse(Cookies.get('user')).memberName | ||||
} | } | ||||