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

View File

@ -129,7 +129,7 @@
import { ref, onMounted, watch, computed } from 'vue'; import { ref, onMounted, watch, computed } from 'vue';
import { img, diyRedirect, currRoute, getToken } from '@/utils/common'; import { img, diyRedirect, currRoute, getToken } from '@/utils/common';
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']);

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": { "easycom": {
"custom": { "custom": {
"^u-(.*)": "uview-plus/components/u-$1/u-$1.vue", "^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' }); uni.showToast({ title: t('pleaseEnterNumber'), icon: 'none' });
return; return;
} }
if (formData.siteId > 9999999) { // if (formData.siteId > 9999999) {
uni.showToast({ title: t('maximumCannotExceed') + '9999999', icon: 'none' }); // uni.showToast({ title: t('maximumCannotExceed') + '9999999', icon: 'none' });
return; // return;
} // }
uni.setStorageSync('wap_site_id', formData.siteId); uni.setStorageSync('wap_site_id', formData.siteId);

View File

@ -1,10 +1,24 @@
<template> <template>
<view> <view>
<u-loading-page :loading="loading" loadingText=""></u-loading-page> <u-loading-page :loading="loading" loadingText="" bg-color="#f7f7f7"></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) + ')' : '' }" <view v-show="!loading">
class="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) + ')' : '' }">
<diy-group :data="data"></diy-group> <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>
</view> </view>
</template> </template>
@ -62,6 +76,10 @@
name: name.value name: name.value
}).then((res : any) => { }).then((res : any) => {
if (res.data.value) { if (res.data.value) {
let data = res.data;
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;
@ -78,6 +96,15 @@
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;

View File

@ -1,10 +1,24 @@
<template> <template>
<view> <view>
<u-loading-page :loading="loading" loadingText=""></u-loading-page> <u-loading-page :loading="loading" loadingText="" bg-color="#f7f7f7"></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) + ')' : '' }" <view v-show="!loading">
class="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) + ')' : '' }">
<diy-group :data="data"></diy-group> <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>
</view> </view>
</template> </template>
@ -25,6 +39,7 @@
const loading = ref(true); const loading = ref(true);
const diyStore = useDiyStore(); const diyStore = useDiyStore();
//
const diyData = reactive({ const diyData = reactive({
global: {}, global: {},
value: [] value: []
@ -57,7 +72,12 @@
name: 'DIY_INDEX' name: 'DIY_INDEX'
}).then((res : any) => { }).then((res : any) => {
if (res.data.value) { if (res.data.value) {
let sources = JSON.parse(res.data.value); 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.global = sources.global;
diyData.value = sources.value; diyData.value = sources.value;
diyData.value.forEach((item, index) => { diyData.value.forEach((item, index) => {
@ -73,6 +93,16 @@
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;

View File

@ -1,10 +1,24 @@
<template> <template>
<view> <view>
<u-loading-page :loading="loading" loadingText=""></u-loading-page> <u-loading-page :loading="loading" loadingText="" bg-color="#f7f7f7"></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) + ')' : '' }" <view v-show="!loading">
class="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) + ')' : '' }">
<diy-group :data="data"></diy-group> <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>
</view> </view>
</template> </template>
@ -52,6 +66,9 @@
name: 'DIY_MEMBER_INDEX' name: 'DIY_MEMBER_INDEX'
}).then((res : any) => { }).then((res : any) => {
if (res.data.value) { if (res.data.value) {
let data = res.data;
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;
@ -68,6 +85,15 @@
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;
}); });

View File

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

View File

@ -21,10 +21,10 @@ class Request {
// #ifdef H5 // #ifdef H5
this.baseUrl = import.meta.env.VITE_APP_BASE_URL || `${location.origin}/api/` this.baseUrl = import.meta.env.VITE_APP_BASE_URL || `${location.origin}/api/`
// #endif // #endif
// #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 += '/')
try { try {
if (process.env.NODE_ENV == 'development') { if (process.env.NODE_ENV == 'development') {