模拟数据:技师的详细数据
This commit is contained in:
@@ -88,14 +88,16 @@ export class GirlData extends BaseData {
|
|||||||
private parseOneGirlBrief(data: proto.cs.IGirlBrief): proto.cs.IGirlBrief | null {
|
private parseOneGirlBrief(data: proto.cs.IGirlBrief): proto.cs.IGirlBrief | null {
|
||||||
if (!data) return null;
|
if (!data) return null;
|
||||||
const oneData: proto.cs.IGirlBrief = {
|
const oneData: proto.cs.IGirlBrief = {
|
||||||
id: data.id, // id
|
id: data.id, // id
|
||||||
name: data.name, // 名字
|
name: data.name, // 名字
|
||||||
age: data.age, // 年龄
|
age: data.age, // 年龄
|
||||||
tagKey: data.tagKey, // 标签
|
tagKey: data.tagKey, // 标签
|
||||||
priceType: data.priceType, // 付费类型
|
priceType: data.priceType, // 付费类型
|
||||||
price: data.price, // 价格
|
price: data.price, // 价格
|
||||||
avatar: data.avatar, // 头像
|
avatar: data.avatar, // 头像
|
||||||
star: data.star, // 星级
|
star: data.star, // 星级
|
||||||
|
category: data.category, // 主题枚举
|
||||||
|
listAvatarPath: data.listAvatarPath, // list头像路径
|
||||||
};
|
};
|
||||||
return oneData;
|
return oneData;
|
||||||
}
|
}
|
||||||
@@ -174,25 +176,40 @@ export class GirlData extends BaseData {
|
|||||||
return oneData.star;
|
return oneData.star;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 获取主题枚举 */
|
||||||
|
public getGrilCategory(categoryId: string, girlId: number): number {
|
||||||
|
let oneData = this.getGrilBrief(categoryId, girlId);
|
||||||
|
if (!oneData) return 0;
|
||||||
|
return oneData.category;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取list头像路径 */
|
||||||
|
public getGrilListAvatar(categoryId: string, girlId: number): string {
|
||||||
|
let oneData = this.getGrilBrief(categoryId, girlId);
|
||||||
|
if (!oneData) return "";
|
||||||
|
return oneData.listAvatarPath;
|
||||||
|
}
|
||||||
|
|
||||||
/** --------------------------------------------------------- 技师的详细数据 --------------------------------------------------------- */
|
/** --------------------------------------------------------- 技师的详细数据 --------------------------------------------------------- */
|
||||||
|
|
||||||
// 解析技师图片数据,一个
|
// 解析技师图片数据,一个
|
||||||
private parseOneGirlPhoto(data: proto.cs.IGirlPhoto): proto.cs.IGirlPhoto | null {
|
private parseOneGirlPhoto(data: proto.cs.IPurchaseCommercialImage): proto.cs.IPurchaseCommercialImage | null {
|
||||||
if (!data) return null;
|
if (!data) return null;
|
||||||
const oneData: proto.cs.IGirlPhoto = {
|
const oneData: proto.cs.IPurchaseCommercialImage = {
|
||||||
pic: data.pic, // 图片路径
|
imageType: data.imageType, // 图片类型
|
||||||
|
imagePrice: data.imagePrice, // 图片价格
|
||||||
|
path: data.path, // 图片资源路径
|
||||||
isRelease: data.isRelease, // 是否解锁
|
isRelease: data.isRelease, // 是否解锁
|
||||||
price: data.price, // 价格
|
|
||||||
};
|
};
|
||||||
return oneData;
|
return oneData;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解析技师图片数据,多个
|
// 解析技师图片数据,多个
|
||||||
private parseAllGirlPhoto(data: proto.cs.IGirlPhoto[]): proto.cs.IGirlPhoto[] | null {
|
private parseAllGirlPhoto(data: proto.cs.IPurchaseCommercialImage[]): proto.cs.IPurchaseCommercialImage[] | null {
|
||||||
if (!data) return null;
|
if (!data) return null;
|
||||||
let allData = [];
|
let allData = [];
|
||||||
for (const value of data) {
|
for (const value of data) {
|
||||||
const oneData: proto.cs.IGirlPhoto = this.parseOneGirlPhoto(value);
|
const oneData: proto.cs.IPurchaseCommercialImage = this.parseOneGirlPhoto(value);
|
||||||
if (oneData) {
|
if (oneData) {
|
||||||
allData.push(oneData);
|
allData.push(oneData);
|
||||||
}
|
}
|
||||||
@@ -200,17 +217,44 @@ export class GirlData extends BaseData {
|
|||||||
return allData;
|
return allData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 解析技师视频数据,一个
|
||||||
|
private parseOneGirlVideo(data: proto.cs.IPurchaseCommercialVideo): proto.cs.IPurchaseCommercialVideo | null {
|
||||||
|
if (!data) return null;
|
||||||
|
const oneData: proto.cs.IPurchaseCommercialVideo = {
|
||||||
|
path: data.path, // 视频资源路径
|
||||||
|
emotion: data.emotion, // 关联情绪
|
||||||
|
videoPrice: data.videoPrice, // 价格
|
||||||
|
isRelease: data.isRelease, // 是否解锁
|
||||||
|
};
|
||||||
|
return oneData;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析技师视频数据,多个
|
||||||
|
private parseAllGirlVideo(data: proto.cs.IPurchaseCommercialVideo[]): proto.cs.IPurchaseCommercialVideo[] | null {
|
||||||
|
if (!data) return null;
|
||||||
|
let allData = [];
|
||||||
|
for (const value of data) {
|
||||||
|
const oneData: proto.cs.IPurchaseCommercialVideo = this.parseOneGirlVideo(value);
|
||||||
|
if (oneData) {
|
||||||
|
allData.push(oneData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return allData;
|
||||||
|
}
|
||||||
|
|
||||||
// 解析技师详细数据,一个
|
// 解析技师详细数据,一个
|
||||||
private parseOneGirlDetail(data: proto.cs.IGirlDetail): proto.cs.IGirlDetail | null {
|
private parseOneGirlDetail(data: proto.cs.IGirlDetail): proto.cs.IGirlDetail | null {
|
||||||
if (!data) return null;
|
if (!data) return null;
|
||||||
const photoData = this.parseAllGirlPhoto(data.photos);
|
const photoData = this.parseAllGirlPhoto(data.images);
|
||||||
|
const videoData = this.parseAllGirlVideo(data.videos);
|
||||||
const briefData = this.parseOneGirlBrief(data.brief);
|
const briefData = this.parseOneGirlBrief(data.brief);
|
||||||
const oneData: proto.cs.IGirlDetail = {
|
const oneData: proto.cs.IGirlDetail = {
|
||||||
brief: briefData, // 技师简要数据
|
brief: briefData, // 技师简要数据
|
||||||
desc: data.desc, // 技师描述
|
desc: data.desc, // 技师描述
|
||||||
photos: photoData, // 技师图片列表
|
|
||||||
isRelease: data.isRelease, // 技师是否解锁
|
isRelease: data.isRelease, // 技师是否解锁
|
||||||
chatCount: data.chatCount, // 剩余聊天次数
|
chatCount: data.chatCount, // 剩余聊天次数
|
||||||
|
images: photoData, // 技师图片列表
|
||||||
|
videos: videoData, // 技师视频列表
|
||||||
};
|
};
|
||||||
return oneData;
|
return oneData;
|
||||||
}
|
}
|
||||||
@@ -271,21 +315,49 @@ export class GirlData extends BaseData {
|
|||||||
return oneData.chatCount;
|
return oneData.chatCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 获取技师图片数据,通过 index */
|
/** 获取所有技师图片数据 */
|
||||||
public getGrilPhotoData(categoryId: string, girlId: number, index: number): proto.cs.IGirlPhoto | null {
|
private getAllGrilPhotoData(categoryId: string, girlId: number): proto.cs.IPurchaseCommercialImage[] | null {
|
||||||
let oneData = this.getGrilDetail(categoryId, girlId);
|
let oneData = this.getGrilDetail(categoryId, girlId);
|
||||||
if (!oneData || !oneData.photos) return null;
|
if (!oneData || !oneData.images) return null;
|
||||||
// 下标越界保护
|
return oneData.images;
|
||||||
if (index < 0 || index >= oneData.photos.length) return null;
|
|
||||||
|
|
||||||
return oneData.photos[index] ?? null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 获取所有技师图片数据的数量 */
|
||||||
|
public getAllGrilPhotoDataCount(categoryId: string, girlId: number): number {
|
||||||
|
let allData = this.getAllGrilPhotoData(categoryId, girlId);
|
||||||
|
if (!allData) return 0;
|
||||||
|
return allData.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取技师图片数据,通过 index */
|
||||||
|
private getGrilPhotoData(categoryId: string, girlId: number, index: number): proto.cs.IPurchaseCommercialImage | null {
|
||||||
|
let allData = this.getAllGrilPhotoData(categoryId, girlId);
|
||||||
|
if (!allData) return null;
|
||||||
|
// 下标越界保护
|
||||||
|
if (index < 0 || index >= allData.length) return null;
|
||||||
|
|
||||||
|
return allData[index] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取技师图片的类型 */
|
||||||
|
public getGrilPhotoType(categoryId: string, girlId: number, index: number): number {
|
||||||
|
let oneData = this.getGrilPhotoData(categoryId, girlId, index);
|
||||||
|
if (!oneData) return 0;
|
||||||
|
return oneData.imageType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取技师图片的价格 */
|
||||||
|
public getGrilPhotoPrice(categoryId: string, girlId: number, index: number): number {
|
||||||
|
let oneData = this.getGrilPhotoData(categoryId, girlId, index);
|
||||||
|
if (!oneData) return 0;
|
||||||
|
return oneData.imagePrice;
|
||||||
|
}
|
||||||
|
|
||||||
/** 获取技师图片的路径 */
|
/** 获取技师图片的路径 */
|
||||||
public getGrilPhotoPic(categoryId: string, girlId: number, index: number): string {
|
public getGrilPhotoPic(categoryId: string, girlId: number, index: number): string {
|
||||||
let oneData = this.getGrilPhotoData(categoryId, girlId, index);
|
let oneData = this.getGrilPhotoData(categoryId, girlId, index);
|
||||||
if (!oneData) return "";
|
if (!oneData) return "";
|
||||||
return oneData.pic;
|
return oneData.path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 获取技师图片是否解锁 */
|
/** 获取技师图片是否解锁 */
|
||||||
@@ -295,11 +367,57 @@ export class GirlData extends BaseData {
|
|||||||
return oneData.isRelease;
|
return oneData.isRelease;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 获取技师图片的价格 */
|
/** 获取所有技师视频数据 */
|
||||||
public getGrilPhotoPrice(categoryId: string, girlId: number, index: number): number {
|
private getAllGrilVideoData(categoryId: string, girlId: number): proto.cs.IPurchaseCommercialVideo[] | null {
|
||||||
let oneData = this.getGrilPhotoData(categoryId, girlId, index);
|
let oneData = this.getGrilDetail(categoryId, girlId);
|
||||||
|
if (!oneData || !oneData.videos) return null;
|
||||||
|
|
||||||
|
return oneData.videos ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取所有技师视频数据的数量 */
|
||||||
|
public getAllGrilVideoDataCount(categoryId: string, girlId: number): number {
|
||||||
|
let allData = this.getAllGrilVideoData(categoryId, girlId);
|
||||||
|
if (!allData) return 0;
|
||||||
|
return allData.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取技师视频数据,通过 index */
|
||||||
|
private getGrilVideoData(categoryId: string, girlId: number, index: number): proto.cs.IPurchaseCommercialVideo | null {
|
||||||
|
let allData = this.getAllGrilVideoData(categoryId, girlId);
|
||||||
|
if (!allData) return null;
|
||||||
|
// 下标越界保护
|
||||||
|
if (index < 0 || index >= allData.length) return null;
|
||||||
|
|
||||||
|
return allData[index] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取技师视频的路径 */
|
||||||
|
public getGrilVideoPath(categoryId: string, girlId: number, index: number): string {
|
||||||
|
let oneData = this.getGrilVideoData(categoryId, girlId, index);
|
||||||
|
if (!oneData) return "";
|
||||||
|
return oneData.path;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取技师视频的关联情绪 */
|
||||||
|
public getGrilVideoEmotion(categoryId: string, girlId: number, index: number): number {
|
||||||
|
let oneData = this.getGrilVideoData(categoryId, girlId, index);
|
||||||
if (!oneData) return 0;
|
if (!oneData) return 0;
|
||||||
return oneData.price;
|
return oneData.emotion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取技师视频的价格 */
|
||||||
|
public getGrilVideoPrice(categoryId: string, girlId: number, index: number): number {
|
||||||
|
let oneData = this.getGrilVideoData(categoryId, girlId, index);
|
||||||
|
if (!oneData) return 0;
|
||||||
|
return oneData.videoPrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取技师视频是否解锁 */
|
||||||
|
public getGrilVideoIsRelease(categoryId: string, girlId: number, index: number): boolean {
|
||||||
|
let oneData = this.getGrilVideoData(categoryId, girlId, index);
|
||||||
|
if (!oneData) return false;
|
||||||
|
return oneData.isRelease;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** --------------------------------------------------------- 每日推荐 --------------------------------------------------------- */
|
/** --------------------------------------------------------- 每日推荐 --------------------------------------------------------- */
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export class MockGirlService implements IGirlService {
|
|||||||
return ({ code: 100, error: { message } } as unknown) as ApiResponse<T>;
|
return ({ code: 100, error: { message } } as unknown) as ApiResponse<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
private genBrief(id: number, name: string, age: number, tagKey: string, priceType: number, price: number, avatar: string, star: number): proto.cs.IGirlBrief {
|
private genBrief(id: number, name: string, age: number, tagKey: string, priceType: number, price: number, avatar: string, star: number, category: number, listAvatarPath: string): proto.cs.IGirlBrief {
|
||||||
return {
|
return {
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
@@ -25,22 +25,35 @@ export class MockGirlService implements IGirlService {
|
|||||||
price,
|
price,
|
||||||
avatar,
|
avatar,
|
||||||
star,
|
star,
|
||||||
|
category,
|
||||||
|
listAvatarPath,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private genPhoto(pic: string, isRelease: boolean, price: number): proto.cs.IGirlPhoto {
|
private genPhoto(imageType: number, imagePrice: number, path: string, isRelease: boolean, ): proto.cs.IPurchaseCommercialImage {
|
||||||
return {
|
return {
|
||||||
pic,
|
imageType,
|
||||||
|
imagePrice,
|
||||||
|
path,
|
||||||
isRelease,
|
isRelease,
|
||||||
price,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private genDetail(brief: proto.cs.IGirlBrief, desc: string, photos: proto.cs.IGirlPhoto[], isRelease: boolean, chatCount: number): proto.cs.IGirlDetail {
|
private genVideo(path: string, emotion: number, videoPrice: number, isRelease: boolean): proto.cs.IPurchaseCommercialVideo {
|
||||||
|
return {
|
||||||
|
path,
|
||||||
|
emotion,
|
||||||
|
videoPrice,
|
||||||
|
isRelease,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private genDetail(brief: proto.cs.IGirlBrief, desc: string, images: proto.cs.IPurchaseCommercialImage[], videos: proto.cs.IPurchaseCommercialVideo[], isRelease: boolean, chatCount: number): proto.cs.IGirlDetail {
|
||||||
return {
|
return {
|
||||||
brief,
|
brief,
|
||||||
desc,
|
desc,
|
||||||
photos,
|
images,
|
||||||
|
videos,
|
||||||
isRelease,
|
isRelease,
|
||||||
chatCount,
|
chatCount,
|
||||||
};
|
};
|
||||||
@@ -61,7 +74,9 @@ export class MockGirlService implements IGirlService {
|
|||||||
let price = 9.9;
|
let price = 9.9;
|
||||||
let avatar = configData.getAvatarPathById(recId);
|
let avatar = configData.getAvatarPathById(recId);
|
||||||
let star = 3;
|
let star = 3;
|
||||||
let oneData = this.genBrief(recId, name, age, tagKey, priceType, price, avatar, star);
|
let category = configData.getCategoryById(recId);
|
||||||
|
let listAvatarPath = configData.getListAvatarPathPathById(recId);
|
||||||
|
let oneData = this.genBrief(recId, name, age, tagKey, priceType, price, avatar, star, category, listAvatarPath);
|
||||||
// 返回数据
|
// 返回数据
|
||||||
const girls = [oneData];
|
const girls = [oneData];
|
||||||
return this.ok({ girls });
|
return this.ok({ girls });
|
||||||
@@ -106,7 +121,10 @@ export class MockGirlService implements IGirlService {
|
|||||||
// 星级兜底:1~5
|
// 星级兜底:1~5
|
||||||
const star = (id % 5) + 1;
|
const star = (id % 5) + 1;
|
||||||
|
|
||||||
return this.genBrief(id, name, age, tagKey, priceType, price, avatar, star);
|
const category = configData.getCategoryById(id);
|
||||||
|
const listAvatarPath = configData.getListAvatarPathPathById(id);
|
||||||
|
|
||||||
|
return this.genBrief(id, name, age, tagKey, priceType, price, avatar, star, category, listAvatarPath);
|
||||||
});
|
});
|
||||||
// 返回数据
|
// 返回数据
|
||||||
return this.ok({ girls });
|
return this.ok({ girls });
|
||||||
@@ -121,7 +139,7 @@ export class MockGirlService implements IGirlService {
|
|||||||
const girlDetailConfig = ConfigManager.I.getDataById<GirlDetailConfig>(ConfigId.GirlDetail);
|
const girlDetailConfig = ConfigManager.I.getDataById<GirlDetailConfig>(ConfigId.GirlDetail);
|
||||||
// id
|
// id
|
||||||
const girlId = req.id;
|
const girlId = req.id;
|
||||||
|
// 简要数据
|
||||||
let name = girlConfig.getNameById(girlId);
|
let name = girlConfig.getNameById(girlId);
|
||||||
let age = Number(girlConfig.getAgeById(girlId));
|
let age = Number(girlConfig.getAgeById(girlId));
|
||||||
let tagKey = girlConfig.getTagKeyById(girlId);
|
let tagKey = girlConfig.getTagKeyById(girlId);
|
||||||
@@ -129,24 +147,37 @@ export class MockGirlService implements IGirlService {
|
|||||||
let price = 9.9;
|
let price = 9.9;
|
||||||
let avatar = girlConfig.getAvatarPathById(girlId);
|
let avatar = girlConfig.getAvatarPathById(girlId);
|
||||||
let star = 3;
|
let star = 3;
|
||||||
let briefData = this.genBrief(girlId, name, age, tagKey, priceType, price, avatar, star);
|
let category = girlConfig.getCategoryById(girlId);
|
||||||
|
let listAvatarPath = girlConfig.getListAvatarPathPathById(girlId);
|
||||||
|
let briefData = this.genBrief(girlId, name, age, tagKey, priceType, price, avatar, star, category, listAvatarPath);
|
||||||
|
|
||||||
let desc = girlDetailConfig.getDetailDescById(girlId);
|
let desc = girlDetailConfig.getDetailDescById(girlId);
|
||||||
let isRelease = Math.random() < 0.4;
|
let isRelease = Math.random() < 0.4;
|
||||||
let chatCount = 10;
|
let chatCount = 10;
|
||||||
|
// 图片
|
||||||
let photoData = [];
|
let photoData = [];
|
||||||
let photoCount = girlDetailConfig.getCommercialImagesCount(girlId);
|
let photoCount = girlDetailConfig.getCommercialImagesCount(girlId);
|
||||||
|
|
||||||
for (let i = 0; i < photoCount; i++) {
|
for (let i = 0; i < photoCount; i++) {
|
||||||
|
let imageType = girlDetailConfig.getImageTypeById(girlId, i);
|
||||||
let imagePath = girlDetailConfig.getImagePathById(girlId, i);
|
let imagePath = girlDetailConfig.getImagePathById(girlId, i);
|
||||||
let isImageRelease = Math.random() < 0.4;
|
let isRelease = Math.random() < 0.4;
|
||||||
let imagePrice = 9.9;
|
let imagePrice = girlDetailConfig.getImagePriceById(girlId, i);
|
||||||
let onePhotoData = this.genPhoto(imagePath, isImageRelease, imagePrice);
|
let oneData = this.genPhoto(imageType, imagePrice, imagePath, isRelease);
|
||||||
photoData.push(onePhotoData);
|
photoData.push(oneData);
|
||||||
}
|
}
|
||||||
|
// 视频
|
||||||
let detail = this.genDetail(briefData, desc, photoData, isRelease, chatCount);
|
let videoData = [];
|
||||||
|
let videoCount = girlDetailConfig.getCommercialVideosCount(girlId);
|
||||||
|
for (let i = 0; i < videoCount; i++) {
|
||||||
|
let videoPath = girlDetailConfig.getVideoPathById(girlId, i);
|
||||||
|
let videoEmotion = girlDetailConfig.getVideoEmotionById(girlId, i);
|
||||||
|
let videoPrice = girlDetailConfig.getVideoPriceById(girlId, i);
|
||||||
|
let isRelease = Math.random() < 0.4;
|
||||||
|
let oneData = this.genVideo(videoPath, videoEmotion, videoPrice, isRelease);
|
||||||
|
videoData.push(oneData);
|
||||||
|
}
|
||||||
|
// 详细数据
|
||||||
|
let detail = this.genDetail(briefData, desc, photoData, videoData, isRelease, chatCount);
|
||||||
// 返回数据
|
// 返回数据
|
||||||
return this.ok({ detail });
|
return this.ok({ detail });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ export class GirlDetailPanel extends li_BaseView {
|
|||||||
}
|
}
|
||||||
nameKey: string;
|
nameKey: string;
|
||||||
tagKey: string;
|
tagKey: string;
|
||||||
category;
|
category: number;
|
||||||
async refresh(index: number) {
|
async refresh(index: number) {
|
||||||
// TODO,暂时这样获取,修改后从GirlData获取
|
// TODO,暂时这样获取,修改后从GirlData获取
|
||||||
const girlConfig = ConfigManager.tables.TbGirls.get(this.id);
|
const girlConfig = ConfigManager.tables.TbGirls.get(this.id);
|
||||||
@@ -144,109 +144,71 @@ export class GirlDetailPanel extends li_BaseView {
|
|||||||
const reqData = {
|
const reqData = {
|
||||||
id: this.id,
|
id: this.id,
|
||||||
};
|
};
|
||||||
// let res = await GirlService.I.reqGetGirlDetail(reqData);
|
let res = await GirlService.I.reqGetGirlDetail(reqData);
|
||||||
// console.log("看看响应数据:", res);
|
if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
||||||
// if (res && res.code === proto.cs.EnmRetCode.SUCCESS) {
|
// 保存数据
|
||||||
// // 保存数据
|
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||||
// const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
girlData.setGirlDetails(this.category.toString(), res.data);
|
||||||
// girlData.setGirlDetails(this.category.toString(), res.data);
|
// 根据数据,刷新界面
|
||||||
// // 根据数据,刷新界面
|
this.nameKey = girlData.getGrilName(this.category.toString(), this.id);
|
||||||
// this.nameKey = girlData.getGrilName(this.category, this.id);
|
this.girlName.string = LanguageUtils.getText(this.nameKey);
|
||||||
// this.girlName.string = LanguageUtils.getText(this.nameKey);
|
this.desc.string = girlData.getGrilDesc(this.category.toString(), this.id);
|
||||||
// this.desc.string = girlData.getGrilDesc(this.category, this.id);
|
|
||||||
|
|
||||||
// let desc = "";
|
let desc = "";
|
||||||
// this.tagKey = girlData.getGrilTagKey(this.category, this.id);
|
this.tagKey = girlData.getGrilTagKey(this.category.toString(), this.id);
|
||||||
// const tags = LanguageUtils.getText(this.tagKey).split("|");
|
const tags = LanguageUtils.getText(this.tagKey).split("|");
|
||||||
// for (let i = 0; i < tags.length; i++) {
|
for (let i = 0; i < tags.length; i++) {
|
||||||
// if (i != 0) desc += "|";
|
if (i != 0) desc += "|";
|
||||||
// desc += tags[i];
|
desc += tags[i];
|
||||||
// }
|
}
|
||||||
// this.tags.string = desc;
|
this.tags.string = desc;
|
||||||
// for (let i = 0; i < 5; i++) {
|
for (let i = 0; i < 5; i++) {
|
||||||
// this.starParent.children[i].active = i < 5;
|
this.starParent.children[i].active = i < 5;
|
||||||
// }
|
}
|
||||||
// let age = girlData.getGrilAge(this.category, this.id);
|
let age = girlData.getGrilAge(this.category.toString(), this.id);
|
||||||
// this.descAge.string =
|
this.descAge.string =
|
||||||
// LanguageUtils.getText("girldetailpanel.age") + age.toString();
|
LanguageUtils.getText("girldetailpanel.age") + age.toString();
|
||||||
|
|
||||||
// // TODO
|
const firstPath = girlData.getGrilVideoPath(this.category.toString(), this.id, 0);
|
||||||
// const dataDetail = ConfigManager.tables.TbGirlsDetail.get(this.id);
|
ResManager.I.changeBundleVideo(
|
||||||
|
this.avatarVideo,
|
||||||
|
firstPath,
|
||||||
|
"Chat18x"
|
||||||
|
);
|
||||||
|
|
||||||
// ResManager.I.changeBundleVideo(
|
let allPhotoDataCount = girlData.getAllGrilPhotoDataCount(this.category.toString(), this.id);
|
||||||
// this.avatarVideo,
|
// 也立即尝试调整(以防已经加载完成)
|
||||||
// dataDetail.commercialVideos[0].path,
|
this.adjustVideoScale();
|
||||||
// "Chat18x"
|
this.refreshImgs(1, this.category, this.id, allPhotoDataCount);
|
||||||
// );
|
}
|
||||||
|
|
||||||
// // 也立即尝试调整(以防已经加载完成)
|
|
||||||
// this.adjustVideoScale();
|
|
||||||
// this.vids = dataDetail.commercialVideos.slice(0);
|
|
||||||
// this.refreshImgs(dataDetail.commercialImages);
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
const dataDetail = ConfigManager.tables.TbGirlsDetail.get(this.id);
|
|
||||||
console.log(dataDetail);
|
|
||||||
|
|
||||||
const data = ConfigManager.tables.TbGirls.get(this.id);
|
|
||||||
this.nameKey = data.nameKey;
|
|
||||||
this.girlName.string = LanguageUtils.getText(data.nameKey);
|
|
||||||
|
|
||||||
this.desc.string = dataDetail.detailDesc;
|
|
||||||
let desc = "";
|
|
||||||
this.tagKey = data.tagKey;
|
|
||||||
const tags = LanguageUtils.getText(data.tagKey).split("|");
|
|
||||||
for (let i = 0; i < tags.length; i++) {
|
|
||||||
if (i != 0) desc += "|";
|
|
||||||
desc += tags[i];
|
|
||||||
}
|
|
||||||
this.tags.string = desc;
|
|
||||||
for (let i = 0; i < 5; i++) {
|
|
||||||
this.starParent.children[i].active = i < 5;
|
|
||||||
}
|
|
||||||
this.descAge.string =
|
|
||||||
LanguageUtils.getText("girldetailpanel.age") + data.age.toString();
|
|
||||||
this.desc.string = dataDetail.detailDesc;
|
|
||||||
|
|
||||||
ResManager.I.changeBundleVideo(
|
|
||||||
this.avatarVideo,
|
|
||||||
dataDetail.commercialVideos[0].path,
|
|
||||||
"Chat18x"
|
|
||||||
);
|
|
||||||
|
|
||||||
// 也立即尝试调整(以防已经加载完成)
|
|
||||||
this.adjustVideoScale();
|
|
||||||
this.vids = dataDetail.commercialVideos.slice(0);
|
|
||||||
this.refreshImgs(dataDetail.commercialImages);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vids: purchase.CommercialVideo[];
|
|
||||||
bindImgToggle() {
|
bindImgToggle() {
|
||||||
const dataDetail = ConfigManager.tables.TbGirlsDetail.get(this.id);
|
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||||
const images = dataDetail.commercialImages;
|
let allPhotoDataCount = girlData.getAllGrilPhotoDataCount(this.category.toString(), this.id);
|
||||||
|
this.refreshImgs(1, this.category, this.id, allPhotoDataCount);
|
||||||
this.refreshImgs(images);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bindVideoToggle() {
|
bindVideoToggle() {
|
||||||
this.refreshImgs(this.vids);
|
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||||
|
let allVideoDataCount = girlData.getAllGrilVideoDataCount(this.category.toString(), this.id);
|
||||||
|
this.refreshImgs(2, this.category, this.id, allVideoDataCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshImgs(
|
refreshImgs(
|
||||||
resouces: purchase.CommercialImage[] | purchase.CommercialVideo[]
|
type: number,
|
||||||
|
category: number,
|
||||||
|
id: number,
|
||||||
|
count: number
|
||||||
) {
|
) {
|
||||||
for (let i = this.imgsLayout.children.length - 1; i >= 0; i--) {
|
for (let i = this.imgsLayout.children.length - 1; i >= 0; i--) {
|
||||||
this.imgsLayout.children[i].destroy();
|
this.imgsLayout.children[i].destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 1; i < resouces.length; i++) {
|
for (let i = 0; i < count; i++) {
|
||||||
const resource = resouces[i];
|
|
||||||
let newNode = instantiate(this.imgItemInst.node);
|
let newNode = instantiate(this.imgItemInst.node);
|
||||||
let item = newNode.getComponent(DetailImageItem);
|
let item = newNode.getComponent(DetailImageItem);
|
||||||
item.refresh(resource, this);
|
item.refresh(this, type, category, id, i);
|
||||||
newNode.active = true;
|
newNode.active = true;
|
||||||
this.imgsLayout.addChild(newNode);
|
this.imgsLayout.addChild(newNode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ import { ViewManager } from "db://assets/Scripts/Main/Manager/ViewManager";
|
|||||||
import { GButton } from "db://assets/Scripts/Main/Common/GButton";
|
import { GButton } from "db://assets/Scripts/Main/Common/GButton";
|
||||||
import { GirlDetailPanel } from "../ui/panels/GirlDetailPanel";
|
import { GirlDetailPanel } from "../ui/panels/GirlDetailPanel";
|
||||||
import { purchase } from "../../schema/schema";
|
import { purchase } from "../../schema/schema";
|
||||||
|
import proto from 'db://assets/Scripts/proto/proto.pb.js';
|
||||||
|
import { DataManager, DataId } from "../data/DataManager";
|
||||||
|
import { GirlData } from "../data/GirlData";
|
||||||
|
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@@ -22,6 +25,10 @@ export class DetailImageItem extends Component {
|
|||||||
url: string;
|
url: string;
|
||||||
isImage: boolean;
|
isImage: boolean;
|
||||||
uitransform: UITransform;
|
uitransform: UITransform;
|
||||||
|
category: number;
|
||||||
|
id: number;
|
||||||
|
index: number;
|
||||||
|
type : number;
|
||||||
|
|
||||||
onLoad() {
|
onLoad() {
|
||||||
GButton.BandClick(this.node, this.onClickThis, this);
|
GButton.BandClick(this.node, this.onClickThis, this);
|
||||||
@@ -82,21 +89,33 @@ export class DetailImageItem extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
refresh(
|
refresh(
|
||||||
resource: purchase.CommercialImage | purchase.CommercialVideo,
|
base: GirlDetailPanel,
|
||||||
base: GirlDetailPanel
|
type: number,
|
||||||
|
category: number,
|
||||||
|
id: number,
|
||||||
|
index: number
|
||||||
) {
|
) {
|
||||||
this.base = base;
|
this.base = base;
|
||||||
|
this.type = type;
|
||||||
|
this.category = category;
|
||||||
|
this.id = id;
|
||||||
|
this.index = index;
|
||||||
this.lock.active = false;
|
this.lock.active = false;
|
||||||
this.question.active = true; // 显示问号,表示加载中
|
this.question.active = true; // 显示问号,表示加载中
|
||||||
this.url = resource.path;
|
|
||||||
|
|
||||||
let imgPath = this.url;
|
const girlData = DataManager.I.getDataById<GirlData>(DataId.Girl);
|
||||||
|
let imgPath = "";
|
||||||
if (resource instanceof purchase.CommercialImage) {
|
if (type === 1) {
|
||||||
|
// 图片
|
||||||
|
this.url = girlData.getGrilPhotoPic(this.category.toString(), this.id, this.index);
|
||||||
|
imgPath = this.url;
|
||||||
this.isImage = true;
|
this.isImage = true;
|
||||||
} else {
|
} else if (type === 2) {
|
||||||
|
// 视频
|
||||||
this.isImage = false;
|
this.isImage = false;
|
||||||
if (resource.videoPrice > 0) {
|
this.url = girlData.getGrilVideoPath(this.category.toString(), this.id, this.index);
|
||||||
|
let videoPrice = girlData.getGrilVideoPrice(this.category.toString(), this.id, this.index);
|
||||||
|
if (videoPrice > 0) {
|
||||||
imgPath = this.url + "_thumbnail_blur";
|
imgPath = this.url + "_thumbnail_blur";
|
||||||
} else {
|
} else {
|
||||||
imgPath = this.url + "_thumbnail";
|
imgPath = this.url + "_thumbnail";
|
||||||
|
|||||||
@@ -87,8 +87,7 @@ export class GirlListItem extends Component {
|
|||||||
this.price.node.active = priceType == PriceType.pay;
|
this.price.node.active = priceType == PriceType.pay;
|
||||||
this.freeNode.active = priceType == PriceType.free;
|
this.freeNode.active = priceType == PriceType.free;
|
||||||
this.tryNode.active = priceType == PriceType.first_time_free;
|
this.tryNode.active = priceType == PriceType.first_time_free;
|
||||||
// TODO,先用 AvatarPath 代替着 listAvatarPath
|
let listAvatarPath = girlData.getGrilListAvatar(this.category.toString(), this.id);
|
||||||
let listAvatarPath = girlData.getGrilAvatar(this.category.toString(), this.id);
|
|
||||||
ResManager.I.changeBundleSpriteFrame(
|
ResManager.I.changeBundleSpriteFrame(
|
||||||
this.avatar,
|
this.avatar,
|
||||||
listAvatarPath,
|
listAvatarPath,
|
||||||
|
|||||||
Reference in New Issue
Block a user