同步uniapp

This commit is contained in:
CQ 2026-01-31 11:27:49 +08:00
parent 5a2da25c9c
commit 3a89a12ff0
20 changed files with 111 additions and 7014 deletions

View File

@ -45,6 +45,7 @@
"@types/qrcode": "^1.5.0",
"@types/sortablejs": "^1.15.0",
"@vue/tsconfig": "^0.1.3",
"cross-env": "^7.0.3",
"sass": "^1.54.5",
"sass-loader": "10.4.1",
"typescript": "^4.9.4",

View File

@ -24,7 +24,7 @@
"build:app-android": "uni build -p app-android",
"build:app-ios": "uni build -p app-ios",
"build:custom": "uni build -p",
"build:h5": "uni build && node publish.cjs h5 build",
"build:h5": "cross-env NODE_OPTIONS=--max-old-space-size=4096 && uni build && node publish.cjs h5 build",
"build:h5:ssr": "uni build --ssr",
"build:mp-alipay": "uni build -p mp-alipay",
"build:mp-baidu": "uni build -p mp-baidu",
@ -33,7 +33,7 @@
"build:mp-lark": "uni build -p mp-lark",
"build:mp-qq": "uni build -p mp-qq",
"build:mp-toutiao": "uni build -p mp-toutiao",
"build:mp-weixin": "uni build -p mp-weixin && node publish.cjs mp-weixin build",
"build:mp-weixin": "cross-env NODE_OPTIONS=--max-old-space-size=4096 && uni build -p mp-weixin && node publish.cjs mp-weixin build",
"build:quickapp-webview": "uni build -p quickapp-webview",
"build:quickapp-webview-huawei": "uni build -p quickapp-webview-huawei",
"build:quickapp-webview-union": "uni build -p quickapp-webview-union",
@ -83,6 +83,7 @@
"vite": "4.0.4",
"vite-plugin-windicss": "^1.8.10",
"vue-tsc": "^1.0.24",
"windicss": "^3.5.6"
"windicss": "^3.5.6",
"cross-env": "^7.0.3"
}
}

View File

@ -15,6 +15,7 @@ const main = () => {
if (mode == 'build') {
handleWeappAddonComponents(mode)
handleWeappLanguage(mode)
handleProjectConfig(mode)
} else if (mode == 'dev') {
listenWeappRunDev()
}
@ -96,6 +97,19 @@ const handleWeappLanguage = (mode) => {
}
}
const handleProjectConfig = (mode) => {
const src = `./dist/${mode}/mp-weixin/project.config.json`
try {
let content = fs.readFileSync(src, 'utf8');
const config = JSON.parse(content)
config.setting.minifyWXML = false
fs.writeFileSync(src, JSON.stringify(config))
} catch (err) {
console.log(err)
}
}
const listenWeappRunDev = () => {
const devProcess = spawn('npm', ['run', 'dev:niu-mp-weixin'], {
stdio: ['pipe', 'pipe', 'pipe'],
@ -112,6 +126,7 @@ const listenWeappRunDev = () => {
serverReady = true;
handleWeappAddonComponents('dev')
handleWeappLanguage('dev')
handleProjectConfig('dev')
}
});

View File

@ -152,6 +152,7 @@ export function useDiyGroup(params: any = {}) {
})
onHide(() => {
isPagesHide.value = true;
diyStore.global.bottomTabBar.isShow = false
})
// 监听滚动事件

View File

@ -7,14 +7,6 @@ export function pay(data : AnyObject) {
return request.post(`pay`, data, { showErrorMessage: true })
}
/**
*
*/
export function testPay(data : AnyObject) {
return request.get(`home_service/pay/pay`, data, { showErrorMessage: true })
}
/**
*
*/

View File

@ -19,6 +19,9 @@
<wx-privacy-popup ref="wxPrivacyPopupRef"></wx-privacy-popup>
<!-- #endif -->
<template v-if="diyStore && diyStore.mode == '' && diyStore.global && diyStore.global.bottomTabBar && diyStore.global.bottomTabBar.isShow">
<tabbar :addon="diyStore.global.bottomTabBar.designNav?.key" />
</template>
</view>
</template>
@ -27,9 +30,10 @@ import { ref, nextTick } from 'vue';
import { useDiy } from '@/hooks/useDiy'
import { useShare } from '@/hooks/useShare'
import diyGroup from '@/addon/components/diy/group/index.vue'
import useDiyStore from '@/app/stores/diy'
const { setShare } = useShare()
const diyStore = useDiyStore()
const diy = useDiy({})
const diyGroupRef = ref(null)

View File

@ -23,6 +23,10 @@
<!-- #ifdef APP -->
<update-version ref="updateVersionRef"></update-version>
<!-- #endif -->
<template v-if="diyStore && diyStore.mode == '' && diyStore.global && diyStore.global.bottomTabBar && diyStore.global.bottomTabBar.isShow">
<tabbar :addon="diyStore.global.bottomTabBar.designNav?.key" />
</template>
</view>
</template>
@ -34,9 +38,12 @@ import { useShare } from '@/hooks/useShare'
import diyGroup from '@/addon/components/diy/group/index.vue'
import updateVersion from '@/components/update-version/update-version.vue'
import useSystemStore from '@/stores/system';
import useDiyStore from '@/app/stores/diy'
const { setShare } = useShare()
const diyStore = useDiyStore()
uni.hideTabBar() // tabbar
const diy = useDiy({

View File

@ -76,7 +76,7 @@
<script setup lang="ts">
import { ref, computed, nextTick } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import { redirect } from '@/utils/common'
import { deepClone, redirect } from '@/utils/common'
import { t } from '@/locale'
import { addAddress, editAddress, getAddressInfo } from '@/app/api/member'
import manifestJson from '@/manifest.json'
@ -296,7 +296,6 @@ const chooseLocation = () => {
// #ifdef H5
const urlencode = formData.value;
uni.setStorageSync('addressInfo', urlencode);
let backurl = location.origin + location.pathname + '?source=' + source.value;
if (isSelectMap.value) {
backurl = backurl + '&isSelectMap=' + isSelectMap.value
@ -318,6 +317,7 @@ const getAddress = (latlng: any) => {
formData.value.full_address += res.data.district != undefined ? '' + res.data.district : '';
formData.value.address_name = formData.value.full_address.replace(/-/g, '');
formData.value.area = (res.data.province + res.data.city + res.data.district) || res.data.full_address;
formData.value.province_id = res.data.province_id != undefined ? res.data.province_id : 0;
formData.value.city_id = res.data.city_id != undefined ? res.data.city_id : 0;

View File

@ -18,6 +18,9 @@
<wx-privacy-popup ref="wxPrivacyPopupRef"></wx-privacy-popup>
<!-- #endif -->
<template v-if="diyStore && diyStore.mode == '' && diyStore.global && diyStore.global.bottomTabBar && diyStore.global.bottomTabBar.isShow">
<tabbar :addon="diyStore.global.bottomTabBar.designNav?.key" />
</template>
</view>
</template>
@ -28,9 +31,11 @@ import { useShare } from '@/hooks/useShare'
import { redirect } from '@/utils/common';
import diyGroup from '@/addon/components/diy/group/index.vue'
import useMemberStore from '@/stores/member'
import useDiyStore from '@/app/stores/diy'
//
const memberStore = useMemberStore()
const diyStore = useDiyStore()
const userInfo = computed(() => memberStore.info)
const { setShare } = useShare()

View File

@ -58,9 +58,10 @@
<text class="text-[28rpx] text-[#333]">{{ subItem.value }}</text>
</view>
</view>
<view class="common-tab-bar w-[100%]"></view>
<view class="verify-tab-bar fixed flex-center !text-[26rpx] rounded-[50rpx] h-[80rpx] left-[20rpx] right-[20rpx] text-[#fff] font-500" :class="verifyInfo.is_can_use ? 'primary-btn-bg' : 'bg-[#ccc]'" @click="verifyFn">确定</view>
<view class="common-tab-bar w-[100%]">
<view class="common-tab-bar-placeholder"></view>
<view class="verify-tab-bar fixed flex-center !text-[26rpx] rounded-[50rpx] h-[80rpx] left-[20rpx] right-[20rpx] text-[#fff] font-500" :class="verifyInfo.is_can_use ? 'primary-btn-bg' : 'bg-[#ccc]'" @click="verifyFn">确定</view>
</view>
</template>
<loading-page :loading="loading"></loading-page>
</view>

View File

@ -5,7 +5,7 @@
示例版权信息
</view>
</template>
<tempalte v-else>
<template v-else>
<view class="flex flex-col justify-center items-center p-[30rpx]" :style="{ color:textColor}">
<img :src="img(systemStore.copyright.logo)" mode="heightFix" class="max-h-[60rpx]" v-if="systemStore.copyright?.logo" />
<view class="text-[22rpx] mt-[20rpx]" v-if="systemStore.copyright?.copyright_desc" @click="systemStore.copyright?.copyright_link && redirect({ url: systemStore.copyright.copyright_link})">
@ -19,7 +19,7 @@
{{ systemStore.copyright.gov_record }}
</view>
</view>
</tempalte>
</template>
</view>
</template>

View File

@ -34,7 +34,7 @@
<script setup lang="ts">
import { ref } from 'vue'
import { t } from '@/locale'
import { getPayInfo, pay,testPay } from '@/app/api/pay'
import { getPayInfo, pay } from '@/app/api/pay'
import { img, redirect, isWeixinBrowser, moneyFormat } from '@/utils/common'
import wechat from '@/utils/wechat'
@ -148,7 +148,7 @@ const confirmPay = () => {
// #ifndef H5
uni.requestPayment({
provider: 'alipay',
...res.data,
orderInfo: res.data,
success: (res: any) => {
toPayResult()
},
@ -181,7 +181,7 @@ const confirmPay = () => {
uni.$on('checkIsReturnAfterPayment', () => {
const data = uni.getStorageSync('paymenting')
if (uni.getStorageSync('paymenting')) {
redirect({
url: '/app/pages/pay/result',
param: {
@ -248,7 +248,7 @@ const toPayResult = () => {
})
return
}
redirect({
url: '/app/pages/pay/result',
param: { trade_type: payInfo.value?.trade_type, trade_id: payInfo.value?.trade_id },

View File

@ -1,11 +1,13 @@
<template>
<template v-if="tabbar && Object.keys(tabbar).length">
<u-tabbar :value="value" zIndex="9999" :fixed="true" :placeholder="true" :safeAreaInsetBottom="true" :inactive-color="tabbar.value.textColor" :active-color="tabbar.value.textHoverColor" :border="props.border" class="custom-tabbar">
<template v-for="item in tabbar.value.list">
<u-tabbar-item class="py-[5rpx]" :custom-style="{'background-color': tabbar.value.backgroundColor}" :text="item.text" :icon="img(value == item.link.url ? item.iconSelectPath : item.iconPath)" :name="item.link.url" v-if="tabbar.value.type == 1" @click="itemBtn(item.link.url)"></u-tabbar-item>
<u-tabbar-item class="py-[5rpx]" :custom-style="{'background-color': tabbar.value.backgroundColor}" :icon="img(value == item.link.url ? item.iconSelectPath : item.iconPath)" :name="item.link.url" v-if="tabbar.value.type == 2" @click="itemBtn(item.link.url)"></u-tabbar-item>
<u-tabbar-item class="py-[5rpx]" :custom-style="{'background-color': tabbar.value.backgroundColor}" :text="item.text" :name="item.link.url" v-if="tabbar.value.type == 3" @click="itemBtn(item.link.url)"></u-tabbar-item>
</template>
<u-tabbar :value="value" zIndex="9999" :fixed="true" :placeholder="true" :safeAreaInsetBottom="false" :inactive-color="tabbar.value.textColor" :active-color="tabbar.value.textHoverColor" :border="props.border" class="custom-tabbar">
<view class="safe-area flex bg-white">
<template v-for="item in tabbar.value.list">
<u-tabbar-item class="py-[5rpx]" :custom-style="{'background-color': tabbar.value.backgroundColor}" :text="item.text" :icon="img(value == item.link.url ? item.iconSelectPath : item.iconPath)" :name="item.link.url" v-if="tabbar.value.type == 1" @click="itemBtn(item.link.url)"></u-tabbar-item>
<u-tabbar-item class="py-[5rpx]" :custom-style="{'background-color': tabbar.value.backgroundColor}" :icon="img(value == item.link.url ? item.iconSelectPath : item.iconPath)" :name="item.link.url" v-if="tabbar.value.type == 2" @click="itemBtn(item.link.url)"></u-tabbar-item>
<u-tabbar-item class="py-[5rpx]" :custom-style="{'background-color': tabbar.value.backgroundColor}" :text="item.text" :name="item.link.url" v-if="tabbar.value.type == 3" @click="itemBtn(item.link.url)"></u-tabbar-item>
</template>
</view>
</u-tabbar>
<view class="tab-bar-placeholder"></view>
</template>
@ -201,6 +203,12 @@ nextTick(() => {
padding-bottom: calc(constant(safe-area-inset-bottom) + 50px);
padding-bottom: calc(env(safe-area-inset-bottom) + 50px);
}
.safe-area {
background: white;
width: 100%;
padding-bottom: calc(constant(safe-area-inset-bottom) + 1px);
padding-bottom: calc(env(safe-area-inset-bottom) + 1px);
}
</style>
<style lang="scss">
@ -226,6 +234,5 @@ nextTick(() => {
font-size: 20rpx !important;
}
}
/* #endif */
</style>

View File

@ -3,7 +3,7 @@
<view class="u-navbar z-100" :class="{'fixed': props.scrollBool != -1, 'absolute': props.scrollBool == -1}" :style="{ backgroundColor: bgColor}">
<view class="navbar-inner" :style="{ width: '100%', height: placeholderHeight + 'px' }">
<view v-if="topStatusBarData.style == 'style-1'" class="content-wrap" :class="[topStatusBarData.textAlign]" :style="navbarInnerStyle">
<view class="back-wrap -ml-[16rpx] text-[26px] nc-iconfont nc-icon-zuoV6xx" :class="{'!text-transparent': !isBackShow}" :style="{ color: titleTextColor }" @tap="goBack"></view>
<view v-if="isBackShow" class="back-wrap -ml-[16rpx] text-[26px] nc-iconfont nc-icon-zuoV6xx" :class="{'!text-transparent': !isBackShow}" :style="{ color: titleTextColor }" @tap="goBack"></view>
<view class="title-wrap" :style="styleOneFontSize">{{ data.title }}</view>
</view>
<view v-if="topStatusBarData.style == 'style-2'" class="content-wrap" :style="navbarInnerStyle" @click="diyStore.toRedirect(topStatusBarData.link)">
@ -194,7 +194,7 @@ const isBackShow = computed(() => {
let bool = false;
if (props.isBack && pages.length > 1) {
bool = true;
} else if (currRoute() == 'app/pages/auth/index') {
} else if (currRoute() == 'app/pages/auth/index' || currRoute() == 'app/pages/auth/login') {
bool = true;
}
return bool;

View File

@ -143,6 +143,9 @@ export function useDiy(params: any = {}) {
item.pageStyle += 'padding-left:' + item.margin.both * 2 + 'rpx' + ';';
}
});
diyStore.global = diyData.global
diyStore.value = diyData.value
// 控制自定义头部是否出现 | 微信小程序
isShowTopTabbar.value = diyData.value.some((item: any) => {

View File

@ -244,7 +244,7 @@ button[type='primary'],uni-button[type='primary']{
margin-right: 40rpx;
color: #333;
line-height: 40rpx;
font-size: 28rpx;
font-size: 26rpx;
&.class-select{
position: relative;
font-weight: 700;
@ -288,7 +288,7 @@ button[type='primary'],uni-button[type='primary']{
.tab-items{
line-height: 88rpx;
font-weight: 400;
font-size: 28rpx;
font-size: 26rpx;
&.class-select{
position: relative;
font-weight: 700;
@ -317,7 +317,7 @@ button[type='primary'],uni-button[type='primary']{
@apply flex-1;
line-height: 88rpx;
font-weight: 400;
font-size: 28rpx;
font-size: 26rpx;
text-align: center;
margin:0 var(--sidebar-m);
&.class-select{
@ -567,4 +567,8 @@ button[type='primary'],uni-button[type='primary']{
padding: 0 24rpx;
min-width: 144rpx;
color: #333;
}
.u-tabbar__content__item-wrapper {
height: calc(env(safe-area-inset-bottom) + 100rpx)!important;
}

View File

@ -1,9 +1,9 @@
@font-face {
font-family: "iconfont";
/* Project id 3952239 */
src: url('//at.alicdn.com/t/c/font_3952239_waynfpfdr5.woff2?t=1762225321119') format('woff2'),
url('//at.alicdn.com/t/c/font_3952239_waynfpfdr5.woff?t=1762225321119') format('woff'),
url('//at.alicdn.com/t/c/font_3952239_waynfpfdr5.ttf?t=1762225321119') format('truetype');
src: url('https://at.alicdn.com/t/c/font_3952239_waynfpfdr5.woff2?t=1762225321119') format('woff2'),
url('https://at.alicdn.com/t/c/font_3952239_waynfpfdr5.woff?t=1762225321119') format('woff'),
url('https://at.alicdn.com/t/c/font_3952239_waynfpfdr5.ttf?t=1762225321119') format('truetype');
}
.iconfont {
@ -1288,4 +1288,4 @@
.iconshouye-zhihui:before {
content: "\e61d";
}
}

View File

@ -830,3 +830,11 @@ export function getTopFixedStatusName(data : any = {}) {
if (data.type) name += '_' + data.type
return name
}
// 距离显示
export function distance(distance: string | number): string {
const dist = typeof distance === 'string' ? parseFloat(distance) : distance;
if (isNaN(dist)) return distance.toString();
return dist < 1 ? parseInt((dist * 1000).toString()) + 'm' : dist.toFixed(1) + 'km'
}

View File

@ -24,7 +24,7 @@ class Wechat {
timestamp: data.timestamp, // 必填,生成签名的时间戳
nonceStr: data.nonceStr, // 必填,生成签名的随机串
signature: data.signature,// 必填,签名
jsApiList: ['chooseWXPay', 'updateAppMessageShareData', 'updateTimelineShareData', 'scanQRCode', 'getLocation','hideMenuItems'] // 必填需要使用的JS接口列表
jsApiList: ['chooseWXPay', 'updateAppMessageShareData', 'updateTimelineShareData', 'scanQRCode', 'getLocation', 'openLocation', 'hideMenuItems'] // 必填需要使用的JS接口列表
});
if (callback) callback();
})
@ -82,6 +82,28 @@ class Wechat {
})
}
/**
*
* @param {Object} callback
*/
public openLocation(data: any, callback: any = null) {
wx.ready(function() {
wx.openLocation({
latitude: data.latitude, // 纬度浮点数范围为90 ~ -90
longitude: data.longitude, // 经度浮点数范围为180 ~ -180
name: data.name, // 位置名
address: data.address, // 地址详情说明
scale: data.scale || 28, // 地图缩放级别,整形值,范围从1~28。默认为最大
success: function(res) {
typeof callback == 'function' && callback(res);
},
fail: function(res) {
typeof callback == 'function' && callback(res);
}
});
})
}
/**
*
* @param {Object} options

File diff suppressed because it is too large Load Diff