Commit 1abb06c4 authored by 郭志伟's avatar 郭志伟 Committed by 郝聪敏

feat: 顾问联调

parent 19b4137b
...@@ -5,14 +5,17 @@ ...@@ -5,14 +5,17 @@
<cr-loading class="loading" size="24px">加载中...</cr-loading> <cr-loading class="loading" size="24px">加载中...</cr-loading>
</div> </div>
<login-modal /> <login-modal />
<auth-from-xyqb />
</div> </div>
</template> </template>
<script> <script>
import { mapState, mapActions } from "vuex"; import { mapState, mapActions } from "vuex";
import LoginModal from "@/components/LoginModal"; import LoginModal from "@/components/LoginModal";
import AuthFromXyqb from "@/components/AuthFromXyqb";
export default { export default {
components: { components: {
LoginModal LoginModal,
AuthFromXyqb
}, },
computed: { computed: {
...mapState(["isLoading"]) ...mapState(["isLoading"])
......
...@@ -6,7 +6,7 @@ export const loginByPhone = param => { ...@@ -6,7 +6,7 @@ export const loginByPhone = param => {
}; };
// 信用钱包用户自动登录 // 信用钱包用户自动登录
export const loginByxyqb = param => { export const authByxyqb = param => {
return req.get("xyqb_user_info", param); return req.get("xyqb_user_info", param);
}; };
......
<template>
<cr-popup
v-model="showAuthXyqb"
get-container="body"
round
closeable
position="bottom"
class="auth"
>
111
</cr-popup>
</template>
<script>
import { mapState, mapActions } from "vuex";
import localStorage from "@/service/localStorage";
import { authByxyqb } from "@/api/user";
export default {
name: "AuthFromXyqb",
data() {
return {};
},
computed: {
...mapState(["showAuthXyqb"])
},
methods: {
...mapActions(["setShowAuthXyqb"]),
async getAuthInfo() {
const res = await authByxyqb();
if (res) {
localStorage.set("mongoToken", res.token);
localStorage.set("xyqbUserInfo", res);
}
}
}
};
</script>
<style lang="less" scoped>
@import "../style/var.less";
</style>
...@@ -85,7 +85,8 @@ export default { ...@@ -85,7 +85,8 @@ export default {
if (res) { if (res) {
this.$notify("登录成功"); this.$notify("登录成功");
this.setIsShowLogin(false); this.setIsShowLogin(false);
localStorage.setItem("mongoToken", res.token); // localStorage.setItem("mongoToken", res.token);
localStorage.setItem("mongoToken", "6ae7da7dd4c543f1a36c702c6f419f12");
} }
}, },
async getCode() { async getCode() {
......
export default { export default {
basicHost: "http://yapi.quantgroups.com/mock/329/", // basicHost: "http://yapi.quantgroups.com/mock/329/",
basicHost: "http://192.168.29.211:80/",
wxAppId: "wx514de17b23d53a20" wxAppId: "wx514de17b23d53a20"
}; };
import Vue from "vue"; import Vue from "vue";
import VueRouter from "vue-router"; import VueRouter from "vue-router";
import routes from "./routes";
import { parseSearch } from "@/service/utils";
import { isXyqb } from "@/service/validation";
import { authByxyqb } from "@/api/user";
import localStorage from "@/service/localStorage";
Vue.use(VueRouter); Vue.use(VueRouter);
const routes = [
{
path: "/",
name: "Default",
redirect: "/goods"
},
{
path: "/home",
name: "Home",
component: () => import("../views/Home/index.vue")
},
{
path: "/home/smart-measure",
name: "SmartMeasure",
component: () => import("../views/Home/SmartMeasure/index.vue")
},
{
path: "/goods",
name: "Goods",
component: () => import("../views/Goods/index.vue")
},
{
path: "/goods/detail",
name: "GoodsDetail",
component: () => import("../views/Goods/Detail/index.vue")
},
{
path: "/goods/plan",
name: "GoodsPlan",
component: () => import("../views/Goods/Plan/index.vue")
},
{
path: "/goods/inform",
name: "GoodsInform",
component: () => import("../views/Goods/Inform/index.vue")
},
{
path: "/consultant",
name: "Consultant",
component: () => import("../views/Consultant/index.vue")
},
{
path: "/consultant/plan",
name: "ConsultantPlan",
component: () => import("../views/Consultant/Plan/index.vue")
},
{
path: "/user",
name: "User",
component: () => import("../views/User/index.vue")
},
{
path: "/user/family",
name: "Family",
component: () => import("../views/User/Family/index.vue")
},
{
path: "/user/family/detail/:id",
name: "Family",
component: () => import("../views/User/Family/Detail/index.vue")
},
{
path: "/user/help-center",
name: "Family",
component: () => import("../views/User/HelpCenter/index.vue")
},
{
path: "/policy",
name: "Policy",
component: () => import("../views/Policy/index.vue")
},
{
path: "/policy/detail",
name: "Detail",
component: () => import("../views/Policy/Detail/index.vue")
},
{
path: "/policy/add",
name: "AddPolicy",
component: () => import("../views/Policy/Add/index.vue")
},
{
path: "/policy/payment-record",
name: "PaymentRecord",
component: () => import("../views/Policy/PaymentRecord/index.vue")
},
{
path: "/policy/renewal",
name: "Renewal",
component: () => import("../views/Policy/Renewal/index.vue")
},
{
path: "/introduction",
name: "Introduction",
component: () => import("../views/Introduction/index.vue")
},
{
path: "/paytest",
name: "Introduction",
component: () => import("../views/paytest")
},
{
path: "*",
redirect: "/goods"
}
];
const originalPush = VueRouter.prototype.push; const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) { VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err); return originalPush.call(this, location).catch(err => err);
}; };
...@@ -125,4 +21,20 @@ const router = new VueRouter({ ...@@ -125,4 +21,20 @@ const router = new VueRouter({
} }
}); });
router.beforeEach((to, from, next) => {
const urlParams = parseSearch(window.location.href);
if (isXyqb()) getAuthInfo(urlParams.token);
next();
});
async function getAuthInfo(xyqbToken) {
const res = await authByxyqb({ xyqbToken });
if (res) {
localStorage.set("mongoToken", res.token);
localStorage.set("xyqbUserInfo", res);
localStorage.set("xyqbToken", xyqbToken);
}
}
// router.afterEach(() => {});
export default router; export default router;
export default [
{
path: "/",
name: "Default",
redirect: "/goods"
},
{
path: "/home",
name: "Home",
component: () => import("../views/Home/index.vue")
},
{
path: "/home/smart-measure",
name: "SmartMeasure",
component: () => import("../views/Home/SmartMeasure/index.vue")
},
{
path: "/goods",
name: "Goods",
component: () => import("../views/Goods/index.vue")
},
{
path: "/goods/detail",
name: "GoodsDetail",
component: () => import("../views/Goods/Detail/index.vue")
},
{
path: "/goods/plan",
name: "GoodsPlan",
component: () => import("../views/Goods/Plan/index.vue")
},
{
path: "/goods/inform",
name: "GoodsInform",
component: () => import("../views/Goods/Inform/index.vue")
},
{
path: "/consultant",
name: "Consultant",
component: () => import("../views/Consultant/index.vue")
},
{
path: "/consultant/plan",
name: "ConsultantPlan",
component: () => import("../views/Consultant/Plan/index.vue")
},
{
path: "/user",
name: "User",
component: () => import("../views/User/index.vue")
},
{
path: "/user/family",
name: "Family",
component: () => import("../views/User/Family/index.vue")
},
{
path: "/user/family/detail/:id",
name: "Family",
component: () => import("../views/User/Family/Detail/index.vue")
},
{
path: "/user/help-center",
name: "Family",
component: () => import("../views/User/HelpCenter/index.vue")
},
{
path: "/policy",
name: "Policy",
component: () => import("../views/Policy/index.vue")
},
{
path: "/policy/detail",
name: "Detail",
component: () => import("../views/Policy/Detail/index.vue")
},
{
path: "/policy/add",
name: "AddPolicy",
component: () => import("../views/Policy/Add/index.vue")
},
{
path: "/policy/payment-record",
name: "PaymentRecord",
component: () => import("../views/Policy/PaymentRecord/index.vue")
},
{
path: "/policy/renewal",
name: "Renewal",
component: () => import("../views/Policy/Renewal/index.vue")
},
{
path: "/introduction",
name: "Introduction",
component: () => import("../views/Introduction/index.vue")
},
{
path: "/paytest",
name: "Introduction",
component: () => import("../views/paytest")
},
{
path: "*",
redirect: "/goods"
}
];
...@@ -100,23 +100,31 @@ export function filterEmoji(name) { ...@@ -100,23 +100,31 @@ export function filterEmoji(name) {
); );
return str; return str;
} }
/** /**
* xss处理 * hash路由获取url参数
* @param {String} s 输入字符串 * @param {String} searchString 输入字符串
* @return: {String} str 字符串 * @return: {String} str 字符串
*/ */
export function parseSearch(searchString) {
export function xssParse(str) { if (!searchString) {
return str return {};
? str.replace(/&((g|l|quo)t|amp|#39|nbsp);/g, function(m) { }
return { if (!searchString.includes("?")) {
"&lt;": "<", return {};
"&amp;": "&", }
"&quot;": '"', return searchString
"&gt;": ">", .split("?")[1]
"&#39;": "'", .split("#")[0]
"&nbsp;": " " .split("&")
}[m]; .reduce((result, next) => {
}) const pair = next.split("=");
: ""; try {
result[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
} catch (e) {
// eslint-disable-next-line
// result[decodeURIComponent(pair[0])] = window.$URL.decode(pair[1]);
}
return result;
}, {});
} }
...@@ -252,5 +252,10 @@ export function isBankNumber(str) { ...@@ -252,5 +252,10 @@ export function isBankNumber(str) {
// 判断微信环境 // 判断微信环境
export function isWeixinBrower() { export function isWeixinBrower() {
const ua = window.navigator.userAgent.toLowerCase(); const ua = window.navigator.userAgent.toLowerCase();
return ua.match(/MicroMessenger/i) == "micromessenger"; return ua.match(/MicroMessenger/i) === "micromessenger";
}
// 判断信用钱包环境
export function isXyqb() {
const ua = window.navigator.userAgent.toLowerCase();
return ua.match(/xyqb/i) === "xyqb";
} }
...@@ -8,7 +8,8 @@ export default new Vuex.Store({ ...@@ -8,7 +8,8 @@ export default new Vuex.Store({
state: { state: {
activeIdx: 0, activeIdx: 0,
isLoading: false, isLoading: false,
isShowLogin: false isShowLogin: false,
showAuthXyqb: true
}, },
mutations: { mutations: {
setActiveIdx(state, value) { setActiveIdx(state, value) {
...@@ -19,6 +20,9 @@ export default new Vuex.Store({ ...@@ -19,6 +20,9 @@ export default new Vuex.Store({
}, },
setIsShowLogin(state, value) { setIsShowLogin(state, value) {
state.isShowLogin = value; state.isShowLogin = value;
},
setShowAuthXyqb(state, value) {
state.showAuthXyqb = value;
} }
}, },
actions: { actions: {
...@@ -30,6 +34,9 @@ export default new Vuex.Store({ ...@@ -30,6 +34,9 @@ export default new Vuex.Store({
}, },
setIsShowLogin({ commit }, args) { setIsShowLogin({ commit }, args) {
commit("setIsShowLogin", args); commit("setIsShowLogin", args);
},
setShowAuthXyqb({ commit }, args) {
commit("setShowAuthXyqb", args);
} }
}, },
modules: { modules: {
......
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
background-color: #fff; background-color: #fff;
&-title { &-title {
.sub-text-mixins(); .sub-text-mixins();
text-align: center;
} }
.cr-button { .cr-button {
height: @button-large-height + 2; height: @button-large-height + 2;
......
...@@ -16,9 +16,15 @@ ...@@ -16,9 +16,15 @@
text-align: center; text-align: center;
a { a {
.sub-text-mixins(); .sub-text-mixins();
display: block;
margin-top: 15px;
} }
} }
&-body { &-body {
height: 230px;
@{deep} .cr-picker--content-choose {
display: none;
}
@{deep} .wheel-item { @{deep} .wheel-item {
font-size: 16px; font-size: 16px;
} }
...@@ -71,6 +77,7 @@ ...@@ -71,6 +77,7 @@
margin-top: 8px; margin-top: 8px;
color: @gray-4; color: @gray-4;
width: 100%; width: 100%;
height: 32px;
} }
.cul-inline { .cul-inline {
@{deep} .cr-radio { @{deep} .cr-radio {
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
} }
" "
v-show="currentStep === 1" v-show="currentStep === 1"
item-height="35"
:show-toolbar="false" :show-toolbar="false"
/> />
<cr-radio-btn <cr-radio-btn
...@@ -57,6 +58,7 @@ ...@@ -57,6 +58,7 @@
} }
" "
v-show="currentStep === 3" v-show="currentStep === 3"
item-height="35"
:show-toolbar="false" :show-toolbar="false"
/> />
<cr-picker <cr-picker
...@@ -68,6 +70,7 @@ ...@@ -68,6 +70,7 @@
} }
" "
v-show="currentStep === 4" v-show="currentStep === 4"
item-height="35"
:show-toolbar="false" :show-toolbar="false"
/> />
<cr-area <cr-area
...@@ -79,6 +82,7 @@ ...@@ -79,6 +82,7 @@
} }
" "
:columns-num="2" :columns-num="2"
item-height="35"
v-show="currentStep === 5" v-show="currentStep === 5"
/> />
<cr-radio-btn <cr-radio-btn
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment