feat: release
This commit is contained in:
@@ -37,7 +37,7 @@
|
|||||||
<view class="cover-card" :class="{ 'has-cover': formData.coverUrl }" @tap="chooseCover">
|
<view class="cover-card" :class="{ 'has-cover': formData.coverUrl }" @tap="chooseCover">
|
||||||
<image
|
<image
|
||||||
v-if="formData.coverUrl"
|
v-if="formData.coverUrl"
|
||||||
:src="formData.coverUrl"
|
:src="FILE_BASE_URL + formData.coverUrl"
|
||||||
class="cover-image"
|
class="cover-image"
|
||||||
mode="aspectFill"
|
mode="aspectFill"
|
||||||
/>
|
/>
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
<view class="participant-avatar-wrap" @tap="chooseParticipantAvatar(index)">
|
<view class="participant-avatar-wrap" @tap="chooseParticipantAvatar(index)">
|
||||||
<image
|
<image
|
||||||
v-if="item.avatar"
|
v-if="item.avatar"
|
||||||
:src="item.avatar"
|
:src="FILE_BASE_URL + item.avatar"
|
||||||
class="participant-avatar"
|
class="participant-avatar"
|
||||||
mode="aspectFill"
|
mode="aspectFill"
|
||||||
/>
|
/>
|
||||||
@@ -160,10 +160,11 @@
|
|||||||
import { reactive, ref } from "vue";
|
import { reactive, ref } from "vue";
|
||||||
import { onLoad } from "@dcloudio/uni-app";
|
import { onLoad } from "@dcloudio/uni-app";
|
||||||
import { getStatusBarHeight } from "@/utils/system";
|
import { getStatusBarHeight } from "@/utils/system";
|
||||||
import { releaseTopic, fetchTopicCategories } from "@/api/release";
|
import { releaseTopic, fetchTopicCategories } from "@/api/topic";
|
||||||
import { smartNavigateBack } from "@/utils/page";
|
import { smartNavigateBack } from "@/utils/page";
|
||||||
import {
|
import {
|
||||||
uploadImage,
|
uploadImage,
|
||||||
|
FILE_BASE_URL,
|
||||||
} from "@/utils/common.js";
|
} from "@/utils/common.js";
|
||||||
|
|
||||||
const statusBarHeight = ref(getStatusBarHeight() || 0);
|
const statusBarHeight = ref(getStatusBarHeight() || 0);
|
||||||
@@ -277,8 +278,21 @@ const onAvatarSelect = async (url) => {
|
|||||||
const chooseParticipantAvatar = (index) => {
|
const chooseParticipantAvatar = (index) => {
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1,
|
count: 1,
|
||||||
success: (res) => {
|
success: async (res) => {
|
||||||
participants.value[index].avatar = res.tempFilePaths[0];
|
const url = res.tempFilePaths[0];
|
||||||
|
uni.showLoading({ title: '上传中...' });
|
||||||
|
try {
|
||||||
|
const imageUrl = await uploadImage(url);
|
||||||
|
participants.value[index].avatar = imageUrl;
|
||||||
|
uni.hideLoading();
|
||||||
|
} catch (e) {
|
||||||
|
uni.hideLoading();
|
||||||
|
uni.showToast({
|
||||||
|
title: "上传失败",
|
||||||
|
icon: "none",
|
||||||
|
});
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import {
|
|||||||
createTracking,
|
createTracking,
|
||||||
} from "@/api/system";
|
} from "@/api/system";
|
||||||
|
|
||||||
|
export const FILE_BASE_URL = "https://file.lihailezzc.com/";
|
||||||
|
|
||||||
export const generateObjectId = (
|
export const generateObjectId = (
|
||||||
m = Math,
|
m = Math,
|
||||||
d = Date,
|
d = Date,
|
||||||
@@ -29,8 +31,7 @@ export const uploadImage = (filePath) => {
|
|||||||
if (keyJson?.data?.result === "auditFailed") {
|
if (keyJson?.data?.result === "auditFailed") {
|
||||||
reject("图片不符合发布规范,请稍作修改后再试");
|
reject("图片不符合发布规范,请稍作修改后再试");
|
||||||
} else {
|
} else {
|
||||||
const url = `https://file.lihailezzc.com/${keyJson?.data.key}`;
|
resolve(keyJson?.data.key);
|
||||||
resolve(url);
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
reject(e);
|
reject(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user