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