Commit db441034 authored by 罗林杰's avatar 罗林杰

修改余额不足弹窗

parent fe0692b4
...@@ -20,11 +20,16 @@ ...@@ -20,11 +20,16 @@
</view> </view>
</view> </view>
</view> </view>
<ELM ref="elm" :msg="tipMsg" :isConfirm="isConfirm" @confirm="confirm"></ELM>
</view> </view>
</template> </template>
<script> <script>
import {publishArticle} from '../api/article/index' import {publishArticle} from '../api/article/index'
import ELM from '@/components/elm-toast/index.vue';
import {getDict} from "../api/system/dict/data";
export default { export default {
data() { data() {
return { return {
...@@ -39,10 +44,15 @@ ...@@ -39,10 +44,15 @@
h: 0, h: 0,
focus: false, focus: false,
isLoginPop: false, isLoginPop: false,
//动态字典配置
articleOptions:{},
//话题id //话题id
topicId:null, topicId:null,
} }
}, },
components: {
ELM
},
computed: { computed: {
heightFn() { heightFn() {
return `${this.h}px` return `${this.h}px`
...@@ -50,6 +60,7 @@ ...@@ -50,6 +60,7 @@
}, },
onLoad(value){ onLoad(value){
this.topicId = value.topicId this.topicId = value.topicId
this.getArticleDict()
}, },
methods: { methods: {
//发布 //发布
...@@ -64,7 +75,9 @@ ...@@ -64,7 +75,9 @@
const params = { const params = {
content:this.content, content:this.content,
pictureId: JSON.stringify(this.uploadImgJSON), pictureId: JSON.stringify(this.uploadImgJSON),
topicId:this.topicId topicId:this.topicId,
wxOpenid: uni.getStorageSync('userInfo').wxOpenid,
isPay: '0'
} }
//将params转成json //将params转成json
publishArticle(params).then( res => { publishArticle(params).then( res => {
...@@ -79,19 +92,59 @@ ...@@ -79,19 +92,59 @@
url: '/pages/tab/article', url: '/pages/tab/article',
}); });
},1000) },1000)
} else { } else if (res.data.code === 1002){
//留言超出限制 是否采用金币进行留言
uni.showModal({
title: '提示',
content: '已超出免费发动态次数,是否花费'+ this.payCount +'金币再进行发布',
success: (res) => {
if (res.confirm) {
const form = {
content:this.content,
pictureId: JSON.stringify(this.uploadImgJSON),
topicId:this.topicId,
wxOpenid: uni.getStorageSync('userInfo').wxOpenid,
isPay: '1'
}
publishArticle(form).then(res=>{
if (res.data.code == 200){
uni.showToast({
title: '发表成功',
icon: 'success'
})
uni.setStorageSync("isRefresh", true)
setTimeout(() => {
uni.switchTab({
url: '/pages/tab/article',
});
},1000)
} else if (res.data.code === 1003) {
this.isConfirm = true;
this.tipMsg = res.data.message;
this.$refs.elm.showDialog();
}
})
} else if (res.cancel) {
}
}
});
} else if(res.data.code === 1001){
uni.showToast({ uni.showToast({
title: '发表失败,请稍后再试', title: res.data.message,
icon: 'error' icon: 'none'
}) })
setTimeout(() => {
uni.switchTab({
url: '/pages/tab/article'
});
},1000)
} }
}) })
}, },
//获取动态字典配置
getArticleDict(){
getDict('article_config').then(res=> {
this.articleOptions = res.data.data
//过滤出dictLabel等于pay_count的dictValue
this.payCount = this.articleOptions.find(item => item.dictLabel === 'pay_count').dictValue;
})
},
// 删除图片 // 删除图片
deletePic(event) { deletePic(event) {
this[`fileList${event.name}`].splice(event.index, 1) this[`fileList${event.name}`].splice(event.index, 1)
...@@ -144,6 +197,9 @@ ...@@ -144,6 +197,9 @@
}, },
confirm() { confirm() {
this.isConfirm = false; this.isConfirm = false;
uni.navigateTo({
url: "/pagesme/goldCoin/recharge"
})
}, },
focusFn(e) { focusFn(e) {
this.h = e.detail.height this.h = e.detail.height
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment