This commit is contained in:
zmj 2023-10-19 14:06:20 +08:00
commit b6e6e68756
24 changed files with 3033 additions and 1101 deletions

197
App.vue
View File

@ -1,105 +1,108 @@
<script>
//#ifdef APP-PLUS
const jpushModule = uni.requireNativePlugin("JG-JPush");
// #endif
import { loginShopAccount, userInfo } from "@/api/oaUser.js"
export default {
onLaunch: async function(info) {
// let noticeArr = []
// jpushModule.addNotificationListener(res => {
// if (!noticeArr.includes(res.messageID)) {
// const audioContext = uni.createInnerAudioContext()
// //
// audioContext.src = `/static/audio/order.mp3`;
// // console.log(res.messageID)
// audioContext.play()
// noticeArr.push(res.messageID)
// console.log("app")
// }
// })
//#ifdef APP-PLUS
const jpushModule = uni.requireNativePlugin("JG-JPush");
// #endif
import {
loginShopAccount,
userInfo
} from "@/api/oaUser.js"
export default {
onLaunch: async function(info) {
// let noticeArr = []
// jpushModule.addNotificationListener(res => {
// if (!noticeArr.includes(res.messageID)) {
// const audioContext = uni.createInnerAudioContext()
// //
// audioContext.src = `/static/audio/order.mp3`;
// // console.log(res.messageID)
// audioContext.play()
// noticeArr.push(res.messageID)
// console.log("app")
// }
// })
// uni.showModal({
// content: info.referrerInfo.extraData
// })
// uni.showModal({
// content: info.referrerInfo.extraData
// })
if (info.referrerInfo?.extraData?.uniMP) {
//宿App
uni.onHostEventReceive((event, data) => {
if(event=='getLocation') uni.$emit('uniMP_getLocation', data);
});
uni.setStorageSync('uniMP', info.referrerInfo?.extraData?.uniMP);
uni.setStorageSync('APP_token', info.referrerInfo?.extraData?.token);
try {
let res = await loginShopAccount({
shop_token: info.referrerInfo?.extraData?.token
});
this.$store.commit('SET_USERINFO', {
user: data,
token: res.data.token
})
this.$store.dispatch('initConfig');
let {
data
} = await userInfo();
this.$store.commit('setUserInfo', data);
this.$isResolve()
// uni.$emit('home_initUserInfo', data);
return;
} catch (e) {
this.$isResolve()
console.log(e);
}
}
console.log('App Launch')
this.$store.dispatch('initConfig');
this.$isResolve()
try {
if (!this.$store.state.app.token) uni.reLaunch({
url: '/pages/oaLogin/oaLogin',
success() {
// #ifdef APP-PLUS
plus.navigator.closeSplashscreen(); //
// #endif
}
})
else {
// #ifdef APP-PLUS
plus.navigator.closeSplashscreen(); //
// #endif
}
} catch (e) {
// #ifdef APP-PLUS
plus.navigator.closeSplashscreen(); //
// #endif
}
},
onShow: function() {
const audioContext = uni.createInnerAudioContext()
//
audioContext.src = '/static/mp3/order.mp3'
//
//#ifdef APP-PLUS
jpushModule.addNotificationListener(res => {
if (res.notificationEventType == 'notificationOpened') return
audioContext.play()
uni.vibrateLong();
console.log("app的监听")
})
// #endif
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
if (info.referrerInfo?.extraData?.uniMP) {
//宿App
uni.onHostEventReceive((event, data) => {
if (event == 'getLocation') uni.$emit('uniMP_getLocation', data);
});
uni.setStorageSync('uniMP', info.referrerInfo?.extraData?.uniMP);
uni.setStorageSync('APP_token', info.referrerInfo?.extraData?.token);
try {
let res = await loginShopAccount({
shop_token: info.referrerInfo?.extraData?.token
});
this.$store.commit('SET_USERINFO', {
user: data,
token: res.data.token
})
this.$store.dispatch('initConfig');
let {
data
} = await userInfo();
this.$store.commit('setUserInfo', data);
this.$isResolve()
// uni.$emit('home_initUserInfo', data);
return;
} catch (e) {
this.$isResolve()
console.log(e);
}
}
console.log('App Launch')
this.$store.dispatch('initConfig');
this.$isResolve()
try {
if (!this.$store.state.app.token) uni.reLaunch({
url: '/pages/oaLogin/oaLogin',
success() {
// #ifdef APP-PLUS
plus.navigator.closeSplashscreen(); //
// #endif
}
})
else {
// #ifdef APP-PLUS
plus.navigator.closeSplashscreen(); //
// #endif
}
} catch (e) {
// #ifdef APP-PLUS
plus.navigator.closeSplashscreen(); //
// #endif
}
},
onShow: function() {
const audioContext = uni.createInnerAudioContext()
//
audioContext.src = '/static/mp3/order.mp3'
//
//#ifdef APP-PLUS
jpushModule.addNotificationListener(res => {
if (res.notificationEventType == 'notificationOpened') return
audioContext.play()
uni.vibrateLong();
console.log("app的监听")
})
// #endif
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style>
/*每个页面公共css */
@import "static/css/base.css";
@import "static/css/style.scss";
/*每个页面公共css */
@import "static/css/base.css";
@import "static/css/style.scss";
view {
box-sizing: border-box;
}
view {
box-sizing: border-box;
}
</style>

14
api/bussness.js Normal file
View File

@ -0,0 +1,14 @@
import oahttp from "@/utils/aa.js";
/**
* 绑定scoket
*/
export const bindScoket = (data) => oahttp.post('/common/im/doBindUid', data)
// 发送消息
export const sendMsgApi = (data) => oahttp.post('/common/im/sendTextMsg', data)
// 发送文件
export const sendFileApi = (data) => oahttp.post('/common/im/sendFileMsg', data)
// 消息列表
export const getMsgListApi = (data) => oahttp.post('/common/im/msgList', data)
// 片区经理id
export const getAreaManagerApi = (data) => oahttp.post('/common/im/getAreaManager', data)

View File

@ -1,45 +1,50 @@
import {
HTTP_REQUEST_URL_THREE,
HEADER,
TOKENNAME,
HTTP_REQUEST_URL_THREE,
HEADER,
TOKENNAME,
} from '@/config/app';
import { Toast } from '../libs/uniApi';
import {
Toast
} from '../libs/uniApi';
// import { checkLogin } from '../libs/login';
import store from '../store';
function toLogin() {
store.commit("LOGOUT");
uni.showToast({
title: '请登录',
icon: 'none',
duration: 1000
});
store.commit("LOGOUT");
uni.showToast({
title: '请登录',
icon: 'none',
duration: 1000
});
}
function upLoad(url, data) {
let Url = HTTP_REQUEST_URL_THREE,
header = {}
if (store.state.app.token) header[TOKENNAME] = store.state.app.token;
return new Promise((reslove, reject) => {
uni.uploadFile({
url: Url + '/api' + url,
filePath: data.filePath,
name: data.name,
success: (uploadFileRes) => {
uploadFileRes.data = JSON.parse(uploadFileRes.data)
if(uploadFileRes.data.code==1) reslove(uploadFileRes.data)
else Toast('网络错误')
},
fail: (err) => {
Toast('网络错误')
}
})
});
let Url = HTTP_REQUEST_URL_THREE,
header = {}
if (store.state.app.token) header[TOKENNAME] = store.state.app.token;
return new Promise((reslove, reject) => {
uni.uploadFile({
url: Url + '/api' + url,
filePath: data.filePath,
name: data.name,
success: (uploadFileRes) => {
uploadFileRes.data = JSON.parse(uploadFileRes.data)
if (uploadFileRes.data.code == 1) reslove(uploadFileRes.data)
else Toast('网络错误')
},
fail: (err) => {
Toast('网络错误')
}
})
});
}
export const upLoadImage = (data)=>{
return upLoad('/upload/image', data)
export const upLoadImage = (data) => {
return upLoad('/upload/image', data)
}
export const VIDEO_URL = HTTP_REQUEST_URL_THREE + '/api/upload/video'
export const FILE_URL = HTTP_REQUEST_URL_THREE + '/api/upload/file'
// im文件上传
// export const VIDEO_URL_IM = HTTP_REQUEST_URL_THREE + '/api/upload/video'
export const FILE_URL_IM = HTTP_REQUEST_URL_THREE + '/common/im/sendFileMsg'

28
api/index.js Normal file
View File

@ -0,0 +1,28 @@
// let Token = localStorage.getItem("token")
let Token = uni.getStorageSync("token")
let request = (METHOD, URL, DATA) => {
return new Promise((reslove, reject) => {
uni.request({
url: 'https://ceshi-im.lihaink.cn/' + URL,
method: METHOD,
data: {
...DATA
},
header: {
'content-type': 'application/json',
"Authorization": Token || ""
},
success: function(res) {
reslove(res)
},
fail: function(err) {
reject(err)
},
});
})
}
export default request;

View File

@ -1,5 +1,5 @@
import oahttp from "@/utils/oahttp.js";
import oahttp2 from "@/utils/logistics.js";
// http://logistics.lihaink.cn/api/getCarHistory
/**
* 车辆列表
@ -14,6 +14,10 @@ export const upVehicleApi = (data) => oahttp.post('/vehicle/rentApply', data)
export const applycarApi = (data) => oahttp.post('/vehicle/rentApply', data)
// 显示轨迹
export const locusApi = (data) => oahttp.post('/vehicle/vehicleTrack', data)
// 获取可购买车辆列表
export const canBuyCarListApi = (data) => oahttp.get('/vehicle/getFreeCars', data)
// 购买车辆
export const buyCarApi = (data) => oahttp.post('/vehicle/buyCars', data)
// 当前车辆位置信息
// export const locusApi = (data) => oahttp.post('/vehicle/vehicleTrack', data)
// api / getCarLocal

View File

@ -0,0 +1,696 @@
<template>
<view style="background-color: #F6F7FD;">
<!-- <view class="storeName" style="padding-top:var(--status-bar-height) ;">
<u--image src="/static/right.png" width="50rpx" height="50rpx" @click='backFn'></u--image>
<view class="" @click="timeFn">
{{timeFn()}}
</view>
<view class="">
</view>
</view> -->
<!-- 消息 -->
<view class="content" @click="showPlus=false" id="content">
<view class="">
<u-loadmore :status="status" />
</view>
<!-- -->
<view class="task-li" v-for="item,index in list" :key="index">
<!-- 对方消息 -->
<view v-if="formId==item.fromUser.id">
<view class="task-li-r">
<view class="" style="margin-right: 10rpx;">
<u--image :showLoading="true" :src="a" shape="circle" width="40px" height="40px"></u--image>
</view>
<view @longpress="copyText(item.content)" class="task-li-content" v-if="item.type=='text'"
style="margin-right: 10rpx;">
{{item.content}}
</view>
<!-- 图片 -->
<view class="task-li-content" v-if="item.type=='image'" style="margin-right: 10rpx;"
@tap="showOverLayFn(item.content,item.type)">
<image :src="item.content" style="width:200rpx" mode="widthFix"></image>
</view>
<!-- 视频 -->
<view class="task-li-content" v-if="item.type=='video'"
style="margin-right: 10rpx;position: relative;"
@tap="showOverLayFn(item.content,item.type)">
<u--image :showLoading="true" :src="a" width="100px" height="80px"></u--image>
<view class="yl-text">
点击预览
</view>
<!-- <video :src="item.content" @loadedmetadata="onVideoLoaded" controls id="vi1"
style="width: 400rpx; height: 100px;"></video> -->
<!-- <image src="item.content" style="width:200rpx" mode="widthFix"></image> -->
<!-- <canvas canvas-id="videoCanvas1" style="width: 100px; height: 100px;"></canvas> -->
</view>
</view>
<view class="send-time">
{{item.sendTime}}
</view>
</view>
<!-- 我的消息 -->
<view class="task-li-l" v-if="true">
<!-- 文字 -->
<view class="task-li-content" @longpress="copyText(item.content)" v-if="item.type=='text'"
style="margin-right: 10rpx;">
{{item.content}}
</view>
<!-- 图片 -->
<view class="task-li-content" v-if="item.type=='image'" style="margin-right: 10rpx;"
@tap="showOverLayFn(item.content,item.type)">
<image :src="item.content" style="width:200rpx" mode="widthFix"></image>
</view>
<!-- 视频 -->
<view class="task-li-content" v-if="item.type=='video'"
style="margin-right: 10rpx;position: relative;" @tap="showOverLayFn(item.content,item.type)">
<u--image :showLoading="true" src="/static/YL1.png" width="100px" height="80px"></u--image>
<view class="yl-text">
点击预览
</view>
</view>
<view class="">
<u--image :showLoading="true" :src="a" shape="circle" width="40px" height="40px"></u--image>
</view>
</view>
</view>
<!-- 本地 -->
<view v-if="local">
<view class="localTask" v-if="localType=='video'">
<view class="task-li-content" style="margin-right: 10rpx;">
<video :src="local" controls id="vi1" style="width: 400rpx; height: 100px;"></video>
<u-line-progress :percentage="progress" activeColor="#19BE6B"></u-line-progress>
<!-- <canvas canvas-id="videoCanvas1" style="width: 100px; height: 100px;"></canvas> -->
</view>
<view class="" style="margin-right: 10rpx;">
<u--image :showLoading="true" shape="circle" :src="a" width="40px" height="40px"></u--image>
</view>
</view>
<view class="localTask" v-if="localType=='image'">
<view class="task-li-content" style="margin-right: 10rpx;">
<!-- <image :src="local" controls id="vi1" style="width: 400rpx; height: 100px;"></image> -->
<image :src="local" style="width:200rpx" mode="widthFix"></image>
<u-line-progress :percentage="progress" activeColor="#19BE6B"></u-line-progress>
</view>
<view class="" style="margin-right: 10rpx;">
<u--image :showLoading="true" shape="circle" :src="a" width="40px" height="40px"></u--image>
</view>
</view>
</view>
<view style="height: 50px;background-color: #F6F7FD;">
</view>
</view>
<!-- 底部 -->
<view class="bottom">
<!-- -->
<view class="send-col">
<input type="text" class="send-ipt" @click="scrollFn(300)" v-model="value" placeholder="请输入聊天内容"
placeholder-style="color:#DDD;" :cursor-spacing="6">
<u--image :showLoading="true" src="/static/img/bussness/Plus.png" width="32px" height="32px"
@click="showPlusFn"></u--image>
<button class="send" @tap="sendFn">发送</button>
</view>
<!-- 发送照片 -->
<view class="plus" v-if="showPlus">
<view class="plus_li">
<u--image :showLoading="true" src="/static/img/bussness/XC.png" width="120rpx" height="120rpx"
@click="choseImgFn"></u--image>
<text>图片</text>
</view>
<view class="plus_li">
<u--image :showLoading="true" src="/static/img/bussness/SP.png" width="120rpx" height="120rpx"
@click="choseVideoFn"></u--image>
<text>视频</text>
</view>
<!-- asdas -->
</view>
</view>
<!-- 遮罩图 -->
<u-overlay :show="show" @click="show = false">
<view class="warp">
<view class="rect" @tap.stop @longpress="saveImage(overLaySrc)" v-if="overLayType=='image'">
<image :showLoading="true" style="width: 80vw;" mode="widthFix" :src="overLaySrc"></image>
</view>
<view class="rect" @tap.stop v-if="overLayType=='video'">
<video :src="overLaySrc"></video>
</view>
</view>
</u-overlay>
</view>
</template>
<script>
// import request from "@/api/index.js"
import {
bindScoket,
sendMsgApi
} from "@/api/bussness.js"
export default {
data() {
return {
a: "https://img1.baidu.com/it/u=716638254,3920932970&fm=253&app=138&size=w931&n=0&f=JPEG&fmt=auto?sec=1695920400&t=aeec3d0e86c23759d5f82b3757e9b442",
list: [],
value: "",
showPlus: false,
num: 0,
flags: true,
scollNum: 999999999999,
client_id: "",
formId: "",
name: "",
status: "lodemore",
page: 1,
limit: 10,
formUser: "",
show: false,
overLaySrc: "",
overLayType: "",
canvasContext: null,
timer: "",
local: "",
localType: "",
progress: "",
showNotice: false
}
},
methods: {
timeFn(time) {
// 1695722299000
const currentDate = new Date(); //
const targetDate = new Date(1695722299000);
if (this.isSameDay(currentDate, targetDate)) {
const hours = targetDate.getHours(); //
const minutes = targetDate.getMinutes(); //
return hours + ':' + minutes;
} else if (this.isYesterday(currentDate, targetDate)) {
return '昨天';
}
const month = targetDate.getMonth() + 1; // 01
const day = targetDate.getDate(); //
return month + '月' + day + '日';
},
isSameDay(date1, date2) {
return (
date1.getFullYear() === date2.getFullYear() &&
date1.getMonth() === date2.getMonth() &&
date1.getDate() === date2.getDate()
);
},
isYesterday(currentDate, targetDate) {
const yesterday = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate() - 1);
return this.isSameDay(yesterday, targetDate);
},
saveImage(src) {
uni.saveImageToPhotosAlbum({
filePath: src,
success() {
uni.showToast({
title: '保存成功',
icon: 'none'
});
},
fail() {
uni.showToast({
title: '保存失败',
icon: 'none'
});
}
});
},
copyText(value) {
const text = value;
uni.setClipboardData({
data: text,
success() {
uni.showToast({
title: '复制成功',
icon: 'none'
});
}
});
},
backFn() {
uni.navigateBack()
},
showOverLayFn(src, type) {
this.show = true
this.overLaySrc = src
this.overLayType = type
},
getListFn() {
request("POST", "enterprise/im/getMessageList", {
limit: this.limit,
page: this.page,
toContactId: this.formId,
}).then(res => {
if (res.data.data.length == 0) {
this.status = "nomore"
return
}
this.list.unshift(...res.data.data)
this.status = "loadmore"
}).catch(err => {
console.log(err, "获取消息列表失败")
})
},
scrollFn(time) {
this.scollNum += 500
setTimeout(() => {
uni.pageScrollTo({
scrollTop: this.scollNum,
});
}, time ? time : 100)
},
generateRandId() {
var d = new Date().getTime();
var uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
var r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c == "x" ? r : r & 0x3 | 0x8).toString(16);
});
return uuid;
},
sendFn() {
if (!this.value) return
this.num++
this.flags = !this.flags
request("POST", "enterprise/im/sendMessage", {
content: this.value,
extends: null,
fileName: "",
fileSize: 0,
file_cate: 0,
file_id: 0,
fromUser: {
...this.fromUser
},
from_user: this.fromUser.id,
id: this.generateRandId(),
is_group: 0,
is_read: 0,
sendTime: Date.now(),
status: "going",
toContactId: this.formId,
type: "text",
}).then(res => {
console.log("发送消息成功")
// this.list.push(res.data.data)
}).catch(err => {
console.log(err, "发送消息失败")
})
this.value = ""
this.scrollFn(100)
},
login() {
return
// request("POST", "common/Pub/login", {
// account: 13800000006,
// password: "123456",
// rememberMe: false,
// }).then(res => {
// uni.setStorageSync("token", (res.data.data.authToken))
// uni.setStorageSync("userinfo", JSON.stringify(res.data.data.userInfo))
// })
},
showPlusFn() {
this.showPlus = !this.showPlus
this.scrollFn(200)
},
choseImgFn() {
this.login()
let time = Date.now()
let that = this
// https://im.raingad.com/common/upload/uploadFile
uni.chooseImage({
count: 1, //
success: res => {
const tempFilePath = res.tempFilePaths[0];
const file = res.tempFiles[0]
console.log(file)
that.local = tempFilePath
that.localType = 'image'
that.showPlus = false
that.scrollFn(200)
const uploadTask = uni.uploadFile({
url: "https://ceshi-im.lihaink.cn/common/upload/uploadFile",
filePath: tempFilePath, //
name: 'file',
header: {
"Authorization": uni.getStorageSync("token")
},
formData: {
message: JSON.stringify({
"id": this.generateRandId(),
"sendTime": Date.now(),
"status": "going",
"type": "image",
// "content": "blob:https://im.raingad.com/e2ffd725-a9e7-4a01-b7da-83fd64af97a4",
"content": `blob:${tempFilePath}`,
"is_read": 0,
"is_group": 0,
"file_id": 0,
"file_cate": 0,
"fileName": file.name,
"fileSize": file.size,
"extends": null,
"fromUser": {
...this.fromUser
},
from_user: this.fromUser.id,
toContactId: this.formId,
})
}, //
success: function(uploadRes) {
that.local = ""
that.list.push(JSON.parse(uploadRes.data).data)
//
},
fail: function(error) {
console.log('上传失败', error);
//
}
});
uploadTask.onProgressUpdate((res) => {
this.progress = res.progress
console.log('上传进度', res.progress);
});
},
fail: err => {
console.log(err, "没有选择图片");
}
});
},
choseVideoFn() {
let that = this
uni.chooseVideo({
sourceType: ['album', 'camera'], //
maxDuration: 600, //
camera: 'back', //
success: res => {
const tempFilePath = res.tempFilePath;
that.local = res.tempFilePath
that.localType = 'video'
that.showPlus = false
that.scrollFn(200)
const uploadTask = uni.uploadFile({
url: "https://ceshi-im.lihaink.cn/common/upload/uploadFile",
filePath: tempFilePath, //
name: 'file',
header: {
"Authorization": uni.getStorageSync("token")
},
formData: {
message: JSON.stringify({
"id": this.generateRandId(),
"sendTime": Date.now(),
"status": "going",
"type": "image",
// "content": "blob:https://im.raingad.com/e2ffd725-a9e7-4a01-b7da-83fd64af97a4",
"content": `blob:${tempFilePath}`,
"is_read": 0,
"is_group": 0,
"file_id": 0,
"file_cate": 0,
"fileName": "20210719150601_4401e.jpg",
"fileSize": 72046,
"extends": null,
"fromUser": {
...this.fromUser
},
from_user: this.fromUser.id,
toContactId: this.formId,
})
}, //
success: function(uploadRes) {
that.local = ""
that.list.push(JSON.parse(uploadRes.data).data)
//
},
fail: function(error) {
uni.showToast({
title: '视频不能超过60s',
duration: 2000,
icon: 'none'
});
that.local = false
}
});
uploadTask.onProgressUpdate((res) => {
this.progress = res.progress
console.log('上传进度', res.progress);
});
},
fail: err => {
uni.showToast({
title: '视频不能超过60s',
duration: 2000,
icon: 'none'
});
}
});
},
},
onShow() {
return
let that = this
this.scrollFn(500)
this.timer = setInterval(() => {
request("POST", "enterprise/im/getMessageList", {
limit: 1,
page: 1,
toContactId: this.formId,
}).then(res => {
if (res.data.data[0]?.id != this.list[this.list.length - 1]?.id) {
this.list.push(res.data.data[0])
if (res.data.data[0].type == 'video' || res.data.data[0].type == 'image') {
this.local = ""
}
// console.log(res.data.data)
}
// this.list.unshift(...res.data.data)
// this.status = "loadmore"
})
}, 3000)
},
async onPullDownRefresh() {
this.status = "loading"
this.page++
await this.getListFn()
// console.log("")
uni.stopPullDownRefresh();
},
created() {
let obj = {
"user_id": 2,
"account": "13800000002",
"realname": "熊大",
"avatar": "https://ceshi-im.lihaink.cn/avatar/熊大/120/2",
"email": "xiongda@kaishanlaw.com",
"sex": 2,
"role": 0,
"motto": null,
"remark": "",
"name_py": "xiongda",
"setting": null,
"is_auth": 0,
"last_login_time": 1695720745,
"last_login_ip": "221.182.82.214",
"delete_time": 0,
"status": 1,
"qrUrl": "https://ceshi-im.lihaink.cn/scan/u/oVQ5OmjEa7zD",
"displayName": "熊大",
"id": 2
}
this.fromUser = obj
console.log(this.fromUser)
return
this.getListFn()
},
onUnload() {
clearInterval(this.timer)
},
}
</script>
<style lang="scss">
.yl-text {
position: absolute;
color: black;
top: 60%;
left: 50%;
transform: translateX(-50%);
font-size: 24rpx;
}
// .storeName {
// position: fixed;
// text-align: center;
// background-color: white;
// font-weight: bold;
// height: 80rpx;
// width: 100vw;
// z-index: 9;
// display: flex;
// align-items: center;
// justify-content: space-between;
// }
.topflag {
height: 80rpx;
background-color: #F6F7FD;
}
.content {
padding: 0 20rpx;
min-height: 100vh;
// height: 89vh;
background-color: #F6F7FD;
overflow: auto;
padding-top: 10rpx;
// padding-bottom: 50px;
.task-li {
margin-bottom: 20rpx;
}
.task-li-l {
display: flex;
justify-content: flex-end;
}
.task-li-r {
display: flex;
}
.task-li-content {
background-color: white;
padding: 20rpx;
border-radius: 20rpx;
color: white;
word-break: break-all;
max-width: 60vw;
}
}
.bottom {
background-color: white;
// height: 8vh;
// padding: 20rpx;
padding: 20rpx 0;
position: fixed;
box-sizing: border-box;
// bottom: 400px;
padding-bottom: 500px;
/* #ifdef APP-PLUS */
bottom: 0px;
padding-bottom: 10px;
/* #endif */
.send-col {
display: flex;
align-items: center;
justify-content: space-around;
.send-ipt {
width: 70vw;
background-color: #F5F5F5;
height: 60rpx;
border-radius: 20rpx;
padding-left: 20rpx;
}
}
.send {
background-color: #2573fb;
color: #fff;
height: 64rpx;
margin-left: 20rpx;
border-radius: 6rpx;
padding: 0;
width: 120rpx;
line-height: 62rpx;
&:active {
background-color: #1573fb;
}
}
.plus {
display: flex;
background-color: white;
padding: 20rpx;
.plus_li {
display: flex;
flex-direction: column;
align-items: center;
margin-right: 20rpx;
flex-wrap: wrap;
}
}
}
.warp {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
.rect {}
.localTask {
display: flex;
justify-content: flex-end;
}
</style>

View File

@ -27,6 +27,7 @@ switch (env) {
httpApi = 'https://ceshi-worker-task.lihaink.cn' //测试
httpApiThree = 'https://ceshi-worker-task.lihaink.cn' //测试
httpApiTwo = 'https://ceshi-logistics.lihaink.cn' //测试环境
//测试环境
}
@ -55,6 +56,7 @@ module.exports = {
HTTP_REQUEST_URL_THREE: httpApiThree,
HTTP_REQUEST_URL_TWO: httpApiTwo,
// #ifdef H5
//H5接口是浏览器地址
// HTTP_REQUEST_URL: httpApi || window.location.protocol + "//" + window.location.host,

1712
pages.json

File diff suppressed because it is too large Load Diff

View File

@ -97,7 +97,7 @@
</view>
<view class="list">
<text>
详情
详情
</text>
<view>
<view>

View File

@ -110,9 +110,28 @@
</view>
</view>
</view>
<!-- 片区经理聊天 -->
<view class="chat" @click="navTo('/subpkg/chatMang/index')" style="margin-top: 130rpx;">
<view class="chat-l">
<u--image shape="circle" :showLoading="true" :src="managerInfo.manager_avatar" width="91rpx" height="91rpx"></u--image>
<view class="" style="margin-left: 40rpx;">
{{managerInfo.manager_name}}
</view>
</view>
<view class="" style="display: flex;">
<view class="brange" v-if="managerInfo.msg_num">
{{managerInfo.msg_num}}
</view>
<view class="iconfont icon-you">
<uni-icons type="forward"></uni-icons>
</view>
</view>
</view>
<view class="my_task">
<view class="task_title flex_a_c_j_sb">
<view class="title">工作管理</view>
<view class="title" @click="leftClick">工作管理</view>
<!-- <view class="flex_a_c"
>更多
<view class="iconfont icon-you">
@ -215,6 +234,9 @@ import {
import {
noticeList
} from "@/api/notice.js";
import {
getAreaManagerApi
} from "@/api/bussness.js"
// import tabbar from '../components/tabbar'
import {
getIndexListAPI,
@ -241,6 +263,8 @@ export default {
},
data () {
return {
brange:0,
options: {
data: '',
},
@ -248,6 +272,7 @@ export default {
page_num: 1,
flag: false,
uniMP: false,
managerInfo:{},
id: "",
is_captain: 0,
notArr: [],
@ -289,14 +314,16 @@ export default {
};
},
async onLoad () {
await this.$onLaunched;
this.is_captain = JSON.parse(uni.getStorageSync("USER_INFO")||'{}')?.is_captain
this.options.data = bj;
//#ifdef APP-PLUS
let that = this;
jpushModule.addNotificationListener(function (result) {
if (!that.notArr.includes(result.messageID)) {
that.$refs.globalPopup.showPopu();
// that.$refs.globalPopup.showPopu();
that.getOrderList();
console.log("idnex的");
that.notArr.push(result.messageID);
@ -326,8 +353,16 @@ export default {
})
},
async onShow () {
// uni.navigateTo({
// url:'/subpkg/chatMang/index'
// }
// this.getUserIndex()
// this.getIndexList()
let user_id= JSON.parse( uni.getStorageSync("USER_INFO")).id
getAreaManagerApi({user_id}).then(res=>{
console.log(res.data)
this.managerInfo=res.data
})
await this.$onLaunched;
if (uni.getStorageSync('uniMP')) this.uniMP = true;
userInfo().then(({
@ -408,18 +443,26 @@ export default {
methods: {
//
noticeFn () {
const audioContext = uni.createInnerAudioContext()
audioContext.src = '/static/mp3/order.mp3'
jpushModule.addNotificationListener(res => {
const audioContext = uni.createInnerAudioContext()
if(res.content.includes('')){
audioContext.src = '/static/mp3/im.wav'
audioContext.play()
uni.vibrateLong();
console.log("im")
return
}
if (res.notificationEventType == 'notificationOpened') return
audioContext.src = '/static/mp3/order.mp3'
audioContext.play()
uni.vibrateLong();
this.getOrderList()
this.$refs.globalPopup.showPopu();
// this.$refs.globalPopup.showPopu();
console.log("index的监听")
})
},
leftClick (e) {
console.log("发送给宿主")
uni.sendHostEvent('closeApp', e, (ret) => {
//
console.log('关闭应用' + JSON.stringify(ret));
@ -958,4 +1001,32 @@ export default {
}
}
}
.chat{
margin-top: 1000px;
// margin-top: 2000rpx;
width: 694.74rpx;
margin: 0 auto;
background-color: white;
border-radius: 12px;
padding:20rpx;
// padding-top: 10rpx;
padding-right: 24rpx;
display: flex;
justify-content: space-between;
align-items: center;
.chat-l{
display: flex;
align-items: center;
}
}
.brange{
color: white;
background-color: red;
width: 40rpx;
height: 40rpx;
border-radius: 40rpx;
font-size: 12px;
text-align: center;
lighting-color: 40rpx;
}
</style>

View File

@ -1,10 +1,10 @@
<template>
<view class="login">
<!-- <image class="bg-iamge" src="../../static/img/login/login_back_img.png"></image> -->
<hx-lottie :options="options" ref="lottie" style="width: 100vw;height: 100vh;transform: scale(1.3);background-color: #0122c7;"/>
<u-navbar v-if="uniMP" @leftClick="leftClick" bgColor="rgba(0,0,0,0)"
leftIconColor=" #fff" :autoBack="false">
</u-navbar>
<hx-lottie :options="options" ref="lottie"
style="width: 100vw;height: 100vh;transform: scale(1.3);background-color: #0122c7;" />
<u-navbar v-if="uniMP" @leftClick="leftClick" bgColor="rgba(0,0,0,0)" leftIconColor=" #fff" :autoBack="false">
</u-navbar>
<!-- #ifdef APP-PLUS||H5 -->
<!-- <view style="height: var(--status-bar-height)"></view> -->
<!-- #endif -->
@ -18,10 +18,10 @@
</view>
<input @click="getId" class="mobile item" v-model="formData.account" type="tel"
placeholder="输入账号" />
<input style="width: 0;height: 0;opacity: 0;margin: 0;padding: 0;" v-model="formData.account" type="tel"
placeholder="输入账号" />
<input @click="getId" class="mobile item" v-model="formData.password"
maxlength="26" placeholder="输入密码" password type="safe-password" />
<input style="width: 0;height: 0;opacity: 0;margin: 0;padding: 0;" v-model="formData.account"
type="tel" placeholder="输入账号" />
<input @click="getId" class="mobile item" v-model="formData.password" maxlength="26"
placeholder="输入密码" password type="safe-password" />
<!-- <input v-if="current == 1" class="mobile item" v-model="formData.account" placeholder="输入手机号" />
<view v-if="current == 1" class="code item">
<input placeholder="输入验证码" v-model="formData.code" maxlength="6" />
@ -42,12 +42,14 @@
loginAccount,
userInfo
} from "@/api/oaUser.js"
import { getConfig } from "@/api/config.js";
import {
getConfig
} from "@/api/config.js";
import {
Toast
} from "../../libs/uniApi";
import bj from "@/static/animation/bj2.json"
import encrypt from "@/utils/encrypt.js"
import bj from "@/static/animation/bj2.json"
import encrypt from "@/utils/encrypt.js"
// #ifdef APP-PLUS
var jpushModule = uni.requireNativePlugin("JG-JPush");
@ -56,11 +58,11 @@
export default {
data() {
return {
options: {
data: '',
},
uniMP: false,
APP_token: '',
options: {
data: '',
},
uniMP: false,
APP_token: '',
tabList: [{
name: '账号登录'
},
@ -74,33 +76,33 @@
terminal: 6, //6APP
scene: 1,
register_id: "",
shop_token: ""
shop_token: ""
},
tips: '获取验证码',
// refCode: null,
seconds: 60,
};
},
onLoad() {
this.APP_token = uni.getStorageSync('APP_token');
this.options.data = bj;
// this.$refs.lottie.call('play');
this.initTerminal();
},
onShow() {
if(uni.getStorageSync('uniMP'))this.uniMP = true;
},
onLoad() {
this.APP_token = uni.getStorageSync('APP_token');
this.options.data = bj;
// this.$refs.lottie.call('play');
this.initTerminal();
},
onShow() {
if (uni.getStorageSync('uniMP')) this.uniMP = true;
},
methods: {
changeTabs(e) {
this.current = e.index;
this.formData.scene = e.index + 1;
},
leftClick(e) {
uni.sendHostEvent('closeApp', e, (ret) => {
//
console.log('关闭应用'+JSON.stringify(ret));
});
},
leftClick(e) {
uni.sendHostEvent('closeApp', e, (ret) => {
//
console.log('关闭应用' + JSON.stringify(ret));
});
},
// id
getId() {
// #ifdef APP-PLUS
@ -118,13 +120,13 @@
if (!this.formData.account) return Toast('账号不能为空');
if (this.formData.scene == 1 && !this.formData.password) return Toast('密码不能为空');
if (this.formData.scene == 2 && !this.formData.code) return Toast('验证码不能为空');
this.formData.shop_token = uni.getStorageSync('APP_token');
this.formData.shop_token = uni.getStorageSync('APP_token');
let that = this;
uni.showLoading({
title: '正在登录中'
})
let res = await loginAccount(that.formData);
encrypt.encode('ACT', that.formData);
encrypt.encode('ACT', that.formData);
this.$store.commit('SET_USERINFO', {
user: data,
token: res.data.token
@ -133,8 +135,8 @@
data
} = await userInfo();
this.$store.commit('setUserInfo', data);
let config = await getConfig();
this.$store.commit('SET_CONFIG', config.data);
let config = await getConfig();
this.$store.commit('SET_CONFIG', config.data);
uni.hideLoading()
if (data.is_new_user) {
uni.showLoading({
@ -150,13 +152,13 @@
}
})
// #endif
return uni.reLaunch({
url: '/pages/oaHome/oaHome',
success: () => {
uni.$emit('initOaTask'); //
uni.hideLoading()
}
})
return uni.reLaunch({
url: '/pages/oaHome/oaHome',
success: () => {
uni.$emit('initOaTask'); //
uni.hideLoading()
}
})
} else uni.navigateTo({
url: '/pages/updatePassword/updatePassword'
});
@ -223,7 +225,7 @@
width: 100vw;
height: 100vh;
position: relative;
overflow: hidden;
overflow: hidden;
background-color: $theme-oa-color;
/* #ifdef H5 */
// background-image: url("../../static/img/login/login_back_img.png");
@ -238,10 +240,10 @@
// }
.body {
position: absolute;
top: 45%;
left: 50%;
transform: translate(-50%, -50%);
position: absolute;
top: 45%;
left: 50%;
transform: translate(-50%, -50%);
display: flex;
flex-direction: column;
align-items: center;
@ -258,9 +260,9 @@
-webkit-background-clip: text;
}
::v-deep uni-input{
min-height: 0 !important;
}
::v-deep uni-input {
min-height: 0 !important;
}
.login-card {
width: 694rpx;

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
static/img/bussness/SP.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
static/img/bussness/XC.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
static/mp3/im.mp3 Normal file

Binary file not shown.

BIN
static/mp3/im.wav Normal file

Binary file not shown.

666
subpkg/chatMang/index.vue Normal file
View File

@ -0,0 +1,666 @@
<template>
<view style="background-color: #F6F7FD;">
<u-loading-page :loading="showLoading" v-if="showLoading"></u-loading-page>
<!-- 消息 -->
<view class="content" @click="showPlus=false" id="content" v-show='!showLoading'>
<view class="">
<u-loadmore :status="status" :loadmore-text="`你正在与${manager_nmae}聊天`" />
</view>
<view class="task-li" v-for="item,index in list" :key="index">
<view class="" v-if="index %5 ==0" style="text-align: center;">
{{timeFn(item.create_time)}}
</view>
<!-- 对方消息 -->
<view v-if="item.from_user_id!=fromId">
<view class="task-li-r">
<view class="" style="margin-right: 10rpx;">
<u--image :showLoading="true" :src="item.from_user_avatar" shape="circle" width="40px"
height="40px"></u--image>
</view>
<view @longpress="copyText(item.content)" class="task-li-content" v-if="item.type=='text'"
style="margin-right: 10rpx;">
<view style="color: #576B95;" @click="href(item.content)" v-if="isLink(item.content)">
{{item.content}}
</view>
<view class="" v-else>
{{item.content}}
</view>
</view>
<!-- 图片 -->
<view class="task-li-content" v-if="item.type=='image'" style="margin-right: 10rpx;"
@tap="previewImage(item.content)">
<image :src="item.content" style="width:200rpx" mode="widthFix"></image>
</view>
<!-- 视频 -->
<view class="task-li-content" v-if="item.type=='video'"
style="margin-right: 10rpx;position: relative;"
@tap="showOverLayFn(item.content,item.type)">
<u--image :showLoading="true"
:src=" item.content+'?x-oss-process=video\/snapshot,t_1000,m_fast,w_800,f_png' "
width="100px" height="80px"></u--image>
<view class="yl-text">
<u-icon name="play-circle" color='white' size='30'></u-icon>
</view>
</view>
</view>
<view class="send-time">
{{item.sendTime}}
</view>
</view>
<!-- 我的消息 -->
<view class="task-li-l" v-else>
<!-- 文字 -->
<view class="task-li-content" @longpress="copyText(item.content)" v-if="item.type=='text'"
style="margin-right: 10rpx;">
<!-- {{item.content}} -->
<view style="color: #576B95;" @click="href(item.content)" v-if="isLink(item.content)">
{{item.content}}
</view>
<view class="" v-else>
{{item.content}}
</view>
<!-- <a href="item.content" target="_blank"> {{item.content}}</a> -->
</view>
<!-- 图片 -->
<view class="task-li-content" v-if="item.type=='image'" style="margin-right: 10rpx;"
@tap="previewImage(item.content)">
<image :src="item.content" style="width:200rpx" mode="widthFix"></image>
</view>
<!-- 视频 -->
<view class="task-li-content" v-if="item.type=='video'"
style="margin-right: 10rpx;position: relative;" @tap="showOverLayFn(item.content,item.type)">
<u--image :showLoading="true"
:src=" item.content+'?x-oss-process=video\/snapshot,t_1000,m_fast,w_800,f_png' "
width="100px" height="80px"></u--image>
<view class="yl-text">
<u-icon name="play-circle" color='white' size='30'></u-icon>
</view>
</view>
<view class="">
<u--image :showLoading="true" :src="a" shape="circle" width="40px" height="40px"></u--image>
</view>
</view>
</view>
<!-- 本地 -->
<view v-show="item.status" v-for="(item,index) in local">
<view class="localTask" v-if="item.localType=='video'">
<view class="task-li-content" style="margin-right: 10rpx;">
<video :src="item.localSrc" controls id="vi1" style="width: 400rpx; height: 100px;"></video>
<!-- <image :src="" style="width:200rpx" mode="widthFix"></image> -->
<u-loadmore status="loading" loading-text="努力上传中" />
</view>
<view class="" style="margin-right: 10rpx;">
<u--image :showLoading="true" shape="circle" :src="a" width="40px" height="40px"></u--image>
</view>
</view>
<view class="localTask" v-if="item.localType=='image'">
<view class="task-li-content" style="margin-right: 10rpx;">
<image :src="item.localSrc" style="width:200rpx" mode="widthFix"></image>
<u-loadmore status="loading" loading-text="努力上传中" />
</view>
<view class="" style="margin-right: 10rpx;">
<u--image :showLoading="true" shape="circle" :src="a" width="40px" height="40px"></u--image>
</view>
</view>
</view>
<view style="height: 300rpx;background-color: #F6F7FD;" v-if="showPlus">
</view>
<view style="height: 150rpx;background-color: #F6F7FD;" v-else>
</view>
</view>
<!-- 底部 -->
<view class="bottom">
<!-- -->
<view class="send-col">
<input type="text" class="send-ipt" @focus="scrollFn" v-model="value" placeholder="请输入聊天内容"
placeholder-style="color:#DDD;" :cursor-spacing="6">
<u--image :showLoading="true" src="/static/img/bussness/Plus.png" width="32px" height="32px"
@click="showPlusFn"></u--image>
<button class="send" @tap="sendFn">发送</button>
</view>
<!-- 发送照片 -->
<view class="plus" v-if="showPlus">
<view class="plus_li">
<u--image :showLoading="true" src="/static/img/bussness/XC.png" width="120rpx" height="120rpx"
@click="choseImgFn"></u--image>
<text>图片</text>
</view>
<view class="plus_li">
<u--image :showLoading="true" src="/static/img/bussness/SP.png" width="120rpx" height="120rpx"
@click="choseVideoFn"></u--image>
<text>视频</text>
</view>
</view>
</view>
<!-- 遮罩图 -->
<u-overlay :show="show" @click="show = false">
<view class="warp">
<view class="rect" @tap.stop v-if="overLayType=='video'">
<video :src="overLaySrc" controls :autoplay="true"></video>
</view>
</view>
</u-overlay>
</view>
</template>
<script>
import {
FILE_URL_IM
} from "@/api/file.js"
import {
sendMsgApi,
getMsgListApi,
bindScoket,
sendFileApi,
getAreaManagerApi
} from "@/api/bussness.js"
export default {
data() {
return {
showLoading: true,
a: "https://img1.baidu.com/it/u=716638254,3920932970&fm=253&app=138&size=w931&n=0&f=JPEG&fmt=auto?sec=1695920400&t=aeec3d0e86c23759d5f82b3757e9b442",
list: [],
bind: false,
value: "",
showPlus: false,
scollNum: 500000000000,
client_id: "",
fromId: "",
toId: "",
name: "",
status: "loadmore",
page_no: 1,
limit: 10,
show: false,
overLaySrc: "",
overLayType: "",
local: [],
localType: "",
imageList: [],
sendData: {},
manager_nmae: "",
msg_id: "",
aaa: false,
}
},
methods: {
isLink(text) {
var pattern = /^(https?:\/\/|www\.|.*\.com).*$/i;
return pattern.test(text);
},
href(url) {
// uni.navigate
plus.runtime.openURL(url);
// plus.runtime.openUrl(url)
},
previewImage(src) {
this.imageList[0] = src
uni.previewImage({
urls: this.imageList,
})
},
generateRandId() {
var d = new Date().getTime();
var uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
var r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c == "x" ? r : r & 0x3 | 0x8).toString(16);
});
// return uuid;
this.msg_id = uuid
console.log("改变id")
},
timeFn(time) {
time = time * 1000
const currentDate = new Date(); //
const targetDate = new Date(time);
if (this.isSameDay(currentDate, targetDate)) {
const hours = targetDate.getHours(); //
const minutes = targetDate.getMinutes(); //
return hours + ':' + (minutes >= 10 ? minutes : '0' + minutes);
} else if (this.isYesterday(currentDate, targetDate)) {
return '昨天';
}
const month = targetDate.getMonth() + 1; // 01
const day = targetDate.getDate(); //
return month + '月' + day + '日';
},
isSameDay(date1, date2) {
return (
date1.getFullYear() === date2.getFullYear() &&
date1.getMonth() === date2.getMonth() &&
date1.getDate() === date2.getDate()
);
},
isYesterday(currentDate, targetDate) {
const yesterday = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate() - 1);
return this.isSameDay(yesterday, targetDate);
},
toast(msg) {
uni.showToast({
title: msg,
icon: 'none'
});
},
saveImage(src) {
uni.saveImageToPhotosAlbum({
filePath: src,
success() {
uni.showToast({
title: '保存成功',
icon: 'none'
});
},
fail() {
this.toast('保存失败')
}
});
},
copyText(value) {
const text = value;
uni.setClipboardData({
data: text,
success() {
uni.showToast({
title: '复制成功',
icon: 'none'
});
}
});
},
showOverLayFn(src, type) {
this.show = true
this.overLaySrc = src
this.overLayType = type
},
getListFn() {
getMsgListApi({
from_user_id: this.fromId,
to_user_id: this.toId,
scene: 0,
page_no: this.page_no,
page_size: 10
}).then(res => {
if (res.data.length <= 0) {
uni.stopPullDownRefresh();
this.status = "nomore"
return
}
this.list = res.data.reverse().concat(this.list)
uni.stopPullDownRefresh();
})
},
scrollFn() {
let that = this
this.scollNum += 100
setTimeout(() => {
uni.pageScrollTo({
scrollTop: that.scollNum, //
success: function() {
console.log('滚动')
}
})
}, 100)
},
sendFn() {
let that = this
if (!this.value) {
this.toast("消息不能为空")
return
}
let data = {
from_user_id: this.fromId,
to_user_id: this.toId,
type: "text",
content: this.value,
scene: 0,
create_time: (Date.now() / 1000),
msg_id: this.msg_id
}
sendMsgApi({
...data
}).then(res => {
console.log(data)
this.list.push(data)
this.scrollFn(100)
this.value = ""
this.generateRandId()
}).catch(err => {
this.toast('发送失败')
this.generateRandId()
})
},
showPlusFn() {
this.showPlus = !this.showPlus
this.scrollFn()
},
choseImgFn() {
this.generateRandId()
let time = Date.now()
let that = this
uni.chooseImage({
count: 1, //
success: res => {
const tempFilePath = res.tempFilePaths[0];
that.local.push({
localType: 'image',
localSrc: tempFilePath,
status: true,
msg_id: that.msg_id
})
that.showPlus = false
that.scrollFn()
console.log(that.local)
uni.uploadFile({
url: FILE_URL_IM,
filePath: tempFilePath, //
name: 'file',
header: {
"Authorization": uni.getStorageSync("TOKEN")
},
formData: {
from_user_id: that.fromId,
to_user_id: that.toId,
scene: 0,
msg_id: that.msg_id,
type: 'image'
},
success: function(uploadRes) {
let data = JSON.parse(uploadRes.data).data
var localIndex = that.local.findIndex(function(element) {
return element.msg_id === data.msg_id;
});
that.local[localIndex].status = false
that.list.push(data)
},
fail: function(error) {
this.toast('上传失败')
}
});
},
fail: err => {
this.toast('操作取消')
}
});
},
choseVideoFn() {
this.generateRandId()
let that = this
uni.chooseVideo({
sourceType: ['album', 'camera'], //
maxDuration: 600, //
camera: 'back', //
success: res => {
const tempFilePath = res.tempFilePath;
that.local.push({
localType: 'video',
localSrc: tempFilePath,
status: true,
msg_id: that.msg_id
})
that.showPlus = false
that.scrollFn()
uni.uploadFile({
url: FILE_URL_IM,
filePath: tempFilePath, //
name: 'file',
header: {
"Authorization": uni.getStorageSync("token")
},
formData: {
from_user_id: that.fromId,
to_user_id: that.toId,
scene: 0,
msg_id: that.msg_id,
type: 'video'
}, //
success: function(uploadRes) {
let data = JSON.parse(uploadRes.data).data
var localIndex = that.local.findIndex(function(element) {
return element.msg_id === data.msg_id;
});
that.local[localIndex].status = false
that.list.push(data)
//
},
fail: function(error) {
console.log(error)
uni.showToast({
title: '视频不能超过60s',
duration: 2000,
icon: 'none'
});
// that.local = false
}
});
},
fail: err => {
// uni.showToast({
// title: '60s',
// duration: 2000,
// icon: 'none'
// });
}
});
},
},
onShow() {
this.page_no = 1
this.generateRandId()
this.fromId = JSON.parse(uni.getStorageSync("USER_INFO")).id
getAreaManagerApi({
user_id: this.fromId
}).then(res => {
this.toId = res.data.to_user_id
this.manager_nmae = res.data.manager_name
getMsgListApi({
from_user_id: this.fromId,
to_user_id: this.toId,
scene: 0,
page_no: 1,
page_size: 10
}).then(res => {
this.showLoading = false
this.list = res.data.reverse()
this.scrollFn()
})
})
},
async onPullDownRefresh() {
let that = this
this.status = "loading"
this.page_no++
await this.getListFn()
this.status = "loadmore"
},
onLoad() {
console.log(F)
let user = JSON.parse(uni.getStorageSync('USER_INFO'))
this.a = user.avatar
console.log(user.avatar)
uni.connectSocket({
url: 'wss://worker-task.lihaink.cn/wss'
});
uni.onSocketOpen(function(res) {
console.log('WebSocket连接已打开');
});
uni.onSocketError(function(res) {
console.log('WebSocket连接打开失败请检查');
});
let that = this
uni.onSocketMessage(function(res) {
let data = JSON.parse(res.data)
if (data.client_id) {
let client_id = data.client_id
if (!that.bind) {
bindScoket({
client_id: client_id,
user_id: that.fromId,
scene: 0,
}).then(res => {
that.bind = true
})
}
}
//
else if (data.type != 'ping') {
console.log(data)
that.list.push(data)
that.scrollFn()
}
});
this.generateRandId()
},
}
</script>
<style lang="scss">
.yl-text {
position: absolute;
color: white;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 24rpx;
}
.topflag {
height: 80rpx;
background-color: #F6F7FD;
}
.content {
padding: 0 20rpx;
min-height: 95vh;
background-color: #F6F7FD;
padding-top: 10rpx;
.task-li {
margin-bottom: 20rpx;
}
.task-li-l {
display: flex;
justify-content: flex-end;
}
.task-li-r {
display: flex;
}
.task-li-content {
background-color: white;
padding: 10rpx 20rpx;
line-height: 50rpx;
// line-height: 30rpx;
border-radius: 20rpx;
// color: white;
word-break: break-all;
max-width: 535rpx;
overflow-wrap: break-word;
}
}
.bottom {
background-color: white;
padding: 20rpx 0;
position: fixed;
box-sizing: border-box;
bottom: 0px;
padding-bottom: 10px;
/* #ifndef APP-PLUS */
// bottom: 40px;
/* #endif */
.send-col {
display: flex;
align-items: center;
justify-content: space-around;
.send-ipt {
width: 70vw;
background-color: #F5F5F5;
height: 60rpx;
border-radius: 20rpx;
padding-left: 20rpx;
}
}
.send {
background-color: #2573fb;
color: #fff;
height: 64rpx;
margin-left: 20rpx;
border-radius: 6rpx;
padding: 0;
width: 120rpx;
line-height: 62rpx;
&:active {
background-color: #1573fb;
}
}
.plus {
display: flex;
background-color: white;
padding: 20rpx;
.plus_li {
display: flex;
flex-direction: column;
align-items: center;
margin-right: 20rpx;
flex-wrap: wrap;
}
}
}
.warp {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
}
.rect {}
.localTask {
display: flex;
justify-content: flex-end;
}
</style>

View File

@ -13,9 +13,15 @@
{{item.create_time.slice(0, 10)}}
</view>
<view class="">
<view class="" v-if="item.type==0">
{{item.company_b_name}}提出租赁车辆一辆
</view>
<view class="" v-if="item.type==1">
{{item.company_b_name}}上传自有车辆一辆
</view>
<view class="" v-if="item.type==2">
{{item.company_b_name}}提出解除租赁
</view>
</view>
</view>
@ -64,6 +70,10 @@
background-color: #FF7C32;
color: white;
padding: 0 10rpx;
font-size: 24rpx;
// line-height: rpx;
display: flex;
align-items: center;
width: 200rpx;
height: 50rpx;
margin-right: 10rpx;

268
subpkg/property/buyCar.vue Normal file
View File

@ -0,0 +1,268 @@
<template>
<view class="box">
<!-- 搜索 -->
<view class="" style="padding:10rpx 20rpx;">
<u-search :showAction="true" bgColor='white' @search="queryCarFn" placeholder="搜索车牌号" actionText="搜索"
:animation="true" v-model="queryCar" @custom='queryCarFn'></u-search>
</view>
<view style="height: 80vh;" v-if="carList.length==0">
<u-empty mode="search" marginTop='100' icon="/static/img/empty/data.png">
</u-empty>
</view>
<view v-else class="car-list" v-for="item,index in carList" :key="index">
<view class="car-info">
<view class="car-info-l">
<view class="">
<u--image :src="item.pic" width="150rpx" height="150rpx" style="margin-right:20rpx"></u--image>
</view>
<view class="car-info-c">
<view class="lincense">
车牌号: {{item.license}}
</view>
<!-- <view class="lincense">
行驶里程: 1212KM
</view> -->
<view class="lincense" v-if="item.flag">
当前状态: 当前使用中
</view>
<view class="lincense" v-else>
当前状态: 闲置中
</view>
</view>
</view>
<!-- -->
<view class="car-info-r">
<view class="" style="margin: 10rpx 50rpx;">
<u-checkbox-group v-model="item.checked" placement="column" @change="checkboxChange(item.id)">
<u-checkbox>
</u-checkbox>
</u-checkbox-group>
</view>
<view class="" v-show="item.id==carCheckedArr[0] &&type!=2">
选择该车辆为监管车辆
</view>
</view>
</view>
</view>
<view class="bottom">
<view class="" @tap="open">
已选择{{carCheckedArr.length}}辆车
</view>
<view class="bottom-btn" @tap="buyCarFn">
<u-button type="primary" style="background-color: #0122C7;border: none;" text="确定"></u-button>
</view>
</view>
<!-- 组件 -->
<u-popup :show="showPop" mode="bottom" @close="close" @open="open">
<view class="pop">
<view class="check-car-list" v-for="item,index in carList" v-show="item.checked.length" :key="index">
<u--image :src="item.pic" width="150rpx" height="150rpx"></u--image>
<view class="" style="margin-top: 10rpx;">
{{item.license}}
</view>
<view class="pop-check">
<u-checkbox-group v-model="item.checked" @change="popChange(item.id)">
<u-checkbox>
</u-checkbox>
</u-checkbox-group>
</view>
</view>
</view>
</u-popup>
</view>
</template>
<script scoped>
// import { methods } from '../../uni_modules/uview-ui/libs/mixin/mixin'
import {
canBuyCarListApi,
buyCarApi
} from "@/api/property.js"
import {
Toast
} from "../../libs/uniApi"
export default {
data() {
return {
queryCar: '',
carList: [],
carListI: [],
showPop: false,
carCheckeList: [],
carCheckedArr: [],
type: "",
}
},
methods: {
buyCarFn() {
if (this.carCheckedArr.length == 0) {
Toast("请先选择车辆!")
return
}
let data = []
this.carList.forEach(item => {
this.carCheckedArr.forEach(items => {
if (item.id == items) {
data.push({
id: item.id,
license: item.license
})
}
})
})
let datas = JSON.stringify(data)
buyCarApi({
cars: datas
}).then(res => {
Toast("申请成功!")
setTimeout(() => {
uni.redirectTo({
url: '/subpkg/property/index'
})
}, 1000)
})
// uni.navigateTo({
// url: '/subpkg/property/index'
// })
},
queryCarFn() {
this.carList = []
this.carListI.forEach(item => {
// console.log(item.license)
if (item.license.includes(this.queryCar)) {
this.carList.push(item)
}
})
},
checkboxChange(i) {
if (this.carCheckedArr.includes(i)) {
// let index=this.ca
let index = this.carCheckedArr.indexOf(i)
// console.log(index)
this.carCheckedArr.splice(index, 1)
// this.arr
} else {
this.carCheckedArr.push(i)
}
console.log(this.carCheckedArr)
},
popChange(index) {
this.checkboxChange(index)
// console.log(this.carCheckedArr)
},
close() {
this.showPop = false
},
open() {
if (this.carCheckedArr.length == 0) return
this.showPop = true
},
change(e) {
console.log(e)
}
},
onLoad(option) {
this.type = option.type
// console.log(option.license)
canBuyCarListApi().then(res => {
res.data.forEach(item => {
if (item.license == option.license) {
item.flag = true
}
})
this.carListI = res.data
this.carList = Array.from(this.carListI);
})
}
}
</script>
<style lang="scss" scoped>
.box {
padding-bottom: 100rpx;
}
.car-list {
padding: 20rpx;
background-color: #fff;
.car-info {
display: flex;
justify-content: space-between;
margin-bottom: 20rpx;
.car-info-l {
display: flex;
}
.car-info-c {
display: flex;
flex-direction: column;
justify-content: space-between;
}
.car-info-r {
max-width: 20vw;
}
}
}
.pop {
min-height: 40vh;
display: flex;
flex-wrap: wrap;
box-sizing: border-box;
padding: 20rpx 10rpx;
padding-right: 0;
padding-bottom: 100rpx;
.check-car-list {
// margin-right: 30rpx;
width: 182.5rpx;
display: flex;
// justify-tent: ;
flex-direction: column;
align-items: center;
position: relative;
}
.pop-check {
position: absolute;
right: 0;
top: -5rpx;
}
}
.bottom {
background-color: white;
height: 100rpx;
position: fixed;
bottom: 0;
z-index: 1000;
width: 100vw;
box-sizing: border-box;
border-radius: 30rpx 30rpx 0 0;
padding: 0 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
.bottom-btn {
width: 200rpx;
}
}
</style>

View File

@ -46,12 +46,12 @@
<view class="car_type">
<text>自有车辆</text>
</view>
<view class="car_li">
<view class="car_li" v-for="(item,index) in dataList.cars_info">
<view class="" style="display: flex;justify-content: space-between;align-items: center;">
<view class="" style="display: flex;align-items: center;">
<u--image :src="dataList.cars_info.pic" width="100rpx" height="100rpx"></u--image>
<u--image :src="item.pic" width="100rpx" height="100rpx"></u--image>
<view class="" style="margin-left: 10rpx;">
车牌号{{dataList.cars_info.license}}
车牌号{{item.license}}
</view>
</view>
@ -133,7 +133,7 @@
<view class="name">{{typeFn( dataList.type) }}
</view>
<view>
<text>{{'2023-03-03'}}</text>
<text>{{dataList.update_time}}</text>
</view>
</view>
</view>
@ -202,11 +202,11 @@
this.dataList = res.data.vehicleContract
this.carList = res.data.vehicleRentCars
this.checked = [this.carList[0]?.car_id] || ''
this.dataList.cars_info = JSON.parse(this.dataList.cars_info) || ""
// if (this.dataList.status == 3) {
// uni.navigateBack()
// }
console.log(this.dataList.cars_info.pic)
if (this.carList.length > 0 || this.dataList.cars_info) {
this.flag1 = false
}
@ -244,7 +244,7 @@
return "租赁合同"
}
if (status == 1) {
return "自有车"
return "自有车"
}
if (status == 2) {
"解除合同"

View File

@ -30,7 +30,7 @@
export default {
data() {
return {
datasList: [1, 2, 3],
datasList: [],
}
},
onLoad() {

View File

@ -4,23 +4,23 @@
<u-loading-page :loading="showLoading"></u-loading-page>
</view>
<view class="" v-else>
<!-- 小组公司 -->
<view class="noCar" v-if='company_type==18'>
<!-- 申请 -->
<view class="" v-if="step==6||step==9999">
<u-empty text="你还没有所属车辆哦,请向镇公司申请用车或使用自有车辆并绑定系统~" icon="../../static/img/empty/data.png">
</u-empty>
<view>
<mytn text='购买车辆' class="buyCar" :position="false" @click="navgo('/subpkg/property/buyCar')">
</mytn>
</view>
<view>
<mytn text='申请用车' class="upCar" :position="false" @click="applycarFn"></mytn>
</view>
<view class="">
<mytn text='上传自有车辆' @click="show=true"></mytn>
</view>
<u-modal :show="show" @close="show=false" :showCancelButton="true" @confirm="upCarFn"
:closeOnClickOverlay="true" @cancel="show=false" title="车辆上传">
<view class="slot-content">
@ -44,7 +44,7 @@
</view>
<view class="uplode" v-else>
<u-icon name="plus-circle-fill" color="#0022C7" size="28"></u-icon>
上传头像
上传车辆图片
<view class="up" style="opacity: 0;">
<u-upload :fileList="imgUrl?[{url:imgUrl}]:[]"
@afterRead="afterReadAvatar" :maxCount="1">
@ -60,13 +60,10 @@
</view>
</view>
</u-modal>
</view>
<!-- 等待 -->
<view class="" v-if='[5,-1,0,1,2].includes(step)'>
<view class="loading" v-if='step==5'>
<span>你已提交解除申请,等待签约</span>
<span class="dots">...</span>
@ -79,6 +76,7 @@
<span class="dots">...</span>
</view>
</view>
<!-- 申请用车 -->
<view v-if="datas.type ==0">
<view class="loading">
@ -86,7 +84,13 @@
<span class="dots">...</span>
</view>
</view>
<!-- 购买车辆 -->
<view class="loading" v-if="datas.type==3">
<span>您的购车申请已经提交我们正在加快审核中请耐心等待在此期间您可以继续使用车辆完成配送任务哦~</span>
<span class="dots">...</span>
</view>
</view>
<!-- 审核结束 -->
<view class="" v-if="step==4">
<view style="margin-top: 15vh;">
@ -101,16 +105,16 @@
</view>
</view>
<view class="">
<mytn text='购买车辆' class="buyCar" :position="false" @click="navgo('/subpkg/property/buyCar')">
</mytn>
<view class="" style="margin: 20rpx 0;">
<mytn text='上传自有车辆' @click="show=true"></mytn>
</view>
<view class="">
<mytn text='申请用车' :position="false" class="upCar" @click="applycarFn"></mytn>
</view>
<u-modal :show="show" @close="show=false" :showCancelButton="true" @confirm="upCarFn"
:closeOnClickOverlay="true" @cancel="show=false" title="车辆上传">
<view class="slot-content">
@ -134,7 +138,7 @@
</view>
<view class="uplode" v-else>
<u-icon name="plus-circle-fill" color="#0022C7" size="28"></u-icon>
上传头像
上传车辆图片
<view class="up" style="opacity: 0;">
<u-upload :fileList="imgUrl?[{url:imgUrl}]:[]"
@afterRead="afterReadAvatar" :maxCount="1">
@ -166,13 +170,13 @@
申请用车</u-button>
</view>
</view>
</view>
<!-- 镇街公司 -->
<view v-if='company_type==16'>
<view class="info">
<text>可监管车辆数量 {{datas.monitor_num}}</text>
<text>购买车辆 {{datas.buy_num}}</text>
<view @click="showPop=true" class="not_leased">
<view class="">
租赁 {{datas.rent_num}}<text v-if="datas.apply_num">(待审核:{{datas.apply_num}})</text>
@ -184,6 +188,7 @@
</view>
</view>
<text v-if="datas.self_num">自有车辆 {{datas.self_num}}</text>
<!-- <text v-if="datas.self_num">出售车辆 {{datas.self_num}}</text> -->
</view>
<!-- 公告栏 -->
<view class="application_tit" v-if="applicationList.length">
@ -208,7 +213,6 @@
<u-icon name="arrow-right"></u-icon>
</view>
</view>
</view>
</view>
<view class="personnel_list">
@ -227,7 +231,8 @@
<text> {{item.rent_user.user_name}}</text>
<view style="float: right;">
<text style="color: green;" v-if="item.type==1">自有车辆</text>
<text style="color: orange;" v-else>租赁车辆</text>
<text style="color: orange;" v-if='item.type==0'>租赁车辆</text>
<text style="color: orange;" v-if='item.type==2'>购买车辆</text>
</view>
</view>
<view class="li">
@ -272,7 +277,6 @@
<view class="slot-content">
<u--input placeholder="请输入内容" type="number" v-model="newCarNum"></u--input>
<view style="color: red;font-size: 20rpx;" v-show="novalue">
<view class="" v-if="newCarNum>datas.can_rent_num">
数量超过上限
</view>
@ -296,13 +300,16 @@
</template>
<script>
import {
FILE_URL_IM
} from "@/api/file.js"
import {
getvehicleListApi,
getAgencyListApi,
leaseApi,
upVehicleApi,
getAgencyDetailApi,
getvehicleDetailApi,
// getvehicleDetailApi,
villageCompanyApi,
} from "@/api/property.js"
@ -341,69 +348,54 @@
newcarTit: "",
flag: false,
showpopp: false,
};
},
onLoad() {
// if (true) {
// uni.navigateTo({
// url: '/subpkg/property/vehicle_a'
// })
// }
// getvehicleListApi().then(res => {
// console.log(res)
// // this.getvehicleList = res
// })
// getAgencyListApi().then(res => {
// // this.applicationList=res
// })
this.initIndex()
// this.initIndex()
setTimeout(() => {
this.flag = true
})
},
onShow() {
this.initIndex()
},
onPullDownRefresh() {
this.initIndex()
//
// setTimeout(() => {
// const newList = this.hostProduct.reverse();
// this.hostProduct = newList;
uni.stopPullDownRefresh();
// }, 500)
},
methods: {
//
initIndex() {
let type = (JSON.parse(Cache.get("USER_INFO")).company.company_type)
let type = this.$store.state.app.userInfo.company.company_type
this.company_type = type
//
if (type == 18) {
villageCompanyApi().then(res => {
this.showLoading = false
this.datas = res.data
this.step = res.data?.status || 9999
console.log(res.data?.id)
if (res.data?.id) {
this.step = res.data?.status
} else {
this.step = 9999
}
if (this.step == 3) {
uni.redirectTo({
url: `/subpkg/property/vehicle_a?id=${res.data.cars_info.id}`
})
}
})
}
//
else {
getvehicleListApi().then(res => {
this.datas = res.data
res.data.apply.length >= 2 ? this.applicationList = res.data.apply : this.applicationList =
res
.data.apply.slice(0, 2)
res.data.apply.slice(0, 2)
this.dataList = res.data.car_list
this.showLoading = false
})
@ -419,7 +411,7 @@
},
confirmFn() {
uni.reLaunch({
url: '/subpkg/property/index' //
url: '/subpkg/property/index'
});
},
@ -454,7 +446,6 @@
})
}, 2000)
})
this.show = false
this.noInfo = false
@ -556,7 +547,19 @@
position: fixed;
bottom: 110rpx;
left: 0;
// z-index: 9999999;
z-index: 1;
width: 100%;
border-radius: 0;
color: #fff;
height: 90rpx;
line-height: 90rpx;
background-color: $theme-oa-color;
}
.buyCar {
position: fixed;
bottom: 220rpx;
left: 0;
z-index: 1;
width: 100%;
border-radius: 0;

View File

@ -24,7 +24,9 @@
<view class="right">
<view class="li" style="display: flex;justify-content: space-between;">
<text>行驶总里程: {{datas.mileage}}</text>
<text v-if="datas.type" style="color: green;">自有车辆</text>
<text v-if="datas.type==2" style="color: green;">购买车辆</text>
<text v-if="datas.type==0" style="color: green;">租赁车辆</text>
<text v-if="datas.type==1" style="color: green;">自有车辆</text>
</view>
<view class="li">
<text>承租公司: </text>
@ -46,7 +48,7 @@
<text>签约时间: </text>
<text>{{datas.rent_time}} </text>
</view>
<view class="li" v-if="datas.type">
<view class="li" v-if="datas.type==1">
<text>到期时间: </text>
<text> {{overDateFn(datas.rent_time) }} </text>
</view>
@ -68,7 +70,10 @@
<u--image :showLoading="true" src="../../static/img/contract/pdf.png" width="80px"
height="80px"></u--image>
<view class="text">
<view class="name">租赁合同</view>
<view class="name" v-if="datas.type==0">租赁合同</view>
<view class="name" v-if="datas.type==1">自有车辆合同</view>
<view class="name" v-if="datas.type==2">购车合同</view>
<!-- <view class="name">购买合同</view> -->
<view>
<text>{{ datas.create_time}}</text>
</view>
@ -82,6 +87,12 @@
</view>
</view>
</view>
<mybtn text="购买车辆"
@click="navTo2(`/subpkg/property/buyCar?license=${datas.car_license}&type=${datas.type}`)"
v-if="company_type==18"></mybtn>
</view>
<web-view style="height: 100vh;" :src="pdfUrl" v-if="showPDF"></web-view>
@ -163,6 +174,16 @@
},
methods: {
navTo(url) {
uni.navigateTo({
url
})
},
navTo2(url) {
uni.redirectTo({
url
})
},
//
overDateFn(date) {
var specifiedDate = new Date(date);
@ -208,7 +229,7 @@
end_time: `${this.queryData} 23:59:59`,
start_time: `${this.queryData} 00:00:00`,
}).then(res => {
console.log(res.data)
// console.log(res.data)
this.markers[0].latitude = res.data[0].latitude
this.markers[0].longitude = res.data[0].longitude
this.polyline = [{

127
utils/aa.js Normal file
View File

@ -0,0 +1,127 @@
import {
HTTP_REQUEST_URL_THREE,
HEADER,
TOKENNAME,
} from '@/config/app';
import {
Toast
} from '../libs/uniApi';
// import { checkLogin } from '../libs/login';
import store from '../store';
function toLogin() {
uni.showToast({
title: '请先登录',
icon: 'none',
duration: 1000
});
}
function baseRequestTwo(url, method, data, {
noAuth = false,
noVerify = false,
onReLogin = false
}) {
let Url = HTTP_REQUEST_URL_THREE,
header = HEADER;
if (!noAuth) {
// 已经未登录了,禁止请求
if (!store.state.config.request) return Promise.reject({
msg: '未登录'
});
//登录过期自动登录
if (!store.state.app.token) {
toLogin();
store.commit("SET_REQUEST", false);
return Promise.reject({
msg: '未登录'
});
}
}
// if (store.state.app.token) header[TOKENNAME] = 'Bearer ' + store.state.app.token;
if (store.state.app.token) header[TOKENNAME] = store.state.app.token;
// header[TOKENNAME] = 'Bearer sdjflidshjgfkbdasgjmasbgvhauuiavhkesvndkaesbvkjsdbv';
return new Promise((reslove, reject) => {
// uni.showLoading({
// title: '加载中'
// })
uni.request({
// url: Url + '/api/v1' + url,
url: Url + url,
method: method || 'GET',
header: {
...header
},
data: method != 'GET' ? data || {} : {},
params: method == 'GET' ? data : {},
success: (res) => {
if (noVerify)
reslove(res.data);
else if (res.data.code == -1) {
if(onReLogin) {
store.commit('LOGOUT');
return reject();
}
// 如果登录超时,自动重新登录并且继续发送请求
store.dispatch("RE_LOGIN", {
url: url,
method: method,
data: data,
opt: {
noAuth,
noVerify
}
}).then((e)=>{
reslove(e);
}).catch((err)=>{
reject(res.data);
})
// store.commit("SET_REQUEST", false);
} else if (res.data.code == 0) {
if (res.data.msg != '无登录信息') {
uni.showToast({
title: res.data.msg || '请检查网络',
icon: 'none',
})
}
reject(res.data);
} else if (res.data.code == 1) {
store.commit("SET_REQUEST");
reslove(res.data);
} else if (res.data.code == 200) {
store.commit("SET_REQUEST");
reslove(res.data.data);
} else if ([410000, 410001, 410002, 40000].indexOf(res.data.code) !== -1) {
toLogin();
reject(res.data);
} else if (res.data.code == 501) {
reject(res.data);
} else {
uni.showToast({
title: res.data.msg || '请检查网络',
icon: 'none'
})
reject(res.data.msg || '请检查网络');
}
},
fail: (message) => {
// uni.hideLoading()
uni.showToast({
title: '网络错误',
icon: 'none'
})
reject('请求失败');
}
})
});
}
const oahttp = {};
['options', 'get', 'post', 'put', 'head', 'delete', 'trace', 'connect'].forEach((method) => {
oahttp[method] = (api, data, opt) => baseRequestTwo(api, method, data, opt || {})
});
export default oahttp;