Selaa lähdekoodia

Merge branch 'zhuf'

bzkf3 2 vuotta sitten
vanhempi
commit
27b0ca0cb1
3 muutettua tiedostoa jossa 36 lisäystä ja 12 poistoa
  1. 8 3
      src/pages/_home/index.vue
  2. 24 7
      src/pages/qzzx/index.vue
  3. 4 2
      src/router/index.js

+ 8 - 3
src/pages/_home/index.vue

@@ -61,7 +61,12 @@ request({
 
 
 function handleClickCard(row) {
-  router.push(`/qzzx/qzzxxq/${row.id}`)
+  // router.push(`/qzzx/qzzxxq/${row.id}`)
+  if (row.type === '1') {
+    window.open(row.brief)
+  } else {
+    router.push(`/qzzx/qzzxxq/${row.id}`)
+  }
 }
 </script>
 
@@ -92,10 +97,10 @@ function handleClickCard(row) {
         <template #default="{ row: item }">
           <van-card :title="item.name" :thumb="item.img" @click="handleClickCard(item)">
             <template #price>
-              <van-tag plain type="primary">{{  item.nic_name  }}</van-tag>
+              <van-tag plain type="primary">{{ item.nic_name }}</van-tag>
             </template>
             <template #num>
-              {{  item.datetime  }}
+              {{ item.datetime }}
             </template>
           </van-card>
         </template>

+ 24 - 7
src/pages/qzzx/index.vue

@@ -12,7 +12,11 @@ function handleNavLeftClick() {
 
 const router = useRouter()
 function handleClickCard(row) {
-  router.push(`/qzzx/qzzxxq/${row.id}`)
+  if (row.type === '1') {
+    window.open(row.brief)
+  } else {
+    router.push(`/qzzx/qzzxxq/${row.id}`)
+  }
 }
 
 
@@ -35,6 +39,7 @@ const overlayForm = reactive({
   ni_title: '',
   ni_content: '',
   ni_img: '',
+  ni_type: '1',
 })
 
 function handleNavRightClick() {
@@ -44,6 +49,7 @@ function handleNavRightClick() {
   overlayForm.ni_title = ''
   overlayForm.ni_content = ''
   overlayForm.ni_img = ''
+  overlayForm.ni_type = '1'
 
   overlayShow = true
 }
@@ -88,10 +94,10 @@ function onFinish(val) {
         <template #default="{ row: item }">
           <van-card :title="item.name" :thumb="(item.img)" @click="handleClickCard(item)">
             <template #price>
-              <van-tag plain type="primary">{{  item.nic_name  }}</van-tag>
+              <van-tag plain type="primary">{{ item.nic_name }}</van-tag>
             </template>
             <template #num>
-              {{  item.datetime  }}
+              {{ item.datetime }}
             </template>
           </van-card>
         </template>
@@ -104,7 +110,7 @@ function onFinish(val) {
     <div class="bg-white w-9/10 p-4 rounded-md dark:bg-black" @click.stop>
       <div class="font-bold text-lg mb-4 pre">新建求真在线</div>
 
-      <van-form @submit="handleOverlaySubmit">
+      <van-form @submit="handleOverlaySubmit" label-width="5em">
         <van-field name="nic_id" label="新闻类型" is-link readonly @click="showPicker = true" v-model="pickerVal"
           :rules="[{ required: true, message: '新闻类型不能为空' }]"> </van-field>
 
@@ -120,9 +126,20 @@ function onFinish(val) {
         <van-field name="ni_title" v-model="overlayForm.ni_title" placeholder="请输入新闻标题..." label="新闻标题"
           :rules="[{ required: true, message: '新闻标题不能为空' }]"></van-field>
 
-        <van-field v-model="overlayForm.ni_content" name="ni_content" placeholder="请输入美篇链接或新闻内容..." maxlength="500"
-          show-word-limit rows="6" type="textarea" autosize :rules="[{ required: true, message: '新闻内容不能为空' }]"
-          label="新闻内容" />
+        <van-field name="radio" label="内容类型">
+          <template #input>
+            <van-radio-group v-model="overlayForm.ni_type" direction="horizontal">
+              <van-radio name="1">美篇链接</van-radio>
+              <van-radio name="0">普通新闻</van-radio>
+            </van-radio-group>
+          </template>
+        </van-field>
+
+        <van-field v-model="overlayForm.ni_content" name="ni_content"
+          :placeholder="`请输入${overlayForm.ni_type === '1' ? '美篇链接' : '新闻内容'}...`" maxlength="500" show-word-limit rows="6"
+          type="textarea" autosize
+          :rules="[{ required: true, message: overlayForm.ni_type === '1' ? '美篇链接不能为空' : '新闻内容不能为空' }]"
+          :label="overlayForm.ni_type === '1' ? '美篇链接' : '新闻内容'" />
 
         <van-field name="ni_img" label="封面图片" :rules="[{ required: true, message: '封面图片不能为空' }]">
           <template #input>

+ 4 - 2
src/router/index.js

@@ -69,12 +69,14 @@ export default createRouter({
     },
     {
       path: "/qzzx",
-      name: 'qzzx',
+
       children: [
         {
           path: '',
+          name: 'qzzx',
           component: () => import("~/pages/qzzx/index.vue"),
-        }, {
+        },
+        {
           // name: 'chat_detail',
           path: 'qzzxxq/:id',
           component: () => import("~/pages/qzzx/xwxq.vue"),