Browse Source

Merge branch 'cpq-dev' of wangfan/adweb3-web into master

chenpeiqing 3 weeks ago
parent
commit
59d3a00af4
2 changed files with 105 additions and 64 deletions
  1. 3 3
      src/views/adweb/enquiry/AdwebEnquiryList.vue
  2. 102 61
      src/views/adweb/theme/AdwebThemeList.vue

+ 3 - 3
src/views/adweb/enquiry/AdwebEnquiryList.vue

@@ -22,9 +22,9 @@
           <a-button :class="queryParam.dateType == 'today' ? 'active' : ''" @click="setTime('today')"> 今日 </a-button>
         </a-col>
 
-        <a-col :xl="3" :xxl="4" v-if="isSuperAdmin">
-          <a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleAdd">新增询盘</a-button>
-        </a-col>
+        <!--        <a-col :xl="3" :xxl="4" v-if="isSuperAdmin">-->
+        <!--          <a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleAdd">新增询盘</a-button>-->
+        <!--        </a-col>-->
       </a-row>
     </div>
 

+ 102 - 61
src/views/adweb/theme/AdwebThemeList.vue

@@ -1,69 +1,75 @@
 <template>
-  <a-row>
-    <a-col class="theme-wrap">
-      <a-col class="tag-wrap" />
-      <a-list
-        :grid="{ gutter: 16, column: 4 }"
-        :data-source="dataSource"
-        :loading="loading"
-        class="j-table-force-nowrap template_list"
-        :style="{ height: '100%' }"
-      >
-        <template #loadMore>
-          <div v-if="!loading && !moreLoading" :style="{ textAlign: 'center', marginTop: '12px', height: '32px', lineHeight: '32px' }">
-            <a-button @click="onLoadMore">loading more</a-button>
-          </div>
-        </template>
-
-        <template #renderItem="{ item, index }">
-          <a-list-item>
-            <a-card :title="item.name" class="text-center">
-              <div class="item" @mouseover="hoverThis">
-                <div class="Pic">
-                  <a class="img">
-                    <img v-if="checkUrl(item.images)" :key="item.code" :alt="item.name" :src="domainUrl + '/sys/common/static/' + item.images" />
-                    <img v-else alt="item.name" :src="domainUrl + '/sys/common/static/' + item.images" />
-                  </a>
-                  <div class="Content">
-                    <a-button class="fl" block @click="visit(item, index)">模板预览</a-button>
-                    <a-button type="primary" block class="fr" @click="createSite(item)">创建站点</a-button>
+  <a-spin :spinning="confirmLoading">
+    <a-row>
+      <a-col class="button-wrapper">
+        <a-button type="primary" preIcon="ant-design:plus-outlined" @click="handleAdd">新增模板</a-button>
+      </a-col>
+      <a-col class="theme-wrap">
+        <a-list
+          :grid="{ gutter: 16, column: 3, xxxl: 4, xxl: 4, lg: 3, md: 2, sm: 2, xs: 1 }"
+          :data-source="dataSource"
+          :loading="loading"
+          class="j-table-force-nowrap template_list"
+          :style="{ height: '100%' }"
+        >
+          <template #loadMore>
+            <div v-if="!loading && !moreLoading" :style="{ textAlign: 'center', marginTop: '12px', height: '32px', lineHeight: '32px' }">
+              <a-button @click="onLoadMore" type="primary" preIcon="ant-design:down-outlined">下一页</a-button>
+            </div>
+          </template>
+
+          <template #renderItem="{ item, index }">
+            <a-list-item>
+              <a-card :title="item.name" class="text-center">
+                <div class="item" @mouseover="hoverThis">
+                  <div class="Pic">
+                    <a class="img">
+                      <img v-if="checkUrl(item.images)" :key="item.code" :alt="item.name" :src="domainUrl + '/sys/common/static/' + item.images" />
+                      <img v-else alt="item.name" :src="domainUrl + '/sys/common/static/' + item.images" />
+                    </a>
+                    <div class="Content">
+                      <a-button class="fl" block @click="visit(item, index)">模板预览</a-button>
+                      <a-button class="fl" block @click="handleEdit(item)">编辑模板</a-button>
+                      <a-button type="primary" block class="fr" @click="createSite(item)">创建站点</a-button>
+                    </div>
                   </div>
+                  <div class="clear"></div>
                 </div>
-                <div class="clear"></div>
-              </div>
-            </a-card>
-          </a-list-item>
-        </template>
-      </a-list>
-
-      <adweb-create-site ref="modelRef" />
-      <a-modal v-model:open="visible" width="80%" @cancel="visitImageCancel" :footer="null" class="self_buy_modal">
-        <template #title>
-          <div>
+              </a-card>
+            </a-list-item>
+          </template>
+        </a-list>
+
+        <adweb-create-site ref="modelRef" />
+        <adweb-theme-modal ref="adwebThemeModalRef" @success="handleSuccess" />
+        <a-modal v-model:open="visible" width="80%" @cancel="visitImageCancel" :footer="null" class="self_buy_modal">
+          <template #title>
             <div>
-              <p class="ant-modal-title">
-                模板预览
-                <template
-                  v-if="
-                    (userRole.indexOf('admin') > -1 ||
-                      userRole.indexOf('adweb_admin') > -1 ||
-                      userRole.indexOf('adweb_seo_manager') > -1 ||
-                      userRole.indexOf('adweb_site_manager') > -1) &&
-                    modelText != null &&
-                    modelText != ''
-                  "
-                >
-                  <a :href="modelText" target="_blank" style="font-size: 14px; text-decoration: underline"><span>购买链接</span></a>
-                </template>
-              </p>
+              <div>
+                <p class="ant-modal-title">
+                  模板预览
+                  <template
+                    v-if="
+                      (userRole.indexOf('admin') > -1 ||
+                        userRole.indexOf('adweb_admin') > -1 ||
+                        userRole.indexOf('adweb_seo_manager') > -1 ||
+                        userRole.indexOf('adweb_site_manager') > -1) &&
+                      modelText != null &&
+                      modelText != ''
+                    "
+                  >
+                    <a :href="modelText" target="_blank" style="font-size: 14px; text-decoration: underline"><span>购买链接</span></a>
+                  </template>
+                </p>
+              </div>
             </div>
-          </div>
-        </template>
+          </template>
 
-        <img alt="example" style="width: 100%" :src="theImage" />
-      </a-modal>
-    </a-col>
-  </a-row>
+          <img alt="example" style="width: 100%" :src="theImage" />
+        </a-modal>
+      </a-col>
+    </a-row>
+  </a-spin>
 </template>
 
 <script lang="ts" setup name="AdwebThemeCList">
@@ -76,6 +82,7 @@
   import { useMessage } from '@/hooks/web/useMessage';
   import AdwebCreateSite from '@/views/adweb/theme/components/AdwebCreateSite.vue';
   import { useGlobSetting } from '@/hooks/setting';
+  import AdwebThemeModal from '@/views/adweb/theme/components/AdwebThemeModal.vue';
   const globSetting = useGlobSetting();
 
   const url = reactive({
@@ -85,7 +92,8 @@
   const domainUrl = ref(globSetting.apiUrl);
 
   const userRole = ref('');
-
+  const adwebThemeModalRef = ref();
+  const confirmLoading = ref(false);
   const modelText = ref('');
   const theImage = ref('');
 
@@ -123,6 +131,7 @@
 
   function getTemplateList() {
     loading.value = true;
+    confirmLoading.value = true;
     let listUrl = `${url.list}` + '?pageNo=' + pageNo.value + '&pageSize=8&templateTags=' + 22;
     getAction(listUrl, null).then(function (res) {
       if (res.code == 200) {
@@ -157,6 +166,8 @@
         // https://stackoverflow.com/questions/46700726/how-to-use-public-method-updateposition-of-react-virtualized
         window.dispatchEvent(new Event('resize'));
       });
+
+      confirmLoading.value = false;
     });
   }
 
@@ -219,8 +230,38 @@
   function createSite(data) {
     modelRef.value.initCreateSiteModel(data);
   }
+
+  /**
+   * 新增事件
+   */
+  function handleAdd() {
+    console.log(adwebThemeModalRef);
+    adwebThemeModalRef.value.disableSubmit = false;
+    adwebThemeModalRef.value.add();
+  }
+
+  /**
+   * 编辑事件
+   */
+  function handleEdit(record: Recordable) {
+    adwebThemeModalRef.value.disableSubmit = false;
+    adwebThemeModalRef.value.edit(record);
+  }
+
+  /**
+   * 成功回调
+   */
+  function handleSuccess() {
+    (selectedRowKeys.value = []) && reload();
+  }
 </script>
 <style scoped lang="less">
+  .button-wrapper {
+    display: flex;
+    justify-content: end;
+    margin: 15px 8px;
+  }
+
   .mt-20 {
     margin-top: 20px;
   }