xhj пре 2 година
комит
54e4984df5

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+/unpackage/

+ 17 - 0
App.vue

@@ -0,0 +1,17 @@
+<script>
+	export default {
+		onLaunch: function() {
+			console.log('App Launch')
+		},
+		onShow: function() {
+			console.log('App Show')
+		},
+		onHide: function() {
+			console.log('App Hide')
+		}
+	}
+</script>
+
+<style>
+	/*每个页面公共css */
+</style>

+ 20 - 0
index.html

@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html lang="en">
+  <head>
+    <meta charset="UTF-8" />
+    <script>
+      var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
+        CSS.supports('top: constant(a)'))
+      document.write(
+        '<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
+        (coverSupport ? ', viewport-fit=cover' : '') + '" />')
+    </script>
+    <title></title>
+    <!--preload-links-->
+    <!--app-context-->
+  </head>
+  <body>
+    <div id="app"><!--app-html--></div>
+    <script type="module" src="/main.js"></script>
+  </body>
+</html>

+ 21 - 0
main.js

@@ -0,0 +1,21 @@
+import App from './App'
+
+// #ifndef VUE3
+import Vue from 'vue'
+Vue.config.productionTip = false
+App.mpType = 'app'
+const app = new Vue({
+    ...App
+})
+app.$mount()
+// #endif
+
+// #ifdef VUE3
+import { createSSRApp } from 'vue'
+export function createApp() {
+  const app = createSSRApp(App)
+  return {
+    app
+  }
+}
+// #endif

+ 77 - 0
manifest.json

@@ -0,0 +1,77 @@
+{
+    "name" : "",
+    "appid" : "__UNI__E5490F4",
+    "description" : "",
+    "versionName" : "1.0.0",
+    "versionCode" : "100",
+    "transformPx" : false,
+    /* 5+App特有相关 */
+    "app-plus" : {
+        "usingComponents" : true,
+        "nvueStyleCompiler" : "uni-app",
+        "compilerVersion" : 3,
+        "splashscreen" : {
+            "alwaysShowBeforeRender" : true,
+            "waiting" : true,
+            "autoclose" : true,
+            "delay" : 0
+        },
+        /* 模块配置 */
+        "modules" : {},
+        /* 应用发布信息 */
+        "distribute" : {
+            /* android打包配置 */
+            "android" : {
+                "permissions" : [
+                    "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
+                    "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
+                    "<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
+                    "<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
+                    "<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
+                    "<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.CAMERA\"/>",
+                    "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
+                    "<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
+                    "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
+                    "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
+                    "<uses-feature android:name=\"android.hardware.camera\"/>",
+                    "<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
+                ]
+            },
+            /* ios打包配置 */
+            "ios" : {},
+            /* SDK配置 */
+            "sdkConfigs" : {}
+        }
+    },
+    /* 快应用特有相关 */
+    "quickapp" : {},
+    /* 小程序特有相关 */
+    "mp-weixin" : {
+        "appid" : "",
+        "setting" : {
+            "urlCheck" : false
+        },
+        "usingComponents" : true
+    },
+    "mp-alipay" : {
+        "usingComponents" : true
+    },
+    "mp-baidu" : {
+        "usingComponents" : true
+    },
+    "mp-toutiao" : {
+        "usingComponents" : true
+    },
+    "uniStatistics" : {
+        "enable" : false
+    },
+    "vueVersion" : "2",
+    "h5" : {
+        "router" : {
+            "mode" : "history"
+        }
+    }
+}

+ 56 - 0
pages.json

@@ -0,0 +1,56 @@
+{
+	"pages": [{
+			"path": "pages/index/index",
+			"style": {
+				"navigationBarTitleText": ""
+			}
+		},
+		{
+			"path": "pages/privacyAgreement/index",
+			"style": {
+				"navigationBarTitleText": "用户隐私政策"
+			}
+		},
+		{
+			"path": "pages/userAgreement/index",
+			"style": {
+				"navigationBarTitleText": "用户服务协议"
+			}
+		}, {
+			"path": "pages/register/index",
+			"style": {
+				"navigationBarTitleText": "邀请下载",
+				"enablePullDownRefresh": false
+			}
+
+		}, 
+		{
+			"path": "pages/downloadApp/index",
+			"style": {
+				"navigationBarTitleText": "APP下载",
+				"enablePullDownRefresh": false
+			}
+
+		}
+	    ,{
+            "path" : "pages/quickappPrivacy/index",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "用户隐私政策",
+                "enablePullDownRefresh": false
+            }
+            
+        }
+    ],
+	"globalStyle": {
+		"navigationBarTextStyle": "black",
+		"navigationBarTitleText": "uni-app",
+		"navigationBarBackgroundColor": "#F8F8F8",
+		"backgroundColor": "#F8F8F8",
+		"navigationStyle": "custom",
+		"app-plus": {
+			"titleNView": false
+		}
+
+	}
+}

+ 68 - 0
pages/downloadApp/index.css

@@ -0,0 +1,68 @@
+.ceng {
+	background: #000000;
+	opacity: 0.5;
+	top: 0;
+	position: fixed;
+	width: 100%;
+	height: 100%;
+	z-index: 2;
+}
+
+.guide-image {
+	position: absolute;
+	z-index: 3;
+	top: 20rpx;
+	right: 60rpx;
+	width: 575rpx;
+	height: 358rpx;
+}
+
+.logo-box {
+	padding-top: 40rpx;
+	margin-top: 400rpx;
+}
+
+.logo-image {
+	width: 150rpx;
+	height: 150rpx;
+	margin: auto;
+}
+
+.logo-text {
+	text-align: center;
+	margin-top: 30rpx;
+}
+
+.logo-image image {
+	width: 100%;
+	height: 100%;
+}
+.download-btn{
+	width: 400rpx;
+	height: 80rpx;
+	background: #00A811;
+	border-radius: 10rpx;
+	text-align: center;
+	line-height: 80rpx;
+	color: #fff;
+	font-weight: bold;
+	margin:100rpx auto;
+}
+.footer-bar {
+	/* margin: 50rpx auto; */
+	position: absolute;
+	bottom: 20rpx;
+	width: 100%;
+	text-align: center;
+}
+.footer-bar text {
+	color: #333;
+	text-decoration: underline;
+}
+.footer-bar view {
+	margin: 10rpx auto;
+}
+.gary-text {
+	color: #999;
+	font-size: 24rpx;
+}

+ 131 - 0
pages/downloadApp/index.vue

@@ -0,0 +1,131 @@
+<template>
+	<!-- <view v-if="config"><view @click="goDownload()">去下载</view></view> -->
+	<view v-if="config" style="overflow: hidden;margin-bottom: 20rpx;min-height: 100vh;">
+		<view v-if="isWeixn">
+			<image class="guide-image" src="../../static/openGuide.png"></image>
+			<view class="ceng"></view>
+		</view>
+
+		<view>
+			<view class="logo-box">
+				<view class="logo-image"><image :src="config.CONFIG_PROJECT_LOGO"></image></view>
+				<view class="logo-text">{{ config.CONFIG_PROJECT_TITLE }}</view>
+			</view>
+			<view class="download-btn" @click="goDownload()">下载</view>
+		</view>
+
+		<view class="gary-text footer-bar">
+			<view>
+				<text style="margin-right: 10rpx;" @click="jump('/pages/userAgreement/index?appId=' + appId)">服务协议</text>
+				和
+				<text style="margin-left: 10rpx;" @click="jump('/pages/privacyAgreement/index?appId=' + appId)">隐私政策</text>
+			</view>
+			<view>{{ config.CONFIG_RECORD_NUMBER }}</view>
+		</view>
+	</view>
+</template>
+
+<script>
+const req = require('../../utils/request.js');
+const util = require('../../utils/util.js');
+export default {
+	data() {
+		return {
+			isWeixn: false, //判断是否在微信环境 true不在,false在
+			appId: '', //
+			config: ''
+		};
+	},
+
+	onLoad(opt) {
+		this.appId = opt.appId;
+		this.isWeixn = this.is_weixn();
+		this.getConfig();
+	},
+
+	methods: {
+		jump(url) {
+			uni.navigateTo({
+				url: url
+			});
+		},
+		getConfig() {
+			req.getRequest(
+				'/api/config',
+				this.appId,
+				{},
+				data => {
+					this.config = data;
+				},
+				true
+			);
+		},
+
+		// 去下载
+		goDownload() {
+			if (this.isWeixn) {
+				//在微信环境
+				this.showModal('请点击右上角“...”按钮, 选择在浏览器打开');
+			} else {
+				var u = navigator.userAgent;
+				var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1;
+				var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
+				// 这里是iOS浏览器
+				if (isIOS) {
+					if (this.config.download_app_ios_url) {
+						window.location.href = this.config.download_app_ios_url; // 跳AppStore下载地址
+					} else {
+						this.showModal('后台暂未开放IOS App版本下载');
+					}
+				} else {
+					if (this.config.download_app_android_url) {
+						window.location.href = this.config.download_app_android_url; // 跳AppStore下载地址
+					} else {
+						this.showModal('后台暂未开放Android App版本下载');
+					}
+				}
+			}
+		},
+
+		// 是微信浏览器
+		is_weixn() {
+			var ua = navigator.userAgent.toLowerCase();
+			if (ua.match(/MicroMessenger/i) == 'micromessenger') {
+				return true;
+			} else {
+				return false;
+			}
+		},
+
+		/**
+		 * 是否为Pc版本
+		 */
+		isPC() {
+			var userAgentInfo = navigator.userAgent;
+			var Agents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod'];
+			var flag = true;
+			for (var v = 0; v < Agents.length; v++) {
+				if (userAgentInfo.indexOf(Agents[v]) > 0) {
+					flag = false;
+					break;
+				}
+			}
+			return flag;
+		},
+
+		showModal(msg) {
+			uni.showModal({
+				title: '提示',
+				content: msg,
+				confirmText: '关闭',
+				showCancel: false,
+				success(res) {}
+			});
+		}
+	}
+};
+</script>
+
+<style>
+@import './index.css';
+</style>

+ 22 - 0
pages/index/index.vue

@@ -0,0 +1,22 @@
+<template>
+	<view>
+		
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				
+			}
+		},
+		methods: {
+			
+		}
+	}
+</script>
+
+<style>
+
+</style>

+ 2 - 0
pages/privacyAgreement/index.css

@@ -0,0 +1,2 @@
+/* index.css */
+.content{padding: 40rpx 30rpx;}

+ 39 - 0
pages/privacyAgreement/index.vue

@@ -0,0 +1,39 @@
+<template>
+	<view>
+		<view class="content"><rich-text :nodes="content"></rich-text></view>
+	</view>
+</template>
+
+<script>
+const req = require('../../utils/request.js');
+
+export default {
+	data() {
+		return {
+			appId: '',
+			content: ''
+		};
+	},
+	onLoad(opt) {
+		this.appId = opt.appId;
+		this.getConfig();
+	},
+	methods: {
+		getConfig() {
+			req.getRequest(
+				'/api/params/value',
+				this.appId,
+				{ type: 'PRIVACY_AGREEMENT' },
+				data => {
+					this.content = data;
+				},
+				true
+			);
+		}
+	}
+};
+</script>
+
+<style>
+@import './index.css';
+</style>

+ 2 - 0
pages/quickappPrivacy/index.css

@@ -0,0 +1,2 @@
+/* index.css */
+.content{padding: 40rpx 30rpx;}

+ 39 - 0
pages/quickappPrivacy/index.vue

@@ -0,0 +1,39 @@
+<template>
+	<view>
+		<view class="content"><rich-text :nodes="content"></rich-text></view>
+	</view>
+</template>
+
+<script>
+const req = require('../../utils/request.js');
+
+export default {
+	data() {
+		return {
+			appId: '',
+			content: ''
+		};
+	},
+	onLoad(opt) {
+		this.appId = opt.appId;
+		this.getConfig();
+	},
+	methods: {
+		getConfig() {
+			req.getRequest(
+				'/api/params/value',
+				this.appId,
+				{ type: 'quickapp_privacy' },
+				data => {
+					this.content = data;
+				},
+				true
+			);
+		}
+	}
+};
+</script>
+
+<style>
+@import './index.css';
+</style>

+ 391 - 0
pages/register/index.vue

@@ -0,0 +1,391 @@
+<template>
+	<view v-if="config" style="overflow: hidden;margin-bottom: 20rpx;min-height: 100vh;position: relative;">
+		<!-- 背景图 -->
+		<image class="wdbg" src="../../static/bg.png" mode="widthFix"></image>
+		<!-- 表单 -->
+		<view class="form-bar">
+			<view class="logo-box">
+				<view class="logo-image"><image :src="config.CONFIG_PROJECT_LOGO"></image></view>
+				<view class="logo-text">{{ config.CONFIG_PROJECT_TITLE }}</view>
+			</view>
+
+			<view v-if="mobileRegister" class="form-box">
+				<view class="form-item">
+					<view class="or-text or-text-b">
+						<view>
+							<text>您已使用</text>
+							{{ mobileRegister }}
+							<text>完成注册</text>
+						</view>
+					</view>
+				</view>
+				<!-- 按钮 -->
+				<view class="submit-btn" @click="downloadApp()">下载APP</view>
+			</view>
+			<view v-else class="form-box">
+				<view class="form-item">
+					<text class="number86">+86</text>
+					<input placeholder="请输入手机号" v-model="mobile" type="number" maxlength="11" placeholder-class="placeholder" class="ipt" />
+				</view>
+				<view class="form-item">
+					<input v-model="code" type="number" maxlength="6" placeholder="请输验证码" placeholder-class="placeholder" class="ipt" />
+					<view class="code-btn gary-text" @click="getCode()" v-text="sendMsg"></view>
+				</view>
+				<view class="form-item noborder" v-if="userInfo">
+					<image class="form-icon" src="../../static/member.png"></image>
+					<text class="gary-text">
+						邀请人
+						<span style="color: #333;margin-left: 10rpx;">{{ userInfo.nickName }}</span>
+					</text>
+				</view>
+				<!-- 按钮 -->
+				<view class="submit-btn" @click="submitRegister()">注册并下载APP</view>
+			</view>
+		</view>
+		<view class="gary-text footer-bar">
+			<view>
+				<text style="margin-right: 10rpx;" @click="jump('/pages/userAgreement/index?appId=' + appId)">服务协议</text>
+				和
+				<text style="margin-left: 10rpx;" @click="jump('/pages/privacyAgreement/index?appId=' + appId)">隐私政策</text>
+			</view>
+			<view>{{ config.CONFIG_RECORD_NUMBER }}</view>
+		</view>
+	</view>
+</template>
+
+<script>
+const req = require('../../utils/request.js');
+const util = require('../../utils/util.js');
+export default {
+	data() {
+		return {
+			appId: '',
+			userId: '', //推荐人用户Id;
+			config: '',
+			mobile: '', //手机号
+			code: '', //code
+			sendMsg: '获取验证码',
+			isGetCodeDisabled: false,
+
+			mobileRegister: '', //用户注册缓存的手机号
+
+			userInfo: '', //被邀请人对象
+			pickleChannel: '', //投放渠道
+			packageChannel: '' //包的渠道
+		};
+	},
+
+	onLoad(opt) {
+		this.mobileRegister = req.getStorage('mobileRegister');
+		this.appId = opt.appId;
+		// this.appId = 'ZQWYx7XoOOhv4Ns';
+		this.userId = opt.userId;
+		this.pickleChannel = opt.pickleChannel;
+		this.packageChannel = opt.packageChannel;
+		req.setStorage('pickleChannel', this.pickleChannel);
+		req.setStorage('packageChannel', this.packageChannel);
+
+		this.getConfig();
+		if (this.userId) {
+			this.getUeserInfo();
+		}
+	},
+
+	methods: {
+		getConfig() {
+			req.getRequest(
+				'/api/config',
+				this.appId,
+				{},
+				data => {
+					req.setStorage('config', data);
+					this.config = data;
+				},
+				true
+			);
+		},
+
+		jump(url) {
+			uni.navigateTo({
+				url: url
+			});
+		},
+
+		getUeserInfo() {
+			req.getRequest(
+				'/api/user/getInfo',
+				this.appId,
+				{ userId: this.userId },
+				data => {
+					this.userInfo = data;
+				},
+				true
+			);
+		},
+
+		getCode() {
+			if (this.isGetCodeDisabled == true) return false;
+			if (!this.mobile) {
+				req.msg('请输入手机号');
+				return;
+			}
+			if (!util.isMobile(this.mobile)) {
+				req.msg('请输入11位有效手机号');
+				return;
+			}
+			req.postRequest(
+				'/api/sms/login',
+				this.appId,
+				{
+					mobile: this.mobile
+				},
+				data => {
+					req.msg('验证码获取成功');
+					let time = 60;
+					let interval = setInterval(() => {
+						time--;
+						if (time == 0) {
+							this.isGetCodeDisabled = false;
+							this.sendMsg = '获取验证码';
+							clearInterval(interval);
+						} else {
+							this.isGetCodeDisabled = true;
+							this.sendMsg = time + '秒后再获取';
+						}
+					}, 1000);
+				},
+				true
+			);
+		},
+		submitRegister() {
+			if (!this.mobile) {
+				req.msg('请输入手机号');
+				return;
+			}
+			if (!this.code) {
+				req.msg('请输入验证码');
+				return;
+			}
+			var dataP = {
+				mobile: this.mobile,
+				code: this.code,
+				parentId: this.userId
+			};
+			req.postRequest(
+				'/api/mobileLogin',
+				this.appId,
+				dataP,
+				data => {
+					if (data.isNewRegister) {
+						req.setStorage('mobileRegister', util.phoneHintText(this.mobile));
+						this.downloadApp();
+					} else {
+						req.msg('当前手机号已经注册过了');
+					}
+				},
+				true
+			);
+		},
+
+		/**
+		 * 下载app
+		 */
+		downloadApp() {
+			this.jump('/pages/downloadApp/index?appId=' + this.appId);
+		},
+
+		// // 去下载
+		// downloadApp() {
+		// 	var u = navigator.userAgent;
+		// 	var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1;
+		// 	var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
+		// 	// 这里是iOS浏览器
+		// 	if (isIOS) {
+		// 		if (this.config.download_app_ios_url) {
+		// 			window.location.href = this.config.download_app_ios_url; // 跳AppStore下载地址
+		// 		} else {
+		// 			this.showModal('后台暂未开放IOS App版本下载');
+		// 		}
+		// 	} else {
+		// 		// 是微信内部webView
+		// 		// if (is_weixn()) {
+		// 		// 	this.showModal('请点击右上角“...”按钮, 选择在浏览器打开');
+		// 		// } else {
+		// 		if (this.config.download_app_android_url) {
+		// 			window.location.href = this.config.download_app_android_url; // 跳AppStore下载地址
+		// 		} else {
+		// 			this.showModal('后台暂未开放Android App版本下载');
+		// 		}
+		// 		// }
+		// 	}
+		// },
+
+		// // 是微信浏览器
+		// is_weixn() {
+		// 	var ua = navigator.userAgent.toLowerCase();
+		// 	if (ua.match(/MicroMessenger/i) == 'micromessenger') {
+		// 		return true;
+		// 	} else {
+		// 		return false;
+		// 	}
+		// },
+
+		// IsPC() {
+		// 	var userAgentInfo = navigator.userAgent;
+		// 	var Agents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod'];
+		// 	var flag = true;
+		// 	for (var v = 0; v < Agents.length; v++) {
+		// 		if (userAgentInfo.indexOf(Agents[v]) > 0) {
+		// 			flag = false;
+		// 			break;
+		// 		}
+		// 	}
+		// 	return flag;
+		// },
+
+		showModal(msg) {
+			uni.showModal({
+				title: '提示',
+				content: msg,
+				confirmText: '关闭',
+				showCancel: false,
+				success(res) {}
+			});
+		}
+	}
+};
+</script>
+
+<style>
+page {
+	background: transparent;
+}
+.wdbg {
+	display: block;
+	width: 100%;
+	height: auto;
+	position: absolute;
+	top: 0;
+	left: 0;
+	z-index: -1;
+}
+.logo-box {
+	padding-top: 40rpx;
+}
+.logo-image {
+	width: 100rpx;
+	height: 100rpx;
+	margin: auto;
+}
+.logo-text {
+	text-align: center;
+	margin-top: 10rpx;
+}
+.logo-image image {
+	width: 100%;
+	height: 100%;
+}
+.form-bar {
+	background-color: #fff;
+	border-radius: 50rpx;
+	margin: 600rpx 50rpx 50rpx 50rpx;
+	z-index: 2;
+}
+.form-bar::before {
+	content: '';
+	display: block;
+	clear: both;
+}
+.form-ba::after {
+	content: '';
+	display: block;
+	clear: both;
+}
+.form-box {
+	padding: 30rpx 40rpx 100rpx 40rpx;
+}
+.form-box .form-item {
+	display: flex;
+	padding: 20rpx 10rpx;
+	border-bottom: 1rpx solid #ebebeb;
+	align-items: center;
+}
+.form-box .form-item:last-of-type {
+	border-bottom: none;
+}
+.form-box .form-item input {
+	flex: 1;
+}
+.form-box .form-item .form-icon {
+	width: 30rpx;
+	height: 30rpx;
+	margin-right: 10rpx;
+}
+.placeholder {
+	color: #999;
+}
+.ipt {
+	font-size: 30rpx;
+	color: #333;
+	height: 70rpx;
+	line-height: 70rpx;
+}
+
+.number86 {
+	font-size: 30rpx;
+	padding-right: 20rpx;
+	margin-right: 20rpx;
+	border-right: 1rpx solid #ebebeb;
+}
+.code-btn {
+	padding: 10rpx 20rpx;
+	border-radius: 10rpx;
+	border: 2rpx solid #999;
+}
+
+.or-text {
+	color: #ff7116;
+	font-size: 30rpx;
+	padding-left: 10rpx;
+	padding-right: 10rpx;
+}
+.or-text-b {
+	margin: 20rpx auto;
+	text-align: center;
+}
+
+.or-text-b text {
+	color: #333;
+}
+
+.gary-text {
+	color: #999;
+	font-size: 24rpx;
+}
+.noborder {
+	border: none !important;
+}
+.submit-btn {
+	background-color: #ff7116;
+	color: #fff;
+	border-radius: 50rpx;
+	padding: 20rpx 50rpx;
+	text-align: center;
+	font-weight: bold;
+	margin-top: 50rpx;
+}
+.footer-bar {
+	/* margin: 50rpx auto; */
+	position: absolute;
+	bottom: 20rpx;
+	width: 100%;
+	text-align: center;
+}
+.footer-bar text {
+	color: #333;
+	text-decoration: underline;
+}
+.footer-bar view {
+	margin: 10rpx auto;
+}
+</style>

+ 2 - 0
pages/userAgreement/index.css

@@ -0,0 +1,2 @@
+/* index.css */
+.content{padding: 40rpx 30rpx;}

+ 39 - 0
pages/userAgreement/index.vue

@@ -0,0 +1,39 @@
+<template>
+	<view>
+		<view class="content"><rich-text :nodes="content"></rich-text></view>
+	</view>
+</template>
+
+<script>
+const req = require('../../utils/request.js');
+
+export default {
+	data() {
+		return {
+			appId: '',
+			content: ''
+		};
+	},
+	onLoad(opt) {
+		this.appId = opt.appId;
+		this.getConfig();
+	},
+	methods: {
+		getConfig() {
+			req.getRequest(
+				'/api/protocol',
+				this.appId,
+				{},
+				data => {
+					this.content = data;
+				},
+				true
+			);
+		}
+	}
+};
+</script>
+
+<style>
+@import './index.css';
+</style>


BIN
static/logo-ningmeng.png



BIN
static/member.png


BIN
static/openGuide.png


+ 76 - 0
uni.scss

@@ -0,0 +1,76 @@
+/**
+ * 这里是uni-app内置的常用样式变量
+ *
+ * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
+ * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
+ *
+ */
+
+/**
+ * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
+ *
+ * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
+ */
+
+/* 颜色变量 */
+
+/* 行为相关颜色 */
+$uni-color-primary: #007aff;
+$uni-color-success: #4cd964;
+$uni-color-warning: #f0ad4e;
+$uni-color-error: #dd524d;
+
+/* 文字基本颜色 */
+$uni-text-color:#333;//基本色
+$uni-text-color-inverse:#fff;//反色
+$uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息
+$uni-text-color-placeholder: #808080;
+$uni-text-color-disable:#c0c0c0;
+
+/* 背景颜色 */
+$uni-bg-color:#ffffff;
+$uni-bg-color-grey:#f8f8f8;
+$uni-bg-color-hover:#f1f1f1;//点击状态颜色
+$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色
+
+/* 边框颜色 */
+$uni-border-color:#c8c7cc;
+
+/* 尺寸变量 */
+
+/* 文字尺寸 */
+$uni-font-size-sm:12px;
+$uni-font-size-base:14px;
+$uni-font-size-lg:16;
+
+/* 图片尺寸 */
+$uni-img-size-sm:20px;
+$uni-img-size-base:26px;
+$uni-img-size-lg:40px;
+
+/* Border Radius */
+$uni-border-radius-sm: 2px;
+$uni-border-radius-base: 3px;
+$uni-border-radius-lg: 6px;
+$uni-border-radius-circle: 50%;
+
+/* 水平间距 */
+$uni-spacing-row-sm: 5px;
+$uni-spacing-row-base: 10px;
+$uni-spacing-row-lg: 15px;
+
+/* 垂直间距 */
+$uni-spacing-col-sm: 4px;
+$uni-spacing-col-base: 8px;
+$uni-spacing-col-lg: 12px;
+
+/* 透明度 */
+$uni-opacity-disabled: 0.3; // 组件禁用态的透明度
+
+/* 文章场景相关 */
+$uni-color-title: #2C405A; // 文章标题颜色
+$uni-font-size-title:20px;
+$uni-color-subtitle: #555555; // 二级标题颜色
+$uni-font-size-subtitle:26px;
+$uni-color-paragraph: #3F536E; // 文章段落颜色
+$uni-font-size-paragraph:15px;

+ 242 - 0
utils/request.js

@@ -0,0 +1,242 @@
+const app = getApp();
+// download.zhiqiyun.com  域名
+const env = {
+	NODE_ENV: 'prd',
+	dev: {
+		apiUrl: 'https://apitest.tongyu99.com',
+	},
+	prd: {
+		apiUrl: 'https://apimall.zhiqiyun.com',
+	},
+	pota: {
+		apiUrl: 'http://192.168.110.59:8098' //
+	}
+}
+
+var header = {
+	'content-type': 'application/x-www-form-urlencoded',
+	/*--商户的appi通过参数传入--*/
+	'appId': '',
+	// 'appId': 'ZQesLvuSYEejOJB', //测试
+	// 'appId': 'ZQWYx7XoOOhv4Ns', //正式
+
+	/*----*/
+}
+
+/**小程序配置 */
+const publics = {
+
+}
+/*
+ * 获取token
+ */
+const getToken = (success) => {
+	let token = getStorage('AUTH_TOKEN');
+	if (token) {
+		success.call(this, token);
+		return false;
+	} else {
+		loadToken(data => {
+			success.call(this, data);
+		});
+	}
+
+}
+const loadToken = (success) => {
+	let that = this
+	uni.request({
+		url: env[env.NODE_ENV].apiUrl + '/api/access_token',
+		data: {},
+		method: 'get',
+		header: header,
+		success(json) {
+			if (json.statusCode !== 200) return msg(json.data.message);
+			if (json.data.code !== 0) return msg(json.data.msg)
+			setStorage('AUTH_TOKEN', json.data.data);
+			success.call(that, json.data.data);
+		},
+		fail() {
+			msg('access_token 获取失败');
+		}
+	})
+}
+
+const clearValueEmpty = (data) => {
+	let keyValue = {};
+	for (let key in data) {
+		let value = typeof data[key];
+		if (value == 'string' && value) {
+			if (data[key] != 'undefined' && data[key] != " " && data[key] != undefined && data[key] != null) {
+				keyValue[key] = data[key];
+			}
+		} else if (value == 'number' && value != null) {
+			keyValue[key] = data[key];
+		} else if (value == 'boolean') {
+			keyValue[key] = data[key];
+		} else {
+			if (data[key]) keyValue[key] = data[key];
+		}
+	}
+	return keyValue;
+}
+
+/**
+ * 公共请求
+ * 
+ * @param {*} url  请求url
+ * @param {*} data 请求参数
+ * @param {*} method 请求方法
+ * @param {*} success 成功函数
+ * @param {*} isLoad 是否显示加载提示
+ */
+const baseRequest = (url, appId, data, method, success, isLoad) => {
+	header['appId'] = appId;
+	getToken(token => {
+		if (isLoad) {
+			load('加载中')
+		}
+		header.authorityToken = token;
+		if (url.indexOf('/v3') != -1 || url.indexOf('/paper/create') != -1) {
+			header['content-type'] = 'application/json;charset=UTF-8'
+		} else {
+			header['content-type'] = 'application/x-www-form-urlencoded'
+		}
+		try {
+			var device_info = {};
+			//第三放巨量投放渠道标记
+			var pickleChannel = getStorage('pickleChannel');
+			device_info.pickleChannel = pickleChannel;
+			var packageChannel = getStorage('packageChannel');
+			device_info.packageChannel = packageChannel;
+			var deviceinfoString = JSON.stringify(device_info);
+			deviceinfoString = deviceinfoString.replace(/{/g, '').replace(/}/g, '').replace(/:/g, '=')
+				.replace(
+					/,/g,
+					';').replace(/"/g,
+					'');
+			header['device-info'] = deviceinfoString;
+		} catch (e) {}
+		uni.request({
+			url: env[env.NODE_ENV].apiUrl + url,
+			data: clearValueEmpty(data),
+			method: method,
+			header: header,
+			success(json) {
+				if (isLoad) {
+					uni.hideLoading();
+				}
+				if (json.statusCode !== 200) return msg(json.data.message);
+				if (json.data.code !== 0) {
+					return msg(json.data.msg)
+				}
+				let data = json.data.data;
+				if (typeof data === 'string' && data.indexOf("{") === 0) {
+					data = JSON.parse(data);
+				}
+				success.call(this, data);
+			},
+			fail() {
+				if (isLoad) {
+					uni.hideLoading();
+				}
+			},
+		})
+	})
+}
+
+const loadIng = (msg) => {
+	uni.showLoading({
+		title: msg,
+		mask: true
+	})
+}
+
+/**POST请求 */
+const postRequest = (url, appId, data, success, isLoad) => {
+	header['content-type'] = 'application/x-www-form-urlencoded'
+	baseRequest(url, appId, data, 'post', success, isLoad);
+}
+
+const postRequestLoding = (url, appId, data, success, isLoding) => {
+	header['content-type'] = 'application/x-www-form-urlencoded'
+	baseRequest(url, appId, data, 'post', success, false, isLoding);
+}
+
+/**GET请求 */
+const getRequest = (url, appId, data, success, isLoad) => {
+	header['content-type'] = 'application/x-www-form-urlencoded'
+	baseRequest(url, appId, data, 'get', success, isLoad);
+}
+/**Put请求 */
+const putRequest = (url, appId, data, success, isLoad) => {
+	header['content-type'] = 'application/x-www-form-urlencoded'
+	baseRequest(url, appId, data, 'put', success, isLoad)
+}
+const putRequestJson = (url, appId, data, success, isLoad) => {
+	header['content-type'] = 'application/json;charset=UTF-8'
+	baseRequest(url, appId, data, 'put', success, isLoad)
+}
+
+
+/**弹窗 */
+const msg = (title, success) => {
+	if (title) {
+		uni.showToast({
+			title: title,
+			icon: 'none',
+			success() {
+				if (success) success.call(this);
+			}
+		});
+	}
+	return false;
+}
+
+
+const load = msg => {
+	uni.showLoading({
+		title: msg,
+		mask: true
+	})
+}
+
+// 去掉字符串中的特殊字符和转义字符
+const excludeSpecial = (s) => {
+	// 去掉转义字符
+	//  s = s.replace(/[\'\"\\\/\b\f\n\r\t]/g, '');
+	const pattern = /[`~!@#$^&*()=|{}':;',\\\[\]\.<>\/?~!@#¥……&*()——|{}【】';:""' + - - _ % 。,、?\s]/g;
+	if (s != undefined || s != null) {
+		s = s.replace(pattern, "")
+	}
+	return s;
+}
+
+const setStorage = (key, value) => {
+	uni.setStorageSync(env.NODE_ENV + "_" + key, value)
+}
+
+const getStorage = (key) => {
+	return uni.getStorageSync(env.NODE_ENV + "_" + key)
+}
+
+const removeStorage = (key) => {
+	return uni.removeStorageSync(env.NODE_ENV + "_" + key);
+}
+
+module.exports = {
+	setStorage: setStorage,
+	getStorage: getStorage,
+	postRequest: postRequest,
+	postRequestLoding: postRequestLoding,
+	getRequest: getRequest,
+	putRequest: putRequest,
+	putRequestJson: putRequestJson,
+	msg: msg,
+	load: load,
+	getToken: getToken,
+	loadIng: loadIng,
+	removeStorage: removeStorage,
+	public: publics,
+	header: header,
+	excludeSpecial: excludeSpecial,
+}

+ 290 - 0
utils/util.js

@@ -0,0 +1,290 @@
+const formatTime = date => {
+	const year = date.getFullYear();
+	const month = date.getMonth() + 1;
+	const day = date.getDate();
+	const hour = date.getHours();
+	const minute = date.getMinutes();
+	const second = date.getSeconds();
+	var t1 = [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(
+		':');
+	var t2 = [year, month, day].map(formatNumber).join('-');
+	var time = {
+		t1: t1,
+		t2: t2
+	};
+	return time;
+};
+
+/**
+ * 获取上一个月
+ *
+ * @date 格式为yyyy-mm-dd的日期,如:2014-01-25
+ */
+const getPreMonth = date => {
+	var arr = date.split('-');
+	var year = arr[0]; //获取当前日期的年份
+
+	var month = arr[1]; //获取当前日期的月份
+
+	var day = arr[2]; //获取当前日期的日
+
+	var days = new Date(year, month, 0);
+	days = days.getDate(); //获取当前日期中月的天数
+
+	var year2 = year;
+	var month2 = parseInt(month) - 1;
+
+	if (month2 == 0) {
+		//如果是1月份,则取上一年的12月份
+		year2 = parseInt(year2) - 1;
+		month2 = 12;
+	}
+
+	var day2 = day;
+	var days2 = new Date(year2, month2, 0);
+	days2 = days2.getDate();
+
+	if (day2 > days2) {
+		//如果原来日期大于上一月的日期,则取当月的最大日期。比如3月的30日,在2月中没有30
+		day2 = days2;
+	}
+
+	if (month2 < 10) {
+		month2 = '0' + month2; //月份填补成2位。
+	}
+
+	var t1 = year + '-' + month;
+	var t2 = year2 + '-' + month2;
+	var time = {
+		t1: t1,
+		t2: t2
+	};
+	return time;
+};
+
+const formatNumber = n => {
+	n = n.toString();
+	return n[1] ? n : '0' + n;
+};
+
+const formatTimes = t => {
+	let second = t % 60;
+	let minute = parseInt(t / 60 % 60);
+	let hour = parseInt(t / 60 / 60);
+	return formatNumber(hour) + ':' + formatNumber(minute) + ":" + formatNumber(second);
+};
+
+const formatDayTimes = t => {
+	let second = t % 60;
+	let minute = parseInt(t / 60 % 60);
+	let hour = parseInt(t / 60 / 60 % 24);
+	let day = parseInt(t / 60 / 60 / 24);
+	return formatNumber(day) + '天' + formatNumber(hour) + ':' + formatNumber(minute) + ":" + formatNumber(second);
+};
+/**
+ * 判断此对象是否是Object类型
+ * @param {Object} obj  
+ */
+
+
+function isObject(obj) {
+	return Object.prototype.toString.call(obj) === '[object Object]';
+}
+
+;
+/**
+ * 判断此类型是否是Array类型
+ * @param {Array} arr 
+ */
+
+function isArray(arr) {
+	return Object.prototype.toString.call(arr) === '[object Array]';
+}
+
+;
+/**
+ *  深度比较两个对象是否相同
+ * @param {Object} oldData 
+ * @param {Object} newData 
+ */
+
+function equalsObj(oldData, newData) {
+	// 类型为基本类型时,如果相同,则返回true
+	if (oldData === newData) return true;
+
+	if (isObject(oldData) && isObject(newData) && Object.keys(oldData).length === Object.keys(newData).length) {
+		// 类型为对象并且元素个数相同
+		// 遍历所有对象中所有属性,判断元素是否相同
+		for (const key in oldData) {
+			if (oldData.hasOwnProperty(key)) {
+				if (!equalsObj(oldData[key], newData[key])) // 对象中具有不相同属性 返回false
+					return false;
+			}
+		}
+	} else if (isArray(oldData) && isArray(oldData) && oldData.length === newData.length) {
+		// 类型为数组并且数组长度相同
+		for (let i = 0, length = oldData.length; i < length; i++) {
+			if (!equalsObj(oldData[i], newData[i])) // 如果数组元素中具有不相同元素,返回false
+				return false;
+		}
+	} else {
+		// 其它类型,均返回false
+		return false;
+	} // 走到这里,说明数组或者对象中所有元素都相同,返回true
+
+
+	return true;
+}
+
+; //时间戳转化
+
+function transTime(date) {
+	var date = new Date(parseInt(date) * 1000);
+	var year = date.getFullYear();
+	var month = date.getMonth() + 1;
+	var day = date.getDate();
+	var hour = date.getHours();
+	var minute = date.getMinutes();
+	var second = date.getSeconds();
+	return [year, month, day].map(formatNumber).join('-') + ' ' + [hour, minute, second].map(formatNumber).join(':');
+}
+
+; // 节流
+
+function throttle(fn, gapTime) {
+	if (gapTime == null || gapTime == undefined) {
+		gapTime = 1500;
+	}
+
+	let _lastTime = null; // 返回新的函数
+
+	return function() {
+		let _nowTime = +new Date();
+
+		if (_nowTime - _lastTime > gapTime || !_lastTime) {
+			fn.apply(this, arguments); //将this和参数传给原函数
+
+			_lastTime = _nowTime;
+		}
+	};
+};
+
+const isMobile = (value) => {
+	var reg = /^1[3|4|5|6|7|8|9][0-9]{9}$/; //验证规则
+
+	var flag = reg.test(value);
+
+	if (!flag) {
+		return false
+	} else {
+		return true
+	}
+}
+
+const convertUrlObj = (data) => {
+	var _result = [];
+	for (var key in data) {
+		var value = data[key];
+		if (value.constructor == Array) {
+			value.forEach(function(_value) {
+				_result.push(key + "=" + _value);
+			});
+		} else {
+			_result.push(key + '=' + value);
+		}
+	}
+	return _result.join('&');
+}
+
+// 隐藏身份证中间位数
+function styleHintText(tel) {
+	if (tel) {
+		var reg = /^(\d{6})\d{8}(\d{4})$/;
+		tel = tel.replace(reg, "$1********$2");
+	}
+	return tel;
+}
+
+
+// 隐藏手机号中间四位
+function phoneHintText(tel) {
+	if (tel) {
+		var reg = /^(\d{3})\d{4}(\d{4})$/;
+		tel = tel.replace(reg, "$1****$2");
+	}
+	return tel;
+}
+
+function getDateDiff(dateTimeStamp) {
+	var minute = 1000 * 60;
+	var hour = minute * 60;
+	var day = hour * 24;
+	var halfamonth = day * 15;
+	var month = day * 30;
+	var now = new Date().getTime();
+	var diffValue = now - dateTimeStamp;
+	if (diffValue < 0) {
+		return;
+	}
+	var monthC = diffValue / month;
+	var weekC = diffValue / (7 * day);
+	var dayC = diffValue / day;
+	var hourC = diffValue / hour;
+	var minC = diffValue / minute;
+	if (monthC >= 1) {
+		result = "" + parseInt(monthC) + "月前";
+	} else if (weekC >= 1) {
+		result = "" + parseInt(weekC) + "周前";
+	} else if (dayC >= 1) {
+		result = "" + parseInt(dayC) + "天前";
+	} else if (hourC >= 1) {
+		result = "" + parseInt(hourC) + "小时前";
+	} else if (minC >= 1) {
+		result = "" + parseInt(minC) + "分钟前";
+	} else
+		result = "刚刚";
+	return result;
+}
+
+function removeHtml(content) {
+	var temp = content.replace(/<\/?.+?>/g, "");
+	var result = temp.replace(/ /g, "");
+	var test = result.replace(/<br>/ig, "");
+	var text = test.replace(/&nbsp;/ig, "");
+	return text;
+}
+
+/**
+ * 安卓环境
+ */
+function isAndroidSys() {
+	return uni.getSystemInfoSync().platform == 'android';
+}
+
+/**
+ * ios环境
+ */
+function isIosSys() {
+	return uni.getSystemInfoSync().platform == 'ios';
+}
+
+
+module.exports = {
+	formatTime: formatTime,
+	formatTimes: formatTimes,
+	formatDayTimes: formatDayTimes,
+	equalsObj: equalsObj,
+	isObject: isObject,
+	isArray: isArray,
+	transTime: transTime,
+	throttle: throttle,
+	getPreMonth: getPreMonth,
+	isMobile: isMobile,
+	convertUrlObj: convertUrlObj,
+	getDateDiff: getDateDiff,
+	styleHintText: styleHintText,
+	removeHtml: removeHtml,
+	isAndroidSys: isAndroidSys,
+	isIosSys: isIosSys,
+	phoneHintText: phoneHintText,
+};