Ver a proveniência

春耕

rongxin_prod
zhao há 2 anos
ascendente
cometimento
8d7610c504
7 ficheiros alterados com 214 adições e 7 eliminações
  1. +24
    -0
      src/api/login/index.js
  2. +2
    -0
      src/permission.js
  3. +18
    -0
      src/router/index.js
  4. +28
    -1
      src/store/modules/user.js
  5. +68
    -0
      src/views/chungengFarmerSSOLogin.vue
  6. +64
    -0
      src/views/chungengUserSSOLogin.vue
  7. +10
    -6
      src/views/sunVillage_info/index_code_rights.vue

+ 24
- 0
src/api/login/index.js Ver ficheiro

@@ -111,3 +111,27 @@ export function registerOn(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
}
})
}

+ 2
- 0
src/permission.js Ver ficheiro

@@ -19,6 +19,8 @@ const whiteList = [
'/notice/inviteTendersDetail',
'/notice/winTheBiddingDetail',
'/project/projectNeedsDetail',
'/chungeng/userSSOLogin',
'/chungeng/farmerSSOLogin',

'/supply/index',
'/interaction/index',


+ 18
- 0
src/router/index.js Ver ficheiro

@@ -3335,6 +3335,24 @@ export const constantRoutes = [
},
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',
name: 'arbitrationList',


+ 28
- 1
src/store/modules/user.js Ver ficheiro

@@ -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 { getToken, setToken, removeToken } from '@/utils/auth'
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)
})
})
},
}
}



+ 68
- 0
src/views/chungengFarmerSSOLogin.vue Ver ficheiro

@@ -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>

+ 64
- 0
src/views/chungengUserSSOLogin.vue Ver ficheiro

@@ -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>

+ 10
- 6
src/views/sunVillage_info/index_code_rights.vue Ver ficheiro

@@ -75,12 +75,16 @@
created() {
this.deptId = Cookies.get('deptId')
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')){
this.userName = JSON.parse(Cookies.get('user')).memberName
}


Carregando…
Cancelar
Guardar