作者 赵云辉

ios支付未修改完成

... ... @@ -17,19 +17,16 @@
},
methods: {
onReadyStateUpdate({name}) {
const isSDKReady = name === this.$TIM.EVENT.SDK_READY ? true : false;
//自动监听并更新 sdk 的ready 状态 (未登录是 notReady 登录后是ready)
this.$store.commit("toggleIsSDKReady", isSDKReady);
//sdk ready 后 肯定完成了登录操作 这里可以获取用户存储在im的基础信息/离线消息/黑名单列表
},
onReceiveMessage({data: messageList}) {
// this.handleAt(messageList);
this.$store.commit("pushCurrentMessageList", messageList);
},
//根据消息列表请求聊天对象的用户信息 并完成数据拼接
},
onLaunch: function() {
// #ifdef APP-PLUS
... ...
<template>
<view class="htz-image-upload-list">
<view class="htz-image-upload-Item" v-if="uploadType == 'image'" v-for="(item,index) in uploadLists" :key="index">
<u-line-progress v-if="ifvideo" :striped="true" :striped-active="true" active-color="#19BE6B" height="16" :percent="percent"></u-line-progress>
<view class="htz-image-upload-Item" v-if="uploadType == 'image'" v-for="(item,index) in uploadLists"
:key="index">
<image :src="imgUrl + item" @click="imgPreview(index)"></image>
<view class="htz-image-upload-Item-del" v-if="remove" @click="imgDel(index)">×</view>
</view>
<view class="htz-image-upload-video" v-if="uploadType == 'video'" v-for="(item,index) in uploadLists" :key="index">
<video :id="'video_'+index" :src="imgUrl + item" :data-index="index" :controls="true" :enable-play-gesture="true" objectFit="contain"></video>
<view class="htz-image-upload-video" v-if="uploadType == 'video'" v-for="(item,index) in uploadLists"
:key="index">
<video :id="'video_'+index" :src="imgUrl + item" :data-index="index" :controls="true"
:enable-play-gesture="true" objectFit="contain"></video>
<view class="delBtn">
<view class="btn" @click="videoDel(index)">
删除
... ... @@ -61,9 +65,9 @@
imagesEdit: { //受控图片列表
type: Array
},
videoEdit:{
type:String,
default:''
videoEdit: {
type: String,
default: ''
},
uploadSuccess: {
default: (res) => {
... ... @@ -73,28 +77,31 @@
}
},
},
pgType:{
type:String,
default:''
pgType: {
type: String,
default: ''
}
},
data() {
return {
uploadType:'',
ifvideo:false,
percent:0,
uploadType: '',
uploadLists: [],
imgUrl:this.imgUrl,
max:1
imgUrl: this.imgUrl,
max: 1
}
},
mounted() {
console.log(this.imagesEdit,this.videoEdit)
if(this.imagesEdit.length > 0){
console.log(this.imagesEdit, this.videoEdit)
if (this.imagesEdit.length > 0) {
this.uploadType = 'image'
this.max = 9
this.uploadLists = this.imagesEdit;
}
if(this.videoEdit != ''){
if (this.videoEdit != '') {
this.uploadType = 'video'
this.uploadLists.push(this.videoEdit);
}
},
... ... @@ -117,40 +124,47 @@
content: '您确定要删除么?',
success: (res) => {
if (res.confirm) {
let delUrl=this.uploadLists[index]
let delUrl = this.uploadLists[index]
this.uploadLists.splice(index, 1)
this.$emit("changeImage", this.uploadLists);
} else if (res.cancel) {}
}
});
},
videoDel(index){
videoDel(index) {
uni.showModal({
title: '提示',
content: '您确定要删除么?',
success: (res) => {
if (res.confirm) {
this.uploadLists.splice(index, 1)
this.$emit("changeVideo", this.uploadLists);
this.percent = 0
this.ifvideo = false
} else if (res.cancel) {}
}
});
},
imgPreview(index) {
let imgPreview = []
this.uploadLists.forEach((item)=>{
this.uploadLists.forEach((item) => {
imgPreview.push(this.imgUrl + item)
})
uni.previewImage({
urls: imgPreview,
current:index,
loop:true
current: index,
loop: true
});
},
imgAdd() {
// 视频上传中不允许触发第二次
if(this.ifvideo) {
return
}
let nowNum
let thisNum
if(this.pgType == '' && (this.uploadType == '' || this.uploadLists.length == 0)){
if (this.pgType == '' && (this.uploadType == '' || this.uploadLists.length == 0)) {
uni.showActionSheet({
itemList: ['选择图片', '选择视频'],
success: (res) => {
... ... @@ -159,33 +173,36 @@
this.max = 9
nowNum = Math.abs(this.uploadLists.length - this.max);
thisNum = (this.chooseNum > nowNum ? nowNum : this.chooseNum) //可选数量
this.$emit('changeType',1)
this.$emit('changeType', 1)
this.chooseImage(thisNum)
this.ifvideo = false
} else if (res.tapIndex == 1) {
this.uploadType = 'video'
this.max = 1
this.$emit('changeType',2)
this.chooseVideo(thisNum)
this.$emit('changeType', 2)
// this.chooseVideo(thisNum)
this.ifvideo = true
}
},
fail: (res) => {
console.log(res.errMsg);
this.ifvideo = false
}
});
}else if(this.pgType == 'uploadImg' || this.uploadType == 'image'){
} else if (this.pgType == 'uploadImg' || this.uploadType == 'image') {
this.max = 9
nowNum = Math.abs(this.uploadLists.length - this.max);
thisNum = (this.chooseNum > nowNum ? nowNum : this.chooseNum) //可选数量
this.uploadType = 'image'
this.chooseImage(thisNum)
}else{
} else {
this.chooseVideo(thisNum)
}
},
chooseVideo(thisNum){
chooseVideo(thisNum) {
uni.chooseVideo({
count: thisNum,
compressed:false,
compressed: false,
sourceType: ['camera', 'album'],
success: (res) => {
/* if(res.size/(1024*1024) > 100){
... ... @@ -195,83 +212,93 @@
})
return
}else{ */
uni.showLoading({
title:'上传中...'
})
let filePath = res.tempFilePath
console.log(filePath)
console.log(filePath.lastIndexOf('.'))
console.log(filePath.length)
console.log(filePath.substr(filePath.lastIndexOf('.'),filePath.length))
// #ifdef APP-PLUS
let suffix = filePath.substr(filePath.lastIndexOf('.'),filePath.length)
// #endif
// #ifndef APP-PLUS
let suffix = res.name.substr(res.name.lastIndexOf('.'),res.name.length)
// #endif
//获取七牛云token
uni.request({
url:this.apiUrl + '/common/getQiniuToken',
method:'POST',
success: (qiniuRet) => {
uni.uploadFile({
url: 'https://up-z2.qiniup.com',
filePath: filePath,
name: 'file',
formData: {
'key' : qiniuRet.data.data.key+suffix,
'token' : qiniuRet.data.data.token
},
success: (uploadFileRes) => {
console.log('上传七牛云结果',JSON.parse(uploadFileRes.data))
uni.hideLoading()
this.uploadLists.push('/'+JSON.parse(uploadFileRes.data).key)
this.$emit("changeVideo", this.uploadLists);
},
fail: (err) => {
uni.hideLoading()
uni.showToast({
title:"上传七云牛错误",
icon:'none'
})
console.log('上传七牛云报错',err)
}
})
}
})
/* let filePath = res.tempFilePath
uni.uploadFile({
url: this.apiUrl + '/common/upload', //仅为示例,非真实的接口地址
filePath: filePath,
timeout: 300000,
header: {
'token': uni.getStorageSync('token')
},
name: 'file',
formData: {
'user': 'test'
},
success: (uploadFileRes) => {
uni.hideLoading()
console.log('上传文件',JSON.parse(uploadFileRes.data));
if(JSON.parse(uploadFileRes.data).code == 1){
this.uploadLists.push(JSON.parse(uploadFileRes.data).data.url)
// uni.showLoading({
// title:'上传中...'
// })
let filePath = res.tempFilePath
console.log(filePath)
console.log(filePath.lastIndexOf('.'))
console.log(filePath.length)
console.log(filePath.substr(filePath.lastIndexOf('.'), filePath.length))
// #ifdef APP-PLUS
let suffix = filePath.substr(filePath.lastIndexOf('.'), filePath.length)
// #endif
// #ifndef APP-PLUS
let suffix = res.name.substr(res.name.lastIndexOf('.'), res.name.length)
// #endif
//获取七牛云token
uni.request({
url: this.apiUrl + '/common/getQiniuToken',
method: 'POST',
success: (qiniuRet) => {
const uploadTask = uni.uploadFile({
url: 'https://up-z2.qiniup.com',
filePath: filePath,
name: 'file',
formData: {
'key': qiniuRet.data.data.key + suffix,
'token': qiniuRet.data.data.token
},
success: (uploadFileRes) => {
console.log('上传七牛云结果', JSON.parse(uploadFileRes
.data))
uni.hideLoading()
this.uploadLists.push('/' + JSON.parse(
uploadFileRes.data).key)
this.$emit("changeVideo", this.uploadLists);
}else{
},
fail: (err) => {
uni.hideLoading()
uni.showToast({
title:JSON.parse(uploadFileRes.data).msg,
icon:'none'
title: "上传七云牛错误",
icon: 'none'
})
console.log('上传七牛云报错', err)
}
});
uploadTask.onProgressUpdate((res)=> {
this.percent = res.progress;
// console.log('上传进度' + res.progress);
// console.log('已经上传的数据长度' + res.totalBytesSent);
// console.log('预期需要上传的数据总长度' + res.totalBytesExpectedToSend);
});
},
})
/* let filePath = res.tempFilePath
uni.uploadFile({
url: this.apiUrl + '/common/upload', //仅为示例,非真实的接口地址
filePath: filePath,
timeout: 300000,
header: {
'token': uni.getStorageSync('token')
},
name: 'file',
formData: {
'user': 'test'
},
success: (uploadFileRes) => {
uni.hideLoading()
console.log('上传文件',JSON.parse(uploadFileRes.data));
if(JSON.parse(uploadFileRes.data).code == 1){
this.uploadLists.push(JSON.parse(uploadFileRes.data).data.url)
this.$emit("changeVideo", this.uploadLists);
}else{
uni.showToast({
title:JSON.parse(uploadFileRes.data).msg,
icon:'none'
})
}
}); */
}
}); */
// }
},
})
},
chooseImage(thisNum){
chooseImage(thisNum) {
// #ifdef APP-PLUS
if (this.sourceType.length > 1) {
uni.showActionSheet({
... ... @@ -291,7 +318,7 @@
if (this.sourceType.length == 1 && this.sourceType.indexOf('album') > -1) {
this.appGallery(thisNum);
}
if (this.sourceType.length == 1 && this.sourceType.indexOf('camera') > -1) {
this.appCamera();
}
... ... @@ -322,11 +349,11 @@
var res = cmr.supportedImageResolutions[0];
var fmt = cmr.supportedImageFormats[0];
//console.log("Resolution: " + res + ", Format: " + fmt);
cmr.captureImage((path)=> {
cmr.captureImage((path) => {
//alert("Capture image success: " + path);
this.chooseSuccessMethod([path])
},
(error) =>{
(error) => {
//alert("Capture image failed: " + error.message);
console.log("Capture image failed: " + error.message)
}, {
... ... @@ -417,14 +444,15 @@
'token': uni.getStorageSync('token')
},
success: (uploadFileRes) => {
console.log('上传图片',uploadFileRes)
if(JSON.parse(uploadFileRes.data).code == 1){
this.uploadLists.push(JSON.parse(uploadFileRes.data).data.url)
console.log('上传图片', uploadFileRes)
if (JSON.parse(uploadFileRes.data).code == 1) {
this.uploadLists.push(JSON.parse(uploadFileRes.data)
.data.url)
this.$emit("changeImage", this.uploadLists);
}else{
} else {
uni.showToast({
title:JSON.parse(uploadFileRes.data).msg,
icon:'none'
title: JSON.parse(uploadFileRes.data).msg,
icon: 'none'
})
}
resolve(uploadFileRes);
... ... @@ -506,21 +534,23 @@
height: 100%;
border-radius: 10rpx;
}
.htz-image-upload-video{
.htz-image-upload-video {
width: 750rpx;
height: 450rpx;
}
.htz-image-upload-video video {
width: 100%;
height: 400rpx;
}
.delBtn{
.delBtn {
display: flex;
justify-content: center;
}
.delBtn .btn{
.delBtn .btn {
font-size: 28rpx;
text-align: center;
background: #f5222d;
... ...
... ... @@ -81,6 +81,7 @@
'token': uni.getStorageSync('token')
},
success: (res) => {
console.log(res.data.data)
this.wallet = res.data.data
}
})
... ...
... ... @@ -13,8 +13,8 @@ Vue.config.productionTip = false
Vue.prototype.check=check;
Vue.prototype.apiUrl="http://app.zhaodizhu.cn/api"
// Vue.prototype.apiUrl="http://landlord.t.brotop.cn/api"
Vue.prototype.imgUrl="http://qiniu.zhaodizhu.cn"
// Vue.prototype.apiUrl="http://landlord.t.brotop.cn/api" // 测试环境
Vue.prototype.imgUrl="http://qiniu.zhaodizhu.cn"
Vue.prototype.tim = tim.tim //tim sdk 引入后生成的tim服务
Vue.prototype.$TIM = TIM //tim 的状态/事件 常量
Vue.prototype.$commen = commen
... ...
{
"name" : "问野",
"appid" : "__UNI__AE869D6",
"appid" : "__UNI__6108A26",
"description" : "问野",
"versionName" : "1.6",
"versionCode" : 109,
... ... @@ -15,7 +15,7 @@
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : false,
"waiting" : false,
"waiting" : true,
"autoclose" : false,
"delay" : 0
},
... ... @@ -104,7 +104,8 @@
},
"alipay" : {
"__platform__" : [ "ios", "android" ]
}
},
"appleiap" : {}
},
"geolocation" : {
"amap" : {
... ... @@ -136,7 +137,7 @@
"xxxhdpi" : "unpackage/res/icons/192x192.png"
},
"ios" : {
"appstore" : "D:/MyWork/1.20210220找地主app-梅姐、培杰/wenye_ios_icon.png",
"appstore" : "C:/Users/26612/Desktop/1.20210220找地主app-梅姐、培杰/wenye_ios_icon.png",
"ipad" : {
"app" : "unpackage/res/icons/76x76.png",
"app@2x" : "unpackage/res/icons/152x152.png",
... ... @@ -163,9 +164,9 @@
"splashscreen" : {
"androidStyle" : "default",
"android" : {
"hdpi" : "D:/MyWork/1.20210220找地主app-梅姐、培杰/启动页480_762.png",
"xhdpi" : "D:/MyWork/1.20210220找地主app-梅姐、培杰/启动页720_1242.png",
"xxhdpi" : "D:/MyWork/1.20210220找地主app-梅姐、培杰/启动页1080_1882.png"
"hdpi" : "C:/Users/26612/Desktop/1.20210220找地主app-梅姐、培杰/启动页480_762.png",
"xhdpi" : "C:/Users/26612/Desktop/1.20210220找地主app-梅姐、培杰/启动页720_1242.png",
"xxhdpi" : "C:/Users/26612/Desktop/1.20210220找地主app-梅姐、培杰/启动页1080_1882.png"
},
"iosStyle" : "common"
}
... ...
... ... @@ -180,7 +180,7 @@
keyword:'',
type:'',//类型:1=最新(报名中)2=往期(报名结束)3=推荐
page:1,
per_page:50,
per_page:20,
sort:'0',//排序:0=最新,1=最热 默认为0
article_cate_id:'',
province:'',
... ... @@ -200,23 +200,32 @@
...mapState(["userinfo","articleList"])
},
onLoad(){
console.log('onLoad',1)
uni.setStorageSync('refreshFindWonderful',false)
this.param.page = 1
this.last_page = 0
this.current_page = 1
this.list = []
this.showWaterFalls = false
this.showWaterFalls = true
this.getData()
console.log('onLoad',2)
console.log('this.showWaterFalls',this.showWaterFalls)
},
onShow(){
console.log('onShow',1)
console.log('onShow',uni.getStorageSync('refreshFindWonderful'))
if(uni.getStorageSync('refreshFindWonderful')){
console.log('onShow',2)
uni.setStorageSync('refreshFindWonderful',false)
this.param.page = 1
this.last_page = 0
this.current_page = 1
this.list = []
this.showWaterFalls = false
console.log('onShow',3)
this.getData()
console.log('onShow',4)
console.log('this.showWaterFalls',this.showWaterFalls)
}
},
onPullDownRefresh(){
... ... @@ -244,6 +253,7 @@
},
methods: {
getData(){
console.log('getData',this.tabIndex)
if(this.tabIndex == 0){
this.listType == 'findPlay'
//获取用户信息
... ... @@ -258,6 +268,7 @@
this.list = this.list.concat(res.data.data)
this.$store.commit('setArticleList',this.list)
this.showWaterFalls = true
console.log(111111111111111111111111111111)
})
}else{
this.$request('/article/followUserList',this.param).then((res)=>{
... ... @@ -266,6 +277,7 @@
this.list = this.list.concat(res.data.data)
this.$store.commit('setArticleList',this.list)
this.showWaterFalls = true
console.log(111111111111111111111111111111)
})
}
})
... ... @@ -328,9 +340,11 @@
this.last_page = res.data.data.last_page
this.current_page = res.data.data.current_page
this.list = this.list.concat(res.data.data.data)
// console.log(this.list)
this.$store.commit('setArticleList',this.list)
this.showWaterFalls = true
uni.hideLoading()
console.log('this.showWaterFalls',this.showWaterFalls)
}
})
},
... ... @@ -416,7 +430,7 @@
this.getArticleLis()
}
this.getData()
},
search(){
... ... @@ -431,7 +445,7 @@
this.param.page = 1
this.last_page = 0
this.current_page = 1
this.list = []
this.list = []
this.showWaterFalls = false
// 类型:1=最新(报名中)2=往期(报名结束)3=推荐
this.otherTabIndex = otherTabIndex
... ... @@ -449,7 +463,7 @@
this.list = []
this.param.page = 1
this.param.keyword = ''
this.param.city = '',
this.param.city = '',
this.param.county = '',
this.tabIndex = tabIndex
if(tabIndex == 1 || tabIndex == 0){
... ...
... ... @@ -53,7 +53,8 @@
<view class="gzBtn" @click="follow">
{{articleInfo.is_follow_user == 1 ? '已关注' : '关注'}}
</view>
<view class="lwBtn" @click="showSendGift = true" v-if="plat == 'android' || (plat == 'ios' && switchTab == '1')">
<!-- <view class="lwBtn" @click="showSendGift = true" v-if="plat == 'android' || (plat == 'ios' && switchTab == '1')"> -->
<view class="lwBtn" @click="showSendGift = true" v-if="plat == 'android' || plat == 'ios'">
送礼物
</view>
</view>
... ...
<template>
<list :pagingEnabled="true" :scroll-top="scrollTop" :scrollable="scrollable"class="zhi_index04" :offset-accuracy="videoStyle.height" :show-scrollbar="false" ref="list" :loadmoreoffset="loadMoreHeight" @scroll="Scroll">
<cell style="position:relative;" :style="videoStyle" v-for="(l,i) in lie" :key='i' @disappear="Disappear($event,i)" @appear="onappear">
<div class="page" :style="{ height: height }">
<list :pagingEnabled="true" :scroll-top="scrollTop" :scrollable="scrollable" class="zhi_index04"
:offset-accuracy="videoStyle.height" :show-scrollbar="false" ref="list" :loadmoreoffset="loadMoreHeight"
@scroll="Scroll">
<cell style="position:relative;" :style="videoStyle" v-for="(l,i) in lie" :key='i'
@disappear="Disappear($event,i)" @appear="onappear">
<template v-if="nowId==l.id">
<video @click="closeAllAlert(l.id)" :style="videoStyle" @play='play' @pause="pause" @timeupdate="Timeupdate" :id="`video_${l.id}`" :ref="`video_${l.id}`" :loop="true" :src="'http://qiniu.w.zhaodizhu.cn'+l.video" controls="false" :enable-progress-gesture="false" :show-center-play-btn="false" />
<video @click="closeAllAlert(l.id)" :style="videoStyle" @play='play' @pause="pause"
@timeupdate="Timeupdate" :id="`video_${l.id}`" :ref="`video_${l.id}`" :loop="true"
:src="'http://qiniu.w.zhaodizhu.cn'+l.video" controls="false" :enable-progress-gesture="false"
:show-center-play-btn="false" />
<!-- 导航栏区域 -->
<div class="navBarWrap" :style="{top:statusBarHeight}">
<image @click="back" src="../../static/image/back_white.png" style="width: 40rpx;height: 40rpx;" mode=""></image>
<image @click="showMoreHandle = !showMoreHandle" src="../../static/image/gengduo.png" style="width: 40rpx;height: 40rpx;" mode=""></image>
<image @click="back" src="../../static/image/back_white.png" style="width: 40rpx;height: 40rpx;"
mode=""></image>
<image @click="showMoreHandle = !showMoreHandle" src="../../static/image/gengduo.png"
style="width: 40rpx;height: 40rpx;" mode=""></image>
</div>
<div class="moreHandleWrap" v-if="showMoreHandle" :style="{height:l.user.id != userinfo.id ? '72rpx' : '144rpx'}">
<div class="moreHandleWrap" v-if="showMoreHandle"
:style="{height:l.user.id != userinfo.id ? '72rpx' : '144rpx'}">
<!-- <div class="handleItem" @click="showShare = true">
<image style="width: 32rpx;height: 32rpx;margin-right: 16rpx;" src="../../static/image/fenxiang-22_1@2x.png" mode=""></image>
<text style="color: #35655f;font-size: 28rpx;">转发</text>
</div> -->
<div class="handleItem" @click="report">
<image style="width: 32rpx;height: 32rpx;margin-right: 16rpx;" src="../../static/image/jubao-9_1@2x.png" mode=""></image>
<text style="color: #35655f;font-size: 28rpx;">{{l.user.id != userinfo.id ? '举报' : '编辑'}}</text>
<image style="width: 32rpx;height: 32rpx;margin-right: 16rpx;"
src="../../static/image/jubao-9_1@2x.png" mode=""></image>
<text
style="color: #35655f;font-size: 28rpx;">{{l.user.id != userinfo.id ? '举报' : '编辑'}}</text>
</div>
<div class="handleItem" @click="delAct" v-if="l.user.id == userinfo.id">
<image style="width: 32rpx;height: 32rpx;margin-right: 16rpx;" src="../../static/image/shanchu-9_1.png" mode=""></image>
<image style="width: 32rpx;height: 32rpx;margin-right: 16rpx;"
src="../../static/image/shanchu-9_1.png" mode=""></image>
<text style="color: #35655f;font-size: 28rpx;">删除</text>
</div>
</div>
<div v-if="playIconStatus" style="position: fixed;top: 0;bottom: 0;left: 0;right: 0;flex-direction: row;justify-content: center;align-items: center;z-index:1;">
<div v-if="playIconStatus"
style="position: fixed;top: 0;bottom: 0;left: 0;right: 0;flex-direction: row;justify-content: center;align-items: center;z-index:1;">
<image src="../../static/image/bofang.png" style="width: 64rpx;height: 64rpx;" mode=""></image>
</div>
<!-- 用户信息区域 -->
<div class="userInfoWrap" :style="{bottom:expandStatus ? '400rpx' : '200rpx'}">
<div class="userInfoLeft">
<div class="userIcon" @click="goMainPage(l.user.id)">
<image :src="l.user.avatar" style="width: 93rpx;height: 93rpx;border-radius: 20rpx 0 20rpx 0;" mode="aspectFill"></image>
<image :src="l.user.avatar"
style="width: 93rpx;height: 93rpx;border-radius: 20rpx 0 20rpx 0;"
mode="aspectFill">
</image>
</div>
<div class="userNameAddress">
<div class="userName">
<text style="font-size: 32rpx;color: #fff;">{{l.user.nickname}}</text>
</div>
<div class="userAddress" v-if="l.area != ''">
<image src="../../static/image/weizhi.png" style="width: 26rpx;height: 26rpx;" mode=""></image>
<text style="color: rgba(255,255,255,0.80);font-size: 24rpx;padding-top: 8rpx;">{{l.area}}</text>
<image src="../../static/image/weizhi.png" style="width: 26rpx;height: 26rpx;"
mode="">
</image>
<text
style="color: rgba(255,255,255,0.80);font-size: 24rpx;padding-top: 8rpx;">{{l.area}}</text>
</div>
</div>
</div>
... ... @@ -45,7 +66,8 @@
<div class="gzBtn" @click="follow(l.user.id)">
<text class="btnTxt">{{articleInfo.is_follow_user == 1 ? '已关注' : '关注'}}</text>
</div>
<div class="lwBtn" @click="showSendGift = true" v-if="plat == 'android' || (plat == 'ios' && switchTab == '1')">
<div class="lwBtn" @click="showSendGift = true"
v-if="plat == 'android' || (plat == 'ios' && switchTab == '1')">
<text class="btnTxt">送礼物</text>
</div>
</div>
... ... @@ -53,81 +75,109 @@
<!-- 介绍区域 -->
<div class="contentWrap">
<div class="content">
<text v-if="!expandStatus" style="font-size: 28rpx;color: #fff;line-height: 100rpx;">{{l.content}}</text>
<text v-if="!expandStatus"
style="font-size: 28rpx;color: #fff;line-height: 100rpx;">{{l.content}}</text>
</div>
<div class="expandBtn" @click="changeExpand">
<text style="line-height: 100rpx;color: #99a1a4;font-size: 28rpx;">{{expandStatus ? '收起' : '展开'}}</text>
<text
style="line-height: 100rpx;color: #99a1a4;font-size: 28rpx;">{{expandStatus ? '收起' : '展开'}}</text>
</div>
</div>
<div class="otherHandleWrap">
<div class="sayWhat" @click="getRemarkList">
<image src="../../static/image/sayWhatIcon.png" mode="" style="width: 32rpx;height: 32rpx;margin-right: 8rpx;"></image>
<image src="../../static/image/sayWhatIcon.png" mode=""
style="width: 32rpx;height: 32rpx;margin-right: 8rpx;"></image>
<text style="color: rgba(255,255,255,0.60);font-size: 24rpx;">说点什么</text>
</div>
<div class="userHandle">
<image @click="like" class="handleImg" :src="articleInfo.is_like == 1 ? '../../static/image/yidianzan.png' : '../../static/image/dianzan.png'" mode=""></image>
<image @click="like" class="handleImg"
:src="articleInfo.is_like == 1 ? '../../static/image/yidianzan.png' : '../../static/image/dianzan.png'"
mode=""></image>
<text class="handleNum">{{articleInfo.like_num}}</text>
<image class="handleImg" @click="getRemarkList" src="../../static/image/liuyan.png" mode=""></image><text class="handleNum">{{articleInfo.remark_num}}</text>
<image @click="collect" class="handleImg" :src="articleInfo.is_collect == 1 ? '../../static/image/yishoucang.png' : '../../static/image/shoucang.png'" mode=""></image>
<image class="handleImg" @click="getRemarkList" src="../../static/image/liuyan.png" mode="">
</image><text class="handleNum">{{articleInfo.remark_num}}</text>
<image @click="collect" class="handleImg"
:src="articleInfo.is_collect == 1 ? '../../static/image/yishoucang.png' : '../../static/image/shoucang.png'"
mode=""></image>
<text class="handleNum">{{articleInfo.collect_num}}</text>
</div>
</div>
</template>
</cell>
<progress :percent="bofangjindu" stroke-width="1" activeColor="#FFFFFF" backgroundColor="rgba(226, 226, 226, 0.3)" class="zhi_index24"/>
</cell>
<progress :percent="bofangjindu" stroke-width="1" activeColor="#FFFFFF"
backgroundColor="rgba(226, 226, 226, 0.3)" class="zhi_index24" />
<!-- 展开内容区域 -->
<!-- <scroll-view scroll-y class="expandContentWrap" v-if="expandStatus">
<div style="white-space: pre-line;">
<textarea style="width: 100%;height: 100rpx;font-size: 28rpx;color: #fff;line-height: 100rpx;" :value="articleInfo.content" :disabled="true" />
</div>
</scroll-view> -->
<div v-if="expandStatus" style="position: fixed;bottom: 200rpx;width: 750rpx;height: 200rpx;flex-direction: column;justify-content: center;align-items: center;">
<textarea style="width: 686rpx;height: 200rpx;font-size: 28rpx;color: #fff;" :value="articleInfo.content" :disabled="true" />
<div v-if="expandStatus"
style="position: fixed;bottom: 200rpx;width: 750rpx;height: 200rpx;flex-direction: column;justify-content: center;align-items: center;">
<textarea style="width: 686rpx;height: 200rpx;font-size: 28rpx;color: #fff;"
:value="articleInfo.content" :disabled="true" />
</div>
<!-- 评论内容弹框 -->
<div class="commentAlert" v-if="showCommentAlert">
<div class="commentNum" @click="closeAllAlert">
<text style="text-align: center;font-size: 28rpx;line-height: 100rpx;">共{{remarkList.length}}条评论</text>
<image @click="showCommentAlert = false" class="closeBtn" src="../../static/image/close.png" style="width: 32rpx;height: 32rpx;" mode=""></image>
<text
style="text-align: center;font-size: 28rpx;line-height: 100rpx;">共{{remarkList.length}}条评论</text>
<image @click="showCommentAlert = false" class="closeBtn" src="../../static/image/close.png"
style="width: 32rpx;height: 32rpx;" mode=""></image>
</div>
<scroll-view scroll-y class="commentList">
<div v-for="(item,index) in remarkList" :key="index" @click="closeAllAlert">
<div class="commentItem">
<image @click="goMainPage(item.user.id)" :src="item.user.avatar" style="width: 93rpx;height: 93rpx;border-radius: 20rpx 0 20rpx 0;" mode="aspectFill"></image>
<image @click="goMainPage(item.user.id)" :src="item.user.avatar"
style="width: 93rpx;height: 93rpx;border-radius: 20rpx 0 20rpx 0;" mode="aspectFill">
</image>
<div class="commentRight">
<div class="userNickName">
<text style="color: #969799;font-size: 28rpx;">{{item.user.nickname}}</text>
<text style="color: #969799;font-size: 28rpx;">{{item.createtime}}</text>
</div>
<text @longpress="changeAskHandle(index)" @click="remarkInp(item.id,index)" style="font-size: 28rpx;line-height: 42rpx;padding-top: 8rpx;">{{item.content}}</text>
<text @click="item.showReply = true" style="font-size: 28rpx;color: #5176d1;padding-top: 16rpx;" v-if="item.article_reply.length > 0 && !item.showReply">展开{{item.article_reply.length}}条回复</text>
<text @longpress="changeAskHandle(index)" @click="remarkInp(item.id,index)"
style="font-size: 28rpx;line-height: 42rpx;padding-top: 8rpx;">{{item.content}}</text>
<text @click="item.showReply = true"
style="font-size: 28rpx;color: #5176d1;padding-top: 16rpx;"
v-if="item.article_reply.length > 0 && !item.showReply">展开{{item.article_reply.length}}条回复</text>
</div>
</div>
<div class="askHandleWrap" v-if="item.showAskHandle">
<div class="handleItem" @click="reply(item.id,index)">
<image style="width: 32rpx;height: 32rpx;margin-right: 16rpx;" src="../../static/image/huifu.png" mode=""></image>
<image style="width: 32rpx;height: 32rpx;margin-right: 16rpx;"
src="../../static/image/huifu.png" mode=""></image>
<text style="color: #35655f;font-size: 28rpx;">回复</text>
</div>
<div class="handleItem" @click="handleAsk(item.id,index,item.user.id)">
<image style="width: 32rpx;height: 32rpx;margin-right: 16rpx;" src="../../static/image/jubao-9_1@2x.png" mode=""></image>
<text style="color: #35655f;font-size: 28rpx;">{{item.user.id != userinfo.id ? '举报' : '删除'}}</text>
<image style="width: 32rpx;height: 32rpx;margin-right: 16rpx;"
src="../../static/image/jubao-9_1@2x.png" mode=""></image>
<text
style="color: #35655f;font-size: 28rpx;">{{item.user.id != userinfo.id ? '举报' : '删除'}}</text>
</div>
</div>
<div v-for="(subItem,subIndex) in item.article_reply" :key="subIndex">
<div class="replyHandleWrap" v-if="subItem.showReplyHandle && subItem.user.id == userinfo.id">
<div class="replyHandleWrap"
v-if="subItem.showReplyHandle && subItem.user.id == userinfo.id">
<div class="handleItem" @click="handleReply(subItem.id,subIndex,subItem.user.id)">
<image style="width: 32rpx;height: 32rpx;margin-right: 16rpx;" src="../../static/image/jubao-9_1@2x.png" mode=""></image>
<image style="width: 32rpx;height: 32rpx;margin-right: 16rpx;"
src="../../static/image/jubao-9_1@2x.png" mode=""></image>
<text style="color: #35655f;font-size: 28rpx;">删除</text>
</div>
</div>
<div v-if="item.showReply" class="commentSubItem">
<image @click="goMainPage(subItem.user.id)" :src="subItem.user.avatar" style="width: 68rpx;height: 68rpx;border-radius: 20rpx 0 20rpx 0;" mode="aspectFill"></image>
<image @click="goMainPage(subItem.user.id)" :src="subItem.user.avatar"
style="width: 68rpx;height: 68rpx;border-radius: 20rpx 0 20rpx 0;"
mode="aspectFill">
</image>
<div class="commentRight">
<div class="userNickName">
<text style="color: #969799;font-size: 28rpx;">{{subItem.user.nickname}}</text>
<text style="color: #969799;font-size: 28rpx;">{{subItem.createtime}}</text>
</div>
<text @longpress="subItem.showReplyHandle = true" @click="subItem.showReplyHandle = false" style="font-size: 28rpx;line-height: 42rpx;padding-top: 8rpx;">{{subItem.content}}</text>
<text @longpress="subItem.showReplyHandle = true"
@click="subItem.showReplyHandle = false"
style="font-size: 28rpx;line-height: 42rpx;padding-top: 8rpx;">{{subItem.content}}</text>
</div>
</div>
</div>
... ... @@ -135,8 +185,10 @@
</scroll-view>
<div class="bottomBtn" :style="{bottom: keyboardHeight+'rpx'}" @click="closeAllAlert">
<div class="sayWhatInp">
<image src="../../static/image/edit_comment.png" mode="" style="width: 32rpx;height: 32rpx;margin-right: 8rpx;"></image>
<input ref="remarkInp" class="inpTxt" type="text" v-model="content" placeholder="说点什么" :adjust-position="false"/>
<image src="../../static/image/edit_comment.png" mode=""
style="width: 32rpx;height: 32rpx;margin-right: 8rpx;"></image>
<input ref="remarkInp" class="inpTxt" type="text" v-model="content" placeholder="说点什么"
:adjust-position="false" />
</div>
<text style="color: #969799;font-size: 32rpx;" @click="remark">发送</text>
</div>
... ... @@ -146,13 +198,16 @@
<div class="sendGift">
<div class="giftPad">
<div class="giftList">
<div class="giftItem" v-for="(item,index) in giftList" :key="index" @click="chooseGift(index)">
<div class="giftItem" v-for="(item,index) in giftList" :key="index"
@click="chooseGift(index)">
<div class="giftImg">
<div class="giftImgActive" :class="{active:giftIndex == index}">
<image style="width: 120rpx;height: 120rpx;" :src="item.image" mode=""></image>
</div>
</div>
<div class="giftName"><text style="text-align: center;color: #e8c760;font-size: 28rpx;">{{item.price}}问野币</text></div>
</div>
<div class="giftName"><text
style="text-align: center;color: #e8c760;font-size: 28rpx;">{{item.price}}问野币</text>
</div>
</div>
</div>
<div class="giftForm">
... ... @@ -163,7 +218,9 @@
<div class="inpItem">
<div class="inpKey">数量</div>
<div class="inpVal">
<input style="width: 200rpx;text-align: right;" type="number" @keyup="inpNum = inpNum.length === 1 ? inpNum.replace(/[^1-9]/g, '') : inpNum.replace(/\D/g, '')" v-model="inpNum" placeholder="请输入数量" placeholder-class="inpValPh"/>
<input style="width: 200rpx;text-align: right;" type="number"
@keyup="inpNum = inpNum.length === 1 ? inpNum.replace(/[^1-9]/g, '') : inpNum.replace(/\D/g, '')"
v-model="inpNum" placeholder="请输入数量" placeholder-class="inpValPh" />
</div>
</div>
<div class="inpItem">
... ... @@ -172,30 +229,32 @@
</div>
</div>
<div class="bottomBtn" @click="sendGift">
<text style="text-align: center;line-height: 88rpx;font-size: 32rpx;color: #fff;">送出礼物</text>
<text
style="text-align: center;line-height: 88rpx;font-size: 32rpx;color: #fff;">送出礼物</text>
</div>
</div>
<div class="closeBtn" @click="showSendGift = false">
<image style="width: 44rpx;height: 44rpx;" src="../../static/image/cross@2x.png" mode=""></image>
<image style="width: 44rpx;height: 44rpx;" src="../../static/image/cross@2x.png" mode="">
</image>
</div>
</div>
</div>
<div class="shareBox" v-if="showShare">
<div class="shareDialog">
<div class="sharelist">
<div class="shareitem" @click="share('weixin','WXSceneSession')">
<div class="imgWrap">
<image class="shareImg" src="../../static/image/share-icon1.png" mode=""></image>
<div class="sharelist">
<div class="shareitem" @click="share('weixin','WXSceneSession')">
<div class="imgWrap">
<image class="shareImg" src="../../static/image/share-icon1.png" mode=""></image>
</div>
<text style="text-align: center;line-height: 40rpx;font-size: 24rpx;">微信好友</text>
</div>
<text style="text-align: center;line-height: 40rpx;font-size: 24rpx;">微信好友</text>
</div>
<div class="shareitem" @click="share('weixin','WXSenceTimeline')">
<div class="imgWrap">
<image class="shareImg" src="../../static/image/share-icon2.png" mode=""></image>
<div class="shareitem" @click="share('weixin','WXSenceTimeline')">
<div class="imgWrap">
<image class="shareImg" src="../../static/image/share-icon2.png" mode=""></image>
</div>
<text style="text-align: center;line-height: 40rpx;font-size: 24rpx;">微信朋友圈</text>
</div>
<text style="text-align: center;line-height: 40rpx;font-size: 24rpx;">微信朋友圈</text>
</div>
<!-- <div class="shareitem" @click="share('qq')">
<!-- <div class="shareitem" @click="share('qq')">
<image src="../static/share-icon3.png" mode=""></image>
<text>QQ</text>
</div>
... ... @@ -203,94 +262,112 @@
<image src="../static/share-icon4.png" mode=""></image>
<text>微博</text>
</div> -->
</div>
<div class="cancelShare" @click="showShare = false">
<text style="font-size: 28rpx;line-height: 86rpx;text-align: center;">取消分享</text>
</div>
</div>
<div class="cancelShare" @click="showShare = false">
<text style="font-size: 28rpx;line-height: 86rpx;text-align: center;">取消分享</text>
</div>
</div>
</div>
</list>
</list>
</div>
</template>
<script>
const deviceInfo = uni.getSystemInfoSync()
const deviceInfo = uni.getSystemInfoSync()
import canshu from './index.js'
import {mapState} from "vuex"
if(deviceInfo.brand=='Xiaomi'){
deviceInfo.windowHeight+=1
import {
mapState
} from "vuex"
if (deviceInfo.brand == 'Xiaomi') {
deviceInfo.windowHeight += 1
}
// var apiUrl = 'http://landlord.t.brotop.cn/api'
var apiUrl = 'http://app.zhaodizhu.cn/api'
export default {
data() {
return {
playIconStatus:false,
keyboardHeight:0,//键盘高度
showShare:false,
wallet:{},//我的钱包
inpNum:'',//输入礼物数量
giftIndex:-1,
showSendGift:false,
giftList:[],//礼物列表
showMoreHandle:false,
article_remark_id:'',
remarkType:'',
remarkQueryParam:{
article_id:'',
page:1,
pageNum:15
sysheight:0,
height:'667px',
background: ['color1', 'color2', 'color3'],
indicatorDots: true,
autoplay: true,
interval: 2000,
duration: 500,
playIconStatus: false,
keyboardHeight: 0, //键盘高度
showShare: false,
wallet: {}, //我的钱包
inpNum: '', //输入礼物数量
giftIndex: -1,
showSendGift: false,
giftList: [], //礼物列表
showMoreHandle: false,
article_remark_id: '',
remarkType: '',
remarkQueryParam: {
article_id: '',
page: 1,
pageNum: 15
},
remarkList:[],
content:'',
article_id:'',
articleInfo:{},
scrollable:true,//是否允许List滚动
expandStatus:false,
showCommentAlert:false,//展示评论内容弹框
statusBarHeight:deviceInfo.statusBarHeight+'px',
remarkList: [],
content: '',
article_id: '',
articleInfo: {},
scrollable: true, //是否允许List滚动
expandStatus: false,
showCommentAlert: false, //展示评论内容弹框
statusBarHeight: deviceInfo.statusBarHeight + 'px',
loadMoreHeight: deviceInfo.windowHeight * 2, // 触发 loadmore 事件所需要的垂直偏移距离 加载到剩余2 继续加载
videoStyle:{
width:"750rpx",
height:deviceInfo.windowHeight+'px',
},
lie:[],
nowId:0,
screenHeight:0,//屏幕高度
scrollTop:0,//滚动距离顶部距离
bofangjindu:0,
appear:'',
kebofang:0,
switchTab:'1',
plat:'android'
videoStyle: {
width: "750rpx",
height: deviceInfo.windowHeight + 'px',
},
lie: [],
nowId: 0,
screenHeight: 0, //屏幕高度
scrollTop: 0, //滚动距离顶部距离
bofangjindu: 0,
appear: '',
kebofang: 0,
switchTab: '1',
plat: 'android'
}
},
computed:{
...mapState(["isLogin","userinfo","articleList"]),
jbNum(){
if(this.giftIndex != -1){
},
computed: {
...mapState(["isLogin", "userinfo", "articleList"]),
jbNum() {
if (this.giftIndex != -1) {
return this.inpNum * this.giftList[this.giftIndex].price
}
}
},
created(){
this.sysheight = uni.getSystemInfoSync().windowHeight
this.height = `${this.sysheight}px`
},
onLoad(e) {
this.nowId = e.id
this.article_id = e.id
//监听键盘高度变化
uni.onKeyboardHeightChange(res => {
if(res.height == 0){
this.keyboardHeight = 0
}else{
this.keyboardHeight = res.height*2 + 10
}
if (res.height == 0) {
this.keyboardHeight = 0
} else {
this.keyboardHeight = res.height * 2 + 10
}
})
//获取后台配置信息
uni.request({
url:apiUrl+'/common/getConfig',
method:'POST',
url: apiUrl + '/common/getConfig',
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'content-type': 'application/x-www-form-urlencoded',
'token': uni.getStorageSync('token')
},
data:{type:'8'},
data: {
type: '8'
},
success: (res) => {
this.switchTab = res.data.data.switch
this.plat = plus.os.name.toLowerCase()
... ... @@ -302,16 +379,16 @@
this.screenHeight = res.screenHeight
}
})
this.getData()
let lieArr = []
let index = 0
let scrollTop = 0
this.articleList.forEach((item)=>{
if(item.type == '2'){
if(item.id == this.nowId){
scrollTop = this.screenHeight*index
this.articleList.forEach((item) => {
if (item.type == '2') {
if (item.id == this.nowId) {
scrollTop = this.screenHeight * index
}
lieArr.push(item)
index++
... ... @@ -319,47 +396,49 @@
})
this.scrollTop = scrollTop
this.lie = lieArr
setTimeout(()=>{
uni.createVideoContext(`video_${this.nowId}`,this).play()
},200)
setTimeout(() => {
uni.createVideoContext(`video_${this.nowId}`, this).play()
}, 200)
},
onShow() {
this.kebofang=1;
this.kebofang = 1;
},
onHide(){
this.kebofang=0;
if(this.lie[this.index]){
uni.createVideoContext(`video_${this.index}`,this).pause()
}
onHide() {
this.kebofang = 0;
if (this.lie[this.index]) {
uni.createVideoContext(`video_${this.index}`, this).pause()
}
},
methods: {
getData(){
getData() {
uni.request({
url:apiUrl+'/article/info',
method:'POST',
url: apiUrl + '/article/info',
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'content-type': 'application/x-www-form-urlencoded',
'token': uni.getStorageSync('token')
},
data:{article_id:this.article_id},
data: {
article_id: this.article_id
},
success: (res) => {
console.log('故事详情',res)
console.log('故事详情', res)
this.articleInfo = res.data.data
}
})
uni.request({
url:apiUrl+'/gift/lis',
method:'POST',
url: apiUrl + '/gift/lis',
method: 'POST',
success: (res) => {
this.giftList = res.data.data
}
})
uni.request({
url:apiUrl+'/wallet/index',
method:'POST',
url: apiUrl + '/wallet/index',
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'content-type': 'application/x-www-form-urlencoded',
'token': uni.getStorageSync('token')
},
success: (res) => {
... ... @@ -367,81 +446,86 @@
}
})
},
Disappear(e,i){
if(this.appear==e.direction && deviceInfo.platform=='android'){
let index=(e.direction=='up')?i+1:i-1;
if(index >= 0){
Disappear(e, i) {
console.log('e', e)
console.log('i', i)
console.log('direction', (e.direction == 'up') ? i + 1 : i - 1)
console.log('this.lie', this.lie)
if (deviceInfo.platform == 'android' && e.direction != undefined) {
let index = (e.direction == 'up') ? i + 1 : i - 1;
console.log('index', index)
if (index >= 0) {
this.nowId = this.lie[index].id
this.article_id = this.lie[index].id
this.getData()
}
setTimeout(()=>{
uni.createVideoContext(`video_${this.nowId}`,this).play()
},300)
}
setTimeout(() => {
uni.createVideoContext(`video_${this.nowId}`, this).play()
}, 300)
}
},
onappear (e) {
this.appear=e.direction;
},
changeAskHandle(index){
this.remarkList.forEach(item=>{
onappear(e) {
this.appear = e.direction;
},
changeAskHandle(index) {
this.remarkList.forEach(item => {
item.showAskHandle = false
})
this.remarkList[index].showAskHandle = true
},
//播放
play(){
play() {
this.playStatus = true
this.playIconStatus = false
},
//暂停
pause(){
pause() {
this.playStatus = false
this.playIconStatus = true
},
remarkInp(id,index){
remarkInp(id, index) {
this.article_remark_id = id
this.remarkType = 'reply'
this.$refs.remarkInp.focus()
},
//去主页
goMainPage(userId){
if(userId == this.userinfo.id){
goMainPage(userId) {
if (userId == this.userinfo.id) {
uni.switchTab({
url:'/pages/my/my'
url: '/pages/my/my'
})
}else{
this.href('/pages/index/landHome?id='+userId)
} else {
this.href('/pages/index/landHome?id=' + userId)
}
},
handleAsk(id,index,userId){
handleAsk(id, index, userId) {
this.remarkList[index].showAskHandle = false
if(userId != this.userinfo.id){
if (userId != this.userinfo.id) {
uni.navigateTo({
url:'/pages/index/report?article_remark_id='+id
url: '/pages/index/report?article_remark_id=' + id
})
}else{
} else {
uni.request({
url:apiUrl+'/article_remark/delRemark',
method:'POST',
url: apiUrl + '/article_remark/delRemark',
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'content-type': 'application/x-www-form-urlencoded',
'token': uni.getStorageSync('token')
},
data:{
article_remark_id:id
data: {
article_remark_id: id
},
success: (res) => {
if(res.data.code == 1){
if (res.data.code == 1) {
this.getRemarkList()
uni.showToast({
title:'删除成功'
title: '删除成功'
})
}else{
} else {
uni.showToast({
title:res.data.msg,
icon:'none'
title: res.data.msg,
icon: 'none'
})
}
}
... ... @@ -449,102 +533,104 @@
}
},
//关闭所有弹框
closeAllAlert(i){
let videoPlay = uni.createVideoContext('video_'+i)
if(!this.showCommentAlert){
if(this.playStatus){
closeAllAlert(i) {
let videoPlay = uni.createVideoContext('video_' + i)
if (!this.showCommentAlert) {
if (this.playStatus) {
videoPlay.pause()
}else{
} else {
videoPlay.play()
}
}
this.showMoreHandle = false
this.remarkList.forEach(item=>{
this.remarkList.forEach(item => {
item.showAskHandle = false
})
this.$forceUpdate()
},
//操作回复
handleReply(id,index,userId){
handleReply(id, index, userId) {
this.remarkList[index].showReplyHandle = false
uni.request({
url:apiUrl+'/article_reply/delReply',
method:'POST',
url: apiUrl + '/article_reply/delReply',
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'content-type': 'application/x-www-form-urlencoded',
'token': uni.getStorageSync('token')
},
data:{
article_reply_id:id
data: {
article_reply_id: id
},
success: (res) => {
if(res.data.code == 1){
if (res.data.code == 1) {
this.getRemarkList()
uni.showToast({
title:'删除成功'
title: '删除成功'
})
}else{
} else {
uni.showToast({
title:res.data.msg,
icon:'none'
title: res.data.msg,
icon: 'none'
})
}
}
})
},
openAskHandle(index){
openAskHandle(index) {
this.remarkList[index].showAskHandle = true
this.article_remark_id = id
this.remarkType = 'reply'
this.$refs.remarkInp.focus()
},
//分享
share(parm1,parm2=''){
share(parm1, parm2 = '') {
//"weixin", "qq", "sinaweibo"
// WXSceneSession 分享到聊天界面
// WXSenceTimeline 分享到朋友圈
// WXSceneFavorite 分享到微信收藏
uni.share({
provider:parm1,
title:"找地主",
scene:parm2,
type:0,
summary:"找地主测试描述",
href:"http://baidu.com",
imageUrl:"https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/uni@2x.png"
provider: parm1,
title: "找地主",
scene: parm2,
type: 0,
summary: "找地主测试描述",
href: "http://baidu.com",
imageUrl: "https://img-cdn-qiniu.dcloud.net.cn/uniapp/images/uni@2x.png"
})
},
//删除帖子
delAct(){
delAct() {
uni.showModal({
title:'提示',
content:'确认删除吗?',
title: '提示',
content: '确认删除吗?',
success: (res) => {
if(res.confirm){
if (res.confirm) {
uni.request({
url:apiUrl + '/article/del',
method:'POST',
url: apiUrl + '/article/del',
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'content-type': 'application/x-www-form-urlencoded',
'token': uni.getStorageSync('token')
},
data:{article_id:this.article_id},
data: {
article_id: this.article_id
},
success: (res) => {
if(res.data.code == 1){
uni.setStorageSync('refreshMy',true)
uni.setStorageSync('refreshFindWonderful',true)
if (res.data.code == 1) {
uni.setStorageSync('refreshMy', true)
uni.setStorageSync('refreshFindWonderful', true)
uni.navigateBack({
delta:1
delta: 1
})
setTimeout(()=>{
setTimeout(() => {
uni.showToast({
title:'删除成功'
title: '删除成功'
})
},500)
}else{
}, 500)
} else {
uni.showToast({
title:res.msg,
icon:'none'
title: res.msg,
icon: 'none'
})
}
}
... ... @@ -552,86 +638,86 @@
}
}
})
},
//送出礼物
sendGift(){
if(this.giftIndex == -1){
sendGift() {
if (this.giftIndex == -1) {
uni.showToast({
title:'请选择礼物',
icon:'none'
title: '请选择礼物',
icon: 'none'
})
return
}
if(this.inpNum == '' || this.inpNum <= 0){
if (this.inpNum == '' || this.inpNum <= 0) {
uni.showToast({
title:'请输入正确数量',
icon:'none'
title: '请输入正确数量',
icon: 'none'
})
return
}
uni.request({
url:apiUrl+'/gift/give',
method:'POST',
url: apiUrl + '/gift/give',
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'content-type': 'application/x-www-form-urlencoded',
'token': uni.getStorageSync('token')
},
data:{
gift_id:this.giftList[this.giftIndex].id,
user_id:this.articleInfo.user.id,
number:this.inpNum
data: {
gift_id: this.giftList[this.giftIndex].id,
user_id: this.articleInfo.user.id,
number: this.inpNum
},
success: (res) => {
if(res.data.code == 1){
if (res.data.code == 1) {
this.showSendGift = false
uni.showToast({
title:'送出礼物成功'
title: '送出礼物成功'
})
}else{
} else {
uni.showToast({
title:res.data.msg,
icon:'none'
title: res.data.msg,
icon: 'none'
})
}
}
})
},
//选择礼物
chooseGift(index){
chooseGift(index) {
this.giftIndex = index
},
//举报
report(){
report() {
this.showMoreHandle = false
if(this.articleInfo.user.id != this.userinfo.id){
if (this.articleInfo.user.id != this.userinfo.id) {
uni.navigateTo({
url:'/pages/index/report?article_id='+this.article_id
url: '/pages/index/report?article_id=' + this.article_id
})
}else{
} else {
uni.navigateTo({
url:'/pages/findWonderful/publishPost?article_id='+this.article_id
url: '/pages/findWonderful/publishPost?article_id=' + this.article_id
})
}
},
//回复
reply(id,index){
reply(id, index) {
this.remarkList[index].showAskHandle = false
this.article_remark_id = id
this.remarkType = 'reply'
this.$refs.remarkInp.focus()
},
//获取评论列表
getRemarkList(){
getRemarkList() {
this.remarkQueryParam.article_id = this.article_id
uni.request({
url:apiUrl+'/article_remark/getArticleList',
method:'POST',
url: apiUrl + '/article_remark/getArticleList',
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'content-type': 'application/x-www-form-urlencoded',
'token': uni.getStorageSync('token')
},
data:this.remarkQueryParam,
data: this.remarkQueryParam,
success: (res) => {
this.remarkList = res.data.data.data
this.showCommentAlert = true
... ... @@ -639,108 +725,114 @@
})
},
//关注
follow(userId){
follow(userId) {
uni.request({
url:apiUrl+'/user_follow_log/follow',
method:'POST',
url: apiUrl + '/user_follow_log/follow',
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'content-type': 'application/x-www-form-urlencoded',
'token': uni.getStorageSync('token')
},
data:{to_user_id:userId},
data: {
to_user_id: userId
},
success: (res) => {
if(res.data.code == 1){
if (res.data.code == 1) {
this.getData()
uni.showToast({
title:res.data.msg + '成功'
title: res.data.msg + '成功'
})
}else{
} else {
uni.showToast({
title:res.data.msg,
icon:'none'
title: res.data.msg,
icon: 'none'
})
}
}
})
},
//点赞
like(){
like() {
uni.request({
url:apiUrl+'/article/like',
method:'POST',
url: apiUrl + '/article/like',
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'content-type': 'application/x-www-form-urlencoded',
'token': uni.getStorageSync('token')
},
data:{article_id:this.article_id},
data: {
article_id: this.article_id
},
success: (res) => {
this.getData()
}
})
},
//收藏
collect(){
collect() {
uni.request({
url:apiUrl+'/article/collect',
method:'POST',
url: apiUrl + '/article/collect',
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'content-type': 'application/x-www-form-urlencoded',
'token': uni.getStorageSync('token')
},
data:{article_id:this.article_id},
data: {
article_id: this.article_id
},
success: (res) => {
this.getData()
}
})
},
//评论
remark(){
if(this.remarkType == 'reply'){
if(this.content == ''){
remark() {
if (this.remarkType == 'reply') {
if (this.content == '') {
uni.showToast({
title:'请输入回复内容',
icon:'none'
title: '请输入回复内容',
icon: 'none'
})
return
}
uni.hideKeyboard()
uni.request({
url:apiUrl+'/article_reply/submitReply',
method:'POST',
url: apiUrl + '/article_reply/submitReply',
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'content-type': 'application/x-www-form-urlencoded',
'token': uni.getStorageSync('token')
},
data:{
article_remark_id:this.article_remark_id,
content:this.content
data: {
article_remark_id: this.article_remark_id,
content: this.content
},
success: (res) => {
this.content = ''
this.remarkType = 'send'
this.article_remark_id = ''
this.article_remark_id = ''
this.getRemarkList()
}
})
}else{
if(this.content == ''){
} else {
if (this.content == '') {
uni.showToast({
title:'请输入评论内容',
icon:'none'
title: '请输入评论内容',
icon: 'none'
})
return
}
uni.hideKeyboard()
uni.request({
url:apiUrl+'/article_remark/submit',
method:'POST',
url: apiUrl + '/article_remark/submit',
method: 'POST',
header: {
'content-type': 'application/x-www-form-urlencoded',
'content-type': 'application/x-www-form-urlencoded',
'token': uni.getStorageSync('token')
},
data:{
article_id:this.article_id,
content:this.content
data: {
article_id: this.article_id,
content: this.content
},
success: (res) => {
this.content = ''
... ... @@ -751,60 +843,60 @@
}
},
//返回上一页
back(){
back() {
uni.navigateBack({
delta:1
delta: 1
})
},
changeExpand(){
changeExpand() {
this.expandStatus = !this.expandStatus
},
dianzan(e){
if(e==0){
this.lie[this.index].yidianzan=1
this.lie[this.index].yidianzanshu= Number(this.lie[this.index].yidianzanshu) + 1
}else{
this.lie[this.index].yidianzan=0
this.lie[this.index].yidianzanshu= Number(this.lie[this.index].yidianzanshu)-1
dianzan(e) {
if (e == 0) {
this.lie[this.index].yidianzan = 1
this.lie[this.index].yidianzanshu = Number(this.lie[this.index].yidianzanshu) + 1
} else {
this.lie[this.index].yidianzan = 0
this.lie[this.index].yidianzanshu = Number(this.lie[this.index].yidianzanshu) - 1
}
},
guanzhu(e){
if(e==0){
this.lie[this.index].guanzhu=1
guanzhu(e) {
if (e == 0) {
this.lie[this.index].guanzhu = 1
uni.showToast({
title: '关注成功',
duration: 1500
title: '关注成功',
duration: 1500
});
}else{
this.lie[this.index].guanzhu=0
} else {
this.lie[this.index].guanzhu = 0
}
},
panduanpofang() {
if (this.kebofang == 0) {
uni.createVideoContext(`video_${this.index}`, this).pause()
}
},
panduanpofang(){
if(this.kebofang==0){
uni.createVideoContext(`video_${this.index}`,this).pause()
}
},
Timeupdate(e){
this.bofangjindu = parseInt(e.detail.currentTime/e.detail.duration*100)
Timeupdate(e) {
this.bofangjindu = parseInt(e.detail.currentTime / e.detail.duration * 100)
},
Scroll(e){
Scroll(e) {
this.expandStatus = false
if(deviceInfo.platform=='ios'){
var i=Math.abs(e.contentOffset.y/deviceInfo.windowHeight)
if(i!=this.index){
this.index=i
setTimeout(()=>{
uni.createVideoContext(`video_${this.index}`,this).play()
},300)
if (deviceInfo.platform == 'ios') {
var i = Math.abs(e.contentOffset.y / deviceInfo.windowHeight)
if (i != this.index) {
this.index = i
setTimeout(() => {
uni.createVideoContext(`video_${this.index}`, this).play()
}, 300)
}
}
}
},
href(url){
href(url) {
uni.navigateTo({
url:url
url: url
})
}
}
... ... @@ -812,13 +904,31 @@
</script>
<style lang="scss" scoped>
.zhi_index04{width:750upx;flex: 1;background-color: #000000;}
.zhi_index05{position: absolute;top: 0;left: 0;}
.zhi_index04 {
width: 750upx;
flex: 1;
background-color: #000000;
}
.zhi_index05 {
position: absolute;
top: 0;
left: 0;
}
/* 导航栏区域 */
.navBarWrap{
position: absolute;height: 88rpx;width: 750rpx;top: 0;padding: 0 32rpx;flex-direction: row;justify-content: space-between;align-items: center;
.navBarWrap {
position: absolute;
height: 88rpx;
width: 750rpx;
top: 0;
padding: 0 32rpx;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
.moreHandleWrap{
.moreHandleWrap {
position: absolute;
width: 168rpx;
height: 72rpx;
... ... @@ -826,108 +936,299 @@
top: 105rpx;
right: 46rpx;
border-radius: 10rpx;
.handleItem{
.handleItem {
flex-direction: row;
justify-content: center;
align-items: center;
height: 72rpx;
}
}
/* 用户信息区域 */
.userInfoWrap{position: absolute;width: 750rpx;height: 100rpx;bottom: 200rpx;padding: 0 32rpx;flex-direction: row;justify-content: space-between;}
.userInfoWrap .userInfoLeft{flex-direction: row;align-items: center;}
.userInfoLeft .userIcon{width: 93rpx;}
.userInfoLeft .userNameAddress{padding-left: 9rpx;}
.userNameAddress .userAddress{flex-direction: row;align-items: center;}
.userInfoWrap .userInfoRight{flex-direction: row;align-items: center;justify-content: space-between;width: 260rpx;}
.userInfoRight .btnTxt{font-size: 22rpx;color: #fff;text-align: center;line-height: 52rpx;}
.userInfoRight .gzBtn{width: 122rpx;height: 52rpx;border: 1rpx solid #ffffff;border-radius: 103rpx;box-shadow: 0rpx 4rpx 6rpx 0rpx rgba(63,63,64,0.37);}
.userInfoRight .lwBtn{width: 122rpx;height: 52rpx;background: #35655f;border-radius: 102rpx;box-shadow: 0rpx 4rpx 6rpx 0rpx rgba(63,63,64,0.37); }
.userInfoWrap {
position: absolute;
width: 750rpx;
height: 100rpx;
bottom: 200rpx;
padding: 0 32rpx;
flex-direction: row;
justify-content: space-between;
}
.userInfoWrap .userInfoLeft {
flex-direction: row;
align-items: center;
}
.userInfoLeft .userIcon {
width: 93rpx;
}
.userInfoLeft .userNameAddress {
padding-left: 9rpx;
}
.userNameAddress .userAddress {
flex-direction: row;
align-items: center;
}
.userInfoWrap .userInfoRight {
flex-direction: row;
align-items: center;
justify-content: space-between;
width: 260rpx;
}
.userInfoRight .btnTxt {
font-size: 22rpx;
color: #fff;
text-align: center;
line-height: 52rpx;
}
.userInfoRight .gzBtn {
width: 122rpx;
height: 52rpx;
border: 1rpx solid #ffffff;
border-radius: 103rpx;
box-shadow: 0rpx 4rpx 6rpx 0rpx rgba(63, 63, 64, 0.37);
}
.userInfoRight .lwBtn {
width: 122rpx;
height: 52rpx;
background: #35655f;
border-radius: 102rpx;
box-shadow: 0rpx 4rpx 6rpx 0rpx rgba(63, 63, 64, 0.37);
}
/* 展开内容区域 */
.expandContentWrap{
position: fixed;width: 750rpx;height: 200rpx;bottom: 200rpx;flex-direction: column;padding: 0 32rpx;
.expandContentWrap {
position: fixed;
width: 750rpx;
height: 200rpx;
bottom: 200rpx;
flex-direction: column;
padding: 0 32rpx;
}
/* 介绍区域 */
.contentWrap{position: absolute;bottom: 100rpx;padding: 0 32rpx;flex-direction: row;height: 100rpx;width: 750rpx;}
.contentWrap .content{flex: 1;
.contentWrap {
position: absolute;
bottom: 100rpx;
padding: 0 32rpx;
flex-direction: row;
height: 100rpx;
width: 750rpx;
}
.contentWrap .content {
flex: 1;
overflow: hidden;
text-overflow: ellipsis;
}
.contentWrap .expandBtn{width: 70rpx;}
.contentWrap .expandBtn {
width: 70rpx;
}
/* 视频播放进度 */
.zhi_index24{position: fixed;bottom: 100rpx;left: 0px;width: 750upx;}
.zhi_index24 {
position: fixed;
bottom: 100rpx;
left: 0px;
width: 750upx;
}
/* 其他操作区域 */
.otherHandleWrap{position: absolute;width: 750rpx;height:100rpx;bottom: 0;padding: 0 32rpx;flex-direction: row;justify-content: space-between;align-items: center;background-color: #000000;}
.otherHandleWrap .sayWhat{width: 238rpx;height: 64rpx;background: rgba(255,255,255,0.20);border-radius: 64rpx;flex-direction: row;padding-left: 24rpx;align-items: center;}
.otherHandleWrap .userHandle{flex-direction: row;align-items: center;}
.userHandle .handleImg{width: 42rpx;height: 42rpx;margin: 0 12rpx 0 24rpx;}
.userHandle .handleNum{color: rgba(255,255,255,0.60);font-size: 30rpx;}
.otherHandleWrap {
position: absolute;
width: 750rpx;
height: 100rpx;
bottom: 0;
padding: 0 32rpx;
flex-direction: row;
justify-content: space-between;
align-items: center;
background-color: #000000;
}
.otherHandleWrap .sayWhat {
width: 238rpx;
height: 64rpx;
background: rgba(255, 255, 255, 0.20);
border-radius: 64rpx;
flex-direction: row;
padding-left: 24rpx;
align-items: center;
}
.otherHandleWrap .userHandle {
flex-direction: row;
align-items: center;
}
.userHandle .handleImg {
width: 42rpx;
height: 42rpx;
margin: 0 12rpx 0 24rpx;
}
.userHandle .handleNum {
color: rgba(255, 255, 255, 0.60);
font-size: 30rpx;
}
/* 评论内容弹框 */
.commentAlert{position: fixed;width: 750rpx;height: 1000rpx;bottom: 0;background: #fff;border-radius: 30rpx 30rpx 0 0;}
.commentAlert .commentNum{height: 100rpx;position: relative;}
.commentNum .closeBtn{position: absolute;top:30rpx;right: 30rpx;}
.commentAlert .commentList{height: 800rpx;padding: 0 30rpx;}
.commentList .commentItem{flex-direction: row;padding: 10rpx 0;}
.commentItem .commentLeft{width: 93rpx;}
.commentItem .commentRight{width: 597rpx;padding-left: 13rpx;}
.commentRight .userNickName{flex-direction: row;justify-content: space-between;}
.commentList .commentSubItem{
flex-direction: row;padding: 10rpx 0 10rpx 106rpx;
.commentRight{
flex: 1;padding-left: 13rpx;
.userNickName{flex-direction: row;justify-content: space-between;}
.commentAlert {
position: fixed;
width: 750rpx;
height: 1000rpx;
bottom: 0;
background: #fff;
border-radius: 30rpx 30rpx 0 0;
}
.commentAlert .commentNum {
height: 100rpx;
position: relative;
}
.commentNum .closeBtn {
position: absolute;
top: 30rpx;
right: 30rpx;
}
.commentAlert .commentList {
height: 800rpx;
padding: 0 30rpx;
}
.commentList .commentItem {
flex-direction: row;
padding: 10rpx 0;
}
.commentItem .commentLeft {
width: 93rpx;
}
.commentItem .commentRight {
width: 597rpx;
padding-left: 13rpx;
}
.commentRight .userNickName {
flex-direction: row;
justify-content: space-between;
}
.commentList .commentSubItem {
flex-direction: row;
padding: 10rpx 0 10rpx 106rpx;
.commentRight {
flex: 1;
padding-left: 13rpx;
.userNickName {
flex-direction: row;
justify-content: space-between;
}
}
}
.askHandleWrap{
.askHandleWrap {
width: 140rpx;
height: 100rpx;
border-radius: 10rpx;
margin-left: 130rpx;
border: 2rpx solid #35655f;
.handleItem{
.handleItem {
flex-direction: row;
justify-content: center;
align-items: center;
height: 50rpx;
}
}
.replyHandleWrap{
.replyHandleWrap {
width: 140rpx;
height: 50rpx;
border-radius: 10rpx;
margin-left: 236rpx;
border: 2rpx solid #35655f;
.handleItem{
.handleItem {
flex-direction: row;
justify-content: center;
align-items: center;
height: 50rpx;
}
}
.commentAlert .bottomBtn{position: fixed;width: 750rpx;height: 100rpx;background: #ffffff;box-shadow: 0rpx -12rpx 14rpx 0rpx rgba(59,98,194,0.03);padding: 0 32rpx;flex-direction: row;align-items: center;justify-content: space-between;}
.bottomBtn .sayWhatInp{width: 590rpx;height: 64rpx;background: #f7f8fa;border-radius: 64rpx;flex-direction: row;align-items: center;padding-left: 20rpx;}
.sayWhatInp .inpTxt{width: 518rpx;height: 32rpx;font-size: 26rpx;}
.commentAlert .bottomBtn {
position: fixed;
width: 750rpx;
height: 100rpx;
background: #ffffff;
box-shadow: 0rpx -12rpx 14rpx 0rpx rgba(59, 98, 194, 0.03);
padding: 0 32rpx;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.bottomBtn .sayWhatInp {
width: 590rpx;
height: 64rpx;
background: #f7f8fa;
border-radius: 64rpx;
flex-direction: row;
align-items: center;
padding-left: 20rpx;
}
.sayWhatInp .inpTxt {
width: 518rpx;
height: 32rpx;
font-size: 26rpx;
}
/* 送礼物弹框 */
.sendGiftAlert{
position: fixed;top: 0;left: 0;right: 0;bottom: 0;background: rgba(0,0,0,0.5);
.sendGift{
.sendGiftAlert {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
.sendGift {
width: 750rpx;
position: absolute;
height: 630rpx;
bottom: 0;
background: #fff;
border-radius: 50rpx 50rpx 0 0;
.giftPad{
.giftPad {
padding: 40rpx 32rpx 0 32rpx;
.giftList{
.giftList {
flex-direction: row;
justify-content: center;
.giftItem{
.giftImg{
.giftItem {
.giftImg {
flex-direction: row;
justify-content: center;
.giftImgActive{
.giftImgActive {
width: 150rpx;
height: 150rpx;
flex-direction: row;
... ... @@ -935,28 +1236,33 @@
justify-content: center;
border-radius: 10rpx;
}
.giftImgActive.active{
.giftImgActive.active {
background: #e0e3ef;
}
}
}
}
.giftForm{
.giftForm {
padding: 32rpx;
.inpItem{
.inpItem {
height: 88rpx;
flex-direction: row;
justify-content: space-between;
align-items: center;
}
}
.bottomBtn{
height:88rpx;
.bottomBtn {
height: 88rpx;
background: #35655f;
border-radius: 50rpx;
}
}
.closeBtn{
.closeBtn {
position: absolute;
width: 44rpx;
height: 44rpx;
... ... @@ -965,13 +1271,46 @@
}
}
}
/* 分享 */
.shareBox{position: fixed;top:0;left:0;right:0;bottom:0;background: rgba(0,0,0,0.5);}
.shareDialog{width: 750rpx;height: 320rpx;background: #fff;position: absolute;bottom:0;}
.sharelist{flex-direction: row;margin:50rpx 0 44rpx;justify-content: center;}
.sharelist .shareitem{width: 187.5rpx;}
.shareitem .imgWrap{flex-direction: row;justify-content: center;}
.shareitem .shareImg{width: 100rpx;height: 100rpx;}
.cancelShare{border-top:1rpx solid #e5e5e5;
.shareBox {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
}
.shareDialog {
width: 750rpx;
height: 320rpx;
background: #fff;
position: absolute;
bottom: 0;
}
.sharelist {
flex-direction: row;
margin: 50rpx 0 44rpx;
justify-content: center;
}
.sharelist .shareitem {
width: 187.5rpx;
}
.shareitem .imgWrap {
flex-direction: row;
justify-content: center;
}
.shareitem .shareImg {
width: 100rpx;
height: 100rpx;
}
.cancelShare {
border-top: 1rpx solid #e5e5e5;
}
</style>
... ...
... ... @@ -10,132 +10,221 @@
{{item.price}}元
</view>
</view>
<view class="recItem" >
<!-- <view class="recItem">
<view class="recVal">
<input type="number" v-model="custNum" placeholder="自定义" style="width: 50%;text-align: center;" placeholder-style="font-size:28rpx;color:#4a8b94;"/>
<input type="number" v-model="custNum" placeholder="自定义" style="width: 50%;text-align: center;"
placeholder-style="font-size:28rpx;color:#4a8b94;" />
</view>
<view class="recPrice" style="font-weight: 600;" @click="custom">
立即充值
</view>
</view>
</view> -->
</view>
<navigator url="aboutUs"></navigator>
<view class="agreeCont">
<!-- <checkbox color="#4a8b94"/> -->充值即代表您同意<text @click="$href('aboutUs?navTitle=问野币充值协议')">《问野币充值协议》</text>
<!-- <checkbox color="#4a8b94"/> -->充值即代表您同意<text
@click="$href('aboutUs?navTitle=问野币充值协议')">《问野币充值协议》</text>
</view>
<!-- 游侠付款弹框 -->
<pay-type v-if="showPay" @pay="pay" @changePayType="changePayType" :price="price" @closePayAlert="showPay = false"></pay-type>
<pay-type v-if="showPay" @pay="pay" @changePayType="changePayType" :price="price"
@closePayAlert="showPay = false"></pay-type>
</view>
</template>
<script>
import payType from '@/components/payType.vue'
export default{
data(){
return{
custNum:'',
param:{
number:'',//问野币数量
pay_type:'wechat'
export default {
data() {
return {
custNum: '',
id: '',
param: {
number: '', //问野币数量
pay_type: 'wechat'
},
showPay:false,//展示支付弹框
price:0,
list:[
{
num:10,
price:1
showPay: false, //展示支付弹框
price: 0,
list: [{
num: 10,
price: 1,
id: 'S3FKBIR',
},
{
num:50,
price:5
num: 60,
price: 6,
id: 'K93MD8T',
},
{
num:100,
price:10
num: 120,
price: 12,
id: 'TR5CNJF',
},
{
num:200,
price:20
num: 250,
price: 25,
id: 'AIDHZK4',
},
{
num:500,
price:50
num: 500,
price: 50,
id: '87FC0DH',
}
]
}
},
components:{
components: {
payType
},
onLoad() {
uni.getProvider({
service: 'payment',
success: function (res) {
console.log('获取通道',res.provider)
}
service: 'payment',
success: function(res) {
console.log('获取通道', res.provider)
}
});
console.log('查看支付通道')
plus.payment.getChannels((channels) => {
console.log('判断是否是苹果支付',channels)
for (var i in channels) {
// 判断是否苹果支付
if (channels[i].id === 'appleiap') {
that.iapChannel = channels[i]
that.requestOrder()
} else {
// that.payment()
that.requestOrder()
}
}
})
},
methods:{
methods: {
//修改支付类型
changePayType(e){
console.log('修改支付类型',e)
changePayType(e) {
console.log('修改支付类型', e)
this.param.pay_type = e
},
//显示支付类型选择弹框
showPayType(index){
showPayType(index) {
this.price = this.list[index].price
this.param.number = this.list[index].num
this.id = this.list[index].id
this.param.pay_type = 'wechat'
this.showPay = true
},
custom(){
if(this.custNum == '' || this.custNum <= 0){
custom() {
if (this.custNum == '' || this.custNum <= 0) {
uni.showToast({
title:'请输入正确的问野币数量',
icon:'none'
title: '请输入正确的问野币数量',
icon: 'none'
})
return
}
let flag = new RegExp("^[1-9]([0-9])*$").test(this.custNum);
if(!flag){
if (!flag) {
uni.showToast({
title:'请输入正确的问野币数量',
icon:'none'
title: '请输入正确的问野币数量',
icon: 'none'
})
return
}
this.param.number = this.custNum
this.price = this.param.number/10
this.price = this.param.number / 10
this.showPay = true
},
pay(){
this.payment()
pay() {
const that = this
uni.showLoading({
title: '检测支付环境...',
mask: true
})
plus.payment.getChannels((channels) => {
console.log('判断是否是苹果支付',channels)
for (var i in channels) {
// 判断是否苹果支付
if (channels[i].id === 'appleiap') {
that.iapChannel = channels[i]
that.requestOrder()
} else {
// that.payment()
that.requestOrder()
}
}
})
},
async payment(){
var orderInfo=await this.getOrderInfo();
async payment() {
console.log('安卓')
var orderInfo = await this.getOrderInfo();
uni.requestPayment({
provider: this.param.pay_type == 'wechat' ? 'wxpay' : 'alipay',
orderInfo: this.param.pay_type == 'wechat' ? orderInfo.data : orderInfo.data.body,//this.param.pay_type == 'wechat' ? JSON.stringify(orderInfo.data) : orderInfo.data, //微信、支付宝订单数据
success: (e) => {
provider: this.param.pay_type == 'wechat' ? 'wxpay' : 'alipay',
orderInfo: this.param.pay_type == 'wechat' ? orderInfo.data : orderInfo.data
.body, //this.param.pay_type == 'wechat' ? JSON.stringify(orderInfo.data) : orderInfo.data, //微信、支付宝订单数据
success: (e) => {
uni.navigateBack({
delta:1
delta: 1
})
setTimeout(()=>{
setTimeout(() => {
uni.showToast({
title:'充值成功'
title: '充值成功'
})
},500)
},
fail: function (err) {
console.log('充值失败',err)
}, 500)
},
fail: function(err) {
console.log('充值失败', err)
}
});
},
getOrderInfo(){
return new Promise((reslove)=>{
this.$request('/wallet/recharge',this.param).then((res)=>{
console.log('充值问野币',res)
requestOrder() {
const that = this
// ['xxxxx'] 是平台申请拿到的内购商品的id
console.log('苹果支付')
that.iapChannel.requestOrder([this.id],
function(event) {
uni.hideLoading()
console.log('苹果支付',event)
for (var index in event) {
var OrderItem = event[index]
console.log(OrderItem)
that.topay(OrderItem.productid)
}
},
function(erroemsg) {
uni.hideLoading()
uni.showToast({
title: "获取支付通道失败:" + errormsg.message,
icon: 'none'
})
})
},
topay(id) {
const that = this
uni.showLoading({
title: '充值中请勿离开',
mask: true
})
uni.requestPayment({
provider: 'appleiap',
orderInfo: {
productid: id
},
success: (res => {
uni.hideLoading()
var orderInfo = this.getOrderInfo();
}),
fail: (e) => {
uni.hideLoading()
uni.showModal({
content: "支付失败",
showCancel: false
})
}
})
},
getOrderInfo() {
return new Promise((reslove) => {
this.$request('/wallet/recharge', this.param).then((res) => {
console.log('充值问野币', res)
reslove(res)
})
})
... ... @@ -145,42 +234,65 @@
</script>
<style lang="scss" scoped>
page{background: #f8f8f9;}
.topLine{height: 2rpx;background: rgba(25,24,51,0.06);}
.recList{
padding:0 32rpx;
page {
background: #f8f8f9;
}
.topLine {
height: 2rpx;
background: rgba(25, 24, 51, 0.06);
}
.recList {
padding: 0 32rpx;
display: flex;
flex-wrap: wrap;
.recItem{
.recItem {
width: 218rpx;
height: 240rpx;
background: #ffffff;
border-radius: 24rpx;
box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(0,0,0,0.06);
margin:24rpx 16rpx 0 0;
.recVal{
padding-top: 64rpx;
display: flex;
justify-content: center;
align-items: center;
color: #4a8b94;
text{font-size: 40rpx;}
box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(0, 0, 0, 0.06);
margin: 24rpx 16rpx 0 0;
.recVal {
padding-top: 64rpx;
display: flex;
justify-content: center;
align-items: center;
color: #4a8b94;
text {
font-size: 40rpx;
}
}
.recPrice{
.recPrice {
padding-top: 16rpx;
text-align: center;
font-size: 28rpx;
}
}
.recItem:nth-of-type(3n){margin-right: 0;}
.recItem:nth-of-type(3n) {
margin-right: 0;
}
}
.agreeCont{
checkbox{transform: scale(0.7);}
.agreeCont {
checkbox {
transform: scale(0.7);
}
padding-top: 42rpx;
font-size: 28rpx;
display: flex;
align-items: center;
justify-content: center;
text{color: #4a8b94;}
text {
color: #4a8b94;
}
}
</style>
... ...