Compare commits

..

2 Commits

Author SHA1 Message Date
曹磊 c27913c586 视频圈发布时不传封面默认一张图片 2025-03-31 09:20:37 +08:00
曹磊 8694b6101f 优化出行方式调整 2025-03-17 09:48:26 +08:00
5 changed files with 125 additions and 73 deletions

View File

@ -1,26 +1,11 @@
//生产环境 //生产环境
const PROT = "https://"//生产需替换 const PROT = "https://"//生产需替换
// const ROOTHOST = "admin.sjajk.com";//生产需替换 const ROOTHOST = "admin.sjajk.com";//生产需替换
// const PROT = "http://"
const ROOTHOST = "192.168.2.22:8187";
//测试环境 //测试环境
// const PROT = "http://" // const PROT = "http://"
// const ROOTHOST = "47.75.182.93:8090"; // const ROOTHOST = "192.168.2.29:8187";
// const ROOTHOST = "1.92.152.160";
// const ROOTHOST = "1.92.152.160";
// const ROOTHOST = "sausers.blxinchuang.com";
// const ROOTHOST = "192.168.2.222:8187";
// const ROOTHOST = "120.46.52.165";
// const ROOTHOST = "192.168.0.115:8187";
// const ROOTHOST = "192.168.1.169:8187";
// 后端本地张聪
// const ROOTHOST = "192.168.1.48:8187";
// 后端韩玉东
// const ROOTHOST = "192.168.1.50:8187";
// 客户现场
// const ROOTHOST = "192.168.110.85:8187";
//验证是否是域名 //验证是否是域名
const checkdomain = (ROOTHOST) => { const checkdomain = (ROOTHOST) => {
@ -37,23 +22,16 @@ const checkdomain = (ROOTHOST) => {
//验证是否是域名后判断http/https //验证是否是域名后判断http/https
const ROOTPATH = (checkdomain(ROOTHOST) ? "https://" : "http://") + ROOTHOST + "/sqx_fast"; const ROOTPATH = (checkdomain(ROOTHOST) ? "https://" : "http://") + ROOTHOST + "/sqx_fast";
const ROOTPATH1 = (checkdomain(ROOTHOST) ? "https://" : "http://") + ROOTHOST + "/sqx_fast"; const ROOTPATH1 = (checkdomain(ROOTHOST) ? "https://" : "http://") + ROOTHOST + "/sqx_fast";
// const ROOTPATH3 = "wss://" + ROOTHOST1 + "/wss/chatSocket/"; //聊天
const ROOTPATH2 = "wss://" + ROOTHOST + "/wss/chatSocket/"; //联系客服 const ROOTPATH2 = "wss://" + ROOTHOST + "/wss/chatSocket/"; //联系客服
const WEBSOCKETADDRESS = "wss://" + ROOTHOST + "/wss/chatSocket/"; //退出软件后台后将用户状态置为离线 const WEBSOCKETADDRESS = "wss://" + ROOTHOST + "/wss/chatSocket/"; //退出软件后台后将用户状态置为离线
const UPLOAD_PATH = ROOTPATH1 + '/alioss/upload'; const UPLOAD_PATH = ROOTPATH1 + '/alioss/upload';
const UPLOAD_AVATAR = ROOTPATH1 + '/alioss/uploadAvatar'; const UPLOAD_AVATAR = ROOTPATH1 + '/alioss/uploadAvatar';
// const ROOTPATH = "http://192.168.0.131:8187/sqx_fast";
// const ROOTPATH1 = "http://192.168.0.131:8187/sqx_fast";
// const ROOTPATH2 = "ws://192.168.0.131:8187/sqx_fast/websocket/";//联系客服
// const ROOTPATH3 = "ws://192.168.0.131:8187/sqx_fast/chatSocket/";//聊天
//腾讯地图key //腾讯地图key
const TX_MAP_KEY = 'VIWBZ-5OM3F-CV7JZ-NLKJY-AXSYV-TMFM6'; const TX_MAP_KEY = 'VIWBZ-5OM3F-CV7JZ-NLKJY-AXSYV-TMFM6';
//ws基础连接地址 //ws基础连接地址
//const WS_BASE_PATH = 'ws://192.168.31.21:8187/sqx_fast/';
//const WS_BASE_PATH = 'ws://192.168.1.20:8187/sqx_fast/';
const WS_BASE_PATH = "wss://" + ROOTHOST + "/sqx_fast/"; const WS_BASE_PATH = "wss://" + ROOTHOST + "/sqx_fast/";
//地图ws接口 //地图ws接口

View File

@ -1,9 +1,9 @@
{ {
"name" : "盛安小象", "name" : "盛安到家",
"appid" : "__UNI__B37C795", "appid" : "__UNI__37CAF65",
"description" : "", "description" : "",
"versionName" : "2.1.5", "versionName" : "2.2.5",
"versionCode" : 160, "versionCode" : 225,
"transformPx" : false, "transformPx" : false,
/* 5+App */ /* 5+App */
"app-plus" : { "app-plus" : {
@ -162,7 +162,7 @@
"platforms" : "Android,iOS", "platforms" : "Android,iOS",
"url" : "https://ext.dcloud.net.cn/plugin?id=7482", "url" : "https://ext.dcloud.net.cn/plugin?id=7482",
"android_package_name" : "com.shengan.anmo", "android_package_name" : "com.shengan.anmo",
"ios_bundle_id" : "", "ios_bundle_id" : "com.shengan.anmo",
"isCloud" : true, "isCloud" : true,
"bought" : 1, "bought" : 1,
"pid" : "7482", "pid" : "7482",

View File

@ -28,7 +28,7 @@
<image src="../../static/images/my/right.png" style="width: 12rpx;height: 21rpx;"></image> <image src="../../static/images/my/right.png" style="width: 12rpx;height: 21rpx;"></image>
</view> </view>
</view> </view>
<view class="bg" @click="show = true"> <view class="bg" @click="show = true" :class="{'disabled-view': isDisabled}">
<view>出行方式</view> <view>出行方式</view>
<view class="flex align-center"> <view class="flex align-center">
<view style="font-weight: 500;color: #999999;font-size: 28rpx;margin-right: 20rpx;" v-if="tripWay == 0"> <view style="font-weight: 500;color: #999999;font-size: 28rpx;margin-right: 20rpx;" v-if="tripWay == 0">
@ -55,6 +55,8 @@
tripWayNum:'', tripWayNum:'',
tripWay: 0, tripWay: 0,
show: false, show: false,
adjustWay: 2,
isDisabled: true,
renzheng: 0, renzheng: 0,
cxList: [{ cxList: [{
text: '公交', text: '公交',
@ -84,7 +86,9 @@
this.$Request.getT("/app/artificer/selectArtificer").then(res => { this.$Request.getT("/app/artificer/selectArtificer").then(res => {
if (res.code == 0) { if (res.code == 0) {
this.tripWay = res.data.tripWay ? res.data.tripWay : 0; this.tripWay = res.data.tripWay ? res.data.tripWay : 0;
this.tripWayNum=res.data.tripWayNum this.tripWayNum=res.data.tripWayNum;
this.adjustWay = res.data.adjustWay;
this.isDisabled = this.adjustWay==2 ? true : false;
} }
}); });
}, },
@ -171,4 +175,9 @@
font-weight: bold; font-weight: bold;
font-family: PingFang SC; font-family: PingFang SC;
} }
.disabled-view {
pointer-events: none; /* 禁止点击事件 */
opacity: 0.6; /* 改变透明度,表示禁用状态 */
}
</style> </style>

View File

@ -58,6 +58,22 @@
<view class="tabbar" @click="submit()">发布 <view class="tabbar" @click="submit()">发布
</view> </view>
</view> </view>
<!-- <view>
<video
v-if="videoSrc"
:src="videoSrc"
controls
style="width: 0; height: 0"
id="myVideo"
></video>
<canvas
:style="{ border: '1px solid red' }"
canvas-id="myCanvas"
id="myCanvas"
:width="canvasWidth"
:height="canvasHeight"
></canvas>
</view> -->
</view> </view>
</template> </template>
@ -75,7 +91,10 @@
// //
headImg: [], headImg: [],
videos: [], videos: [],
videosList: '' videosList: '',
canvasWidth: 295,
canvasHeight: 355,
videoSrc: '',
} }
}, },
onLoad(e) {}, onLoad(e) {},
@ -103,14 +122,15 @@
}) })
return return
} }
// if (!this.form.headImg) { if (!this.form.headImg) {
// uni.showToast({ // uni.showToast({
// title: '', // title: '',
// icon: 'none', // icon: 'none',
// duration: 1000 // duration: 1000
// }) // })
// return; // return;
// } this.form.headImg = "https://wx.sjajk.com/file/uploadPath/logo2.png";
}
let data = { let data = {
createBy: uni.getStorageSync("userId"), createBy: uni.getStorageSync("userId"),
filePath: this.videosList, filePath: this.videosList,
@ -136,7 +156,7 @@
} }
}); });
}, },
addvideo(e) { async addvideo(e) {
let that = this let that = this
uni.chooseVideo({ uni.chooseVideo({
count: 1, count: 1,
@ -147,7 +167,7 @@
that.$queue.showLoading("上传中..."); that.$queue.showLoading("上传中...");
uni.getFileInfo({ uni.getFileInfo({
filePath: that.videos[i], filePath: that.videos[i],
success: (infoRes) => { success: async (infoRes) => {
const size = infoRes.size; const size = infoRes.size;
if (size / 1024 / 1024 > 10) { if (size / 1024 / 1024 > 10) {
// 2MB // 2MB
@ -156,8 +176,9 @@
title: '视频超出10MB限制,请重新选择' title: '视频超出10MB限制,请重新选择'
}) })
} else { } else {
// this.videoSrc = res.tempFilePath; //2025-03-28
this.onLoadedMetadata(res.tempFilePath); //ctx.drawImagectx.draw
// await this.onLoadedMetadata(); //2025-03-28
// 2MB // 2MB
uni.uploadFile({ // uni.uploadFile({ //
@ -184,25 +205,23 @@
}) })
}, },
onLoadedMetadata(tempFilePath) { async onLoadedMetadata() {
let that = this let that = this
const canvas = document.createElement('canvas'); const video = uni.createVideoContext('myVideo', that); //2025-03-28
// Canvas video.play()
canvas.width = 295; setTimeout(function(){
canvas.height = 355;
console.log(canvas);
const context = canvas.getContext('2d');
const video = document.createElement('video');
video.src = tempFilePath;
//
video.play().then(() => {
video.pause(); video.pause();
// canvas }, 100)
context.drawImage(video, 0, 0, canvas.width, canvas.height); const ctx = uni.createCanvasContext('myCanvas', that) //2025-03-28
// canvasbase64 ctx.drawImage(video, 0, 0, 295, 355);
const base64Image = canvas.toDataURL('image/png'); ctx.draw(true, () => {
// base64Image console.log('✅ 标准回调执行');
that.checkImageSize(base64Image, (isValid) => { //
uni.canvasToTempFilePath({
canvasId: 'myCanvas',
quality: 0.8,
success: res => {
that.checkImageSize(res.tempFilePath, (isValid) => {
if (isValid) { if (isValid) {
// //
console.log('图片校验通过,可以上传'); console.log('图片校验通过,可以上传');
@ -210,8 +229,55 @@
console.log('图片超出大小限制,请重新选择'); console.log('图片超出大小限制,请重新选择');
} }
}); });
}).catch(error => { resolve()
console.error('无法播放视频:', error); },
fail: err => {
console.error('截图失败:', err)
reject(err)
}
}, this)
});
// if (!this.checkCanvasReady()) return;
// //
// ctx.beginPath();
// ctx.arc(150, 150, 50, 0, Math.PI * 2);
// ctx.fillStyle = '#00ff00';
// ctx.fill();
// // H5
// await this.h5Draw(ctx);
},
checkCanvasReady() {
// DOM
const canvas = document.getElementById('myCanvas');
if (!canvas) {
console.error('Canvas 元素未找到');
return false;
}
return true;
},
async h5Draw(ctx) {
return new Promise((resolve) => {
let callbackExecuted = false;
//
ctx.draw(true, () => {
callbackExecuted = true;
console.log('✅ 标准回调执行');
resolve();
});
//
setTimeout(() => {
if (!callbackExecuted) {
console.log('⏱️ 强制通过定时器完成');
resolve();
}
}, 100);
}); });
}, },

View File

@ -102,8 +102,7 @@ class Request {
constructor() { constructor() {
this.config = { this.config = {
baseUrl: 'https://admin.sjajk.com/', // 请求的根域名//生产需替换 baseUrl: 'https://admin.sjajk.com/', // 请求的根域名//生产需替换
// baseUrl: 'http://192.168.2.222:8187/', // 请求的根域名 // baseUrl: 'http://192.168.2.29:8187/', // 请求的根域名
// baseUrl: 'https://sausers.blxinchuang.com', // 请求的根域名
// 默认的请求头 // 默认的请求头
header: {}, header: {},
method: 'POST', method: 'POST',