Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/dev_czc' into dev

master
congzc 1 anno fa
parent
commit
319e1c2d30
2 ha cambiato i file con 17 aggiunte e 7 eliminazioni
  1. +5
    -1
      src/pages/index/index.vue
  2. +12
    -6
      src/pages/uploadPhoto/uploadPhoto.vue

+ 5
- 1
src/pages/index/index.vue Vedi File

@@ -140,7 +140,11 @@ const pageClass = computed(() => {
//#endregion //#endregion
//#region 头像 //#region 头像
const avatarUrl = ref(null); const avatarUrl = ref(null);
function chooseAvatar(params) {
function chooseAvatar() {
uni.navigateTo({
url: "/pages/uploadPhoto/uploadPhoto",
});
return;
uni.chooseImage({ uni.chooseImage({
count: 1, // 最多可以选择的图片张数,这里设置为1,只选择一张图片 count: 1, // 最多可以选择的图片张数,这里设置为1,只选择一张图片
success: async (res) => { success: async (res) => {


+ 12
- 6
src/pages/uploadPhoto/uploadPhoto.vue Vedi File

@@ -85,8 +85,8 @@ const userInfoModulesPinia = userInfoModules();
//#region 选择图片 //#region 选择图片
const uploadState = ref(1); //上传状态 const uploadState = ref(1); //上传状态
const showImgUrl = ref(null); //回显路径
const showImgUrl2 = ref(null); //回显路径
const showImgUrl = ref(null); //回显路径 压缩
const showImgUrl2 = ref(null); //回显路径 未压缩
const showImgData = ref(null); //上传数据 const showImgData = ref(null); //上传数据
function chooseImage() { function chooseImage() {
// 调用uni.chooseImage方法选择图片 // 调用uni.chooseImage方法选择图片
@@ -100,7 +100,7 @@ function chooseImage() {
if (userInfoModulesPinia.platForm != 1) { if (userInfoModulesPinia.platForm != 1) {
uni.compressImage({ uni.compressImage({
src: res.tempFilePaths[0], src: res.tempFilePaths[0],
quality: 80,
quality: 40,
success: (res2) => { success: (res2) => {
showImgUrl.value = res2.tempFilePath; showImgUrl.value = res2.tempFilePath;
}, },
@@ -140,10 +140,12 @@ async function toCloseStyle() {
} }
uploadState.value = 3; uploadState.value = 3;
console.log(showImgUrl.value);
console.log(showImgUrl2.value.path);
// 人脸识别接口 // 人脸识别接口
uni.uploadFile({ uni.uploadFile({
url: "https://test.metavatar.cc/C/api/userDigital/checkPhoto", //上传图片api url: "https://test.metavatar.cc/C/api/userDigital/checkPhoto", //上传图片api
filePath: showImgUrl.value,
filePath: showImgUrl2.value.path,
name: "file", name: "file",
formData: { formData: {
user: "test", user: "test",
@@ -161,7 +163,7 @@ async function toCloseStyle() {
// 上传接口 // 上传接口
uni.uploadFile({ uni.uploadFile({
url: "https://test.metavatar.cc/C/api/upload/awsImgUpload", //上传图片api url: "https://test.metavatar.cc/C/api/upload/awsImgUpload", //上传图片api
filePath: showImgUrl.value,
filePath: showImgUrl2.value.path,
name: "file", name: "file",
formData: { formData: {
user: "test", user: "test",
@@ -202,7 +204,11 @@ async function toCloseStyle() {
}); });
}, },
fail: () => { fail: () => {
uploadState.value = 4;
uploadState.value = 1;
uni.showToast({
title: "网络被数字人偷走了, 请稍后重试",
icon: "none",
});
}, },
}); });
} }


Caricamento…
Annulla
Salva