Commit a4cabe6e authored by 郭志伟's avatar 郭志伟

fix(share): 问题修复

parent 3a426459
...@@ -59,12 +59,16 @@ export default { ...@@ -59,12 +59,16 @@ export default {
request(cfg) { request(cfg) {
const { method, hideVccChannel } = cfg; const { method, hideVccChannel } = cfg;
cfg.headers['X-Auth-Token'] = localStorage.get('vccToken') || ''; cfg.headers['X-Auth-Token'] = localStorage.get('vccToken') || '';
cfg.headers['version'] = '8.2.00';
if (cfg.customHeader) { if (cfg.customHeader) {
Object.assign(cfg.headers, cfg.customHeader); Object.assign(cfg.headers, cfg.customHeader);
} }
if (cfg.creditToken) { if (cfg.creditToken) {
cfg.headers['X-Auth-Token'] = localStorage.get('creditToken'); cfg.headers['X-Auth-Token'] = localStorage.get('creditToken');
} }
if (!cfg.hideTerminal) {
cfg.headers['x-user-terminal'] = isWxMp ? 'MINI-APP' : 'H5'; // 全局暂定H5
}
if (!hideVccChannel) { if (!hideVccChannel) {
cfg.headers['vccChannel'] = getVccChannel(); cfg.headers['vccChannel'] = getVccChannel();
cfg.headers['sonVccChannel'] = getVccChannel('sonVccChannel'); cfg.headers['sonVccChannel'] = getVccChannel('sonVccChannel');
...@@ -76,32 +80,4 @@ export default { ...@@ -76,32 +80,4 @@ export default {
return cfg; return cfg;
} }
} }
// unique: {
// response(res) {
// const { data, config } = res;
// if (data.code === 0) {
// return [data.data, null];
// }
// if (!config.hideToast) {
// Toast(data.msg);
// }
// let error = new Error(data.msg);
// error.response = data;
// console.error(error);
// return [null, error];
// },
// request(cfg) {
// const { method } = cfg;
// cfg.headers['X-Auth-Token'] = localStorage.get('vccToken') || '';
// if (cfg.creditToken) {
// cfg.headers['X-Auth-Token'] = localStorage.get('creditToken');
// }
// cfg.headers['vccChannel'] = getVccChannel();
// if (method === 'post' && cfg.emulateJSON) {
// cfg.headers['Content-Type'] = 'application/x-www-form-urlencoded';
// cfg.data = getURLSearchParams(cfg.data);
// }
// return cfg;
// }
// }
}; };
<template>
<wx-open-launch-app
class="launch-btn"
@launch="launch"
@error="launchError"
id="launch-btn"
appid="wx75d5a207551d0b4d"
:extinfo="extinfo"
>
<script type="text/wxtag-template">
<style>.btn {height: 100vh;width: 100vw;}</style>
<div class="btn">打开APP</div>
</script>
</wx-open-launch-app>
</template>
<script>
import { navToDlApp } from '@qg/citrus-ui/src/helper/service/utils';
export default {
name: "LaunchApp",
props: {
jumpUrl: String,
appSchema: String
},
computed: {
extinfo() {
return JSON.stringify({
url: this.jumpUrl,
data: {}
});
}
},
methods: {
launch() {
setTimeout(() => {
navToDlApp();
}, 2500);
window.location.href = this.appSchema;
},
launchError(e) {
if (e.detail.errMsg === "launch:fail") {
navToDlApp();
}
},
}
};
</script>
<style lang="less">
.launch-btn {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
opacity: 0;
z-index: 100;
left: 0;
}
</style>
<template>
<wx-open-launch-weapp
class="launch-btn"
username="gh_a976018bfb9e"
:path="jumpUrl"
@launch="launch"
@error="launchError"
>
<script type="text/wxtag-template">
<style>.btn {height: 100vh;width: 100vw;}</style>
<div class="btn">打开小程序</div>
</script>
</wx-open-launch-weapp>
</template>
<script>
export default {
name: "LaunchWeapp",
props: {
jumpUrl: String
},
data() {
return {};
},
methods: {
launch() {
console.log("launch");
},
launchError() {
console.log("launchError");
}
}
};
</script>
<style lang="less">
.launch-btn {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
opacity: 0;
z-index: 100;
left: 0;
}
</style>
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<script> <script>
import Bridge from '@qg/js-bridge'; import Bridge from '@qg/js-bridge';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
import { isApp, isWxMp, debounce, isWechat, isH5Normal } from '@/service/utils.service'; import { isApp, isWxMp, debounce, isWechat, isH5Normal, isDef } from '@/service/utils.service';
import { registeredEvents } from '@/service/sa.service'; import { registeredEvents } from '@/service/sa.service';
import api from '@/api/editor.api'; import api from '@/api/editor.api';
import cfg from '@/config/index'; import cfg from '@/config/index';
...@@ -61,9 +61,9 @@ export default { ...@@ -61,9 +61,9 @@ export default {
computed: { computed: {
...mapGetters(['pageData', 'pageInfo']), ...mapGetters(['pageData', 'pageInfo']),
backTopList() { backTopList() {
const btAttachVal = this.pageData && this.pageData.props.btAttachVal ? this.pageData.props.btAttachVal : []; const btAttachVal = this.pageData.props?.btAttachVal || [];
if (this.cartIndex !== null && btAttachVal.length) { if (isDef(this.cartIndex) && btAttachVal.length) {
btAttachVal[this.cartIndex - 1].info = this.cartCount; btAttachVal[this.cartIndex].info = this.cartCount;
} }
return isApp ? btAttachVal : isWxMp ? btAttachVal.filter(item => item.persets !== '购物车') : []; return isApp ? btAttachVal : isWxMp ? btAttachVal.filter(item => item.persets !== '购物车') : [];
// if (this.pageData.props && this.pageData.props.btAttachVal) { // if (this.pageData.props && this.pageData.props.btAttachVal) {
...@@ -86,10 +86,13 @@ export default { ...@@ -86,10 +86,13 @@ export default {
}, },
watch: { watch: {
backTopList(val) { backTopList: {
this.cartIndex = (val || []).findIndex(item => item.persets === '购物车') + 1; immediate: true,
handler(val) {
this.cartIndex = (val || []).findIndex(item => item.persets === '购物车');
this.getCartCountDebounce(); this.getCartCountDebounce();
} }
}
}, },
created() { created() {
if (!EASY_ENV_IS_NODE) { if (!EASY_ENV_IS_NODE) {
...@@ -186,7 +189,7 @@ export default { ...@@ -186,7 +189,7 @@ export default {
}, 10000); }, 10000);
}, },
async getCartCount() { async getCartCount() {
if (localStorage.get('vccToken') && this.cartIndex && isApp) { if (localStorage.get('vccToken') && isDef(this.cartIndex) && isApp) {
const [res] = await api.getShopCartCount(); const [res] = await api.getShopCartCount();
this.cartCount = res.count; this.cartCount = res.count;
this.$nextTick(() => { this.$nextTick(() => {
......
...@@ -137,7 +137,7 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin, Disab ...@@ -137,7 +137,7 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin, Disab
layoutReadyEvent(newLayout) { layoutReadyEvent(newLayout) {
this.$nextTick(() => { this.$nextTick(() => {
const loadingEle = document.querySelector('.mainload'); const loadingEle = document.querySelector('.mainload');
console.log('loadingEle', loadingEle); // console.log('loadingEle', loadingEle);
if (!loadingEle) { return; } if (!loadingEle) { return; }
loadingEle.style.display = 'none'; loadingEle.style.display = 'none';
if (isApp) { if (isApp) {
...@@ -153,13 +153,13 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin, Disab ...@@ -153,13 +153,13 @@ export default class Activity extends Mixins(TransformStyleMixin, SaMixin, Disab
}); });
} }
setGridItemTransform(index, status) { setGridItemTransform(index, status) {
console.log('setGridItemTransform', index, status); // console.log('setGridItemTransform', index, status);
const elements = JSON.parse(JSON.stringify(this.pageData?.elements)); const elements = JSON.parse(JSON.stringify(this.pageData?.elements));
elements[index].noTransforms = status; elements[index].noTransforms = status;
this.setPageElement(elements); this.setPageElement(elements);
} }
layoutUpdatedEvent() { layoutUpdatedEvent() {
console.log('layoutUpdatedEvent'); // console.log('layoutUpdatedEvent');
// 高度更新时重新计算导航组件样式 // 高度更新时重新计算导航组件样式
this.modfiTabsStyleDebounce(); this.modfiTabsStyleDebounce();
} }
......
...@@ -39,7 +39,7 @@ export default class TransformStyleMixin extends Vue { ...@@ -39,7 +39,7 @@ export default class TransformStyleMixin extends Vue {
const calcHeight = +height + (component.commonStyle.paddingTop || 0) + (component.commonStyle.paddingBottom || 0); const calcHeight = +height + (component.commonStyle.paddingTop || 0) + (component.commonStyle.paddingBottom || 0);
const point = { ...component.point, h: component.name === 'cs-goods-tabs' ? Math.floor(+calcHeight) : Math.ceil(+calcHeight) }; const point = { ...component.point, h: component.name === 'cs-goods-tabs' ? Math.floor(+calcHeight) : Math.ceil(+calcHeight) };
this.setElementPoint({ id: eleId, data: point }); this.setElementPoint({ id: eleId, data: point });
console.log('adjustHeight', height, component, element.getAttribute('id'), point); // console.log('adjustHeight', height, component, element.getAttribute('id'), point);
} }
} }
...@@ -8,7 +8,6 @@ Vue.use(Vuex); ...@@ -8,7 +8,6 @@ Vue.use(Vuex);
export default function createStore(initState: any = {}) { export default function createStore(initState: any = {}) {
const { title, url, origin, locale, csrf, activity } = initState; const { title, url, origin, locale, csrf, activity } = initState;
console.log('store', title, url, origin, locale, csrf, activity);
const state = { title, url, origin, locale, csrf }; const state = { title, url, origin, locale, csrf };
return new Vuex.Store<RootState>({ return new Vuex.Store<RootState>({
state, state,
......
import Vue from 'vue'; import Vue from 'vue';
// import {
// Button,
// Image,
// Icon,
// Cell,
// CellGroup,
// Row,
// Col,
// Dialog,
// Popup,
// Overlay,
// Divider,
// Loading,
// Picker,
// NavBar,
// Field,
// Checkbox,
// CardList,
// List,
// Form,
// Sticky,
// Tab,
// Tabs,
// Notify,
// Swipe,
// SwipeItem,
// Toast,
// BackTop,
// } from '@qg/cherry-ui';
// import { KaLoginForm } from '@qg/citrus-ui';
import Button from '@qg/cherry-ui/src/button'; import Button from '@qg/cherry-ui/src/button';
import Image from '@qg/cherry-ui/src/image'; import Image from '@qg/cherry-ui/src/image';
import Field from '@qg/cherry-ui/src/field'; import Field from '@qg/cherry-ui/src/field';
...@@ -45,34 +16,18 @@ import Tag from '@qg/cherry-ui/src/tag'; ...@@ -45,34 +16,18 @@ import Tag from '@qg/cherry-ui/src/tag';
import Popover from '@qg/cherry-ui/src/popover'; import Popover from '@qg/cherry-ui/src/popover';
import Icon from '@qg/cherry-ui/src/icon'; import Icon from '@qg/cherry-ui/src/icon';
import Empty from '@qg/cherry-ui/src/empty'; import Empty from '@qg/cherry-ui/src/empty';
import NoticeBar from '@qg/cherry-ui/src/notice-bar';
Vue.use(Button); Vue.use(Button);
Vue.use(Image); Vue.use(Image);
Vue.use(Popover); Vue.use(Popover);
Vue.use(Icon); Vue.use(Icon);
// Vue.use(Cell); Vue.use(NoticeBar);
// Vue.use(CellGroup);
// Vue.use(Row);
// Vue.use(Col);
// Vue.use(Popup);
// Vue.use(Divider);
// Vue.use(Picker);
Vue.use(Field); Vue.use(Field);
// Vue.use(Dialog);
// Vue.use(Checkbox);
// Vue.use(Icon);
// Vue.use(Sticky);
// Vue.use(Overlay);
Vue.use(Form); Vue.use(Form);
// Vue.use(CardList);
Vue.use(Loading); Vue.use(Loading);
// Vue.use(List);
Vue.use(Tab); Vue.use(Tab);
Vue.use(Tabs); Vue.use(Tabs);
// Vue.use(Toast);
// Vue.use(Swipe);
// Vue.use(SwipeItem);
// Vue.use(Swipe);
Vue.use(BackTop); Vue.use(BackTop);
Vue.use(Text); Vue.use(Text);
Vue.use(Tag); Vue.use(Tag);
......
...@@ -31,6 +31,10 @@ export function isNull(str) { ...@@ -31,6 +31,10 @@ export function isNull(str) {
return str === undefined || str.length === 0 || str === null; return str === undefined || str.length === 0 || str === null;
} }
export function isDef(val) {
return val !== undefined && val !== null;
}
// 判断手机号 // 判断手机号
export function isPhone(str) { export function isPhone(str) {
if (!isNull(str)) { if (!isNull(str)) {
......
...@@ -1658,12 +1658,12 @@ ...@@ -1658,12 +1658,12 @@
} }
}, },
"@qg/citrus-ui": { "@qg/citrus-ui": {
"version": "0.3.3", "version": "0.3.4",
"resolved": "http://npmprivate.quantgroups.com/@qg%2fcitrus-ui/-/citrus-ui-0.3.3.tgz", "resolved": "http://npmprivate.quantgroups.com/@qg%2fcitrus-ui/-/citrus-ui-0.3.4.tgz",
"integrity": "sha512-4v7SS9FWso7wi0sY9972N1w8jVvaItZkC+es2PN9a1DHcr8vCcawPfSA6EUPqGJ7q15J7q/aRzDXHhhzLe12Dg==", "integrity": "sha512-H7ddsQRKQoTJ/FUg9Q8XZT91UkKcBkQsQW5eKuQPJuUkpY4X52WrHnv2uYbFo0ObyKpUBy1xSxHZbbzHubD79w==",
"requires": { "requires": {
"@better-scroll/core": "^2.1.1", "@better-scroll/core": "^2.1.1",
"@qg/cherry-ui": "^2.23.4", "@qg/cherry-ui": "2.23.7",
"@qg/js-bridge": "^1.1.12", "@qg/js-bridge": "^1.1.12",
"axios": "^0.21.1", "axios": "^0.21.1",
"intersection-observer": "^0.12.0", "intersection-observer": "^0.12.0",
...@@ -20930,9 +20930,9 @@ ...@@ -20930,9 +20930,9 @@
} }
}, },
"sa-sdk-javascript": { "sa-sdk-javascript": {
"version": "1.18.20", "version": "1.19.1",
"resolved": "http://npmprivate.quantgroups.com/sa-sdk-javascript/-/sa-sdk-javascript-1.18.20.tgz", "resolved": "http://npmprivate.quantgroups.com/sa-sdk-javascript/-/sa-sdk-javascript-1.19.1.tgz",
"integrity": "sha1-3KfWiUu3mO2Eh5yWBY8heF92uAg=" "integrity": "sha1-poxgBrZqU8UnTbGXyGCokDgVELU="
}, },
"safe-buffer": { "safe-buffer": {
"version": "5.2.1", "version": "5.2.1",
......
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