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

feat: 顾问联调

parent 19b4137b
......@@ -5,14 +5,17 @@
<cr-loading class="loading" size="24px">加载中...</cr-loading>
</div>
<login-modal />
<auth-from-xyqb />
</div>
</template>
<script>
import { mapState, mapActions } from "vuex";
import LoginModal from "@/components/LoginModal";
import AuthFromXyqb from "@/components/AuthFromXyqb";
export default {
components: {
LoginModal
LoginModal,
AuthFromXyqb
},
computed: {
...mapState(["isLoading"])
......
......@@ -6,7 +6,7 @@ export const loginByPhone = param => {
};
// 信用钱包用户自动登录
export const loginByxyqb = param => {
export const authByxyqb = 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 {
if (res) {
this.$notify("登录成功");
this.setIsShowLogin(false);
localStorage.setItem("mongoToken", res.token);
// localStorage.setItem("mongoToken", res.token);
localStorage.setItem("mongoToken", "6ae7da7dd4c543f1a36c702c6f419f12");
}
},
async getCode() {
......
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"
};
import Vue from "vue";
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);
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;
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err);
};
......@@ -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 [
{
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) {
);
return str;
}
/**
* xss处理
* @param {String} s 输入字符串
* hash路由获取url参数
* @param {String} searchString 输入字符串
* @return: {String} str 字符串
*/
export function xssParse(str) {
return str
? str.replace(/&((g|l|quo)t|amp|#39|nbsp);/g, function(m) {
return {
"&lt;": "<",
"&amp;": "&",
"&quot;": '"',
"&gt;": ">",
"&#39;": "'",
"&nbsp;": " "
}[m];
})
: "";
export function parseSearch(searchString) {
if (!searchString) {
return {};
}
if (!searchString.includes("?")) {
return {};
}
return searchString
.split("?")[1]
.split("#")[0]
.split("&")
.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) {
// 判断微信环境
export function isWeixinBrower() {
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({
state: {
activeIdx: 0,
isLoading: false,
isShowLogin: false
isShowLogin: false,
showAuthXyqb: true
},
mutations: {
setActiveIdx(state, value) {
......@@ -19,6 +20,9 @@ export default new Vuex.Store({
},
setIsShowLogin(state, value) {
state.isShowLogin = value;
},
setShowAuthXyqb(state, value) {
state.showAuthXyqb = value;
}
},
actions: {
......@@ -30,6 +34,9 @@ export default new Vuex.Store({
},
setIsShowLogin({ commit }, args) {
commit("setIsShowLogin", args);
},
setShowAuthXyqb({ commit }, args) {
commit("setShowAuthXyqb", args);
}
},
modules: {
......
......@@ -66,6 +66,7 @@
background-color: #fff;
&-title {
.sub-text-mixins();
text-align: center;
}
.cr-button {
height: @button-large-height + 2;
......
......@@ -16,9 +16,15 @@
text-align: center;
a {
.sub-text-mixins();
display: block;
margin-top: 15px;
}
}
&-body {
height: 230px;
@{deep} .cr-picker--content-choose {
display: none;
}
@{deep} .wheel-item {
font-size: 16px;
}
......@@ -71,6 +77,7 @@
margin-top: 8px;
color: @gray-4;
width: 100%;
height: 32px;
}
.cul-inline {
@{deep} .cr-radio {
......
......@@ -40,6 +40,7 @@
}
"
v-show="currentStep === 1"
item-height="35"
:show-toolbar="false"
/>
<cr-radio-btn
......@@ -57,6 +58,7 @@
}
"
v-show="currentStep === 3"
item-height="35"
:show-toolbar="false"
/>
<cr-picker
......@@ -68,6 +70,7 @@
}
"
v-show="currentStep === 4"
item-height="35"
:show-toolbar="false"
/>
<cr-area
......@@ -79,6 +82,7 @@
}
"
:columns-num="2"
item-height="35"
v-show="currentStep === 5"
/>
<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