Browse Source

Merge remote-tracking branch 'origin/master'

gt 2 years ago
parent
commit
95d611b879
51 changed files with 724 additions and 187 deletions
  1. 24 10
      nngkxxdp/src/main/java/com/example/nngkxxdp/filters/LoginFilter.java
  2. 4 2
      nngkxxdp/src/main/java/com/example/nngkxxdp/program/constant/MiniConstant.java
  3. 1 1
      nngkxxdp/src/main/java/com/example/nngkxxdp/program/controller/LoginController.java
  4. 53 46
      nngkxxdp/src/main/java/com/example/nngkxxdp/program/service/Impl/MiniLoginServiceImpl.java
  5. 26 0
      nngkxxdp/src/main/resources/static/nnzwminiapp/app.js
  6. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/icon1.png
  7. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/icon2.png
  8. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/icon3.png
  9. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/icon4.png
  10. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/icon5.png
  11. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/icon6.png
  12. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/icon7.png
  13. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/icon8.png
  14. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/icon9.png
  15. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/public1.png
  16. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/public2.png
  17. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/public3.png
  18. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/public4.png
  19. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/search.png
  20. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/topbg.png
  21. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/toplogo.png
  22. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/图层 1298.png
  23. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/图层 3261.png
  24. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/图层 3262.png
  25. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/图层 3269.png
  26. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/images/图层 3270.png
  27. 8 0
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/api/index-api.js
  28. 27 0
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/api/request.js
  29. 9 0
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/api/user-api.js
  30. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/index-bg.png
  31. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/index-search.png
  32. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/people-title.png
  33. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-1.png
  34. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-10.png
  35. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-2.png
  36. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-3.png
  37. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-4.png
  38. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-5.png
  39. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-6.png
  40. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-7.png
  41. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-8.png
  42. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-9.png
  43. BIN
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/three.png
  44. 76 42
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/index/index.js
  45. 2 1
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/index/index.json
  46. 58 10
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/index/index.wxml
  47. 111 10
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/index/index.wxss
  48. 95 61
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/publics/publics.js
  49. 2 2
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/publics/publics.json
  50. 99 1
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/publics/publics.wxml
  51. 129 1
      nngkxxdp/src/main/resources/static/nnzwminiapp/pages/publics/publics.wxss

+ 24 - 10
nngkxxdp/src/main/java/com/example/nngkxxdp/filters/LoginFilter.java

@@ -1,6 +1,7 @@
 package com.example.nngkxxdp.filters;
 
 import java.io.IOException;
+import java.io.PrintWriter;
 import java.util.Map;
 
 import javax.servlet.*;
@@ -8,12 +9,16 @@ import javax.servlet.annotation.WebFilter;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import com.example.nngkxxdp.program.util.MiniTokenUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.annotation.Order;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.example.nngkxxdp.dao.UserDao;
+import com.example.nngkxxdp.program.constant.MiniConstant;
+import com.example.nngkxxdp.program.util.MiniTokenUtil;
 import com.example.nngkxxdp.util.Blank;
+import com.example.nngkxxdp.util.SendUtil;
 import com.example.nngkxxdp.util.TokenUtil;
 
 /**
@@ -36,15 +41,24 @@ public class LoginFilter implements Filter {
         HttpServletResponse rsp = (HttpServletResponse)response;
         System.err.println(req.getRequestURL());
         // mini是小程序接口
-        if (req.getRequestURI().indexOf("/mini/") > 0) {
-			if (Blank.isEmpty(req.getHeader("mini-token"))) {
-				rsp.sendError(403);
-			}
-			String token = req.getHeader("mini-token");
-			if (!MiniTokenUtil.verify(token)) {
-				rsp.sendError(403);
-			}
-			chain.doFilter(req, response);
+        if (req.getRequestURL().indexOf("/mini/") > 0) {
+            // 登陆
+            if (req.getServletPath().equals("/mini/login")) {
+                chain.doFilter(req, response);
+            } else {
+                if (Blank.isNotEmpty(req.getHeader(MiniConstant.MINI_TOKEN))
+                    && MiniTokenUtil.verify(req.getHeader(MiniConstant.MINI_TOKEN))) {
+                    chain.doFilter(req, response);
+                } else {
+                    response.setCharacterEncoding("utf-8");
+                    response.setContentType("text/html; charset=utf-8");
+                    PrintWriter writer = response.getWriter();
+                    writer.write(JSON.toJSONString(SendUtil.send(false, "请重新登陆"), SerializerFeature.WriteMapNullValue));
+                    writer.flush();
+                    writer.close();
+                    return;
+                }
+            }
         } else {
             if (req.getRequestURI().indexOf("/mapdata/page") > 0) {
                 chain.doFilter(req, response);

+ 4 - 2
nngkxxdp/src/main/java/com/example/nngkxxdp/program/constant/MiniConstant.java

@@ -11,6 +11,8 @@ public class MiniConstant {
 
     public static final String CODE_ERROR = "code error please try again";
 
+    public static final String MINI_TOKEN = "mini-token";
+
     public static final String REQUEST_WRONGPARAMS = "参数错误";
 
     public static final String RESULT_SUCCESS = "SUCCESS";
@@ -65,9 +67,9 @@ public class MiniConstant {
 
     public final static String LOGIN_HLW = "applets/login";
 
-    public final static String APPID = "wx41a107ae83f5c39d";
+    public final static String APPID = "wx77f361463d258af2";
 
-    public final static String SECRET = "e16d1740a235201880231540d284a12a";
+    public final static String SECRET = "2e495c4d111669b3ec1bf00177d13ee2";
 
     public final static String GRANR_TYPE = "authorization_code";
 }

+ 1 - 1
nngkxxdp/src/main/java/com/example/nngkxxdp/program/controller/LoginController.java

@@ -25,7 +25,7 @@ public class LoginController {
     private final MiniLoginService miniLoginService;
 
     @PostMapping("/login")
-    public Map<String, Object> login(@RequestParam String code) {
+    public Map<String, Object> login(@RequestBody String code) {
         if (StrUtil.isEmpty(code)) {
             return SendUtil.send(false, MiniConstant.CODE_ERROR, "");
         }

+ 53 - 46
nngkxxdp/src/main/java/com/example/nngkxxdp/program/service/Impl/MiniLoginServiceImpl.java

@@ -1,24 +1,26 @@
 package com.example.nngkxxdp.program.service.Impl;
 
-import cn.hutool.core.convert.Convert;
-import cn.hutool.core.lang.UUID;
-import cn.hutool.core.util.ObjectUtil;
-import cn.hutool.http.HttpUtil;
-import cn.hutool.json.JSONObject;
+import static com.example.nngkxxdp.program.constant.MiniConstant.LOGIN_HLW;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
 import com.example.nngkxxdp.program.constant.MiniConstant;
 import com.example.nngkxxdp.program.dao.AppletUserDao;
 import com.example.nngkxxdp.program.entity.AppletUser;
 import com.example.nngkxxdp.program.service.MiniLoginService;
 import com.example.nngkxxdp.program.util.MiniTokenUtil;
 import com.example.nngkxxdp.util.SendUtil;
-import lombok.RequiredArgsConstructor;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
 
-import java.util.HashMap;
-import java.util.Map;
-
-import static com.example.nngkxxdp.program.constant.MiniConstant.LOGIN_HLW;
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.lang.UUID;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.http.HttpUtil;
+import cn.hutool.json.JSONObject;
+import lombok.RequiredArgsConstructor;
 
 /**
  * description: 登陆
@@ -42,43 +44,48 @@ public class MiniLoginServiceImpl implements MiniLoginService {
      */
     @Override
     public Map<String, Object> login(String code) {
-        Map<String, Object> requestParameters = new HashMap<>(5);
-        requestParameters.put("appid", MiniConstant.APPID);
-        requestParameters.put("secret", MiniConstant.SECRET);
-        requestParameters.put("js_code", code);
-        requestParameters.put("grant_type", MiniConstant.GRANR_TYPE);
-        String s = HttpUtil.get(MiniConstant.LOGIN, requestParameters);
-        System.err.println(s);
-        JSONObject jsonObject = new JSONObject(s);
-        if (ObjectUtil.isNotEmpty(jsonObject.get("errcode"))) {
-            return SendUtil.send(false, "", jsonObject);
-        }
-        Map<String, Object> parameters = new HashMap<>(5);
-        parameters.put("unionId", Convert.toStr(jsonObject.get("openid")));
-        String s1 = HttpUtil.get(address + LOGIN_HLW, parameters);
-        JSONObject userinfo = new JSONObject(s1);
+        try {
+            Map<String, Object> requestParameters = new HashMap<>(5);
+            requestParameters.put("appid", MiniConstant.APPID);
+            requestParameters.put("secret", MiniConstant.SECRET);
+            requestParameters.put("js_code", code);
+            requestParameters.put("grant_type", MiniConstant.GRANR_TYPE);
+            String s = HttpUtil.get(MiniConstant.LOGIN, requestParameters);
+            System.err.println(s);
+            JSONObject jsonObject = new JSONObject(s);
+            if (ObjectUtil.isNotEmpty(jsonObject.get("errcode"))) {
+                return SendUtil.send(false, "", jsonObject);
+            }
+            Map<String, Object> parameters = new HashMap<>(5);
+            parameters.put("unionId", Convert.toStr(jsonObject.get("openid")));
+            String s1 = HttpUtil.get(address + LOGIN_HLW, parameters);
+            JSONObject userinfo = new JSONObject(s1);
 
-        AppletUser appletUser = new AppletUser();
-        appletUser.setId(UUID.randomUUID().toString());
-        appletUser.setSessionKey(Convert.toStr(jsonObject.get("session_key")));
-        appletUser.setOpenid(Convert.toStr(jsonObject.get("openid")));
-        appletUser.setNickName(Convert.toStr(userinfo.get("nickName")));
-        appletUser.setImgUrl(Convert.toStr(userinfo.get("imgUrl")));
-        appletUser.setUserId(Convert.toLong(userinfo.get("userId")));
-        appletUser.setSex(Convert.toInt(userinfo.get("sex")));
+            AppletUser appletUser = new AppletUser();
+            appletUser.setId(UUID.randomUUID().toString());
+            appletUser.setSessionKey(Convert.toStr(jsonObject.get("session_key")));
+            appletUser.setOpenid(Convert.toStr(jsonObject.get("openid")));
+            appletUser.setNickName(Convert.toStr(userinfo.get("nickName")));
+            appletUser.setImgUrl(Convert.toStr(userinfo.get("imgUrl")));
+            appletUser.setUserId(Convert.toLong(userinfo.get("userId")));
+            appletUser.setSex(Convert.toInt(userinfo.get("sex")));
 
-        AppletUser info = appletUserDao.queryByUserId(appletUser.getUserId());
-        if (ObjectUtil.isNotEmpty(info)) {
-            info.setToken(appletUser.getToken());
-            info.setNickName(appletUser.getNickName());
-            info.setImgUrl(appletUser.getImgUrl());
-            info.setSex(appletUser.getSex());
-            appletUserDao.update(info);
+            AppletUser info = appletUserDao.queryByUserId(appletUser.getUserId());
+            if (ObjectUtil.isNotEmpty(info)) {
+                info.setToken(appletUser.getToken());
+                info.setNickName(appletUser.getNickName());
+                info.setImgUrl(appletUser.getImgUrl());
+                info.setSex(appletUser.getSex());
+                appletUserDao.update(info);
+            }
+            appletUserDao.add(appletUser);
+            // 生成token
+            String token = MiniTokenUtil.generateToken(appletUser.getId(), appletUser.getNickName(), 60 * 24);
+            return SendUtil.send(true, "", token);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return SendUtil.send(false, "登陆失败");
         }
-        appletUserDao.add(appletUser);
-        // 生成token
-        String token = MiniTokenUtil.generateToken(appletUser.getId(), appletUser.getNickName(), 60 * 24);
-        return SendUtil.send(true, "", token);
     }
 
     @Override

+ 26 - 0
nngkxxdp/src/main/resources/static/nnzwminiapp/app.js

@@ -1,6 +1,32 @@
 // app.js
 App({
+  globalData: {},
   onLaunch() {
+    // 获取胶囊信息
+    let menuButtonObject = wx.getMenuButtonBoundingClientRect()
+    // 获取设备信息
+    wx.getSystemInfo({
+      success: res => {
+        // 整个导航栏的高度
+        let navHeight = menuButtonObject.top + menuButtonObject.height + (menuButtonObject.top - res.statusBarHeight) * 2
+        // 导航栏的高度
+        let nav = navHeight - res.statusBarHeight
+        // 挂载到全区变量 globalData 上
+        this.globalData.navHeight = navHeight
+        this.globalData.nav = nav
+        // 胶囊与左边的距离
+        this.globalData.menuLeft = menuButtonObject.left
+        // 胶囊的高度
+        this.globalData.menuHeight = menuButtonObject.height
+        // 胶囊距离顶部的高度
+        this.globalData.menuBot = menuButtonObject.top - res.statusBarHeight
+        // 整个设备的宽度
+        this.globalData.windowWidth = res.windowWidth
+      },
+      fail: err => {
+        console.log(err)
+      }
+    })
     // 展示本地存储能力
     // const logs = wx.getStorageSync('logs') || []
     // logs.unshift(Date.now())

BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/icon1.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/icon2.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/icon3.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/icon4.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/icon5.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/icon6.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/icon7.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/icon8.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/icon9.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/public1.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/public2.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/public3.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/public4.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/search.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/topbg.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/toplogo.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/图层 1298.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/图层 3261.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/图层 3262.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/图层 3269.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/images/图层 3270.png


+ 8 - 0
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/api/index-api.js

@@ -0,0 +1,8 @@
+import request from './request.js'
+
+export function test() {
+  return request({
+    url: `/test`,
+    method: 'GET'
+  })
+}

+ 27 - 0
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/api/request.js

@@ -0,0 +1,27 @@
+const baseUrl = "http://localhost:7777/mini"
+let token = wx.getStorageSync('token')
+
+const request = (options) => {
+    return new Promise((resolve,reject) => {
+        options.url = baseUrl + options.url
+        wx.request({
+        	// 配置 "wx.request" 请求参数
+            ...options,
+            header: {
+                'content-type': 'application/json;charset=UTF-8',
+                'mini-token':`${token}`                             
+            },
+            success: function (res) {
+                console.log("network-res=>", res);
+                // 返回成功信息
+                resolve(res.data)    
+            },
+            fail: function (error) {
+                console.log("network-err=>", error);
+                // 返回错误信息
+                reject(error)
+            }
+        })
+    })
+}
+export default request

+ 9 - 0
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/api/user-api.js

@@ -0,0 +1,9 @@
+import request from './request.js'
+
+export function login(data) {
+  return request({
+    url: `/login`,
+    method: 'POST',
+    data: data
+  })
+}

BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/index-bg.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/index-search.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/people-title.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-1.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-10.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-2.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-3.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-4.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-5.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-6.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-7.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-8.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/service-9.png


BIN
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/images/three.png


+ 76 - 42
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/index/index.js

@@ -1,59 +1,93 @@
 // index.js
+import {
+  login
+} from "../api/user-api";
+
 // 获取应用实例
 const app = getApp()
 
 Page({
   data: {
-    motto: 'Hello World',
-    userInfo: {},
-    hasUserInfo: false,
-    canIUse: wx.canIUse('button.open-type.getUserInfo'),
-    canIUseGetUserProfile: false,
-	canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName')
-	// 如需尝试获取用户信息可改为false
+    // 屏幕高度
+    navHeight: '',
+    searchInput: '',
+    // 服务列表
+    serviceItems1: [{ img: '../images/service-1.png', name: '生活缴费' },
+    { img: '../images/service-2.png', name: '社保服务' },
+    { img: '../images/service-3.png', name: '公积金' },
+    { img: '../images/service-4.png', name: '电子证照' },
+    { img: '../images/service-5.png', name: '民政低保' }],
+    serviceItems2: [{ img: '../images/service-6.png', name: '税务服务' },
+    { img: '../images/service-7.png', name: '交通出行' },
+    { img: '../images/service-8.png', name: '核算采样点' },
+    { img: '../images/service-9.png', name: '住房置业' },
+    { img: '../images/service-10.png', name: '更多功能' }],
+    // 百姓聚焦
+    peopleService: [{ top: true, name: '12345热线'},
+    { top: false, name: '个人社保查询'},
+    { top: false, name: '南岸文旅消费劵'},
+    { top: false, name: '长喜汇弹子石老街'},
+    { top: false, name: '南山一棵松'},
+    { top: false, name: '一次性创业补助'}]
   },
 
-
-  onReady() {
-	  	console.log(1);
-		if (typeof this.getTabBar === 'function' &&
-		this.getTabBar()) {
-			this.getTabBar().setData({
-			selected: 0
-			})
-		}
-	},
-  bindViewTap() {
-    wx.navigateTo({
-      url: '/pages/myCenter/myCenter'
+  onReady() {},
+  onShow() {},
+  onLoad() {
+    console.log(app.globalData.navHeight)
+    this.setData({
+      navHeight: app.globalData.navHeight + app.globalData.menuHeight / 2
     })
+    // wx.login({
+    //   success(res) {
+    //     if (res.code) {
+    //       //发起网络请求
+    //       login(res.code).then(res => {
+    //         console.log(res)
+    //         wx.setStorageSync("token", res.data.data)
+    //       })
+    //     } else {
+    //       console.log('登录失败!' + res.errMsg)
+    //     }
+    //   }
+    // })
   },
-  onShow(){
-		if (typeof this.getTabBar === 'function' &&
-		this.getTabBar()) {
-		this.getTabBar().setData({
-		selected: 0
-		})
-	}
-  },
-  onLoad() {
-    if (wx.getUserProfile) {
-      this.setData({
-        canIUseGetUserProfile: true
-      })
-    }
+
+  bindKeyInput: function (e) {
+    this.setData({
+      searchInput: e.detail.value
+    })
   },
-  getUserProfile(e) {
-    // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
+
+  getUserProfile() {
+    wx.setStorageSync('nickname', "");
+    wx.setStorageSync('avatarUrl', "");
     wx.getUserProfile({
-      desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写
+      desc: '获取用户信息',
       success: (res) => {
-        console.log(res)
-        this.setData({
-          userInfo: res.userInfo,
-          hasUserInfo: true
+        wx.setStorageSync('nickname', res.userInfo.nickName);
+        wx.setStorageSync('avatarUrl', res.userInfo.avatarUrl);
+        wx.login({
+          success(res) {
+            if (res.code) {
+              //发起网络请求
+              data = {
+                code: res.code
+              }
+              login(data).then(res => {
+                console.log(res)
+                wx.setStorageSync("token", res.data.data)
+              })
+            } else {
+              console.log('登录失败!' + res.errMsg)
+            }
+          }
         })
+      },
+      fail(res) {
+        console.log("获取用户信息失败", res)
       }
     })
   }
-})
+
+})

+ 2 - 1
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/index/index.json

@@ -1,5 +1,6 @@
 {
 	"usingComponents": {
 	  },
-	  "navigationBarTitleText": "首页"
+		"navigationBarTitleText": "首页",
+		"navigationStyle":"custom"
 }

+ 58 - 10
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/index/index.wxml

@@ -1,12 +1,60 @@
-<!--index.wxml-->
-<view class="container">
-  <view class="userinfo" bindtap="gotoshitang">
-    <block wx:if="{{canIUseOpenData}}">
-      <view class="userinfo-avatar" bindtap="bindViewTap">
-        <open-data type="userAvatarUrl" ></open-data>
-      </view>
-      <open-data type="userNickName"></open-data>
-    </block>
+<!--pages/publics/publics.wxml-->
+<view>
+
+  <view class="top">
+    <image src="../images/index-bg.png" style="width:100%;height:409rpx"></image>
+    <image src="../../images/toplogo.png" class="top-logo" style="top: {{navHeight}}rpx"></image>
+  </view>
+
+  <view class="content-search" style="height:648rpx;width:100%;background-color:#F5F5F5;position:relative">
+    <!-- 内容top -->
+    <view class="content-search-tab" style="height: 648rpx;">
+      <!-- 搜索 -->
+      <view style="width:650rpx;height:60rpx">
+        <view class="search-view">
+          <view class="search-icon">
+            <image src="../images/index-search.png" style="height:28rpx;width:28rpx"></image>
+          </view>
+          <input class="search-input" bindinput="bindKeyInput" placeholder="在此输入关键字" />
+        </view>
+      </view>
+      <!-- 服务内容1 -->
+      <view class="content-service" style="margin-top: 15rpx">
+        <view wx:for="{{ serviceItems1 }}" wx:for-item="item" wx:for-index="index" class="content-service-item">
+          <view>
+            <image src="{{ item.img }}" style="height:88rpx;width:88rpx"></image>
+          </view>
+          <view>{{ item.name }}</view>
+        </view>
+      </view>
+      <!-- 服务内容2 -->
+      <view class="content-service">
+        <view wx:for="{{ serviceItems2 }}" wx:for-item="item" wx:for-index="index" class="content-service-item">
+          <view>
+            <image src="{{ item.img }}" style="height:88rpx;width:88rpx"></image>
+          </view>
+          <view>{{ item.name }}</view>
+        </view>
+      </view>
+      <!-- 百姓聚焦 -->
+      <view class="content-people" style="margin-top: 15rpx">
+        <view class="people-title">
+          <image src="../images/people-title.png" style="height: 59rpx;width: 59rpx;"></image>
+          <view class="people-font1">百姓聚焦</view>
+          <view class="people-font2">每日更新</view>
+        </view>
+        <view class="people-content">
+          <view wx:for="{{ peopleService }}" wx:for-item="item" wx:for-index="index" class="people-content-item"> {{ item.name }}</view>
+        </view>
+      </view>
+      <!-- 百姓聚焦 -->
+    </view>
+    <!-- 内容top -->
+  </view>
+
+  <!-- 三会一聚 -->
+  <view class="three" style="background-color: #F5F5F5;">
+    <image src="../images/three.png" style="height:163rpx;width:100%"></image>
   </view>
-</view>
 
+</view>

+ 111 - 10
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/index/index.wxss

@@ -1,19 +1,120 @@
 /**index.wxss**/
-.userinfo {
+/* pages/publics/publics.wxss */
+.top {
+  height: 409rpx;
+  overflow: hidden;
+  position: relative;
+}
+
+.top-logo {
+  z-index: 99;
+  position: absolute;
+  left: 50%;
+  transform: translate(-50%);
+  width: 500rpx;
+  height: 200rpx;
+}
+
+.content-search-tab {
+  margin-left: 20rpx;
+  top: -85rpx;
+  position: absolute;
+  border-radius: 10rpx;
+  background-color: #ffffff;
+  padding: 25rpx 30rpx;
+  width: 651rpx;
+}
+
+.search-view {
+  height: 60rpx;
+  border-radius: 5rpx;
+  background-color: #F5F5F5;
   display: flex;
+  justify-content: left;
+  align-items: center;
+}
+
+.search-icon {
+  display: flex;
+  justify-content: center;
+  align-items: center;
+  padding-left: 20rpx;
+  padding-right: 20rpx;
+  letter-spacing: 3rpx;
+}
+
+.search-input {
+  height: 30rpx;
+  font-size: 25rpx;
+  letter-spacing: 3rpx;
+}
+
+.content-service {
+  height: 170rpx;
+  flex-wrap: wrap;
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+
+.content-service-item {
+  display: flex;
+  justify-content: center;
+  align-items: center;
   flex-direction: column;
+  height: 123rpx;
+  width: 119rpx;
+}
+
+/* 百信聚焦 */
+.people-title {
+  display: flex;
+  flex-direction: row;
+  justify-content: left;
   align-items: center;
-  color: #aaa;
 }
 
-.userinfo-avatar {
-  overflow: hidden;
-  width: 128rpx;
-  height: 128rpx;
-  margin: 20rpx;
-  border-radius: 50%;
+.people-font1 {
+  height: 59rpx;
+  /* font-size: 36rpx; */
+  font-size: 46rpx;
+  font-family: DOUYU;
+  font-weight: normal;
+  color: #333333;
+  padding-right: 18rpx;
+  display: flex;
+  flex-direction: row;
+  align-items: center;
 }
 
-.usermotto {
-  margin-top: 200px;
+.people-font2 {
+  height: 59rpx;
+  font-size: 18px;
+  font-family: PingFang SC;
+  font-weight: 500;
+  color: #999999;
+  display: flex;
+  flex-direction: row;
+  align-items: flex-end;
+}
+
+.people-content {
+  height: 140rpx;
+  flex-wrap: wrap;
+  display: flex;
+  justify-content: space-around;
+  align-items: center;
+}
+
+.people-content-item {
+  font-size: 24rpx;
+  font-family: PingFang SC;
+  font-weight: 500;
+  color: #508FF4;
+  height: 48rpx;
+  background-color: #E5EFFF;
+  padding: 0rpx 20rpx;
+  display: flex;
+  align-items: center;
+  border-radius: 28rpx;
 }

+ 95 - 61
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/publics/publics.js

@@ -2,65 +2,99 @@
 let app = getApp();
 Page({
 
-	/**
-	 * 页面的初始数据
-	 */
-	data: {
-
-	},
-
-
-	/**
-	 * 生命周期函数--监听页面初次渲染完成
-	 */
-	onReady() {
-
-	},
-
-	/**
-	 * 生命周期函数--监听页面显示
-	 */
-	onShow() {
-		console.log(2);
-		if (typeof this.getTabBar === 'function' && this.getTabBar()) {
-		this.getTabBar().setData({
-		  selected: 1
-		})
-	  }
-	},
-
-	/**
-	 * 生命周期函数--监听页面隐藏
-	 */
-	onHide() {
-
-	},
-
-	/**
-	 * 生命周期函数--监听页面卸载
-	 */
-	onUnload() {
-
-	},
-
-	/**
-	 * 页面相关事件处理函数--监听用户下拉动作
-	 */
-	onPullDownRefresh() {
-
-	},
-
-	/**
-	 * 页面上拉触底事件的处理函数
-	 */
-	onReachBottom() {
-
-	},
-
-	/**
-	 * 用户点击右上角分享
-	 */
-	onShareAppMessage() {
-
-	}
+  /**
+   * 页面的初始数据
+   */
+  data: {
+    // 屏幕高度
+    navHeight: '',
+    background: ['1', '2', '3', '4', '5'],
+    // 政策解读
+    policyInterpretation: [{
+      name: '文字解读'
+    }, {
+      name: '图片解读'
+    }, {
+      name: '视频解读'
+    }, {
+      name: '媒体解读'
+    }],
+    // 政策解读默认项
+    currentTab: '0',
+    // 政务专题
+    topics: ['../../images/图层 3269.png', '../../images/图层 3270.png', '../../images/图层 3269.png']
+  },
+
+
+  /**
+   * 生命周期函数--监听页面初次渲染完成
+   */
+  onReady() {
+
+  },
+  // 事件处理函数
+  onLoad() {
+    this.setData({
+      navHeight: app.globalData.navHeight + app.globalData.menuHeight / 2
+    })
+
+  },
+  // 跳转更多界面
+  goToMore() {
+    console.log("跳转到详细界面");
+  },
+  // 切换政策解读
+  tabNav(e) {
+    let currentTab = e.currentTarget.dataset.index
+    this.setData({
+      currentTab
+    })
+  },
+
+  /**
+   * 生命周期函数--监听页面显示
+   */
+  onShow() {
+    console.log(2);
+    if (typeof this.getTabBar === 'function' && this.getTabBar()) {
+      this.getTabBar().setData({
+        selected: 1
+      })
+    }
+  },
+
+  /**
+   * 生命周期函数--监听页面隐藏
+   */
+  onHide() {
+
+  },
+
+  /**
+   * 生命周期函数--监听页面卸载
+   */
+  onUnload() {
+
+  },
+
+  /**
+   * 页面相关事件处理函数--监听用户下拉动作
+   */
+  onPullDownRefresh() {
+
+  },
+
+  /**
+   * 页面上拉触底事件的处理函数
+   */
+  onReachBottom() {
+
+  },
+
+  /**
+   * 用户点击右上角分享
+   */
+  onShareAppMessage() {
+
+  }
 })

+ 2 - 2
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/publics/publics.json

@@ -1,4 +1,4 @@
 {
-	"usingComponents": {
-	}
+  "usingComponents": {},
+  "navigationStyle":"custom"
 }

+ 99 - 1
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/publics/publics.wxml

@@ -1,2 +1,100 @@
 <!--pages/publics/publics.wxml-->
-<text>pages/publics/publics.wxml</text>
+<view style="background-color: #F5F5F5">
+  <view class="top">
+    <image src="../../images/topbg.png" style="width: 100%;height:519rpx"></image>
+    <image src="../../images/toplogo.png" class="top-logo" style="top: {{navHeight}}rpx"></image>
+    <view class="top-serach">
+      <view class="search-input">
+        <input style="height: 72rpx;" placeholder="请在此输入关键字" />
+      </view>
+      <button class="search-button">
+        <image src="../../images/search.png"></image>
+      </button>
+    </view>
+  </view>
+  <view class="learder">
+    <view style="display:flex" class="content-top">
+      <view class="content-line"></view>
+      <view class="content-title">区政府领导</view>
+      <view class="content-more" bindtap="goToMore">查看更多 >></view>
+    </view>
+    <swiper display-multiple-items="3" autoplay="{{false}}" style="padding: 0 20rpx;" next-margin="100rpx" snap-to-edge="{{true}}">
+      <block wx:for="{{background}}" wx:key="*this">
+        <swiper-item>
+          <image src="../../images/图层 1298.png"></image>
+          <view style="display: flex;">
+            <view class="swiper-item">王茂春</view>
+            <view>区长</view>
+          </view>
+        </swiper-item>
+      </block>
+    </swiper>
+  </view>
+  <view style="height: 400px;">
+    <view style="display:flex" class="content-top">
+      <view class="content-line"></view>
+      <view class="content-title">政府信息公开</view>
+      <view class="content-more" bindtap="goToMore">查看更多 >></view>
+    </view>
+    <view>
+      <view style="background-image: url('../../images/public1.png');width: 100%;height:100%"></view>
+    </view>
+  </view>
+  <view style="height: 400px;">
+    <view style="display:flex" class="content-top">
+      <view class="content-line"></view>
+      <view class="content-title">基层政务公开</view>
+      <view class="content-more" bindtap="goToMore">查看更多 >></view>
+    </view>
+    <view>
+      <view style="background-image: url('../../images/public1.png');width: 100%;height:100%"></view>
+    </view>
+  </view>
+  <view style="height: 400px;">
+    <view style="display:flex" class="content-top">
+      <view class="content-line"></view>
+      <view class="content-title">政策文件</view>
+      <view class="content-more" bindtap="goToMore">查看更多 >></view>
+    </view>
+    <view>
+      <view style="background-image: url('../../images/public1.png');width: 100%;height:100%"></view>
+    </view>
+  </view>
+  <view>
+    <view style="display:flex" class="content-top">
+      <view class="content-line"></view>
+      <view class="content-title">政策解读</view>
+      <view class="content-more" bindtap="goToMore">查看更多 >></view>
+    </view>
+    <view class="policy-interpretation">
+      <scroll-view class="scroll-wrapper" scroll-x scroll-with-animation="true" scroll-into-view="item{{currentTab < 4 ? 0 : currentTab - 3}}">
+        <view class="navigate-item" id="item{{index}}" wx:for="{{policyInterpretation}}" wx:key="index" data-index="{{index}}" bindtap="tabNav">
+          <view class="names">{{item.name}}</view>
+          <view class="currtline {{currentTab === index ? 'active' : ''}}" wx:if="{{currentTab === index}}"></view>
+        </view>
+      </scroll-view>
+      <swiper display-multiple-items="2" current="{{currentTab}}" bindchange="handleSwiper" autoplay="{{false}}" style="padding: 0 10px;margin-top: 15rpx">
+        <block wx:for="{{background}}" wx:key="*this">
+          <swiper-item>
+            <image src="../../images/图层 3261.png" style="width: 327rpx;height: 227rpx;"></image>
+          </swiper-item>
+        </block>
+      </swiper>
+    </view>
+
+  </view>
+  <view>
+    <view style="display:flex" class="content-top">
+      <view class="content-line"></view>
+      <view class="content-title">政务专题</view>
+      <view class="content-more" bindtap="goToMore">查看更多 >></view>
+    </view>
+    <swiper display-multiple-items="2" autoplay="{{false}}" style="padding: 0 10px;height: 400rpx;;">
+      <block wx:for="{{topics}}" wx:key="*this">
+        <swiper-item>
+          <image src="{{item}}" style="width: 327rpx;height: 227rpx;"></image>
+        </swiper-item>
+      </block>
+    </swiper>
+  </view>
+</view>

+ 129 - 1
nngkxxdp/src/main/resources/static/nnzwminiapp/pages/publics/publics.wxss

@@ -1 +1,129 @@
-/* pages/publics/publics.wxss */
+/* pages/publics/publics.wxss */
+.top {
+  position: relative;
+}
+
+.top-logo {
+  z-index: 99;
+  position: absolute;
+  left: 50%;
+  transform: translate(-50%, 0);
+  width: 426rpx;
+  height: 150rpx;
+}
+
+.top-serach {
+  z-index: 99;
+  position: absolute;
+  left: 50%;
+  bottom: 100rpx;
+  transform: translate(-50%, 0);
+  display: flex;
+}
+
+.search-input {
+  border-top-left-radius: 10rpx;
+  border-end-start-radius: 10rpx;
+  padding: 0 30rpx;
+  width: 434rpx;
+  height: 72rpx;
+  line-height: 72rpx;
+  background-color: rgba(255, 255, 255, 0.6);
+}
+
+.search-button {
+  border-top-left-radius: 0 !important;
+  border-end-start-radius: 0 !important;
+  border: none;
+  width: 103rpx !important;
+  height: 72rpx !important;
+  padding: 0;
+  background-color: rgba(80, 143, 244, 0.6);
+}
+
+.search-button image {
+  width: 32rpx;
+  height: 33rpx;
+  text-align: center;
+  margin-top: 19rpx;
+}
+
+.learder {
+  position: relative;
+  margin-top: -70rpx;
+  background-color: #FFFFFF;
+  border-radius: 6px;
+}
+
+
+.content-top {
+  padding: 30rpx 10rpx 20rpx 20rpx;
+  height: 32rpx;
+}
+
+.content-title {
+  line-height: 32rpx;
+  font-size: 32rpx;
+  font-weight: bold;
+  color: #333333;
+  margin-right: auto;
+}
+
+.content-line {
+  border-left: 10rpx solid #508FF4;
+  height: 32rpx;
+  margin-right: 20rpx;
+}
+
+.content-more {
+  color: #999999;
+  font-size: 24rpx;
+  height: 32rpx;
+}
+
+.learder image {
+  width: 100px;
+  height: 120px;
+}
+
+.policy-interpretation {
+  background-color: #FFFFFF;
+  border-radius: 12rpx;
+  box-shadow: 0px 2px 5px 0px rgba(153,153,153,0.17);
+  margin: 0 20rpx;
+}
+
+
+.scroll-wrapper {
+  white-space: nowrap;
+  -webkit-overflow-scrolling: touch;
+  background: #FFF;
+  height: 90rpx;
+  padding: 0 32rpx;
+  box-sizing: border-box;
+}
+
+.navigate-item {
+  display: inline-block;
+  text-align: center;
+  height: 90rpx;
+  line-height: 90rpx;
+  margin: 0 30rpx;
+}
+
+.names {
+  font-size: 28rpx;
+  color: #333333;
+}
+
+.currtline {
+  margin: -8rpx auto 0 auto;
+  width: 100rpx;
+  height: 8rpx;
+  border-radius: 4rpx;
+}
+
+.currtline.active {
+  background: #508FF4;
+  transition: all .3s;
+}