梁沛聪 il y a 6 ans
Parent
révision
85710224b0

+ 2
- 2
hksystem/src/router/router.js Voir le fichier

@@ -170,11 +170,11 @@ export const appRouter = [{
170 170
         path: '/image',
171 171
         icon: 'images',
172 172
         name: 'image',
173
-        title: '首页底部图片配置',
173
+        title: '首页介绍和图片配置',
174 174
         component: Main,
175 175
         children: [{
176 176
             path: 'index',
177
-            title: '首页图片配置',
177
+            title: '首页服务介绍和底部图片配置',
178 178
             name: 'image_index',
179 179
             component: resolve => {
180 180
                 require(['@/views/image/index.vue'], resolve);

+ 47
- 20
hksystem/src/views/image/index.vue Voir le fichier

@@ -9,6 +9,13 @@
9 9
             float: right;
10 10
         }
11 11
     }
12
+    .ivu-form .ivu-form-item-label{
13
+        width: 80px;
14
+        font-size: 16px;
15
+    }
16
+    .ivu-form-item-content{
17
+        margin-left: 80px;
18
+    }
12 19
 </style>
13 20
 
14 21
 <template>
@@ -16,14 +23,19 @@
16 23
         <Row class="margin-top-10">
17 24
             <Col>
18 25
             <Card>
19
-                <p slot="title">首页底部模块编辑</p>
26
+                <p slot="title">首页服务介绍和底部图片配置</p>
20 27
                 <div class="edittable-table-height-con">
28
+                    <img :src="photo" style="width:100%;max-width:750px;" v-if="photo" class="upload-img">
21 29
                     <Form>
22
-                        <Upload :action='$domain + "/upload"'>
23
-                            <Button icon="ios-cloud-upload-outline">上传显示图片</Button>
30
+                        <Upload :headers="uploadHeader" :on-success="handleSuccess" :action='$domain + "/upload"'>
31
+                            <Button icon="ios-cloud-upload-outline">上传更新图片</Button>
24 32
                         </Upload>
25
-                        <FormItem label="图片点击显示详情">
26
-                            <editor :editor-content="introduce"></editor>
33
+                        <br>
34
+                        <FormItem label="图片详情">
35
+                            <editor :editor-content="content"></editor>
36
+                        </FormItem>
37
+                        <FormItem label="服务介绍">
38
+                            <Input v-model="introduce" type="textarea" :rows="6" placeholder="请输入服务介绍" />
27 39
                         </FormItem>
28 40
                     </Form>
29 41
                     <div class="submit">
@@ -40,24 +52,37 @@
40 52
     import tinymce from 'tinymce';
41 53
     import editor from '../main-components/editor'
42 54
     export default {
43
-        name: 'introduce',
55
+        name: 'images',
44 56
         components: {
45 57
             editor
46 58
         },
47 59
         data() {
48 60
             return {
61
+                content: '',
62
+                photo: '',
49 63
                 introduce: '',
50
-                publishLoading: false
64
+                publishLoading: false,
65
+                uploadHeader: {
66
+
67
+                }
51 68
             };
52 69
         },
53 70
         methods: {
71
+            handleSuccess (res, file) {
72
+                if (res.status == 0) {
73
+                    this.photo = res.location
74
+                }
75
+            },
54 76
             handlePublish() {
55
-                let introduce = tinymce.activeEditor.getContent();
56
-                console.warn(introduce)
57
-                if (introduce) {
77
+                const content = tinymce.activeEditor.getContent();
78
+                const photo = this.photo;
79
+                const introduce = this.introduce;
80
+                if (content && photo) {
58 81
                     this.publishLoading = true;
59
-                    this.axios.post("/product/store", {
60
-
82
+                    this.axios.post("/bottom/store", {
83
+                        content,
84
+                        photo,
85
+                        introduce
61 86
                     }).then((res) => {
62 87
                         if (res.data.status == 0) {
63 88
                             this.$Message.success('操作成功!');
@@ -68,20 +93,22 @@
68 93
                         }
69 94
                     });
70 95
                 } else {
71
-                    this.$Message.warning('内容不能为空!');
96
+                    this.$Message.warning('请把内容填写完整!');
72 97
                 }
73 98
             },
74 99
             getData() {
75
-                this.axios.post("/product/store", {})
76
-                .then((res) => {
77
-                    if (res.data.status == 0) {
78
-                        this.introduce = res.data.data.introduce;
79
-                    }
80
-                });
100
+                this.axios.get("/bottom", {})
101
+                    .then((res) => {
102
+                        if (res.data.status == 0) {
103
+                            this.content = res.data.data.content;
104
+                            this.photo = res.data.data.photo;
105
+                            this.introduce = res.data.data.introduce;
106
+                        }
107
+                    });
81 108
             }
82 109
         },
83 110
         mounted() {
84
-            // this.getData();
111
+            this.getData();
85 112
         }
86 113
     };
87 114
 </script>

+ 0
- 1
hksystem/src/views/introduce/index.vue Voir le fichier

@@ -50,7 +50,6 @@
50 50
         methods: {
51 51
             handlePublish() {
52 52
                 let introduce = tinymce.activeEditor.getContent();
53
-                console.warn(introduce)
54 53
                 if (introduce) {
55 54
                     this.publishLoading = true;
56 55
                     this.axios.post("/introduce/store", {

+ 6
- 2
miniapp/app/pages/detail/index.js Voir le fichier

@@ -4,10 +4,14 @@ const $ = global
4 4
 new $.Page({
5 5
     onLoad(options) {
6 6
         const id = options.id;
7
-        if (id) {
7
+        const meta = $.router.getMeta();
8
+        const content = meta && meta.params && meta.params.content;
9
+        if (content) {
10
+            WxParse.wxParse('article', 'html', content, this, 5);
11
+        }else if (id) {
8 12
             $.request(`server_info/${id}`, 'GET', {}).then((res) => {
9 13
                 var article = res.data.content || '';
10
-                WxParse.wxParse('article', 'html', article, this, 5)
14
+                WxParse.wxParse('article', 'html', article, this, 5);
11 15
             });
12 16
         }
13 17
     }

+ 12
- 8
miniapp/app/pages/home/index.js Voir le fichier

@@ -41,17 +41,21 @@ new $.Page({
41 41
         }
42 42
     },
43 43
     toDetail(e) {
44
+        console.warn(e);
44 45
         const {
45 46
             id,
46
-            name
47
-        } = e.target.dataset;
47
+            name,
48
+            type
49
+        } = e.currentTarget.dataset;
50
+        if (type && type == 'bottom') {
51
+            return $.router.goto({
52
+                path: `/pages/detail/index`,
53
+                params: {
54
+                    content: this.data.bottom.content || ''
55
+                }
56
+            });
57
+        }
48 58
         if (id) {
49
-            // $.router.goto({
50
-            //     path: `/pages/detail/index`,
51
-            //     query: {
52
-            //         id
53
-            //     }
54
-            // });
55 59
             $.router.goto({
56 60
                 path: `/pages/introduce/index`,
57 61
                 query: {

+ 1
- 1
miniapp/app/pages/home/index.wxml Voir le fichier

@@ -63,7 +63,7 @@
63 63
                 </view>
64 64
             </view>
65 65
         </view>
66
-        <image class="bottom-banner" wx:if="{{bottom.photo}}" mode="widthFix" src="{{bottom.photo}}" data-id="{{bottom.id}}"
66
+        <image class="bottom-banner" wx:if="{{bottom.photo}}" data-type="bottom" mode="widthFix" src="{{bottom.photo}}" data-id="{{bottom.id}}"
67 67
             bindtap="toDetail"></image>
68 68
     </view>
69 69
 </view>

Loading…
Annuler
Enregistrer