You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1542 lines
38 KiB

<template>
<!-- 发布帖子 -->
<loadlogo v-if="!isWxaudit" />
<block v-else>
<view class="postRelease">
<far-bottom></far-bottom>
<!-- 帖子信息输入 -->
<view class="postInfoInput">
<view class="postInfoInputPackage">
<view class="postMainInput">
<view class="postMainInputPackage">
<view class="postMainInputTitle">
<span>{{languageStatus!=1?'内容描述':'내용설명'}}</span>
<view @click="show = true" v-if="setInfo.set.hideaudio == 0">
<image :src="imgfixUrls + 'merchant/ys.png'" />
<span>{{languageStatus!=1?'语音':'음성'}}</span>
</view>
</view>
<textarea placeholder="内容描述(可以文字和语音录入,语音请讲普通话),请尽量避免使用特殊符号,字体表情,颜文字等特殊文本,防止无法储存造成内容空白。" :maxlength="1800"
v-model="info.content" placeholder-class="main_input" @input="textEnter"></textarea>
</view>
</view>
<!-- 上传提示 -->
<view class="postImgTips" v-if="setInfo.set.hideimg != 1 || setInfo.set.hidevideo != 1">
<span>
{{languageStatus!=1?'有图有真相':'실물이미지'}}
<span>
{{setInfo.set.hideimg != 1
&& setInfo.set.hidevideo != 1?(languageStatus!=1?'(最多上传9张图片、1个视频)':'(최대 9개 이미지,1개 동영상 가능)'):setInfo.set.hideimg == 1
&& setInfo.set.hidevideo != 1?(languageStatus!=1?'(最多上传1个视频)':'1개 동영상 가능'):(languageStatus!=1?'(最多上传9张图片)':'최대 6개 이미지')}}</span>
</span>
</view>
<!-- 上传提示 -->
<!-- 上传按钮 -->
<view class="upLoadFile">
<!-- 图片阅览 -->
<view class="zsView" v-for="(item, index) in images" style="fontSize:24upx">
<image :src="item" mode="aspectFill" />
<image :src="imgfixUrls + 'merchant/close.png'" @click="deletImg(item, 'img')" />
</view>
<view class="zsView" style="fontSize:24upx" v-if="info.video_img_link !== '' && !!info.video_img_link">
<image :src="info.video_img_link" mode="aspectFill" />
<image :src="imgfixUrls + 'merchant/close.png'" @click="deletImg(info.video_img_link, 'video')" />
</view>
<!-- 图片阅览 -->
<view class="upLoadImg" @click="uploadFiles(uploadnums, 'img')" v-if="info.img.length < 9 && setInfo.set.hideimg != 1 && !info.video_link && !info.video_img_link">
<view>
<image :src="imgfixUrls + 'merchant/sctp.png'" />
</view>
<text class="upText">{{languageStatus!=1?'上传图片':'이미지 올리기'}}</text>
</view>
<view ref="input" class="input" style="display: none;"></view>
<!-- 视频封面图 -->
<view class="upLoadImg" @click="uploadFiles(1, 'video')" v-if="!info.video_img_link && setInfo.set.hidevideo != 1 && info.img.length==0">
<view>
<image :src="imgfixUrls + 'merchant/sctp.png'" />
</view>
<text class="upText">{{languageStatus!=1?'上传视频封面':'이미지 올리기'}}</text>
</view>
<!-- 视频封面图 -->
<view ref="input" class="input" style="display: none;"></view>
<block v-if="src == '' && setInfo.set.hidevideo != 1 && info.img.length==0">
<view class="upLoadVideo" @click="upButton">
<view>
<image :src="imgfixUrls + 'merchant/scsp.png'" />
</view>
<text class="upText">{{languageStatus!=1?'上传视频':'동영상 올리기'}}</text>
</view>
</block>
</view>
<!-- 上传按钮 -->
<!-- 上传视频展示 -->
<view class="Zsvideo-main" v-if="info.video_link !== '' && !!info.video_link">
<view class="t-r" v-if="isAndroid === '1' && isAdclose">
<image :src="imgfixUrls + 'merchant/close.png'" class="adcloseImg" @click="deletVideo"></image>
</view>
<video class="zsVideo" :src="src" v-if="info.video_link !== '' && !!info.video_link">
<block v-if="isAndroid === '2'">
<cover-image :src="imgfixUrls + 'merchant/close.png'" class="closeImg" @click="deletVideo"></cover-image>
</block>
</video>
</view>
<!-- 上传视频展示 -->
<!-- 标签选择 -->
<!-- <view class="checkTips" :style="{marginTop:marginT.marginTop}">
<view v-for="(item, index) in setInfo.label" @click="checkSecondsType(item)" :class="info.keyword.indexOf(item) !== -1 ? 'checked' : ''">
<span>{{ item }}</span>
</view>
</view> -->
<!-- 标签选择 -->
</view>
</view>
<!-- 帖子信息输入 -->
<!-- 用户信息输入 -->
<view class="userInfoInput" v-if="0">
<view class="userInfoInputPackage">
<view class="userInfoInputTitle"><span>{{languageStatus!=1?'填写信息':'정보 입력'}}</span></view>
<view class="userInput">
<view class="inputView">
<span>{{languageStatus!=1?'联系人':'연락인'}}</span>
<input placeholder="请输入真实姓名" v-model="info.nickname" />
</view>
<view class="inputView">
<span>{{languageStatus!=1?'联系电话':'연락전화'}}</span>
<input placeholder="请输入联系电话" v-model="info.phone" type="number" />
</view>
<view class="inputView">
<span>{{languageStatus!=1?'分享标题':'공유제목'}}</span>
<input placeholder="默认格式:XX发布的XX信息" v-model="info.share_title" />
</view>
</view>
</view>
</view>
<!-- 用户信息输入 -->
<!-- 用户定位 -->
<view class="dwView" v-if="locaStaus !== 0" @click="locatShow = true">
<span>{{ dwText }}</span>
<image :src="imgfixUrls + 'merchant/right.svg'" />
</view>
<!-- 用户定位 -->
<!-- #ifdef MP-WEIXIN -->
<view class="dvview dis-flex f-24" v-if="setInfo.set.wxapptip == '1'">
<text class="col-9 iconfont icon-info f-24" style="font-size: 24upx;padding-right: 10upx;line-height: 40upx;"></text>
<view class="col-9">
为了让您及时获取发布信息或其他用户回复信息提示,系统将订阅消息通知,您也可以前往个人中心-设置-订阅消息中主动订阅'业务处理结果通知。
</view>
</view>
<!-- #endif -->
<!-- 发布按钮 -->
<!-- <button class="fbButton col-f f-28" @click="release" :disabled="HideDisabled"> 确 认 发 布 </button> -->
<button type="warn" v-if="!id" :disabled="HideDisabled" @click="release" class="fbButton"> {{languageStatus!=1?'确 认 发 布':'올리기 확인'}} <text class="f-24" v-if="setInfo.price != '0.00'">({{setInfo.price}})元</text></button>
<button type="warn" v-else :disabled="HideDisabled" @click="release" class="fbButton"> {{languageStatus!=1?'确 认 修 改':'정보 수정'}}</button>
<!-- 发布按钮 -->
<view class="full"></view>
<!-- 语音弹窗 -->
<PopManager :show="show" @clickmask="closePop" :type="type">
<view class="yyView">
<view>
<span v-if="ysStatus == 0">开始录音</span>
<span v-else>{{ str }}</span>
</view>
<view class="yyButtonPackage">
<view class="yyButton" v-if="ysStatus == 0" @click="start"></view>
<view v-else class="yyStopButton" @click="yyStop"></view>
</view>
</view>
</PopManager>
<!-- 语音弹窗 -->
<!-- 地址 -->
<PopManager :show="locatShow" @clickmask="closeLocatShow" :type="type">
<view class="locatPop">
<view class="locatPopTitle"><span>所在位置</span></view>
<view class="button" @click="nochangeLocation" v-if="setInfo.set.locastatus != '2'">
<view class="buttonPackage">
<span>不显示位置</span>
<image :src="imgfixUrls + 'merchant/checked.svg'" v-if="info.locastatus == '0'" />
</view>
</view>
<view class="button" @click="changeLocation">
<view class="buttonPackage"><span>定位</span></view>
</view>
<view class="button" v-if="info.address_info !== ''" @click="changeLoca">
<view class="buttonPackage">
<span>{{ info.address_info }}</span>
<image :src="imgfixUrls + 'merchant/checked.svg'" v-if="info.locastatus == '1'" />
</view>
</view>
<view class="buttonFull"></view>
<view class="closeButton" @click="locatShow = false"><span>关闭</span></view>
</view>
</PopManager>
<!-- 地址 -->
<PhoneMask :show1="show1" @clickmask1="closePop1"></PhoneMask>
<getvxphone :show="vxshow" @showFalse="showFalse"></getvxphone>
<!-- #ifdef H5 -->
<PopManager :show="isOpenLaction" :type="'bottom'" :overlay="false" :showOverlay="false">
<view class="iframe-wid-hgt" :style="{ height: phoneHeight }" v-if="latlngs.latitude">
<iframe id="mapPage" width="100%" height="100%" frameborder="0" :src="`https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=KIQBZ-6OT3G-AOMQD-IHW6J-PEUDV-VCFAF&referer=myapp&coord=${latlngs.latitude},${latlngs.longitude}`"></iframe>
</view>
<view class="iframe-wid-hgt" :style="{ height: phoneHeight }" v-else>
<iframe id="mapPage" width="100%" height="100%" frameborder="0" :src="`https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=KIQBZ-6OT3G-AOMQD-IHW6J-PEUDV-VCFAF&referer=myapp`"></iframe>
</view>
</PopManager>
<!-- #endif -->
<view>
<follow
:followShow="followShow"
:followType="followType"
:followTitleShow="followTitleShow"
@clickmask="openQrShow"
@closeFollowPop="closeFollowPop"
@closeFollowTitle="closeFollowTitle"
:followData="followData"
></follow>
</view>
</view>
</block>
</template>
<script>
import App from '@/common/js/app.js';
import PopManager from '@/components/template/PopManager';
import Loadlogo from '@/components/template/loadlogo.vue';
import PhoneMask from '@/components/template/PhoneMask';
import getvxphone from '@/components/template/getVXphone.vue';
import follow from '@/components/template/follow.vue';
// #ifdef MP-WEIXIN
let plugin = requirePlugin("WechatSI")
let manager = plugin.getRecordRecognitionManager();
//#endif
// #ifdef H5
import wxApi from '@/common/js/wxApi.js';
// #endif
export default {
components: {
PopManager,
Loadlogo,
PhoneMask,
getvxphone,
follow
},
data() {
return {
show1: false,
HideDisabled: false, //控制帖子发布按钮的禁用状态
releaseType: 1,
phoneHeight: null,
isOpenLaction: false,
showmain: null,
marginT: {
marginTop: '20rpx'
},
latlngs:null,
info: {
content: '',
onetype: null,
// nickname: '',
// phone: '',
// share_title: '',
type: null,
keyword: [],
img: [],
locastatus: '',
address: '',
address_info: '',
lat: '',
lng: '',
video_img_link: '',
video_link: '',
id: ''
},
dwText: '不显示位置',
setInfo: {
set: {
locastatus: 0
}
},
locaStaus: null,
show: false,
type: 'bottom',
res: null,
text: null,
ysStatus: 0,
images: [],
src: '',
locatShow: false,
shi: '00',
fen: '00',
miao: 0,
h: 0,
m: 0,
s: 0,
ms: 0,
time: 0,
str: '00:00:00',
id: null,
isAndroid: '',
isAdclose: false,
vxshow:false,
followTitleShow: true,
followShow: false,
followType: '10',
followData:{
},
userInfo:{},
lblis:{}
};
},
computed: {
isWxaudit() {
return this.$store.state.isWxAudit
},
uploadnums(){
if(this.images.length<4){
return 6;
}else{
return (9 - this.images.length);
}
}
},
onShow() {
let _this = this;
//#ifdef APP-PLUS
if(_this.lblis.lat){
_this.info.address = _this.userInfo.address;
_this.info.address_info = _this.userInfo.address;
_this.info.locastatus = '1';
_this.info.lat = _this.userInfo.lat;
_this.info.lng = _this.userInfo.lng;
_this.dwText = _this.userInfo.address;
}
//#endif
// _this.init(_this.id);//选择定位会一直onshow
// let data = {
// id: _this.info.type
// };
// App._post_form('&p=pocket&do=preparation', data, res => {
// _this.setInfo = res.data;
// });
// _this.preparation();
},
onLoad(e) {
console.log(e, '2222')
let _this = this;
_this.dwText = _this.languageStatus !=1?'不显示位置':'위치 미공개';
uni.getSystemInfo({
success(res) {
_this.phoneHeight = res.windowHeight + 'px';
_this.isAndroid = res.platform === 'android' ? '1' : '2';
}
});
// #ifdef MP-WEIXIN
this.initRecord() //开启语音转文字插件
//#endif
// #ifdef H5
_this.latlngs = uni.getStorageSync('curLoction');
window.addEventListener(
'message',
function(event) {
// 接收位置信息用户选择确认位置点后选点组件会触发该事件回传用户的位置信息
let loc = event.data;
if (loc && loc.module == 'locationPicker') {
//防止其他应用也会向该页面post信息需判断module是否为'locationPicker'
console.log('location', loc);
_this.info.address = loc.poiaddress;
_this.info.locastatus = '1';
_this.info.lat = loc.latlng.lat;
_this.info.lng = loc.latlng.lng;
_this.dwText = loc.poiaddress;
_this.isOpenLaction = false;
_this.locatShow = false;
}
},
false
);
// #endif
this.info.onetype = e.onetype;
this.info.type = e.type;
_this.id = e.id;
console.info(e.id);
setTimeout(()=>{
// #ifdef H5
wxApi.wxRegister();
// #endif
},1000);
_this.init(_this.id);
},
mounted() {
// #ifdef H5
let _this = this;
let input = document.createElement('input');
console.info('input', input);
input.type = 'file';
input.id = 'fileInput';
// input.style.display = 'none'
_this.$refs.input.$el.appendChild(input);
input.onchange = event => {
let filesObj = event.target.files['0'];
var reader = new FileReader();
// 传入一个参数对象即可得到基于该参数对象的文本内容
reader.readAsDataURL(filesObj);
reader.onload = function(e) {
_this.uploadVideo(e.target.result);
};
//上传方法
};
// #endif
},
methods: {
closeFollowTitle() {
let _this = this;
_this.followTitleShow = false;
},
closeFollowPop() {
let _this = this;
_this.followShow = false;
},
openQrShow() {
let _this = this;
_this.followShow = true;
},
showFalse(){
console.log('进了showfalse')
this.vxshow = false;
},
closePop1() {
let _this = this;
_this.show1 = false;
},
changeLoca() {
let _this = this;
_this.dwText = _this.info.address_info;
_this.info.locastatus = '1';
_this.locatShow = false;
},
nochangeLocation() {
let _this = this;
(_this.info.locastatus = '0'), (_this.locatShow = false);
_this.dwText = _this.languageStatus !=1?'不显示位置':'위치 미공개';
},
init(id) {
let _this = this;
if (!!id) {
_this.getEditPocket(id);
_this.info.id = id;
console.info(_this.info.id);
} else {
_this.info.locastatus = 0;
_this.preparation();
}
},
// 打开地图弹窗
changeLocation() {
let _this = this;
// #ifdef MP-WEIXIN
uni.chooseLocation({
success: function(res) {
console.log(res, 11111)
_this.info.address = res.address;
_this.info.address_info = res.name;
_this.info.locastatus = '1';
_this.info.lat = res.latitude;
_this.info.lng = res.longitude;
_this.info.latitude = res.latitude;
_this.info.longitude = res.longitude;
// _this.dwText = res.address;
_this.dwText = res.name;
_this.locatShow = false;
}
});
// #endif
// #ifdef H5
_this.isOpenLaction = true;
// #endif
//#ifdef APP-PLUS
App.navigationTo({
url: 'pages/subPages2/map/index'
});
//#endif
},
// 关闭地址弹窗
closeLocatShow() {
let _this = this;
_this.locatShow = false;
},
// 获取帖子编辑信息
getEditPocket(id) {
let _this = this;
let data = {
id: id
};
App._post_form('&p=pocket&do=editPocket', data, res => {
_this.info = { ..._this.info,
...res.data
};
_this.src = res.data.video_url;
console.info(res.data.video_link);
_this.info.latitude = res.data.location.lat;//没有返回定位信息
_this.info.longitude = res.data.location.lng;
_this.info.lat = res.data.location.lat;
_this.info.lng = res.data.location.lng;
if(!_this.info.share_title || _this.info.share_title == 'null'){
// debugger
_this.info.share_title = '';
}
if (!!res.data.address && res.data.address != '') {
_this.dwText = res.data.address_info;
_this.info.address = res.data.address;
} else if (res.data.address == '') {
_this.dwText = _this.languageStatus !=1?'不显示位置':'위치 미공개';
}
if (!!res.data.img_url) {
let newInfoimage = [];
for (let i = 0; i < res.data.img_url.length; i++) {
_this.images.push(res.data.img_url[i]);
newInfoimage.push(res.data.img_url[i]);
}
_this.info.img = newInfoimage;
console.log(_this.info.img, '_this.info.img')
}
// _this.info.content = _this.info.content.replace(/\<br\/\>/g,"\n");
let data = {
id: _this.info.type
};
App._post_form('&p=pocket&do=preparation', data, res => {
_this.setInfo = res.data;
});
});
},
post(data){
console.log(data, '发布的内容');
let _this = this;
App._post_form(
'&p=pocket&do=release',
data,
res => {
if (res.data.status == 0) {
App.navigationTo({
url: 'pages/mainPages/successRelease/successRelease?id=' + res.data.id,
navType: 'rediRect'
});
} else {
let _this = this;
let data = {
id: res.data.id,
num: '',
payfor: 1
};
App._post_form('&p=pocket&do=createOrder', data, reson => {
console.log(reson, '000000')
if (reson.errno == 0) {
App.navigationTo({
url: 'pages/mainPages/payment/payment?orderid=' + reson.data.orderid + '&plugin=pocket&types=' + 1
});
}
_this.HideDisabled = false;
});
}
},
fail => {
_this.HideDisabled = false;
if (fail.data.message == '未绑定手机号') {
let _this = this;
//#ifdef H5
_this.show1 = true;
//#endif
//#ifndef H5
_this.vxshow = true;
//#endif
_this.releaseType = 1;
}
}
);
},
// 发布信息
release() {
if(this.info.video_img_link && !this.info.video_link){
uni.showToast({
title: '请上传视频',
icon: 'none'
})
return;
}
// if(!this.info.video_img_link && this.info.video_link){
// uni.showToast({
// title: '请上传视频封面图',
// icon: 'none'
// })
// return;
// }
if(!this.info.video_link && this.info.img.length==0){
uni.showToast({
title: '请选择上传图片或者视频',
icon: 'none'
})
return;
}
if(this.info.locastatus=='0'){
this.info.address = '';
this.info.address_info = '';
this.info.lat = '';
this.info.lng = '';
}
let _this = this;
let data = _this.info;
// data.content = _this.info.content.replace(/\n/g,"\<br\/\>").replace(/\r/g,"\<br\/\>")
// console.log(data, data.content, 222222222)
_this.HideDisabled = true;
// _this.releaseType = 0;
let datas = {
type:'12'
};
App._post_form('&do=follow',
datas
, ress => {
if (ress.data.status == 0) {
if(_this.setInfo.set.wxapptip == '1'){
//#ifndef H5
if(_this.setInfo.set.tempId){
uni.requestSubscribeMessage({ //订阅消息
tmplIds: [_this.setInfo.set.tempId],
success(res) {
console.log(res)
if(res[_this.setInfo.set.tempId] == 'accept'){
_this.post(data)
}
_this.HideDisabled = false;
},
fail(res){
_this.HideDisabled = false;
// debugger
}
})
}else{
_this.post(data)
}
//#endif
//#ifdef H5
_this.post(data)
//#endif
}else{
_this.post(data)
}
}else{
_this.followShow = true;
_this.HideDisabled = false;
_this.followData = ress.data;
}
})
},
// 删除视频
deletVideo() {
let _this = this;
_this.src = '';
_this.info.video_link = '';
_this.info.video_img_link = '';
_this.isAdclose = false;
_this.marginT.marginTop = '20rpx'
},
uoloadIgs(length, ids = 0, resImg) {
let _this = this;
wxApi.uoloadIg(resImg.localIds[ids], data => {
if (data.errMsg === 'uploadImage:ok') {
let requestData = {
upload_type: 2,
id: data.serverId
};
App._post_form(
'&do=uploadFiles',
requestData,
res => {
if (res.errno === 0) {
_this.images.push(res.data.img);
_this.info.img.push(res.data.img);
if (ids < length - 1) {
ids++;
uni.setTimeout(_this.uoloadIgs(length, ids, resImg), 500);
}
}
},
false,
() => {}
);
} else {
App.showError('上传失败');
}
});
},
// 文件上传接口
async uploadFiles(len, uploadType) {
let _this = this;
// #ifdef H5
if(App.getClientType() == 2){
let res = await App.browser_upload(len);
for (let i = 0; i < res.tempFilePaths.length; i++) {
let imageData = await App._upLoad(res.tempFilePaths[i]);
_this.images.push(imageData.data.img);
_this.info.img.push(imageData.data.img);
}
return
}
// debugger
wxApi.choseImage(res => {
wxApi.uoloadIg(res.localIds[0], data => {
if (data.errMsg === 'uploadImage:ok') {
uni.showLoading({});
let requestData = {
upload_type: 2,
id: data.serverId
};
let length = res.localIds.length;
let ids = 0;
let resImg = res;
App._post_form(
'&do=uploadFiles',
requestData,
res => {
if (res.errno === 0) {
_this.images.push(res.data.img);
_this.info.img.push(res.data.img);
if (ids < length - 1) {
ids++;
uni.setTimeout(_this.uoloadIgs(length, ids, resImg), 500);
}
}
},
false,
() => {
uni.hideLoading();
}
);
} else {
uni.hideLoading();
App.showError('上传失败');
}
});
},9);
// wxApi.choseImage(res => {
// console.log(res)
// let i = res.localIds.length;
// _this.uoloadIgs(i, 0, res);
// }, 6);
// #endif
// #ifndef H5
wx.chooseMedia({//基础库 2.10.0 开始支持
count: len,
mediaType: ['image'],
sourceType: ['album', 'camera'],
sizeType: ['original', 'compressed'],
success: async function(res) {
console.log(res)
for (let i = 0; i < res.tempFiles.length; i++) {
let imageData = await App._upLoad(res.tempFiles[i].tempFilePath);
console.log(imageData, 111)
if(imageData.data.img){
if(uploadType=='img'){
_this.images.push(imageData.data.img);
_this.info.img.push(imageData.data.img);
}else if(uploadType=='video'){
_this.info.video_img_link = imageData.data.img;
}
}else{
uni.showToast({
title:"上传失败",
icon:'none'
})
}
}
}
});
// #endif
},
upButton() {
let _this = this;
// #ifdef H5
if (_this.isAndroid === '2') {
return document.getElementById('fileInput').click();
} else {
_this.ChooseVdo();
}
// #endif
// #ifndef H5
_this.ChooseVdo();
// #endif
},
ChooseVdo() {
let _this = this;
uni.chooseVideo({
count: 1,
sourceType: ['camera', 'album'],
success: function(res) {
_this.info.video_link = res.tempFilePath;
console.info(res.tempFilePath);
let siteroot = null;
siteroot = App.siteInfo.siteroot + `${App.routers}`;
uni.showLoading();
uni.uploadFile({
url: App.api_root + '&do=uploadFiles', //仅为示例,非真实的接口地址
filePath: res.tempFilePath,
name: 'file',
formData: {
upload_type: 1,
is_base: 1
},
success: res => {
let data = JSON.parse(res.data),
base64 = new _this.$util.Base64();
console.info('data', data);
_this.marginT.marginTop = '380rpx'
if (data.errno === 0) {
_this.src = base64.decode(data.data.img);
_this.info.video_link = base64.decode(data.data.image);
_this.isAdclose = true;
} else {
App.showError(data.message, () => {});
}
uni.hideLoading();
},
fail: res => {
console.info('resInfofail', res);
_this.showmain = JSON.stringify(res);
uni.hideLoading();
}
});
}
});
},
resultPath(e) {
uni.showModal({
content: JSON.stringify(e)
});
},
// 选择视频
uploadVideo(file) {
let _this = this;
uni.showLoading();
uni.uploadFile({
url: App.api_root + '&do=uploadFiles', //仅为示例,非真实的接口地址
filePath: file,
name: 'file',
formData: {
upload_type: 1
},
success: res => {
let data = JSON.parse(res.data);
console.info('res', res);
_this.marginT.marginTop = '340rpx';
if (data.errno === 0) {
_this.src = data.data.img;
_this.info.video_link = data.data.image;
} else {
App.showError(data.message);
}
uni.hideLoading();
},
fail: res => {
uni.hideLoading();
}
});
},
// 开始录音
lyStar() {
let _this = this;
_this.s++;
if (_this.s >= 60) {
_this.s = 0;
_this.m = _this.m + 1; //分钟
}
if (_this.m >= 60) {
_this.m = 0;
_this.h = _this.h + 1; //小时
}
_this.str = _this.toDub(_this.h) + ':' + _this.toDub(_this.m) + ':' + _this.toDub(_this.s);
},
start() {
console.info('start');
let _this = this;
// #ifdef H5
wxApi.wxStartRecord();
// #endif
// #ifdef MP-WEIXIN
manager.start({
duration: 60000,
lang: "zh_CN"
});
// #endif
_this.ysStatus = 1;
//开始
_this.timer = setInterval(_this.lyStar, 1000);
},
initRecord: function() {
let _this = this;
manager.onStart = function(res) {
// _this.info.content ="onStart:"+ res.msg+"正在录音"
};
//有新的识别内容返回,则会调用此事件
manager.onRecognize = (res) => {
// debugger
// _this.info.content = res.result;
}
// 识别结束事件
manager.onStop = (res) => {
// debugger
_this.info.content = res.result;
}
// 识别错误事件
manager.onError = (res) => {
// debugger
// _this.info.content = res.msg;
}
},
toDub(n) {
//补0操作
if (n < 10) {
return '0' + n;
} else {
return '' + n;
}
},
yyStop() {
console.info('Stop');
let _this = this;
_this.ysStatus = 0;
_this.h = 0;
_this.m = 0;
_this.s = 0;
_this.str = '00:00:00';
clearInterval(_this.timer);
// #ifdef H5
wxApi.wxStopRecord(res => {
console.info('wxStopRecord');
wxApi.wxTranslateVoice(res, res1 => {
console.info('wxTranslateVoice');
if (res1 == undefined) {
uni.showToast({
icon: 'none',
title: '识别失败',
duration: 2000
});
} else {
_this.show = false;
_this.info.content = res1;
console.info('content', content);
}
});
});
// #endif
// #ifdef MP-WEIXIN
manager.stop()
//#endif
},
// 发布准备信息获取
preparation() {
let _this = this;
let data = {
id: _this.info.type
};
let client = App.getClientType();
App._post_form('&p=pocket&do=preparation', data, res => {
_this.setInfo = res.data;
_this.info.nickname = res.data.user.nickname;
_this.info.phone = res.data.user.mobile;
_this.locaStaus = Number(res.data.set.locastatus);
if (res.data.set.locastatus == '2') {
_this.info.locastatus = 1;
if (client === '1') {
wxApi.getLocation({
type: 'gcj02', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
success(res) {
(_this.info.lng = res.longitude), (_this.info.lat = res.latitude);
console.info('info', res.latitude, res.longitude);
let data1 = {
lat: res.latitude,
lng: res.longitude
};
App._post_form('&do=cityLocation', data1, res => {
console.info('cityLocation');
_this.info.address = res.data.address_component.city;
_this.dwText = res.data.address_component.city;
});
},
fail(res) {
uni.showToast({
icon: 'none',
title: '定位失败',
duration: 2000
});
},
complete(res) {
console.log(res);
}
});
} else if (client === '3') {
wx.getLocation({
type: 'gcj02',
success(res) {
(_this.info.lng = res.longitude), (_this.info.lat = res.latitude);
console.info('info', res.latitude, res.longitude);
let data1 = {
lat: res.latitude,
lng: res.longitude
};
App._post_form('&do=cityLocation', data1, res => {
console.info('cityLocation');
_this.info.address = res.data.address_component.city;
_this.dwText = res.data.address_component.city;
});
},
fail(res) {
uni.showToast({
icon: 'none',
title: '定位失败',
duration: 2000
});
}
});
} else {
uni.getLocation({
type: 'gcj02',
success: function(res) {
(_this.info.lng = res.longitude), (_this.info.lat = res.latitude);
let data1 = {
lat: res.latitude,
lng: res.longitude
};
App._post_form('&do=cityLocation', data1, res => {
console.info('cityLocation');
_this.info.address = res.data.address_component.city;
_this.dwText = res.data.address_component.city;
});
},
fail: function(res) {
uni.showToast({
icon: 'none',
title: '定位失败',
duration: 2000
});
}
});
}
}
});
},
// 选择标签
checkSecondsType(item) {
let _this = this;
if (_this.info.keyword.indexOf(item) == -1) {
_this.info.keyword.push(item);
} else {
for (let i = 0; i < _this.info.keyword.length; i++) {
if (_this.info.keyword[i] == item) {
_this.info.keyword.splice(i, 1);
}
}
}
console.info(_this.info.keyword);
},
// 关闭语音弹窗
closePop() {
let _this = this;
_this.show = false;
},
// 删除图片
deletImg(item, deleteType) {
let _this = this;
if(deleteType == 'img'){
for (let i = 0; i < _this.images.length; i++) {
if (_this.images[i] == item) {
_this.images.splice(i, 1);
}
}
for (let i = 0; i < _this.info.img.length; i++) {
if (_this.info.img[i] == item) {
_this.info.img.splice(i, 1);
}
}
}else if(deleteType == 'video'){
_this.info.video_img_link = '';
}
},
textEnter(e){
console.log(e)
}
}
};
</script>
<style lang="less" scoped>
/* #ifdef H5 */
#fileInput {
width: 20upx !important;
height: 20upx !important;
}
/* #endif */
.upText {
font-size: 22upx;
color: rgba(51, 51, 51, 1);
}
.main_input {
font-size: 24upx;
color: rgba(204, 204, 204, 1);
}
.closeButton {
height: 85upx;
width: 750upx;
text-align: center;
>span {
line-height: 85upx;
font-size: 28upx;
font-weight: bold;
color: rgba(51, 51, 51, 1);
}
}
.locatPopTitle {
height: 140upx;
text-align: center;
>span {
line-height: 140upx;
font-size: 30upx;
font-weight: bold;
color: rgba(51, 51, 51, 1);
}
}
.buttonFull {
width: 750upx;
height: 20upx;
background: rgba(248, 248, 248, 1);
}
.buttonPackage {
display: flex;
justify-content: space-between;
padding: 40upx 30upx;
border-bottom: 1upx solid rgba(238, 238, 238, 1);
>span {
vertical-align: middle;
font-size: 28upx;
font-weight: bold;
color: rgba(51, 51, 51, 1);
}
>image {
vertical-align: middle;
width: 28upx;
height: 28upx;
}
}
.locatPop {
width: 750upx;
background: rgba(255, 255, 255, 1);
border-radius: 20px 20px 0px 0px;
}
.closeImg {
width: 40upx;
height: 40upx;
float: right;
position: relative;
z-index: 999;
}
.adcloseImg {
width: 40upx;
height: 40upx;
}
.upLoadImg {
text-align: center;
>view {
>image {
width: 48upx;
height: 48upx;
margin: 30upx 0upx 0upx 0upx;
}
}
}
.upLoadVideo {
text-align: center;
>view {
>image {
width: 48upx;
height: 48upx;
margin: 30upx 0upx 0upx 0upx;
}
}
}
.zsView {
vertical-align: middle !important;
display: inline-block !important;
width: 134upx !important;
height: 133upx !important;
border-radius: 10upx !important;
overflow: hidden !important;
border: none !important;
>image:nth-child(1) {
width: 134upx !important;
height: 133upx !important;
}
>image:nth-child(2) {
left: 100upx;
position: relative;
bottom: 130upx;
width: 34upx;
height: 34upx;
border-radius: 50%;
}
}
.yyStopButton {
border-radius: 10upx;
margin: 35upx auto 0 auto;
width: 110upx;
height: 110upx;
background: rgba(20, 220, 213, 1);
}
.yyButton {
margin: 15upx auto 0 auto;
width: 150upx;
height: 150upx;
border-radius: 50%;
background: linear-gradient(0deg, rgba(255, 68, 68, 1) 0%, rgba(255, 133, 67, 1) 100%);
}
.yyButtonPackage {
margin: 30upx auto 0 auto;
width: 180upx;
height: 180upx;
border-radius: 50%;
border: 1upx solid gray;
}
.yyView {
border: 1upx solid rgba(0, 0, 0, 0);
width: 750upx;
height: 400upx;
background: #ffffff;
>view:nth-child(1) {
margin: 80upx 0 0 0;
text-align: center;
>span {
font-size: 24upx;
color: rgba(153, 153, 153, 1);
}
}
}
.checked {
width: 130upx !important;
height: 54upx !important;
background: rgba(255, 68, 68, 1) !important;
border-radius: 27upx !important;
text-align: center !important;
>span {
font-size: 24upx !important;
font-weight: 500 !important;
color: rgba(255, 255, 255, 1) !important;
}
}
.full {
height: 30upx;
}
.fbButton {
margin: 20upx auto 0 auto;
width: 690upx;
height: 83upx;
background: rgba(255, 68, 68, 1);
border-radius: 42upx;
text-align: center;
padding: 0;
position: relative;
display: block;
box-sizing: border-box;
font-size: 35upx;
text-decoration: none;
line-height: 2.55555556;
-webkit-tap-highlight-color: transparent;
overflow: hidden;
>span {
line-height: 83upx;
font-size: 28upx;
color: rgba(255, 255, 255, 1);
}
}
.dvview{
margin: 20upx auto 0 auto;
padding: 0 30upx;
// width: 630upx;
border-radius: 10upx;
// background-color: #ffffff;
}
.dwView {
margin: 20upx auto 0 auto;
width: 690upx;
background: rgba(255, 255, 255, 1);
border-radius: 10upx;
display: flex;
justify-content: space-between;
>span {
margin: 30upx;
vertical-align: middle;
font-size: 28upx;
font-weight: bold;
color: rgba(51, 51, 51, 1);
}
>image {
margin: 40upx 30upx 0 0;
vertical-align: middle;
height: 20upx;
width: 20upx;
}
}
.inputView {
margin: 20upx 0 0 0;
width: 630upx;
height: 80upx;
background: rgba(248, 248, 248, 1);
border-radius: 10upx;
>span {
margin-left: 30upx;
vertical-align: middle;
text-align: right;
display: inline-block;
width: 96upx;
font-size: 24upx;
color: rgba(51, 51, 51, 1);
}
>input {
padding-left: 30upx;
vertical-align: middle;
height: 80upx;
display: inline-block;
width: 400upx;
font-size: 24upx;
color: rgba(51, 51, 51, 1);
}
}
.userInput {
margin: 10upx 0 0 0;
}
.userInfoInputTitle {
font-size: 28upx;
font-weight: bold;
color: rgba(51, 51, 51, 1);
}
.userInfoInputPackage {
padding: 30upx;
}
.userInfoInput {
margin: 20upx auto 0 auto;
width: 690upx;
background: rgba(255, 255, 255, 1);
border-radius: 10upx;
}
.checkTips {
margin-top: 10upx;
>view {
margin: 20upx 20upx 0 0;
display: inline-block;
width: 130upx;
height: 54upx;
border: 1upx solid rgba(238, 238, 238, 1);
border-radius: 27upx;
text-align: center;
>span {
line-height: 54upx;
font-size: 24upx;
color: rgba(51, 51, 51, 1);
}
}
}
.Zsvideo-main{
// position: relative;
}
.zsVideo {
background: red;
margin-top: 20upx;
width: 630upx;
height: 355upx;
border-radius: 10upx;
// position: absolute;
z-index: 10;
}
.upLoadFile {
margin: 20upx 0 0 0;
>view {
margin-top: 10upx;
vertical-align: middle;
margin-right: 20upx;
display: inline-block;
width: 134upx;
height: 134upx;
background: rgba(251, 251, 251, 1);
border: 1upx dashed rgba(204, 204, 204, 1);
border-radius: 10upx;
}
}
.postImgTips {
margin: 40upx 0 0 0;
>span {
font-size: 24upx;
color: rgba(51, 51, 51, 1);
>span {
color: #999999;
}
}
}
.postMainInputTitle {
display: flex;
justify-content: space-between;
>span {
font-size: 24upx;
color: rgba(51, 51, 51, 1);
}
>view {
display: inline-block;
>image {
vertical-align: middle;
height: 30upx;
width: 30upx;
}
>span {
margin-left: 5upx;
vertical-align: middle;
font-size: 24upx;
color: rgba(255, 68, 68, 1);
}
}
}
.postMainInputPackage {
padding: 30upx;
overflow: hidden;
>textarea {
width: 570upx !important;
height: 170upx !important;
margin-top: 35upx;
font-size: 24upx;
color: rgba(51, 51, 51, 1);
}
}
.postMainInput {
width: 630upx;
background: rgba(248, 248, 248, 1);
border-radius: 10upx;
}
.postInfoInput {
margin: 20upx auto 0 auto;
width: 690upx;
background: rgba(255, 255, 255, 1);
border-radius: 10upx;
}
.postInfoInputPackage {
padding: 30upx;
}
page {
background: #f8f8f8;
overflow-x: hidden;
}
.postRelease {
background: #f8f8f8;
font-size: 0;
border: 1upx solid rgba(0, 0, 0, 0);
}
.iframe-wid-hgt {
width: 100vw;
}
</style>