|
@@ -14,9 +14,68 @@
|
|
|
<main class="app-main__content">
|
|
<main class="app-main__content">
|
|
|
<RouterView />
|
|
<RouterView />
|
|
|
</main>
|
|
</main>
|
|
|
|
|
+ <LinkList v-if="mainData.linkList" :data="mainData.linkList" />
|
|
|
<div v-if="showBackIcon" class="back-icon__box">
|
|
<div v-if="showBackIcon" class="back-icon__box">
|
|
|
<a-button type="primary" shape="round" @click="router.back()">back</a-button>
|
|
<a-button type="primary" shape="round" @click="router.back()">back</a-button>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
+ <div class="back-icon__box msg-icon__box" @click="handleMessage">
|
|
|
|
|
+ <MessageOutlined :style="{fontSize: '42px', color: '#666', cursor: 'pointer'}" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <a-modal
|
|
|
|
|
+ v-model:open="msgForm.open"
|
|
|
|
|
+ title="留言板"
|
|
|
|
|
+ :footer="null"
|
|
|
|
|
+ >
|
|
|
|
|
+ <div style="text-align: center;">
|
|
|
|
|
+ <Logo size="120px" />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ <a-form
|
|
|
|
|
+ ref="msgFormRef"
|
|
|
|
|
+ :model="msgForm"
|
|
|
|
|
+ name="msgForm"
|
|
|
|
|
+ layout="vertical"
|
|
|
|
|
+ @finish="submitMessage"
|
|
|
|
|
+ >
|
|
|
|
|
+ <a-form-item
|
|
|
|
|
+ label="姓"
|
|
|
|
|
+ name="firstName"
|
|
|
|
|
+ :rules="[{ required: true, message: '不能为空' }]"
|
|
|
|
|
+ >
|
|
|
|
|
+ <a-input v-model:value="msgForm.firstName" placeholder="请输入" allowClear />
|
|
|
|
|
+ </a-form-item>
|
|
|
|
|
+ <a-form-item
|
|
|
|
|
+ label="名"
|
|
|
|
|
+ name="lastName"
|
|
|
|
|
+ :rules="[{ required: true, message: '不能为空' }]"
|
|
|
|
|
+ >
|
|
|
|
|
+ <a-input v-model:value="msgForm.lastName" placeholder="请输入" allowClear />
|
|
|
|
|
+ </a-form-item>
|
|
|
|
|
+ <a-form-item
|
|
|
|
|
+ label="公司名称"
|
|
|
|
|
+ name="companyName"
|
|
|
|
|
+ :rules="[{ required: true, message: '不能为空' }]"
|
|
|
|
|
+ >
|
|
|
|
|
+ <a-input v-model:value="msgForm.companyName" placeholder="请输入" allowClear />
|
|
|
|
|
+ </a-form-item>
|
|
|
|
|
+ <a-form-item
|
|
|
|
|
+ label="手机号码"
|
|
|
|
|
+ name="mobile"
|
|
|
|
|
+ :rules="[{ required: true, validator: checkMobile }]"
|
|
|
|
|
+ >
|
|
|
|
|
+ <a-input v-model:value="msgForm.mobile" placeholder="请输入" allowClear />
|
|
|
|
|
+ </a-form-item>
|
|
|
|
|
+ <a-form-item
|
|
|
|
|
+ label="留言内容"
|
|
|
|
|
+ name="message"
|
|
|
|
|
+ :rules="[{ required: true, message: '不能为空' }]"
|
|
|
|
|
+ >
|
|
|
|
|
+ <a-input v-model:value="msgForm.message" placeholder="请输入" allowClear />
|
|
|
|
|
+ </a-form-item>
|
|
|
|
|
+ <a-form-item>
|
|
|
|
|
+ <a-button type="primary" html-type="submit" block :disabled="mainData.disabled">发 送</a-button>
|
|
|
|
|
+ </a-form-item>
|
|
|
|
|
+ </a-form>
|
|
|
|
|
+ </a-modal>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
@@ -25,7 +84,11 @@ import Notice from './components/Notice.vue';
|
|
|
import Toolbar from './components/Toolbar.vue';
|
|
import Toolbar from './components/Toolbar.vue';
|
|
|
import HandleBar from './components/HandleBar.vue';
|
|
import HandleBar from './components/HandleBar.vue';
|
|
|
import Category from './components/Category.vue';
|
|
import Category from './components/Category.vue';
|
|
|
-import { onMounted, computed, reactive } from 'vue';
|
|
|
|
|
|
|
+import LinkList from './components/LinkList.vue';
|
|
|
|
|
+import Logo from '@/components/logo/index.vue'
|
|
|
|
|
+import { message } from 'ant-design-vue';
|
|
|
|
|
+import { MessageOutlined } from '@ant-design/icons-vue';
|
|
|
|
|
+import { onMounted, computed, ref, reactive, nextTick } from 'vue';
|
|
|
import { useRoute, useRouter } from 'vue-router';
|
|
import { useRoute, useRouter } from 'vue-router';
|
|
|
import { useUserStore } from '@/store/user';
|
|
import { useUserStore } from '@/store/user';
|
|
|
import { useHomeStore } from '@/store/home';
|
|
import { useHomeStore } from '@/store/home';
|
|
@@ -33,6 +96,9 @@ import { useGoodsStore } from '@/store/goods';
|
|
|
import { useCategoryStore } from '@/store/category';
|
|
import { useCategoryStore } from '@/store/category';
|
|
|
import { getStoreList, getNotice } from '@/api/common';
|
|
import { getStoreList, getNotice } from '@/api/common';
|
|
|
import * as storeUtil from '@/utils/storeUtil';
|
|
import * as storeUtil from '@/utils/storeUtil';
|
|
|
|
|
+import { getAmityList } from '@/api/home';
|
|
|
|
|
+import { userLeaveMessage } from '@/api/user';
|
|
|
|
|
+import { validPhone } from '@/utils/validate';
|
|
|
import { storeList } from '@/utils/mock';
|
|
import { storeList } from '@/utils/mock';
|
|
|
|
|
|
|
|
const route = useRoute();
|
|
const route = useRoute();
|
|
@@ -50,11 +116,57 @@ const isLogin = computed(() => {
|
|
|
});
|
|
});
|
|
|
const showBackIcon = computed(() => route.path !== '/category');
|
|
const showBackIcon = computed(() => route.path !== '/category');
|
|
|
|
|
|
|
|
|
|
+const msgFormRef = ref()
|
|
|
const mainData = reactive({
|
|
const mainData = reactive({
|
|
|
storeList: [],
|
|
storeList: [],
|
|
|
- noticeContent: ''
|
|
|
|
|
|
|
+ linkList: [],
|
|
|
|
|
+ noticeContent: '',
|
|
|
|
|
+ disabled: false
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
|
|
+const msgForm = reactive({
|
|
|
|
|
+ open: false,
|
|
|
|
|
+ firstName: '',
|
|
|
|
|
+ lastName: '',
|
|
|
|
|
+ companyName: '',
|
|
|
|
|
+ mobile: '',
|
|
|
|
|
+ message: ''
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
|
|
+const handleMessage = () => {
|
|
|
|
|
+ msgForm.open = true
|
|
|
|
|
+ msgForm.firstName = ''
|
|
|
|
|
+ msgForm.lastName = ''
|
|
|
|
|
+ msgForm.companyName = ''
|
|
|
|
|
+ msgForm.mobile = ''
|
|
|
|
|
+ msgForm.message = ''
|
|
|
|
|
+ nextTick(() => {
|
|
|
|
|
+ msgFormRef.value?.clearValidate()
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const submitMessage = () => {
|
|
|
|
|
+ mainData.disabled = true
|
|
|
|
|
+ userLeaveMessage({
|
|
|
|
|
+ firstName: msgForm.firstName,
|
|
|
|
|
+ lastName: msgForm.lastName,
|
|
|
|
|
+ companyName: msgForm.companyName,
|
|
|
|
|
+ mobile: msgForm.mobile,
|
|
|
|
|
+ message: msgForm.message
|
|
|
|
|
+ }).then(() => {
|
|
|
|
|
+ msgForm.open = false
|
|
|
|
|
+ message.success('留言成功')
|
|
|
|
|
+ }).finally(() => {
|
|
|
|
|
+ mainData.disabled = false
|
|
|
|
|
+ })
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const checkMobile = (rule, value) => {
|
|
|
|
|
+ if (value === '') return Promise.reject('不能为空')
|
|
|
|
|
+ if (!validPhone(value)) return Promise.reject('格式有误')
|
|
|
|
|
+ return Promise.resolve()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
const resetGoodsDataAndFetch = () => {
|
|
const resetGoodsDataAndFetch = () => {
|
|
|
goodsStore.resetParams();
|
|
goodsStore.resetParams();
|
|
|
goodsStore.resetListData();
|
|
goodsStore.resetListData();
|
|
@@ -120,6 +232,12 @@ const fetchNoticeData = async () => {
|
|
|
mainData.noticeContent = res.data || '';
|
|
mainData.noticeContent = res.data || '';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 获取友情链接
|
|
|
|
|
+const fetchgetAmityList = async () => {
|
|
|
|
|
+ const res = await getAmityList()
|
|
|
|
|
+ mainData.linkList = res.data || []
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
onMounted(async () => {
|
|
onMounted(async () => {
|
|
|
homeStore.updateStorageId(storeUtil.getId());
|
|
homeStore.updateStorageId(storeUtil.getId());
|
|
|
await fetchStoreListData();
|
|
await fetchStoreListData();
|
|
@@ -133,6 +251,7 @@ onMounted(async () => {
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
resetGoodsDataAndFetch();
|
|
resetGoodsDataAndFetch();
|
|
|
|
|
+ fetchgetAmityList();
|
|
|
if (isLogin.value) {
|
|
if (isLogin.value) {
|
|
|
fetchNoticeData();
|
|
fetchNoticeData();
|
|
|
userStore.fetchUserDetail()
|
|
userStore.fetchUserDetail()
|
|
@@ -146,10 +265,14 @@ onMounted(async () => {
|
|
|
padding: 20px;
|
|
padding: 20px;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-.back-icon__box {
|
|
|
|
|
|
|
+.back-icon__box,
|
|
|
|
|
+.msg-icon__box {
|
|
|
position: fixed;
|
|
position: fixed;
|
|
|
- bottom: 30px;
|
|
|
|
|
|
|
+ bottom: 50px;
|
|
|
right: 30px;
|
|
right: 30px;
|
|
|
z-index: 9999;
|
|
z-index: 9999;
|
|
|
}
|
|
}
|
|
|
|
|
+.msg-icon__box {
|
|
|
|
|
+ bottom: 0;
|
|
|
|
|
+}
|
|
|
</style>
|
|
</style>
|