Procházet zdrojové kódy

规划项目架构

张启 před 4 roky
rodič
revize
35df11662c

+ 22 - 13
App.vue

@@ -1,18 +1,27 @@
 <script>
-	export default {
-		onLaunch: function() {
-			console.log('App Launch')
-		},
-		onShow: function() {
-			console.log('App Show')
-		},
-		onHide: function() {
-			console.log('App Hide')
-		}
-	}
+  export default {
+    created() {
+      if (sessionStorage.getItem('agr_cloud_store')) {
+        this.$store.replaceState(Object.assign({}, this.$store.state, JSON.parse(sessionStorage.getItem('agr_cloud_store'))));
+      }
+      window.addEventListener('beforeunload', () => {
+        sessionStorage.setItem('agr_cloud_store', JSON.stringify(this.$store.state));
+      });
+    },
+    onLaunch: function() {
+      console.log('App Launch')
+    },
+    onShow: function() {
+      console.log('App Show')
+    },
+    onHide: function() {
+      console.log('App Hide')
+    }
+  }
 </script>
 
 <style lang="scss">
-	@import "uview-ui/index.scss";
-	/*每个页面公共css */
+  @import "uview-ui/index.scss";
+  /*每个页面公共css */
+  @import url("static/agrcloud-css/common.scss");
 </style>

+ 28 - 0
agrcloud-api/complaints.js

@@ -0,0 +1,28 @@
+import request from '@/agrcloud-utils/request';
+
+// 我的投诉
+export function complaintsAddData(data) {
+  return request({
+    url: '/sec/plaint/door',
+    method: 'POST',
+    data: data
+  });
+}
+
+// 历史投诉
+export function complaintsListData(query) {
+  return request({
+    url: '/sec/plaint/door/list',
+    method: 'GET',
+    data: query
+  });
+}
+
+// 投诉详情
+export function complaintsViewData(query) {
+  return request({
+    url: '/sec/plaint/door/info',
+    method: 'GET',
+    data: query
+  });
+}

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 21 - 0
agrcloud-components/uni-load-more/uni-load-more.vue


+ 20 - 0
agrcloud-config/index.config.js

@@ -0,0 +1,20 @@
+const CONFIG = {
+	// 开发环境配置
+	development: {
+		assetsPath: '/static', // 静态资源路径
+		baseUrl: '/dev-api', // 后台接口请求地址
+		hostUrl: '', // H5地址(前端运行地址)
+		websocketUrl: '', // websocket服务端地址
+		weixinAppId: '' // 微信公众号appid
+	},
+	// 生产环境配置
+	production: {
+		assetsPath: '/static', // 静态资源路径
+		baseUrl: '/prod-api', // 后台接口请求地址
+		hostUrl: '', // H5地址(前端运行地址)
+		websocketUrl: '', // websocket服务端地址
+		weixinAppId: '' // 微信公众号appid
+	}
+
+};
+export default CONFIG[process.env.NODE_ENV];

+ 9 - 0
agrcloud-store/getters.js

@@ -0,0 +1,9 @@
+/**
+ * 封装getters
+ * @author Rockery(1113269755@qq.com)
+ */
+
+const getters = {
+  complaintsDetailsObj: state => state.complaintsDetails.itemData
+}
+export default getters

+ 20 - 0
agrcloud-store/index.js

@@ -0,0 +1,20 @@
+/**
+ * 封装Vuex
+ * @author Rockery(1113269755@qq.com)
+ */
+
+import Vue from 'vue';
+import Vuex from 'vuex';
+import complaintsDetails from './modules/complaintsdetails';
+import getters from './getters'
+
+Vue.use(Vuex);
+
+const store = new Vuex.Store({
+  modules: {
+    complaintsDetails
+  },
+  getters
+});
+
+export default store;

+ 40 - 0
agrcloud-store/modules/complaintsdetails.js

@@ -0,0 +1,40 @@
+/**
+ * 封装历史投诉列表项数据缓存
+ * @author Rockery(1113269755@qq.com)
+ */
+
+const complaintsDetails = {
+  state: {
+    itemData: {}
+  },
+
+  mutations: {
+    SET_ITEMDATA: (state, itemData) => {
+      state.itemData = itemData;
+    },
+    CLEAR_ITEMDATA: (state, itemData) => {
+      state.itemData = itemData;
+    }
+  },
+
+  actions: {
+    SetComplaintsDetails({ commit }, itemData) {
+      return new Promise((resolve, reject) => {
+        if (itemData) {
+          commit('SET_ITEMDATA', itemData);
+          resolve();
+        } else {
+          reject('error');
+        }
+      });
+    },
+    ClearComplaintsDetails({ commit }) {
+      return new Promise(resolve => {
+        commit('CLEAR_ITEMDATA', {});
+        resolve()
+      });
+    }
+  }
+}
+
+export default complaintsDetails

+ 15 - 0
agrcloud-utils/bus.js

@@ -0,0 +1,15 @@
+import Vue from 'vue'
+export const bus = new Vue({
+  data () {
+    return {
+      // 定义数据
+      data: {}
+    }
+  },
+  created () {
+    // 绑定监听
+    this.$on('toDetailPage', (value)=>{
+      this.data = value.data
+    })
+  }
+})

+ 28 - 0
agrcloud-utils/https.js

@@ -0,0 +1,28 @@
+/**
+ * 封装请求方式
+ * @author Rockery(1113269755@qq.com)
+ */
+import request from '@/utils/request';
+
+export default {
+	async default(url, param, method) {
+		const res = await request(url, param, method)
+		return res;
+	},
+	async post(url, param) {
+		const res = await request(url, param, 'post')
+		return res;
+	},
+	async get(url, param) {
+		const res = await request(url, param, 'get')
+		return res;
+	},
+	async put(url, param) {
+		const res = await request(url, param, 'put')
+		return res;
+	},
+	async delete(url, param) {
+		const res = await request(url, param, 'delete')
+		return res;
+	}
+}

+ 72 - 0
agrcloud-utils/request.js

@@ -0,0 +1,72 @@
+/**
+ * 封装请求
+ * @author Rockery(1113269755@qq.com)
+ */
+
+import indexConfig from '@/agrcloud-config/index.config';
+
+module.exports = (params) => {
+  debugger
+  let url = indexConfig.baseUrl + params.url;
+  let method = params.method;
+  let header = params.header || {};
+  let data = params.data || {};
+  if (method) {
+    method = method.toUpperCase();
+    if (method == "POST") {
+      header = {
+        // 'Content-Type': 'application/x-www-form-urlencoded',
+        'Access-Control-Allow-Origin': '*',
+        accessToken: uni.getStorageSync("token")
+      };
+    }
+  }
+  //	发起请求 加载动画
+  if (!params.hideLoading) {
+    uni.showLoading({
+      title: "加载中..."
+    });
+  }
+  //	发起网络请求
+  return new Promise((resolve, reject) => {
+    uni.request({
+      url: url,
+      method: method || "GET",
+      header: header,
+      data: data,
+      dataType: "json",
+      sslVerify: false, //是否验证ssl证书
+      success: res => {
+        if (res.statusCode && res.statusCode != 200) {
+          uni.hideLoading();
+          uni.showToast({
+            title: res.errMsg,
+            icon: 'none'
+          });
+          reject({ code: res.statusCode, msg: res.errMsg });
+        } else {
+          const respData = res.data || {};
+          if (respData.code != 200) {
+            uni.hideLoading();
+            uni.showToast({
+              title: respData.msg,
+              icon: 'none'
+            });
+            reject({ code: respData.code, msg: respData.msg });
+          } else {
+            uni.hideLoading();
+            resolve(res.data);
+          }
+        }
+      },
+      fail: err => {
+        uni.hideLoading();
+        uni.showToast({
+          title: err.errMsg,
+          icon: 'none'
+        });
+        reject(err.data);
+      }
+    });
+  });
+}

+ 1 - 1
template.h5.html → agrcloud.template.h5.html

@@ -4,7 +4,7 @@
   <head>
     <meta charset="utf-8">
     <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <link rel="shortcut icon" type="image/x-icon" href="static/favicon.ico">
+    <link rel="shortcut icon" type="image/x-icon" href="static/agrcloud-ico/favicon.ico">
     <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
     <title>修文农业云公共服务系统</title>
     <script>

+ 2 - 2
main.js

@@ -1,6 +1,6 @@
 import Vue from 'vue';
 import App from './App';
-import store from './store';
+import store from './agrcloud-store';
 
 Vue.config.productionTip = false;
 
@@ -10,7 +10,7 @@ App.mpType = 'app';
 import uView from 'uview-ui';
 Vue.use(uView);
 
-/** 
+/**
  * 定义全局提示框
  * @title 提示的内容
  * @icon 图标,默认none,可选[显示成功图标: success,显示加载图标: loading,不显示图标: none]

+ 1 - 1
manifest.json

@@ -78,7 +78,7 @@
 		"usingComponents": true
 	},
 	"h5": {
-		"template": "template.h5.html",
+		"template": "agrcloud.template.h5.html",
 		"router": {
 			"mode": "history"
 		},

+ 13 - 2
pages.json

@@ -8,6 +8,12 @@
       "style": {
         "navigationBarTitleText": "修文农业云公共服务系统"
       }
+    },
+    {
+      "path": "pages/center/index",
+      "style": {
+        "navigationBarTitleText": "AgrCloud-center"
+      }
     }
   ],
   "globalStyle": {
@@ -23,9 +29,14 @@
     "backgroundColor": "#FFFFF",
     "list": [{
       "pagePath": "pages/index/index",
-      "iconPath": "static/index.png",
-      "selectedIconPath": "static/index-selected.png",
+      "iconPath": "static/agrcloud-images/index.png",
+      "selectedIconPath": "static/agrcloud-images/index-selected.png",
       "text": "首页"
+    }, {
+      "pagePath": "pages/center/index",
+      "iconPath": "static/agrcloud-images/center.png",
+      "selectedIconPath": "static/agrcloud-images/center-selected.png",
+      "text": "我的"
     }]
   }
 }

+ 5 - 12
pages/center/index.vue

@@ -1,14 +1,11 @@
 <template>
 	<view class="content">
-		<image class="logo" src="/static/logo.png"></image>
+		<image class="logo" src="/static/agrcloud-images/logo.png"></image>
 		<view class="text-area">
 			<text class="title">
-				uView - 多平台快速开发的UI框架
+				{{ title }}
 			</text>
 		</view>
-		<view class="link-demo">
-			<u-link :color="$u.color['primary']" :under-line="true" href="http://www.uviewui.com">Link超链接组件演示</u-link>
-		</view>
 	</view>
 </template>
 
@@ -16,7 +13,7 @@
 	export default {
 		data() {
 			return {
-				title: 'Hello'
+				title: 'AgrCloud-center'
 			}
 		},
 		onLoad() {
@@ -36,7 +33,7 @@
 		justify-content: center;
 		padding: 40rpx;
 	}
-	
+
 	.logo {
 		height: 200rpx;
 		width: 200rpx;
@@ -50,13 +47,9 @@
 		display: flex;
 		justify-content: center;
 	}
-	
+
 	.title {
 		font-size: 28rpx;
 		color: $u-content-color;
 	}
-	
-	.link-demo {
-		margin-top: 80rpx;
-	}
 </style>

+ 6 - 9
pages/index/index.vue

@@ -1,16 +1,13 @@
 <template>
 	<view class="content">
-		<image class="logo" src="/static/logo.png"></image>
+		<image class="logo" src="/static/agrcloud-images/logo.png"></image>
 		<view class="text-area">
 			<text class="title">
-				uView - 多平台快速开发的UI框架
+				AgrCloud-index
 			</text>
 		</view>
 		<view class="button-demo">
-			<u-button :ripple="true">按钮组件演示</u-button>
-		</view>
-		<view class="link-demo">
-			<u-link :color="$u.color['primary']" :under-line="true" href="http://www.uviewui.com">跳转uView文档:www.uviewui.com</u-link>
+			<u-button :ripple="true">按钮演示</u-button>
 		</view>
 	</view>
 </template>
@@ -53,16 +50,16 @@
 		display: flex;
 		justify-content: center;
 	}
-	
+
 	.title {
 		font-size: 28rpx;
 		color: $u-content-color;
 	}
-	
+
 	.button-demo {
 		margin-top: 80rpx;
 	}
-	
+
 	.link-demo {
 		margin-top: 80rpx;
 	}

+ 457 - 0
static/agrcloud-css/common.scss

@@ -0,0 +1,457 @@
+/**
+ * 封装公共样式
+ * @author Rockery(1113269755@qq.com)
+ */
+
+/**
+ * 基础样式
+ */
+html,body{
+  background: #F7F8F9;
+}
+.fl{
+  float: left;
+}
+
+.fr{
+  float: right;
+}
+
+.block {
+  display: block;
+}
+
+.pointer {
+  cursor: pointer;
+}
+
+
+/**
+ * padding类样式
+ */
+.cust-pd5 {
+  padding: 5rpx;
+}
+.cust-pd6 {
+  padding: 6rpx;
+}
+.cust-pd7 {
+  padding: 7rpx;
+}
+.cust-pd8 {
+  padding: 8rpx;
+}
+.cust-pd9 {
+  padding: 9rpx;
+}
+.cust-pd10 {
+  padding: 10rpx;
+}
+.cust-pd12 {
+  padding: 12rpx;
+}
+.cust-pd15 {
+  padding: 15rpx;
+}
+.cust-pd20 {
+  padding: 20rpx;
+}
+.cust-pd25 {
+  padding: 25rpx;
+}
+.cust-pd30 {
+  padding: 30rpx;
+}
+.cust-pd35 {
+  padding: 35rpx;
+}
+.cust-pd40 {
+  padding: 40rpx;
+}
+
+.pt5 {
+  padding-top: 5rpx;
+}
+.pt6 {
+  padding-top: 6rpx;
+}
+.pt7 {
+  padding-top: 7rpx;
+}
+.pt8 {
+  padding-top: 8rpx;
+}
+.pt9 {
+  padding-top: 9rpx;
+}
+.pt10 {
+  padding-top: 10rpx;
+}
+.pt12 {
+  padding-top: 12rpx;
+}
+.pt15 {
+  padding-top: 15rpx;
+}
+.pt20 {
+  padding-top: 20rpx;
+}
+.pt25 {
+  padding-top: 25rpx;
+}
+.pt30 {
+  padding-top: 30rpx;
+}
+.pt35 {
+  padding-top: 35rpx;
+}
+.pt40 {
+  padding-top: 40rpx;
+}
+
+.pr5 {
+  padding-right: 5rpx;
+}
+.pr6 {
+  padding-right: 6rpx;
+}
+.pr7 {
+  padding-right: 7rpx;
+}
+.pr8 {
+  padding-right: 8rpx;
+}
+.pr9 {
+  padding-right: 9rpx;
+}
+.pr10 {
+  padding-right: 10rpx;
+}
+.pr15 {
+  padding-right: 15rpx;
+}
+.pr20 {
+  padding-right: 20rpx;
+}
+.pr25 {
+  padding-right: 25rpx;
+}
+.pr30 {
+  padding-right: 30rpx;
+}
+.pr35 {
+  padding-right: 35rpx;
+}
+.pr40 {
+  padding-right: 40rpx;
+}
+
+.pl5 {
+  padding-left: 5rpx;
+}
+.pl6 {
+  padding-left: 6rpx;
+}
+.pl7 {
+  padding-left: 7rpx;
+}
+.pl8 {
+  padding-left: 8rpx;
+}
+.pl9 {
+  padding-left: 9rpx;
+}
+.pl10 {
+  padding-left: 10rpx;
+}
+.pl15 {
+  padding-left: 15rpx;
+}
+.pl20 {
+  padding-left: 20rpx;
+}
+.pl25 {
+  padding-left: 25rpx;
+}
+.pl30 {
+  padding-left: 30rpx;
+}
+.pl35 {
+  padding-left: 35rpx;
+}
+.pl40 {
+  padding-left: 40rpx;
+}
+
+.pb5 {
+  padding-bottom: 5rpx;
+}
+.pb6 {
+  padding-bottom: 6rpx;
+}
+.pb7 {
+  padding-bottom: 7rpx;
+}
+.pb8 {
+  padding-bottom: 8rpx;
+}
+.pb9 {
+  padding-bottom: 9rpx;
+}
+.pb10 {
+  padding-bottom: 10rpx;
+}
+.pb15 {
+  padding-bottom: 15rpx;
+}
+.pb20 {
+  padding-bottom: 20rpx;
+}
+.pb25 {
+  padding-bottom: 25rpx;
+}
+.pb30 {
+  padding-bottom: 30rpx;
+}
+.pb35 {
+  padding-bottom: 35rpx;
+}
+.pb40 {
+  padding-bottom: 40rpx;
+}
+
+
+/**
+ * margin类样式
+ */
+.cust-mg5{
+  margin: 5rpx;
+}
+.cust-mg6{
+  margin: 6rpx;
+}
+.cust-mg7{
+  margin: 7rpx;
+}
+.cust-mg8{
+  margin: 8rpx;
+}
+.cust-mg9{
+  margin: 9rpx;
+}
+.cust-mg10{
+  margin: 10rpx;
+}
+.cust-mg12{
+  margin: 12rpx;
+}
+.cust-mg15{
+  margin: 15rpx;
+}
+.cust-mg20{
+  margin: 20rpx;
+}
+.cust-mg25{
+  margin: 25rpx;
+}
+.cust-mg30{
+  margin: 30rpx;
+}
+.cust-mg35{
+  margin: 35rpx;
+}
+.cust-mg40{
+  margin: 40rpx;
+}
+
+.mt5 {
+  margin-top: 5rpx;
+}
+.mt6 {
+  margin-top: 5rpx;
+}
+.mt7 {
+  margin-top: 7rpx;
+}
+.mt8 {
+  margin-top: 8rpx;
+}
+.mt9 {
+  margin-top: 9rpx;
+}
+.mt10 {
+  margin-top: 10rpx;
+}
+.mt12 {
+  margin-top: 12rpx;
+}
+.mt15 {
+  margin-top: 15rpx;
+}
+.mt20 {
+  margin-top: 20rpx;
+}
+.mt25 {
+  margin-top: 25rpx;
+}
+.mt30 {
+  margin-top: 30rpx;
+}
+.mt35 {
+  margin-top: 35rpx;
+}
+.mt40 {
+  margin-top: 40rpx;
+}
+
+.mr5 {
+  margin-right: 5rpx;
+}
+.mr6 {
+  margin-right: 5rpx;
+}
+.mr7 {
+  margin-right: 7rpx;
+}
+.mr8 {
+  margin-right: 8rpx;
+}
+.mr9 {
+  margin-right: 9rpx;
+}
+.mr10 {
+  margin-right: 10rpx;
+}
+.mr12 {
+  margin-right: 12rpx;
+}
+.mr15 {
+  margin-right: 15rpx;
+}
+.mr20 {
+  margin-right: 20rpx;
+}
+.mr25 {
+  margin-right: 25rpx;
+}
+.mr30 {
+  margin-right: 30rpx;
+}
+.mr35 {
+  margin-right: 35rpx;
+}
+.mr40 {
+  margin-right: 40rpx;
+}
+
+.ml5 {
+  margin-left: 5rpx;
+}
+.ml6 {
+  margin-left: 6rpx;
+}
+.ml7 {
+  margin-left: 7rpx;
+}
+.ml8 {
+  margin-left: 8rpx;
+}
+.ml9 {
+  margin-left: 9rpx;
+}
+.ml10 {
+  margin-left: 10rpx;
+}
+.ml12 {
+  margin-left: 12rpx;
+}
+.ml15 {
+  margin-left: 15rpx;
+}
+.ml20 {
+  margin-left: 20rpx;
+}
+.ml25 {
+  margin-left: 25rpx;
+}
+.ml30 {
+  margin-left: 30rpx;
+}
+.ml35 {
+  margin-left: 35rpx;
+}
+.ml40 {
+  margin-left: 40rpx;
+}
+
+.mb5 {
+  margin-bottom: 5rpx;
+}
+.mb6 {
+  margin-bottom: 6rpx;
+}
+.mb7 {
+  margin-bottom: 7rpx;
+}
+.mb8 {
+  margin-bottom: 8rpx;
+}
+.mb9 {
+  margin-bottom: 9rpx;
+}
+.mb10 {
+  margin-bottom: 10rpx;
+}
+.mb12 {
+  margin-bottom: 12rpx;
+}
+.mb15 {
+  margin-bottom: 15rpx;
+}
+.mb20 {
+  margin-bottom: 20rpx;
+}
+.mb25 {
+  margin-bottom: 25rpx;
+}
+.mb30 {
+  margin-bottom: 30rpx;
+}
+.mb35 {
+  margin-bottom: 35rpx;
+}
+.mb40 {
+  margin-bottom: 40rpx;
+}
+
+
+/**
+ * 超链接类样式
+ */
+.link-type,
+.link-type:focus {
+  color: #337ab7;
+  cursor: pointer;
+
+  &:hover {
+    color: rgb(32, 160, 255);
+  }
+}
+
+/**
+ * 页面类样式
+ */
+.page-content {
+  // background-color: rgb(240, 240, 240);
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  padding: 40rpx;
+}
+.page-header{
+  width: 100%;
+}
+.page-main{
+  width: 100%;
+}

+ 0 - 0
static/favicon.ico → static/agrcloud-ico/favicon.ico


+ 0 - 0
static/center-selected.png → static/agrcloud-images/center-selected.png


+ 0 - 0
static/center.png → static/agrcloud-images/center.png


+ 0 - 0
static/index-selected.png → static/agrcloud-images/index-selected.png


+ 0 - 0
static/index.png → static/agrcloud-images/index.png


+ 0 - 0
static/logo.png → static/agrcloud-images/logo.png


Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů