Просмотр исходного кода

初步完成项目资料模块

shaogen1995 4 лет назад
Родитель
Сommit
70acce532b

+ 32 - 0
src/apis/tab1.js

@@ -61,3 +61,35 @@ export const getDetail = (id) => {
     url: `/cms/project/detail/${id}`
   })
 }
+// 编辑页面的项目详情保存
+export const projectEdit1 = (data) => {
+  return axios({
+    method: 'post',
+    url: '/cms/project/edit',
+    data
+  })
+}
+// 编辑页面的 网址/场景保存
+export const editScene = (data) => {
+  return axios({
+    method: 'post',
+    url: '/cms/project/editScene',
+    data
+  })
+}
+// 编辑页面的 文档保存
+export const editDoc = (data) => {
+  return axios({
+    method: 'post',
+    url: '/cms/project/editDoc',
+    data
+  })
+}
+// 编辑页面的 文物保存
+export const editGoods = (data) => {
+  return axios({
+    method: 'post',
+    url: '/cms/project/editGoods',
+    data
+  })
+}

+ 6 - 0
src/router/index.js

@@ -35,6 +35,12 @@ const routes = [
         meta: { myInd: 0 },
         component: () => import('@/views/tab1/tab1_add.vue')
       },
+      {
+        path: 'tab1_edit',
+        name: 'tab1_edit',
+        meta: { myInd: 0 },
+        component: () => import('@/views/tab1/tab1_edit.vue')
+      },
       // 文物案例
       {
         path: 'tab2',

+ 8 - 1
src/views/tab1/index.vue

@@ -63,7 +63,7 @@
           <el-table-column label="操作" width="180">
             <template #default='{row}'>
               <el-button type="text" @click="look(row.id)">查 看</el-button>
-              <el-button type="text">编 辑</el-button>
+              <el-button type="text" @click="projecEdit(row.id)">编 辑</el-button>
               <el-button type="text" @click="projecDel(row.id)">删 除</el-button>
             </template>
           </el-table-column>
@@ -109,6 +109,13 @@ export default {
   watch: {},
   // 方法集合
   methods: {
+    // 点击编辑
+    projecEdit (id) {
+      this.$router.push({
+        path: '/layout/tab1_edit',
+        query: { id }
+      })
+    },
     // 点击删除
     projecDel (id) {
       this.$confirm('确定删除吗?', '提示', {

+ 4 - 3
src/views/tab1/tab1_add.vue

@@ -93,7 +93,6 @@
         </div>
         <div id="tab1" class="conten_box">
           <div class="title">项目网址</div>
-
           <div class="row" v-for="(item, index) in tab1Arr" :key="index">
             <el-input
               v-model="tab1Arr[index].name"
@@ -496,8 +495,10 @@ export default {
 
     successFujian (file) {
       // console.log('上传附件成功', file)
-      this.fuJianArr.push({ name: file.data.name, id: file.data.id })
-      this.$message.success('上传成功')
+      if (file.code === 0) {
+        this.fuJianArr.push({ name: file.data.name, id: file.data.id })
+        this.$message.success('上传成功')
+      } else if (file.code === -1) this.$message.warning('上传失败,不支持的文件格式')
     },
     // 删除附件
     delFJ (index) {

Разница между файлами не показана из-за своего большого размера
+ 1072 - 0
src/views/tab1/tab1_edit.vue


+ 9 - 2
src/views/tab1/tab1_look.vue

@@ -53,7 +53,7 @@
       <!-- 底部按钮 -->
       <div class="button_btn">
         <div @click="$router.go(-1)">返 回</div>
-        <div class="edit">编 辑</div>
+        <div class="edit" @click="projecEdit">编 辑</div>
       </div>
     </div>
   </div>
@@ -92,6 +92,13 @@ export default {
   watch: {},
   // 方法集合
   methods: {
+    // 点击编辑调整编辑页面
+    projecEdit () {
+      this.$router.push({
+        path: '/layout/tab1_edit',
+        query: { id: this.myId }
+      })
+    },
     tabCut (index) {
       this.topTabInd = index
     }
@@ -103,7 +110,7 @@ export default {
     // 拿到路由跳转传过来的数据
     this.myId = this.$route.query.id
     const res = await getDetail(this.myId)
-    console.log(999, res)
+    // console.log(999, res)
     this.tab0Data = res.data.entity
     this.tab0Data.technology = this.myTechnology(this.tab0Data.technology)
     this.tab0Data.application = this.myApplication(this.tab0Data.application)