update uni-app

This commit is contained in:
全栈小学生 2023-06-21 16:55:50 +08:00
parent 38010ed1b5
commit a1dff2a58c
11 changed files with 171 additions and 71 deletions

View File

@ -6,6 +6,7 @@
<script setup lang="ts">
import { redirect, diyRedirect, currRoute, getToken } from '@/utils/common'
import { useLogin } from '@/hooks/useLogin';
const prop = defineProps({
url: String,

View File

@ -129,7 +129,7 @@
import { ref, onMounted, watch, computed } from 'vue';
import { img, diyRedirect, currRoute, getToken } from '@/utils/common';
import useDiyStore from '@/stores/diy';
import { useLogin } from '@/hooks/useLogin'
import { useLogin } from '@/hooks/useLogin';
const props = defineProps(['component', 'index']);

View File

@ -0,0 +1,15 @@
<template>
<view class="fixed-group">
</view>
</template>
<script lang="ts" setup>
import { computed } from 'vue';
const props = defineProps(['data']);
const data = computed(() => {
return props.data.value;
})
</script>
<style lang="scss" scoped>
@import './index.scss';
</style>

View File

@ -296,7 +296,8 @@
"easycom": {
"custom": {
"^u-(.*)": "uview-plus/components/u-$1/u-$1.vue",
"diy-(\W.*)": "@/components/diy/$1/index.vue"
"diy-(\W.*)": "@/components/diy/$1/index.vue",
"fixed-(\W.*)": "@/components/fixed/$1/index.vue"
}
}
}

View File

@ -41,10 +41,10 @@
uni.showToast({ title: t('pleaseEnterNumber'), icon: 'none' });
return;
}
if (formData.siteId > 9999999) {
uni.showToast({ title: t('maximumCannotExceed') + '9999999', icon: 'none' });
return;
}
// if (formData.siteId > 9999999) {
// uni.showToast({ title: t('maximumCannotExceed') + '9999999', icon: 'none' });
// return;
// }
uni.setStorageSync('wap_site_id', formData.siteId);

View File

@ -1,10 +1,24 @@
<template>
<view>
<u-loading-page :loading="loading" loadingText=""></u-loading-page>
<view v-show="!loading"
:style="{ backgroundColor: data.global.pageBgColor,minHeight: 'calc(100vh - 50px)',backgroundImage : data.global.bgUrl ? 'url(' + img(data.global.bgUrl) + ')' : '' }"
class="bg-index">
<diy-group :data="data"></diy-group>
<u-loading-page :loading="loading" loadingText="" bg-color="#f7f7f7"></u-loading-page>
<view v-show="!loading">
<!-- 自定义模板渲染 -->
<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) + ')' : '' }">
<diy-group :data="data"></diy-group>
</view>
<!-- 固定模板渲染 -->
<view class="fixed-template-wrap" v-if="data.mode == 'fixed'">
<fixed-group :data="data"></fixed-group>
</view>
</view>
</view>
</template>
@ -62,22 +76,35 @@
name: name.value
}).then((res : any) => {
if (res.data.value) {
let sources = JSON.parse(res.data.value);
diyData.global = sources.global;
diyData.value = sources.value;
diyData.value.forEach((item, index) => {
item.pageStyle = '';
if (item.pageBgColor) item.pageStyle += 'background-color:' + item.pageBgColor + ';';
if (item.margin) {
item.pageStyle += 'padding-top:' + item.margin.top * 2 + 'rpx' + ';';
item.pageStyle += 'padding-bottom:' + item.margin.bottom * 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
})
let data = res.data;
diyData.mode = data.mode;
if (data.mode == 'diy') {
let sources = JSON.parse(res.data.value);
diyData.global = sources.global;
diyData.value = sources.value;
diyData.value.forEach((item, index) => {
item.pageStyle = '';
if (item.pageBgColor) item.pageStyle += 'background-color:' + item.pageBgColor + ';';
if (item.margin) {
item.pageStyle += 'padding-top:' + item.margin.top * 2 + 'rpx' + ';';
item.pageStyle += 'padding-bottom:' + item.margin.bottom * 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
})
} 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;

View File

@ -1,10 +1,24 @@
<template>
<view>
<u-loading-page :loading="loading" loadingText=""></u-loading-page>
<view v-show="!loading"
:style="{ backgroundColor: data.global.pageBgColor,minHeight: 'calc(100vh - 50px)',backgroundImage : data.global.bgUrl ? 'url(' + img(data.global.bgUrl) + ')' : '' }"
class="bg-index">
<diy-group :data="data"></diy-group>
<u-loading-page :loading="loading" loadingText="" bg-color="#f7f7f7"></u-loading-page>
<view v-show="!loading">
<!-- 自定义模板渲染 -->
<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) + ')' : '' }">
<diy-group :data="data"></diy-group>
</view>
<!-- 固定模板渲染 -->
<view class="fixed-template-wrap" v-if="data.mode == 'fixed'">
<fixed-group :data="data"></fixed-group>
</view>
</view>
</view>
</template>
@ -25,6 +39,7 @@
const loading = ref(true);
const diyStore = useDiyStore();
//
const diyData = reactive({
global: {},
value: []
@ -57,22 +72,37 @@
name: 'DIY_INDEX'
}).then((res : any) => {
if (res.data.value) {
let sources = JSON.parse(res.data.value);
diyData.global = sources.global;
diyData.value = sources.value;
diyData.value.forEach((item, index) => {
item.pageStyle = '';
if (item.pageBgColor) item.pageStyle += 'background-color:' + item.pageBgColor + ';';
if (item.margin) {
item.pageStyle += 'padding-top:' + item.margin.top * 2 + 'rpx' + ';';
item.pageStyle += 'padding-bottom:' + item.margin.bottom * 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
})
let data = res.data;
diyData.mode = data.mode;
if (data.mode == 'diy') {
//
let sources = JSON.parse(data.value);
diyData.title = sources.title;
diyData.global = sources.global;
diyData.value = sources.value;
diyData.value.forEach((item, index) => {
item.pageStyle = '';
if (item.pageBgColor) item.pageStyle += 'background-color:' + item.pageBgColor + ';';
if (item.margin) {
item.pageStyle += 'padding-top:' + item.margin.top * 2 + 'rpx' + ';';
item.pageStyle += 'padding-bottom:' + item.margin.bottom * 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
})
} 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;

View File

@ -1,10 +1,24 @@
<template>
<view>
<u-loading-page :loading="loading" loadingText=""></u-loading-page>
<view v-show="!loading"
:style="{ backgroundColor: data.global.pageBgColor,minHeight: 'calc(100vh - 50px)',backgroundImage : data.global.bgUrl ? 'url(' + img(data.global.bgUrl) + ')' : '' }"
class="bg-index">
<diy-group :data="data"></diy-group>
<u-loading-page :loading="loading" loadingText="" bg-color="#f7f7f7"></u-loading-page>
<view v-show="!loading">
<!-- 自定义模板渲染 -->
<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) + ')' : '' }">
<diy-group :data="data"></diy-group>
</view>
<!-- 固定模板渲染 -->
<view class="fixed-template-wrap" v-if="data.mode == 'fixed'">
<fixed-group :data="data"></fixed-group>
</view>
</view>
</view>
</template>
@ -52,22 +66,34 @@
name: 'DIY_MEMBER_INDEX'
}).then((res : any) => {
if (res.data.value) {
let sources = JSON.parse(res.data.value);
diyData.global = sources.global;
diyData.value = sources.value;
diyData.value.forEach((item, index) => {
item.pageStyle = '';
if (item.pageBgColor) item.pageStyle += 'background-color:' + item.pageBgColor + ';';
if (item.margin) {
item.pageStyle += 'padding-top:' + item.margin.top * 2 + 'rpx' + ';';
item.pageStyle += 'padding-bottom:' + item.margin.bottom * 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
})
let data = res.data;
diyData.mode = data.mode;
if (data.mode == 'diy') {
let sources = JSON.parse(res.data.value);
diyData.global = sources.global;
diyData.value = sources.value;
diyData.value.forEach((item, index) => {
item.pageStyle = '';
if (item.pageBgColor) item.pageStyle += 'background-color:' + item.pageBgColor + ';';
if (item.margin) {
item.pageStyle += 'padding-top:' + item.margin.top * 2 + 'rpx' + ';';
item.pageStyle += 'padding-bottom:' + item.margin.bottom * 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
})
} 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;
});

View File

@ -224,7 +224,7 @@ export function mobileConceal(mobile : string) : string {
*/
export function getSiteId(siteid : number) {
// #ifdef H5
const match = location.href.match(/\/s(\d*)\//);
const match = location.href.match(/\/wap\/(\d*)\//);
if (match) return match[1]
else return siteid
// #endif

View File

@ -21,10 +21,10 @@ class Request {
// #ifdef H5
this.baseUrl = import.meta.env.VITE_APP_BASE_URL || `${location.origin}/api/`
// #endif
// #ifndef H5
this.baseUrl = import.meta.env.VITE_APP_BASE_URL
// #endif
this.baseUrl.substr(-1) != '/' && (this.baseUrl += '/')
try {
if (process.env.NODE_ENV == 'development') {