|
@@ -10,7 +10,8 @@ import {
|
|
|
useMessage,
|
|
|
NUpload,
|
|
|
UploadFileInfo,
|
|
|
- NImage
|
|
|
+ NImage,
|
|
|
+ UploadCustomRequestOptions
|
|
|
} from 'naive-ui';
|
|
|
|
|
|
import { useUserStore } from '/src/store/modules/users';
|
|
@@ -22,19 +23,20 @@ import suggestClose from '../images/suggestClose.png';
|
|
|
import inFront from '../images/inFront.png';
|
|
|
import inBack from '../images/inBack.png';
|
|
|
import submitBtn from '../images/submitBtn.png';
|
|
|
-import sealing from '../images/sealing.png'
|
|
|
-import boxBg from '../images/boxBg.png'
|
|
|
+import sealing from '../images/sealing.png';
|
|
|
+import boxBg from '../images/boxBg.png';
|
|
|
import {
|
|
|
addSuggestion,
|
|
|
getSuggestionList,
|
|
|
sysParamConfigPage
|
|
|
} from '../modals/api';
|
|
|
import { nextTick } from 'process';
|
|
|
+import { getUploadSign, onFileUpload } from '/src/helpers/oss-file-upload';
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: 'train-update',
|
|
|
emits: ['close', 'submit'],
|
|
|
- setup(props, { emit,expose }) {
|
|
|
+ setup(props, { emit, expose }) {
|
|
|
const message = useMessage();
|
|
|
const userStore = useUserStore();
|
|
|
const forms = reactive({
|
|
@@ -46,7 +48,7 @@ export default defineComponent({
|
|
|
mobileNo: userStore.getUserInfo.phone
|
|
|
});
|
|
|
const state = reactive([]) as any;
|
|
|
- const isubmit = ref(false)
|
|
|
+ const isubmit = ref(false);
|
|
|
|
|
|
const suggestionTypeList = ref([] as any);
|
|
|
const ossUploadUrl = `https://gyt.ks3-cn-beijing.ksyuncs.com/`;
|
|
@@ -57,8 +59,8 @@ export default defineComponent({
|
|
|
const tempFiileBuffer = ref();
|
|
|
const email = ref('');
|
|
|
const phone = ref('');
|
|
|
- const isLoading = ref(false)
|
|
|
- const ishidden= ref(false)
|
|
|
+ const isLoading = ref(false);
|
|
|
+ const ishidden = ref(false);
|
|
|
const onSubmit = async () => {
|
|
|
// if (!forms.suggestionTypeId) {
|
|
|
// message.error('请选择反馈类型');
|
|
@@ -85,31 +87,29 @@ export default defineComponent({
|
|
|
const res = await addSuggestion({ ...forms, attachmentUrls });
|
|
|
isubmit.value = true;
|
|
|
// message.success('提交成功');
|
|
|
- setTimeout(()=>{
|
|
|
- onReset()
|
|
|
- ishidden.value = true
|
|
|
- emit('close')
|
|
|
- },3000)
|
|
|
-
|
|
|
+ setTimeout(() => {
|
|
|
+ onReset();
|
|
|
+ ishidden.value = true;
|
|
|
+ emit('close');
|
|
|
+ }, 3000);
|
|
|
} catch (e) {
|
|
|
console.log(e);
|
|
|
}
|
|
|
console.log('onSubmit');
|
|
|
- })
|
|
|
-
|
|
|
+ });
|
|
|
};
|
|
|
- const onReset = ()=>{
|
|
|
- ishidden.value = false
|
|
|
- isubmit.value = false
|
|
|
- forms.suggestionTypeId=null
|
|
|
- forms.clientType='TEACHER'
|
|
|
- forms.content= ''
|
|
|
- forms.attachmentUrls= ''
|
|
|
+ const onReset = () => {
|
|
|
+ ishidden.value = false;
|
|
|
+ isubmit.value = false;
|
|
|
+ forms.suggestionTypeId = null;
|
|
|
+ forms.clientType = 'TEACHER';
|
|
|
+ forms.content = '';
|
|
|
+ forms.attachmentUrls = '';
|
|
|
fileListRef.value = [];
|
|
|
- forms.type= 'APP'
|
|
|
- forms.mobileNo= userStore.getUserInfo.phone
|
|
|
- }
|
|
|
- expose({onReset})
|
|
|
+ forms.type = 'APP';
|
|
|
+ forms.mobileNo = userStore.getUserInfo.phone;
|
|
|
+ };
|
|
|
+ expose({ onReset });
|
|
|
const onBeforeUpload = async (options: any) => {
|
|
|
console.log(options, 'onBeforeUpload');
|
|
|
const file = options.file;
|
|
@@ -143,7 +143,8 @@ export default defineComponent({
|
|
|
unknowValueField: []
|
|
|
}
|
|
|
};
|
|
|
- const { data } = await policy(obj);
|
|
|
+ // const { data } = await policy(obj);
|
|
|
+ const { data } = await getUploadSign(obj);
|
|
|
state.push({
|
|
|
id: file.id,
|
|
|
tempFiileBuffer: file.file,
|
|
@@ -162,6 +163,23 @@ export default defineComponent({
|
|
|
}
|
|
|
return true;
|
|
|
};
|
|
|
+ const onCustomRequest = ({
|
|
|
+ file,
|
|
|
+ // data,
|
|
|
+ // headers,
|
|
|
+ // withCredentials,
|
|
|
+ action,
|
|
|
+ onFinish,
|
|
|
+ onError,
|
|
|
+ onProgress
|
|
|
+ }: UploadCustomRequestOptions) => {
|
|
|
+ const item = state.find((c: any) => {
|
|
|
+ return c.id == file.id;
|
|
|
+ });
|
|
|
+
|
|
|
+ item.file = file;
|
|
|
+ onFileUpload({ file, action, data: item, onProgress, onFinish, onError });
|
|
|
+ };
|
|
|
const onFinish = (options: any) => {
|
|
|
// const url =
|
|
|
const name = options.file.name;
|
|
@@ -185,8 +203,6 @@ export default defineComponent({
|
|
|
}
|
|
|
};
|
|
|
|
|
|
-
|
|
|
-
|
|
|
const getPhoneInfo = async () => {
|
|
|
try {
|
|
|
const { data } = await sysParamConfigPage({
|
|
@@ -209,117 +225,127 @@ export default defineComponent({
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- const imglist = [inFront,inBack,submitBtn,sealing,boxBg]
|
|
|
- const loadImg = (imgList:any) => {
|
|
|
+ const imglist = [inFront, inBack, submitBtn, sealing, boxBg];
|
|
|
+ const loadImg = (imgList: any) => {
|
|
|
for (let i = 0; i < imgList.length; i++) {
|
|
|
- const img = new Image()
|
|
|
+ const img = new Image();
|
|
|
// let currentSrc = ''
|
|
|
- img.src = imgList[i]
|
|
|
+ img.src = imgList[i];
|
|
|
img.onload = function (e) {
|
|
|
- console.log('加载完毕', e,img.complete );
|
|
|
- }
|
|
|
+ console.log('加载完毕', e, img.complete);
|
|
|
+ };
|
|
|
img.onerror = function (e) {
|
|
|
console.log('加载错误', e);
|
|
|
- }
|
|
|
+ };
|
|
|
}
|
|
|
- }
|
|
|
- loadImg(imglist)
|
|
|
+ };
|
|
|
+ loadImg(imglist);
|
|
|
onMounted(() => {
|
|
|
getTypeList();
|
|
|
getPhoneInfo();
|
|
|
});
|
|
|
return () => (
|
|
|
<div class={[styles.suggestOption]}>
|
|
|
- <div class={[styles.updatePassword,isubmit.value?styles.isAni:'',ishidden.value?styles.isend:null]}>
|
|
|
- <div class={[styles.formWrap,isubmit.value?styles.isAni:'']}>
|
|
|
- <NImage
|
|
|
- class={styles.closeBtn}
|
|
|
- src={suggestClose}
|
|
|
- previewDisabled onClick={() => {onReset();emit('close')}}></NImage>
|
|
|
- <NImage class={styles.bgLine} src={bgLine} previewDisabled></NImage>
|
|
|
- <h2 class={styles.formTitle}>意见反馈</h2>
|
|
|
- <div class={styles.formWrapInfo}>
|
|
|
- <NForm
|
|
|
- labelAlign="right"
|
|
|
- labelPlacement="left"
|
|
|
- labelWidth={'auto'}
|
|
|
- ref={formsRef}
|
|
|
- model={forms}
|
|
|
- requireMarkPlacement="left">
|
|
|
- {/* <NFormItem
|
|
|
+ <div
|
|
|
+ class={[
|
|
|
+ styles.updatePassword,
|
|
|
+ isubmit.value ? styles.isAni : '',
|
|
|
+ ishidden.value ? styles.isend : null
|
|
|
+ ]}>
|
|
|
+ <div class={[styles.formWrap, isubmit.value ? styles.isAni : '']}>
|
|
|
+ <NImage
|
|
|
+ class={styles.closeBtn}
|
|
|
+ src={suggestClose}
|
|
|
+ previewDisabled
|
|
|
+ onClick={() => {
|
|
|
+ onReset();
|
|
|
+ emit('close');
|
|
|
+ }}></NImage>
|
|
|
+ <NImage class={styles.bgLine} src={bgLine} previewDisabled></NImage>
|
|
|
+ <h2 class={styles.formTitle}>意见反馈</h2>
|
|
|
+ <div class={styles.formWrapInfo}>
|
|
|
+ <NForm
|
|
|
+ labelAlign="right"
|
|
|
+ labelPlacement="left"
|
|
|
+ labelWidth={'auto'}
|
|
|
+ ref={formsRef}
|
|
|
+ model={forms}
|
|
|
+ requireMarkPlacement="left">
|
|
|
+ {/* <NFormItem
|
|
|
path="currentClass"
|
|
|
label=""
|
|
|
class={styles.phoneContainer}>
|
|
|
<p class={styles.phone}>{forms.mobile}</p>
|
|
|
</NFormItem> */}
|
|
|
|
|
|
- <NFormItem
|
|
|
- rule={[
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请选择反馈类型'
|
|
|
- }
|
|
|
- ]}
|
|
|
- path="suggestionTypeId">
|
|
|
- <CSelect
|
|
|
- class={styles.suggestSelect}
|
|
|
- value-field="id"
|
|
|
- label-field="name"
|
|
|
- style={{ width: '227px!important' }}
|
|
|
- {...({
|
|
|
- options: suggestionTypeList.value,
|
|
|
- placeholder: '反馈类型(必选)',
|
|
|
- clearable: true,
|
|
|
- inline: true
|
|
|
- } as any)}
|
|
|
- v-model:value={forms.suggestionTypeId}></CSelect>
|
|
|
- </NFormItem>
|
|
|
- <NFormItem
|
|
|
- path="content"
|
|
|
- rule={[
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请输入反馈内容'
|
|
|
- }
|
|
|
- ]}>
|
|
|
- <NInput
|
|
|
- class={styles.countInput}
|
|
|
- type="textarea"
|
|
|
- rows={5}
|
|
|
- placeholder={'请输入反馈内容'}
|
|
|
- maxlength={200}
|
|
|
- resizable={false}
|
|
|
- showCount
|
|
|
- v-model:value={forms.content}></NInput>
|
|
|
- </NFormItem>
|
|
|
- <NFormItem>
|
|
|
- <NUpload
|
|
|
- list-type="image-card"
|
|
|
- accept=".jpg,jpeg,.png"
|
|
|
- v-model:fileList={fileListRef.value}
|
|
|
- ref={uploadRef}
|
|
|
- multiple={true}
|
|
|
- max={5}
|
|
|
- data={(file: any) => {
|
|
|
- const item = state.find((c: any) => {
|
|
|
- return c.id == file.file.id;
|
|
|
- });
|
|
|
- const { id, tempFiileBuffer, ...more } = item;
|
|
|
- return { ...more };
|
|
|
- }}
|
|
|
- showPreviewButton
|
|
|
- action={ossUploadUrl}
|
|
|
- onBeforeUpload={(options: any) => onBeforeUpload(options)}
|
|
|
- onRemove={(options: any) => onRemove(options)}
|
|
|
- onFinish={(options: any) => onFinish(options)}>
|
|
|
- <div class={styles.addInput}>
|
|
|
- <NImage previewDisabled src={chioseAdd}></NImage>
|
|
|
- <p> 点击上传图片</p>
|
|
|
- <p>(最多五张)</p>
|
|
|
- </div>
|
|
|
- </NUpload>
|
|
|
- </NFormItem>
|
|
|
- {/* {phone.value || email.value ? (
|
|
|
+ <NFormItem
|
|
|
+ rule={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请选择反馈类型'
|
|
|
+ }
|
|
|
+ ]}
|
|
|
+ path="suggestionTypeId">
|
|
|
+ <CSelect
|
|
|
+ class={styles.suggestSelect}
|
|
|
+ value-field="id"
|
|
|
+ label-field="name"
|
|
|
+ style={{ width: '227px!important' }}
|
|
|
+ {...({
|
|
|
+ options: suggestionTypeList.value,
|
|
|
+ placeholder: '反馈类型(必选)',
|
|
|
+ clearable: true,
|
|
|
+ inline: true
|
|
|
+ } as any)}
|
|
|
+ v-model:value={forms.suggestionTypeId}></CSelect>
|
|
|
+ </NFormItem>
|
|
|
+ <NFormItem
|
|
|
+ path="content"
|
|
|
+ rule={[
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: '请输入反馈内容'
|
|
|
+ }
|
|
|
+ ]}>
|
|
|
+ <NInput
|
|
|
+ class={styles.countInput}
|
|
|
+ type="textarea"
|
|
|
+ rows={5}
|
|
|
+ placeholder={'请输入反馈内容'}
|
|
|
+ maxlength={200}
|
|
|
+ resizable={false}
|
|
|
+ showCount
|
|
|
+ v-model:value={forms.content}></NInput>
|
|
|
+ </NFormItem>
|
|
|
+ <NFormItem>
|
|
|
+ <NUpload
|
|
|
+ list-type="image-card"
|
|
|
+ accept=".jpg,jpeg,.png"
|
|
|
+ v-model:fileList={fileListRef.value}
|
|
|
+ ref={uploadRef}
|
|
|
+ multiple={true}
|
|
|
+ max={5}
|
|
|
+ // data={(file: any) => {
|
|
|
+ // const item = state.find((c: any) => {
|
|
|
+ // return c.id == file.file.id;
|
|
|
+ // });
|
|
|
+ // const { id, tempFiileBuffer, ...more } = item;
|
|
|
+ // return { ...more };
|
|
|
+ // }}
|
|
|
+ showPreviewButton
|
|
|
+ action={ossUploadUrl}
|
|
|
+ customRequest={onCustomRequest}
|
|
|
+ onBeforeUpload={(options: any) => onBeforeUpload(options)}
|
|
|
+ onRemove={(options: any) => onRemove(options)}
|
|
|
+ onFinish={(options: any) => onFinish(options)}>
|
|
|
+ <div class={styles.addInput}>
|
|
|
+ <NImage previewDisabled src={chioseAdd}></NImage>
|
|
|
+ <p> 点击上传图片</p>
|
|
|
+ <p>(最多五张)</p>
|
|
|
+ </div>
|
|
|
+ </NUpload>
|
|
|
+ </NFormItem>
|
|
|
+ {/* {phone.value || email.value ? (
|
|
|
<NFormItem>
|
|
|
<div class={styles.messageWrap}>
|
|
|
{phone.value ? <p>客服电话:{phone.value}</p> : null}
|
|
@@ -328,7 +354,7 @@ export default defineComponent({
|
|
|
</NFormItem>
|
|
|
) : null} */}
|
|
|
|
|
|
- {/* <NSpace class={styles.updateBtnGroup}>
|
|
|
+ {/* <NSpace class={styles.updateBtnGroup}>
|
|
|
<NButton
|
|
|
strong
|
|
|
type="default"
|
|
@@ -340,26 +366,36 @@ export default defineComponent({
|
|
|
确认
|
|
|
</NButton>
|
|
|
</NSpace> */}
|
|
|
- </NForm>
|
|
|
+ </NForm>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+ <div class={[styles.inBack, isubmit.value ? styles.isAni : '']}></div>
|
|
|
+ {/* <div class={styles.inBackBottom}></div> boxBg */}
|
|
|
+ <NImage
|
|
|
+ src={boxBg}
|
|
|
+ class={styles.inBackBottom}
|
|
|
+ previewDisabled></NImage>
|
|
|
+ <NImage src={inFront} class={styles.inFront} previewDisabled></NImage>
|
|
|
+ <NImage
|
|
|
+ src={sealing}
|
|
|
+ class={[styles.sealing, isubmit.value ? styles.isAni : '']}
|
|
|
+ previewDisabled></NImage>
|
|
|
+ {!isubmit.value ? (
|
|
|
+ <>
|
|
|
+ <NImage
|
|
|
+ src={submitBtn}
|
|
|
+ onClick={() => {
|
|
|
+ onSubmit();
|
|
|
+ }}
|
|
|
+ class={styles.submitBtn}
|
|
|
+ previewDisabled></NImage>
|
|
|
+ <div class={styles.messageWrap}>
|
|
|
+ {phone.value ? <p>客服电话:{phone.value}</p> : null}
|
|
|
+ {email.value ? <p>邮箱:{email.value}</p> : null}
|
|
|
+ </div>
|
|
|
+ </>
|
|
|
+ ) : null}
|
|
|
</div>
|
|
|
- <div class={[styles.inBack,isubmit.value?styles.isAni:'']}>
|
|
|
-
|
|
|
- </div>
|
|
|
- {/* <div class={styles.inBackBottom}></div> boxBg */}
|
|
|
- <NImage src={boxBg} class={styles.inBackBottom} previewDisabled></NImage>
|
|
|
- <NImage src={inFront} class={styles.inFront} previewDisabled></NImage>
|
|
|
- <NImage src={sealing} class={[styles.sealing,isubmit.value?styles.isAni:'']} previewDisabled></NImage>
|
|
|
- {!isubmit.value?<>
|
|
|
- <NImage src={submitBtn} onClick={()=>{onSubmit()}} class={styles.submitBtn} previewDisabled></NImage>
|
|
|
- <div class={styles.messageWrap}>
|
|
|
- {phone.value ? <p>客服电话:{phone.value}</p> : null}
|
|
|
- {email.value ? <p>邮箱:{email.value}</p> : null}
|
|
|
- </div>
|
|
|
- </>:null}
|
|
|
-
|
|
|
- </div>
|
|
|
-
|
|
|
</div>
|
|
|
);
|
|
|
}
|