diff --git a/api/rumor.js b/api/rumor.js
index e57f831..4db966c 100644
--- a/api/rumor.js
+++ b/api/rumor.js
@@ -1,21 +1,22 @@
// 谣言相关接口
import fetch from '@/common/fetch.js';
-import BASE_URL from './base1.js';
+// import BASE_URL from './base.js';
+const BASE_URL = 'http://xjwljb.blueapp.com.cn:8080/report_xj/frontAPI'
-const LIST = BASE_URL + '/businessRumor/list'
+const LIST = BASE_URL + '/achieveRumorList'
const Vote = BASE_URL + '/businessVoteRecord/isVote'
-const Add = BASE_URL + '/businessVoteRecord/add'
+const Add = BASE_URL + '/voteRumor'
// 谣言列表
-export function getRumorList(data) {
- return fetch.post(LIST, data).then(res => res);
+export function getRumorList() {
+ return fetch.post(LIST).then(res => res);
}
// 用户是否投票
-export function isVote(data) {
- return fetch.post(Vote, data).then(res => res);
-}
+// export function isVote(data) {
+// return fetch.post(Vote, data).then(res => res);
+// }
// 用户投票
export function addVote(data) {
- return fetch.post(Add, data).then(res => res);
+ return fetch.post(Add, data, {}, {'Content-Type': 'application/x-www-form-urlencoded'}).then(res => res);
}
diff --git a/api/rumor.js b/api/rumor.js
index e57f831..4db966c 100644
--- a/api/rumor.js
+++ b/api/rumor.js
@@ -1,21 +1,22 @@
// 谣言相关接口
import fetch from '@/common/fetch.js';
-import BASE_URL from './base1.js';
+// import BASE_URL from './base.js';
+const BASE_URL = 'http://xjwljb.blueapp.com.cn:8080/report_xj/frontAPI'
-const LIST = BASE_URL + '/businessRumor/list'
+const LIST = BASE_URL + '/achieveRumorList'
const Vote = BASE_URL + '/businessVoteRecord/isVote'
-const Add = BASE_URL + '/businessVoteRecord/add'
+const Add = BASE_URL + '/voteRumor'
// 谣言列表
-export function getRumorList(data) {
- return fetch.post(LIST, data).then(res => res);
+export function getRumorList() {
+ return fetch.post(LIST).then(res => res);
}
// 用户是否投票
-export function isVote(data) {
- return fetch.post(Vote, data).then(res => res);
-}
+// export function isVote(data) {
+// return fetch.post(Vote, data).then(res => res);
+// }
// 用户投票
export function addVote(data) {
- return fetch.post(Add, data).then(res => res);
+ return fetch.post(Add, data, {}, {'Content-Type': 'application/x-www-form-urlencoded'}).then(res => res);
}
diff --git a/common/fetch.js b/common/fetch.js
index ba307c4..cb24537 100644
--- a/common/fetch.js
+++ b/common/fetch.js
@@ -35,10 +35,14 @@
},
success(data) {
if (data.statusCode === 200) {
+ // console.log(data, 'datadatadata')
+ if(data.data.result === '200') {
+ resolve(data.data.info);
+ }
if (data.data.status === 1 || data.data.code === 200 || data.data.status ==='1') {
if(data.data.message === '网址未重复') {
wx.setStorageSync('isRepeat', 'false')
- }
+ }
if (data.data.status === 1) {
resolve(data.data.data ? data.data.data : data.data);
} else {
@@ -84,7 +88,7 @@
}
},
fail(err) {
- console.log('fail', err)
+ console.log('fail', err)
reject(err);
},
...otherParams,
diff --git a/api/rumor.js b/api/rumor.js
index e57f831..4db966c 100644
--- a/api/rumor.js
+++ b/api/rumor.js
@@ -1,21 +1,22 @@
// 谣言相关接口
import fetch from '@/common/fetch.js';
-import BASE_URL from './base1.js';
+// import BASE_URL from './base.js';
+const BASE_URL = 'http://xjwljb.blueapp.com.cn:8080/report_xj/frontAPI'
-const LIST = BASE_URL + '/businessRumor/list'
+const LIST = BASE_URL + '/achieveRumorList'
const Vote = BASE_URL + '/businessVoteRecord/isVote'
-const Add = BASE_URL + '/businessVoteRecord/add'
+const Add = BASE_URL + '/voteRumor'
// 谣言列表
-export function getRumorList(data) {
- return fetch.post(LIST, data).then(res => res);
+export function getRumorList() {
+ return fetch.post(LIST).then(res => res);
}
// 用户是否投票
-export function isVote(data) {
- return fetch.post(Vote, data).then(res => res);
-}
+// export function isVote(data) {
+// return fetch.post(Vote, data).then(res => res);
+// }
// 用户投票
export function addVote(data) {
- return fetch.post(Add, data).then(res => res);
+ return fetch.post(Add, data, {}, {'Content-Type': 'application/x-www-form-urlencoded'}).then(res => res);
}
diff --git a/common/fetch.js b/common/fetch.js
index ba307c4..cb24537 100644
--- a/common/fetch.js
+++ b/common/fetch.js
@@ -35,10 +35,14 @@
},
success(data) {
if (data.statusCode === 200) {
+ // console.log(data, 'datadatadata')
+ if(data.data.result === '200') {
+ resolve(data.data.info);
+ }
if (data.data.status === 1 || data.data.code === 200 || data.data.status ==='1') {
if(data.data.message === '网址未重复') {
wx.setStorageSync('isRepeat', 'false')
- }
+ }
if (data.data.status === 1) {
resolve(data.data.data ? data.data.data : data.data);
} else {
@@ -84,7 +88,7 @@
}
},
fail(err) {
- console.log('fail', err)
+ console.log('fail', err)
reject(err);
},
...otherParams,
diff --git a/components/card.vue b/components/card.vue
index 711b968..e7153b0 100644
--- a/components/card.vue
+++ b/components/card.vue
@@ -22,22 +22,22 @@
谣言:
- {{currentShow.rumor}}
+ {{currentShow.title}}
- 来源:新疆网络举报
+ 来源:{{currentShow.source}}
-
+
真
- {{currentShow.approveRate}}
+ {{currentShow.yesNum}}
-
+
假
- {{currentShow.againstRate}}
+ {{currentShow.noNum}}
@@ -156,10 +156,10 @@
votePerson:phone ? phone : this.id // 用户唯一标识
}
// 查询用户是否投票
- isVote(params).then(res => {
- console.log(res, '查询用户是否投票')
- this.isVoteFlag = res
- })
+ // isVote(params).then(res => {
+ // console.log(res, '查询用户是否投票')
+ // this.isVoteFlag = res
+ // })
}
}
@@ -169,11 +169,11 @@
// 点击真假进行投票
async vote(flag) {
// 已经投票
- if(this.isVoteFlag) {
- uni.$u.toast('您已投过票')
- // this.next()
- return
- }
+ // if(this.isVoteFlag) {
+ // uni.$u.toast('您已投过票')
+ // // this.next()
+ // return
+ // }
// 未投票
const userinfo = wx.getStorageSync('userInfoxj')
let phone = ''
@@ -181,15 +181,16 @@
phone = await decryption(userinfo.phone)
}
const params = {
- rumorId:this.currentShow.id,
- votePerson:phone ? phone : this.id, // 用户唯一标识
- status: flag ? '1' : '0'
+ contentId:this.currentShow.contentId,
+ // votePerson:phone ? phone : this.id, // 用户唯一标识
+ flag: flag ? '1' : '2',
+ deviceUniqueCode: phone ? phone : this.id
}
addVote(params).then(res => {
console.log(res, '投票结果')
uni.$u.toast('投票成功')
// 投票成功修改 投票状态
- this.isVoteFlag = true
+ // this.isVoteFlag = true
// this.next()
})
},
diff --git a/api/rumor.js b/api/rumor.js
index e57f831..4db966c 100644
--- a/api/rumor.js
+++ b/api/rumor.js
@@ -1,21 +1,22 @@
// 谣言相关接口
import fetch from '@/common/fetch.js';
-import BASE_URL from './base1.js';
+// import BASE_URL from './base.js';
+const BASE_URL = 'http://xjwljb.blueapp.com.cn:8080/report_xj/frontAPI'
-const LIST = BASE_URL + '/businessRumor/list'
+const LIST = BASE_URL + '/achieveRumorList'
const Vote = BASE_URL + '/businessVoteRecord/isVote'
-const Add = BASE_URL + '/businessVoteRecord/add'
+const Add = BASE_URL + '/voteRumor'
// 谣言列表
-export function getRumorList(data) {
- return fetch.post(LIST, data).then(res => res);
+export function getRumorList() {
+ return fetch.post(LIST).then(res => res);
}
// 用户是否投票
-export function isVote(data) {
- return fetch.post(Vote, data).then(res => res);
-}
+// export function isVote(data) {
+// return fetch.post(Vote, data).then(res => res);
+// }
// 用户投票
export function addVote(data) {
- return fetch.post(Add, data).then(res => res);
+ return fetch.post(Add, data, {}, {'Content-Type': 'application/x-www-form-urlencoded'}).then(res => res);
}
diff --git a/common/fetch.js b/common/fetch.js
index ba307c4..cb24537 100644
--- a/common/fetch.js
+++ b/common/fetch.js
@@ -35,10 +35,14 @@
},
success(data) {
if (data.statusCode === 200) {
+ // console.log(data, 'datadatadata')
+ if(data.data.result === '200') {
+ resolve(data.data.info);
+ }
if (data.data.status === 1 || data.data.code === 200 || data.data.status ==='1') {
if(data.data.message === '网址未重复') {
wx.setStorageSync('isRepeat', 'false')
- }
+ }
if (data.data.status === 1) {
resolve(data.data.data ? data.data.data : data.data);
} else {
@@ -84,7 +88,7 @@
}
},
fail(err) {
- console.log('fail', err)
+ console.log('fail', err)
reject(err);
},
...otherParams,
diff --git a/components/card.vue b/components/card.vue
index 711b968..e7153b0 100644
--- a/components/card.vue
+++ b/components/card.vue
@@ -22,22 +22,22 @@
谣言:
- {{currentShow.rumor}}
+ {{currentShow.title}}
- 来源:新疆网络举报
+ 来源:{{currentShow.source}}
-
+
真
- {{currentShow.approveRate}}
+ {{currentShow.yesNum}}
-
+
假
- {{currentShow.againstRate}}
+ {{currentShow.noNum}}
@@ -156,10 +156,10 @@
votePerson:phone ? phone : this.id // 用户唯一标识
}
// 查询用户是否投票
- isVote(params).then(res => {
- console.log(res, '查询用户是否投票')
- this.isVoteFlag = res
- })
+ // isVote(params).then(res => {
+ // console.log(res, '查询用户是否投票')
+ // this.isVoteFlag = res
+ // })
}
}
@@ -169,11 +169,11 @@
// 点击真假进行投票
async vote(flag) {
// 已经投票
- if(this.isVoteFlag) {
- uni.$u.toast('您已投过票')
- // this.next()
- return
- }
+ // if(this.isVoteFlag) {
+ // uni.$u.toast('您已投过票')
+ // // this.next()
+ // return
+ // }
// 未投票
const userinfo = wx.getStorageSync('userInfoxj')
let phone = ''
@@ -181,15 +181,16 @@
phone = await decryption(userinfo.phone)
}
const params = {
- rumorId:this.currentShow.id,
- votePerson:phone ? phone : this.id, // 用户唯一标识
- status: flag ? '1' : '0'
+ contentId:this.currentShow.contentId,
+ // votePerson:phone ? phone : this.id, // 用户唯一标识
+ flag: flag ? '1' : '2',
+ deviceUniqueCode: phone ? phone : this.id
}
addVote(params).then(res => {
console.log(res, '投票结果')
uni.$u.toast('投票成功')
// 投票成功修改 投票状态
- this.isVoteFlag = true
+ // this.isVoteFlag = true
// this.next()
})
},
diff --git a/pages/rumor/rumor.vue b/pages/rumor/rumor.vue
index a6c1bc1..f4b7824 100644
--- a/pages/rumor/rumor.vue
+++ b/pages/rumor/rumor.vue
@@ -34,43 +34,14 @@
return {
stackList:[
{
- id:'1',
- rumor:'“0蔗糖”就是无糖?',
- approveRate:'50%',
- againstRate:'50%'
- },
- {
- id:'2',
- rumor:'水果越酸,维生素C含量越高?',
- approveRate:'60%',
- againstRate:'40%'
- },
- {
- id:'3',
- rumor:'不渴不用喝水?',
- approveRate:'81%',
- againstRate:'19%'
- },
- {
- id:'4',
- rumor:'指甲上的月牙是健康晴雨表?',
- approveRate:'66%',
- againstRate:'34%'
- },
- {
- id:'5',
- rumor:'泡面是垃圾食品有害健康?',
- approveRate:'40%',
- againstRate:'60%'
- },
- {
- id:'6',
- rumor:'草莓个头大是因为打了激素?',
- approveRate:'88%',
- againstRate:'12%'
- },
-
- ],
+ contentId: 2,
+ endtime: "12月31日 23:59",
+ noNum: 47,
+ source: "新疆网络举报",
+ title: "草莓个头大是因为打了激素",
+ yesNum: 73,
+ }
+ ],
stackInit: {
currentPage:0,
visible: 3
@@ -128,7 +99,8 @@
},
// 获取谣言列表
fetchData() {
- getRumorList({rumor:''}).then(res => {
+ getRumorList().then(res => {
+ console.log(res, '谣言列表')
this.stackList = res
}).catch(error => {
console.log(error, 'error')