-
+
+
+ 女
+ 男
+
+
-
+
{{ item.title }}
{{ peopleNum(item.mouldType) }}
@@ -20,33 +33,73 @@
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index 1ac9f02..92a6f8c 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -30,9 +30,7 @@
我的金币: {{ userInfoModulesPinia.myGlod }}
- 购买金币购买金币
登录即可体验更多功能哦!
@@ -70,9 +68,7 @@
v-for="item in PhotoList"
:key="item.id"
class="showListItem"
- @click="
- goOtherPage(`/pages/lookPhoto/index?id=${item.id}`, item.status)
- "
+ @click="goLookPhoto(item.id, item.status)"
>
{{ item.title }}
@@ -116,11 +112,7 @@
暂无数据 ,
- 去生成!
+ 去生成!
@@ -226,6 +218,7 @@ import {
findGlodApi,
getPhotoListApi,
getConsumeListApi,
+ getInviteListApi,
deleteApi,
} from "../../api/home.js";
import { userInfoModules } from "@/store/modules/userInfo";
@@ -252,47 +245,25 @@ function chooseAvatar() {
url: "/pages/uploadPhoto/uploadPhoto",
});
return;
- uni.chooseImage({
- count: 1, // 最多可以选择的图片张数,这里设置为1,只选择一张图片
- success: async (res) => {
- // avatarUrl.value = res.tempFilePaths[0];
- // TODO: 在这里处理图片上传逻辑,你可以调用上传接口将图片上传到服务器
- // 示例代码:
- // uploadImageToServer(tempFilePaths[0]);
- // 图片压缩
- console.log(res.tempFiles[0].size);
- if (userInfoModulesPinia.platForm != 1) {
- uni.compressImage({
- src: res.tempFilePaths[0],
- quality: 20,
- success: (res2) => {
- avatarUrl.value = res2.tempFilePath;
- console.log(res2.tempFilePath);
- },
- });
- } else {
- const options = {
- maxSizeMB: 2, // 最大压缩大小为 4MB
- useWebWorker: true, // 使用 Web Worker 进行压缩,提高性能
- };
- const compressedFile = await imageCompression(
- res.tempFiles[0],
- options
- );
- //compressedFile是一个blob对象
- avatarUrl.value = URL.createObjectURL(compressedFile);
- console.log(compressedFile);
- // avatarUrl.value = compressedFile;
- console.log("压缩图片h5");
- }
- },
- fail: (err) => {
- console.error("选择图片失败", err);
- },
- });
}
+//#endregion
-function goOtherPage(url, status) {
+//#region 路由跳转
+function goBuyCoin() {
+ if (userInfoModulesPinia.platForm == 3) {
+ uni.showToast({
+ title: "暂未开放",
+ icon: "none",
+ mask: true,
+ });
+ } else {
+ uni.navigateTo({
+ url: "/pages/index/buyCoin",
+ });
+ }
+}
+
+function goLookPhoto(id, status) {
if (status != 2) {
uni.showToast({
title: "正在生成,请稍后",
@@ -301,9 +272,24 @@ function goOtherPage(url, status) {
return;
}
uni.navigateTo({
- url: url,
+ url: `/pages/lookPhoto/index?id=${id}`,
});
}
+
+function goCloseStyle() {
+ if (!userInfoModulesPinia.myAvatar) {
+ uni.showToast({
+ title: "请先上传头像",
+ icon: "none",
+ mask: true,
+ });
+ } else {
+ uni.navigateTo({
+ url: `/pages/closeStyle/closeStyle`,
+ });
+ }
+}
+
//#endregion
//#region tab
@@ -319,13 +305,14 @@ function clickTabHandle(e) {
return;
}
showListActive.value = e.id;
-
pageNum1.value = 1;
pageNum2.value = 1;
+ pageNum3.value = 1;
if (e.id == 1) {
getPhotoList(pageSize1.value, pageNum1.value);
} else if (e.id == 2) {
} else if (e.id == 3) {
+ getInviteList(pageSize3.value, pageNum3.value);
} else if (e.id == 4) {
getConsumeList(pageSize2.value, pageNum2.value);
}
@@ -412,11 +399,44 @@ function getSymbol(type) {
if ([1, 2, 3].includes(type)) {
return "+";
} else {
- return "-";
+ return "";
}
}
//#endregion 获取图片,金币,
+//#region 获取消费记录
+const pageSize3 = ref(20);
+const pageNum3 = ref(1);
+const InviteList = ref(20);
+async function getInviteList(pageSize, pageNum) {
+ try {
+ const res = await getInviteListApi(pageSize, pageNum);
+ InviteList.value = res.data.list;
+ } catch (error) {}
+}
+
+/**
+ * @description:触底加载更多消费记录
+ */
+async function getMoreInviteList() {
+ try {
+ pageNum2.value += 1;
+ const res = await getInviteListApi(pageSize3.value, pageNum3.value);
+ if (res.data && res.data.list && res.data.list.length == 0) {
+ pageNum3.value -= 1;
+ }
+ InviteList.value.push(...res.data.list);
+ } catch (error) {
+ console.log(error, "error");
+ uni.showToast({
+ title: "获取数据失败,请重试",
+ icon: "none",
+ });
+ }
+}
+
+//#endregion
+
const myAvatar = ref(
"https://suimang.oss-accelerate.aliyuncs.com/capi/2023-08-25/03b58cd2f52c49829435addbf1ec435a.jpg?x-oss-process=image/resize,w_10000/quality,q_60"
);
@@ -494,6 +514,7 @@ onLoad(async () => {
findGlod();
getPhotoList(pageSize1.value, pageNum1.value);
getConsumeList(pageSize2.value, pageNum2.value);
+ getInviteList(pageSize3.value, pageNum3.value);
}
// setTimeout(() => {
// findImage();
@@ -706,12 +727,13 @@ onShareAppMessage((res) => {
}
}
}
- .noData {
- text-align: center;
- .goCreate {
- color: #ff4f00;
- text-decoration: underline;
- }
+}
+.noData {
+ margin-top: 20rpx;
+ text-align: center;
+ .goCreate {
+ color: #ff4f00;
+ text-decoration: underline;
}
}
// 视频列表
diff --git a/src/pages/login/index.vue b/src/pages/login/index.vue
index 39ae650..6e328dc 100644
--- a/src/pages/login/index.vue
+++ b/src/pages/login/index.vue
@@ -20,7 +20,7 @@
+
+
+
+
+
+
+
+
+
+ {{ backwardsNum < 60 ? backwardsNum + "s" : "发送验证码" }}
+
+
+
+
+
+
+ 登录
+
+
+
+
+ 隐私协议更新
+
+ 感谢您一直以来对我们的信任和支持。为了更好地保护您的个人信息安全我们已经更新了隐私协议。如您继续使用我们的服务即表示同意并接受更新后的隐私协议。如您有任何疑问或意见,欢迎您联系我们的客户服务团队。
+
+
+ 同意
+
+
+ 查看《隐私保护指引》
+
+
+
+
@@ -64,11 +152,18 @@
//#region 导入
import { ref, reactive, computed } from "vue";
import { onLoad } from "@dcloudio/uni-app";
-import { voiceTotalApi, loginPhoneApi } from "../../api/login.js";
+import {
+ loginApi,
+ loginPhoneApi,
+ getCodeApi,
+ loginByCodeApi,
+} from "../../api/login.js";
import { userInfoModules } from "@/store/modules/userInfo";
//#endregion
const userInfoModulesPinia = userInfoModules();
+const showPrivacy = ref(false);
+
const pageClass = computed(() => {
if (userInfoModulesPinia.platForm == 1) {
return "page pageH5";
@@ -76,7 +171,7 @@ const pageClass = computed(() => {
return "page";
}
});
-//#region 勾选
+//#region 勾选和手机号授权
const checkboxValue = ref([]);
const checkboxList = ref([
{
@@ -87,15 +182,17 @@ function changedCheckbox(e) {
console.log(e);
}
-async function getphonenumber(e) {
- console.log(e);
+async function dogetphonenumber(e) {
+ console.log(e, "e");
if (e.detail.errMsg.includes("ok")) {
+ // if (e.detail.errMsg.includes("fail")) {
//用户授权了手机号
const data = {
- appId: "wx75cf14e3a0d45821",
+ appId: userInfoModulesPinia.getAppId(),
openId: userInfoModulesPinia.openId,
encryptedData: e.detail.encryptedData,
iv: e.detail.iv,
+ uid: urlUid.value,
};
try {
const res2 = await loginPhoneApi(data);
@@ -110,7 +207,7 @@ async function getphonenumber(e) {
} catch (error) {
uni.showToast({
icon: "none",
- title: "获取失败",
+ title: "获取手机号失败",
});
}
} else {
@@ -126,7 +223,7 @@ async function toCreate(e) {
console.log();
if (checkboxValue.value[0]) {
// await handleLogin();
- await getphonenumber(e);
+ await dogetphonenumber(e);
} else {
uni.showModal({
title: "提示",
@@ -135,7 +232,7 @@ async function toCreate(e) {
if (res.confirm) {
checkboxValue.value = ["同意智像相机用户使用协议"];
// handleLogin();
- getphonenumber(e);
+ dogetphonenumber(e);
} else if (res.cancel) {
}
},
@@ -192,23 +289,343 @@ const goPro = () => {
};
//#endregion ---------------------
-//#region
+//#region 抖音手机号登录
+const formData = ref({
+ phoneNum: null,
+ codeNum: null,
+});
+const rules = {
+ phoneNum: [
+ {
+ required: true,
+ message: "请填写手机号",
+ trigger: ["blur"],
+ },
+ {
+ // 自定义验证函数,见上说明
+ validator: (rule, value, callback) => {
+ // 上面有说,返回true表示校验通过,返回false表示不通过
+ // uni.$u.test.mobile()就是返回true或者false的
+ return uni.$u.test.mobile(value);
+ },
+ message: "手机号码不正确",
+ // 触发器可以同时用blur和change
+ trigger: ["blur"],
+ },
+ ],
+};
+const formRef = ref(null);
+const form1 = ref(null);
+const backwardsNum = ref(60);
+const countdownTimer = ref(null); // 倒计时的计时器
+const timerFlag = ref(false);
+function getCode() {
+ if (timerFlag.value) {
+ return; // 如果倒计时尚未结束,不执行倒计时操作
+ }
+ timerFlag.value = true;
+ formRef.value
+ .validate()
+ .then(async (res) => {
+ try {
+ uni.showLoading({
+ title: "请稍后",
+ mask: true,
+ });
+ const res = await getCodeApi(formData.value.phoneNum);
+ console.log(res.code, "duanxing");
+ uni.hideLoading();
+ if (res.code != 200) {
+ uni.showToast({
+ title: res.message,
+ icon: "none",
+ });
+ }
+ console.log(res);
+ // 表单验证通过后开始倒计时
+ countdownTimer.value = setInterval(() => {
+ if (backwardsNum.value > 0) {
+ backwardsNum.value--;
+ } else {
+ clearInterval(countdownTimer.value);
+ countdownTimer.value = null;
+ backwardsNum.value = 60;
+ timerFlag.value = false;
+ }
+ }, 1000);
+ } catch (error) {
+ uni.hideLoading();
+ uni.$u.toast("短信验证码获取失败");
+ clearInterval(countdownTimer.value);
+ countdownTimer.value = null;
+ backwardsNum.value = 5;
+ timerFlag.value = false;
+ }
+ })
+ .catch((errors) => {
+ console.log(errors);
+ });
+}
+
+async function loginByCode() {
+ uni.showLoading({
+ title: "请稍后",
+ mask: true,
+ });
+ const data = {
+ appId: userInfoModulesPinia.getAppId(),
+ openId: userInfoModulesPinia.openId,
+ phone: formData.value.phoneNum,
+ code: formData.value.codeNum,
+ };
+ try {
+ const res = await loginByCodeApi(data);
+ console.log(res);
+ uni.hideLoading();
+ userInfoModulesPinia.token = res.data.token;
+ console.log(res.code, "denglu");
+ if (res.code != 200) {
+ uni.showToast({
+ title: res.message,
+ icon: "none",
+ });
+ } else {
+ // uni.switchTab({
+ // url: "/pages/uploadPhoto/uploadPhoto",
+ // });
+ }
+ } catch (error) {
+ uni.hideLoading();
+ uni.showToast({
+ title: "登录失败,请重试",
+ icon: "none",
+ });
+ }
+}
+//#endregion ---------------------
+
+//#region 隐私协议
+const getPrivacySetting = (num) => {
+ const canIUsePrivacy = wx.canIUse("getPrivacySetting");
+ // console.log(canIUsePrivacy, "canIUse getPrivacySetting");
+ if (canIUsePrivacy) {
+ wx.getPrivacySetting({
+ success: (res) => {
+ // console.log(res, "getPrivacySetting"); // 返回结果为: res = { needAuthorization: true/false, privacyContractName: '《xxx隐私保护指引》' }
+ if (res.needAuthorization) {
+ // 需要弹出隐私协议
+ showPrivacy.value = true;
+ } else {
+ // 用户已经同意过隐私协议,所以不需要再弹出隐私协议,也能调用已声明过的隐私接口
+ if (num == 1) {
+ // 返回token,直接跳转首页
+ // uni.switchTab({
+ // url: "/pages/uploadPhoto/uploadPhoto",
+ // });
+ } else if (num == 2) {
+ // 没有返回token,无事发生
+ }
+ }
+ },
+ fail: () => {},
+ complete: () => {},
+ });
+ }
+};
+
+// 关闭弹框直接退出小程序,仅对微信小程序生效
+const closePrivacy = () => {
+ wx.exitMiniProgram();
+};
+
+const handleAgreePrivacyAuthorization = () => {
+ // console.log("Privacy Agreed!");
+ showPrivacy.value = false;
+ // 用户同意隐私协议事件回调
+ // 用户点击了同意,之后所有已声明过的隐私接口和组件都可以调用了
+};
+
+const handleOpenPrivacyContract = () => {
+ // 打开隐私协议页面
+ wx.openPrivacyContract({
+ success: () => {}, // 打开成功
+ fail: () => {}, // 打开失败
+ complete: () => {},
+ });
+};
+//#endregion ---------------------------------
+
+//#region 初始化
+const urlUid = ref(""); //通过邀请来的会携带邀请人ID参数
onLoad((options) => {
+ // 二维码扫描进入时
+ if (options.scene) {
+ const str = decodeURIComponent(options.scene);
+ const regex = /_u:(\d+)/; // 正则表达式匹配_u:后面的数字
+ const match = str.match(regex);
+ urlUid.value = match[1];
+ }
+ // 分享链接进入时
+ else if (options.userId) {
+ urlUid.value = options.userId;
+ } else {
+ urlUid.value = null;
+ }
+ console.log(urlUid.value, "邀请人id");
uni.hideHomeButton();
// workId.value = options.id;
+
if (options.type == "tokenFfalse") {
uni.showToast({
title: "登录失效,请重新登录",
icon: "none",
});
}
+
+ if (userInfoModulesPinia.platForm == 2) {
+ uni.login({
+ provider: "weixin", // 使用微信登录授权
+ success: async (res) => {
+ if (res.code) {
+ try {
+ uni.showLoading({
+ title: "加载中...",
+ mask: true,
+ });
+ const data = {
+ appId: userInfoModulesPinia.getAppId(),
+ code: res.code,
+ };
+ const res2 = await loginApi(data);
+ userInfoModulesPinia.openId = res2.data.openId;
+ if (res2.data.token) {
+ userInfoModulesPinia.token = res2.data.token;
+ // uni.setStorageSync("token", userInfoModulesPinia.token);
+ console.log(userInfoModulesPinia.openId, "获取openid");
+ // 获取头像和金币
+ // const res3 = await findImageApi();
+ // userInfoModulesPinia.myAvatar =
+ // res3.data && res3.data.image ? res3.data.image : "";
+ // const res4 = await findGlodApi();
+ // if (!res4.data) {
+ // userInfoModulesPinia.myGlod = 0;
+ // } else {
+ // userInfoModulesPinia.myGlod = res4.data.digitalAvatarResidueGlod
+ // ? res4.data.digitalAvatarResidueGlod
+ // : 0;
+ // }
+ uni.hideLoading();
+ if (res2.data.token) {
+ getPrivacySetting(1);
+ } else {
+ console.log("error1");
+ uni.showToast({
+ title: "登录失败,请重试",
+ icon: "none",
+ });
+ }
+ } else {
+ getPrivacySetting(2);
+ }
+ uni.hideLoading();
+ } catch (error) {
+ // uni.redirectTo({
+ // url: "pages/index/index",
+ // });
+ console.log(error, "error2");
+ uni.showToast({
+ title: "登录失败,请重试",
+ icon: "none",
+ });
+ }
+ } else {
+ // uni.redirectTo({
+ // url: "pages/index/index",
+ // });
+ console.log("error3");
+ uni.showToast({
+ title: "登录失败,请重试",
+ icon: "none",
+ });
+ }
+ },
+ fail: (err) => {
+ // uni.redirectTo({
+ // url: "pages/index/index",
+ // });
+ console.log("error4");
+ uni.showToast({
+ title: "登录失败,请重试",
+ icon: "none",
+ });
+ },
+ });
+ }
+ // 抖音头条授权
+ else if (userInfoModulesPinia.platForm == 3) {
+ uni.login({
+ provider: "toutiao", // 使用微信登录授权
+ success: async (res) => {
+ if (res.code) {
+ try {
+ uni.showLoading({
+ title: "加载中...",
+ mask: true,
+ });
+ const data = {
+ appId: userInfoModulesPinia.getAppId(),
+ code: res.code,
+ };
+ const res2 = await loginApi(data);
+ userInfoModulesPinia.openId = res2.data.openId;
+ if (res2.data.token) {
+ userInfoModulesPinia.token = res2.data.token;
+ // uni.setStorageSync("token", userInfoModulesPinia.token);
+ console.log(userInfoModulesPinia.openId, "获取openid");
+ uni.hideLoading();
+ } else {
+ uni.hideLoading();
+ // uni.redirectTo({
+ // url: "/pages/login/index",
+ // });
+ console.log("error1");
+ uni.showToast({
+ title: "登录失败,请重试",
+ icon: "none",
+ });
+ }
+ uni.hideLoading();
+ } catch (error) {
+ uni.hideLoading();
+ console.log(error, "error2");
+ uni.showToast({
+ title: "登录失败,请重试",
+ icon: "none",
+ });
+ }
+ } else {
+ console.log("error3");
+ uni.showToast({
+ title: "登录失败,请重试",
+ icon: "none",
+ });
+ }
+ },
+ fail: (err) => {
+ console.log("error4");
+ uni.showToast({
+ title: "登录失败,请重试",
+ icon: "none",
+ });
+ },
+ });
+ }
});
//#endregion ---------------------------------
//#region
//#endregion ---------------------------------
-// voiceTotalApi();
diff --git a/src/pages/lookPhoto/index.vue b/src/pages/lookPhoto/index.vue
index ae5c1c5..5d924a8 100644
--- a/src/pages/lookPhoto/index.vue
+++ b/src/pages/lookPhoto/index.vue
@@ -2,6 +2,7 @@
- 左右滑动查看更多
+
+ 左右滑动查看更多
+ 生成中,请稍后...
- {{ supperTips() }}
+
+ {{ supperTips() }} -->
-
+
邀请好友可获得2枚金币
- 分享
- 邀请好友
+ 分享
+ 邀请好友
金币充值
+
+
+
+ 长按保存、分享、收藏
+ 关闭
+
+
+
diff --git a/src/pages/recorded/index.vue b/src/pages/recorded/index.vue
index 2a23c32..ca19f17 100644
--- a/src/pages/recorded/index.vue
+++ b/src/pages/recorded/index.vue
@@ -1,75 +1,50 @@
-
-
-
-
+
+
+
-
-
-
+
+
+ 开始录音
-
-
-
-
-
+ 试听
+ 重新录音
+
+
+
+ 生成视频
-
-
-
-
-
-
-
-
+
+ 邀请好友可获得2枚金币
+ 分享
+ 邀请好友
+ 购买金币
@@ -91,17 +65,57 @@
+
+
diff --git a/src/pages/uploadPhoto/success.vue b/src/pages/uploadPhoto/success.vue
index 267d789..85bdf8f 100644
--- a/src/pages/uploadPhoto/success.vue
+++ b/src/pages/uploadPhoto/success.vue
@@ -37,7 +37,7 @@