第一次上传

This commit is contained in:
Ls
2026-03-09 16:39:03 +08:00
commit 3d9efaf15c
924 changed files with 326227 additions and 0 deletions

View File

@@ -0,0 +1,320 @@
import { HttpRequest, StoreAssist, UploadAssist, ResultData } from '@/common/Common';
import { BaseConfig } from './BaseConfig';
export class Service extends BaseConfig {
//获取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 GetMateUrlByImg(path : string) {
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');
}
//获取缓存
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/login/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/UploadFile',
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,299 @@
<template>
<view class="content">
<view class="liy-select-fixed" :class="openClass">
<view class="liy-search-warp">
<view class="liy-search-input">
<view class="lsi-warp">
<image src="../../static/liy-select/images/search.png" mode="widthFix"
class="lsi-icon"></image>
<input class="lsi-input" v-model="keyword" placeholder="请输入搜索内容" @input="getParamsList" />
</view>
</view>
<scroll-view scroll-y="true" class="scroll-Y" @scrolltolower="lower">
<view class="liy-search-list" v-if="outPutList.length > 0">
<view class="liy-search-li" v-for="(item,index) in outPutList" :key="index"
@click="mapSelectMenu(item,index)">
<view class="liy-search-left">
<view class="liy-search-title" v-if="titleKey">{{item[titleKey]}}
</view>
<view class="liy-search-title" v-else>未选择标题
</view>
<view class="liy-search-desc" v-if="subtitleKey">{{item[subtitleKey]}}</view>
</view>
<view class="liy-search-icon" v-if="mapSelectIndex == index">
<image class="lsi-icon" src="../../static/liy-select/images/check_mark.png"
mode="widthFix"></image>
</view>
</view>
<view class="liy-loading">
<image class="liy-loading-img" src="../../static/liy-select/images/complete.png"
mode="widthFix"></image>
<view class="liy-loading-text">加载完成</view>
</view>
</view>
<view v-else class="liy-void">
<image class="liy-void-img" src="../../static/liy-select/images/void.png"
mode="widthFix"></image>
<view class="liy-void-text">未查询到内容</view>
</view>
</scroll-view>
</view>
</view>
<view class="liy-overlay" @click="closeOverlay" v-if="open == true"></view>
</view>
</template>
<script>
export default {
name:'liy-select',
props:{
list:{
type:Array,
default:[]
},
titleKey:{
type:[String,null],
default: null
},
subtitleKey:{
type:[String,null],
default:null
},
open:{
type:Boolean,
default:false
}
},
data() {
return {
mapSelectIndex: null,
keyword: "",
outPutList: [],
openClass:""
}
},
watch: {
list (newList, oldList) {
this.getParamsList();
},
open(newOpen,oldOpen){
if(newOpen == true){
this.openClass = "show";
}else{
this.openClass = "hide";
}
}
},
created() {
this.getParamsList();
},
methods: {
mapSelectMenu(item,index) {
this.mapSelectIndex = index;
this.$emit("change",item,index)
this.$emit("close");
},
getParamsList() {
var selectList = this.list;
this.mapSelectIndex = null;
if (!this.keyword) {
this.outPutList = selectList;
return false;
}
var arr = [];
for (var i = 0; i < selectList.length; i++) {
let item = selectList[i];
if (item[this.titleKey].indexOf(this.keyword) > -1) {
arr.push(item);
} else {
}
}
this.outPutList = arr;
},
lower() {
},
closeOverlay() {
this.$emit("close");
}
}
}
</script>
<style scoped lang="scss">
.liy-overlay {
transition-duration: 300ms;
transition-timing-function: ease-out;
position: fixed;
inset: 0px;
z-index: 100;
background-color: rgba(0, 0, 0, 0.5);
}
.liy-select-fixed {
position: fixed;
bottom: 0;
left: 0;
width: 100%;
z-index: 150;
transition: transform .5s ease-in-out;
transform: translateY(calc(100% + 40rpx));
&.show {
animation: showHandler 0.3s forwards;
}
&.hide {
animation: hideHandler 0.3s forwards;
}
.liy-search-warp {
background: #fff;
border-radius: 10rpx 10rpx 0 0;
.liy-search-input {
padding: 30rpx 40rpx;
font-size: 28rpx;
.lsi-warp {
display: flex;
align-items: center;
border: 2rpx solid #e3e3e3;
padding: 16rpx 20rpx;
border-radius: 50rpx;
.lsi-icon {
width: 30rpx;
height: 30rpx;
}
.lsi-input {
width: 90%;
padding-left: 16rpx;
font-size: 28rpx;
}
}
}
.liy-search-list {
.liy-search-li {
padding: 20rpx 30rpx;
display: flex;
align-items: center;
border-bottom: 1rpx solid #f7f7f7;
min-height: 50rpx;
.liy-search-left {
width: 90%;
.liy-search-title {
font-size: 28rpx;
line-height: 36rpx;
color: #333;
}
.liy-search-desc {
padding-top: 10rpx;
font-size: 24rpx;
line-height: 36rpx;
color: #999;
}
}
.liy-search-icon {
.lsi-icon {
width: 40rpx;
height: 40rpx;
}
}
}
}
}
}
.scroll-Y {
height: 500rpx;
}
.liy-loading {
color: #333;
font-size: 26rpx;
display: flex;
align-items: center;
justify-content: center;
padding: 20rpx 0;
.liy-loading-img {
width: 32rpx;
height: 32rpx;
// animation: turn 3s linear infinite;
}
.liy-loading-text {
padding-left: 12rpx;
padding-right: 32rpx;
}
}
@keyframes turn {
0% {
transform: rotate(0deg);
}
25% {
transform: rotate(90deg);
}
50% {
transform: rotate(180deg);
}
75% {
transform: rotate(270deg);
}
100% {
transform: rotate(360deg);
}
}
@keyframes showHandler {
0% {
transform: translateY(calc(100% + 40rpx));
}
100% {
transform: translateY(0);
}
}
@keyframes hideHandler {
0% {
transform: translateY(0);
}
100% {
transform: translateY(calc(100% + 40rpx));
}
}
.liy-void {
text-align: center;
padding-top: 60rpx;
.liy-void-img {
width: 40%;
}
.liy-void-text {
padding-top: 30rpx;
font-size: 26rpx;
color: #909090;
}
}
</style>

View File

@@ -0,0 +1,439 @@
<template>
<view class="promotion-page" :style="showCode?'height: 100vh; overflow: hidden;':''">
<!-- 沉浸式状态栏 -->
<view v-if="!isZFB" class="status-bar"></view>
<!-- 顶部导航 -->
<view v-if="!isZFB" class="nav-bar">
<image class="back-icon" src="/static/icons/back.svg" @click="goBack" mode="aspectFit" />
<text class="nav-title">店铺推广</text>
<view class="nav-placeholder"></view>
</view>
<!-- 会员列表 -->
<view class="content">
<view class="list-header">
<text class="header-title" style="font-size: 32rpx;" >推广会员列表</text>
<text class="header-count">共{{ list.length }}人</text>
</view>
<view v-if="list.length > 0" class="members-list">
<view v-for="member in list" :key="member.id" class="member-card">
<!-- 会员信息 -->
<view class="member-info">
<image class="member-avatar" :src="Service.GetMateUrlByImg(member.headImg)" mode="aspectFill" />
<view class="member-details">
<view class="name-tag-row">
<text class="member-name">{{ member.nick }}</text>
</view>
<view class="user-id-tag">
<image :src="Service.GetIconImg('/static/iconMent/user/viptype.png')" style="width: 20rpx; height: 20rpx; margin-right: 10rpx;"></image>
<text class="id-text">ID: {{ member.userNo }}</text>
</view>
<text class="register-time">注册时间:{{ Service.formatDate(new Date(member.addTime),1) }}</text>
</view>
</view>
<!-- 积分奖励 -->
<view class="points-info">
<text class="points-label">奖励</text>
<text class="points-value">+{{ member.award }}</text>
</view>
</view>
</view>
<!-- 空状态 -->
<view v-else class="empty-state">
<text class="ri-team-line empty-icon"></text>
<text class="empty-text">暂无推广会员</text>
<text class="empty-desc">邀请好友加入,获得积分奖励</text>
</view>
</view>
<up-popup :show="showCode" round='10' mode='center' @close="showCode=false" :closeable="true"
:safeAreaInsetTop='true' :safeAreaInsetBottom='false' >
<view class="" style=" margin: 0 auto; padding: 20rpx; background-color: #fff; " >
<l-painter :board="poster" ref="posterFun">
</l-painter>
</view>
<view class="" style="padding: 0 20rpx 20rpx;" >
<up-button color='var(--nav-mian)' @click="save()" text="保存图片" ></up-button>
</view>
</up-popup>
</view>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue'
import { onShow, onLoad, onReachBottom } from "@dcloudio/uni-app";
import { vpMerchService, Service } from "@/Service/vp/vpMerchService"
import {
inject
} from 'vue';
const isZFB = inject('isZFB');
let list = ref<Array<any>>([])
let status = ref<string>('loadmore')
let pageNo = ref<number>(1)
let allAward = ref<Number>(0)
let showCode=ref(false)
let code=ref('')
let url = ref<string>('')
let imgurl = ref<string>('')
const posterFun = ref(null)
const poster = ref<any>({
css: {
// 根节点若无尺寸,自动获取父级节点
position: ' relative',
borderRadius: '18rpx',
overflow: 'hidden',
width:'550rpx'
},
views: [{
type: 'image',
src: 'https://vp.clouds.xypays.cn/poster/poster1.png',
css: {
width: '550rpx',
margin: '0 auto',
},
mode: "widthFix"
}, {
type: 'qrcode',
text: '',
css: {
width: '80rpx',
height: '80rpx',
position: 'absolute',
top: '870rpx',
left: '65rpx'
},
}],
})
let picture = ref<string>('')
onLoad(() => {
getData()
// getCode()
})
onReachBottom(() => {
getList()
});
const getData = () => {
list.value = []
status.value = 'loadmore'
pageNo.value = 1
getList()
}
const getList = () => {
if (status.value == 'nomore' || status.value == 'loading') {
return
}
status.value = 'loading'
vpMerchService.GetMerchRemList(pageNo.value).then(res => {
if (res.code == 0) {
list.value = [...list.value, ...res.data.list]
status.value = 10 == res.data.list.length ? 'loadmore' : 'nomore'
pageNo.value++
} else {
Service.Msg(res.msg)
}
})
}
const getCode=()=>{
// vpUserService.GetShareEwm().then(res=>{
// if(res.code==0){
// url.value=res.data.url
// imgurl.value = res.data.bgUrl
// poster.value.views[1].text = url.value
// poster.value.views[0].src = imgurl.value
// }
// })
}
// 返回
const goBack = () => {
Service.GoPageBack()
}
const save=()=>{
Service.LoadClose('开始下载')
posterFun.value.canvasToTempFilePathSync({
fileType: 'jpg',
pathType:'url',
quality: 1,
success: (res) => {
picture.value = res.tempFilePath
saveImage()
},
fail(e) {
Service.Msg('下载失败')
console.log('???????????', e)
}
})
}
const saveImage = () => {
uni.saveImageToPhotosAlbum({
filePath: picture.value,
success(res) {
Service.Msg('保存成功!')
},
fail: function (err) {
console.log(err,'===')
Service.Msg('保存失败')
}
});
}
</script>
<style lang="scss" scoped>
/* 引入全局标签样式 */
@import '@/styles/member-tags.scss';
.promotion-page {
min-height: 100vh;
background: #F5F5F5;
}
/* 状态栏 */
.status-bar {
background: linear-gradient(135deg, #FF6B00, #FF9500);
height: var(--status-bar-height);
width: 100%;
}
/* 导航栏 */
.nav-bar {
display: flex;
align-items: center;
justify-content: space-between;
padding: 60rpx 24rpx 20rpx 24rpx;
background: linear-gradient(135deg, #FF6B00, #FF9500);
}
.back-icon {
width: 48rpx;
height: 48rpx;
padding: 8rpx;
}
.nav-title {
font-size: 36rpx;
font-weight: 600;
color: #FFFFFF;
}
.nav-placeholder {
width: 48rpx;
}
/* 统计卡片 */
.stats-section {
padding: 20rpx;
}
.stats-card {
background: linear-gradient(135deg, #FF6B00, #FF9500);
border-radius: 16rpx;
padding: 32rpx 24rpx;
display: flex;
align-items: center;
justify-content: space-around;
box-shadow: 0 4rpx 16rpx rgba(255, 107, 0, 0.3);
}
.stat-item {
display: flex;
flex-direction: column;
align-items: center;
gap: 8rpx;
}
.stat-value {
font-size: 40rpx;
font-weight: 700;
color: #FFFFFF;
line-height: 1;
}
.stat-label {
font-size: 22rpx;
color: rgba(255, 255, 255, 0.9);
}
.stat-divider {
width: 1rpx;
height: 60rpx;
background: rgba(255, 255, 255, 0.3);
}
/* 内容区域 */
.content {
padding: 0 20rpx 20rpx;
}
/* 列表头部 */
.list-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 20rpx 0;
}
.header-title {
font-size: 28rpx;
font-weight: 600;
color: #222222;
}
.header-count {
font-size: 22rpx;
color: #999999;
}
/* 会员列表 */
.members-list {
display: flex;
flex-direction: column;
gap: 16rpx;
}
.member-card {
background: #FFFFFF;
border-radius: 16rpx;
padding: 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.04);
}
.member-info {
flex: 1;
display: flex;
align-items: center;
gap: 16rpx;
}
.member-avatar {
width: 88rpx;
height: 88rpx;
border-radius: 44rpx;
flex-shrink: 0;
}
.member-details {
display: flex;
flex-direction: column;
gap: 8rpx;
}
.member-name-row {
display: flex;
align-items: center;
gap: 12rpx;
}
.name-tag-row {
display: flex;
align-items: center;
gap: 8rpx;
margin-bottom: 8rpx;
}
.member-name {
font-size: 28rpx;
font-weight: 600;
color: #222222;
}
.user-member-tag {
transform: scale(0.92);
transform-origin: left center;
}
.user-id-tag {
margin-bottom: 8rpx;
width: fit-content;
display: inline-flex;
}
.register-time {
font-size: 22rpx;
color: #CCCCCC;
}
/* 积分信息 */
.points-info {
display: flex;
flex-direction: column;
align-items: center;
gap: 6rpx;
padding: 16rpx;
background: #FFF4E6;
border-radius: 12rpx;
margin-left: 16rpx;
}
.points-label {
font-size: 20rpx;
color: #FF9800;
}
.points-value {
font-size: 28rpx;
font-weight: 700;
color: #FF6B00;
}
/* 空状态 */
.empty-state {
background: #FFFFFF;
border-radius: 16rpx;
padding: 120rpx 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 16rpx;
}
.empty-icon {
font-size: 120rpx;
color: #CCCCCC;
}
.empty-text {
font-size: 28rpx;
color: #999999;
font-weight: 500;
}
.empty-desc {
font-size: 24rpx;
color: #CCCCCC;
}
</style>