|
|
@@ -85,12 +85,7 @@
|
|
|
<el-input v-model="form.name" type="textarea" placeholder="请输入内容" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="图标" prop="logo">
|
|
|
- <el-upload v-model:file-list="fileList" :headers="headers" :action="uploadImgUrl" list-type="picture-card"
|
|
|
- :on-remove="handleRemove" :on-success="handleUploadSuccess">
|
|
|
- <el-icon>
|
|
|
- <Plus />
|
|
|
- </el-icon>
|
|
|
- </el-upload>
|
|
|
+ <el-input v-model="form.logo" type="textarea" placeholder="请输入内容" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="链接" prop="url">
|
|
|
<el-input v-model="form.url" type="textarea" placeholder="请输入内容" />
|
|
|
@@ -112,8 +107,7 @@
|
|
|
<script setup name="Miniprogram" lang="ts">
|
|
|
import { listMiniprogram, getMiniprogram, delMiniprogram, addMiniprogram, updateMiniprogram } from '@/api/miniprogram';
|
|
|
import { MiniprogramVO, MiniprogramQuery, MiniprogramForm } from '@/api/miniprogram/types';
|
|
|
-import { getToken } from '@/utils/auth';
|
|
|
-import type { UploadProps, UploadUserFile } from 'element-plus'
|
|
|
+
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
|
@@ -128,25 +122,14 @@ const total = ref(0);
|
|
|
|
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
|
const miniprogramFormRef = ref<ElFormInstance>();
|
|
|
-const baseUrl = import.meta.env.VITE_APP_BASE_API;
|
|
|
-const uploadImgUrl = ref(baseUrl + "/resource/oss/upload"); // 上传的图片服务器地址
|
|
|
+
|
|
|
|
|
|
const dialog = reactive<DialogOption>({
|
|
|
visible: false,
|
|
|
title: ''
|
|
|
});
|
|
|
|
|
|
-const headers = ref({
|
|
|
- "Authorization": 'Bearer ' + getToken(),
|
|
|
- "Clientid": 'e5cd7e4891bf95d1d19206ce24a7b32e',
|
|
|
- "Accept": 'application/json, text/plain, */*'
|
|
|
-});
|
|
|
-
|
|
|
-const fileList = ref<UploadUserFile[]>([
|
|
|
-
|
|
|
-])
|
|
|
-
|
|
|
-const fileData = ref([])
|
|
|
+
|
|
|
|
|
|
const initFormData: MiniprogramForm = {
|
|
|
id: undefined,
|
|
|
@@ -200,31 +183,19 @@ const { queryParams, form, rules } = toRefs(data);
|
|
|
/** 查询小程序信息列表 */
|
|
|
const getList = async () => {
|
|
|
loading.value = true;
|
|
|
+ ;(queryParams.value as any).remark = queryParams.value.desc
|
|
|
const res = await listMiniprogram(queryParams.value);
|
|
|
- miniprogramList.value = res.rows;
|
|
|
+ miniprogramList.value = (res.rows as any[]).map((row: any) => {
|
|
|
+ if (!row.desc && row.remark) {
|
|
|
+ row.desc = row.remark
|
|
|
+ }
|
|
|
+ return row as MiniprogramVO
|
|
|
+ })
|
|
|
total.value = res.total;
|
|
|
loading.value = false;
|
|
|
}
|
|
|
|
|
|
-const handleRemove = (uploadFile, uploadFiles) => {
|
|
|
- console.log(uploadFile)
|
|
|
- const arry = fileData.value.filter((item) => item.ossId != fileData.value.ossId)
|
|
|
- fileData.value = arry;
|
|
|
- fileList.value = arry;
|
|
|
-}
|
|
|
-
|
|
|
-const handleUploadSuccess = (response, file, fileList) => {
|
|
|
- console.log(response)
|
|
|
- console.log(response.data.url)
|
|
|
- if (response.code == 200) {
|
|
|
- var obj = {
|
|
|
- name: response.data.fileName,
|
|
|
- url: response.data.url.replaceAll("http://127.0.0.1:9000", "https://khy.xiaole.vip/khyfile").split('?')[0],
|
|
|
- ossId: response.data.ossId
|
|
|
- }
|
|
|
- }
|
|
|
- fileData.value.push(obj)
|
|
|
-}
|
|
|
+
|
|
|
|
|
|
/** 取消按钮 */
|
|
|
const cancel = () => {
|
|
|
@@ -270,6 +241,9 @@ const handleUpdate = async (row?: MiniprogramVO) => {
|
|
|
const _id = row?.id || ids.value[0]
|
|
|
const res = await getMiniprogram(_id);
|
|
|
Object.assign(form.value, res.data);
|
|
|
+ if (!form.value.desc && (res.data as any).remark) {
|
|
|
+ (form.value as any).desc = (res.data as any).remark
|
|
|
+ }
|
|
|
dialog.visible = true;
|
|
|
dialog.title = "修改小程序信息";
|
|
|
}
|
|
|
@@ -279,7 +253,7 @@ const submitForm = () => {
|
|
|
// form.value.status = 1
|
|
|
// form.value.ext1 = 1
|
|
|
// form.value.ext2 = 1
|
|
|
- form.value.logo = JSON.stringify(fileData.value)
|
|
|
+ ;(form.value as any).remark = form.value.desc
|
|
|
miniprogramFormRef.value?.validate(async (valid: boolean) => {
|
|
|
if (valid) {
|
|
|
buttonLoading.value = true;
|