|
@@ -15,7 +15,7 @@
|
|
|
</view>
|
|
|
|
|
|
<!-- 加载动画区域 -->
|
|
|
- <view class="loading-area" v-if="state == 2">
|
|
|
+ <view class="loading-area" v-if="state == 2 || isLoading">
|
|
|
<image src="../../static/me/loadAnimation.gif" mode="widthFix"></image>
|
|
|
</view>
|
|
|
|
|
@@ -51,20 +51,23 @@
|
|
|
<view class="form-group">
|
|
|
<view class="label">性别</view>
|
|
|
<view class="gender-options">
|
|
|
- <view class="gender-option" :class="sex == 'male' ? 'selected' : ''">
|
|
|
- <view class="gender-icon male" @tap="selectGender('male')">
|
|
|
+ <view class="gender-option" :class="sex == 'male' ? 'selected' : ''"
|
|
|
+ @tap="selectGender('male')">
|
|
|
+ <view class="gender-icon male">
|
|
|
<image src="../../static/me/wd_icon_nan.png" mode="aspectFit"></image>
|
|
|
男性
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="gender-option" :class="sex == 'female' ? 'selected' : ''">
|
|
|
- <view class="gender-icon female" @tap="selectGender('female')">
|
|
|
+ <view class="gender-option" :class="sex == 'female' ? 'selected' : ''"
|
|
|
+ @tap="selectGender('female')">
|
|
|
+ <view class="gender-icon female">
|
|
|
<image src="../../static/me/wd_icon_nv.png" mode="aspectFit"></image>
|
|
|
女性
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="gender-option" :class="sex == 'other' ? 'selected' : ''">
|
|
|
- <view class="gender-icon other" @tap="selectGender('other')">
|
|
|
+ <view class="gender-option" :class="sex == 'other' ? 'selected' : ''"
|
|
|
+ @tap="selectGender('other')">
|
|
|
+ <view class="gender-icon other">
|
|
|
<image src="../../static/me/wd_icon_qita.png" mode="aspectFit"></image>
|
|
|
其它
|
|
|
</view>
|
|
@@ -109,7 +112,7 @@
|
|
|
</view>
|
|
|
|
|
|
<!-- 角色信息展示页面 -->
|
|
|
- <view class="character-info" v-else-if="state == 5">
|
|
|
+ <view class="character-info" v-else-if="state == 5 || state == 6">
|
|
|
|
|
|
<view class="custom-navbar">
|
|
|
<view class="navbar-left" @click="goBack">
|
|
@@ -130,7 +133,7 @@
|
|
|
<!-- 角色信息板块 -->
|
|
|
<view class="info-section">
|
|
|
<view class="character-name">
|
|
|
- {{ starInfo.name }}
|
|
|
+ {{ starInfo.nickname }}
|
|
|
<image class="male" v-if="starInfo.sex == 0" src="../../static/me/wd_icon_nan.png"
|
|
|
mode="aspectFit">
|
|
|
</image>
|
|
@@ -157,7 +160,7 @@
|
|
|
<view class="description-title">
|
|
|
<view>人物标签</view>
|
|
|
</view>
|
|
|
- <view class="tags-box">
|
|
|
+ <view class="tags-box">
|
|
|
<view class="tag-item" v-for="tag in starInfo.tags" :key="tag">
|
|
|
{{ tag }}
|
|
|
</view>
|
|
@@ -167,7 +170,8 @@
|
|
|
</view>
|
|
|
|
|
|
<!-- 底部按钮 -->
|
|
|
- <view class="join-button" @tap="handleJoin"> 入驻星球 </view>
|
|
|
+ <view class="join-button" @tap="handleJoin(1)" v-if="state == 5"> 入驻星球 </view>
|
|
|
+ <view class="join-button" @tap="handleJoin(0)" v-if="state == 6"> 已驻星球 </view>
|
|
|
</view>
|
|
|
|
|
|
<SharePopup :visible="showShare" :share-url="shareUrl" :share-title="shareTitle" :share-desc="shareDesc"
|
|
@@ -177,6 +181,7 @@
|
|
|
|
|
|
<script>
|
|
|
import tabbarView from "@/components/tabbar/tabbar.vue";
|
|
|
+import value from '../../uni_modules/uv-text/components/uv-text/value';
|
|
|
|
|
|
export default {
|
|
|
components: {
|
|
@@ -198,11 +203,10 @@ export default {
|
|
|
"#9A8194", // 紫色
|
|
|
"#FF9F1C", // 橙色
|
|
|
],
|
|
|
- showForm: false,
|
|
|
showError: false,
|
|
|
formData: {
|
|
|
nickname: "",
|
|
|
- gender: "其他",
|
|
|
+ sex: "其他",
|
|
|
description: "",
|
|
|
tags: [],
|
|
|
},
|
|
@@ -211,7 +215,7 @@ export default {
|
|
|
starImg: "",
|
|
|
noteContent: "",
|
|
|
starInfo: {},
|
|
|
- state: 5, //0 是用户输入星灵基因重组仓的状态 1 是用户已经完成了匹星灵展示页面 2是用户匹配中加载的状态 3是匹配到了待点击进入设置界面 (根据其它字段判断是否失败) 4是用户设置星灵信息的页面 5是用户查看星灵信息的页面 待入驻 6是用户已经已经入驻星球了
|
|
|
+ state: 2, //0 是用户输入星灵基因重组仓的状态 1 是用户已经完成了匹星灵展示页面 2是用户匹配中加载的状态 3是匹配到了待点击进入设置界面 (根据其它字段判断是否失败) 4是用户设置星灵信息的页面 5是用户查看星灵信息的页面 待入驻 6是用户已经已经入驻星球了
|
|
|
sex: "",
|
|
|
selectTags: [],
|
|
|
info: {
|
|
@@ -226,15 +230,19 @@ export default {
|
|
|
"tags": "",
|
|
|
"status": 0
|
|
|
},
|
|
|
+ timeoutId: 0,
|
|
|
showShare: false,
|
|
|
shareUrl: "https://your-share-url.com",
|
|
|
shareTitle: "分享标题",
|
|
|
shareDesc: "分享描述",
|
|
|
shareImg: "https://your-share-image.com/image.jpg",
|
|
|
+ maxRetries: 10, // 最大重试次数
|
|
|
+ retryCount: 0, // 当前重试次数
|
|
|
+ pollingInterval: 30000, // 轮询间隔时间(毫秒)
|
|
|
};
|
|
|
},
|
|
|
onLoad() {
|
|
|
- this.getStar("get");
|
|
|
+ this.aIpipeiGetinfo("get");
|
|
|
},
|
|
|
methods: {
|
|
|
// 返回上一页
|
|
@@ -244,14 +252,18 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
confirmGender() {
|
|
|
- if (!this.noteContent) return;
|
|
|
// this.selectedGender = this.noteContent;
|
|
|
this.isLoading = true;
|
|
|
-
|
|
|
- this.getStar("make");
|
|
|
+ this.closeContentPopUpWindow();
|
|
|
+ this.state = 2
|
|
|
+ this.apiPeiStar();
|
|
|
},
|
|
|
goToSetProfile() {
|
|
|
- this.showForm = true;
|
|
|
+ this.state = 4;
|
|
|
+ this.formData.nickname = ''
|
|
|
+ this.formData.sex = ''
|
|
|
+ this.formData.tags = ''
|
|
|
+
|
|
|
},
|
|
|
toggleTag(tag) {
|
|
|
const index = this.formData.tags.indexOf(tag);
|
|
@@ -264,93 +276,32 @@ export default {
|
|
|
handleJoin() {
|
|
|
console.log("入驻星球");
|
|
|
// 处理入驻逻辑
|
|
|
- },
|
|
|
- getStar(act) {
|
|
|
- let that = this;
|
|
|
- console.log("uuid", getApp().globalData.uuid);
|
|
|
-
|
|
|
- // 设置加载状态
|
|
|
- if (act === "make") {
|
|
|
- this.isLoading = true;
|
|
|
- }
|
|
|
-
|
|
|
uni.request({
|
|
|
- url: this.$apiHost + "/Work/getStar",
|
|
|
+ url: this.$apiHost + "/AIpipei/gogogo",
|
|
|
data: {
|
|
|
uuid: getApp().globalData.uuid,
|
|
|
- sex: this.tempGender,
|
|
|
- // noteContent: this.noteContent,
|
|
|
- act: act,
|
|
|
},
|
|
|
header: {
|
|
|
- "content-type": "application/json",
|
|
|
+ "content-type": "application/x-www-form-urlencoded",
|
|
|
sign: getApp().globalData.headerSign,
|
|
|
},
|
|
|
+ method: "POST",
|
|
|
// 设置60秒超时
|
|
|
timeout: 60000,
|
|
|
success: (res) => {
|
|
|
- console.log("res.data", res.data);
|
|
|
- // res.data.have = 0
|
|
|
- if (res.data.have == 0) {
|
|
|
- this.showInfo = false;
|
|
|
- this.starImg = res.data.image;
|
|
|
- } else {
|
|
|
- //首次进来获取到了
|
|
|
- this.showInfo = true;
|
|
|
- }
|
|
|
- this.openContentPopUpWindow();
|
|
|
- if (res.data.success === "yes") {
|
|
|
- this.starImg = res.data.image;
|
|
|
- }
|
|
|
- if (res.data.info && res.data.info.tags != "") {
|
|
|
- let tags = res.data.info.tags.split(",");
|
|
|
- this.predefinedTags = tags.map(tag => ({
|
|
|
- text: tag,
|
|
|
- value: tag
|
|
|
- }));
|
|
|
- }
|
|
|
- this.starInfo = res.data.info || {};
|
|
|
- this.starInfo.tags = this.starInfo.tags.trim().split(",");
|
|
|
- console.log("starInfo", this.starInfo);
|
|
|
+ this.aIpipeiGetinfo({ polling: false })
|
|
|
|
|
|
- this.formData.description = this.starInfo.content;
|
|
|
- if (act == "make") {
|
|
|
- // 模拟加载过程
|
|
|
- setTimeout(() => {
|
|
|
- that.isLoading = false;
|
|
|
- }, 300);
|
|
|
- }
|
|
|
},
|
|
|
fail: (err) => {
|
|
|
- console.error("请求失败:", err);
|
|
|
- // 显示错误提示
|
|
|
- uni.showToast({
|
|
|
- title: "网络请求失败,请重试",
|
|
|
- icon: "none",
|
|
|
- duration: 2000,
|
|
|
- });
|
|
|
-
|
|
|
- // 重置加载状态
|
|
|
- if (act === "make") {
|
|
|
- that.isLoading = false;
|
|
|
- }
|
|
|
|
|
|
- // 如果是网络超时,自动重试一次
|
|
|
- if (err.errMsg.includes("timeout")) {
|
|
|
- setTimeout(() => {
|
|
|
- console.log("请求超时,正在重试...");
|
|
|
- that.getStar(act);
|
|
|
- }, 1000);
|
|
|
- }
|
|
|
},
|
|
|
complete: () => {
|
|
|
- // 确保在任何情况下都能重置加载状态
|
|
|
- if (act === "make" && this.isLoading) {
|
|
|
- this.isLoading = false;
|
|
|
- }
|
|
|
+
|
|
|
},
|
|
|
});
|
|
|
+
|
|
|
},
|
|
|
+
|
|
|
// 提交用户 开始创建的命令
|
|
|
apiPeiStar() {
|
|
|
if (!this.noteContent) {
|
|
@@ -367,44 +318,31 @@ export default {
|
|
|
content: this.noteContent,
|
|
|
},
|
|
|
header: {
|
|
|
- "content-type": "application/json",
|
|
|
+ "content-type": "application/x-www-form-urlencoded",
|
|
|
sign: getApp().globalData.headerSign,
|
|
|
},
|
|
|
// 设置60秒超时
|
|
|
timeout: 60000,
|
|
|
- methods: "POST",
|
|
|
+ method: 'POST',
|
|
|
success: (res) => {
|
|
|
- console.log("开始AI匹配", res.data);
|
|
|
- state
|
|
|
- if (res.data.have == 0) {
|
|
|
- this.showInfo = false;
|
|
|
- this.starImg = res.data.image;
|
|
|
- } else {
|
|
|
- //首次进来获取到了
|
|
|
- this.showInfo = true;
|
|
|
- }
|
|
|
- this.openContentPopUpWindow();
|
|
|
- if (res.data.success === "yes") {
|
|
|
- this.starImg = res.data.image;
|
|
|
- }
|
|
|
- if (res.data.info && res.data.info.tags != "") {
|
|
|
- let tags = res.data.info.tags.split(",");
|
|
|
- this.predefinedTags = tags.map(tag => ({
|
|
|
- text: tag,
|
|
|
- value: tag
|
|
|
- }));
|
|
|
- }
|
|
|
- this.starInfo = res.data.info || {};
|
|
|
- this.starInfo.tags = this.starInfo.tags.trim().split(",");
|
|
|
- console.log("starInfo", this.starInfo);
|
|
|
+ setTimeout(() => {
|
|
|
+ uni.showToast({
|
|
|
+ title: res.data.str,
|
|
|
+ icon: "none",
|
|
|
+ duration: 2000,
|
|
|
+ });
|
|
|
+ if (res.data.str == "内容不能为空") {
|
|
|
+ this.openContentPopUpWindow();
|
|
|
+ this.state = 0
|
|
|
+ this.apiPeiStar();
|
|
|
+ }
|
|
|
+ if (res.data.str == "开始匹配") {
|
|
|
+ this.aIpipeiGetinfo({ polling: true })
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }, 3000);
|
|
|
|
|
|
- this.formData.description = this.starInfo.content;
|
|
|
- if (act == "make") {
|
|
|
- // 模拟加载过程
|
|
|
- setTimeout(() => {
|
|
|
- that.isLoading = false;
|
|
|
- }, 300);
|
|
|
- }
|
|
|
},
|
|
|
fail: (err) => {
|
|
|
console.error("请求失败:", err);
|
|
@@ -416,28 +354,36 @@ export default {
|
|
|
});
|
|
|
|
|
|
// 重置加载状态
|
|
|
- if (act === "make") {
|
|
|
- that.isLoading = false;
|
|
|
- }
|
|
|
|
|
|
- // 如果是网络超时,自动重试一次
|
|
|
- if (err.errMsg.includes("timeout")) {
|
|
|
- setTimeout(() => {
|
|
|
- console.log("请求超时,正在重试...");
|
|
|
- that.getStar(act);
|
|
|
- }, 1000);
|
|
|
- }
|
|
|
},
|
|
|
complete: () => {
|
|
|
- // 确保在任何情况下都能重置加载状态
|
|
|
- if (act === "make" && this.isLoading) {
|
|
|
- this.isLoading = false;
|
|
|
- }
|
|
|
+
|
|
|
},
|
|
|
});
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
// 查询Ai匹配信息
|
|
|
- aIpipeiGetinfo(act) {
|
|
|
+ aIpipeiGetinfo({ polling }) {
|
|
|
+ // 清除之前的定时器
|
|
|
+ if (this.timeoutId) {
|
|
|
+ clearTimeout(this.timeoutId);
|
|
|
+ this.timeoutId = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 检查是否超过最大重试次数
|
|
|
+ if (polling && this.retryCount >= this.maxRetries) {
|
|
|
+ uni.showToast({
|
|
|
+ title: '匹配超时,请重新尝试',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000
|
|
|
+ });
|
|
|
+ this.retryCount = 0;
|
|
|
+ this.state = 0;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 发起请求
|
|
|
uni.request({
|
|
|
url: this.$apiHost + "/AIpipei/getinfo",
|
|
|
data: {
|
|
@@ -447,55 +393,113 @@ export default {
|
|
|
"content-type": "application/json",
|
|
|
sign: getApp().globalData.headerSign,
|
|
|
},
|
|
|
- // 设置60秒超时
|
|
|
timeout: 60000,
|
|
|
success: (res) => {
|
|
|
console.log("查询到生成信息", res.data);
|
|
|
+ // 重置重试计数
|
|
|
+ this.retryCount = 0;
|
|
|
+
|
|
|
+ if (res && res.data && res.data.info) {
|
|
|
+ if (res.data.info && res.data.info.tags != "") {
|
|
|
+ res.data.info.tags = res.data.info.tags.split(",");
|
|
|
+ this.predefinedTags = res.data.info.tags.map(tag => { return { text: tag, value: tag } })
|
|
|
+ console.log(666, res);
|
|
|
+
|
|
|
+ } else {
|
|
|
+ res.data.info.tags = []
|
|
|
+
|
|
|
+ }
|
|
|
+ // 实现状态的判断
|
|
|
+ // 更改状态为 用户还未匹配过 待输入匹配内容
|
|
|
+ if (res.data.str == "没有匹配过" && res.data.info) {
|
|
|
+ this.state = 0
|
|
|
+ setTimeout(() => {
|
|
|
+ this.openContentPopUpWindow();
|
|
|
+ }, 300);
|
|
|
+ }
|
|
|
+ // 更改状态为 用户还匹配成功时 待点击设置心灵简介
|
|
|
+ if (res.data.info.image && res.data.info.status == 2) {
|
|
|
+ this.state = 1
|
|
|
+ this.openContentPopUpWindow();
|
|
|
+ }
|
|
|
+ if (res.data.info.image && res.data.info.status == 1) {
|
|
|
+ this.state = 6
|
|
|
+ }
|
|
|
+ if (res.data.info.image && res.data.info.status == 3) {
|
|
|
+ this.state = 5
|
|
|
+ }
|
|
|
+ this.starInfo = res.data.info;
|
|
|
+
|
|
|
+ if (res.data.info.content) {
|
|
|
+ this.formData.description = res.data.info.content;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
fail: (err) => {
|
|
|
console.error("请求失败:", err);
|
|
|
+ // 增加重试计数
|
|
|
+ this.retryCount++;
|
|
|
+
|
|
|
// 显示错误提示
|
|
|
uni.showToast({
|
|
|
- title: "网络请求失败,请重试",
|
|
|
+ title: `网络请求失败,第${this.retryCount}次重试`,
|
|
|
icon: "none",
|
|
|
duration: 2000,
|
|
|
});
|
|
|
- // 如果是网络超时,自动重试一次
|
|
|
+
|
|
|
+ // 如果是网络超时,自动重试
|
|
|
if (err.errMsg.includes("timeout")) {
|
|
|
setTimeout(() => {
|
|
|
console.log("请求超时,正在重试...");
|
|
|
- that.aIpipeiGetinfo(act);
|
|
|
+ this.aIpipeiGetinfo({ polling: true });
|
|
|
}, 6000);
|
|
|
}
|
|
|
},
|
|
|
complete: () => {
|
|
|
-
|
|
|
- },
|
|
|
+ // 如果需要继续轮询,设置下一次请求
|
|
|
+ if (polling) {
|
|
|
+ this.timeoutId = setTimeout(() => {
|
|
|
+ this.aIpipeiGetinfo({ polling: true });
|
|
|
+ }, this.pollingInterval);
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
// 保存表单信息
|
|
|
submitStar() {
|
|
|
this.formData.tags = this.selectTags.join(",");
|
|
|
- this.state = 5
|
|
|
- return
|
|
|
let that = this;
|
|
|
uni.showLoading({
|
|
|
mask: true,
|
|
|
});
|
|
|
+ if (this.formData.sex) {
|
|
|
+ this.formData.sex = this.genderScreeningId(this.formData.sex);
|
|
|
+ }
|
|
|
+ console.log({
|
|
|
+ uuid: getApp().globalData.uuid,
|
|
|
+ sex: this.formData.sex,
|
|
|
+ name: this.formData.nickname,
|
|
|
+ content: this.formData.description,
|
|
|
+ tags: this.formData.tags,
|
|
|
+
|
|
|
+ }, 2000);
|
|
|
+
|
|
|
uni.request({
|
|
|
url: this.$apiHost + "/AIpipei/save",
|
|
|
data: {
|
|
|
uuid: getApp().globalData.uuid,
|
|
|
- sex: this.tempGender,
|
|
|
- // noteContent: this.noteContent,
|
|
|
- name: this.formData.nickname,
|
|
|
+ sex: this.formData.sex,
|
|
|
+ nickname: this.formData.nickname,
|
|
|
content: this.formData.description,
|
|
|
+ tags: this.formData.tags,
|
|
|
|
|
|
},
|
|
|
header: {
|
|
|
- "content-type": "application/json",
|
|
|
+ "content-type": "application/x-www-form-urlencoded",
|
|
|
sign: getApp().globalData.headerSign,
|
|
|
},
|
|
|
+ method: 'POST',
|
|
|
// 设置60秒超时
|
|
|
timeout: 10000,
|
|
|
success: (res) => {
|
|
@@ -507,7 +511,7 @@ export default {
|
|
|
});
|
|
|
if (res.data.success === "yes") {
|
|
|
setTimeout(() => {
|
|
|
- that.aIpipeiGetinfo();
|
|
|
+ that.aIpipeiGetinfo({ polling: false });
|
|
|
}, 300);
|
|
|
}
|
|
|
},
|
|
@@ -540,7 +544,26 @@ export default {
|
|
|
this.$refs.openContentPopUpWindow.close();
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+ genderScreening(str) {
|
|
|
+ switch (str) {
|
|
|
+ case '0':
|
|
|
+ return '男'
|
|
|
+ case '1':
|
|
|
+ return '女'
|
|
|
+ case '2':
|
|
|
+ return '其它'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ genderScreeningId(str) {
|
|
|
+ switch (str) {
|
|
|
+ case 'male':
|
|
|
+ return 0
|
|
|
+ case 'female':
|
|
|
+ return 1
|
|
|
+ case 'other':
|
|
|
+ return 2
|
|
|
+ }
|
|
|
+ }
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
@@ -562,7 +585,7 @@ export default {
|
|
|
min-height: 200rpx !important;
|
|
|
font-weight: 400;
|
|
|
font-size: 28rpx;
|
|
|
- color: #999999;
|
|
|
+ color: #1f1f1f;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -578,8 +601,6 @@ export default {
|
|
|
|
|
|
|
|
|
::v-deep.checklist-box {
|
|
|
-
|
|
|
-
|
|
|
border-radius: 16rpx !important;
|
|
|
border: 2rpx solid #1f1f1f !important;
|
|
|
background-color: #fff !important;
|
|
@@ -605,6 +626,8 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
.star-container {
|
|
|
|
|
|
/* 自定义导航栏样式 */
|
|
@@ -641,7 +664,7 @@ export default {
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
|
-
|
|
|
+
|
|
|
.fa-angle-left {
|
|
|
font-size: 48rpx;
|
|
|
color: #333;
|