first commit

This commit is contained in:
Ls
2026-02-12 12:19:20 +08:00
commit 219fd9be5c
529 changed files with 169918 additions and 0 deletions

View File

@@ -0,0 +1,355 @@
import { HttpRequest, StoreAssist, UploadAssist, ResultData } from '@/common/Common';
import { BaseConfig } from './BaseConfig';
export class Service extends BaseConfig {
// 获取是否后台
static getIsHede () {
let isHede = this.GetStorageCache('isHede')
if (isHede == null || isHede == '') {
return false;
} else {
return isHede;
}
}
//获取API地址
static ApiUrl(path : string) {
return `${this.servesUrl}${path}`;
}
//获取图片地址
static GetpayImg(path : string) {
if (path.startsWith('http') || path.startsWith('https')) {
return path;
} else {
return `${this.payuploadUrl}${path}`;
}
}
//获取图标地址
static GetIconImg(path : string) {
return path
if (path.startsWith('http') || path.startsWith('https')) {
return path;
} else {
return `${this.imgUrl}${path}`;
}
}
//获取图片地址
static GetMateUrlByImg(path : string) {
return path
if (path.startsWith('http') || path.startsWith('https')) {
return path;
} else {
return `${this.imgUrl}${path}`;
}
}
//获取音视频地址
static GetMateUrlByMedia(path : string) {
if (path.startsWith('http') || path.startsWith('https')) {
return path;
} else {
return `${this.mediaUrl}${path}`;
}
}
//获取登录账号token
static GetUserToken() {
return Service.GetStorageCache('token');
}
// 获取登录状态
static GetUserIsLogin() {
var token = this.GetUserToken();
if (token == null || token == '') {
return false;
} else {
return true;
}
}
//设置登录账户Token
static SetUserToken(token : string) {
this.SetStorageCache('token', token);
}
//清理登录账户Token
static OffUserToken() {
Service.DelStorageCache('token');
uni.$emit('ImComOff', 'user');
this.ClearUserStateData();
}
//获取登录账号状态信息
static GetUserStateData() {
return Service.GetStorageCache('StateDomain');
}
//设置当前登录账号状态信息
static SetUserStateData() {
return Service.GetStorageCache('StateDomain');
}
//清理当前登录账号状态信息
static ClearUserStateData() {
Service.DelStorageCache('StateDomain');
}
//获取当前客户端ID
static GetUserClientId() {
return this.GetStorageCache('ClientId');
}
//保存当前客户端ID
static SetUserClientId(clientId: string) {
this.SetStorageCache('ClientId', clientId);
}
//获取缓存
static GetStorageCache(key : string) {
return StoreAssist.Get(key);
}
//删除缓存
static DelStorageCache(key : string) {
StoreAssist.Delete(key);
}
//设置缓存
static SetStorageCache(key : string, data : any) {
StoreAssist.Set(key, data);
}
/*****以下是基础方法调用与拦截器*****/
static Request(url : string, method : 'GET' | 'POST' | 'PUT' | undefined, data : object | any) {
const token = Service.GetUserToken();
const _url = Service.ApiUrl(url);
var result = HttpRequest.RequestWithToken(_url, method, token, data).then((retResult : any) => {
if (retResult.statusCode == '200') {
var obj = retResult.data;
if (obj.code == 401) {
//过期
this.OffUserToken();
this.Msg('登录过期,请重新登录')
this.GoPage('/pages/my/login')
return Promise.reject();
} else if (obj.code == 40101) {
//失效
this.OffUserToken();
this.GoPageDelse('/pages/mine/login/login');
return Promise.reject();
} else if (obj.code == 1004) {
//资源不存在
this.GoPageDelse('/pages/AppSet/404/404');
return Promise.reject();
// return new ResultData(-1, '', '');
} else if (obj.code == 40188) {
//无权限
this.GoPageDelse('/pages/AppSet/40188/40188');
return Promise.reject();
// return new ResultData(-1, '', '');
} else if (obj.code == 1008) {
//业务提示
return new ResultData(obj.code, obj.msg, obj.data);
} else {
return new ResultData(obj.code, obj.msg, obj.data);
}
} else {
return new ResultData(-1, '', '');
}
});
return result;
}
/*****以下是腾讯云oss上传*****/
static UpLoadMedia(code : string, fileName : string, desire : string, path : string) {
var result = this.Request(this.uploadUrl, 'GET', { code, fileName, desire }).then((retResult) => {
if (retResult.code == 0) {
var upOk = UploadAssist.Upload(retResult.data.url, path, retResult.data.cosData).then((upRet : any) => {
if (upRet.statusCode == 200) {
const retData : any = { code: retResult.data.code, file: retResult.data.file, cache: retResult.data.cache };
return new ResultData(0, '上传成功!', retData);
} else {
this.Msg('上传失败!');
return new ResultData(-1, '', '');
}
});
return upOk;
} else {
this.Msg('上传失败!');
return new ResultData(-1, retResult.msg,retResult.data);
}
});
return result;
}
/***********消息操作**************/
static Msg(message : any, icon ?: any) : void {
if (icon != null) {
uni.showToast({
title: message,
icon: icon
});
} else {
uni.showToast({
title: message,
icon: 'none'
});
}
}
static Alert(msg : string, cb ?: any) {
uni.showModal({
title: '提示',
content: msg,
showCancel: false,
cancelText: '取消',
confirmText: '确定',
success: res => {
if (res.confirm) {
cb && cb();
}
}
})
}
static LoadIng(text : any) : void {
uni.showLoading({
title: text,
icon: 'none'
});
}
static LoadClose() : void {
uni.hideLoading();
}
/**********跳转操作*********/
static GoPageTab(path : string) : void {
uni.switchTab({
url: path
});
}
/**********跳转操作*********/
static GoPage(path : string) : void {
uni.navigateTo({
url: path, //跳转的页面
success: function (res) {
// 通过eventChannel向被打开页面传送数据
}
});
}
/**********跳转并删除当前页面操作*********/
static GoPageDelse(path : string) : void {
uni.redirectTo({
url: path //跳转的页面
});
}
/**********返回上一页*********/
static GoPageBack() : void {
uni.navigateBack({ delta: 1 });
}
/*****获取图片base64*****/
static UpLoadMediaBase64(path : string) {
return new Promise(function (resolve, reject) {
uni.uploadFile({
url: 'http://cloud.pccsh.com/DefUp/UploadFileImgBase64', //仅为示例,非真实的接口地址
filePath: path,
name: 'file',
success: (uploadFileRes) => {
resolve(uploadFileRes);
},
fail: (err) => {
reject(err);
}
});
});
}
/*****获取图片位置信息*****/
//获取时间戳
static GetTimeSpan(milliSecond : number) {
return Date.now() + milliSecond;
}
// 时间戳处理
static formatDate(time : any, type : number) : string {
const date = new Date(time);
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始所以加1并用0填充
const day = String(date.getDate()).padStart(2, '0'); // 用0填充
const hours = String(date.getHours()).padStart(2, '0'); // 用0填充
const minutes = String(date.getMinutes()).padStart(2, '0'); // 用0填充
const seconds = String(date.getSeconds()).padStart(2, '0'); // 用0填充
if (type == 0) {
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}
else if (type == 1) {
return `${year}-${month}-${day} ${hours}:${minutes}`;
} else if (type == 2) {
return `${year}-${month}-${day}`;
} else if (type == 3) {
return `${hours}:${minutes}`;
} else if (type == 4) {
return `${year}${month}${day}`;
}
else {
return `${hours}:${minutes}`;
}
}
/*****节流*****/
static throttle(fn: () => void, time: number) {
let canRun: boolean = true;
return function () {
if (!canRun) return;
canRun = false;
setTimeout(() => {
fn(); //可以不执行
canRun = true;
}, time);
};
}
/*****防抖*****/
static debounce<T extends (...args: any[]) => void>(fn: T, time: number): (...args: Parameters<T>) => void {
let timerId: NodeJS.Timeout | null = null;
return (...args: Parameters<T>) => {
if (timerId) {
clearTimeout(timerId);
}
timerId = setTimeout(() => {
fn(...args); // 执行传入的函数
timerId = null; // 清除定时器ID
}, time);
};
}
// 普通图片上传
static uploadH5(path, dic, callback) {
console.log(this.payuploadUrl,'xxx')
uni.uploadFile({
url: this.payuploadUrl+'/Upload/Upload',
method: "POST",
header: {
'Authorization': 'Bearer ' + Service.GetUserToken(),
},
formData: {
"path": dic,
},
filePath: path,
name: 'file',
success: (data) => {
let info = data.data
callback(info)
}
})
}
}

View File

@@ -0,0 +1,242 @@
<template>
<!-- <UpApp :show="upShow" :url="url" /> -->
<view class="borybac" v-if="upShow">
<view class="up_box">
<view class="mt50">
<view class="" style="margin: 0 60rpx;" >
1.优化布局细节,优化购物体验,优化产品体验
</view>
<view class="" style="margin: 0 60rpx;" >
2.修复已知问题修复一些BUG
</view>
</view>
<view class="jdBox">
<view class="jd">
<view class="jdbfb">
{{sum}}%
</view>
<view class="jdt">
<view class="jdn" :style="'width:'+sum+'%'">
</view>
</view>
<view v-if="buttonContro" class="jddx">
{{datacl(beg)}}/{{datacl(downlog)}}
</view>
</view>
</view>
<view class="" v-if="force==0"
style="width: 100%; padding: 0 20rpx; height: 60rpx; margin: 40rpx auto; display: flex; justify-content: space-between;">
<view class="" style="width: 70rpx;">
</view>
<view class=""
style="width: 240rpx; height: 60rpx; line-height: 60rpx; border-radius: 30rpx; text-align: center; color: #fff; font-size: 24rpx; background-color: #FFD700;"
@click="delUpApp">
开始更新
</view>
<view class="" style="font-size: 22rpx; line-height: 80rpx; color: #999;" @click="goindex">
暂不更新
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app';
import { ref } from 'vue';
let buttonContro = ref(false)
let url = ref('')
let force = ref('0')
// 控制热更新
let upShow = ref(true)
let sum = ref(0)
let downlog = ref(0)
let beg = ref(0)
let remark = ref('')
let type = ref('')
//模拟请求
onLoad((data : any) => {
// getdata()
url.value = data.url
});
const goindex = function () {
uni.navigateBack({
delta: 1
});
}
const getdata = function () {
// RegisterService.GetNewVersion().then((res:any)=>{
// url.value = res.data.path
// downlog.value = res.data.size
// force.value = res.data.force
// remark.value = res.data.remark
// type.value = res.data.type
// if(res.data.force=='1'){
// delUpApp()
// }
// })
}
const datacl = function (e : any) {
if (e > 1024) {
let sl = ((e / 1024) / 1024).toFixed(1)
return sl + 'MB'
} else {
return (e / 1024).toFixed(1) + 'KB'
}
}
const delUpApp = function () {
if (buttonContro.value) {
return
}
buttonContro.value = true
// 1.开始请求下载
const downloadTask = uni.downloadFile({
url: url.value,
success: (downloadResult) => {
if (downloadResult.statusCode === 200) {
plus.runtime.install(downloadResult.tempFilePath, {
force: false
}, function () {
uni.hideLoading()
uni.showToast({
title: "下载成功",
complete() {
if (type.value == 'Bulking') {
setTimeout(function () {
plus.runtime.restart();
}, 2000)
}
}
})
console.log('install success...');
}, function (e) {
uni.hideLoading()
console.log(e, '失败')
// uni.$u.toast('下载失败!')
// console.error('install fail...');
});
}
},
fail(downloadResult) {
console.log(downloadResult, '失败')
// console.log('下载失败');
// uni.$u.toast('下载失败')
}
});
downloadTask.onProgressUpdate((res) => {
downlog.value = res.totalBytesExpectedToWrite
beg.value = res.totalBytesWritten
sum.value = res.progress
});
}
</script>
<style lang="scss" setup>
.borybac {
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
background-color: #f6f6f6;
display: flex;
overflow: hidden;
.up_box {
width: 650rpx;
height: 1000rpx;
margin: 200rpx auto;
border-radius: 20rpx;
overflow: hidden;
position: relative;
background-image: url(@/static/index/system/updata.png);
background-repeat: no-repeat;
background-size: cover;
.mt50 {
display: block;
margin-top: 570rpx;
}
.jdBox {
overflow: hidden;
margin-top: 70rpx;
display: block;
width: 100%;
padding: 0 20rpx;
.jd {
display: block;
width: 90%;
height: 100%;
margin: 0 auto;
.jdbfb {
display: block;
width: 100%;
height: 40rpx;
line-height: 40rpx;
font-size: 30rpx;
color: #FFD700;
font-weight: 600;
}
.jdt {
margin-top: 10rpx;
display: block;
width: 100%;
height: 23rpx;
border-radius: 15rpx;
background-color: #E5E5E5;
.jdn {
display: block;
height: 23rpx;
border-radius: 15rpx;
background: radial-gradient(#8370F8 0%, #455FF8 100%);
}
}
.jddx {
width: 100%;
font-size: 24rpx;
margin-top: 20rpx;
font-weight: 600;
}
}
}
}
}
.text {
display: block;
text-align: center;
margin-top: 30rpx;
width: 100%;
height: 40rpx;
font-size: 32rpx;
}
</style>

View File

@@ -0,0 +1,22 @@
## 1.1.72024-10-29
修复底部露出部分组件bug
## 1.1.62024-08-20
更新本地数据源为最新数据源
## 1.1.52024-06-12
使用说明文档优化
## 1.1.42024-06-12
增加问题反馈描述
## 1.1.32024-02-29
更新使用文档
## 1.1.22024-01-16
解决Vue3项目导入导出报错问题
## 1.1.12023-12-06
defaultValue可以传入defaultValue:['河北省','唐山市','丰南区']数组类型以及defaultValue: '420103'地区编码字符串类型
## 1.1.02023-12-05
即默认值传入地区编码,也支持传入中文省市区数组
## 1.0.92023-12-04
优化
## 1.0.82023-10-24
修复东菀市和中山市下各镇的行政编码错误问题
## 1.0.42023-09-15
改为uni_modules规范

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

View File

@@ -0,0 +1,125 @@
<template>
<view class="">
<web-view ref="webviewRef" v-if="isshow" :src="url" @message="handleMessage" @logData = "logData"></web-view>
<!-- ✅ 新增:一个绝对定位的遮罩层,用于在刷新时覆盖 web-view -->
<view v-else class="reloading-mask">
<up-loading-icon text="正在获取订单状态..." v-if="orderOver" textSize="16"></up-loading-icon>
<up-loading-icon text="订单已完成" v-else textSize="16"></up-loading-icon>
</view>
</view>
</template>
<script setup lang="ts">
import { onLoad } from '@dcloudio/uni-app';
import { Service } from "@/Service/Service";
import { ref, onMounted } from 'vue';
import { CNRiderOrderService } from '@/Service/CN/CNRiderOrderService'
let orderId = ref<string>('')
let url = ref<string>('')
let isshow = ref<false>(false)
let orderInfo = ref<any>({
isFood: 0
})
let riderOrder = ref<any>({
status:0
})
let orderOver = ref<true>(false)
onLoad((data) => {
if (data.orderId) {
orderId.value = data.orderId
getData()
} else {
Service.Msg('为获取到订单ID')
}
});
// 初始化url
const getUrl = () => {
isshow.value = false
url.value = 'https://hmjz.327gzs.top?orderId=' + orderId.value + '&isFood=' + riderOrder.value.status
isshow.value = true
}
const getData = () => {
CNRiderOrderService.GetUnitOrderInfo(orderId.value).then(res => {
if (res.code==0) {
orderInfo.value = res.data.orderInfo
riderOrder.value = res.data.riderOrder
getUrl()
}else{
Service.Msg(res.mgs)
}
})
}
// 点击完成送餐取餐调用
const handleMessage = (data) => {
let preat = data.detail.data[0]
if(preat.action =='message'){
if (riderOrder.value.status == 0) {
// 去商家、取餐
pickFood(1)
} else {
// 去用户,送餐
pickFood(2)
}
}else if(preat.action =='logData'){
CNRiderOrderService.UpdateRiderLocation(preat.data[0],preat.data[1]).then(res=>{
if(res.code==0){
}
})
}
return
};
// 骑手定位
const logData = (data) =>{
console.log(data,'骑手定位')
}
// 取餐
const pickFood = ( type:number) => {
CNRiderOrderService.UpdateRiderOrderTake(orderId.value, type).then(res => {
if (res.data) {
Service.Msg(type==1?'取餐成功':'订单完成')
if(type==2){
setTimeout(()=>{Service.GoPageTab('/pages/index/index')},500)
}
getData()
} else {
Service.Msg(res.msg)
}
})
};
</script>
<style lang="scss" scoped>
.reloading-mask {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #f7f7f7; // 使用页面底色
display: flex;
justify-content: center;
align-items: center;
z-index: 10;
}
</style>