Ver Fonte

政策服务

linwu há 4 meses atrás
pai
commit
bf0f5a88fc

+ 16 - 0
app/mobile/controller/Jfm.php

@@ -85,6 +85,22 @@ class Jfm extends MobileBaseController
         ]);
     }
 
+    public function policyDetail1()
+    {
+        $id = input('id', 0);
+        if (empty($id)) {
+            jump('文章不存在!');
+        }
+
+        $info = PolicyModel::find($id);
+        $info->volume++;
+        $info->save();
+
+        return view('', [
+            'info' => $info,
+        ]);
+    }
+
     public function service()
     {
         return view();

+ 96 - 36
app/mobile/view/jfm/policy1.html

@@ -1,47 +1,95 @@
-{extend name="public/base_jfm"/}
-{block name="css"}
-<style>
-    .policy-item{width:90%;border:1px solid #eee;margin:20px auto 0 auto;padding:10px 10px;border-radius:10px;box-shadow: 0 0 10px #ccc;box-sizing: border-box;}
-    .policy-header {font-size:15px;font-weight:bold;padding-bottom:10px;}
-    .policy-footer {font-size:12px;display:flex;color:#8C8C8C;border-top:1px solid #ccc;padding-top:10px;}
-    .policy-footer-left {white-space: nowrap;overflow: hidden;text-overflow: ellipsis;width:calc(100% - 110px);}
-    .policy-footer-right {margin-left:auto;width:100px;text-align:right;}
-</style>
-{/block}
-{block name="body"}
-<van-nav-bar
-        class="nav-theme"
-        :fixed="true"
-        :placeholder="true"
-        left-text="返回"
-        left-arrow
-        @click-left="onBack"
->
-    <template #title>
-        <span class="text-white">政策服务</span>
-    </template>
-</van-nav-bar>
-<div class="policy-list">
-    <div class="policy-item" v-for="item in list" @click="toDetail(item.id)">
-        <div class="policy-header">
-            <van-image src="__MIMAGES__/icon_policy.png" height="14px" width="13px"></van-image>
-            {{item.title}}
-        </div>
-        <div class="policy-footer">
-            <div class="policy-footer-left">{{item.government}}</div>
-            <div class="policy-footer-right">{{item.publish_time}}</div>
+<!DOCTYPE html>
+<html lang="zh-cn">
+<head>
+    <meta charset="utf-8">
+    <title>政策服务</title>
+    <meta name="renderer" content="webkit">
+    <meta name="viewport"
+          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"/>
+    <meta name="apple-mobile-web-app-capable" content="yes"/>
+    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
+    <link rel="stylesheet" href="__MCSS__/vant4.6.min.css">
+    <link rel="stylesheet" href="__MCSS__/style.css">
+    <script src="__COMMON_JS__/vue3.3.4.min.js"></script>
+    <script src="__MJS__/vant4.6.min.js"></script>
+    <script src="__COMMON_JS__/axios1.4.min.js"></script>
+    <script>
+        const baseUrl = "{:url('/')}";
+    </script>
+    <script src="__MJS__/axios_instance.js"></script>
+    <style>
+        .policy-item {
+            width: 90%;
+            border: 1px solid #eee;
+            margin: 20px auto 0 auto;
+            padding: 10px 10px;
+            border-radius: 10px;
+            box-shadow: 0 0 10px #ccc;
+            box-sizing: border-box;
+        }
+
+        .policy-header {
+            font-size: 15px;
+            font-weight: bold;
+            padding-bottom: 10px;
+        }
+
+        .policy-footer {
+            font-size: 12px;
+            display: flex;
+            color: #8C8C8C;
+            border-top: 1px solid #ccc;
+            padding-top: 10px;
+        }
+
+        .policy-footer-left {
+            white-space: nowrap;
+            overflow: hidden;
+            text-overflow: ellipsis;
+            width: calc(100% - 110px);
+        }
+
+        .policy-footer-right {
+            margin-left: auto;
+            width: 100px;
+            text-align: right;
+        }
+    </style>
+</head>
+<body>
+<div id="app">
+    <van-nav-bar
+            class="nav-theme"
+            :fixed="true"
+            :placeholder="true"
+            left-text="返回"
+            left-arrow
+            @click-left="onBack"
+    >
+        <template #title>
+            <span class="text-white">政策服务</span>
+        </template>
+    </van-nav-bar>
+    <div class="policy-list">
+        <div class="policy-item" v-for="item in list" @click="toDetail(item.id)">
+            <div class="policy-header">
+                <van-image src="__MIMAGES__/icon_policy.png" height="14px" width="13px"></van-image>
+                {{item.title}}
+            </div>
+            <div class="policy-footer">
+                <div class="policy-footer-left">{{item.government}}</div>
+                <div class="policy-footer-right">{{item.publish_time}}</div>
+            </div>
         </div>
     </div>
 </div>
-{/block}
-{block name="script"}
 <script>
     function v_setup() {
         let base = {};
 
         base.list = {$list};
         base.toDetail = (id) => {
-            location.href = "{:url('jfm/policyDetail')}?id="+id;
+            location.href = "{:url('jfm/policyDetail1')}?id=" + id;
         };
 
         base.onBack = () => {
@@ -50,5 +98,17 @@
 
         return base;
     }
+
+    const vue3 = {
+        setup() {
+            return v_setup();
+        }
+    };
+
+    const app = Vue.createApp(vue3)
+        .use(vant)
+        .use(vant.Lazyload);
+    app.mount('#app');
 </script>
-{/block}
+</body>
+</html>

+ 124 - 0
app/mobile/view/jfm/policy_detail1.html

@@ -0,0 +1,124 @@
+<!DOCTYPE html>
+<html lang="zh-cn">
+<head>
+    <meta charset="utf-8">
+    <title>政策服务</title>
+    <meta name="renderer" content="webkit">
+    <meta name="viewport"
+          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, viewport-fit=cover"/>
+    <meta name="apple-mobile-web-app-capable" content="yes"/>
+    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
+    <link rel="stylesheet" href="__MCSS__/vant4.6.min.css">
+    <link rel="stylesheet" href="__MCSS__/style.css">
+    <script src="__COMMON_JS__/vue3.3.4.min.js"></script>
+    <script src="__MJS__/vant4.6.min.js"></script>
+    <script src="__COMMON_JS__/axios1.4.min.js"></script>
+    <script>
+        const baseUrl = "{:url('/')}";
+    </script>
+    <script src="__MJS__/axios_instance.js"></script>
+
+    <style>
+        .article {
+            background: white;
+            padding: 0 10px;
+        }
+
+        .article h3 {
+            padding: 10px 0;
+            margin: 0;
+        }
+
+        .article .article-info {
+            align-items: center;
+            display: flex;
+            justify-content: space-between;
+            margin: 5px;
+            font-size: 12px;
+        }
+
+        .article .article-info .s-time {
+            color: #b4b4b4;
+        }
+
+        .article .article-info .s-comment {
+            background: #f5f7f9;
+            border-radius: 5px;
+            flex-shrink: 0;
+            font-size: 14px;
+            padding: 5px 10px;
+        }
+
+        .content, .content img {
+            width: 100%;
+            display: block;
+        }
+
+        .content p {
+            padding: 0;
+            margin: 0;
+        }
+    </style>
+</head>
+<body>
+<div id="app">
+    <van-nav-bar
+            class="nav-theme"
+            :fixed="true"
+            :placeholder="true"
+            left-text="返回"
+            left-arrow
+            @click-left="onBack"
+    >
+        <template #title>
+            <span class="text-white">政策详情</span>
+        </template>
+    </van-nav-bar>
+
+    <div class="article">
+        <header>
+            <h3>{$info.title}</h3>
+            <section class="article-info">
+                <div class="s-author">
+                    <address>
+                        <span>{$info.government}</span>
+                    </address>
+                    <div class="s-time">
+                        <time>{$info.publish_time}</time>
+                    </div>
+                </div>
+                <aside class="s-comment js-article-comment">
+                    <van-icon name="chat-o"></van-icon>
+                    <span class="js-article-commentCount">{$info.volume}</span>
+                </aside>
+            </section>
+        </header>
+        <section class="content" ref="content">
+            {$info.content}
+        </section>
+    </div>
+</div>
+<script>
+    function v_setup() {
+        let base = {};
+
+        base.onBack = () => {
+            history.back();
+        };
+
+        return base;
+    }
+
+    const vue3 = {
+        setup() {
+            return v_setup();
+        }
+    };
+
+    const app = Vue.createApp(vue3)
+        .use(vant)
+        .use(vant.Lazyload);
+    app.mount('#app');
+</script>
+</body>
+</html>