mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2025-12-12 10:52:48 +00:00
update uni-app
This commit is contained in:
parent
72bd5a1ba3
commit
ffa8719298
@ -32,14 +32,18 @@ export function logout() {
|
|||||||
* 用户名注册
|
* 用户名注册
|
||||||
*/
|
*/
|
||||||
export function usernameRegister(data : AnyObject) {
|
export function usernameRegister(data : AnyObject) {
|
||||||
return request.post('register', data, { showErrorMessage: true })
|
let url = 'register'
|
||||||
|
data.pid && (url += `?pid=${data.pid}`)
|
||||||
|
return request.post(url, data, { showErrorMessage: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 手机号注册
|
* 手机号注册
|
||||||
*/
|
*/
|
||||||
export function mobileRegister(data : AnyObject) {
|
export function mobileRegister(data : AnyObject) {
|
||||||
return request.post('register/mobile', data, { showErrorMessage: true })
|
let url = 'register/mobile'
|
||||||
|
data.pid && (url += `?pid=${data.pid}`)
|
||||||
|
return request.post(url, data, { showErrorMessage: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,7 +64,9 @@ export function weappLogin(data : AnyObject) {
|
|||||||
* 绑定手机号
|
* 绑定手机号
|
||||||
*/
|
*/
|
||||||
export function bind(data : AnyObject) {
|
export function bind(data : AnyObject) {
|
||||||
return request.post('bind', data, { showErrorMessage: true })
|
let url = 'bind'
|
||||||
|
data.pid && (url += `?pid=${data.pid}`)
|
||||||
|
return request.post(url, data, { showErrorMessage: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -10,6 +10,6 @@ export function pay(data : AnyObject) {
|
|||||||
/**
|
/**
|
||||||
* 获取支付信息
|
* 获取支付信息
|
||||||
*/
|
*/
|
||||||
export function getPayInfo(outTradeNo : string) {
|
export function getPayInfo(tradeType : string, tradeId : number) {
|
||||||
return request.get(`pay/info/${outTradeNo}`, {}, { showErrorMessage: true })
|
return request.get(`pay/info/${tradeType}/${tradeId}`, {}, { showErrorMessage: true })
|
||||||
}
|
}
|
||||||
@ -6,8 +6,6 @@
|
|||||||
: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 :component="component" :index="index"
|
||||||
:pullDownRefresh="props.pullDownRefresh"></diy-article>
|
:pullDownRefresh="props.pullDownRefresh"></diy-article>
|
||||||
@ -31,6 +29,12 @@
|
|||||||
<template v-if="component.componentName == 'Text'">
|
<template v-if="component.componentName == 'Text'">
|
||||||
<diy-text :component="component" :index="index" :pullDownRefresh="props.pullDownRefresh"></diy-text>
|
<diy-text :component="component" :index="index" :pullDownRefresh="props.pullDownRefresh"></diy-text>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-if="component.componentName == 'RubikCube'">
|
||||||
|
<diy-rubik-cube :component="component" :index="index" :pullDownRefresh="props.pullDownRefresh"></diy-rubik-cube>
|
||||||
|
</template>
|
||||||
|
<template v-if="component.componentName == 'HotArea'">
|
||||||
|
<diy-hot-area :component="component" :index="index" :pullDownRefresh="props.pullDownRefresh"></diy-hot-area>
|
||||||
|
</template>
|
||||||
</view>
|
</view>
|
||||||
<template v-if="diyStore.mode != 'decorate' && data.global.bottomTabBarSwitch">
|
<template v-if="diyStore.mode != 'decorate' && data.global.bottomTabBarSwitch">
|
||||||
<view class="pt-[20rpx]"></view>
|
<view class="pt-[20rpx]"></view>
|
||||||
|
|||||||
83
uni-app/components/diy/hot-area/index.vue
Normal file
83
uni-app/components/diy/hot-area/index.vue
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<template>
|
||||||
|
<view :style="warpCss">
|
||||||
|
<view class="simple-graph-wrap overflow-hidden relative leading-0">
|
||||||
|
<image :style="{ height: diyComponent.imgHeight }" :src="img(diyComponent.imageUrl)" mode="widthFix"
|
||||||
|
:show-menu-by-longpress="true" class="w-full"></image>
|
||||||
|
|
||||||
|
<template v-if="diyStore.mode != 'decorate'">
|
||||||
|
<!-- 热区功能 -->
|
||||||
|
<app-link :data="mapItem.link" class="absolute" v-for="(mapItem, mapIndex) in diyComponent.heatMapData"
|
||||||
|
:key="mapIndex" :style="{
|
||||||
|
width: mapItem.width + '%',
|
||||||
|
height: mapItem.height + '%',
|
||||||
|
left: mapItem.left + '%',
|
||||||
|
top: mapItem.top + '%'
|
||||||
|
}"></app-link>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
// 热区
|
||||||
|
import { computed, watch, onMounted } from 'vue';
|
||||||
|
import useDiyStore from '@/stores/diy';
|
||||||
|
import { img } from '@/utils/common';
|
||||||
|
|
||||||
|
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 = '';
|
||||||
|
if (diyComponent.value.componentBgColor) style += 'background-color:' + diyComponent.value.componentBgColor + ';';
|
||||||
|
if (diyComponent.value.topRounded) style += 'border-top-left-radius:' + diyComponent.value.topRounded * 2 + 'rpx;';
|
||||||
|
if (diyComponent.value.topRounded) style += 'border-top-right-radius:' + diyComponent.value.topRounded * 2 + 'rpx;';
|
||||||
|
if (diyComponent.value.bottomRounded) style += 'border-bottom-left-radius:' + diyComponent.value.bottomRounded * 2 + 'rpx;';
|
||||||
|
if (diyComponent.value.bottomRounded) style += 'border-bottom-right-radius:' + diyComponent.value.bottomRounded * 2 + 'rpx;';
|
||||||
|
return style;
|
||||||
|
})
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
refresh();
|
||||||
|
// 装修模式下刷新
|
||||||
|
watch(
|
||||||
|
() => diyComponent.value,
|
||||||
|
(newValue, oldValue) => {
|
||||||
|
if (newValue && newValue.componentName == 'HotArea') {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
|
const refresh = () => {
|
||||||
|
if (diyStore.mode == 'decorate') {
|
||||||
|
// 装修模式下设置默认图
|
||||||
|
if (diyComponent.value.imageUrl == '') {
|
||||||
|
diyComponent.value.imageUrl = 'static/resource/images/diy/figure.png';
|
||||||
|
diyComponent.value.imgWidth = 690;
|
||||||
|
diyComponent.value.imgHeight = 330;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.pullDownRefresh,
|
||||||
|
(newValue, oldValue) => {
|
||||||
|
// 处理下拉刷新业务
|
||||||
|
}
|
||||||
|
)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
</style>
|
||||||
@ -2,7 +2,7 @@
|
|||||||
<view class="image-ads" :style="warpCss">
|
<view class="image-ads" :style="warpCss">
|
||||||
<view v-if="diyComponent.list.length == 1" class="leading-0 overflow-hidden" :style="swiperWarpCss">
|
<view v-if="diyComponent.list.length == 1" class="leading-0 overflow-hidden" :style="swiperWarpCss">
|
||||||
<app-link :data="diyComponent.list[0].link">
|
<app-link :data="diyComponent.list[0].link">
|
||||||
<image :src="img(diyComponent.list[0].imageUrl)" :style="{height: imgHeight}" mode="scaleToFill"
|
<image :src="img(diyComponent.list[0].imageUrl)" :style="{height: imgHeight}" mode="heightFix"
|
||||||
class="w-full" :show-menu-by-longpress="true"></image>
|
class="w-full" :show-menu-by-longpress="true"></image>
|
||||||
</app-link>
|
</app-link>
|
||||||
</view>
|
</view>
|
||||||
@ -71,9 +71,6 @@
|
|||||||
swiperIndex.value = e.detail.current;
|
swiperIndex.value = e.detail.current;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleData = () => {
|
|
||||||
};
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
refresh();
|
refresh();
|
||||||
// 装修模式下刷新
|
// 装修模式下刷新
|
||||||
@ -100,7 +97,6 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
handleData()
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
549
uni-app/components/diy/rubik-cube/index.vue
Normal file
549
uni-app/components/diy/rubik-cube/index.vue
Normal file
@ -0,0 +1,549 @@
|
|||||||
|
<template>
|
||||||
|
<view :class="['rubik-cube', diyStore.mode]" :style="warpCss">
|
||||||
|
|
||||||
|
<!-- 1左2右 -->
|
||||||
|
<template v-if="diyComponent.mode == 'row1-lt-of2-rt'">
|
||||||
|
<view class="template-left">
|
||||||
|
<app-link :data="diyComponent.list[0].link" :class="['item', diyComponent.mode]"
|
||||||
|
:style="{ marginRight: diyComponent.imageGap * 2 + 'rpx', width: diyComponent.list[0].imgWidth, height: diyComponent.list[0].imgHeight + 'px' }">
|
||||||
|
<image :src="img(diyComponent.list[0].imageUrl)" mode="scaleToFill"
|
||||||
|
:style="diyComponent.list[0].pageItemStyle" :show-menu-by-longpress="true"></image>
|
||||||
|
</app-link>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="template-right">
|
||||||
|
<template v-for="(item, index) in diyComponent.list" :key="index">
|
||||||
|
<template v-if="index > 0">
|
||||||
|
<app-link :data="item.link" :class="['item', diyComponent.mode]"
|
||||||
|
:style="{ marginBottom: diyComponent.imageGap * 2 + 'rpx', width: item.imgWidth, height: item.imgHeight + 'px' }">
|
||||||
|
<image :src="img(item.imageUrl)" mode="scaleToFill" :style="item.pageItemStyle"
|
||||||
|
:show-menu-by-longpress="true"></image>
|
||||||
|
</app-link>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- 1左3右 -->
|
||||||
|
<template v-else-if="diyComponent.mode == 'row1-lt-of1-tp-of2-bm'">
|
||||||
|
<view class="template-left">
|
||||||
|
<app-link :data="diyComponent.list[0].link" :class="['item', diyComponent.mode]"
|
||||||
|
:style="{ marginRight: diyComponent.imageGap * 2 + 'rpx', width: diyComponent.list[0].imgWidth, height: diyComponent.list[0].imgHeight + 'px' }">
|
||||||
|
<image :src="img(diyComponent.list[0].imageUrl)" mode="scaleToFill"
|
||||||
|
:style="diyComponent.list[0].pageItemStyle" :show-menu-by-longpress="true"></image>
|
||||||
|
</app-link>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<view class="template-right">
|
||||||
|
<app-link :data="diyComponent.list[1].link" :class="['item', diyComponent.mode]"
|
||||||
|
:style="{ marginBottom: diyComponent.imageGap * 2 + 'rpx', width: diyComponent.list[1].imgWidth, height: diyComponent.list[1].imgHeight + 'px' }">
|
||||||
|
<image :src="img(diyComponent.list[1].imageUrl)" mode="scaleToFill"
|
||||||
|
:style="diyComponent.list[1].pageItemStyle" :show-menu-by-longpress="true"></image>
|
||||||
|
</app-link>
|
||||||
|
<view class="template-bottom">
|
||||||
|
<template v-for="(item, index) in diyComponent.list" :key="index">
|
||||||
|
<template v-if="index > 1">
|
||||||
|
<app-link :data="item.link" :class="['item', diyComponent.mode]" :style="{
|
||||||
|
marginRight: diyComponent.imageGap * 2 + 'rpx',
|
||||||
|
width: item.imgWidth,
|
||||||
|
height: item.imgHeight + 'px'
|
||||||
|
}">
|
||||||
|
<image :src="img(item.imageUrl)" mode="scaleToFill" :style="item.pageItemStyle"
|
||||||
|
:show-menu-by-longpress="true"></image>
|
||||||
|
</app-link>
|
||||||
|
</template>
|
||||||
|
</template>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template v-else>
|
||||||
|
<app-link :class="['item', diyComponent.mode]" v-for="(item, index) in diyComponent.list" :key="index"
|
||||||
|
:data="item.link"
|
||||||
|
:style="{ marginRight: diyComponent.imageGap * 2 + 'rpx', marginBottom: diyComponent.imageGap * 2 + 'rpx', width: item.widthStyle, height: item.imgHeight + 'px' }">
|
||||||
|
<image :src="img(item.imageUrl)" :mode="'scaleToFill'" :style="item.pageItemStyle"
|
||||||
|
:show-menu-by-longpress="true"></image>
|
||||||
|
</app-link>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
// 魔方
|
||||||
|
import { onMounted, computed, watch } from 'vue';
|
||||||
|
import useDiyStore from '@/stores/diy';
|
||||||
|
import { img } from '@/utils/common';
|
||||||
|
|
||||||
|
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 = '';
|
||||||
|
if (diyComponent.value.componentBgColor) style += 'background-color:' + diyComponent.value.componentBgColor + ';';
|
||||||
|
if (diyComponent.value.topRounded) style += 'border-top-left-radius:' + diyComponent.value.topRounded * 2 + 'rpx;';
|
||||||
|
if (diyComponent.value.topRounded) style += 'border-top-right-radius:' + diyComponent.value.topRounded * 2 + 'rpx;';
|
||||||
|
if (diyComponent.value.bottomRounded) style += 'border-bottom-left-radius:' + diyComponent.value.bottomRounded * 2 + 'rpx;';
|
||||||
|
if (diyComponent.value.bottomRounded) style += 'border-bottom-right-radius:' + diyComponent.value.bottomRounded * 2 + 'rpx;';
|
||||||
|
return style;
|
||||||
|
})
|
||||||
|
|
||||||
|
const countBorderRadius = (type, index) => {
|
||||||
|
var obj = '';
|
||||||
|
if (diyComponent.value.elementAngle == 'right') {
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
var defaultData = {
|
||||||
|
'row1-lt-of2-rt': [
|
||||||
|
['border-top-right-radius', 'border-bottom-right-radius'],
|
||||||
|
['border-top-left-radius', 'border-bottom-left-radius', 'border-bottom-right-radius'],
|
||||||
|
['border-top-left-radius', 'border-bottom-left-radius', 'border-top-right-radius']
|
||||||
|
],
|
||||||
|
'row1-lt-of1-tp-of2-bm': [
|
||||||
|
['border-top-right-radius', 'border-bottom-right-radius'],
|
||||||
|
['border-top-left-radius', 'border-bottom-left-radius', 'border-bottom-right-radius'],
|
||||||
|
['border-radius'],
|
||||||
|
['border-top-left-radius', 'border-bottom-left-radius', 'border-top-right-radius']
|
||||||
|
],
|
||||||
|
'row1-tp-of2-bm': [
|
||||||
|
['border-bottom-left-radius', 'border-bottom-right-radius'],
|
||||||
|
['border-top-left-radius', 'border-bottom-right-radius', 'border-top-right-radius'],
|
||||||
|
['border-top-left-radius', 'border-bottom-left-radius', 'border-top-right-radius']
|
||||||
|
],
|
||||||
|
'row2-lt-of2-rt': [
|
||||||
|
['border-top-right-radius', 'border-bottom-left-radius', 'border-bottom-right-radius'],
|
||||||
|
['border-top-left-radius', 'border-bottom-right-radius', 'border-bottom-left-radius'],
|
||||||
|
['border-top-left-radius', 'border-bottom-right-radius', 'border-top-right-radius'],
|
||||||
|
['border-top-left-radius', 'border-bottom-left-radius', 'border-top-right-radius']
|
||||||
|
],
|
||||||
|
'row1-of4': [
|
||||||
|
['border-top-right-radius', 'border-bottom-right-radius'],
|
||||||
|
['border-radius'],
|
||||||
|
['border-radius'],
|
||||||
|
['border-top-left-radius', 'border-bottom-left-radius']
|
||||||
|
],
|
||||||
|
'row1-of3': [
|
||||||
|
['border-top-right-radius', 'border-bottom-right-radius'],
|
||||||
|
['border-radius'],
|
||||||
|
['border-top-left-radius', 'border-bottom-left-radius']
|
||||||
|
],
|
||||||
|
'row1-of2': [
|
||||||
|
['border-top-right-radius', 'border-bottom-right-radius'],
|
||||||
|
['border-top-left-radius', 'border-bottom-left-radius']
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultData[type][index].forEach((item, index) => {
|
||||||
|
obj += 'border-top-left-radius:' + diyComponent.value.topElementRounded * 2 + 'rpx;';
|
||||||
|
obj += 'border-top-right-radius:' + diyComponent.value.topElementRounded * 2 + 'rpx;';
|
||||||
|
obj += 'border-bottom-left-radius:' + diyComponent.value.bottomElementRounded * 2 + 'rpx;';
|
||||||
|
obj += 'border-bottom-right-radius:' + diyComponent.value.bottomElementRounded * 2 + 'rpx;';
|
||||||
|
});
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.pullDownRefresh,
|
||||||
|
(newValue, oldValue) => {
|
||||||
|
// 处理下拉刷新业务
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
refresh();
|
||||||
|
// 装修模式下刷新
|
||||||
|
watch(
|
||||||
|
() => diyComponent.value,
|
||||||
|
(newValue, oldValue) => {
|
||||||
|
if (newValue && newValue.componentName == 'RubikCube') {
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
});
|
||||||
|
|
||||||
|
const refresh = () => {
|
||||||
|
if (diyStore.mode == 'decorate') {
|
||||||
|
diyComponent.value.list.forEach((item : any, index) => {
|
||||||
|
// 装修模式下设置默认图
|
||||||
|
if (item.imageUrl == '') {
|
||||||
|
item.imageUrl = 'static/resource/images/diy/figure.png';
|
||||||
|
item.imgWidth = 690;
|
||||||
|
item.imgHeight = 330;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
handleData()
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleData = () => {
|
||||||
|
var singleRow = {
|
||||||
|
'row1-of2': {
|
||||||
|
ratio: 2,
|
||||||
|
width: 'calc((100% - ' + uni.upx2px(diyComponent.value.imageGap * 2) + 'px) / 2)'
|
||||||
|
},
|
||||||
|
'row1-of3': {
|
||||||
|
ratio: 3,
|
||||||
|
width: 'calc((100% - ' + uni.upx2px(diyComponent.value.imageGap * 4) + 'px) / 3)'
|
||||||
|
},
|
||||||
|
'row1-of4': {
|
||||||
|
ratio: 4,
|
||||||
|
width: 'calc((100% - ' + uni.upx2px(diyComponent.value.imageGap * 6) + 'px) / 4)'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
diyComponent.value.list.forEach((item, index) => {
|
||||||
|
item.pageItemStyle = countBorderRadius(diyComponent.value.mode, index);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (singleRow[diyComponent.value.mode]) {
|
||||||
|
calcSingleRow(singleRow[diyComponent.value.mode]);
|
||||||
|
} else if (diyComponent.value.mode == 'row2-lt-of2-rt') {
|
||||||
|
calcFourSquare();
|
||||||
|
} else if (diyComponent.value.mode == 'row1-lt-of2-rt') {
|
||||||
|
calcRowOneLeftOfTwoRight();
|
||||||
|
} else if (diyComponent.value.mode == 'row1-tp-of2-bm') {
|
||||||
|
calcRowOneTopOfTwoBottom();
|
||||||
|
} else if (diyComponent.value.mode == 'row1-lt-of1-tp-of2-bm') {
|
||||||
|
calcRowOneLeftOfOneTopOfTwoBottom();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 魔方:单行多个,平分宽度
|
||||||
|
* 公式:
|
||||||
|
* 宽度:屏幕宽度/2,示例:375/2=187.5
|
||||||
|
* 比例:原图高/原图宽,示例:322/690=0.46
|
||||||
|
* 高度:宽度*比例,示例:187.5*0.46=86.25
|
||||||
|
*/
|
||||||
|
const calcSingleRow = (params) => {
|
||||||
|
uni.getSystemInfo({
|
||||||
|
success: res => {
|
||||||
|
let maxHeight = 0;
|
||||||
|
|
||||||
|
diyComponent.value.list.forEach((item, index) => {
|
||||||
|
var ratio = item.imgHeight / item.imgWidth;
|
||||||
|
|
||||||
|
let width = res.windowWidth - uni.upx2px(diyComponent.value.margin.both *
|
||||||
|
2); // 减去左右间距
|
||||||
|
if (diyComponent.value.imageGap > 0) {
|
||||||
|
width -= uni.upx2px(params.ratio * diyComponent.value.imageGap * 2); // 减去间隙
|
||||||
|
}
|
||||||
|
item.imgWidth = width / params.ratio;
|
||||||
|
item.imgHeight = item.imgWidth * ratio;
|
||||||
|
|
||||||
|
if (maxHeight == 0 || maxHeight < item.imgHeight) maxHeight = item
|
||||||
|
.imgHeight;
|
||||||
|
})
|
||||||
|
|
||||||
|
diyComponent.value.list.forEach((item, index) => {
|
||||||
|
item.widthStyle = params.width;
|
||||||
|
item.imgHeight = maxHeight;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 魔方:四方型,各占50%
|
||||||
|
*/
|
||||||
|
const calcFourSquare = () => {
|
||||||
|
uni.getSystemInfo({
|
||||||
|
success: res => {
|
||||||
|
let maxHeightFirst = 0;
|
||||||
|
let maxHeightTwo = 0;
|
||||||
|
diyComponent.value.list.forEach((item, index) => {
|
||||||
|
var ratio = item.imgHeight / item.imgWidth;
|
||||||
|
item.imgWidth = res.windowWidth;
|
||||||
|
item.imgWidth -= uni.upx2px(diyComponent.value.margin.both * 4);
|
||||||
|
if (diyComponent.value.imageGap > 0) {
|
||||||
|
item.imgWidth -= uni.upx2px(diyComponent.value.imageGap * 2);
|
||||||
|
}
|
||||||
|
item.imgWidth = item.imgWidth / 2;
|
||||||
|
item.imgHeight = item.imgWidth * ratio;
|
||||||
|
|
||||||
|
|
||||||
|
// 获取每行最大高度
|
||||||
|
if (index <= 1) {
|
||||||
|
if (maxHeightFirst == 0 || maxHeightFirst < item.imgHeight) {
|
||||||
|
maxHeightFirst = item.imgHeight;
|
||||||
|
}
|
||||||
|
} else if (index > 1) {
|
||||||
|
if (maxHeightTwo == 0 || maxHeightTwo < item.imgHeight) {
|
||||||
|
maxHeightTwo = item.imgHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
diyComponent.value.list.forEach((item, index) => {
|
||||||
|
item.imgWidth = 'calc((100% - ' + uni.upx2px(diyComponent.value.imageGap * 2) +
|
||||||
|
'px) / 2)';
|
||||||
|
item.widthStyle = item.imgWidth;
|
||||||
|
if (index <= 1) {
|
||||||
|
item.imgHeight = maxHeightFirst;
|
||||||
|
} else if (index > 1) {
|
||||||
|
item.imgHeight = maxHeightTwo;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 魔方:1左2右
|
||||||
|
*/
|
||||||
|
const calcRowOneLeftOfTwoRight = () => {
|
||||||
|
let rightHeight = 0; // 右侧两图平分高度
|
||||||
|
let divide = 'left'; // 划分规则,left:左,right:右
|
||||||
|
if (diyComponent.value.list[1].imgWidth === diyComponent.value.list[2].imgWidth) divide = 'right';
|
||||||
|
uni.getSystemInfo({
|
||||||
|
success: res => {
|
||||||
|
diyComponent.value.list.forEach((item, index) => {
|
||||||
|
if (index == 0) {
|
||||||
|
var ratio = item.imgHeight / item.imgWidth; // 获取左图的尺寸比例
|
||||||
|
item.imgWidth = res.windowWidth - uni.upx2px(diyComponent.value.margin
|
||||||
|
.both * 4) - uni.upx2px(diyComponent.value.imageGap * 2);
|
||||||
|
item.imgWidth = item.imgWidth / 2;
|
||||||
|
item.imgHeight = item.imgWidth * ratio;
|
||||||
|
rightHeight = (item.imgHeight - uni.upx2px(diyComponent.value.imageGap *
|
||||||
|
2)) / 2;
|
||||||
|
item.imgWidth += 'px';
|
||||||
|
} else {
|
||||||
|
item.imgWidth = diyComponent.value.list[0].imgWidth;
|
||||||
|
item.imgHeight = rightHeight;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 魔方:1上2下
|
||||||
|
*/
|
||||||
|
const calcRowOneTopOfTwoBottom = () => {
|
||||||
|
var maxHeight = 0;
|
||||||
|
uni.getSystemInfo({
|
||||||
|
success: res => {
|
||||||
|
diyComponent.value.list.forEach((item, index) => {
|
||||||
|
|
||||||
|
var ratio = item.imgHeight / item.imgWidth; // 获取左图的尺寸比例
|
||||||
|
if (index == 0) {
|
||||||
|
item.imgWidth = res.windowWidth - uni.upx2px(diyComponent.value.margin
|
||||||
|
.both * 4);
|
||||||
|
} else if (index > 0) {
|
||||||
|
item.imgWidth = res.windowWidth - uni.upx2px(diyComponent.value.margin
|
||||||
|
.both * 4) - uni.upx2px(diyComponent.value.imageGap * 2);
|
||||||
|
item.imgWidth = item.imgWidth / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
item.imgHeight = item.imgWidth * ratio;
|
||||||
|
|
||||||
|
// 获取最大高度
|
||||||
|
if (index > 0 && (maxHeight == 0 || maxHeight < item.imgHeight))
|
||||||
|
maxHeight = item.imgHeight;
|
||||||
|
|
||||||
|
});
|
||||||
|
diyComponent.value.list.forEach((item, index) => {
|
||||||
|
item.imgWidth += 'px';
|
||||||
|
item.widthStyle = item.imgWidth;
|
||||||
|
if (index > 0) item.imgHeight = maxHeight;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 魔方:1左3右
|
||||||
|
*/
|
||||||
|
const calcRowOneLeftOfOneTopOfTwoBottom = () => {
|
||||||
|
uni.getSystemInfo({
|
||||||
|
success: res => {
|
||||||
|
diyComponent.value.list.forEach((item, index) => {
|
||||||
|
// 左图
|
||||||
|
if (index == 0) {
|
||||||
|
var ratio = item.imgHeight / item.imgWidth; // 获取左图的尺寸比例
|
||||||
|
item.imgWidth = res.windowWidth - uni.upx2px(diyComponent.value.margin
|
||||||
|
.both * 4) - uni.upx2px(diyComponent.value.imageGap * 2);
|
||||||
|
item.imgWidth = item.imgWidth / 2;
|
||||||
|
item.imgHeight = item.imgWidth * ratio;
|
||||||
|
} else if (index == 1) {
|
||||||
|
item.imgWidth = diyComponent.value.list[0].imgWidth;
|
||||||
|
item.imgHeight = (diyComponent.value.list[0].imgHeight - uni.upx2px(diyComponent.value
|
||||||
|
.imageGap * 2)) / 2;
|
||||||
|
} else if (index > 1) {
|
||||||
|
item.imgWidth = (diyComponent.value.list[0].imgWidth - uni.upx2px(diyComponent.value
|
||||||
|
.imageGap * 2)) / 2;
|
||||||
|
item.imgHeight = diyComponent.value.list[1].imgHeight;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
diyComponent.value.list.forEach((item, index) => {
|
||||||
|
item.imgWidth += 'px';
|
||||||
|
item.imgHeight;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss">
|
||||||
|
.rubik-cube {
|
||||||
|
overflow: hidden;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
|
||||||
|
.item {
|
||||||
|
text-align: center;
|
||||||
|
line-height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 一行两个
|
||||||
|
.rubik-cube .item.row1-of2 {
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-top: 0 !important;
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rubik-cube .item.row1-of2:nth-child(1) {
|
||||||
|
margin-left: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rubik-cube .item.row1-of2:nth-child(2) {
|
||||||
|
margin-right: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 一行三个
|
||||||
|
.rubik-cube .item.row1-of3 {
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-top: 0 !important;
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rubik-cube .item.row1-of3:nth-child(1) {
|
||||||
|
margin-left: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rubik-cube .item.row1-of3:nth-child(3) {
|
||||||
|
margin-right: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 一行四个
|
||||||
|
.rubik-cube .item.row1-of4 {
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-top: 0 !important;
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rubik-cube .item.row1-of4:nth-child(1) {
|
||||||
|
margin-left: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rubik-cube .item.row1-of4:nth-child(4) {
|
||||||
|
margin-right: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 两左两右
|
||||||
|
.rubik-cube .item.row2-lt-of2-rt {
|
||||||
|
// width: 50%;
|
||||||
|
display: inline-block;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rubik-cube .item.row2-lt-of2-rt:nth-child(1) {
|
||||||
|
margin-left: 0 !important;
|
||||||
|
margin-top: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rubik-cube .item.row2-lt-of2-rt:nth-child(2) {
|
||||||
|
margin-right: 0 !important;
|
||||||
|
margin-top: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rubik-cube .item.row2-lt-of2-rt:nth-child(3) {
|
||||||
|
margin-left: 0 !important;
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rubik-cube .item.row2-lt-of2-rt:nth-child(4) {
|
||||||
|
margin-right: 0 !important;
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 一左两右
|
||||||
|
.rubik-cube .template-left,
|
||||||
|
.rubik-cube .template-right {
|
||||||
|
// width: 50%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rubik-cube .template-left .item.row1-lt-of2-rt:nth-child(1) {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rubik-cube .template-right .item.row1-lt-of2-rt:nth-child(2) {
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rubik-cube.row1-lt-of2-rt .template-right {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 一上两下
|
||||||
|
.rubik-cube .item.row1-tp-of2-bm:nth-child(1) {
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-top: 0 !important;
|
||||||
|
margin-left: 0 !important;
|
||||||
|
margin-right: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rubik-cube .item.row1-tp-of2-bm:nth-child(2) {
|
||||||
|
// width: 50%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-left: 0 !important;
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rubik-cube .item.row1-tp-of2-bm:nth-child(3) {
|
||||||
|
// width: 50%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-right: 0 !important;
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 一左三右
|
||||||
|
.rubik-cube .template-left .item.row1-lt-of1-tp-of2-bm {
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rubik-cube .template-bottom {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rubik-cube .template-bottom .item:nth-child(2) {
|
||||||
|
margin-right: 0 !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@ -1,39 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<view :style="warpCss">
|
<view>
|
||||||
固定模板示例,我也可以装修
|
固定模板示例,我也可以装修
|
||||||
我定义的数据源:{{ diyComponent.componentName }}
|
<!-- 自定义模板渲染 -->
|
||||||
|
<diy-group :data="props.data" :pullDownRefresh="props.pullDownRefresh"></diy-group>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, watch } from 'vue';
|
import { computed, watch } from 'vue';
|
||||||
import useDiyStore from '@/stores/diy';
|
const props = defineProps(['data', 'pullDownRefresh']);
|
||||||
|
|
||||||
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>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<style></style>
|
||||||
@ -1,14 +1,12 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="fixed-group">
|
<view class="fixed-group">
|
||||||
<template v-if="props.component.componentName == 'DemoIndex'">
|
<template v-if="props.data.global.component == 'demo-index'">
|
||||||
<fixed-demo-index :component="props.component" :index="props.index"
|
<fixed-demo-index :data="props.data" :pullDownRefresh="props.pullDownRefresh"></fixed-demo-index>
|
||||||
:pullDownRefresh="props.pullDownRefresh"></fixed-demo-index>
|
|
||||||
</template>
|
</template>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, watch } from 'vue';
|
const props = defineProps(['data', 'pullDownRefresh']);
|
||||||
const props = defineProps(['component', 'index', 'pullDownRefresh']);
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import './index.scss';
|
@import './index.scss';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<u-popup :show="show" :round="10" @close="handleClose" :closeable="true" bgColor="#fff"
|
<u-popup :show="show" :round="10" @close="handleClose" :closeable="true" bgColor="#fff" zIndex="10081"
|
||||||
:closeOnClickOverlay="false">
|
:closeOnClickOverlay="false">
|
||||||
<view class="flex flex-col h-[75vh]" v-if="payInfo">
|
<view class="flex flex-col h-[75vh]" v-if="payInfo">
|
||||||
<view class="head">
|
<view class="head">
|
||||||
@ -63,7 +63,8 @@
|
|||||||
loading.value = true
|
loading.value = true
|
||||||
|
|
||||||
pay({
|
pay({
|
||||||
out_trade_no: payInfo.value?.out_trade_no,
|
trade_type: payInfo.value?.trade_type,
|
||||||
|
trade_id: payInfo.value?.trade_id,
|
||||||
type: type.value
|
type: type.value
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
switch (type.value) {
|
switch (type.value) {
|
||||||
@ -73,7 +74,7 @@
|
|||||||
provider: 'wxpay',
|
provider: 'wxpay',
|
||||||
...res.data,
|
...res.data,
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
redirect({ url: '/pages/pay/result', param: { code: payInfo.value?.out_trade_no }, mode: 'redirectTo' })
|
toPayResult()
|
||||||
},
|
},
|
||||||
fail: (res) => {
|
fail: (res) => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
@ -87,32 +88,30 @@
|
|||||||
wechat.pay({
|
wechat.pay({
|
||||||
...res.data,
|
...res.data,
|
||||||
success: () => {
|
success: () => {
|
||||||
redirect({ url: '/pages/pay/result', param: { code: payInfo.value?.out_trade_no }, mode: 'redirectTo' })
|
toPayResult()
|
||||||
},
|
},
|
||||||
cancel: () => {
|
cancel: () => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
uni.setStorageSync('paymenting', payInfo.value?.out_trade_no)
|
uni.setStorageSync('paymenting', { trade_type: payInfo.value?.trade_type, trade_id: payInfo.value?.trade_id })
|
||||||
location.href = res.data.h5_url
|
location.href = res.data.h5_url
|
||||||
addListenerPayBack()
|
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
break;
|
break;
|
||||||
case 'alipay':
|
case 'alipay':
|
||||||
// #ifdef H5
|
// #ifdef H5
|
||||||
if (isWeixinBrowser()) {
|
if (isWeixinBrowser()) {
|
||||||
redirect({ url: '/pages/pay/browser', param: { code: payInfo.value?.out_trade_no, alipay: encodeURIComponent(res.data.url) }, mode: 'redirectTo' })
|
redirect({ url: '/pages/pay/browser', param: { trade_type: payInfo.value?.trade_type, trade_id: payInfo.value?.trade_id, alipay: encodeURIComponent(res.data.url) }, mode: 'redirectTo' })
|
||||||
} else {
|
} else {
|
||||||
uni.setStorageSync('paymenting', payInfo.value?.out_trade_no)
|
uni.setStorageSync('paymenting', { trade_type: payInfo.value?.trade_type, trade_id: payInfo.value?.trade_id })
|
||||||
location.href = res.data.url
|
location.href = res.data.url
|
||||||
addListenerPayBack()
|
|
||||||
}
|
}
|
||||||
// #endif
|
// #endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
redirect({ url: '/pages/pay/result', param: { code: payInfo.value?.out_trade_no }, mode: 'redirectTo' })
|
toPayResult()
|
||||||
}
|
}
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
@ -123,10 +122,14 @@
|
|||||||
* 检测是否是支付后返回
|
* 检测是否是支付后返回
|
||||||
*/
|
*/
|
||||||
uni.$on('checkIsReturnAfterPayment', () => {
|
uni.$on('checkIsReturnAfterPayment', () => {
|
||||||
|
const data = uni.getStorageSync('paymenting')
|
||||||
if (uni.getStorageSync('paymenting')) {
|
if (uni.getStorageSync('paymenting')) {
|
||||||
redirect({
|
redirect({
|
||||||
url: '/pages/pay/result',
|
url: '/pages/pay/result',
|
||||||
param: { code: uni.getStorageSync('paymenting') },
|
param: {
|
||||||
|
trade_type: data.trade_type,
|
||||||
|
trade_id: data.trade_id
|
||||||
|
},
|
||||||
mode: 'redirectTo',
|
mode: 'redirectTo',
|
||||||
success() {
|
success() {
|
||||||
uni.removeStorageSync('paymenting')
|
uni.removeStorageSync('paymenting')
|
||||||
@ -135,28 +138,36 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const open = (outTradeNo : string) => {
|
const open = (tradeType : string, tradeId : number, payReturn: string = '') => {
|
||||||
getPayInfo(outTradeNo)
|
// 设置支付后跳转页面
|
||||||
|
uni.setStorageSync('payReturn', encodeURIComponent(payReturn))
|
||||||
|
|
||||||
|
getPayInfo(tradeType, tradeId)
|
||||||
.then((res : any) => {
|
.then((res : any) => {
|
||||||
let { data } = res
|
let { data } = res
|
||||||
|
payInfo.value = data
|
||||||
|
|
||||||
if (uni.$u.test.isEmpty(data)) {
|
if (uni.$u.test.isEmpty(data)) {
|
||||||
uni.showToast({ title: t('pay.notObtainedInfo'), icon: 'none' })
|
uni.showToast({ title: t('pay.notObtainedInfo'), icon: 'none' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (data.money == 0) {
|
if (data.money == 0) {
|
||||||
redirect({ url: '/pages/pay/result', param: { code: outTradeNo }, mode: 'redirectTo' })
|
toPayResult()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (data.status != 0) {
|
if (data.status != 0) {
|
||||||
uni.showToast({ title: t('pay.paymentDocuments') + data.status_name, icon: 'none' })
|
uni.showToast({ title: t('pay.paymentDocuments') + data.status_name, icon: 'none' })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
payInfo.value = data
|
|
||||||
type.value = data.pay_type_list[0] ? data.pay_type_list[0].key : ''
|
type.value = data.pay_type_list[0] ? data.pay_type_list[0].key : ''
|
||||||
show.value = true
|
show.value = true
|
||||||
})
|
})
|
||||||
.catch(() => { })
|
.catch(() => { })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const toPayResult = ()=> {
|
||||||
|
redirect({ url: '/pages/pay/result', param: { trade_type: payInfo.value?.trade_type, trade_id: payInfo.value?.trade_id }, mode: 'redirectTo' })
|
||||||
|
}
|
||||||
|
|
||||||
const emits = defineEmits(['close'])
|
const emits = defineEmits(['close'])
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<u-tabbar :value="value" @change="tabbarChange" :fixed="true" :placeholder="true" :safeAreaInsetBottom="true"
|
<u-tabbar :value="value" @change="tabbarChange" zIndex="9999" :fixed="true" :placeholder="true" :safeAreaInsetBottom="true"
|
||||||
:inactive-color="tabbar.textColor" :active-color="tabbar.textHoverColor" v-if="tabbar">
|
:inactive-color="tabbar.textColor" :active-color="tabbar.textHoverColor" v-if="tabbar">
|
||||||
<block v-for="item in tabbar.list">
|
<block v-for="item in tabbar.list">
|
||||||
<u-tabbar-item :style="{'background-color': tabbar.backgroundColor}" :text="item.text"
|
<u-tabbar-item :style="{'background-color': tabbar.backgroundColor}" :text="item.text"
|
||||||
|
|||||||
@ -4,13 +4,21 @@
|
|||||||
|
|
||||||
<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.pageMode != '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" :pullDownRefresh="pullDownRefresh"></diy-group>
|
<diy-group :data="data" :pullDownRefresh="pullDownRefresh"></diy-group>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 固定模板渲染 -->
|
||||||
|
<view class="fixed-template-wrap" v-if="data.pageMode == 'fixed'">
|
||||||
|
|
||||||
|
<fixed-group :data="data" :pullDownRefresh="pullDownRefresh"></fixed-group>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -32,6 +40,8 @@
|
|||||||
const pullDownRefresh = ref(0)
|
const pullDownRefresh = ref(0)
|
||||||
|
|
||||||
const diyData = reactive({
|
const diyData = reactive({
|
||||||
|
pageMode: 'diy',
|
||||||
|
title: '',
|
||||||
global: {},
|
global: {},
|
||||||
value: []
|
value: []
|
||||||
})
|
})
|
||||||
@ -76,9 +86,10 @@
|
|||||||
}).then((res : any) => {
|
}).then((res : any) => {
|
||||||
if (res.data.value) {
|
if (res.data.value) {
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
diyData.mode = data.mode;
|
diyData.pageMode = data.mode;
|
||||||
|
diyData.title = data.title;
|
||||||
|
|
||||||
let sources = JSON.parse(res.data.value);
|
let sources = JSON.parse(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) => {
|
||||||
@ -92,7 +103,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: diyData.global.title
|
title: diyData.title
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -4,13 +4,21 @@
|
|||||||
|
|
||||||
<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.pageMode != '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" :pullDownRefresh="pullDownRefresh"></diy-group>
|
<diy-group :data="data" :pullDownRefresh="pullDownRefresh"></diy-group>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 固定模板渲染 -->
|
||||||
|
<view class="fixed-template-wrap" v-if="data.pageMode == 'fixed'">
|
||||||
|
|
||||||
|
<fixed-group :data="data" :pullDownRefresh="pullDownRefresh"></fixed-group>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -34,6 +42,8 @@
|
|||||||
|
|
||||||
// 自定义页面 数据
|
// 自定义页面 数据
|
||||||
const diyData = reactive({
|
const diyData = reactive({
|
||||||
|
pageMode: 'diy',
|
||||||
|
title: '',
|
||||||
global: {},
|
global: {},
|
||||||
value: []
|
value: []
|
||||||
})
|
})
|
||||||
@ -72,9 +82,10 @@
|
|||||||
}).then((res : any) => {
|
}).then((res : any) => {
|
||||||
if (res.data.value) {
|
if (res.data.value) {
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
diyData.mode = data.mode;
|
diyData.pageMode = data.mode;
|
||||||
|
diyData.title = data.title;
|
||||||
|
|
||||||
let sources = JSON.parse(data.value);
|
let sources = JSON.parse(data.value);
|
||||||
diyData.title = sources.title;
|
|
||||||
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) => {
|
||||||
@ -88,7 +99,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: diyData.global.title
|
title: diyData.title
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -138,7 +138,7 @@
|
|||||||
rechargeLoading.value = true
|
rechargeLoading.value = true
|
||||||
|
|
||||||
createRecharge({ recharge_money: rechargeAmount.value }).then(res => {
|
createRecharge({ recharge_money: rechargeAmount.value }).then(res => {
|
||||||
payRef.value?.open(res.data.out_trade_no)
|
payRef.value?.open(res.data.trade_type, res.data.trade_id)
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
rechargeLoading.value = false
|
rechargeLoading.value = false
|
||||||
})
|
})
|
||||||
|
|||||||
@ -4,13 +4,21 @@
|
|||||||
|
|
||||||
<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.pageMode != '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" :pullDownRefresh="pullDownRefresh"></diy-group>
|
<diy-group :data="data" :pullDownRefresh="pullDownRefresh"></diy-group>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
|
<!-- 固定模板渲染 -->
|
||||||
|
<view class="fixed-template-wrap" v-if="data.pageMode == 'fixed'">
|
||||||
|
|
||||||
|
<fixed-group :data="data" :pullDownRefresh="pullDownRefresh"></fixed-group>
|
||||||
|
|
||||||
|
</view>
|
||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@ -28,6 +36,8 @@
|
|||||||
const pullDownRefresh = ref(0)
|
const pullDownRefresh = ref(0)
|
||||||
|
|
||||||
const diyData = reactive({
|
const diyData = reactive({
|
||||||
|
pageMode: 'diy',
|
||||||
|
title: '',
|
||||||
global: {},
|
global: {},
|
||||||
value: []
|
value: []
|
||||||
})
|
})
|
||||||
@ -66,8 +76,10 @@
|
|||||||
}).then((res : any) => {
|
}).then((res : any) => {
|
||||||
if (res.data.value) {
|
if (res.data.value) {
|
||||||
let data = res.data;
|
let data = res.data;
|
||||||
diyData.mode = data.mode;
|
diyData.pageMode = data.mode;
|
||||||
let sources = JSON.parse(res.data.value);
|
diyData.title = data.title;
|
||||||
|
|
||||||
|
let sources = JSON.parse(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) => {
|
||||||
@ -81,7 +93,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: diyData.global.title
|
title: diyData.title
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
loading.value = false;
|
loading.value = false;
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
onLoad((data : AnyObject) => {
|
onLoad((data : AnyObject) => {
|
||||||
if (!isWeixinBrowser() && data.alipay) {
|
if (!isWeixinBrowser() && data.alipay) {
|
||||||
uni.setStorageSync('paymenting', data.code)
|
uni.setStorageSync('paymenting', { trade_type: data.trade_type, trade_id: data.trade_id })
|
||||||
location.href = decodeURIComponent(data.alipay)
|
location.href = decodeURIComponent(data.alipay)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -32,11 +32,13 @@
|
|||||||
|
|
||||||
const payInfo = ref<AnyObject | null>(null)
|
const payInfo = ref<AnyObject | null>(null)
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
let outTradeNo = ''
|
let tradeType = ''
|
||||||
|
let tradeId = 0
|
||||||
let requestNum = 0
|
let requestNum = 0
|
||||||
|
|
||||||
onLoad((data : any) => {
|
onLoad((data : any) => {
|
||||||
outTradeNo = data.code
|
tradeType = data.trade_type
|
||||||
|
tradeId = data.trade_id
|
||||||
getPayInfo()
|
getPayInfo()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -44,7 +46,7 @@
|
|||||||
* 获取支付信息
|
* 获取支付信息
|
||||||
*/
|
*/
|
||||||
const getPayInfo = () => {
|
const getPayInfo = () => {
|
||||||
getPayInfoApi(outTradeNo)
|
getPayInfoApi(tradeType, tradeId)
|
||||||
.then((res : responseResult) => {
|
.then((res : responseResult) => {
|
||||||
if (!uni.$u.test.isEmpty(res.data)) {
|
if (!uni.$u.test.isEmpty(res.data)) {
|
||||||
if (res.data.status == 1 && requestNum < 5) {
|
if (res.data.status == 1 && requestNum < 5) {
|
||||||
|
|||||||
@ -3,6 +3,7 @@ import { toRaw } from 'vue'
|
|||||||
|
|
||||||
interface Diy {
|
interface Diy {
|
||||||
mode : string, // 模式:decorate 装修,为空表示正常
|
mode : string, // 模式:decorate 装修,为空表示正常
|
||||||
|
pageMode : string, // 页面展示模式,diy:自定义,fixed:固定
|
||||||
currentIndex : number,
|
currentIndex : number,
|
||||||
global : {
|
global : {
|
||||||
title : string,
|
title : string,
|
||||||
@ -17,6 +18,7 @@ const useDiyStore = defineStore('diy', {
|
|||||||
state: () : Diy => {
|
state: () : Diy => {
|
||||||
return {
|
return {
|
||||||
mode: '',
|
mode: '',
|
||||||
|
pageMode: 'diy',
|
||||||
currentIndex: -99,
|
currentIndex: -99,
|
||||||
global: {
|
global: {
|
||||||
title: "",
|
title: "",
|
||||||
@ -46,6 +48,7 @@ const useDiyStore = defineStore('diy', {
|
|||||||
try {
|
try {
|
||||||
let data = JSON.parse(event.data);
|
let data = JSON.parse(event.data);
|
||||||
this.currentIndex = data.currentIndex;
|
this.currentIndex = data.currentIndex;
|
||||||
|
this.pageMode = data.pageMode;
|
||||||
if (data.global) this.global = data.global;
|
if (data.global) this.global = data.global;
|
||||||
if (data.value) this.value = data.value;
|
if (data.value) this.value = data.value;
|
||||||
|
|
||||||
|
|||||||
@ -95,8 +95,11 @@ class Request {
|
|||||||
this.config.showSuccessMessage && uni.showToast({ title: data.msg, icon: 'none' })
|
this.config.showSuccessMessage && uni.showToast({ title: data.msg, icon: 'none' })
|
||||||
resolve(data)
|
resolve(data)
|
||||||
} else {
|
} else {
|
||||||
this.handleAuthError(data.code)
|
if (data.code == 0) {
|
||||||
this.config.showErrorMessage && uni.showToast({ title: data.msg, icon: 'none' })
|
uni.showToast({ title: data.msg, icon: 'none' })
|
||||||
|
} else {
|
||||||
|
this.handleAuthError(data.code)
|
||||||
|
}
|
||||||
reject(data)
|
reject(data)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -128,8 +131,11 @@ class Request {
|
|||||||
this.config.showSuccessMessage && uni.showToast({ title: data.msg, icon: 'none' })
|
this.config.showSuccessMessage && uni.showToast({ title: data.msg, icon: 'none' })
|
||||||
resolve(data)
|
resolve(data)
|
||||||
} else {
|
} else {
|
||||||
this.handleAuthError(data.code)
|
if (data.code == 0) {
|
||||||
this.config.showErrorMessage && uni.showToast({ title: data.msg, icon: 'none' })
|
uni.showToast({ title: data.msg, icon: 'none' })
|
||||||
|
} else {
|
||||||
|
this.handleAuthError(data.code)
|
||||||
|
}
|
||||||
reject(data)
|
reject(data)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user