修改高德地图key更新此commit 之前请务必确认一下创建的高德key日期。修改部分方法名称

master
lemon橪 2022-05-20 16:40:09 +08:00
parent 32dffe96ed
commit 1b4c05f70b
10 changed files with 98 additions and 106 deletions

View File

@ -1,40 +1,39 @@
<template> <template>
<div id="app"> <div id="app">
<router-view/> <router-view />
</div> </div>
</template> </template>
<script> <script>
import storage from "@/plugins/storage";
import storage from '@/plugins/storage'; import { getBaseSite } from "@/api/common.js";
import { getLogoImg} from '@/api/common.js';
export default { export default {
name: 'App', name: "App",
mounted(){ mounted() {
//LOGO //
getLogoImg().then(res => { getBaseSite().then((res) => {
if(res.success&&res.result.settingValue){ if (res.success && res.result.settingValue) {
let data = JSON.parse(res.result.settingValue); let data = JSON.parse(res.result.settingValue);
this.$store.commit("SET_LOGOIMG", data.buyerSideLogo); this.$store.commit("SET_LOGOIMG", data.buyerSideLogo);
this.$store.commit("SET_SITENAME", data.siteName); this.$store.commit("SET_SITENAME", data.siteName);
storage.setItem("siteName", data.siteName); storage.setItem("siteName", data.siteName);
window.document.title = data.siteName; window.document.title = data.siteName;
//icon //icon
let link = let link =
document.querySelector("link[rel*='icon']") || document.querySelector("link[rel*='icon']") ||
document.createElement("link"); document.createElement("link");
link.type = "image/x-icon"; link.type = "image/x-icon";
link.href = data.buyerSideLogo; link.href = data.buyerSideLogo;
link.rel = "shortcut icon"; link.rel = "shortcut icon";
document.getElementsByTagName("head")[0].appendChild(link); document.getElementsByTagName("head")[0].appendChild(link);
} }
}) });
} },
}; };
</script> </script>
<style lang="scss"> <style lang="scss">
#app{ #app {
@include background_color($light_background_color); @include background_color($light_background_color);
} }
</style> </style>

View File

@ -32,16 +32,7 @@ export function sendSms (params) {
params params
}); });
} }
/**
* 获取logo图标
*/
export function getLogo () {
return request({
url: `${commonUrl}/common/logo`,
method: Method.GET,
needToken: false
});
}
// 地区数据,用于三级联动 // 地区数据,用于三级联动
export function getRegion (id) { export function getRegion (id) {
return request({ return request({
@ -95,9 +86,9 @@ export function getIMDetail () {
//获取图片logo //获取图片logo
export function getLogoImg(){ export function getBaseSite(){
return request ({ return request ({
url:`${commonUrl}/common/common/logo`, url:`${commonUrl}/common/common/site`,
method: Method.GET, method: Method.GET,
needToken: false needToken: false
}) })

View File

@ -12,14 +12,10 @@ module.exports = {
* 高德地图申请链接 * 高德地图申请链接
* https://lbs.amap.com/api/javascript-api/guide/abc/prepare * https://lbs.amap.com/api/javascript-api/guide/abc/prepare
* 添加成功后可获取到key值和安全密钥jscode自2021年12月02日升级升级之后所申请的 key 必须配备安全密钥 jscode 一起使用) * 添加成功后可获取到key值和安全密钥jscode自2021年12月02日升级升级之后所申请的 key 必须配备安全密钥 jscode 一起使用)
* 如果是2021年12月02日之后的需要在main.js中添加如下代码
* window._AMapSecurityConfig = {
* securityJsCode:'您申请的安全密钥',
* }
*
* 如果2021年12月02日之前申请的无视上面代码
*/ */
aMapKey: "b440952723253aa9fe483e698057bf7d", //高德web端申请的api key //FIXME 请检查当前高德key创建的日期如果2021年12月02日之前申请的 无需填写安全密钥
aMapSecurityJsCode:"2bd0fbf621881f4c77be74f0e76495f3", // 高德web端js申请的安全密钥
aMapKey: "7f11113750315d8543daaf5c3ba353ca", //高德web端js申请的api key
enableCDN: true, //生产环境 是否启用cdn加载 vue等js enableCDN: true, //生产环境 是否启用cdn加载 vue等js
port: 10000, //端口 port: 10000, //端口
}; };

View File

@ -1,54 +1,65 @@
import Vue from 'vue'; import Vue from "vue";
import App from './App'; import App from "./App";
import router from './router'; import router from "./router";
import ViewUI from 'view-design'; import ViewUI from "view-design";
import './assets/styles/theme.less'; import "./assets/styles/theme.less";
// import './assets/iconfont/iconfont.css'; // import './assets/iconfont/iconfont.css';
import * as filters from './plugins/filters'; import * as filters from "./plugins/filters";
import store from '@/vuex/store' import store from "@/vuex/store";
import storage from '@/plugins/storage'; import storage from "@/plugins/storage";
// 全局引入封装组件 // 全局引入封装组件
import {InstallAll} from '@/components/global.js'; import { InstallAll } from "@/components/global.js";
let title = require('@/config').title const { aMapSecurityJsCode, title } = require("@/config");
Vue.use(ViewUI); Vue.use(ViewUI);
Vue.use(InstallAll); Vue.use(InstallAll);
Vue.config.productionTip = false; Vue.config.productionTip = false;
Object.keys(filters).forEach(key => { Object.keys(filters).forEach((key) => {
Vue.filter(key, filters[key]); Vue.filter(key, filters[key]);
}); });
// 高德安全密钥
if (aMapSecurityJsCode) {
window._AMapSecurityConfig = {
securityJsCode: aMapSecurityJsCode,
};
}
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
ViewUI.LoadingBar.start(); ViewUI.LoadingBar.start();
window.document.title = to.meta.title === undefined ? title : to.meta.title window.document.title = to.meta.title === undefined ? title : to.meta.title;
next(); next();
}); });
router.afterEach(route => { router.afterEach((route) => {
ViewUI.LoadingBar.finish(); ViewUI.LoadingBar.finish();
}); });
Vue.prototype.linkTo = function (url) { Vue.prototype.linkTo = function (url) {
if (url.substr(0, 1) === '/') { // 非外部链接没有origin只有路由地址 if (url.substr(0, 1) === "/") {
if (router.mode === 'hash') { // 非外部链接没有origin只有路由地址
window.open(location.origin + '/#' + url, '_blank'); if (router.mode === "hash") {
window.open(location.origin + "/#" + url, "_blank");
} else { } else {
window.open(location.origin + url, '_blank'); window.open(location.origin + url, "_blank");
} }
} else { // 外部链接完整的url地址 } else {
window.open(url, '_blank') // 外部链接完整的url地址
window.open(url, "_blank");
} }
} };
// 联系客服 // 联系客服
Vue.prototype.connectCs = function (sign = '37ef9b97807d03c6741298ed4eb5b536d2d238e08a3c00fb01fe48f03a569974c99ad767e72c04b3165ef29aca2c488b505fe4ca') { Vue.prototype.connectCs = function (
const url = 'https://yzf.qq.com/xv/web/static/chat/index.html?sign=' + sign sign = "37ef9b97807d03c6741298ed4eb5b536d2d238e08a3c00fb01fe48f03a569974c99ad767e72c04b3165ef29aca2c488b505fe4ca"
window.open(url, '_blank') ) {
} const url = "https://yzf.qq.com/xv/web/static/chat/index.html?sign=" + sign;
Vue.prototype.Cookies = storage window.open(url, "_blank");
};
Vue.prototype.Cookies = storage;
/* eslint-disable no-new */ /* eslint-disable no-new */
new Vue({ new Vue({
router, router,
store, store,
render: h => h(App) render: (h) => h(App),
}).$mount("#app") }).$mount("#app");

View File

@ -19,12 +19,9 @@ export const getVerifyImg = (verificationEnums) => {
export const postVerifyImg = (params) => { export const postVerifyImg = (params) => {
return postRequestWithNoToken(`${commonUrl}/common/common/slider/${params.verificationEnums}`, params); return postRequestWithNoToken(`${commonUrl}/common/common/slider/${params.verificationEnums}`, params);
}; };
//获取LOGO
export const getLogo = ()=>{
return getRequest (`${commonUrl}/common/common/logo`);
};
// 获取系统基础信息 // 获取系统基础信息
export const getSetsite = () => { export const getBaseSite = () => {
return getRequest(`${commonUrl}/common/common/site`); return getRequest(`${commonUrl}/common/common/site`);
}; };

View File

@ -4,14 +4,10 @@ module.exports = {
* 高德地图申请链接 * 高德地图申请链接
* https://lbs.amap.com/api/javascript-api/guide/abc/prepare * https://lbs.amap.com/api/javascript-api/guide/abc/prepare
* 添加成功后可获取到key值和安全密钥jscode自2021年12月02日升级升级之后所申请的 key 必须配备安全密钥 jscode 一起使用) * 添加成功后可获取到key值和安全密钥jscode自2021年12月02日升级升级之后所申请的 key 必须配备安全密钥 jscode 一起使用)
* 如果是2021年12月02日之后的需要在main.js中添加如下代码
* window._AMapSecurityConfig = {
* securityJsCode:'您申请的安全密钥',
* }
*
* 如果2021年12月02日之前申请的无视上面代码
*/ */
aMapKey: "b440952723253aa9fe483e698057bf7d", //FIXME 请检查当前高德key创建的日期如果2021年12月02日之前申请的 无需填写安全密钥
aMapSecurityJsCode:"2bd0fbf621881f4c77be74f0e76495f3", // 高德web端js申请的安全密钥
aMapKey: "7f11113750315d8543daaf5c3ba353ca", //高德web端js申请的api key
website: "https://www.pickmall.cn", //官网地址 website: "https://www.pickmall.cn", //官网地址
enableCDN: true, //生产环境 是否启用cdn加载 vue等js enableCDN: true, //生产环境 是否启用cdn加载 vue等js
port: 10003, //端口 port: 10003, //端口

View File

@ -24,6 +24,14 @@ import {md5} from '@/utils/md5.js';
// 打印 // 打印
import Print from 'vue-print-nb'; import Print from 'vue-print-nb';
Vue.use(Print); Vue.use(Print);
const { aMapSecurityJsCode } = require("@/config");
// 高德安全密钥
if (aMapSecurityJsCode) {
window._AMapSecurityConfig = {
securityJsCode: aMapSecurityJsCode,
};
}
Vue.config.devtools = true; Vue.config.devtools = true;
Vue.config.productionTip = false Vue.config.productionTip = false

View File

@ -84,7 +84,7 @@ import circleLoading from "@/views/my-components/lili/circle-loading.vue";
import Cookies from "js-cookie"; import Cookies from "js-cookie";
import util from "@/libs/util.js"; import util from "@/libs/util.js";
import { getNoticePage, logout } from "@/api/index"; import { getNoticePage, logout } from "@/api/index";
import { getLogo, getSetsite } from "@/api/common"; import { getBaseSite } from "@/api/common";
var client; var client;
export default { export default {
@ -130,18 +130,15 @@ export default {
this.sliceNum = 2; this.sliceNum = 2;
} }
//domainLogo //domainLogo
getSetsite().then((res) => { getBaseSite().then((res) => {
const { domainLogo, siteName } = JSON.parse(res.result.settingValue); const { domainLogo, siteName } = JSON.parse(res.result.settingValue);
// console.log(data, "ressss");
//list:res.result.settingValue.join(",")
this.domainLogo = domainLogo; this.domainLogo = domainLogo;
//icon //icon
this.setStore("icon", this.domainLogo); this.setStore("icon", this.domainLogo);
// this.domainLogo = this.domainLogo;
let link = let link =
document.querySelector("link[rel*='icon']") || document.querySelector("link[rel*='icon']") ||
document.ceateElement("link"); document.createElement("link");
link.type = "image/x-icon"; link.type = "image/x-icon";
link.href = this.domainLogo; link.href = this.domainLogo;
link.rel = "shortcut icon"; link.rel = "shortcut icon";
@ -150,13 +147,7 @@ export default {
this.setStore("title", siteName); this.setStore("title", siteName);
window.document.title = siteName + " - 运营后台"; window.document.title = siteName + " - 运营后台";
}), }),
getLogo().then((res) => {
if (res.success && res.result.settingValue) {
let data = JSON.parse(res.result.settingValue);
console.log(data);
}
});
// //
getNoticePage({}).then((res) => { getNoticePage({}).then((res) => {
if (res.success) { if (res.success) {

View File

@ -1,17 +1,13 @@
module.exports = { module.exports = {
title: "lilishop", //配置显示在浏览器标签的title title: "lilishop", //配置显示在浏览器标签的title
/** /**
* 高德地图申请链接 * 高德地图申请链接
* https://lbs.amap.com/api/javascript-api/guide/abc/prepare * https://lbs.amap.com/api/javascript-api/guide/abc/prepare
* 添加成功后可获取到key值和安全密钥jscode自2021年12月02日升级升级之后所申请的 key 必须配备安全密钥 jscode 一起使用) * 添加成功后可获取到key值和安全密钥jscode自2021年12月02日升级升级之后所申请的 key 必须配备安全密钥 jscode 一起使用)
* 如果是2021年12月02日之后的需要在main.js中添加如下代码
* window._AMapSecurityConfig = {
* securityJsCode:'您申请的安全密钥',
* }
*
* 如果2021年12月02日之前申请的无视上面代码
*/ */
aMapKey: "b440952723253aa9fe483e698057bf7d", //高德web端申请的api key //FIXME 请检查当前高德key创建的日期如果2021年12月02日之前申请的 无需填写安全密钥
aMapSecurityJsCode:"2bd0fbf621881f4c77be74f0e76495f3", // 高德web端js申请的安全密钥
aMapKey: "7f11113750315d8543daaf5c3ba353ca", //高德web端js申请的api key
website: "https://www.pickmall.cn", //官网地址 website: "https://www.pickmall.cn", //官网地址
enableCDN: true, //生产环境 是否启用cdn加载 vue等js enableCDN: true, //生产环境 是否启用cdn加载 vue等js
port: 10002, //端口 port: 10002, //端口

View File

@ -27,6 +27,13 @@ import VueLazyload from "vue-lazyload";
import * as filters from "@/utils/filters"; // global filter import * as filters from "@/utils/filters"; // global filter
import { md5 } from "@/utils/md5.js"; import { md5 } from "@/utils/md5.js";
const { aMapSecurityJsCode } = require("@/config");
// 高德安全密钥
if (aMapSecurityJsCode) {
window._AMapSecurityConfig = {
securityJsCode: aMapSecurityJsCode,
};
}
Vue.config.devtools = true; Vue.config.devtools = true;
Vue.config.productionTip = false; Vue.config.productionTip = false;
Vue.use(VueLazyload, { Vue.use(VueLazyload, {
@ -84,7 +91,7 @@ new Vue({
mounted() { mounted() {
// 初始化菜单 // 初始化菜单
util.initRouter(this); util.initRouter(this);
this.currentPageName = this.$route.name; this.currentPageName = this.$route.name;
// 显示打开的页面的列表 // 显示打开的页面的列表
this.$store.commit("setOpenedList"); this.$store.commit("setOpenedList");