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

修改余额不足弹窗

parent fe0692b4
......@@ -20,11 +20,16 @@
</view>
</view>
</view>
<ELM ref="elm" :msg="tipMsg" :isConfirm="isConfirm" @confirm="confirm"></ELM>
</view>
</template>
<script>
import {publishArticle} from '../api/article/index'
import ELM from '@/components/elm-toast/index.vue';
import {getDict} from "../api/system/dict/data";
export default {
data() {
return {
......@@ -39,10 +44,15 @@
h: 0,
focus: false,
isLoginPop: false,
//动态字典配置
articleOptions:{},
//话题id
topicId:null,
}
},
components: {
ELM
},
computed: {
heightFn() {
return `${this.h}px`
......@@ -50,6 +60,7 @@
},
onLoad(value){
this.topicId = value.topicId
this.getArticleDict()
},
methods: {
//发布
......@@ -64,7 +75,9 @@
const params = {
content:this.content,
pictureId: JSON.stringify(this.uploadImgJSON),
topicId:this.topicId
topicId:this.topicId,
wxOpenid: uni.getStorageSync('userInfo').wxOpenid,
isPay: '0'
}
//将params转成json
publishArticle(params).then( res => {
......@@ -79,19 +92,59 @@
url: '/pages/tab/article',
});
},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({
title: '发表失败,请稍后再试',
icon: 'error'
title: res.data.message,
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) {
this[`fileList${event.name}`].splice(event.index, 1)
......@@ -144,6 +197,9 @@
},
confirm() {
this.isConfirm = false;
uni.navigateTo({
url: "/pagesme/goldCoin/recharge"
})
},
focusFn(e) {
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