Browse Source

feature:fixbug

feature-1.0
Penny 3 years ago
parent
commit
8d10f74d18
  1. 12
      api/creator.js
  2. 4
      main.js
  3. 89
      pages/creator/imgDetail.vue
  4. 33
      pages/userInfo/userInfo.vue
  5. 6
      utils/request.js

12
api/creator.js

@ -61,7 +61,7 @@ export function tiktokLike(data, headers) {
url: `${serviceTitle}${prefix}/tiktokLike`, url: `${serviceTitle}${prefix}/tiktokLike`,
method: 'post', method: 'post',
data, data,
headers: headers //headers: headers
}) })
} }
// 取消点赞 // 取消点赞
@ -70,7 +70,7 @@ export function tiktokUnLike(data, headers) {
url: `${serviceTitle}${prefix}/tiktokUnLike`, url: `${serviceTitle}${prefix}/tiktokUnLike`,
method: 'post', method: 'post',
data, data,
headers: headers //headers: headers
}) })
} }
// 收藏 // 收藏
@ -79,7 +79,7 @@ export function tiktokCollect(data, headers) {
url: `${serviceTitle}${prefix}/tiktokCollect`, url: `${serviceTitle}${prefix}/tiktokCollect`,
method: 'post', method: 'post',
data, data,
headers: headers //headers: headers
}) })
} }
// 取消收藏 // 取消收藏
@ -88,7 +88,7 @@ export function tiktokUnCollect(data, headers) {
url: `${serviceTitle}${prefix}/tiktokUnCollect`, url: `${serviceTitle}${prefix}/tiktokUnCollect`,
method: 'post', method: 'post',
data, data,
headers: headers //headers: headers
}) })
} }
@ -106,7 +106,7 @@ export function insertOrUpdatePreAdProfit(data, headers) {
url: `${serviceTitle}${prefix}/insertOrUpdatePreAdProfit`, url: `${serviceTitle}${prefix}/insertOrUpdatePreAdProfit`,
method: 'post', method: 'post',
data, data,
headers: headers //headers: headers
}) })
} }
@ -116,7 +116,7 @@ export function insertOrUpdatePreInviteProfit(data, headers) {
url: `${serviceTitle}${prefix}/insertOrUpdatePreInviteProfit`, url: `${serviceTitle}${prefix}/insertOrUpdatePreInviteProfit`,
method: 'post', method: 'post',
data, data,
headers: headers //headers: headers
}) })
} }

4
main.js

@ -1,11 +1,15 @@
import App from './App' import App from './App'
import store from './store/' import store from './store/'
//配置公共方法(防止重复提交)
import common from './utils/common.js'
// const baseURL = 'http://localhost:7010' // const baseURL = 'http://localhost:7010'
// const baseURL = 'http://81.69.47.31:7010' // const baseURL = 'http://81.69.47.31:7010'
const baseURL = 'https://service.bnyer.cn' const baseURL = 'https://service.bnyer.cn'
//const baseURL = 'http://dbb5xc.natappfree.cc'
Vue.prototype.baseURL = baseURL; Vue.prototype.baseURL = baseURL;
Vue.prototype.$noMultipleClicks = common.noMultipleClicks;
// #ifndef VUE3 // #ifndef VUE3
import Vue from 'vue' import Vue from 'vue'

89
pages/creator/imgDetail.vue

@ -8,7 +8,7 @@
<uni-icons v-if="detailMsg.isHot ==='0'" class="tool-bar-icon" custom-prefix="iconfont" :type="'icon-hot'" size="24" ></uni-icons> <uni-icons v-if="detailMsg.isHot ==='0'" class="tool-bar-icon" custom-prefix="iconfont" :type="'icon-hot'" size="24" ></uni-icons>
<uni-icons v-else class="tool-bar-icon" custom-prefix="iconfont" :type="'icon-hot'" size="24" :color="likeColor"></uni-icons> <uni-icons v-else class="tool-bar-icon" custom-prefix="iconfont" :type="'icon-hot'" size="24" :color="likeColor"></uni-icons>
</view> </view>
<view class="toolbar-box" @click="$noMultipleClicks(download,detailMsg.imgUrl)"> <view class="toolbar-box" @click="$noMultipleClicks(authDownload,detailMsg.imgUrl)">
<uni-icons v-if="isDownload" class="tool-bar-icon" custom-prefix="iconfont" :type="'icon-xiazai'" size="24" ></uni-icons> <uni-icons v-if="isDownload" class="tool-bar-icon" custom-prefix="iconfont" :type="'icon-xiazai'" size="24" ></uni-icons>
<uni-icons v-else class="tool-bar-icon" custom-prefix="iconfont" :type="'icon-xiazai'" size="24" ></uni-icons> <uni-icons v-else class="tool-bar-icon" custom-prefix="iconfont" :type="'icon-xiazai'" size="24" ></uni-icons>
<text>下载</text> <text>下载</text>
@ -86,14 +86,16 @@
if (res.from === 'button') { // if (res.from === 'button') { //
console.log(res) console.log(res)
} }
return {
title: '来看看艺术家[' + that.scanCode + ']精心准备的图片吧~',
path: `/pages/creator/imgDetail?id=${that.detailMsg.id}`,
bgImgUrl: `${that.detailMsg.imgUrl}`,
success() {
uni.showToast({ uni.showToast({
title: '分享成功', title: '分享成功',
icon: 'none', icon: 'none',
}) })
return { }
title: '来看看艺术家[' + that.scanCode + ']精心准备的图片吧~',
path: `/pages/creator/imgDetail?id=${that.detailMsg.id}`,
bgImgUrl: `${that.detailMsg.imgUrl}`
} }
}, },
methods: { methods: {
@ -140,7 +142,7 @@
imgId: this.detailMsg.id, imgId: this.detailMsg.id,
userId: this.userInfo.id userId: this.userInfo.id
} }
const res = await judgeTiktokLike(params, token) const res = await judgeTiktokLike(params,token)
if (res.data.code === 200) { if (res.data.code === 200) {
this.isLike = res.data.data this.isLike = res.data.data
} else { } else {
@ -156,7 +158,7 @@
imgId: this.detailMsg.id, imgId: this.detailMsg.id,
userId: this.userInfo.id userId: this.userInfo.id
} }
const res = await judgeTiktokCollect(params, token) const res = await judgeTiktokCollect(params,token)
if (res.data.code === 200) { if (res.data.code === 200) {
this.isCollect = res.data.data this.isCollect = res.data.data
} else { } else {
@ -166,7 +168,8 @@
}) })
} }
}, },
async lickRequest(token) {
async lickRequest() {
const params = { const params = {
imgId: this.detailMsg.id, imgId: this.detailMsg.id,
userId: this.userInfo.id userId: this.userInfo.id
@ -174,7 +177,7 @@
let isLike = this.isLike let isLike = this.isLike
if (!isLike) { if (!isLike) {
// //
const res = await tiktokLike(params, token) const res = await tiktokLike(params)
if (res.data.code === 200) { if (res.data.code === 200) {
this.isLike = !isLike this.isLike = !isLike
} else { } else {
@ -185,7 +188,7 @@
} }
} else { } else {
// //
const res = await tiktokUnLike(params, token) const res = await tiktokUnLike(params)
if (res.data.code === 200) { if (res.data.code === 200) {
this.isLike = !isLike this.isLike = !isLike
} else { } else {
@ -196,7 +199,7 @@
} }
} }
}, },
async collectRequest(token) { async collectRequest() {
const params = { const params = {
imgId: this.detailMsg.id, imgId: this.detailMsg.id,
userId: this.userInfo.id userId: this.userInfo.id
@ -204,7 +207,7 @@
let isCollect = this.isCollect let isCollect = this.isCollect
if (!isCollect) { if (!isCollect) {
// //
const res = await tiktokCollect(params, token) const res = await tiktokCollect(params)
if (res.data.code === 200) { if (res.data.code === 200) {
this.isCollect = !isCollect this.isCollect = !isCollect
} else { } else {
@ -215,7 +218,7 @@
} }
} else { } else {
// //
const res = await tiktokUnCollect(params, token) const res = await tiktokUnCollect(params)
if (res.data.code === 200) { if (res.data.code === 200) {
this.isCollect = !isCollect this.isCollect = !isCollect
} else { } else {
@ -226,18 +229,19 @@
} }
} }
}, },
async lickOrCollect(val, token) { async lickOrCollect(val) {
if (val === 'isLike') { if (val === 'isLike') {
await this.lickRequest(token); await this.lickRequest();
} else if (val === 'isCollect') { } else if (val === 'isCollect') {
await this.collectRequest(token); await this.collectRequest();
} }
}, },
// / // /
likeCollect(val) { likeCollect(val) {
if (!this.userInfo) { if (!this.userInfo) {
this.getUserInfoLogin((token) => { this.getUserInfoLogin(res => {
this.lickOrCollect(val, token) succ
this.lickOrCollect(val)
}) })
} else { } else {
this.lickOrCollect(val) this.lickOrCollect(val)
@ -257,6 +261,7 @@
data: res.data.data.userInfo, data: res.data.data.userInfo,
}) })
this.userInfo = res.data.data.userInfo; this.userInfo = res.data.data.userInfo;
console.log('this.userInfo',this.userInfo)
uni.setStorage({ uni.setStorage({
key: 'token', key: 'token',
data: res.data.data.access_token data: res.data.data.access_token
@ -289,20 +294,8 @@
success: async (userInfo) => { success: async (userInfo) => {
await this.loginFunc(res, userInfo, callBack) await this.loginFunc(res, userInfo, callBack)
}, },
complete: () => {
},
fail: (errMsg) => {
}
}) })
}, },
complete: () => {
},
fail: (errMsg) => {
}
}) })
} else { } else {
uni.showModal({ uni.showModal({
@ -321,26 +314,11 @@
success: async (userInfo) => { success: async (userInfo) => {
await this.loginFunc(res, userInfo, callBack) await this.loginFunc(res, userInfo, callBack)
}, },
complete: () => {
},
fail: (errMsg) => {
}
}) })
}, },
complete: () => {
},
fail: (errMsg) => {
}
}) })
} }
}, },
fail: () => {
}
}) })
} else if (res.cancel) { } else if (res.cancel) {
console.log('用户点击取消'); console.log('用户点击取消');
@ -352,7 +330,7 @@
}) })
}, },
//广 //广
async insertPreAdProfit(token) { async insertPreAdProfit() {
let that = this; let that = this;
const params = { const params = {
imgId: that.detailMsg.id, imgId: that.detailMsg.id,
@ -362,7 +340,7 @@
appType: '0', appType: '0',
platform: '0' platform: '0'
} }
const res = await insertOrUpdatePreAdProfit(params, token); const res = await insertOrUpdatePreAdProfit(params);
if (res.data.code === 200) { if (res.data.code === 200) {
console.log("写入广告收益成功!") console.log("写入广告收益成功!")
that.adResult = res.data.code; that.adResult = res.data.code;
@ -375,7 +353,7 @@
}, },
// //
async insertPreInviteProfit(token) { async insertPreInviteProfit() {
let that = this; let that = this;
const params = { const params = {
imgId: that.detailMsg.id, imgId: that.detailMsg.id,
@ -384,7 +362,7 @@
appType: '0', appType: '0',
platform: '0' platform: '0'
} }
const res = await insertOrUpdatePreInviteProfit(params, token) const res = await insertOrUpdatePreInviteProfit(params)
if (res.data.code === 200) { if (res.data.code === 200) {
// console.log(""); // console.log("");
that.inviteResult = res.data.code; that.inviteResult = res.data.code;
@ -403,7 +381,7 @@
appType: '0', appType: '0',
platform: '0' platform: '0'
} }
const res = await checkUserCanDownload(params, token); const res = await checkUserCanDownload(params,token);
if (res.data.code === 200) { if (res.data.code === 200) {
console.log("当日下载结果为", res.data.data) console.log("当日下载结果为", res.data.data)
this.canDownload = res.data.data; this.canDownload = res.data.data;
@ -416,15 +394,15 @@
}, },
authDownload(url) { authDownload(url) {
if (!this.userInfo) { if (!this.userInfo) {
this.getUserInfoLogin((token) => { this.getUserInfoLogin(() => {
this.download(url, token) this.download(url)
}) })
} else { } else {
this.download(url) this.download(url)
} }
}, },
// //
download(url, token) { download(url) {
let that = this; let that = this;
if (that.canDownload !== true) { if (that.canDownload !== true) {
// //
@ -471,8 +449,9 @@
title: "下载成功!", title: "下载成功!",
icon: 'none', icon: 'none',
success() { success() {
that.insertPreAdProfit(token); //
that.insertPreInviteProfit(token); that.insertPreAdProfit();
that.insertPreInviteProfit();
} }
}); });
} }

33
pages/userInfo/userInfo.vue

@ -73,9 +73,6 @@ import UniIcons from "../../uni_modules/uni-icons/components/uni-icons/uni-icons
] ]
} }
}, },
// onReady() {
// //this.userInfo = uni.getStorageSync('userInfo')
// },
onShow(){ onShow(){
this.userInfo = uni.getStorageSync('userInfo') this.userInfo = uni.getStorageSync('userInfo')
}, },
@ -102,6 +99,7 @@ import UniIcons from "../../uni_modules/uni-icons/components/uni-icons/uni-icons
key: 'userInfo', key: 'userInfo',
data: res.data.data.userInfo, data: res.data.data.userInfo,
}) })
//
this.userInfo = res.data.data.userInfo; this.userInfo = res.data.data.userInfo;
uni.setStorage({ uni.setStorage({
key: 'token', key: 'token',
@ -109,7 +107,7 @@ import UniIcons from "../../uni_modules/uni-icons/components/uni-icons/uni-icons
success() { success() {
uni.showToast({ uni.showToast({
title: '登录成功!', title: '登录成功!',
icon: 'none' icon: 'none',
}) })
} }
}) })
@ -134,20 +132,8 @@ import UniIcons from "../../uni_modules/uni-icons/components/uni-icons/uni-icons
success: (userInfo) => { success: (userInfo) => {
this.loginFunc(res, userInfo) this.loginFunc(res, userInfo)
}, },
complete: () => {
},
fail: (errMsg) => {
}
}) })
}, },
complete: () => {
},
fail: (errMsg) => {
}
}) })
} else { } else {
uni.showModal({ uni.showModal({
@ -166,26 +152,11 @@ import UniIcons from "../../uni_modules/uni-icons/components/uni-icons/uni-icons
success: (userInfo) => { success: (userInfo) => {
this.loginFunc(res, userInfo) this.loginFunc(res, userInfo)
}, },
complete: () => {
},
fail: (errMsg) => {
}
}) })
}, },
complete: () => {
},
fail: (errMsg) => {
}
}) })
} }
}, },
fail: () => {
}
}) })
} else if (res.cancel) { } else if (res.cancel) {
console.log('用户点击取消'); console.log('用户点击取消');

6
utils/request.js

@ -141,12 +141,8 @@ service.interceptors.request.use(
service.interceptors.response.use(res => { service.interceptors.response.use(res => {
if (res.data.code === 200) { if (res.data.code === 200) {
return res return res
} else if (res.data.code === 401) {
//登录过期,刷新token
refreshToken();
//return Promise.reject(res.data.msg);
}else{ }else{
return res; return Promise.reject(res.data.msg);
} }
}, error => { }, error => {
if(error.response.status === 401){ if(error.response.status === 401){

Loading…
Cancel
Save