Browse Source

feature-tiktok-1.0:提交代码

feature-1.0
chengkun 4 years ago
parent
commit
377eda596d
  1. 12
      api/creator.js
  2. 4
      api/index.js
  3. 9
      pages/creator/creator.vue
  4. 23
      pages/creator/creatorDetail.vue
  5. 6
      pages/index/choiceness.vue
  6. 6
      pages/index/index.vue

12
api/creator.js

@ -10,7 +10,8 @@ export function getBannerList() {
method: 'get' method: 'get'
}) })
} }
//获取小程序艺术家图片分页
//获取艺术家界面查询艺术家图片分页
export function getCreatorImgsPage(data) { export function getCreatorImgsPage(data) {
return request({ return request({
url: `${serviceTitle}/img/mini/tiktok/creatorImgsPage`, url: `${serviceTitle}/img/mini/tiktok/creatorImgsPage`,
@ -19,6 +20,15 @@ export function getCreatorImgsPage(data) {
}) })
} }
//根据搜索码和分类id查询艺术家图片分页
export function getTypeImgsPage(data) {
return request({
url: `${serviceTitle}/img/mini/tiktok/typeImgsPage`,
method: 'post',
data
})
}
// 获取图片详情 // 获取图片详情
export function detailsTiktokImg(data) { export function detailsTiktokImg(data) {
return request({ return request({

4
api/index.js

@ -19,9 +19,9 @@ export function imgLists(data) {
}) })
} }
//艺术家详情页-根据搜索码查询艺术家图片列表 //艺术家详情页-根据搜索码查询艺术家图片列表
export function creatorImgsDetails(data) { export function creatorDetails(data) {
return request({ return request({
url: `${serviceTitle}/img/mini/tiktok/creatorImgsDetails`, url: `${serviceTitle}/img/mini/tiktok/creatorDetails`,
method: 'post', method: 'post',
data data
}) })

9
pages/creator/creator.vue

@ -54,7 +54,7 @@
getCreatorImgsPage getCreatorImgsPage
} from '@/api/creator.js' } from '@/api/creator.js'
import { import {
creatorImgsDetails creatorDetails
} from '@/api/index.js' } from '@/api/index.js'
export default { export default {
data() { data() {
@ -97,7 +97,7 @@
const params = { const params = {
scanCode: item.scanCode scanCode: item.scanCode
} }
creatorImgsDetails(params).then(response => { creatorDetails(params).then(response => {
if(response.data.code === 200){ if(response.data.code === 200){
this.creatorInfo = response.data.data this.creatorInfo = response.data.data
console.log("this.creatorInfo结果",this.creatorInfo); console.log("this.creatorInfo结果",this.creatorInfo);
@ -129,11 +129,6 @@
} }
}, },
getCreatorDetails(item) {
//TODO
console.log(item);
},
async getBanner() { async getBanner() {
const res = await getBannerList() const res = await getBannerList()
if (res.data.code === 200) { if (res.data.code === 200) {

23
pages/creator/creatorDetail.vue

@ -40,7 +40,7 @@
</view> </view>
<swiper class="swiper" :circular="false" :current="current" :indicator-dots="false" :autoplay="false" <swiper class="swiper" :circular="false" :current="current" :indicator-dots="false" :autoplay="false"
@change="changeItem" :duration="500"> @change="changeItem" :duration="500">
<swiper-item v-for="(item,index) in creatorInfo.typeImgList" :key="item.typeId" <swiper-item v-for="(item,index) in creatorInfo.typeList" :key="item.typeId"
:current-item-id="item.typeId" > :current-item-id="item.typeId" >
<view class="swiper-item bottom"> <view class="swiper-item bottom">
<image :src="val.imgUrl" mode="" v-for="(val,i) in item.imgList" :key="i" <image :src="val.imgUrl" mode="" v-for="(val,i) in item.imgList" :key="i"
@ -55,8 +55,8 @@
<script> <script>
import { import {
creatorImgsDetails getTypeImgsPage
} from '@/api/index.js' } from '@/api/creator.js'
export default { export default {
data() { data() {
return { return {
@ -65,6 +65,8 @@
arrList: [], arrList: [],
imgWidth: 0, // imgWidth: 0, //
imgHeight: 0, // imgHeight: 0, //
pageNum: 1,
pageSize: 10,
} }
}, },
created() { created() {
@ -80,7 +82,7 @@
success: res => { success: res => {
this.creatorInfo = res.data this.creatorInfo = res.data
console.log('getStorage', this.creatorInfo) console.log('getStorage', this.creatorInfo)
this.creatorInfo.typeImgList.forEach(item => { this.creatorInfo.typeList.forEach(item => {
this.arrList.push(item.typeName) this.arrList.push(item.typeName)
}) })
console.log('arrList', this.arrList) console.log('arrList', this.arrList)
@ -105,6 +107,19 @@
onClickItem(e) { onClickItem(e) {
console.log('点击', e) console.log('点击', e)
this.current = e.currentIndex this.current = e.currentIndex
const params = {
scanCode: this.creatorInfo.scanCode,
typeId: this.current,
pageNum: this.pageNum,
pageSize: this.pageSize,
}
console.log('params',params)
getTypeImgsPage(params).then(response => {
if(response.data.code === 200){
console.log('response',response)
//TODO
}
});
}, },
// //
changeItem(e) { changeItem(e) {

6
pages/index/choiceness.vue

@ -19,7 +19,7 @@
<script> <script>
import { import {
imgLists, imgLists,
creatorImgsDetails creatorDetails
} from '@/api/index.js' } from '@/api/index.js'
export default { export default {
data() { data() {
@ -73,10 +73,10 @@
// //
async goCreatorDetail(scanCode) { async goCreatorDetail(scanCode) {
if (scanCode) { if (scanCode) {
const res = await creatorImgsDetails({ const res = await creatorDetails({
scanCode scanCode
}) })
console.log('creatorImgsDetails', res) console.log('creatorDetails', res)
if (res.data.code === 200) { if (res.data.code === 200) {
uni.setStorage({ uni.setStorage({
key: 'creatorDetail', key: 'creatorDetail',

6
pages/index/index.vue

@ -28,7 +28,7 @@
<script> <script>
import { import {
listHotCreator, listHotCreator,
creatorImgsDetails, creatorDetails,
loginTiktok loginTiktok
} from '@/api/index.js' } from '@/api/index.js'
import Choiceness from './choiceness.vue' import Choiceness from './choiceness.vue'
@ -138,10 +138,10 @@
// //
async goCreatorDetail(scanCode) { async goCreatorDetail(scanCode) {
if (scanCode) { if (scanCode) {
const res = await creatorImgsDetails({ const res = await creatorDetails({
scanCode scanCode
}) })
console.log('creatorImgsDetails', res) console.log('creatorDetails', res)
if (res.data.code === 200) { if (res.data.code === 200) {
uni.setStorage({ uni.setStorage({
key: 'creatorDetail', key: 'creatorDetail',

Loading…
Cancel
Save