mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2026-01-07 13:38:10 +00:00
update uni-app
This commit is contained in:
parent
e0b9bb5804
commit
78abbed304
@ -71,4 +71,8 @@
|
|||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<style>
|
||||||
|
uni-page-head {
|
||||||
|
display: none!important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -75,4 +75,11 @@ export function fetchBase64Image(data : AnyObject) {
|
|||||||
*/
|
*/
|
||||||
export function getSiteInfo() {
|
export function getSiteInfo() {
|
||||||
return request.get('site')
|
return request.get('site')
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取微信小程序订阅消息模板id
|
||||||
|
*/
|
||||||
|
export function getWeappTemplateId(keys: string) {
|
||||||
|
return request.get('weapp/subscribemsg', { keys })
|
||||||
}
|
}
|
||||||
@ -21,12 +21,12 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// 文章
|
// 文章
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed, watch } from 'vue';
|
||||||
import { redirect, img } from '@/utils/common';
|
import { redirect, img } from '@/utils/common';
|
||||||
import useDiyStore from '@/stores/diy';
|
import useDiyStore from '@/stores/diy';
|
||||||
import { getArticleAll } from '@/api/article';
|
import { getArticleAll } from '@/api/article';
|
||||||
|
|
||||||
const props = defineProps(['component', 'index']);
|
const props = defineProps(['component', 'index', 'pullDownRefresh']);
|
||||||
const diyStore = useDiyStore();
|
const diyStore = useDiyStore();
|
||||||
const articleList = ref<Array<any>>([]);
|
const articleList = ref<Array<any>>([]);
|
||||||
|
|
||||||
@ -58,6 +58,13 @@
|
|||||||
return style;
|
return style;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.pullDownRefresh,
|
||||||
|
(newValue, oldValue) => {
|
||||||
|
// 处理下拉刷新业务
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
const getArticleListFn = () => {
|
const getArticleListFn = () => {
|
||||||
interface dataStructure {
|
interface dataStructure {
|
||||||
ids ?: Array<number>,
|
ids ?: Array<number>,
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
{{diyComponent.navTitle}}
|
{{diyComponent.navTitle}}
|
||||||
</div>
|
</div>
|
||||||
<view v-if="diyComponent.layout == 'vertical'" class="graphic-nav">
|
<view v-if="diyComponent.layout == 'vertical'" class="graphic-nav">
|
||||||
<view class="graphic-nav-item" v-for=" (item, index) in diyComponent.list" :key="item.id">
|
<view class="graphic-nav-item" v-for="(item, index) in diyComponent.list" :key="item.id">
|
||||||
|
|
||||||
<app-link :data="item.link" class="flex items-center justify-between py-[30rpx] px-[32rpx]"
|
<app-link :data="item.link" class="flex items-center justify-between py-[30rpx] px-[32rpx]"
|
||||||
:class="[index == 0 ? 'border-t-0':'border-t']">
|
:class="[index == 0 ? 'border-t-0':'border-t']">
|
||||||
@ -39,25 +39,17 @@
|
|||||||
:style="{ height: swiperHeight }" @change="swiperChange">
|
:style="{ height: swiperHeight }" @change="swiperChange">
|
||||||
<swiper-item class="graphic-nav-wrap flex flex-wrap"
|
<swiper-item class="graphic-nav-wrap flex flex-wrap"
|
||||||
v-for="(numItem, numIndex) in Math.ceil(diyComponent.list.length / (diyComponent.pageCount * diyComponent.rowCount))">
|
v-for="(numItem, numIndex) in Math.ceil(diyComponent.list.length / (diyComponent.pageCount * diyComponent.rowCount))">
|
||||||
<!-- #ifdef MP-WEIXIN -->
|
|
||||||
|
|
||||||
<view class="graphic-nav-item" :class="[diyComponent.mode]" v-for=" (item, index) in diyComponent.list"
|
<template v-for="(item, index) in diyComponent.list">
|
||||||
:key="item.id"
|
|
||||||
v-if="index >= [(numItem) * (diyComponent.pageCount * diyComponent.rowCount)] && index < [(numItem+1) * (diyComponent.pageCount * diyComponent.rowCount)]"
|
<view class="graphic-nav-item" :class="[diyComponent.mode]" :key="item.id"
|
||||||
:style="{ width: 100 / diyComponent.rowCount + '%' }">
|
v-if="swiperCondition(index,numItem)" :style="{ width: 100 / diyComponent.rowCount + '%' }">
|
||||||
<!-- #endif -->
|
|
||||||
<!-- #ifdef H5 -->
|
|
||||||
<view class="graphic-nav-item" :class="[diyComponent.mode]"
|
|
||||||
v-for=" (item, index) in diyComponent.list" :key="item.id"
|
|
||||||
v-if="index >= [(numItem - 1) * (diyComponent.pageCount * diyComponent.rowCount)] && index < [numItem * (diyComponent.pageCount * diyComponent.rowCount)]"
|
|
||||||
:style="{ width: 100 / diyComponent.rowCount + '%' }">
|
|
||||||
<!-- #endif -->
|
|
||||||
|
|
||||||
<app-link :data="item.link" class="flex flex-col items-center box-border py-2">
|
<app-link :data="item.link" class="flex flex-col items-center box-border py-2">
|
||||||
|
|
||||||
<view class="graphic-img relative flex items-center justify-center w-10 h-10"
|
<view class="graphic-img relative flex items-center justify-center w-10 h-10"
|
||||||
v-if="diyComponent.mode != 'text'"
|
v-if="diyComponent.mode != 'text'"
|
||||||
:style="{ width: diyComponent.imageSize * 2 + 'rpx', height: diyComponent.imageSize * 2 + 'rpx' }">
|
:style="{ width: diyComponent.imageSize * 2 + 'rpx', height: diyComponent.imageSize * 2 + 'rpx' }">
|
||||||
<image :src="img(item.imageUrl)" mode="aspectFill"
|
<image :src="img(item.imageUrl)" mode="aspectFill"
|
||||||
:style="{ maxWidth: diyComponent.imageSize * 2 + 'rpx', maxHeight: diyComponent.imageSize * 2 + 'rpx', borderRadius: diyComponent.aroundRadius * 2 + 'rpx' }">
|
:style="{ maxWidth: diyComponent.imageSize * 2 + 'rpx', maxHeight: diyComponent.imageSize * 2 + 'rpx', borderRadius: diyComponent.aroundRadius * 2 + 'rpx' }">
|
||||||
</image>
|
</image>
|
||||||
@ -79,11 +71,12 @@
|
|||||||
</app-link>
|
</app-link>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
</template>
|
||||||
</swiper-item>
|
</swiper-item>
|
||||||
</swiper>
|
</swiper>
|
||||||
|
|
||||||
<scroll-view v-else :scroll-x="diyComponent.showStyle == 'singleSlide'"
|
<scroll-view v-else :scroll-x="diyComponent.showStyle == 'singleSlide'"
|
||||||
:class="['graphic-nav','graphic-nav-'+diyComponent.showStyle]">
|
:class="['graphic-nav','graphic-nav-' + diyComponent.showStyle]">
|
||||||
<!-- #ifdef MP -->
|
<!-- #ifdef MP -->
|
||||||
<view class="uni-scroll-view-content">
|
<view class="uni-scroll-view-content">
|
||||||
<!-- #endif -->
|
<!-- #endif -->
|
||||||
@ -131,7 +124,7 @@
|
|||||||
import useDiyStore from '@/stores/diy';
|
import useDiyStore from '@/stores/diy';
|
||||||
import { useLogin } from '@/hooks/useLogin';
|
import { useLogin } from '@/hooks/useLogin';
|
||||||
|
|
||||||
const props = defineProps(['component', 'index']);
|
const props = defineProps(['component', 'index', 'pullDownRefresh']);
|
||||||
|
|
||||||
const diyStore = useDiyStore();
|
const diyStore = useDiyStore();
|
||||||
|
|
||||||
@ -153,24 +146,46 @@
|
|||||||
return style;
|
return style;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.pullDownRefresh,
|
||||||
|
(newValue, oldValue) => {
|
||||||
|
// 处理下拉刷新业务
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
const swiperIndex = ref(0);
|
const swiperIndex = ref(0);
|
||||||
|
|
||||||
const swiperChange = e => {
|
const swiperChange = e => {
|
||||||
swiperIndex.value = e.detail.current;
|
swiperIndex.value = e.detail.current;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const swiperCondition = (index, numItem) => {
|
||||||
|
let count = diyComponent.value.pageCount * diyComponent.value.rowCount;
|
||||||
|
let result = true;
|
||||||
|
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
result = index >= [(numItem) * (count)] && index < [(numItem + 1) * (count)];
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef H5
|
||||||
|
result = index >= [(numItem - 1) * (count)] && index < [numItem * (count)];
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
const swiperHeight = ref('');
|
const swiperHeight = ref('');
|
||||||
|
|
||||||
const handleData = () => {
|
const handleData = () => {
|
||||||
var height = 0;
|
var height = 0;
|
||||||
if (diyComponent.value.mode == 'graphic') {
|
if (diyComponent.value.mode == 'graphic') {
|
||||||
height = (21 + 6 + 14 + 8 + diyComponent.value.imageSize) * diyComponent.value.pageCount; // 21 = 文字高度,8 = 文字上边距,14 = 上下内边距,8 = 外边距
|
height = (21 + 6 + 14 + 8 + diyComponent.value.imageSize) * diyComponent.value.pageCount; // 21 = 文字高度,6 = 文字上边距,14 = 上下内边距,8 = 外边距
|
||||||
} else if (diyComponent.value.mode == 'img') {
|
} else if (diyComponent.value.mode == 'img') {
|
||||||
height = (14 + 8 + diyComponent.value.imageSize) * diyComponent.value.pageCount; // 14 = 上下内边距,8 = 外边距
|
height = (14 + 8 + diyComponent.value.imageSize) * diyComponent.value.pageCount; // 14 = 上下内边距,8 = 外边距
|
||||||
} else if (diyComponent.value.mode == 'text') {
|
} else if (diyComponent.value.mode == 'text') {
|
||||||
height = (21 + 14 + 8) * diyComponent.value.pageCount; // 21 = 文字高度,14 = 上下内边距,8 = 外边距
|
height = (21 + 14 + 8) * diyComponent.value.pageCount; // 21 = 文字高度,14 = 上下内边距,8 = 外边距
|
||||||
}
|
}
|
||||||
swiperHeight.value = height + 'rpx';
|
swiperHeight.value = (height * 2) + 'rpx';
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
|||||||
@ -1,27 +1,35 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="diy-group" id="componentList">
|
<view class="diy-group" id="componentList">
|
||||||
|
|
||||||
<view v-for="(component, index) in data.value" :key="component.id"
|
<view v-for="(component, index) in data.value" :key="component.id"
|
||||||
@click="diyStore.changeCurrentIndex(index, component)" class="draggable-element relative cursor-move"
|
@click="diyStore.changeCurrentIndex(index, component)" class="draggable-element relative cursor-move"
|
||||||
:class="{ selected: diyStore.currentIndex == index,decorate : diyStore.mode == 'decorate' }"
|
:class="{ selected: diyStore.currentIndex == index,decorate : diyStore.mode == 'decorate' }"
|
||||||
:style="component.pageStyle">
|
:style="component.pageStyle">
|
||||||
|
|
||||||
|
<fixed-group :component="component" :index="index" :pullDownRefresh="props.pullDownRefresh"></fixed-group>
|
||||||
|
|
||||||
<template v-if="component.componentName == 'Article'">
|
<template v-if="component.componentName == 'Article'">
|
||||||
<diy-article :component="component" :index="index"></diy-article>
|
<diy-article :component="component" :index="index"
|
||||||
|
:pullDownRefresh="props.pullDownRefresh"></diy-article>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'GraphicNav'">
|
<template v-if="component.componentName == 'GraphicNav'">
|
||||||
<diy-graphic-nav :component="component" :index="index"></diy-graphic-nav>
|
<diy-graphic-nav :component="component" :index="index"
|
||||||
|
:pullDownRefresh="props.pullDownRefresh"></diy-graphic-nav>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'HorzBlank'">
|
<template v-if="component.componentName == 'HorzBlank'">
|
||||||
<diy-horz-blank :component="component" :index="index"></diy-horz-blank>
|
<diy-horz-blank :component="component" :index="index"
|
||||||
|
:pullDownRefresh="props.pullDownRefresh"></diy-horz-blank>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'ImageAds'">
|
<template v-if="component.componentName == 'ImageAds'">
|
||||||
<diy-image-ads :component="component" :index="index"></diy-image-ads>
|
<diy-image-ads :component="component" :index="index"
|
||||||
|
:pullDownRefresh="props.pullDownRefresh"></diy-image-ads>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'MemberInfo'">
|
<template v-if="component.componentName == 'MemberInfo'">
|
||||||
<diy-member-info :component="component" :index="index"></diy-member-info>
|
<diy-member-info :component="component" :index="index"
|
||||||
|
:pullDownRefresh="props.pullDownRefresh"></diy-member-info>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="component.componentName == 'Text'">
|
<template v-if="component.componentName == 'Text'">
|
||||||
<diy-text :component="component" :index="index"></diy-text>
|
<diy-text :component="component" :index="index" :pullDownRefresh="props.pullDownRefresh"></diy-text>
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
<template v-if="diyStore.mode != 'decorate' && data.global.bottomTabBarSwitch">
|
<template v-if="diyStore.mode != 'decorate' && data.global.bottomTabBarSwitch">
|
||||||
@ -32,10 +40,10 @@
|
|||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import useDiyStore from '@/stores/diy';
|
import useDiyStore from '@/stores/diy';
|
||||||
import { onMounted, nextTick, computed, ref } from 'vue';
|
import { onMounted, nextTick, computed, ref, watch } from 'vue';
|
||||||
import Sortable from 'sortablejs';
|
import Sortable from 'sortablejs';
|
||||||
import { range } from 'lodash-es';
|
import { range } from 'lodash-es';
|
||||||
const props = defineProps(['data']);
|
const props = defineProps(['data', 'pullDownRefresh']);
|
||||||
const diyStore = useDiyStore();
|
const diyStore = useDiyStore();
|
||||||
|
|
||||||
const data = computed(() => {
|
const data = computed(() => {
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// 辅助空白
|
// 辅助空白
|
||||||
import { computed } from 'vue';
|
import { computed, watch } from 'vue';
|
||||||
import useDiyStore from '@/stores/diy';
|
import useDiyStore from '@/stores/diy';
|
||||||
|
|
||||||
const props = defineProps(['component', 'index']);
|
const props = defineProps(['component', 'index', 'pullDownRefresh']);
|
||||||
|
|
||||||
const diyStore = useDiyStore();
|
const diyStore = useDiyStore();
|
||||||
|
|
||||||
@ -26,6 +26,13 @@
|
|||||||
if (diyComponent.value.componentBgColor) style += 'background-color:' + diyComponent.value.componentBgColor + ';';
|
if (diyComponent.value.componentBgColor) style += 'background-color:' + diyComponent.value.componentBgColor + ';';
|
||||||
return style;
|
return style;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.pullDownRefresh,
|
||||||
|
(newValue, oldValue) => {
|
||||||
|
// 处理下拉刷新业务
|
||||||
|
}
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<style></style>
|
||||||
@ -27,7 +27,7 @@
|
|||||||
import { img } from '@/utils/common';
|
import { img } from '@/utils/common';
|
||||||
import useDiyStore from '@/stores/diy';
|
import useDiyStore from '@/stores/diy';
|
||||||
|
|
||||||
const props = defineProps(['component', 'index']);
|
const props = defineProps(['component', 'index', 'pullDownRefresh']);
|
||||||
|
|
||||||
const diyStore = useDiyStore();
|
const diyStore = useDiyStore();
|
||||||
|
|
||||||
@ -54,6 +54,13 @@
|
|||||||
return style;
|
return style;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.pullDownRefresh,
|
||||||
|
(newValue, oldValue) => {
|
||||||
|
// 处理下拉刷新业务
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
const imgHeight = computed(() => {
|
const imgHeight = computed(() => {
|
||||||
return (diyComponent.value.imageHeight * 2) + 'rpx';
|
return (diyComponent.value.imageHeight * 2) + 'rpx';
|
||||||
})
|
})
|
||||||
|
|||||||
@ -64,7 +64,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, ref } from 'vue'
|
import { computed, ref, watch } from 'vue'
|
||||||
import useMemberStore from '@/stores/member'
|
import useMemberStore from '@/stores/member'
|
||||||
import { useLogin } from '@/hooks/useLogin'
|
import { useLogin } from '@/hooks/useLogin'
|
||||||
import { img, isWeixinBrowser, redirect, urlDeconstruction, moneyFormat } from '@/utils/common'
|
import { img, isWeixinBrowser, redirect, urlDeconstruction, moneyFormat } from '@/utils/common'
|
||||||
@ -72,7 +72,7 @@
|
|||||||
import { wechatSync } from '@/api/system'
|
import { wechatSync } from '@/api/system'
|
||||||
import useDiyStore from '@/stores/diy'
|
import useDiyStore from '@/stores/diy'
|
||||||
|
|
||||||
const props = defineProps(['component', 'index']);
|
const props = defineProps(['component', 'index', 'pullDownRefresh']);
|
||||||
|
|
||||||
const diyStore = useDiyStore();
|
const diyStore = useDiyStore();
|
||||||
|
|
||||||
@ -99,6 +99,13 @@
|
|||||||
return style;
|
return style;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.pullDownRefresh,
|
||||||
|
(newValue, oldValue) => {
|
||||||
|
// 处理下拉刷新业务
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
const memberStore = useMemberStore()
|
const memberStore = useMemberStore()
|
||||||
|
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
|
|||||||
@ -38,11 +38,11 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// 标题
|
// 标题
|
||||||
import { ref, computed } from 'vue';
|
import { ref, computed, watch } from 'vue';
|
||||||
import { redirect, img } from '@/utils/common';
|
import { redirect, img } from '@/utils/common';
|
||||||
import useDiyStore from '@/stores/diy';
|
import useDiyStore from '@/stores/diy';
|
||||||
|
|
||||||
const props = defineProps(['component', 'index']);
|
const props = defineProps(['component', 'index', 'pullDownRefresh']);
|
||||||
const diyStore = useDiyStore();
|
const diyStore = useDiyStore();
|
||||||
|
|
||||||
const diyComponent = computed(() => {
|
const diyComponent = computed(() => {
|
||||||
@ -62,6 +62,13 @@
|
|||||||
if (diyComponent.value.bottomRounded) style += 'border-bottom-right-radius:' + diyComponent.value.bottomRounded * 2 + 'rpx;';
|
if (diyComponent.value.bottomRounded) style += 'border-bottom-right-radius:' + diyComponent.value.bottomRounded * 2 + 'rpx;';
|
||||||
return style;
|
return style;
|
||||||
})
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.pullDownRefresh,
|
||||||
|
(newValue, oldValue) => {
|
||||||
|
// 处理下拉刷新业务
|
||||||
|
}
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
39
uni-app/components/fixed/demo-index/index.vue
Normal file
39
uni-app/components/fixed/demo-index/index.vue
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
<template>
|
||||||
|
<view :style="warpCss">
|
||||||
|
固定模板示例,我也可以装修
|
||||||
|
我定义的数据源:{{ diyComponent.componentName }}
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { computed, watch } from 'vue';
|
||||||
|
import useDiyStore from '@/stores/diy';
|
||||||
|
|
||||||
|
const props = defineProps(['component', 'index', 'pullDownRefresh']);
|
||||||
|
|
||||||
|
const diyStore = useDiyStore();
|
||||||
|
|
||||||
|
const diyComponent = computed(() => {
|
||||||
|
if (diyStore.mode == 'decorate') {
|
||||||
|
return diyStore.value[props.index];
|
||||||
|
} else {
|
||||||
|
return props.component;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const warpCss = computed(() => {
|
||||||
|
var style = '';
|
||||||
|
style += 'height:' + diyComponent.value.height * 2 + 'rpx;';
|
||||||
|
if (diyComponent.value.componentBgColor) style += 'background-color:' + diyComponent.value.componentBgColor + ';';
|
||||||
|
return style;
|
||||||
|
})
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.pullDownRefresh,
|
||||||
|
(newValue, oldValue) => {
|
||||||
|
// 处理下拉刷新业务
|
||||||
|
}
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style></style>
|
||||||
@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="fixed-group">
|
<view class="fixed-group">
|
||||||
|
<template v-if="props.component.componentName == 'DemoIndex'">
|
||||||
|
<fixed-demo-index :component="props.component" :index="props.index"
|
||||||
|
:pullDownRefresh="props.pullDownRefresh"></fixed-demo-index>
|
||||||
|
</template>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed } from 'vue';
|
import { computed, watch } from 'vue';
|
||||||
const props = defineProps(['data']);
|
const props = defineProps(['component', 'index', 'pullDownRefresh']);
|
||||||
|
|
||||||
const data = computed(() => {
|
|
||||||
return props.data.value;
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import './index.scss';
|
@import './index.scss';
|
||||||
|
|||||||
30
uni-app/hooks/useSubscribeMessage.ts
Normal file
30
uni-app/hooks/useSubscribeMessage.ts
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import { getWeappTemplateId } from '@/api/system'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序订阅消息
|
||||||
|
*/
|
||||||
|
export const useSubscribeMessage = () => {
|
||||||
|
const request = (keys: string)=> {
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
const method = getWeappTemplateId
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef MP
|
||||||
|
method(keys).then(({ data }) => {
|
||||||
|
uni.requestSubscribeMessage({
|
||||||
|
tmplIds: data,
|
||||||
|
success: (res) => {
|
||||||
|
console.log("requestSubscribeMessage:success", res)
|
||||||
|
},
|
||||||
|
fail: (res) => {
|
||||||
|
console.log('requestSubscribeMessage:fail', res)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}).catch()
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
request
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,5 +1,4 @@
|
|||||||
import { nextTick } from 'vue'
|
import { nextTick } from 'vue'
|
||||||
import { setDocumentTitle } from '@/utils/common'
|
|
||||||
|
|
||||||
class Language {
|
class Language {
|
||||||
private i18n: any
|
private i18n: any
|
||||||
@ -20,10 +19,6 @@ class Language {
|
|||||||
this.i18n.global.locale = locale
|
this.i18n.global.locale = locale
|
||||||
}
|
}
|
||||||
uni.setLocale(locale)
|
uni.setLocale(locale)
|
||||||
|
|
||||||
// #ifdef H5
|
|
||||||
setDocumentTitle(path)
|
|
||||||
// #endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name" : "NiuCloud-ADMIN",
|
"name" : "",
|
||||||
"appid" : "__UNI__BFCE0C3",
|
"appid" : "__UNI__ED923AB",
|
||||||
"description" : "",
|
"description" : "",
|
||||||
"versionName" : "1.0.0",
|
"versionName" : "1.0.0",
|
||||||
"versionCode" : "100",
|
"versionCode" : "100",
|
||||||
|
|||||||
@ -3,108 +3,74 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/index/index",
|
"path": "pages/index/index",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
"navigationBarTitleText": "%pages.index.index%",
|
||||||
"navigationStyle": "custom",
|
"enablePullDownRefresh": true
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.index.index%"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/article/list",
|
"path": "pages/article/list",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.article.list%"
|
"navigationBarTitleText": "%pages.article.list%"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/auth/agreement",
|
"path": "pages/auth/agreement",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.auth.agreement%"
|
"navigationBarTitleText": "%pages.auth.agreement%"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/auth/bind",
|
"path": "pages/auth/bind",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.auth.bind%"
|
"navigationBarTitleText": "%pages.auth.bind%"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/auth/login",
|
"path": "pages/auth/login",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.auth.login%"
|
"navigationBarTitleText": "%pages.auth.login%"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/auth/register",
|
"path": "pages/auth/register",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.auth.register%"
|
"navigationBarTitleText": "%pages.auth.register%"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/auth/resetpwd",
|
"path": "pages/auth/resetpwd",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.auth.resetpwd%"
|
"navigationBarTitleText": "%pages.auth.resetpwd%"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/index/diy",
|
"path": "pages/index/diy",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
"navigationBarTitleText": "%pages.index.diy%",
|
||||||
"navigationStyle": "custom",
|
"enablePullDownRefresh": true
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.index.diy%"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/index/close",
|
"path": "pages/index/close",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.index.close%"
|
"navigationBarTitleText": "%pages.index.close%"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/index/nosite",
|
"path": "pages/index/nosite",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.index.nosite%"
|
"navigationBarTitleText": "%pages.index.nosite%"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/article/detail",
|
"path": "pages/article/detail",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.article.detail%"
|
"navigationBarTitleText": "%pages.article.detail%"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/member/apply_cash_out",
|
"path": "pages/member/apply_cash_out",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.member.apply_cash_out%"
|
"navigationBarTitleText": "%pages.member.apply_cash_out%"
|
||||||
},
|
},
|
||||||
"needLogin": true
|
"needLogin": true
|
||||||
@ -112,9 +78,6 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/member/commission",
|
"path": "pages/member/commission",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.member.commission%"
|
"navigationBarTitleText": "%pages.member.commission%"
|
||||||
},
|
},
|
||||||
"needLogin": true
|
"needLogin": true
|
||||||
@ -122,9 +85,6 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/member/balance",
|
"path": "pages/member/balance",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.member.balance%"
|
"navigationBarTitleText": "%pages.member.balance%"
|
||||||
},
|
},
|
||||||
"needLogin": true
|
"needLogin": true
|
||||||
@ -132,9 +92,6 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/member/recharge_record",
|
"path": "pages/member/recharge_record",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.member.recharge_record%"
|
"navigationBarTitleText": "%pages.member.recharge_record%"
|
||||||
},
|
},
|
||||||
"needLogin": true
|
"needLogin": true
|
||||||
@ -142,9 +99,6 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/member/recharge_record_detail",
|
"path": "pages/member/recharge_record_detail",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.member.recharge_record_detail%"
|
"navigationBarTitleText": "%pages.member.recharge_record_detail%"
|
||||||
},
|
},
|
||||||
"needLogin": true
|
"needLogin": true
|
||||||
@ -152,45 +106,31 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/member/detailed_account",
|
"path": "pages/member/detailed_account",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.member.detailed_account%"
|
"navigationBarTitleText": "%pages.member.detailed_account%"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/member/cash_out",
|
"path": "pages/member/cash_out",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.member.cash_out%"
|
"navigationBarTitleText": "%pages.member.cash_out%"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/member/cash_out_detail",
|
"path": "pages/member/cash_out_detail",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.member.cash_out_detail%"
|
"navigationBarTitleText": "%pages.member.cash_out_detail%"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/member/index",
|
"path": "pages/member/index",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
"navigationBarTitleText": "%pages.member.index%",
|
||||||
"navigationStyle": "custom",
|
"enablePullDownRefresh": true
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.member.index%"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/member/personal",
|
"path": "pages/member/personal",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.member.personal%"
|
"navigationBarTitleText": "%pages.member.personal%"
|
||||||
},
|
},
|
||||||
"needLogin": true
|
"needLogin": true
|
||||||
@ -198,9 +138,6 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/member/point",
|
"path": "pages/member/point",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.member.point%"
|
"navigationBarTitleText": "%pages.member.point%"
|
||||||
},
|
},
|
||||||
"needLogin": true
|
"needLogin": true
|
||||||
@ -208,9 +145,6 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/member/account",
|
"path": "pages/member/account",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.member.account%"
|
"navigationBarTitleText": "%pages.member.account%"
|
||||||
},
|
},
|
||||||
"needLogin": true
|
"needLogin": true
|
||||||
@ -218,9 +152,6 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/member/account_edit",
|
"path": "pages/member/account_edit",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.member.account_edit%"
|
"navigationBarTitleText": "%pages.member.account_edit%"
|
||||||
},
|
},
|
||||||
"needLogin": true
|
"needLogin": true
|
||||||
@ -228,27 +159,18 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/pay/browser",
|
"path": "pages/pay/browser",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.pay.browser%"
|
"navigationBarTitleText": "%pages.pay.browser%"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/pay/result",
|
"path": "pages/pay/result",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.pay.result%"
|
"navigationBarTitleText": "%pages.pay.result%"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/setting/index",
|
"path": "pages/setting/index",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.setting.index%"
|
"navigationBarTitleText": "%pages.setting.index%"
|
||||||
},
|
},
|
||||||
"needLogin": true
|
"needLogin": true
|
||||||
@ -256,18 +178,12 @@
|
|||||||
{
|
{
|
||||||
"path": "pages/webview/index",
|
"path": "pages/webview/index",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.webview.index%"
|
"navigationBarTitleText": "%pages.webview.index%"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "pages/index/develop",
|
"path": "pages/index/develop",
|
||||||
"style": {
|
"style": {
|
||||||
// #ifdef H5
|
|
||||||
"navigationStyle": "custom",
|
|
||||||
// #endif
|
|
||||||
"navigationBarTitleText": "%pages.index.develop%"
|
"navigationBarTitleText": "%pages.index.develop%"
|
||||||
}
|
}
|
||||||
} // {{PAGE}}
|
} // {{PAGE}}
|
||||||
|
|||||||
@ -4,18 +4,10 @@
|
|||||||
|
|
||||||
<view v-show="!loading">
|
<view v-show="!loading">
|
||||||
|
|
||||||
<!-- 自定义模板渲染 -->
|
<view class="diy-template-wrap bg-index"
|
||||||
<view class="diy-template-wrap bg-index" v-if="data.mode != 'fixed'"
|
|
||||||
:style="{ backgroundColor: data.global.pageBgColor,minHeight: 'calc(100vh - 50px)',backgroundImage : data.global.bgUrl ? 'url(' + img(data.global.bgUrl) + ')' : '' }">
|
:style="{ backgroundColor: data.global.pageBgColor,minHeight: 'calc(100vh - 50px)',backgroundImage : data.global.bgUrl ? 'url(' + img(data.global.bgUrl) + ')' : '' }">
|
||||||
|
|
||||||
<diy-group :data="data"></diy-group>
|
<diy-group :data="data" :pullDownRefresh="pullDownRefresh"></diy-group>
|
||||||
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 固定模板渲染 -->
|
|
||||||
<view class="fixed-template-wrap" v-if="data.mode == 'fixed'">
|
|
||||||
|
|
||||||
<fixed-group :data="data"></fixed-group>
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -25,7 +17,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, computed } from 'vue';
|
import { ref, reactive, computed } from 'vue';
|
||||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
import { onLoad, onShow, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||||
import { getDiyInfo } from '@/api/diy';
|
import { getDiyInfo } from '@/api/diy';
|
||||||
import useDiyStore from '@/stores/diy';
|
import useDiyStore from '@/stores/diy';
|
||||||
import { useShare } from '@/hooks/useShare'
|
import { useShare } from '@/hooks/useShare'
|
||||||
@ -37,6 +29,7 @@
|
|||||||
|
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const diyStore = useDiyStore();
|
const diyStore = useDiyStore();
|
||||||
|
const pullDownRefresh = ref(0)
|
||||||
|
|
||||||
const diyData = reactive({
|
const diyData = reactive({
|
||||||
global: {},
|
global: {},
|
||||||
@ -66,6 +59,12 @@
|
|||||||
name.value = option.name || '';
|
name.value = option.name || '';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 监听下拉刷新事件
|
||||||
|
onPullDownRefresh(() => {
|
||||||
|
pullDownRefresh.value++;
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
})
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
// 装修模式
|
// 装修模式
|
||||||
if (diyStore.mode == 'decorate') {
|
if (diyStore.mode == 'decorate') {
|
||||||
@ -79,32 +78,22 @@
|
|||||||
let data = res.data;
|
let data = res.data;
|
||||||
diyData.mode = data.mode;
|
diyData.mode = data.mode;
|
||||||
|
|
||||||
if (data.mode == 'diy') {
|
let sources = JSON.parse(res.data.value);
|
||||||
let sources = JSON.parse(res.data.value);
|
diyData.global = sources.global;
|
||||||
diyData.global = sources.global;
|
diyData.value = sources.value;
|
||||||
diyData.value = sources.value;
|
diyData.value.forEach((item, index) => {
|
||||||
diyData.value.forEach((item, index) => {
|
item.pageStyle = '';
|
||||||
item.pageStyle = '';
|
if (item.pageBgColor) item.pageStyle += 'background-color:' + item.pageBgColor + ';';
|
||||||
if (item.pageBgColor) item.pageStyle += 'background-color:' + item.pageBgColor + ';';
|
if (item.margin) {
|
||||||
if (item.margin) {
|
item.pageStyle += 'padding-top:' + item.margin.top * 2 + 'rpx' + ';';
|
||||||
item.pageStyle += 'padding-top:' + item.margin.top * 2 + 'rpx' + ';';
|
item.pageStyle += 'padding-bottom:' + item.margin.bottom * 2 + 'rpx' + ';';
|
||||||
item.pageStyle += 'padding-bottom:' + item.margin.bottom * 2 + 'rpx' + ';';
|
item.pageStyle += 'padding-right:' + item.margin.both * 2 + 'rpx' + ';';
|
||||||
item.pageStyle += 'padding-right:' + item.margin.both * 2 + 'rpx' + ';';
|
item.pageStyle += 'padding-left:' + item.margin.both * 2 + 'rpx' + ';';
|
||||||
item.pageStyle += 'padding-left:' + item.margin.both * 2 + 'rpx' + ';';
|
}
|
||||||
}
|
});
|
||||||
});
|
uni.setNavigationBarTitle({
|
||||||
uni.setNavigationBarTitle({
|
title: diyData.global.title
|
||||||
title: diyData.global.title
|
})
|
||||||
})
|
|
||||||
} else if (data.mode == 'fixed') {
|
|
||||||
// 固定模板
|
|
||||||
let sources = JSON.parse(res.data.value);
|
|
||||||
diyData.title = data.title;
|
|
||||||
diyData.value = sources;
|
|
||||||
uni.setNavigationBarTitle({
|
|
||||||
title: diyData.title
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let share = res.data.share ? JSON.parse(res.data.share) : null;
|
let share = res.data.share ? JSON.parse(res.data.share) : null;
|
||||||
|
|||||||
@ -4,18 +4,10 @@
|
|||||||
|
|
||||||
<view v-show="!loading">
|
<view v-show="!loading">
|
||||||
|
|
||||||
<!-- 自定义模板渲染 -->
|
<view class="diy-template-wrap bg-index"
|
||||||
<view class="diy-template-wrap bg-index" v-if="data.mode != 'fixed'"
|
|
||||||
:style="{ backgroundColor: data.global.pageBgColor,minHeight: 'calc(100vh - 50px)',backgroundImage : data.global.bgUrl ? 'url(' + img(data.global.bgUrl) + ')' : '' }">
|
:style="{ backgroundColor: data.global.pageBgColor,minHeight: 'calc(100vh - 50px)',backgroundImage : data.global.bgUrl ? 'url(' + img(data.global.bgUrl) + ')' : '' }">
|
||||||
|
|
||||||
<diy-group :data="data"></diy-group>
|
<diy-group :data="data" :pullDownRefresh="pullDownRefresh"></diy-group>
|
||||||
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 固定模板渲染 -->
|
|
||||||
<view class="fixed-template-wrap" v-if="data.mode == 'fixed'">
|
|
||||||
|
|
||||||
<fixed-group :data="data"></fixed-group>
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -25,7 +17,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, computed } from 'vue';
|
import { ref, reactive, computed } from 'vue';
|
||||||
import { onLoad, onShow } from '@dcloudio/uni-app';
|
import { onLoad, onShow, onPullDownRefresh } from '@dcloudio/uni-app';
|
||||||
import { getDiyInfo } from '@/api/diy';
|
import { getDiyInfo } from '@/api/diy';
|
||||||
import useDiyStore from '@/stores/diy';
|
import useDiyStore from '@/stores/diy';
|
||||||
import { useShare } from '@/hooks/useShare'
|
import { useShare } from '@/hooks/useShare'
|
||||||
@ -38,6 +30,7 @@
|
|||||||
|
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const diyStore = useDiyStore();
|
const diyStore = useDiyStore();
|
||||||
|
const pullDownRefresh = ref(0)
|
||||||
|
|
||||||
// 自定义页面 数据
|
// 自定义页面 数据
|
||||||
const diyData = reactive({
|
const diyData = reactive({
|
||||||
@ -63,6 +56,12 @@
|
|||||||
// #endif
|
// #endif
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 监听下拉刷新事件
|
||||||
|
onPullDownRefresh(() => {
|
||||||
|
pullDownRefresh.value++;
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
})
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
// 装修模式
|
// 装修模式
|
||||||
if (diyStore.mode == 'decorate') {
|
if (diyStore.mode == 'decorate') {
|
||||||
@ -74,35 +73,23 @@
|
|||||||
if (res.data.value) {
|
if (res.data.value) {
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
diyData.mode = data.mode;
|
diyData.mode = data.mode;
|
||||||
if (data.mode == 'diy') {
|
let sources = JSON.parse(data.value);
|
||||||
// 自定义模板
|
diyData.title = sources.title;
|
||||||
let sources = JSON.parse(data.value);
|
diyData.global = sources.global;
|
||||||
diyData.title = sources.title;
|
diyData.value = sources.value;
|
||||||
diyData.global = sources.global;
|
diyData.value.forEach((item, index) => {
|
||||||
diyData.value = sources.value;
|
item.pageStyle = '';
|
||||||
diyData.value.forEach((item, index) => {
|
if (item.pageBgColor) item.pageStyle += 'background-color:' + item.pageBgColor + ';';
|
||||||
item.pageStyle = '';
|
if (item.margin) {
|
||||||
if (item.pageBgColor) item.pageStyle += 'background-color:' + item.pageBgColor + ';';
|
item.pageStyle += 'padding-top:' + item.margin.top * 2 + 'rpx' + ';';
|
||||||
if (item.margin) {
|
item.pageStyle += 'padding-bottom:' + item.margin.bottom * 2 + 'rpx' + ';';
|
||||||
item.pageStyle += 'padding-top:' + item.margin.top * 2 + 'rpx' + ';';
|
item.pageStyle += 'padding-right:' + item.margin.both * 2 + 'rpx' + ';';
|
||||||
item.pageStyle += 'padding-bottom:' + item.margin.bottom * 2 + 'rpx' + ';';
|
item.pageStyle += 'padding-left:' + item.margin.both * 2 + 'rpx' + ';';
|
||||||
item.pageStyle += 'padding-right:' + item.margin.both * 2 + 'rpx' + ';';
|
}
|
||||||
item.pageStyle += 'padding-left:' + item.margin.both * 2 + 'rpx' + ';';
|
});
|
||||||
}
|
uni.setNavigationBarTitle({
|
||||||
});
|
title: diyData.global.title
|
||||||
uni.setNavigationBarTitle({
|
})
|
||||||
title: diyData.global.title
|
|
||||||
})
|
|
||||||
|
|
||||||
} else if (data.mode == 'fixed') {
|
|
||||||
// 固定模板
|
|
||||||
let sources = JSON.parse(res.data.value);
|
|
||||||
diyData.title = data.title;
|
|
||||||
diyData.value = sources;
|
|
||||||
uni.setNavigationBarTitle({
|
|
||||||
title: diyData.title
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
|||||||
@ -4,18 +4,10 @@
|
|||||||
|
|
||||||
<view v-show="!loading">
|
<view v-show="!loading">
|
||||||
|
|
||||||
<!-- 自定义模板渲染 -->
|
<view class="diy-template-wrap bg-index"
|
||||||
<view class="diy-template-wrap bg-index" v-if="data.mode != 'fixed'"
|
|
||||||
:style="{ backgroundColor: data.global.pageBgColor,minHeight: 'calc(100vh - 50px)',backgroundImage : data.global.bgUrl ? 'url(' + img(data.global.bgUrl) + ')' : '' }">
|
:style="{ backgroundColor: data.global.pageBgColor,minHeight: 'calc(100vh - 50px)',backgroundImage : data.global.bgUrl ? 'url(' + img(data.global.bgUrl) + ')' : '' }">
|
||||||
|
|
||||||
<diy-group :data="data"></diy-group>
|
<diy-group :data="data" :pullDownRefresh="pullDownRefresh"></diy-group>
|
||||||
|
|
||||||
</view>
|
|
||||||
|
|
||||||
<!-- 固定模板渲染 -->
|
|
||||||
<view class="fixed-template-wrap" v-if="data.mode == 'fixed'">
|
|
||||||
|
|
||||||
<fixed-group :data="data"></fixed-group>
|
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
@ -25,7 +17,7 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, reactive, computed } from 'vue'
|
import { ref, reactive, computed } from 'vue'
|
||||||
import { onLoad, onShow } from '@dcloudio/uni-app'
|
import { onLoad, onShow, onPullDownRefresh } from '@dcloudio/uni-app'
|
||||||
import { getDiyInfo } from '@/api/diy'
|
import { getDiyInfo } from '@/api/diy'
|
||||||
import useDiyStore from '@/stores/diy'
|
import useDiyStore from '@/stores/diy'
|
||||||
import useMemberStore from '@/stores/member'
|
import useMemberStore from '@/stores/member'
|
||||||
@ -33,6 +25,7 @@
|
|||||||
|
|
||||||
const loading = ref(true);
|
const loading = ref(true);
|
||||||
const diyStore = useDiyStore();
|
const diyStore = useDiyStore();
|
||||||
|
const pullDownRefresh = ref(0)
|
||||||
|
|
||||||
const diyData = reactive({
|
const diyData = reactive({
|
||||||
global: {},
|
global: {},
|
||||||
@ -57,6 +50,12 @@
|
|||||||
// #endif
|
// #endif
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 监听下拉刷新事件
|
||||||
|
onPullDownRefresh(() => {
|
||||||
|
pullDownRefresh.value++;
|
||||||
|
uni.stopPullDownRefresh();
|
||||||
|
})
|
||||||
|
|
||||||
onShow(() => {
|
onShow(() => {
|
||||||
// 装修模式
|
// 装修模式
|
||||||
if (diyStore.mode == 'decorate') {
|
if (diyStore.mode == 'decorate') {
|
||||||
@ -68,32 +67,22 @@
|
|||||||
if (res.data.value) {
|
if (res.data.value) {
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
diyData.mode = data.mode;
|
diyData.mode = data.mode;
|
||||||
if (data.mode == 'diy') {
|
let sources = JSON.parse(res.data.value);
|
||||||
let sources = JSON.parse(res.data.value);
|
diyData.global = sources.global;
|
||||||
diyData.global = sources.global;
|
diyData.value = sources.value;
|
||||||
diyData.value = sources.value;
|
diyData.value.forEach((item, index) => {
|
||||||
diyData.value.forEach((item, index) => {
|
item.pageStyle = '';
|
||||||
item.pageStyle = '';
|
if (item.pageBgColor) item.pageStyle += 'background-color:' + item.pageBgColor + ';';
|
||||||
if (item.pageBgColor) item.pageStyle += 'background-color:' + item.pageBgColor + ';';
|
if (item.margin) {
|
||||||
if (item.margin) {
|
item.pageStyle += 'padding-top:' + item.margin.top * 2 + 'rpx' + ';';
|
||||||
item.pageStyle += 'padding-top:' + item.margin.top * 2 + 'rpx' + ';';
|
item.pageStyle += 'padding-bottom:' + item.margin.bottom * 2 + 'rpx' + ';';
|
||||||
item.pageStyle += 'padding-bottom:' + item.margin.bottom * 2 + 'rpx' + ';';
|
item.pageStyle += 'padding-right:' + item.margin.both * 2 + 'rpx' + ';';
|
||||||
item.pageStyle += 'padding-right:' + item.margin.both * 2 + 'rpx' + ';';
|
item.pageStyle += 'padding-left:' + item.margin.both * 2 + 'rpx' + ';';
|
||||||
item.pageStyle += 'padding-left:' + item.margin.both * 2 + 'rpx' + ';';
|
}
|
||||||
}
|
});
|
||||||
});
|
uni.setNavigationBarTitle({
|
||||||
uni.setNavigationBarTitle({
|
title: diyData.global.title
|
||||||
title: diyData.global.title
|
})
|
||||||
})
|
|
||||||
} else if (data.mode == 'fixed') {
|
|
||||||
// 固定模板
|
|
||||||
let sources = JSON.parse(res.data.value);
|
|
||||||
diyData.title = data.title;
|
|
||||||
diyData.value = sources;
|
|
||||||
uni.setNavigationBarTitle({
|
|
||||||
title: diyData.title
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
});
|
});
|
||||||
|
|||||||
@ -22,6 +22,7 @@ const useMemberStore = defineStore('member', {
|
|||||||
await this.getMemberInfo()
|
await this.getMemberInfo()
|
||||||
},
|
},
|
||||||
async getMemberInfo() {
|
async getMemberInfo() {
|
||||||
|
if (!this.token) return
|
||||||
await getMemberInfo()
|
await getMemberInfo()
|
||||||
.then((res : any) => {
|
.then((res : any) => {
|
||||||
this.info = res.data
|
this.info = res.data
|
||||||
@ -31,6 +32,7 @@ const useMemberStore = defineStore('member', {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
async logout(isRedirect : boolean = false) {
|
async logout(isRedirect : boolean = false) {
|
||||||
|
if (!this.token) return
|
||||||
await logout().then(() => {
|
await logout().then(() => {
|
||||||
this.$reset()
|
this.$reset()
|
||||||
removeToken()
|
removeToken()
|
||||||
|
|||||||
@ -176,7 +176,13 @@ export function isUrl(str : string) : boolean {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
export function img(path : string) : string {
|
export function img(path : string) : string {
|
||||||
|
// #ifdef H5
|
||||||
return isUrl(path) ? path : `${import.meta.env.VITE_IMG_DOMAIN || location.origin}/${path}`
|
return isUrl(path) ? path : `${import.meta.env.VITE_IMG_DOMAIN || location.origin}/${path}`
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifndef H5
|
||||||
|
return isUrl(path) ? path : `${import.meta.env.VITE_IMG_DOMAIN}/${path}`
|
||||||
|
// #endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -232,31 +238,4 @@ export function getSiteId(siteid : number) {
|
|||||||
// #ifndef H5
|
// #ifndef H5
|
||||||
return siteid
|
return siteid
|
||||||
// #endif
|
// #endif
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置html标题
|
|
||||||
* @param {Object} route
|
|
||||||
*/
|
|
||||||
export function setDocumentTitle(route: string) {
|
|
||||||
if (process.env.NODE_ENV != 'production') return
|
|
||||||
try {
|
|
||||||
const locale: AnyObject = {
|
|
||||||
'zh-Hans': pagesZh,
|
|
||||||
'en': pagesEn
|
|
||||||
}
|
|
||||||
const key = route.replace('/', '').replaceAll('/', '.')
|
|
||||||
if (locale[ uni.getLocale() ][key]) {
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.setNavigationBarTitle({
|
|
||||||
title: locale[ uni.getLocale() ][key],
|
|
||||||
fail(e) {
|
|
||||||
setDocumentTitle(route)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}, 500)
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log(e)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import { language } from '@/locale'
|
import { language } from '@/locale'
|
||||||
import { checkNeedLogin } from '@/utils/auth'
|
import { checkNeedLogin } from '@/utils/auth'
|
||||||
import { redirect, urlDeconstruction, getToken, getSiteId, setDocumentTitle } from '@/utils/common'
|
import { redirect, urlDeconstruction, getToken, getSiteId } from '@/utils/common'
|
||||||
import { memberLog } from '@/api/auth'
|
import { memberLog } from '@/api/auth'
|
||||||
import { nextTick } from 'vue'
|
import { nextTick } from 'vue'
|
||||||
|
|
||||||
@ -17,17 +17,14 @@ export const redirectInterceptor = () => {
|
|||||||
|
|
||||||
// 加载语言包
|
// 加载语言包
|
||||||
language.loadLocaleMessages(route.path, uni.getLocale())
|
language.loadLocaleMessages(route.path, uni.getLocale())
|
||||||
|
|
||||||
// 开发模式下,如果未配置站点ID,则跳转到开发环境配置页面
|
// 开发模式下,如果未配置站点ID,则跳转到开发环境配置页面
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
if (process.env.NODE_ENV == 'development') {
|
if (process.env.NODE_ENV == 'development') {
|
||||||
if ((getSiteId(uni.getStorageSync('wap_site_id') || import.meta.env.VITE_SITE_ID) === '') && route.path != '/pages/index/develop') {
|
if ((getSiteId(import.meta.env.VITE_SITE_ID || uni.getStorageSync('wap_site_id')) === '') && route.path != '/pages/index/develop') {
|
||||||
redirect({ url: '/pages/index/develop', mode: 'reLaunch' })
|
redirect({ url: '/pages/index/develop', mode: 'reLaunch' })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置网站标题
|
|
||||||
setDocumentTitle(route.path)
|
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// 校验是否需要登录
|
// 校验是否需要登录
|
||||||
@ -51,20 +48,17 @@ export const launchInterceptor = () => {
|
|||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
if (process.env.NODE_ENV == 'development') {
|
if (process.env.NODE_ENV == 'development') {
|
||||||
// 后台DIY装修页面时,获取站点ID
|
// 后台DIY装修页面时,获取站点ID
|
||||||
if (location.search.indexOf('?mode=decorate&site_id=') != -1) {
|
|
||||||
uni.setStorageSync('wap_site_id', location.search.replace('?mode=decorate&site_id=',''));
|
if (location.search.indexOf('site_id=') != -1) {
|
||||||
|
let site_id = location.search.substr(location.search.indexOf('site_id=')+8);
|
||||||
|
uni.setStorageSync('wap_site_id', site_id);
|
||||||
}
|
}
|
||||||
if (location.search.indexOf('?mode=preview&site_id=') != -1) {
|
if (getSiteId(import.meta.env.VITE_SITE_ID || uni.getStorageSync('wap_site_id')) === '') {
|
||||||
uni.setStorageSync('wap_site_id', location.search.replace('?mode=preview&site_id=',''));
|
|
||||||
}
|
|
||||||
if (getSiteId(uni.getStorageSync('wap_site_id') || import.meta.env.VITE_SITE_ID) === '') {
|
|
||||||
launch.path = '/pages/index/develop';
|
launch.path = '/pages/index/develop';
|
||||||
uni.setStorageSync('develop_before_path', launch.path);
|
uni.setStorageSync('develop_before_path', launch.path);
|
||||||
redirect({ url: '/pages/index/develop', mode: 'reLaunch' })
|
redirect({ url: '/pages/index/develop', mode: 'reLaunch' })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 设置网站标题
|
|
||||||
setDocumentTitle(launch.path)
|
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
// 加载语言包
|
// 加载语言包
|
||||||
|
|||||||
@ -24,11 +24,11 @@ class Request {
|
|||||||
// #ifndef H5
|
// #ifndef H5
|
||||||
this.baseUrl = import.meta.env.VITE_APP_BASE_URL
|
this.baseUrl = import.meta.env.VITE_APP_BASE_URL
|
||||||
// #endif
|
// #endif
|
||||||
this.baseUrl.substr(-1) != '/' && (this.baseUrl += '/')
|
this.baseUrl.substr(-1) != '/' && (this.baseUrl += '/')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (process.env.NODE_ENV == 'development') {
|
if (process.env.NODE_ENV == 'development') {
|
||||||
this.config.header[import.meta.env.VITE_REQUEST_HEADER_SITEID_KEY] = getSiteId(uni.getStorageSync('wap_site_id') || import.meta.env.VITE_SITE_ID)
|
this.config.header[import.meta.env.VITE_REQUEST_HEADER_SITEID_KEY] = getSiteId(import.meta.env.VITE_SITE_ID || uni.getStorageSync('wap_site_id'))
|
||||||
} else {
|
} else {
|
||||||
this.config.header[import.meta.env.VITE_REQUEST_HEADER_SITEID_KEY] = getSiteId(import.meta.env.VITE_SITE_ID)
|
this.config.header[import.meta.env.VITE_REQUEST_HEADER_SITEID_KEY] = getSiteId(import.meta.env.VITE_SITE_ID)
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ class Request {
|
|||||||
getToken() && (this.config.header[import.meta.env.VITE_REQUEST_HEADER_TOKEN_KEY] = getToken())
|
getToken() && (this.config.header[import.meta.env.VITE_REQUEST_HEADER_TOKEN_KEY] = getToken())
|
||||||
this.config.header[import.meta.env.VITE_REQUEST_HEADER_CHANNEL_KEY] = getAppChannel()
|
this.config.header[import.meta.env.VITE_REQUEST_HEADER_CHANNEL_KEY] = getAppChannel()
|
||||||
if (process.env.NODE_ENV == 'development') {
|
if (process.env.NODE_ENV == 'development') {
|
||||||
this.config.header[import.meta.env.VITE_REQUEST_HEADER_SITEID_KEY] = getSiteId(uni.getStorageSync('wap_site_id') || import.meta.env.VITE_SITE_ID)
|
this.config.header[import.meta.env.VITE_REQUEST_HEADER_SITEID_KEY] = getSiteId(import.meta.env.VITE_SITE_ID || uni.getStorageSync('wap_site_id'))
|
||||||
} else {
|
} else {
|
||||||
this.config.header[import.meta.env.VITE_REQUEST_HEADER_SITEID_KEY] = getSiteId(import.meta.env.VITE_SITE_ID)
|
this.config.header[import.meta.env.VITE_REQUEST_HEADER_SITEID_KEY] = getSiteId(import.meta.env.VITE_SITE_ID)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user