Browse Source

feature-hub-1.0:fix bug

feature-1.0
‘‘ 3 years ago
parent
commit
7b577900da
  1. 2
      main.js
  2. 38
      pages/index/index.vue
  3. 490
      pages/index/material/imgDetail.vue
  4. 248
      pages/index/material/material.vue
  5. 20
      pages/userInfo/userInfo.vue
  6. BIN
      static/emoBack.png
  7. BIN
      static/friendBack.png
  8. BIN
      static/gifBack.png
  9. BIN
      static/headBack.png
  10. BIN
      static/iconAbout.png
  11. BIN
      static/iconContactUs.png
  12. BIN
      static/iconInvite.png
  13. BIN
      static/iconInviteLog.png
  14. BIN
      static/iconNotice.png
  15. BIN
      static/iconWithdraw.png
  16. BIN
      static/iwatchBack.png
  17. BIN
      static/material.png
  18. BIN
      static/phoneBack.png
  19. BIN
      static/upload.png

2
main.js

@ -4,7 +4,7 @@ import store from './store/'
// const baseURL = 'http://localhost:7010'
//const baseURL = 'http://81.69.47.31:7010'
// const baseURL = 'http://bnyer.vaiwan.com'
const baseURL = 'http://av9r46.natappfree.cc'
const baseURL = 'http://9fkisg.natappfree.cc'
Vue.prototype.$baseURL = baseURL;

38
pages/index/index.vue

@ -20,7 +20,8 @@
<uni-grid :column="2" :square="true" :highlight="false" @change="change" :showBorder="true">
<uni-grid-item v-for="(val, i) in funcList" :index="i" :key="i">
<view class="grid-item-box">
<uni-icons type="image" :size="30" color="#777" />
<!-- <uni-icons type="image" :size="30" color="#777" /> -->
<image :src="val.icon" class="iconImage" mode="aspectFill" />
<text class="text">{{ val.title }}</text>
</view>
</uni-grid-item>
@ -33,7 +34,8 @@
<uni-grid :column="3" :square="true" :highlight="false">
<uni-grid-item v-for="(params, v) in list" :index="v" :key="v">
<view class="grid-item-box">
<uni-icons type="image" :size="30" color="#777" />
<!-- <uni-icons type="image" :size="30" color="#777" /> -->
<image :src="params.icon" class="listIconImage" mode="aspectFill" />
<text class="text">{{ params.text }}</text>
<text class="text">{{ params.num }}</text>
</view>
@ -63,40 +65,48 @@
pageUrl:'',
funcList: [{
title: '素材管理',
url: '/pages/index/material/material'
url: '/pages/index/material/material',
icon: '/static/material.png'
}, {
title: '上传素材',
url: '/pages/index/upload/upload'
url: '/pages/index/upload/upload',
icon: '/static/upload.png'
}],
list: [{
typeId: 1,
text: '头像',
num: ''
num: '',
icon: '/static/headBack.png'
},
{
typeId: 2,
text: 'Gif动图',
num: ''
num: '',
icon: '/static/gifBack.png'
},
{
typeId: 3,
text: '手机壁纸',
num: ''
num: '',
icon: '/static/phoneBack.png'
},
{
typeId: 4,
text: '朋友圈',
num: '',
icon: '/static/friendBack.png'
},
{
typeId: 5,
text: '表情包',
num: ''
num: '',
icon: '/static/emoBack.png'
},
{
typeId: 6,
text: 'iwatch',
num: ''
num: '',
icon: '/static/iwatchBack.png'
}
]
};
@ -269,4 +279,14 @@
background-color: #007aff;
}
.iconImage{
width:3rem;
height:3rem;
}
.listIconImage{
width:2rem;
height:2rem;
}
</style>

490
pages/index/material/imgDetail.vue

@ -0,0 +1,490 @@
<template>
<view class="imgDetail">
<image class="main-img" :src="detailMsg.imgUrl" mode=""></image>
<view class="toolbar">
<view class="toolbar-box">
<image v-if="detailMsg.isHot ==='0'" src="../../static/hot-not.png" mode=""></image>
<image v-else src="../../static/hot-yes.png" mode=""></image>
</view>
<view class="toolbar-box" @click="download(detailMsg.imgUrl)">
<image v-if="isDownload" src="../../static/download-select.png" mode=""></image>
<image v-else src="../../static/download.png" mode=""></image>
<text>下载</text>
</view>
<view class="toolbar-box" @click="likeCollect('isLike')">
<image v-if="isLike" src="../../static/like-select.png" mode=""></image>
<image v-else src="../../static/like.png" mode=""></image>
<text>喜欢</text>
</view>
<view class="toolbar-box" @click="likeCollect('isCollect')">
<image v-if="isCollect" src="../../static/collect-select.png" mode=""></image>
<image v-else src="../../static/collect.png" mode=""></image>
<text>收藏</text>
</view>
<view class="toolbar-box share-box">
<button open-type="share">
<image src="../../static/share.png" mode=""></image>
<text>分享</text>
</button>
</view>
</view>
</view>
</template>
<script>
import {
detailsTiktokImg, //
judgeTiktokLike, //
judgeTiktokCollect, //
tiktokLike, //
tiktokUnLike, //
tiktokCollect, //
tiktokUnCollect, //
queryCreatorScanCodeById, //
insertOrUpdatePreAdProfit, ///广
insertOrUpdatePreInviteProfit, // /
checkUserCanDownload //
} from '@/api/creator.js'
export default {
data() {
return {
detailMsg: {}, //
userInfo: {}, //
isDownload: false, //
isLike: false, // /
isCollect: false, // ,
scanCode: undefined, //
canDownload: false // false
}
},
created() {
const detailId = uni.getStorageSync('detailId')
if (detailId) {
this.getImgDetail(detailId)
} else {
this.getImgDetail(detailId)
}
},
onShareAppMessage(res) {
if (res.from === 'button') { //
console.log(res)
}
return {
title: '来看看艺术家[' + this.scanCode + ']精心准备的图片吧~',
path: `/pages/creator/imgDetail?id=${this.userInfo.id}`,
bgImgUrl: `${this.detailMsg.imgUrl}`
}
uni.showToast({
title: '分享成功',
icon: 'none'
})
},
methods: {
//
async getImgDetail(id) {
const res = await detailsTiktokImg(id)
console.log('res', res)
if (res.data.code === 200) {
this.detailMsg = res.data.data
console.log('图片详情', res)
const result = await queryCreatorScanCodeById(this.detailMsg.creatorId)
if (result.data.code === 200) {
this.scanCode = result.data.data.scanCode
} else {
uni.showToast({
title: '该艺术家不存在!',
icon: 'none'
})
}
uni.getStorage({
key: 'userInfo',
success: res => {
this.userInfo = res.data
console.log('userInfo', this.userInfo)
this.searchIsLike()
this.searchisCollect()
this.checkUserDownload()
}
})
} else {
uni.showToast({
title: '请输入艺术家代号',
icon: 'none'
})
}
},
//
async searchIsLike() {
const params = {
imgId: this.detailMsg.id,
userId: this.userInfo.id
}
console.log('params', this.detailMsg, params)
const res = await judgeTiktokLike(params)
if (res.data.code === 200) {
this.isLike = res.data.data
} else {
uni.showToast({
title: res.data.msg,
icon: 'none'
})
}
},
//
async searchisCollect() {
const params = {
imgId: this.detailMsg.id,
userId: this.userInfo.id
}
const res = await judgeTiktokCollect(params)
if (res.data.code === 200) {
this.isCollect = res.data.data
} else {
uni.showToast({
title: res.data.msg,
icon: 'none'
})
}
},
// /
async likeCollect(val) {
const params = {
imgId: this.detailMsg.id,
userId: this.userInfo.id
}
if (val === 'isLike') {
this.isLike = !this.isLike
console.log('this.isLike', this.isLike)
if (this.isLike) {
//
console.log('点赞')
const res = await tiktokLike(params)
if (res.data.code === 200) {} else {
uni.showToast({
title: res.data.msg,
icon: 'none'
})
}
} else {
//
console.log('取消点赞')
const res = await tiktokUnLike(params)
if (res.data.code === 200) {} else {
uni.showToast({
title: res.data.msg,
icon: 'none'
})
}
}
} else if (val === 'isCollect') {
this.isCollect = !this.isCollect
if (this.isCollect) {
//
console.log('收藏')
const res = await tiktokCollect(params)
if (res.data.code === 200) {} else {
uni.showToast({
title: res.data.msg,
icon: 'none'
})
}
} else {
//
console.log('取消收藏')
const res = await tiktokUnCollect(params)
if (res.data.code === 200) {} else {
uni.showToast({
title: res.data.msg,
icon: 'none'
})
}
}
}
},
//广
async insertPreAdProfit() {
const params = {
imgId: this.detailMsg.id,
creatorId: this.detailMsg.creatorId,
scanCode: this.scanCode,
userId: this.userInfo.id,
appType: '0',
platform: '0'
}
const res = await insertOrUpdatePreAdProfit(params);
if (res.data.code === 200) {
console.log("写入广告收益成功!")
this.adResult = res.data.code;
} else {
uni.showToast({
title: '图片下载失败!',
icon: 'none'
})
}
},
//
async insertPreInviteProfit() {
const params = {
imgId: this.detailMsg.id,
creatorId: this.detailMsg.creatorId,
scanCode: this.scanCode,
appType: '0',
platform: '0'
}
const res = await insertOrUpdatePreInviteProfit(params)
if (res.data.code === 200) {
console.log("写入邀请收益成功");
this.inviteResult = res.data.code;
} else {
uni.showToast({
title: '图片下载失败!',
icon: 'none'
})
}
},
//
async checkUserDownload() {
const params = {
userId: this.userInfo.id,
appType: '0',
platform: '0'
}
const res = await checkUserCanDownload(params);
if (res.data.code === 200) {
console.log("当日下载结果为", res.data.data)
this.canDownload = res.data.data;
} else {
uni.showToast({
title: '检查下载状态失败!',
icon: 'none'
})
}
},
//
download(url) {
let that = this;
if (this.canDownload != true) {
//
this.isDownload = true
uni.showLoading({
title: '正在保存图片...'
});
//
uni.getSetting({
success: (res) => {
//
if (!res.authSetting["scope.writePhotosAlbum"]) {
//
tt.authorize({
scope: "scope.album",
success: () => {
//
uni.downloadFile({
url,
success: (res) => {
console.log('下载路径', res)
if (res.statusCode === 200) {
uni.saveImageToPhotosAlbum({
//
filePath: res
.tempFilePath,
success: (res) => {
console.log(
'success',
res)
},
fail: (res) => {
console.log(
'fail',
res)
return uni
.showToast({
title: res
.errMsg,
icon: 'none'
});
},
complete: (res) => {
uni
.hideLoading();
if (res
.errMsg !==
"saveImageToPhotosAlbum:ok"
) {
return uni
.showToast({
title: "下载失败!",
icon: 'none'
});
} else {
return uni
.showToast({
title: "下载成功!",
icon: 'none',
success() {
that.insertPreAdProfit();
that.insertPreInviteProfit();
}
});
}
},
});
} else {
uni.showToast({
title: "下载失败!",
icon: 'none'
});
}
}
})
},
//
fail: () => {
uni.hideLoading();
uni.showModal({
title: "您已拒绝获取相册权限",
content: "是否进入权限管理,调整授权?",
success: (res) => {
if (res.confirm) {
//
uni.openSetting({
success: (
res) => {
console
.log(
res
.authSetting
);
},
});
} else if (res.cancel) {
return uni.showToast({
title: "已取消!",
icon: 'none'
});
}
},
});
},
});
} else {
//
uni.saveImageToPhotosAlbum({
filePath: url,
success: (res) => {
uni.hideLoading();
return uni.showToast({
title: "保存成功!",
icon: 'none'
});
},
fail: (res) => {
uni.hideLoading();
console.log(res.errMsg);
return uni.showToast({
title: res.errMsg,
icon: 'none'
});
},
//
complete: (res) => {
uni.hideLoading();
},
});
}
},
fail: (res) => {},
});
} else {
// canDownloadtrue
uni.showToast({
title: '当日下载次数已用完,请明日再来!',
icon: 'none'
})
}
},
//
share() {
uni.showToast({
title: '分享',
icon: 'none'
})
},
}
}
</script>
<style lang="less">
.imgDetail {
height: 100vh;
width: 100vw;
overflow: hidden;
position: relative;
.main-img {
width: 100%;
height: 100%;
}
.toolbar {
width: 60px;
background-color: rgba(255, 255, 255, 0.2);
position: absolute;
bottom: 76px;
right: 10px;
border-radius: 60px;
padding-top: 40rpx;
.share-box {
>button {
line-height: 0 !important;
padding: 0;
outline: none;
background: none;
border: none;
}
>button::after {
border: none;
}
}
.toolbar-box {
height: 60px;
text-align: center;
margin-bottom: 40rpx;
text {
display: block;
text-align: center;
line-height: 60rpx;
font-size: 12px;
}
image {
width: 50rpx;
height: 50rpx;
margin: 0 auto;
}
}
.toolbar-box:first-child {
line-height: 40rpx;
height: 40rpx;
}
}
}
</style>

248
pages/index/material/material.vue

@ -1,15 +1,21 @@
<template>
<view>
<view class="choiceness">
<uni-segmented-control :current="statusCurrent" :values="statusList" :style-type="styleType"
:active-color="activeColor" @clickItem="onClickStatus" />
<uni-segmented-control :current="ttypeCurrent" :values="typeList" :style-type="styleType"
<uni-segmented-control :current="typeCurrent" :values="typeList" :style-type="styleType"
:active-color="activeColor" @clickItem="onClickType" />
<view class="choiceness-list">
<image v-for="(item,index) in creatorImgList" :key='index' class="img-box"
:style="'width:'+imgWidth+';height:'+imgHeight" :src="item.imgUrl" @click="targetDetail(item)"
mode=""></image>
<view class="ivOver" v-if="flag">-----已经到底啦-----</view>
</view>
</view>
</template>
<script>
import {
onlineOrOfflineImg
listType,listTiktokImgIn
} from '@/api/index.js'
export default {
data() {
@ -17,21 +23,247 @@
statusCurrent: 0,
activeColor: '#007aff',
styleType: 'text',
statusList: ['已上架', '已下架','待审核','审核通过','审核未通过'],
typeList:['头像','Gif动图','手机壁纸','朋友圈','表情包','iwatch'],
statusList: ['待审核','审核拒绝','已上架','已下架'],
typeList:[],
typeIdList:[],
typeCurrent: 0,
typeId: 1,
status: 0,
pageNum: 1,
pageSize: 10,
creatorImgList: [],
userInfo: {},
imgWidth: 0, //
imgHeight: 0, //
flag: false
}
},
onLoad() {
this.listTiktokImgIn();
},
created(){
const userInfoSync = uni.getStorageSync("userInfo");
this.userInfo = userInfoSync;
this.queryListType();
uni.getSystemInfo({
success: res => {
console.log(res)
this.imgWidth = res.windowWidth - 130 + 'rpx'
this.imgHeight = res.windowWidth - 130 + 'rpx'
}
})
},
//
onPullDownRefresh(){
this.pageNum = 1
this.creatorImgList = []
this.listTiktokImgIn();
this.flag = false;
uni.stopPullDownRefresh();
},
//
onReachBottom() {
console.log(2222)
if (this.creatorImgList.length > this.pageSize*this.pageNum-1) {
this.flag = false;
this.pageNum += 1
this.listTiktokImgIn()
}else{
this.flag = true;
}
},
methods: {
//
targetDetail(item) {
console.log('跳转', item)
if (item.id) {
uni.setStorage({
key: 'detailId',
data: item.id,
success() {
console.log(111111)
uni.navigateTo({
url: '../material/imgDetail'
})
}
})
}
},
onClickStatus(e1){
console.log('statusE',e1)
let that = this;
that.flag = false;
that.creatorImgList = [];
that.status = e1.currentIndex;
console.log('status',that.status)
uni.showLoading({
title: "加载中",
mask: true,
success() {
//
const param = {
creatorId: that.userInfo.id,
typeId: that.typeId,
pageSize: that.pageSize,
pageNum: 1,
status: that.status
};
listTiktokImgIn(param).then(res => {
console.log('that.typeId',that.typeId);
console.log('that.status',that.status);
if(res.data.code === 200){
that.creatorImgList.push(...res.data.rows)
console.log('调用成功1!', that.creatorImgList);
}else {
uni.showModal({
content: "艺术家图片列表数据加载失败!",
showCancel: false,
});
}
});
},
complete() {
uni.hideLoading();
},
});
},
onClickType(e2){
console.log('typeE',e2)
let that = this;
that.flag = false;
that.creatorImgList = [];
that.typeId = that.typeIdList[e2.currentIndex];
console.log('typeId',that.typeId)
uni.showLoading({
title: "加载中",
mask: true,
success() {
//
const param = {
creatorId: that.userInfo.id,
typeId: that.typeId,
pageSize: that.pageSize,
pageNum: 1,
status: that.status
};
listTiktokImgIn(param).then(res => {
console.log('that.typeId',that.typeId);
console.log('that.status',that.status);
if(res.data.code === 200){
that.creatorImgList.push(...res.data.rows)
console.log('调用成功2!', that.creatorImgList);
}else {
uni.showModal({
content: "艺术家图片列表数据加载失败!",
showCancel: false,
});
}
});
},
complete() {
uni.hideLoading();
uni.getSystemInfo({
success: res => {
console.log(res)
if(that.typeId === 1){
that.imgWidth = res.windowWidth - 130 + 'rpx'
that.imgHeight = res.windowWidth - 130 + 'rpx'
}else if(that.typeId === 2){
that.imgWidth = res.windowWidth - 130 + 'rpx'
that.imgHeight = res.windowWidth + 20 + 'rpx'
}else if(that.typeId === 3){
that.imgWidth = res.windowWidth - 130 + 'rpx'
that.imgHeight = res.windowWidth + 20 + 'rpx'
}else if(that.typeId === 4){
that.imgWidth = res.windowWidth - 60 + 'rpx'
that.imgHeight = res.windowWidth - 130 + 'rpx'
}else if(that.typeId === 5){
that.imgWidth = res.windowWidth - 130 + 'rpx'
that.imgHeight = res.windowWidth - 130 + 'rpx'
}else if(that.typeId === 6){
that.imgWidth = res.windowWidth - 130 + 'rpx'
that.imgHeight = res.windowWidth - 130 + 'rpx'
}
}
})
},
});
},
//
async queryListType() {
const res = await listType();
if (res.data.code === 200) {
for (let s of res.data.data) {
this.typeList.push(s.typeName);
this.typeIdList.push(s.id);
}
//console.log('typeList', this.typeList)
console.log('typeIdList', this.typeIdList)
} else {
uni.showModal({
content: "图片分类列表加载失败!",
showCancel: false,
});
}
},
//
async listTiktokImgIn() {
const userInfo = uni.getStorageSync('userInfo')
if (!userInfo) {
console.log('havent userInfo')
} else {
console.log('have userInfo')
}
const res = await listTiktokImgIn({
pageNum: this.pageNum,
pageSize: this.pageSize,
typeId: this.typeId,
status: this.status,
creatorId: userInfo.id
})
if (res.data.code === 200) {
this.creatorImgList.push(...res.data.rows)
console.log('creatorImgList',this.creatorImgList);
} else {
uni.showModal({
content: '艺术家图片列表加载失败!',
showCancel: false
});
}
}
}
}
</script>
<style>
<style lang="less">
.choiceness {
padding-top: 20rpx;
.choiceness-list {
display: flex;
flex-wrap: wrap;
justify-content: flex-first;
flex-direction: row;
image {
margin-top: 10rpx;
margin-left: 10rpx;
margin-right: 5rpx;
border-radius: 10rpx;
}
}
}
.ivOver{
width: 100%;
height:50px;
line-height: 50px;
text-align: center;
background: #fff;
font-size: 20rpx;
}
</style>

20
pages/userInfo/userInfo.vue

@ -23,7 +23,8 @@
<uni-grid :column="3" @change="change" :showBorder="false" :square="true">
<uni-grid-item v-for="(item, index) in list" :index="index" :key="index">
<view class="grid-item-box" style="background-color: #fff;">
<uni-icons type="image" :size="30" color="#777" />
<!-- <uni-icons type="image" :size="30" color="#777" /> -->
<image :src="item.img" class="listIconImage" mode="aspectFill" />
<text class="text">{{item.title}}</text>
</view>
</uni-grid-item>
@ -41,27 +42,27 @@
list: [{
url: '/pages-userInfo/about/about',
title: '关于节点',
img: ''
img: '/static/iconAbout.png'
}, {
url: '/pages-userInfo/contact/contact',
title: '联系我们',
img: ''
img: '/static/iconContactUs.png'
}, {
url: '/pages-userInfo/extends/extends',
title: '邀请他人',
img: ''
img: '/static/iconInvite.png'
}, {
url: '/pages-userInfo/inviteLog/inviteLog',
title: '邀请记录',
img: ''
img: '/static/iconInviteLog.png'
}, {
url: '/pages-userInfo/notice/notice',
title: '通知公告',
img: ''
img: '/static/iconNotice.png'
}, {
url: '/pages-userInfo/withdraw/withdraw',
title: '提现记录',
img: ''
img: '/static/iconWithdraw.png'
}],
pageUrl: '',
userInfo: {},
@ -212,4 +213,9 @@
justify-content: center;
padding: 15px 0;
}
.listIconImage{
width:2rem;
height:2rem;
}
</style>

BIN
static/emoBack.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
static/friendBack.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
static/gifBack.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
static/headBack.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

BIN
static/iconAbout.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
static/iconContactUs.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
static/iconInvite.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
static/iconInviteLog.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
static/iconNotice.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
static/iconWithdraw.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
static/iwatchBack.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

BIN
static/material.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
static/phoneBack.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
static/upload.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Loading…
Cancel
Save