hwq 4 年之前
父节点
当前提交
3fc731483b
共有 65 个文件被更改,包括 5099 次插入2494 次删除
  1. 10 0
      api/course.js
  2. 57 0
      api/login.js
  3. 46 0
      api/set.js
  4. 95 1
      api/user.js
  5. 37 0
      api/wx.js
  6. 57 0
      components/Loading/index.vue
  7. 120 0
      components/countDown/index.vue
  8. 1 1
      components/empty.vue
  9. 36 0
      components/emptyPage.vue
  10. 118 0
      components/home/index.vue
  11. 0 632
      components/jyf-parser/jyf-parser.vue
  12. 0 99
      components/jyf-parser/libs/CssHandler.js
  13. 0 537
      components/jyf-parser/libs/MpHtmlParser.js
  14. 0 82
      components/jyf-parser/libs/config.js
  15. 0 24
      components/jyf-parser/libs/handler.wxs
  16. 0 503
      components/jyf-parser/libs/trees.vue
  17. 421 0
      components/newlist/nowList.vue
  18. 68 0
      components/returnButton.vue
  19. 246 0
      components/seckill/seckill.vue
  20. 6 27
      components/ss-calendar/ss-calendar.vue
  21. 5 10
      components/tki-qrcode/qrcode.js
  22. 15 19
      components/tki-qrcode/tki-qrcode.vue
  23. 18 30
      components/uni-countdown/uni-countdown.vue
  24. 6 10
      components/uni-countdown/uni-countdowns.vue
  25. 0 0
      components/uni-icons/uni-icons.vue
  26. 2 2
      components/uni-list-item/uni-list-item.vue
  27. 33 33
      components/uni-load-more/uni-load-more.vue
  28. 49 27
      components/uni-notice-bar/uni-notice-bar.vue
  29. 5 9
      components/uni-number-box.vue
  30. 243 0
      components/uni-popup/uni-popup-dialog.vue
  31. 116 0
      components/uni-popup/uni-popup-message.vue
  32. 263 0
      components/uni-popup/uni-popup-ori.vue
  33. 282 0
      components/uni-popup/uni-popup-share.vue
  34. 12 14
      components/uni-popup/uni-popup.vue
  35. 20 2
      components/uni-transition/uni-transition.vue
  36. 1 1
      components/wangding-pickerAddress/wangding-pickerAddress.vue
  37. 18 0
      config/app.js
  38. 32 0
      config/cache.js
  39. 39 0
      libs/log.js
  40. 84 0
      libs/login.js
  41. 253 0
      libs/wechat.js
  42. 36 0
      main.js
  43. 23 59
      manifest.json
  44. 32 0
      pages.json
  45. 55 28
      pages/course/course.vue
  46. 22 15
      pages/user/user.vue
  47. 147 0
      plugin/image-tools/index.js
  48. 0 0
      plugin/jweixin-module/index.js
  49. 551 0
      static/css/cmy.css
  50. 1 1
      store/index.js
  51. 8 8
      uni.scss
  52. 110 0
      utils/SubscribeMessage.js
  53. 134 0
      utils/cache.js
  54. 89 0
      utils/index.js
  55. 39 0
      utils/log.js
  56. 23 54
      utils/loginUtils.js
  57. 31 110
      utils/newRequest.js
  58. 24 0
      utils/platform.js
  59. 18 24
      utils/request.js
  60. 78 33
      utils/rocessor.js
  61. 42 0
      utils/uni-copy.js
  62. 111 0
      utils/upApp.js
  63. 550 0
      utils/util.js
  64. 161 95
      utils/wxAuthorized.js
  65. 0 4
      utils/wxMinProgram.js

+ 10 - 0
api/course.js

@@ -0,0 +1,10 @@
+import request from '@/utils/request'
+
+//获取课程
+export function getCourse(data) {
+	return request({
+		url: '/api/student/record',
+		method: 'get',
+		data
+	});
+}

+ 57 - 0
api/login.js

@@ -0,0 +1,57 @@
+import request from '@/utils/request'
+
+// 登录
+export function login(data) {
+	return request({
+		url: '/api/login',
+		method: 'post',
+		data
+	});
+}
+// 注册
+export function register(data) {
+	return request({
+		url: '/api/register',
+		method: 'post',
+		data
+	});
+}
+// 验证码
+export function verify(data) {
+	// type=register为注册
+	// type=login为登录
+	return request({
+		url: '/api/register/verify',
+		method: 'post',
+		data
+	});
+}
+
+// 获取用户信息
+export function getUserInfo(data) {
+	return request({
+		url: '/api/userinfo',
+		method: 'get',
+		data
+	});
+}
+
+// 短信登录
+export function loginMobile(data) {
+	return request({
+		url: '/api/login/mobile',
+		method: 'post',
+		data
+	});
+}
+// #ifdef APP-PLUS
+// 微信授权登录
+export function loginWx(data) {
+	return request({
+		url: '/api/wechat/appauth',
+		method: 'get',
+		data
+	});
+}
+// #endif
+

+ 46 - 0
api/set.js

@@ -0,0 +1,46 @@
+import request from '@/utils/request'
+
+// 修改用户信息
+export function userEdit(data) {
+	return request({
+		url: '/api/user/edit',
+		method: 'post',
+		data
+	});
+}
+
+//退出登录
+export function logout(data) {
+	return request({
+		url: '/api/logout',
+		method: 'get',
+		data
+	});
+}
+//修改密码
+export function registerReset(data) {
+	return request({
+		url: '/api/register/reset',
+		method: 'post',
+		data
+	});
+}
+
+//绑定手机
+export function binding(data) {
+	return request({
+		url: '/api/binding',
+		method: 'post',
+		data
+	});
+}
+// #ifdef APP-PLUS
+//苹果生成账户
+export function applelogin(data) {
+	return request({
+		url: '/api/applelogin',
+		method: 'post',
+		data
+	});
+}
+// #endif

+ 95 - 1
api/user.js

@@ -1,10 +1,104 @@
 import request from '@/utils/request'
 
+// 订单统计信息
+export function orderData(data) {
+	return request({
+		url: '/api/order/data',
+		method: 'get',
+		data
+	});
+}
+
 // 获取用户信息
-export function userinfo(data) {
+export function getUserInfo(data) {
 	return request({
 		url: '/api/userinfo',
 		method: 'get',
 		data
 	});
 }
+
+// 用户分享图
+export function spreadBanner(data) {
+	return request({
+		url: '/api/spread/banner',
+		method: 'get',
+		data
+	});
+}
+
+// 获取地址列表
+export function getAddressList(data) {
+	return request({
+		url: '/api/address/list',
+		method: 'get',
+		data
+	});
+}
+// 修改地址
+export function addressEdit(data) {
+	return request({
+		url: '/api/address/edit',
+		method: 'post',
+		data
+	});
+}
+// 删除地址
+export function addressDel(data) {
+	return request({
+		url: '/api/address/del',
+		method: 'post',
+		data
+	});
+}
+// 设为默认地址
+export function setAddressDefault(data) {
+	return request({
+		url: '/api/address/default/set',
+		method: 'post',
+		data
+	});
+}
+// 购物车列表
+export function getCartList(data) {
+	return request({
+		url: '/api/cart/list',
+		method: 'get',
+		data
+	});
+}
+
+// 修改购物车数量
+export function getCartNum(data) {
+	return request({
+		url: '/api/cart/num',
+		method: 'post',
+		data
+	});
+}
+//删除购物车
+export function cartDel(data) {
+	return request({
+		url: '/api/cart/del',
+		method: 'post',
+		data
+	});
+}
+//获取收藏夹列表
+export function getcollectList(data) {
+	return request({
+		url: '/api/collect/user',
+		method: 'get',
+		data
+	});
+}
+// 取消收藏
+export function delcollect(data) {
+	return request({
+		url: '/api/collect/del',
+		method: 'post',
+		data
+	});
+}
+
+

+ 37 - 0
api/wx.js

@@ -0,0 +1,37 @@
+import request from '@/utils/request'
+// #ifdef H5
+// 微信分享信息
+export function share(data) {
+	return request({
+		url: '/api/share',
+		method: 'get',
+		data
+	});
+}
+//微信配置
+export function wechatConfig(data) {
+	return request({
+		url: '/api/wechat/config',
+		method: 'get',
+		data
+	});
+}
+// 微信code地址
+export function wechatAuth(data) {
+	return request({
+		url: '/api/wechat/auth',
+		method: 'get',
+		data
+	});
+}
+// #endif
+// #ifdef MP-WEIXIN
+// 微信code地址
+export function wechatMpAuth(data) {
+	return request({
+		url: '/api/wechat/mp_auth',
+		method: 'post',
+		data
+	});
+}
+// #endif

+ 57 - 0
components/Loading/index.vue

@@ -0,0 +1,57 @@
+<template>
+	<view>
+		<view class="Loads acea-row row-center-wrapper" v-if="loading && !loaded" style="margin-top: .2rem;">
+			<view v-if="loading">
+				<view class="iconfont icon-jiazai loading acea-row row-center-wrapper"></view>
+				正在加载中
+			</view>
+			<view v-else>
+				上拉加载更多
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		name: "Loading",
+		props: {
+			loaded: {
+				type: Boolean,
+				default: false
+			},
+			loading: {
+				type: Boolean,
+				default: false
+			}
+		}
+	};
+</script>
+<style>
+	.Loads {
+	  height: 80upx;
+	  font-size: 25upx;
+	  color: #000;
+	}
+	.Loads .iconfont {
+	  font-size: 30upx;
+	  margin-right: 10upx;
+	  height: 32upx;
+	  line-height: 32upx;
+	}
+	/*加载动画*/
+	@keyframes load {
+	  from {
+	    transform: rotate(0deg);
+	  }
+	  to {
+	    transform: rotate(360deg);
+	  }
+	}
+	.loadingpic {
+	  animation: load 3s linear 1s infinite;
+	}
+	.loading {
+	  animation: load linear 1s infinite;
+	}
+</style>

+ 120 - 0
components/countDown/index.vue

@@ -0,0 +1,120 @@
+<template>
+	<view class="time" :style="justifyLeft">
+		<text class="red" v-if="tipText">{{ tipText }}</text>
+		<text class="styleAll" v-if="isDay === true">{{ day }}</text>
+		<text class="timeTxt red" v-if="dayText">{{ dayText }}</text>
+		<text class="styleAll">{{ hour }}</text>
+		<text class="timeTxt red" v-if="hourText">{{ hourText }}</text>
+		<text class="styleAll">{{ minute }}</text>
+		<text class="timeTxt red" v-if="minuteText">{{ minuteText }}</text>
+		<text class="styleAll">{{ second }}</text>
+		<text class="timeTxt red" v-if="secondText">{{ secondText }}</text>
+	</view>
+</template>
+
+<script>
+	export default {
+		name: "countDown",
+		props: {
+			justifyLeft: {
+				type: String,
+				default: ""
+			},
+			//距离开始提示文字
+			tipText: {
+				type: String,
+				default: "倒计时"
+			},
+			dayText: {
+				type: String,
+				default: "天"
+			},
+			hourText: {
+				type: String,
+				default: "时"
+			},
+			minuteText: {
+				type: String,
+				default: "分"
+			},
+			secondText: {
+				type: String,
+				default: "秒"
+			},
+			datatime: {
+				type: Number,
+				default: 0
+			},
+			isDay: {
+				type: Boolean,
+				default: true
+			}
+		},
+		data: function() {
+			return {
+				day: "00",
+				hour: "00",
+				minute: "00",
+				second: "00"
+			};
+		},
+		created: function() {
+			this.show_time();
+		},
+		mounted: function() {},
+		methods: {
+			show_time: function() {
+				let that = this;
+
+				function runTime() {
+					//时间函数
+					let intDiff = that.datatime - Date.parse(new Date()) / 1000; //获取数据中的时间戳的时间差;
+					let day = 0,
+						hour = 0,
+						minute = 0,
+						second = 0;
+					if (intDiff > 0) {
+						//转换时间
+						if (that.isDay === true) {
+							day = Math.floor(intDiff / (60 * 60 * 24));
+						} else {
+							day = 0;
+						}
+						hour = Math.floor(intDiff / (60 * 60)) - day * 24;
+						minute = Math.floor(intDiff / 60) - day * 24 * 60 - hour * 60;
+						second =
+							Math.floor(intDiff) -
+							day * 24 * 60 * 60 -
+							hour * 60 * 60 -
+							minute * 60;
+						if (hour <= 9) hour = "0" + hour;
+						if (minute <= 9) minute = "0" + minute;
+						if (second <= 9) second = "0" + second;
+						that.day = day;
+						that.hour = hour;
+						that.minute = minute;
+						that.second = second;
+					} else {
+						that.day = "00";
+						that.hour = "00";
+						that.minute = "00";
+						that.second = "00";
+					}
+				}
+				runTime();
+				setInterval(runTime, 1000);
+			}
+		}
+	};
+</script>
+
+<style>
+	.time{
+		display: flex;
+		justify-content: center;
+	} 
+	.red{
+		color: #fc4141;
+		margin: 0 4rpx;
+	}
+</style>

+ 1 - 1
components/empty.vue

@@ -43,7 +43,7 @@
 		bottom: 0;
 		background: $page-color-base;
 		padding-bottom: 120upx;
-		z-index: 99;
+
 		&-image {
 			width: 200upx;
 			height: 200upx;

+ 36 - 0
components/emptyPage.vue

@@ -0,0 +1,36 @@
+<template>
+	<view class="empty-box">
+		<image src="/static/images/empty-box.png"></image>
+		<view class="txt">{{title}}</view>
+	</view>
+</template>
+
+<script>
+	export default{
+		props: {
+			title: {
+				type: String,
+				default: '暂无记录',
+			},
+		},
+	}
+	
+</script>
+
+<style lang="scss">
+	.empty-box{
+		display: flex;
+		flex-direction: column;
+		justify-content: center;
+		align-items: center;
+		margin-top: 200rpx;
+		image{
+			width: 414rpx;
+			height: 240rpx;
+		}
+		.txt{
+			font-size: 26rpx;
+			color: #999;
+		}
+	}
+</style>

+ 118 - 0
components/home/index.vue

@@ -0,0 +1,118 @@
+<template>
+	<view style="touch-action: none;">
+		<view class="home" style="position:fixed;" :style="{ top: top + 'px', bottom: bottom }" id="right-nav" @touchmove.stop.prevent="setTouchMove">
+			<view class="homeCon bg-color-red" :class="homeActive === true ? 'on' : ''" v-if="homeActive">
+				<navigator hover-class='none' url='/pages/index/index' open-type='switchTab' class='iconfont icon-shouye-xianxing'></navigator>
+				<navigator hover-class='none' url='/pages/order_addcart/order_addcart' open-type='switchTab' class='iconfont icon-caigou-xianxing'></navigator>
+				<navigator hover-class='none' url='/pages/user/index' open-type='switchTab' class='iconfont icon-yonghu1'></navigator>
+			</view>
+			<view @click="open" class="pictrueBox">
+				<view class="pictrue">
+					<image :src="
+              homeActive === true
+                ? '/static/images/close.gif'
+                : '/static/images/open.gif'
+            "
+					 class="image" />
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+<script>
+	import {
+		mapGetters
+	} from "vuex";
+	export default {
+		name: "Home",
+		props: {},
+		data: function() {
+			return {
+				top: "",
+				bottom: ""
+			};
+		},
+		computed: mapGetters(["homeActive"]),
+		methods: {
+			setTouchMove(e) {
+				var that = this;
+				if (e.touches[0].clientY < 545 && e.touches[0].clientY > 66) {
+					that.top = e.touches[0].clientY
+					// that.setData({
+					// 	top: e.touches[0].clientY
+					// })
+				}
+			},
+			open: function() {
+				this.homeActive ?
+					this.$store.commit("CLOSE_HOME") :
+					this.$store.commit("OPEN_HOME");
+			}
+		},
+		created() {
+			this.bottom = "50px";
+		}
+	};
+</script>
+
+<style scoped>
+	.pictrueBox {
+		width: 130rpx;
+		height: 120rpx;
+	}
+
+	/*返回主页按钮*/
+	.home {
+		position: fixed;
+		color: white;
+		text-align: center;
+		z-index: 9999;
+		right: 15rpx;
+		display: flex;
+	}
+
+	.home .homeCon {
+		border-radius: 50rpx;
+		opacity: 0;
+		height: 0;
+		color: #e93323;
+		width: 0;
+	}
+
+	.home .homeCon.on {
+		opacity: 1;
+		animation: bounceInRight 0.5s cubic-bezier(0.215, 0.610, 0.355, 1.000);
+		width: 300rpx;
+		height: 86rpx;
+		margin-bottom: 20rpx;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+		background: #f44939 !important;
+	}
+
+	.home .homeCon .iconfont {
+		font-size: 48rpx;
+		color: #fff;
+		display: inline-block;
+		margin: 0 auto;
+	}
+
+	.home .pictrue {
+		width: 86rpx;
+		height: 86rpx;
+		border-radius: 50%;
+		margin: 0 auto;
+	}
+
+	.home .pictrue .image {
+		width: 100%;
+		height: 100%;
+		border-radius: 50%;
+		transform: rotate(90deg);
+		ms-transform: rotate(90deg);
+		moz-transform: rotate(90deg);
+		webkit-transform: rotate(90deg);
+		o-transform: rotate(90deg);
+	}
+</style>

+ 0 - 632
components/jyf-parser/jyf-parser.vue

@@ -1,4 +1,3 @@
-<<<<<<< HEAD
 <template>
 	<view>
 		<slot v-if="!nodes.length" />
@@ -628,635 +627,4 @@
 	}
 
 	/* #endif */
-=======
-<template>
-	<view>
-		<slot v-if="!nodes.length" />
-		<!--#ifdef APP-PLUS-NVUE-->
-		<web-view id="_top" ref="web" :style="'margin-top:-2px;height:'+height+'px'" @onPostMessage="_message" />
-		<!--#endif-->
-		<!--#ifndef APP-PLUS-NVUE-->
-		<view id="_top" :style="showAm+(selectable?';user-select:text;-webkit-user-select:text':'')">
-			<!--#ifdef H5 || MP-360-->
-			<div :id="'rtf'+uid"></div>
-			<!--#endif-->
-			<!--#ifndef H5 || MP-360-->
-			<trees :nodes="nodes" :lazyLoad="lazyLoad" :loading="loadingImg" />
-			<!--#endif-->
-		</view>
-		<!--#endif-->
-	</view>
-</template>
-
-<script>
-	// #ifndef H5 || APP-PLUS-NVUE || MP-360
-	import trees from './libs/trees';
-	var cache = {},
-		// #ifdef MP-WEIXIN || MP-TOUTIAO
-		fs = uni.getFileSystemManager ? uni.getFileSystemManager() : null,
-		// #endif
-		Parser = require('./libs/MpHtmlParser.js');
-	var dom;
-	// 计算 cache 的 key
-	function hash(str) {
-		for (var i = str.length, val = 5381; i--;)
-			val += (val << 5) + str.charCodeAt(i);
-		return val;
-	}
-	// #endif
-	// #ifdef H5 || APP-PLUS-NVUE || MP-360
-	var windowWidth = uni.getSystemInfoSync().windowWidth,
-		cfg = require('./libs/config.js');
-	// #endif
-	// #ifdef APP-PLUS-NVUE
-	var weexDom = weex.requireModule('dom');
-	// #endif
-	/**
-	 * Parser 富文本组件
-	 * @tutorial https://github.com/jin-yufeng/Parser
-	 * @property {String} html 富文本数据
-	 * @property {Boolean} autopause 是否在播放一个视频时自动暂停其他视频
-	 * @property {Boolean} autoscroll 是否自动给所有表格添加一个滚动层
-	 * @property {Boolean} autosetTitle 是否自动将 title 标签中的内容设置到页面标题
-	 * @property {Number} compress 压缩等级
-	 * @property {String} domain 图片、视频等链接的主域名
-	 * @property {Boolean} lazyLoad 是否开启图片懒加载
-	 * @property {String} loadingImg 图片加载完成前的占位图
-	 * @property {Boolean} selectable 是否开启长按复制
-	 * @property {Object} tagStyle 标签的默认样式
-	 * @property {Boolean} showWithAnimation 是否使用渐显动画
-	 * @property {Boolean} useAnchor 是否使用锚点
-	 * @property {Boolean} useCache 是否缓存解析结果
-	 * @event {Function} parse 解析完成事件
-	 * @event {Function} load dom 加载完成事件
-	 * @event {Function} ready 所有图片加载完毕事件
-	 * @event {Function} error 错误事件
-	 * @event {Function} imgtap 图片点击事件
-	 * @event {Function} linkpress 链接点击事件
-	 * @author JinYufeng
-	 * @version 20200728
-	 * @listens MIT
-	 */
-	export default {
-		name: 'parser',
-		data() {
-			return {
-				// #ifdef H5 || MP-360
-				uid: this._uid,
-				// #endif
-				// #ifdef APP-PLUS-NVUE
-				height: 1,
-				// #endif
-				// #ifndef APP-PLUS-NVUE
-				showAm: '',
-				// #endif
-				nodes: []
-			}
-		},
-		// #ifndef H5 || APP-PLUS-NVUE || MP-360
-		components: {
-			trees
-		},
-		// #endif
-		props: {
-			html: String,
-			autopause: {
-				type: Boolean,
-				default: true
-			},
-			autoscroll: Boolean,
-			autosetTitle: {
-				type: Boolean,
-				default: true
-			},
-			// #ifndef H5 || APP-PLUS-NVUE || MP-360
-			compress: Number,
-			loadingImg: String,
-			useCache: Boolean,
-			// #endif
-			domain: String,
-			lazyLoad: Boolean,
-			selectable: Boolean,
-			tagStyle: Object,
-			showWithAnimation: Boolean,
-			useAnchor: Boolean
-		},
-		watch: {
-			html(html) {
-				this.setContent(html);
-			}
-		},
-		created() {
-			// 图片数组
-			this.imgList = [];
-			this.imgList.each = function(f) {
-				for (var i = 0, len = this.length; i < len; i++)
-					this.setItem(i, f(this[i], i, this));
-			}
-			this.imgList.setItem = function(i, src) {
-				if (i == void 0 || !src) return;
-				// #ifndef MP-ALIPAY || APP-PLUS
-				// 去重
-				if (src.indexOf('http') == 0 && this.includes(src)) {
-					var newSrc = src.split('://')[0];
-					for (var j = newSrc.length, c; c = src[j]; j++) {
-						if (c == '/' && src[j - 1] != '/' && src[j + 1] != '/') break;
-						newSrc += Math.random() > 0.5 ? c.toUpperCase() : c;
-					}
-					newSrc += src.substr(j);
-					return this[i] = newSrc;
-				}
-				// #endif
-				this[i] = src;
-				// 暂存 data src
-				if (src.includes('data:image')) {
-					var filePath, info = src.match(/data:image\/(\S+?);(\S+?),(.+)/);
-					if (!info) return;
-					// #ifdef MP-WEIXIN || MP-TOUTIAO
-					filePath = `${wx.env.USER_DATA_PATH}/${Date.now()}.${info[1]}`;
-					fs && fs.writeFile({
-						filePath,
-						data: info[3],
-						encoding: info[2],
-						success: () => this[i] = filePath
-					})
-					// #endif
-					// #ifdef APP-PLUS
-					filePath = `_doc/parser_tmp/${Date.now()}.${info[1]}`;
-					var bitmap = new plus.nativeObj.Bitmap();
-					bitmap.loadBase64Data(src, () => {
-						bitmap.save(filePath, {}, () => {
-							bitmap.clear()
-							this[i] = filePath;
-						})
-					})
-					// #endif
-				}
-			}
-		},
-		mounted() {
-			// #ifdef H5 || MP-360
-			this.document = document.getElementById('rtf' + this._uid);
-			// #endif
-			// #ifndef H5 || APP-PLUS-NVUE || MP-360
-			if (dom) this.document = new dom(this);
-			// #endif
-			// #ifdef APP-PLUS-NVUE
-			this.document = this.$refs.web;
-			setTimeout(() => {
-				// #endif
-				if (this.html) this.setContent(this.html);
-				// #ifdef APP-PLUS-NVUE
-			}, 30)
-			// #endif
-		},
-		beforeDestroy() {
-			// #ifdef H5 || MP-360
-			if (this._observer) this._observer.disconnect();
-			// #endif
-			this.imgList.each(src => {
-				// #ifdef APP-PLUS
-				if (src && src.includes('_doc')) {
-					plus.io.resolveLocalFileSystemURL(src, entry => {
-						entry.remove();
-					});
-				}
-				// #endif
-				// #ifdef MP-WEIXIN || MP-TOUTIAO
-				if (src && src.includes(uni.env.USER_DATA_PATH))
-					fs && fs.unlink({
-						filePath: src
-					})
-				// #endif
-			})
-			clearInterval(this._timer);
-		},
-		methods: {
-			// 设置富文本内容
-			setContent(html, append) {
-				// #ifdef APP-PLUS-NVUE
-				if (!html)
-					return this.height = 1;
-				if (append)
-					this.$refs.web.evalJs("var b=document.createElement('div');b.innerHTML='" + html.replace(/'/g, "\\'") +
-						"';document.getElementById('parser').appendChild(b)");
-				else {
-					html =
-						'<meta charset="utf-8" /><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"><style>html,body{width:100%;height:100%;overflow:hidden}body{margin:0}</style><base href="' +
-						this.domain + '"><div id="parser"' + (this.selectable ? '>' : ' style="user-select:none">') + this._handleHtml(html).replace(/\n/g, '\\n') +
-						'</div><script>"use strict";function e(e){if(window.__dcloud_weex_postMessage||window.__dcloud_weex_){var t={data:[e]};window.__dcloud_weex_postMessage?window.__dcloud_weex_postMessage(t):window.__dcloud_weex_.postMessage(JSON.stringify(t))}}document.body.onclick=function(){e({action:"click"})},' +
-						(this.showWithAnimation ? 'document.body.style.animation="_show .5s",' : '') +
-						'setTimeout(function(){e({action:"load",text:document.body.innerText,height:document.getElementById("parser").scrollHeight})},50);\x3c/script>';
-					this.$refs.web.evalJs("document.write('" + html.replace(/'/g, "\\'") + "');document.close()");
-				}
-				this.$refs.web.evalJs(
-					'var t=document.getElementsByTagName("title");t.length&&e({action:"getTitle",title:t[0].innerText});for(var o,n=document.getElementsByTagName("style"),r=1;o=n[r++];)o.innerHTML=o.innerHTML.replace(/body/g,"#parser");for(var a,c=document.getElementsByTagName("img"),s=[],i=0==c.length,d=0,l=0,g=0;a=c[l];l++)parseInt(a.style.width||a.getAttribute("width"))>' +
-					windowWidth + '&&(a.style.height="auto"),a.onload=function(){++d==c.length&&(i=!0)},a.onerror=function(){++d==c.length&&(i=!0),' + (cfg.errorImg ? 'this.src="' + cfg.errorImg + '",' : '') +
-					'e({action:"error",source:"img",target:this})},a.hasAttribute("ignore")||"A"==a.parentElement.nodeName||(a.i=g++,s.push(a.src),a.onclick=function(){e({action:"preview",img:{i:this.i,src:this.src}})});e({action:"getImgList",imgList:s});for(var u,m=document.getElementsByTagName("a"),f=0;u=m[f];f++)u.onclick=function(){var t,o=this.getAttribute("href");if("#"==o[0]){var n=document.getElementById(o.substr(1));n&&(t=n.offsetTop)}return e({action:"linkpress",href:o,offset:t}),!1};for(var h,y=document.getElementsByTagName("video"),v=0;h=y[v];v++)h.style.maxWidth="100%",h.onerror=function(){e({action:"error",source:"video",target:this})}' +
-					(this.autopause ? ',h.onplay=function(){for(var e,t=0;e=y[t];t++)e!=this&&e.pause()}' : '') +
-					';for(var _,p=document.getElementsByTagName("audio"),w=0;_=p[w];w++)_.onerror=function(){e({action:"error",source:"audio",target:this})};' +
-					(this.autoscroll ? 'for(var T,E=document.getElementsByTagName("table"),B=0;T=E[B];B++){var N=document.createElement("div");N.style.overflow="scroll",T.parentNode.replaceChild(N,T),N.appendChild(T)}' : '') +
-					'var x=document.getElementById("parser");clearInterval(window.timer),window.timer=setInterval(function(){i&&clearInterval(window.timer),e({action:"ready",ready:i,height:x.scrollHeight})},350)'
-				)
-				this.nodes = [1];
-				// #endif
-				// #ifdef H5 || MP-360
-				if (!html) {
-					if (this.rtf && !append) this.rtf.parentNode.removeChild(this.rtf);
-					return;
-				}
-				var div = document.createElement('div');
-				if (!append) {
-					if (this.rtf) this.rtf.parentNode.removeChild(this.rtf);
-					this.rtf = div;
-				} else {
-					if (!this.rtf) this.rtf = div;
-					else this.rtf.appendChild(div);
-				}
-				div.innerHTML = this._handleHtml(html, append);
-				for (var styles = this.rtf.getElementsByTagName('style'), i = 0, style; style = styles[i++];) {
-					style.innerHTML = style.innerHTML.replace(/body/g, '#rtf' + this._uid);
-					style.setAttribute('scoped', 'true');
-				}
-				// 懒加载
-				if (!this._observer && this.lazyLoad && IntersectionObserver) {
-					this._observer = new IntersectionObserver(changes => {
-						for (let item, i = 0; item = changes[i++];) {
-							if (item.isIntersecting) {
-								item.target.src = item.target.getAttribute('data-src');
-								item.target.removeAttribute('data-src');
-								this._observer.unobserve(item.target);
-							}
-						}
-					}, {
-						rootMargin: '500px 0px 500px 0px'
-					})
-				}
-				var _ts = this;
-				// 获取标题
-				var title = this.rtf.getElementsByTagName('title');
-				if (title.length && this.autosetTitle)
-					uni.setNavigationBarTitle({
-						title: title[0].innerText
-					})
-				// 图片处理
-				this.imgList.length = 0;
-				var imgs = this.rtf.getElementsByTagName('img');
-				for (let i = 0, j = 0, img; img = imgs[i]; i++) {
-					if (parseInt(img.style.width || img.getAttribute('width')) > windowWidth)
-						img.style.height = 'auto';
-					var src = img.getAttribute('src');
-					if (this.domain && src) {
-						if (src[0] == '/') {
-							if (src[1] == '/')
-								img.src = (this.domain.includes('://') ? this.domain.split('://')[0] : '') + ':' + src;
-							else img.src = this.domain + src;
-						} else if (!src.includes('://')) img.src = this.domain + '/' + src;
-					}
-					if (!img.hasAttribute('ignore') && img.parentElement.nodeName != 'A') {
-						img.i = j++;
-						_ts.imgList.push(img.src || img.getAttribute('data-src'));
-						img.onclick = function() {
-							var preview = true;
-							this.ignore = () => preview = false;
-							_ts.$emit('imgtap', this);
-							if (preview) {
-								uni.previewImage({
-									current: this.i,
-									urls: _ts.imgList
-								});
-							}
-						}
-					}
-					img.onerror = function() {
-						if (cfg.errorImg)
-							_ts.imgList[this.i] = this.src = cfg.errorImg;
-						_ts.$emit('error', {
-							source: 'img',
-							target: this
-						});
-					}
-					if (_ts.lazyLoad && this._observer && img.src && img.i != 0) {
-						img.setAttribute('data-src', img.src);
-						img.removeAttribute('src');
-						this._observer.observe(img);
-					}
-				}
-				// 链接处理
-				var links = this.rtf.getElementsByTagName('a');
-				for (var link of links) {
-					link.onclick = function() {
-						var jump = true,
-							href = this.getAttribute('href');
-						_ts.$emit('linkpress', {
-							href,
-							ignore: () => jump = false
-						});
-						if (jump && href) {
-							if (href[0] == '#') {
-								if (_ts.useAnchor) {
-									_ts.navigateTo({
-										id: href.substr(1)
-									})
-								}
-							} else if (href.indexOf('http') == 0 || href.indexOf('//') == 0)
-								return true;
-							else
-								uni.navigateTo({
-									url: href
-								})
-						}
-						return false;
-					}
-				}
-				// 视频处理
-				var videos = this.rtf.getElementsByTagName('video');
-				_ts.videoContexts = videos;
-				for (let video, i = 0; video = videos[i++];) {
-					video.style.maxWidth = '100%';
-					video.onerror = function() {
-						_ts.$emit('error', {
-							source: 'video',
-							target: this
-						});
-					}
-					video.onplay = function() {
-						if (_ts.autopause)
-							for (let item, i = 0; item = _ts.videoContexts[i++];)
-								if (item != this) item.pause();
-					}
-				}
-				// 音频处理
-				var audios = this.rtf.getElementsByTagName('audio');
-				for (var audio of audios)
-					audio.onerror = function() {
-						_ts.$emit('error', {
-							source: 'audio',
-							target: this
-						});
-					}
-				// 表格处理
-				if (this.autoscroll) {
-					var tables = this.rtf.getElementsByTagName('table');
-					for (var table of tables) {
-						let div = document.createElement('div');
-						div.style.overflow = 'scroll';
-						table.parentNode.replaceChild(div, table);
-						div.appendChild(table);
-					}
-				}
-				if (!append) this.document.appendChild(this.rtf);
-				this.$nextTick(() => {
-					this.nodes = [1];
-					this.$emit('load');
-				});
-				setTimeout(() => this.showAm = '', 500);
-				// #endif
-				// #ifndef APP-PLUS-NVUE
-				// #ifndef H5 || MP-360
-				var nodes;
-				if (!html) return this.nodes = [];
-				var parser = new Parser(html, this);
-				// 缓存读取
-				if (this.useCache) {
-					var hashVal = hash(html);
-					if (cache[hashVal])
-						nodes = cache[hashVal];
-					else {
-						nodes = parser.parse();
-						cache[hashVal] = nodes;
-					}
-				} else nodes = parser.parse();
-				this.$emit('parse', nodes);
-				if (append) this.nodes = this.nodes.concat(nodes);
-				else this.nodes = nodes;
-				if (nodes.length && nodes.title && this.autosetTitle)
-					uni.setNavigationBarTitle({
-						title: nodes.title
-					})
-				if (this.imgList) this.imgList.length = 0;
-				this.videoContexts = [];
-				this.$nextTick(() => {
-					(function f(cs) {
-						for (var i = cs.length; i--;) {
-							if (cs[i].top) {
-								cs[i].controls = [];
-								cs[i].init();
-								f(cs[i].$children);
-							}
-						}
-					})(this.$children)
-					this.$emit('load');
-				})
-				// #endif
-				var height;
-				clearInterval(this._timer);
-				this._timer = setInterval(() => {
-					// #ifdef H5 || MP-360
-					this.rect = this.rtf.getBoundingClientRect();
-					// #endif
-					// #ifndef H5 || MP-360
-					uni.createSelectorQuery().in(this)
-						.select('#_top').boundingClientRect().exec(res => {
-							if (!res) return;
-							this.rect = res[0];
-							// #endif
-							if (this.rect.height == height) {
-								this.$emit('ready', this.rect)
-								clearInterval(this._timer);
-							}
-							height = this.rect.height;
-							// #ifndef H5 || MP-360
-						});
-					// #endif
-				}, 350);
-				if (this.showWithAnimation && !append) this.showAm = 'animation:_show .5s';
-				// #endif
-			},
-			// 获取文本内容
-			getText(ns = this.nodes) {
-				var txt = '';
-				// #ifdef APP-PLUS-NVUE
-				txt = this._text;
-				// #endif
-				// #ifdef H5 || MP-360
-				txt = this.rtf.innerText;
-				// #endif
-				// #ifndef H5 || APP-PLUS-NVUE || MP-360
-				for (var i = 0, n; n = ns[i++];) {
-					if (n.type == 'text') txt += n.text.replace(/&nbsp;/g, '\u00A0').replace(/&lt;/g, '<').replace(/&gt;/g, '>')
-						.replace(/&amp;/g, '&');
-					else if (n.type == 'br') txt += '\n';
-					else {
-						// 块级标签前后加换行
-						var block = n.name == 'p' || n.name == 'div' || n.name == 'tr' || n.name == 'li' || (n.name[0] == 'h' && n.name[1] >
-							'0' && n.name[1] < '7');
-						if (block && txt && txt[txt.length - 1] != '\n') txt += '\n';
-						if (n.children) txt += this.getText(n.children);
-						if (block && txt[txt.length - 1] != '\n') txt += '\n';
-						else if (n.name == 'td' || n.name == 'th') txt += '\t';
-					}
-				}
-				// #endif
-				return txt;
-			},
-			// 锚点跳转
-			in (obj) {
-				if (obj.page && obj.selector && obj.scrollTop) this._in = obj;
-			},
-			navigateTo(obj) {
-				if (!this.useAnchor) return obj.fail && obj.fail('Anchor is disabled');
-				// #ifdef APP-PLUS-NVUE
-				if (!obj.id)
-					weexDom.scrollToElement(this.$refs.web);
-				else
-					this.$refs.web.evalJs('var pos=document.getElementById("' + obj.id +
-						'");if(pos)post({action:"linkpress",href:"#",offset:pos.offsetTop+' + (obj.offset || 0) + '})');
-				obj.success && obj.success();
-				// #endif
-				// #ifndef APP-PLUS-NVUE
-				var d = ' ';
-				// #ifdef MP-WEIXIN || MP-QQ || MP-TOUTIAO
-				d = '>>>';
-				// #endif
-				var selector = uni.createSelectorQuery().in(this._in ? this._in.page : this).select((this._in ? this._in.selector :
-					'#_top') + (obj.id ? `${d}#${obj.id},${this._in?this._in.selector:'#_top'}${d}.${obj.id}` : '')).boundingClientRect();
-				if (this._in) selector.select(this._in.selector).scrollOffset().select(this._in.selector).boundingClientRect();
-				else selector.selectViewport().scrollOffset();
-				selector.exec(res => {
-					if (!res[0]) return obj.fail && obj.fail('Label not found')
-					var scrollTop = res[1].scrollTop + res[0].top - (res[2] ? res[2].top : 0) + (obj.offset || 0);
-					if (this._in) this._in.page[this._in.scrollTop] = scrollTop;
-					else uni.pageScrollTo({
-						scrollTop,
-						duration: 300
-					})
-					obj.success && obj.success();
-				})
-				// #endif
-			},
-			// 获取视频对象
-			getVideoContext(id) {
-				// #ifndef APP-PLUS-NVUE
-				if (!id) return this.videoContexts;
-				else
-					for (var i = this.videoContexts.length; i--;)
-						if (this.videoContexts[i].id == id) return this.videoContexts[i];
-				// #endif
-			},
-			// #ifdef H5 || APP-PLUS-NVUE || MP-360
-			_handleHtml(html, append) {
-				if (!append) {
-					// 处理 tag-style 和 userAgentStyles
-					var style = '<style>@keyframes _show{0%{opacity:0}100%{opacity:1}}img{max-width:100%}';
-					for (var item in cfg.userAgentStyles)
-						style += `${item}{${cfg.userAgentStyles[item]}}`;
-					for (item in this.tagStyle)
-						style += `${item}{${this.tagStyle[item]}}`;
-					style += '</style>';
-					html = style + html;
-				}
-				// 处理 rpx
-				if (html.includes('rpx'))
-					html = html.replace(/[0-9.]+\s*rpx/g, $ => (parseFloat($) * windowWidth / 750) + 'px');
-				return html;
-			},
-			// #endif
-			// #ifdef APP-PLUS-NVUE
-			_message(e) {
-				// 接收 web-view 消息
-				var d = e.detail.data[0];
-				switch (d.action) {
-					case 'load':
-						this.$emit('load');
-						this.height = d.height;
-						this._text = d.text;
-						break;
-					case 'getTitle':
-						if (this.autosetTitle)
-							uni.setNavigationBarTitle({
-								title: d.title
-							})
-						break;
-					case 'getImgList':
-						this.imgList.length = 0;
-						for (var i = d.imgList.length; i--;)
-							this.imgList.setItem(i, d.imgList[i]);
-						break;
-					case 'preview':
-						var preview = true;
-						d.img.ignore = () => preview = false;
-						this.$emit('imgtap', d.img);
-						if (preview)
-							uni.previewImage({
-								current: d.img.i,
-								urls: this.imgList
-							})
-						break;
-					case 'linkpress':
-						var jump = true,
-							href = d.href;
-						this.$emit('linkpress', {
-							href,
-							ignore: () => jump = false
-						})
-						if (jump && href) {
-							if (href[0] == '#') {
-								if (this.useAnchor)
-									weexDom.scrollToElement(this.$refs.web, {
-										offset: d.offset
-									})
-							} else if (href.includes('://'))
-								plus.runtime.openWeb(href);
-							else
-								uni.navigateTo({
-									url: href
-								})
-						}
-						break;
-					case 'error':
-						if (d.source == 'img' && cfg.errorImg)
-							this.imgList.setItem(d.target.i, cfg.errorImg);
-						this.$emit('error', {
-							source: d.source,
-							target: d.target
-						})
-						break;
-					case 'ready':
-						this.height = d.height;
-						if (d.ready) uni.createSelectorQuery().in(this).select('#_top').boundingClientRect().exec(res => {
-							this.rect = res[0];
-							this.$emit('ready', res[0]);
-						})
-						break;
-					case 'click':
-						this.$emit('click');
-						this.$emit('tap');
-				}
-			},
-			// #endif
-		}
-	}
-</script>
-
-<style>
-	@keyframes _show {
-		0% {
-			opacity: 0;
-		}
-
-		100% {
-			opacity: 1;
-		}
-	}
-
-	/* #ifdef MP-WEIXIN */
-	:host {
-		display: block;
-		overflow: scroll;
-		-webkit-overflow-scrolling: touch;
-	}
-
-	/* #endif */
->>>>>>> 5b465a14bac2c1448cc18a0b08b88844fc895cd5
 </style>

+ 0 - 99
components/jyf-parser/libs/CssHandler.js

@@ -1,4 +1,3 @@
-<<<<<<< HEAD
 const cfg = require('./config.js'),
 	isLetter = c => (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
 
@@ -95,102 +94,4 @@ parser.prototype.Content = function() {
 		else this.res[item] = content;
 	this.list = [];
 	this.state = this.Space;
-=======
-const cfg = require('./config.js'),
-	isLetter = c => (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
-
-function CssHandler(tagStyle) {
-	var styles = Object.assign(Object.create(null), cfg.userAgentStyles);
-	for (var item in tagStyle)
-		styles[item] = (styles[item] ? styles[item] + ';' : '') + tagStyle[item];
-	this.styles = styles;
-}
-CssHandler.prototype.getStyle = function(data) {
-	this.styles = new parser(data, this.styles).parse();
-}
-CssHandler.prototype.match = function(name, attrs) {
-	var tmp, matched = (tmp = this.styles[name]) ? tmp + ';' : '';
-	if (attrs.class) {
-		var items = attrs.class.split(' ');
-		for (var i = 0, item; item = items[i]; i++)
-			if (tmp = this.styles['.' + item])
-				matched += tmp + ';';
-	}
-	if (tmp = this.styles['#' + attrs.id])
-		matched += tmp + ';';
-	return matched;
-}
-module.exports = CssHandler;
-
-function parser(data, init) {
-	this.data = data;
-	this.floor = 0;
-	this.i = 0;
-	this.list = [];
-	this.res = init;
-	this.state = this.Space;
-}
-parser.prototype.parse = function() {
-	for (var c; c = this.data[this.i]; this.i++)
-		this.state(c);
-	return this.res;
-}
-parser.prototype.section = function() {
-	return this.data.substring(this.start, this.i);
-}
-// 状态机
-parser.prototype.Space = function(c) {
-	if (c == '.' || c == '#' || isLetter(c)) {
-		this.start = this.i;
-		this.state = this.Name;
-	} else if (c == '/' && this.data[this.i + 1] == '*')
-		this.Comment();
-	else if (!cfg.blankChar[c] && c != ';')
-		this.state = this.Ignore;
-}
-parser.prototype.Comment = function() {
-	this.i = this.data.indexOf('*/', this.i) + 1;
-	if (!this.i) this.i = this.data.length;
-	this.state = this.Space;
-}
-parser.prototype.Ignore = function(c) {
-	if (c == '{') this.floor++;
-	else if (c == '}' && !--this.floor) this.state = this.Space;
-}
-parser.prototype.Name = function(c) {
-	if (cfg.blankChar[c]) {
-		this.list.push(this.section());
-		this.state = this.NameSpace;
-	} else if (c == '{') {
-		this.list.push(this.section());
-		this.Content();
-	} else if (c == ',') {
-		this.list.push(this.section());
-		this.Comma();
-	} else if (!isLetter(c) && (c < '0' || c > '9') && c != '-' && c != '_')
-		this.state = this.Ignore;
-}
-parser.prototype.NameSpace = function(c) {
-	if (c == '{') this.Content();
-	else if (c == ',') this.Comma();
-	else if (!cfg.blankChar[c]) this.state = this.Ignore;
-}
-parser.prototype.Comma = function() {
-	while (cfg.blankChar[this.data[++this.i]]);
-	if (this.data[this.i] == '{') this.Content();
-	else {
-		this.start = this.i--;
-		this.state = this.Name;
-	}
-}
-parser.prototype.Content = function() {
-	this.start = ++this.i;
-	if ((this.i = this.data.indexOf('}', this.i)) == -1) this.i = this.data.length;
-	var content = this.section();
-	for (var i = 0, item; item = this.list[i++];)
-		if (this.res[item]) this.res[item] += ';' + content;
-		else this.res[item] = content;
-	this.list = [];
-	this.state = this.Space;
->>>>>>> 5b465a14bac2c1448cc18a0b08b88844fc895cd5
 }

+ 0 - 537
components/jyf-parser/libs/MpHtmlParser.js

@@ -1,4 +1,3 @@
-<<<<<<< HEAD
 /**
  * html 解析器
  * @tutorial https://github.com/jin-yufeng/Parser
@@ -533,540 +532,4 @@ MpHtmlParser.prototype.EndTag = function(c) {
 		else this.state = this.Text;
 	}
 }
-=======
-/**
- * html 解析器
- * @tutorial https://github.com/jin-yufeng/Parser
- * @version 20200728
- * @author JinYufeng
- * @listens MIT
- */
-const cfg = require('./config.js'),
-	blankChar = cfg.blankChar,
-	CssHandler = require('./CssHandler.js'),
-	windowWidth = uni.getSystemInfoSync().windowWidth;
-var emoji;
-
-function MpHtmlParser(data, options = {}) {
-	this.attrs = {};
-	this.CssHandler = new CssHandler(options.tagStyle, windowWidth);
-	this.data = data;
-	this.domain = options.domain;
-	this.DOM = [];
-	this.i = this.start = this.audioNum = this.imgNum = this.videoNum = 0;
-	options.prot = (this.domain || '').includes('://') ? this.domain.split('://')[0] : 'http';
-	this.options = options;
-	this.state = this.Text;
-	this.STACK = [];
-	// 工具函数
-	this.bubble = () => {
-		for (var i = this.STACK.length, item; item = this.STACK[--i];) {
-			if (cfg.richOnlyTags[item.name]) {
-				if (item.name == 'table' && !Object.hasOwnProperty.call(item, 'c')) item.c = 1;
-				return false;
-			}
-			item.c = 1;
-		}
-		return true;
-	}
-	this.decode = (val, amp) => {
-		var i = -1,
-			j, en;
-		while (1) {
-			if ((i = val.indexOf('&', i + 1)) == -1) break;
-			if ((j = val.indexOf(';', i + 2)) == -1) break;
-			if (val[i + 1] == '#') {
-				en = parseInt((val[i + 2] == 'x' ? '0' : '') + val.substring(i + 2, j));
-				if (!isNaN(en)) val = val.substr(0, i) + String.fromCharCode(en) + val.substr(j + 1);
-			} else {
-				en = val.substring(i + 1, j);
-				if (cfg.entities[en] || en == amp)
-					val = val.substr(0, i) + (cfg.entities[en] || '&') + val.substr(j + 1);
-			}
-		}
-		return val;
-	}
-	this.getUrl = url => {
-		if (url[0] == '/') {
-			if (url[1] == '/') url = this.options.prot + ':' + url;
-			else if (this.domain) url = this.domain + url;
-		} else if (this.domain && url.indexOf('data:') != 0 && !url.includes('://'))
-			url = this.domain + '/' + url;
-		return url;
-	}
-	this.isClose = () => this.data[this.i] == '>' || (this.data[this.i] == '/' && this.data[this.i + 1] == '>');
-	this.section = () => this.data.substring(this.start, this.i);
-	this.parent = () => this.STACK[this.STACK.length - 1];
-	this.siblings = () => this.STACK.length ? this.parent().children : this.DOM;
-}
-MpHtmlParser.prototype.parse = function() {
-	if (emoji) this.data = emoji.parseEmoji(this.data);
-	for (var c; c = this.data[this.i]; this.i++)
-		this.state(c);
-	if (this.state == this.Text) this.setText();
-	while (this.STACK.length) this.popNode(this.STACK.pop());
-	return this.DOM;
-}
-// 设置属性
-MpHtmlParser.prototype.setAttr = function() {
-	var name = this.attrName.toLowerCase(),
-		val = this.attrVal;
-	if (cfg.boolAttrs[name]) this.attrs[name] = 'T';
-	else if (val) {
-		if (name == 'src' || (name == 'data-src' && !this.attrs.src)) this.attrs.src = this.getUrl(this.decode(val, 'amp'));
-		else if (name == 'href' || name == 'style') this.attrs[name] = this.decode(val, 'amp');
-		else if (name.substr(0, 5) != 'data-') this.attrs[name] = val;
-	}
-	this.attrVal = '';
-	while (blankChar[this.data[this.i]]) this.i++;
-	if (this.isClose()) this.setNode();
-	else {
-		this.start = this.i;
-		this.state = this.AttrName;
-	}
-}
-// 设置文本节点
-MpHtmlParser.prototype.setText = function() {
-	var back, text = this.section();
-	if (!text) return;
-	text = (cfg.onText && cfg.onText(text, () => back = true)) || text;
-	if (back) {
-		this.data = this.data.substr(0, this.start) + text + this.data.substr(this.i);
-		let j = this.start + text.length;
-		for (this.i = this.start; this.i < j; this.i++) this.state(this.data[this.i]);
-		return;
-	}
-	if (!this.pre) {
-		// 合并空白符
-		var flag, tmp = [];
-		for (let i = text.length, c; c = text[--i];)
-			if (!blankChar[c]) {
-				tmp.unshift(c);
-				if (!flag) flag = 1;
-			} else {
-				if (tmp[0] != ' ') tmp.unshift(' ');
-				if (c == '\n' && flag == void 0) flag = 0;
-			}
-		if (flag == 0) return;
-		text = tmp.join('');
-	}
-	this.siblings().push({
-		type: 'text',
-		text: this.decode(text)
-	});
-}
-// 设置元素节点
-MpHtmlParser.prototype.setNode = function() {
-	var node = {
-			name: this.tagName.toLowerCase(),
-			attrs: this.attrs
-		},
-		close = cfg.selfClosingTags[node.name];
-	if (this.options.nodes.length) node.type = 'node';
-	this.attrs = {};
-	if (!cfg.ignoreTags[node.name]) {
-		// 处理属性
-		var attrs = node.attrs,
-			style = this.CssHandler.match(node.name, attrs, node) + (attrs.style || ''),
-			styleObj = {};
-		if (attrs.id) {
-			if (this.options.compress & 1) attrs.id = void 0;
-			else if (this.options.useAnchor) this.bubble();
-		}
-		if ((this.options.compress & 2) && attrs.class) attrs.class = void 0;
-		switch (node.name) {
-			case 'a':
-			case 'ad': // #ifdef APP-PLUS
-			case 'iframe':
-				// #endif
-				this.bubble();
-				break;
-			case 'font':
-				if (attrs.color) {
-					styleObj['color'] = attrs.color;
-					attrs.color = void 0;
-				}
-				if (attrs.face) {
-					styleObj['font-family'] = attrs.face;
-					attrs.face = void 0;
-				}
-				if (attrs.size) {
-					var size = parseInt(attrs.size);
-					if (size < 1) size = 1;
-					else if (size > 7) size = 7;
-					var map = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'];
-					styleObj['font-size'] = map[size - 1];
-					attrs.size = void 0;
-				}
-				break;
-			case 'embed':
-				// #ifndef APP-PLUS
-				var src = node.attrs.src || '',
-					type = node.attrs.type || '';
-				if (type.includes('video') || src.includes('.mp4') || src.includes('.3gp') || src.includes('.m3u8'))
-					node.name = 'video';
-				else if (type.includes('audio') || src.includes('.m4a') || src.includes('.wav') || src.includes('.mp3') || src.includes(
-						'.aac'))
-					node.name = 'audio';
-				else break;
-				if (node.attrs.autostart)
-					node.attrs.autoplay = 'T';
-				node.attrs.controls = 'T';
-				// #endif
-				// #ifdef APP-PLUS
-				this.bubble();
-				break;
-				// #endif
-			case 'video':
-			case 'audio':
-				if (!attrs.id) attrs.id = node.name + (++this[`${node.name}Num`]);
-				else this[`${node.name}Num`]++;
-				if (node.name == 'video') {
-					if (this.videoNum > 3)
-						node.lazyLoad = 1;
-					if (attrs.width) {
-						styleObj.width = parseFloat(attrs.width) + (attrs.width.includes('%') ? '%' : 'px');
-						attrs.width = void 0;
-					}
-					if (attrs.height) {
-						styleObj.height = parseFloat(attrs.height) + (attrs.height.includes('%') ? '%' : 'px');
-						attrs.height = void 0;
-					}
-				}
-				if (!attrs.controls && !attrs.autoplay) attrs.controls = 'T';
-				attrs.source = [];
-				if (attrs.src) {
-					attrs.source.push(attrs.src);
-					attrs.src = void 0;
-				}
-				this.bubble();
-				break;
-			case 'td':
-			case 'th':
-				if (attrs.colspan || attrs.rowspan)
-					for (var k = this.STACK.length, item; item = this.STACK[--k];)
-						if (item.name == 'table') {
-							item.c = void 0;
-							break;
-						}
-		}
-		if (attrs.align) {
-			styleObj['text-align'] = attrs.align;
-			attrs.align = void 0;
-		}
-		// 压缩 style
-		var styles = style.split(';');
-		style = '';
-		for (var i = 0, len = styles.length; i < len; i++) {
-			var info = styles[i].split(':');
-			if (info.length < 2) continue;
-			let key = info[0].trim().toLowerCase(),
-				value = info.slice(1).join(':').trim();
-			if (value[0] == '-' || value.includes('safe'))
-				style += `;${key}:${value}`;
-			else if (!styleObj[key] || value.includes('import') || !styleObj[key].includes('import'))
-				styleObj[key] = value;
-		}
-		if (node.name == 'img') {
-			if (attrs.src && !attrs.ignore) {
-				if (this.bubble())
-					attrs.i = (this.imgNum++).toString();
-				else attrs.ignore = 'T';
-			}
-			if (attrs.ignore) {
-				style += ';-webkit-touch-callout:none';
-				styleObj['max-width'] = '100%';
-			}
-			var width;
-			if (styleObj.width) width = styleObj.width;
-			else if (attrs.width) width = attrs.width.includes('%') ? attrs.width : attrs.width + 'px';
-			if (width) {
-				styleObj.width = width;
-				attrs.width = '100%';
-				if (parseInt(width) > windowWidth) {
-					styleObj.height = '';
-					if (attrs.height) attrs.height = void 0;
-				}
-			}
-			if (styleObj.height) {
-				attrs.height = styleObj.height;
-				styleObj.height = '';
-			} else if (attrs.height && !attrs.height.includes('%'))
-				attrs.height += 'px';
-		}
-		for (var key in styleObj) {
-			var value = styleObj[key];
-			if (!value) continue;
-			if (key.includes('flex') || key == 'order' || key == 'self-align') node.c = 1;
-			// 填充链接
-			if (value.includes('url')) {
-				var j = value.indexOf('(');
-				if (j++ != -1) {
-					while (value[j] == '"' || value[j] == "'" || blankChar[value[j]]) j++;
-					value = value.substr(0, j) + this.getUrl(value.substr(j));
-				}
-			}
-			// 转换 rpx
-			else if (value.includes('rpx'))
-				value = value.replace(/[0-9.]+\s*rpx/g, $ => parseFloat($) * windowWidth / 750 + 'px');
-			else if (key == 'white-space' && value.includes('pre') && !close)
-				this.pre = node.pre = true;
-			style += `;${key}:${value}`;
-		}
-		style = style.substr(1);
-		if (style) attrs.style = style;
-		if (!close) {
-			node.children = [];
-			if (node.name == 'pre' && cfg.highlight) {
-				this.remove(node);
-				this.pre = node.pre = true;
-			}
-			this.siblings().push(node);
-			this.STACK.push(node);
-		} else if (!cfg.filter || cfg.filter(node, this) != false)
-			this.siblings().push(node);
-	} else {
-		if (!close) this.remove(node);
-		else if (node.name == 'source') {
-			var parent = this.parent();
-			if (parent && (parent.name == 'video' || parent.name == 'audio') && node.attrs.src)
-				parent.attrs.source.push(node.attrs.src);
-		} else if (node.name == 'base' && !this.domain) this.domain = node.attrs.href;
-	}
-	if (this.data[this.i] == '/') this.i++;
-	this.start = this.i + 1;
-	this.state = this.Text;
-}
-// 移除标签
-MpHtmlParser.prototype.remove = function(node) {
-	var name = node.name,
-		j = this.i;
-	// 处理 svg
-	var handleSvg = () => {
-		var src = this.data.substring(j, this.i + 1);
-		if (!node.attrs.xmlns) src = ' xmlns="http://www.w3.org/2000/svg"' + src;
-		var i = j;
-		while (this.data[j] != '<') j--;
-		src = this.data.substring(j, i).replace("viewbox", "viewBox") + src;
-		var parent = this.parent();
-		if (node.attrs.width == '100%' && parent && (parent.attrs.style || '').includes('inline'))
-			parent.attrs.style = 'width:300px;max-width:100%;' + parent.attrs.style;
-		this.siblings().push({
-			name: 'img',
-			attrs: {
-				src: 'data:image/svg+xml;utf8,' + src.replace(/#/g, '%23'),
-				style: (/vertical[^;]+/.exec(node.attrs.style) || []).shift(),
-				ignore: 'T'
-			}
-		})
-	}
-	if (node.name == 'svg' && this.data[j] == '/') return handleSvg(this.i++);
-	while (1) {
-		if ((this.i = this.data.indexOf('</', this.i + 1)) == -1) {
-			if (name == 'pre' || name == 'svg') this.i = j;
-			else this.i = this.data.length;
-			return;
-		}
-		this.start = (this.i += 2);
-		while (!blankChar[this.data[this.i]] && !this.isClose()) this.i++;
-		if (this.section().toLowerCase() == name) {
-			// 代码块高亮
-			if (name == 'pre') {
-				this.data = this.data.substr(0, j + 1) + cfg.highlight(this.data.substring(j + 1, this.i - 5), node.attrs) + this.data
-					.substr(this.i - 5);
-				return this.i = j;
-			} else if (name == 'style')
-				this.CssHandler.getStyle(this.data.substring(j + 1, this.i - 7));
-			else if (name == 'title')
-				this.DOM.title = this.data.substring(j + 1, this.i - 7);
-			if ((this.i = this.data.indexOf('>', this.i)) == -1) this.i = this.data.length;
-			if (name == 'svg') handleSvg();
-			return;
-		}
-	}
-}
-// 节点出栈处理
-MpHtmlParser.prototype.popNode = function(node) {
-	// 空白符处理
-	if (node.pre) {
-		node.pre = this.pre = void 0;
-		for (let i = this.STACK.length; i--;)
-			if (this.STACK[i].pre)
-				this.pre = true;
-	}
-	var siblings = this.siblings(),
-		len = siblings.length,
-		childs = node.children;
-	if (node.name == 'head' || (cfg.filter && cfg.filter(node, this) == false))
-		return siblings.pop();
-	var attrs = node.attrs;
-	// 替换一些标签名
-	if (cfg.blockTags[node.name]) node.name = 'div';
-	else if (!cfg.trustTags[node.name]) node.name = 'span';
-	// 处理列表
-	if (node.c && (node.name == 'ul' || node.name == 'ol')) {
-		if ((node.attrs.style || '').includes('list-style:none')) {
-			for (let i = 0, child; child = childs[i++];)
-				if (child.name == 'li')
-					child.name = 'div';
-		} else if (node.name == 'ul') {
-			var floor = 1;
-			for (let i = this.STACK.length; i--;)
-				if (this.STACK[i].name == 'ul') floor++;
-			if (floor != 1)
-				for (let i = childs.length; i--;)
-					childs[i].floor = floor;
-		} else {
-			for (let i = 0, num = 1, child; child = childs[i++];)
-				if (child.name == 'li') {
-					child.type = 'ol';
-					child.num = ((num, type) => {
-						if (type == 'a') return String.fromCharCode(97 + (num - 1) % 26);
-						if (type == 'A') return String.fromCharCode(65 + (num - 1) % 26);
-						if (type == 'i' || type == 'I') {
-							num = (num - 1) % 99 + 1;
-							var one = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX'],
-								ten = ['X', 'XX', 'XXX', 'XL', 'L', 'LX', 'LXX', 'LXXX', 'XC'],
-								res = (ten[Math.floor(num / 10) - 1] || '') + (one[num % 10 - 1] || '');
-							if (type == 'i') return res.toLowerCase();
-							return res;
-						}
-						return num;
-					})(num++, attrs.type) + '.';
-				}
-		}
-	}
-	// 处理表格的边框
-	if (node.name == 'table') {
-		var padding = attrs.cellpadding,
-			spacing = attrs.cellspacing,
-			border = attrs.border;
-		if (node.c) {
-			this.bubble();
-			attrs.style = (attrs.style || '') + ';display:table';
-			if (!padding) padding = 2;
-			if (!spacing) spacing = 2;
-		}
-		if (border) attrs.style = `border:${border}px solid gray;${attrs.style || ''}`;
-		if (spacing) attrs.style = `border-spacing:${spacing}px;${attrs.style || ''}`;
-		if (border || padding || node.c)
-			(function f(ns) {
-				for (var i = 0, n; n = ns[i]; i++) {
-					if (n.type == 'text') continue;
-					var style = n.attrs.style || '';
-					if (node.c && n.name[0] == 't') {
-						n.c = 1;
-						style += ';display:table-' + (n.name == 'th' || n.name == 'td' ? 'cell' : (n.name == 'tr' ? 'row' : 'row-group'));
-					}
-					if (n.name == 'th' || n.name == 'td') {
-						if (border) style = `border:${border}px solid gray;${style}`;
-						if (padding) style = `padding:${padding}px;${style}`;
-					} else f(n.children || []);
-					if (style) n.attrs.style = style;
-				}
-			})(childs)
-		if (this.options.autoscroll) {
-			var table = Object.assign({}, node);
-			node.name = 'div';
-			node.attrs = {
-				style: 'overflow:scroll'
-			}
-			node.children = [table];
-		}
-	}
-	this.CssHandler.pop && this.CssHandler.pop(node);
-	// 自动压缩
-	if (node.name == 'div' && !Object.keys(attrs).length && childs.length == 1 && childs[0].name == 'div')
-		siblings[len - 1] = childs[0];
-}
-// 状态机
-MpHtmlParser.prototype.Text = function(c) {
-	if (c == '<') {
-		var next = this.data[this.i + 1],
-			isLetter = c => (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
-		if (isLetter(next)) {
-			this.setText();
-			this.start = this.i + 1;
-			this.state = this.TagName;
-		} else if (next == '/') {
-			this.setText();
-			if (isLetter(this.data[++this.i + 1])) {
-				this.start = this.i + 1;
-				this.state = this.EndTag;
-			} else this.Comment();
-		} else if (next == '!' || next == '?') {
-			this.setText();
-			this.Comment();
-		}
-	}
-}
-MpHtmlParser.prototype.Comment = function() {
-	var key;
-	if (this.data.substring(this.i + 2, this.i + 4) == '--') key = '-->';
-	else if (this.data.substring(this.i + 2, this.i + 9) == '[CDATA[') key = ']]>';
-	else key = '>';
-	if ((this.i = this.data.indexOf(key, this.i + 2)) == -1) this.i = this.data.length;
-	else this.i += key.length - 1;
-	this.start = this.i + 1;
-	this.state = this.Text;
-}
-MpHtmlParser.prototype.TagName = function(c) {
-	if (blankChar[c]) {
-		this.tagName = this.section();
-		while (blankChar[this.data[this.i]]) this.i++;
-		if (this.isClose()) this.setNode();
-		else {
-			this.start = this.i;
-			this.state = this.AttrName;
-		}
-	} else if (this.isClose()) {
-		this.tagName = this.section();
-		this.setNode();
-	}
-}
-MpHtmlParser.prototype.AttrName = function(c) {
-	if (c == '=' || blankChar[c] || this.isClose()) {
-		this.attrName = this.section();
-		if (blankChar[c])
-			while (blankChar[this.data[++this.i]]);
-		if (this.data[this.i] == '=') {
-			while (blankChar[this.data[++this.i]]);
-			this.start = this.i--;
-			this.state = this.AttrValue;
-		} else this.setAttr();
-	}
-}
-MpHtmlParser.prototype.AttrValue = function(c) {
-	if (c == '"' || c == "'") {
-		this.start++;
-		if ((this.i = this.data.indexOf(c, this.i + 1)) == -1) return this.i = this.data.length;
-		this.attrVal = this.section();
-		this.i++;
-	} else {
-		for (; !blankChar[this.data[this.i]] && !this.isClose(); this.i++);
-		this.attrVal = this.section();
-	}
-	this.setAttr();
-}
-MpHtmlParser.prototype.EndTag = function(c) {
-	if (blankChar[c] || c == '>' || c == '/') {
-		var name = this.section().toLowerCase();
-		for (var i = this.STACK.length; i--;)
-			if (this.STACK[i].name == name) break;
-		if (i != -1) {
-			var node;
-			while ((node = this.STACK.pop()).name != name) this.popNode(node);
-			this.popNode(node);
-		} else if (name == 'p' || name == 'br')
-			this.siblings().push({
-				name,
-				attrs: {}
-			});
-		this.i = this.data.indexOf('>', this.i);
-		this.start = this.i + 1;
-		if (this.i == -1) this.i = this.data.length;
-		else this.state = this.Text;
-	}
-}
->>>>>>> 5b465a14bac2c1448cc18a0b08b88844fc895cd5
 module.exports = MpHtmlParser;

+ 0 - 82
components/jyf-parser/libs/config.js

@@ -1,4 +1,3 @@
-<<<<<<< HEAD
 /* 配置文件 */
 var cfg = {
 	// 出错占位图
@@ -78,85 +77,4 @@ cfg.ignoreTags.iframe = void 0;
 Object.assign(cfg.trustTags, makeMap('embed,iframe'));
 // #endif
 
-=======
-/* 配置文件 */
-var cfg = {
-	// 出错占位图
-	errorImg: null,
-	// 过滤器函数
-	filter: null,
-	// 代码高亮函数
-	highlight: null,
-	// 文本处理函数
-	onText: null,
-	// 实体编码列表
-	entities: {
-		quot: '"',
-		apos: "'",
-		semi: ';',
-		nbsp: '\xA0',
-		ensp: '\u2002',
-		emsp: '\u2003',
-		ndash: '–',
-		mdash: '—',
-		middot: '·',
-		lsquo: '‘',
-		rsquo: '’',
-		ldquo: '“',
-		rdquo: '”',
-		bull: '•',
-		hellip: '…'
-	},
-	blankChar: makeMap(' ,\xA0,\t,\r,\n,\f'),
-	boolAttrs: makeMap('allowfullscreen,autoplay,autostart,controls,ignore,loop,muted'),
-	// 块级标签,将被转为 div
-	blockTags: makeMap('address,article,aside,body,caption,center,cite,footer,header,html,nav,pre,section'),
-	// 将被移除的标签
-	ignoreTags: makeMap('area,base,canvas,frame,iframe,input,link,map,meta,param,script,source,style,svg,textarea,title,track,wbr'),
-	// 只能被 rich-text 显示的标签
-	richOnlyTags: makeMap('a,colgroup,fieldset,legend,table'),
-	// 自闭合的标签
-	selfClosingTags: makeMap('area,base,br,col,circle,ellipse,embed,frame,hr,img,input,line,link,meta,param,path,polygon,rect,source,track,use,wbr'),
-	// 信任的标签
-	trustTags: makeMap('a,abbr,ad,audio,b,blockquote,br,code,col,colgroup,dd,del,dl,dt,div,em,fieldset,h1,h2,h3,h4,h5,h6,hr,i,img,ins,label,legend,li,ol,p,q,source,span,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,title,ul,video'),
-	// 默认的标签样式
-	userAgentStyles: {
-		address: 'font-style:italic',
-		big: 'display:inline;font-size:1.2em',
-		blockquote: 'background-color:#f6f6f6;border-left:3px solid #dbdbdb;color:#6c6c6c;padding:5px 0 5px 10px',
-		caption: 'display:table-caption;text-align:center',
-		center: 'text-align:center',
-		cite: 'font-style:italic',
-		dd: 'margin-left:40px',
-		mark: 'background-color:yellow',
-		pre: 'font-family:monospace;white-space:pre;overflow:scroll',
-		s: 'text-decoration:line-through',
-		small: 'display:inline;font-size:0.8em',
-		u: 'text-decoration:underline'
-	}
-}
-
-function makeMap(str) {
-	var map = Object.create(null),
-		list = str.split(',');
-	for (var i = list.length; i--;)
-		map[list[i]] = true;
-	return map;
-}
-
-// #ifdef MP-WEIXIN
-if (wx.canIUse('editor')) {
-	cfg.blockTags.pre = void 0;
-	cfg.ignoreTags.rp = true;
-	Object.assign(cfg.richOnlyTags, makeMap('bdi,bdo,caption,rt,ruby'));
-	Object.assign(cfg.trustTags, makeMap('bdi,bdo,caption,pre,rt,ruby'));
-}
-// #endif
-
-// #ifdef APP-PLUS
-cfg.ignoreTags.iframe = void 0;
-Object.assign(cfg.trustTags, makeMap('embed,iframe'));
-// #endif
-
->>>>>>> 5b465a14bac2c1448cc18a0b08b88844fc895cd5
 module.exports = cfg;

+ 0 - 24
components/jyf-parser/libs/handler.wxs

@@ -1,4 +1,3 @@
-<<<<<<< HEAD
 var inline = {
 	abbr: 1,
 	b: 1,
@@ -20,27 +19,4 @@ module.exports = {
 	use: function(item) {
 		return !item.c && !inline[item.name] && (item.attrs.style || '').indexOf('display:inline') == -1
 	}
-=======
-var inline = {
-	abbr: 1,
-	b: 1,
-	big: 1,
-	code: 1,
-	del: 1,
-	em: 1,
-	i: 1,
-	ins: 1,
-	label: 1,
-	q: 1,
-	small: 1,
-	span: 1,
-	strong: 1,
-	sub: 1,
-	sup: 1
-}
-module.exports = {
-	use: function(item) {
-		return !item.c && !inline[item.name] && (item.attrs.style || '').indexOf('display:inline') == -1
-	}
->>>>>>> 5b465a14bac2c1448cc18a0b08b88844fc895cd5
 }

+ 0 - 503
components/jyf-parser/libs/trees.vue

@@ -1,4 +1,3 @@
-<<<<<<< HEAD
 <template>
 	<view :class="'interlayer '+(c||'')" :style="s">
 		<block v-for="(n, i) in nodes" v-bind:key="i">
@@ -499,506 +498,4 @@
 		border-style: solid;
 		border-width: 15px 0 15px 30px;
 	}
-=======
-<template>
-	<view :class="'interlayer '+(c||'')" :style="s">
-		<block v-for="(n, i) in nodes" v-bind:key="i">
-			<!--图片-->
-			<view v-if="n.name=='img'" :class="'_img '+n.attrs.class" :style="n.attrs.style" :data-attrs="n.attrs" @tap="imgtap">
-				<rich-text v-if="ctrl[i]!=0" :nodes="[{attrs:{src:loading&&(ctrl[i]||0)<2?loading:(lazyLoad&&!ctrl[i]?placeholder:(ctrl[i]==3?errorImg:n.attrs.src||'')),alt:n.attrs.alt||'',width:n.attrs.width||'',style:'-webkit-touch-callout:none;max-width:100%;display:block'+(n.attrs.height?';height:'+n.attrs.height:'')},name:'img'}]" />
-				<image class="_image" :src="lazyLoad&&!ctrl[i]?placeholder:n.attrs.src" :lazy-load="lazyLoad"
-				 :show-menu-by-longpress="!n.attrs.ignore" :data-i="i" :data-index="n.attrs.i" data-source="img" @load="loadImg"
-				 @error="error" />
-			</view>
-			<!--文本-->
-			<text v-else-if="n.type=='text'" decode>{{n.text}}</text>
-			<!--#ifndef MP-BAIDU-->
-			<text v-else-if="n.name=='br'">\n</text>
-			<!--#endif-->
-			<!--视频-->
-			<view v-else-if="((n.lazyLoad&&!n.attrs.autoplay)||(n.name=='video'&&!loadVideo))&&ctrl[i]==undefined" :id="n.attrs.id" :class="'_video '+(n.attrs.class||'')"
-			 :style="n.attrs.style" :data-i="i" @tap="_loadVideo" />
-			<video v-else-if="n.name=='video'" :id="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :autoplay="n.attrs.autoplay||ctrl[i]==0"
-			 :controls="n.attrs.controls" :loop="n.attrs.loop" :muted="n.attrs.muted" :poster="n.attrs.poster" :src="n.attrs.source[ctrl[i]||0]"
-			 :unit-id="n.attrs['unit-id']" :data-id="n.attrs.id" :data-i="i" data-source="video" @error="error" @play="play" />
-			<!--音频-->
-			<audio v-else-if="n.name=='audio'" :ref="n.attrs.id" :class="n.attrs.class" :style="n.attrs.style" :author="n.attrs.author"
-			 :autoplay="n.attrs.autoplay" :controls="n.attrs.controls" :loop="n.attrs.loop" :name="n.attrs.name" :poster="n.attrs.poster"
-			 :src="n.attrs.source[ctrl[i]||0]" :data-i="i" :data-id="n.attrs.id" data-source="audio"
-			 @error.native="error" @play.native="play" />
-			<!--链接-->
-			<view v-else-if="n.name=='a'" :id="n.attrs.id" :class="'_a '+(n.attrs.class||'')" hover-class="_hover" :style="n.attrs.style"
-			 :data-attrs="n.attrs" @tap="linkpress">
-				<trees class="_span" c="_span" :nodes="n.children" />
-			</view>
-			<!--广告-->
-			<!--<ad v-else-if="n.name=='ad'" :class="n.attrs.class" :style="n.attrs.style" :unit-id="n.attrs['unit-id']" :appid="n.attrs.appid" :apid="n.attrs.apid" :type="n.attrs.type" :adpid="n.attrs.adpid" data-source="ad" @error="error" />-->
-			<!--列表-->
-			<view v-else-if="n.name=='li'" :id="n.attrs.id" :class="n.attrs.class" :style="(n.attrs.style||'')+';display:flex;flex-direction:row'">
-				<view v-if="n.type=='ol'" class="_ol-bef">{{n.num}}</view>
-				<view v-else class="_ul-bef">
-					<view v-if="n.floor%3==0" class="_ul-p1">█</view>
-					<view v-else-if="n.floor%3==2" class="_ul-p2" />
-					<view v-else class="_ul-p1" style="border-radius:50%">█</view>
-				</view>
-				<trees class="_li" c="_li" :nodes="n.children" :lazyLoad="lazyLoad" :loading="loading" />
-			</view>
-			<!--表格-->
-			<view v-else-if="n.name=='table'&&n.c" :id="n.attrs.id" :class="n.attrs.class" :style="(n.attrs.style||'')+';display:table'">
-				<view v-for="(tbody, o) in n.children" v-bind:key="o" :class="tbody.attrs.class" :style="(tbody.attrs.style||'')+(tbody.name[0]=='t'?';display:table-'+(tbody.name=='tr'?'row':'row-group'):'')">
-					<view v-for="(tr, p) in tbody.children" v-bind:key="p" :class="tr.attrs.class" :style="(tr.attrs.style||'')+(tr.name[0]=='t'?';display:table-'+(tr.name=='tr'?'row':'cell'):'')">
-						<trees v-if="tr.name=='td'" :nodes="tr.children" />
-						<trees v-else v-for="(td, q) in tr.children" v-bind:key="q" :class="td.attrs.class" :c="td.attrs.class" :style="(td.attrs.style||'')+(td.name[0]=='t'?';display:table-'+(td.name=='tr'?'row':'cell'):'')"
-						 :s="(td.attrs.style||'')+(td.name[0]=='t'?';display:table-'+(td.name=='tr'?'row':'cell'):'')" :nodes="td.children" />
-					</view>
-				</view>
-			</view>
-			<!--#ifdef APP-PLUS-->
-			<iframe v-else-if="n.name=='iframe'" :style="n.attrs.style" :allowfullscreen="n.attrs.allowfullscreen" :frameborder="n.attrs.frameborder"
-			 :width="n.attrs.width" :height="n.attrs.height" :src="n.attrs.src" />
-			<embed v-else-if="n.name=='embed'" :style="n.attrs.style" :width="n.attrs.width" :height="n.attrs.height" :src="n.attrs.src" />
-			<!--#endif-->
-			<!--富文本-->
-			<!--#ifdef MP-WEIXIN || MP-QQ || APP-PLUS-->
-			<rich-text v-else-if="handler.use(n)" :id="n.attrs.id" :class="'_p __'+n.name" :nodes="[n]" />
-			<!--#endif-->
-			<!--#ifndef MP-WEIXIN || MP-QQ || APP-PLUS-->
-			<rich-text v-else-if="!n.c" :id="n.attrs.id" :nodes="[n]" style="display:inline" />
-			<!--#endif-->
-			<trees v-else :class="(n.attrs.id||'')+' _'+n.name+' '+(n.attrs.class||'')" :c="(n.attrs.id||'')+' _'+n.name+' '+(n.attrs.class||'')"
-			 :style="n.attrs.style" :s="n.attrs.style" :nodes="n.children" :lazyLoad="lazyLoad" :loading="loading" />
-		</block>
-	</view>
-</template>
-<script module="handler" lang="wxs" src="./handler.wxs"></script>
-<script>
-	global.Parser = {};
-	import trees from './trees'
-	const errorImg = require('../libs/config.js').errorImg;
-	export default {
-		components: {
-			trees
-		},
-		name: 'trees',
-		data() {
-			return {
-				ctrl: [],
-				placeholder: 'data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="300" height="225"/>',
-				errorImg,
-				loadVideo: typeof plus == 'undefined',
-				// #ifndef MP-ALIPAY
-				c: '',
-				s: ''
-				// #endif
-			}
-		},
-		props: {
-			nodes: Array,
-			lazyLoad: Boolean,
-			loading: String,
-			// #ifdef MP-ALIPAY
-			c: String,
-			s: String
-			// #endif
-		},
-		mounted() {
-			for (this.top = this.$parent; this.top.$options.name != 'parser'; this.top = this.top.$parent);
-			this.init();
-		},
-		// #ifdef APP-PLUS
-		beforeDestroy() {
-			this.observer && this.observer.disconnect();
-		},
-		// #endif
-		methods: {
-			init() {
-				for (var i = this.nodes.length, n; n = this.nodes[--i];) {
-					if (n.name == 'img') {
-						this.top.imgList.setItem(n.attrs.i, n.attrs.src);
-						// #ifdef APP-PLUS
-						if (this.lazyLoad && !this.observer) {
-							this.observer = uni.createIntersectionObserver(this).relativeToViewport({
-								top: 500,
-								bottom: 500
-							});
-							setTimeout(() => {
-								this.observer.observe('._img', res => {
-									if (res.intersectionRatio) {
-										for (var j = this.nodes.length; j--;)
-											if (this.nodes[j].name == 'img')
-												this.$set(this.ctrl, j, 1);
-										this.observer.disconnect();
-									}
-								})
-							}, 0)
-						}
-						// #endif
-					} else if (n.name == 'video' || n.name == 'audio') {
-						var ctx;
-						if (n.name == 'video') {
-							ctx = uni.createVideoContext(n.attrs.id
-								// #ifndef MP-BAIDU
-								, this
-								// #endif
-							);
-						} else if (this.$refs[n.attrs.id])
-							ctx = this.$refs[n.attrs.id][0];
-						if (ctx) {
-							ctx.id = n.attrs.id;
-							this.top.videoContexts.push(ctx);
-						}
-					}
-				}
-				// #ifdef APP-PLUS
-				// APP 上避免 video 错位需要延时渲染
-				setTimeout(() => {
-					this.loadVideo = true;
-				}, 1000)
-				// #endif
-			},
-			play(e) {
-				var contexts = this.top.videoContexts;
-				if (contexts.length > 1 && this.top.autopause)
-					for (var i = contexts.length; i--;)
-						if (contexts[i].id != e.currentTarget.dataset.id)
-							contexts[i].pause();
-			},
-			imgtap(e) {
-				var attrs = e.currentTarget.dataset.attrs;
-				if (!attrs.ignore) {
-					var preview = true,
-						data = {
-							id: e.target.id,
-							src: attrs.src,
-							ignore: () => preview = false
-						};
-					global.Parser.onImgtap && global.Parser.onImgtap(data);
-					this.top.$emit('imgtap', data);
-					if (preview) {
-						var urls = this.top.imgList,
-							current = urls[attrs.i] ? parseInt(attrs.i) : (urls = [attrs.src], 0);
-						uni.previewImage({
-							current,
-							urls
-						})
-					}
-				}
-			},
-			loadImg(e) {
-				var i = e.currentTarget.dataset.i;
-				if (this.lazyLoad && !this.ctrl[i]) {
-					// #ifdef QUICKAPP-WEBVIEW
-					this.$set(this.ctrl, i, 0);
-					this.$nextTick(function() {
-						// #endif
-						// #ifndef APP-PLUS
-						this.$set(this.ctrl, i, 1);
-						// #endif
-						// #ifdef QUICKAPP-WEBVIEW
-					})
-					// #endif
-				} else if (this.loading && this.ctrl[i] != 2) {
-					// #ifdef QUICKAPP-WEBVIEW
-					this.$set(this.ctrl, i, 0);
-					this.$nextTick(function() {
-						// #endif
-						this.$set(this.ctrl, i, 2);
-						// #ifdef QUICKAPP-WEBVIEW
-					})
-					// #endif
-				}
-			},
-			linkpress(e) {
-				var jump = true,
-					attrs = e.currentTarget.dataset.attrs;
-				attrs.ignore = () => jump = false;
-				global.Parser.onLinkpress && global.Parser.onLinkpress(attrs);
-				this.top.$emit('linkpress', attrs);
-				if (jump) {
-					// #ifdef MP
-					if (attrs['app-id']) {
-						return uni.navigateToMiniProgram({
-							appId: attrs['app-id'],
-							path: attrs.path
-						})
-					}
-					// #endif
-					if (attrs.href) {
-						if (attrs.href[0] == '#') {
-							if (this.top.useAnchor)
-								this.top.navigateTo({
-									id: attrs.href.substring(1)
-								})
-						} else if (attrs.href.indexOf('http') == 0 || attrs.href.indexOf('//') == 0) {
-							// #ifdef APP-PLUS
-							plus.runtime.openWeb(attrs.href);
-							// #endif
-							// #ifndef APP-PLUS
-							uni.setClipboardData({
-								data: attrs.href,
-								success: () =>
-									uni.showToast({
-										title: '链接已复制'
-									})
-							})
-							// #endif
-						} else
-							uni.navigateTo({
-								url: attrs.href,
-								fail() {
-									uni.switchTab({
-										url: attrs.href,
-									})
-								}
-							})
-					}
-				}
-			},
-			error(e) {
-				var target = e.currentTarget,
-					source = target.dataset.source,
-					i = target.dataset.i;
-				if (source == 'video' || source == 'audio') {
-					// 加载其他 source
-					var index = this.ctrl[i] ? this.ctrl[i].i + 1 : 1;
-					if (index < this.nodes[i].attrs.source.length)
-						this.$set(this.ctrl, i, index);
-					if (e.detail.__args__)
-						e.detail = e.detail.__args__[0];
-				} else if (errorImg && source == 'img') {
-					this.top.imgList.setItem(target.dataset.index, errorImg);
-					this.$set(this.ctrl, i, 3);
-				}
-				this.top && this.top.$emit('error', {
-					source,
-					target,
-					errMsg: e.detail.errMsg
-				});
-			},
-			_loadVideo(e) {
-				this.$set(this.ctrl, e.target.dataset.i, 0);
-			}
-		}
-	}
-</script>
-
-<style>
-	/* 在这里引入自定义样式 */
-
-	/* 链接和图片效果 */
-	._a {
-		display: inline;
-		padding: 1.5px 0 1.5px 0;
-		color: #366092;
-		word-break: break-all;
-	}
-
-	._hover {
-		text-decoration: underline;
-		opacity: 0.7;
-	}
-
-	._img {
-		display: inline-block;
-		max-width: 100%;
-		overflow: hidden;
-	}
-
-	/* #ifdef MP-WEIXIN */
-	:host {
-		display: inline;
-	}
-
-	/* #endif */
-
-	/* #ifndef MP-ALIPAY || APP-PLUS */
-	.interlayer {
-		display: inherit;
-		flex-direction: inherit;
-		flex-wrap: inherit;
-		align-content: inherit;
-		align-items: inherit;
-		justify-content: inherit;
-		width: 100%;
-		white-space: inherit;
-	}
-
-	/* #endif */
-
-	._b,
-	._strong {
-		font-weight: bold;
-	}
-
-	/* #ifndef MP-ALIPAY */
-	._blockquote,
-	._div,
-	._p,
-	._ol,
-	._ul,
-	._li {
-		display: block;
-	}
-	
-	/* #endif */
-
-	._code {
-		font-family: monospace;
-	}
-
-	._del {
-		text-decoration: line-through;
-	}
-
-	._em,
-	._i {
-		font-style: italic;
-	}
-
-	._h1 {
-		font-size: 2em;
-	}
-
-	._h2 {
-		font-size: 1.5em;
-	}
-
-	._h3 {
-		font-size: 1.17em;
-	}
-
-	._h5 {
-		font-size: 0.83em;
-	}
-
-	._h6 {
-		font-size: 0.67em;
-	}
-
-	._h1,
-	._h2,
-	._h3,
-	._h4,
-	._h5,
-	._h6 {
-		display: block;
-		font-weight: bold;
-	}
-
-	._image {
-		display: block;
-		width: 100%;
-		height: 360px;
-		margin-top: -360px;
-		opacity: 0;
-	}
-
-	._ins {
-		text-decoration: underline;
-	}
-
-	._li {
-		flex: 1;
-		width: 0;
-	}
-
-	._ol-bef {
-		width: 36px;
-		margin-right: 5px;
-		text-align: right;
-	}
-
-	._ul-bef {
-		display: block;
-		margin: 0 12px 0 23px;
-		line-height: normal;
-	}
-
-	._ol-bef,
-	._ul-bef {
-		flex: none;
-		user-select: none;
-	}
-
-	._ul-p1 {
-		display: inline-block;
-		width: 0.3em;
-		height: 0.3em;
-		overflow: hidden;
-		line-height: 0.3em;
-	}
-
-	._ul-p2 {
-		display: inline-block;
-		width: 0.23em;
-		height: 0.23em;
-		border: 0.05em solid black;
-		border-radius: 50%;
-	}
-
-	._q::before {
-		content: '"';
-	}
-
-	._q::after {
-		content: '"';
-	}
-
-	._sub {
-		font-size: smaller;
-		vertical-align: sub;
-	}
-
-	._sup {
-		font-size: smaller;
-		vertical-align: super;
-	}
-
-	/* #ifdef MP-ALIPAY || APP-PLUS || QUICKAPP-WEBVIEW */
-	._abbr,
-	._b,
-	._code,
-	._del,
-	._em,
-	._i,
-	._ins,
-	._label,
-	._q,
-	._span,
-	._strong,
-	._sub,
-	._sup {
-		display: inline;
-	}
-
-	/* #endif */
-
-	/* #ifdef MP-WEIXIN || MP-QQ */
-	.__bdo,
-	.__bdi,
-	.__ruby,
-	.__rt {
-		display: inline-block;
-	}
-
-	/* #endif */
-	._video {
-		position: relative;
-		display: inline-block;
-		width: 300px;
-		height: 225px;
-		background-color: black;
-	}
-
-	._video::after {
-		position: absolute;
-		top: 50%;
-		left: 50%;
-		margin: -15px 0 0 -15px;
-		content: '';
-		border-color: transparent transparent transparent white;
-		border-style: solid;
-		border-width: 15px 0 15px 30px;
-	}
->>>>>>> 5b465a14bac2c1448cc18a0b08b88844fc895cd5
 </style>

+ 421 - 0
components/newlist/nowList.vue

@@ -0,0 +1,421 @@
+<template>
+	<view class="other">
+		<view class="other-1">大家还在拼</view>
+		
+		<view class="preferred_item" v-for="item in recommendedlist" @click.stop="ToKaiTuan(item)">
+			<view class="flex_item" style="overflow: hidden;">
+				<view class="tlist-img">
+					<view class="leftImgIcon">AA团</view>
+					<!-- <view class="leftImgIcon" v-if="sid == 129">达人团</view> -->
+					<view class="img"><image :src="item.image" mode="scaleToFill"></image></view>
+				</view>
+				<view class="tlist-img " v-for="imgItem in item.images">
+					<view class="img"><image :src="imgItem" mode="scaleToFill"></image></view>
+				</view>
+			</view>
+			<view class="goods_name">
+				<view class="goods_title flex_item">
+					<view class="text">{{ item.min_people }}人团</view>
+					<view class="title">{{ item.title }}</view>
+				</view>
+				<view class="goods-height">
+					<!-- <view class="goods_num clamp">{{ item.info }}</view> -->
+					<view class="flex goods-peplo">
+						<view class="goods-tip flex_item">
+							<view class="peplo">库存剩{{ item.percent | parseIntTo }}%</view>
+							<view class="make">{{ item.mark }}</view>
+						</view>
+						<view class="right flex_item">
+							<image src="/static/icon/hot.png" mode="aspectFill"></image>
+							<text>已拼{{ item.sales }}份</text>
+						</view>
+					</view>
+				</view>
+				<view class="price flex">
+					<view class="price_list">
+						<view class="price-red">
+							<text>单人仅付:</text>
+							<text class="moneyIcon">¥</text>
+							<text class="money">{{ item.price }}</text>
+							<text class="moneyType">/{{ item.unit_name }}</text>
+							<!-- <text class="outMoney">¥{{ item.product_price }}</text> -->
+						</view>
+					</view>
+					<view class="img position-relative" @click.stop="ToKaiTuan(item)">去开团</view>
+				</view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+export default {
+	props: {
+		recommendedlist: {
+			type: Array,
+			default: function() {
+				return {
+				};
+			}
+		}
+	},
+	data() {
+		return {};
+	},
+	filters: {
+		parseIntTo(percent) {
+			percent = +percent * 100;
+			if (percent % 1 === 0) {
+				return percent;
+			} else {
+				percent = percent.toFixed(1);
+				return percent;
+			}
+		}
+	},
+	methods: {
+		// 去开团
+		ToKaiTuan(item) {
+			console.log(8754847)
+			let id = item.id;
+			uni.navigateTo({
+				url: '/pages/product/productGroup?id=' + id
+			});
+		},
+	}
+};
+</script>
+
+<style lang="scss">
+.other{
+		.other-1{
+			font-size:27rpx;
+			color:#333333;
+			line-height: 55rpx;
+		}
+		
+		.preferred_item {
+			width: 100%;
+			height: 100%;
+			padding: 25rpx 25rpx;
+			position: relative;
+			background-color: #FFFFFF;
+			border-radius: 15rpx;
+			margin-bottom: 15rpx;
+			.tlist-img {
+				width: 225rpx;
+				position: relative;
+				margin-right: 15rpx;
+				.leftImgIcon {
+					position: absolute;
+					top: 0;
+					left: 0;
+					font-size: 22rpx;
+					font-family: PingFangSC;
+					color: rgba(148, 71, 34, 1);
+					background: rgba(254, 242, 111, 1);
+					z-index: 99;
+					border-radius: 5rpx;
+					padding: 5rpx 10rpx;
+				}
+				.img {
+					width: 210rpx;
+					height: 210rpx;
+					image {
+						width: 100%;
+						height: 100%;
+						border-radius: 20rpx;
+					}
+				}
+				.stock {
+					margin-top: 13rpx;
+					font-size: 26rpx;
+					background: #fff1ee;
+					width: 100%;
+					color: #fb4912;
+					padding: 6rpx 0;
+					border-radius: 5rpx;
+					justify-content: center;
+					align-items: center;
+					position: absolute;
+					left: 0;
+					bottom: 0;
+					.img {
+						width: 20rpx;
+						height: 20rpx;
+						flex-shrink: 0;
+					}
+					.stock-num {
+						padding-left: 7rpx;
+						font-size: 22rpx;
+						border-radius: 5rpx;
+						height: 32rpx;
+						line-height: 32rpx;
+					}
+				}
+			}
+			.goods_name {
+				.goods_title {
+					padding-top: 15rpx;
+					color:rgba(0,0,0,1);
+					// white-space: nowrap;
+					// overflow: hidden;
+					// text-overflow: ellipsis;
+					font-size:32rpx;
+					color: $font-color-dark;
+					// height: 70rpx;
+					align-items: baseline;
+					.text{
+						border-radius: 8rpx;
+						border: 2rpx solid #FF1A27;
+						color: #FF1A27;
+						padding:0rpx 10rpx;
+						font-size: 26rpx !important;
+						margin-right: 15rpx;
+						
+					}
+					.title {
+						width: 80%;
+						overflow : hidden;
+						text-overflow: ellipsis;
+						display: -webkit-box;
+						-webkit-line-clamp: 2;
+						-webkit-box-orient: vertical;
+					}
+				}
+				.goods-height {
+					min-height: 60rpx;
+				}
+				.goods_num {
+					font-size: 26rpx;
+					color: #8f8f97;
+					padding-bottom: 15rpx;
+				}
+				.goods-peplo {
+					height: 45rpx;
+					margin-top: 15rpx;
+					.right {
+						color:#8e8e8e;
+						font-size: 24rpx;
+						width:195rpx;
+						image {
+							width: 30rpx;
+							height: 33rpx;
+							margin-right: 15rpx;
+						}
+					}
+					.goods-tip {
+						.peplo {
+							background:linear-gradient(14deg,rgba(255,116,37,1),rgba(255,30,41,1));
+							padding: 5rpx 10rpx;
+							color: #ffffff;
+							border-top-left-radius:8rpx;
+							border-bottom-left-radius: 8rpx;
+						}
+						.make {
+							background-color: #fef26f;
+							color: #944722;
+							border-top-right-radius: 8rpx;
+							border-bottom-right-radius: 8rpx;
+						}
+						.make,
+						.peplo {
+							font-size: $font-sm;
+							padding: 5rpx 10rpx;
+						}
+					}
+				}
+				.price {
+					font-size: 28rpx;
+					position: relative;
+					padding-top: 15rpx;
+					.price_list {
+						.price-red {
+							font-size: 30rpx !important;
+							font-family: Source Han Sans CN;
+							color: rgba(253, 27, 42, 1);
+							font-size: $font-base;
+							font-weight: bold;
+							.moneyIcon {
+								font-weight: normal !important; 
+							}
+							.money {
+								font-size: 58rpx;
+							}
+							.moneyType {
+								font-weight: 400;
+							}
+							.outMoney {
+								font-weight: 400;
+								text-decoration: line-through;
+								color: rgba(142, 142, 142, 1);
+							}
+						}
+						.price-green {
+							color: #2dbd59;
+							font-size: 26rpx !important;
+							font-weight: bold;
+							text {
+								background: linear-gradient(45deg, rgba(21, 197, 52, 1), rgba(21, 197, 52, 1));
+								color: #ffffff;
+								padding: 0rpx 10rpx;
+								border-radius: 7rpx;
+								font-size: 24rpx !important;
+								margin-left: 15rpx;
+							}
+						}
+					}
+					.img {
+						width: 265rpx;
+						height: 74rpx;
+						line-height: 74rpx;
+						// background:linear-gradient(14deg,rgba(255,116,37,1),rgba(255,30,41,1));
+						background: linear-gradient(270deg, rgba(181,116,242, 1) 0%, rgba(139,86,254, 1) 100%);
+						border-radius: 99rpx;
+						color: #ffffff;
+						font-size: $font-lg;
+						text-align: center;
+					}
+					.img1{
+						background-color: #D3D3D3;
+						width: 265rpx;
+						height: 74rpx;
+						line-height: 74rpx;
+						border-radius: 99rpx;
+						color: #ffffff;
+						font-size: $font-lg;
+						text-align: center;
+					}
+					.tomorrow {
+						background: #29a66e;
+						color: #ffffff;
+						border-radius: 25rpx;
+						padding: 10rpx 25rpx;
+					}
+				}
+			}
+		}
+		
+		
+		.other-2{
+			width: 100%;
+			background:#ffffff;
+			padding: 10rpx 15rpx ;
+			border-radius: 20rpx;
+			.content-row{
+				padding: 10rpx 0;
+				.row-1{
+					width: 210rpx;
+					position: relative;
+					margin-right: 20rpx;
+					text-align: center;
+					.row-1-1{
+						text-align: center;
+						height:40rpx;
+						background:#fff1ee;
+						border-radius:6rpx;
+						font-size:22rpx;
+						font-weight:500;
+						color:#fb4912;
+						line-height:40rpx;
+						image{
+							width: 23rpx;
+							height: 23rpx;
+							margin-right: 5rpx;
+						}
+					}
+					.img1{
+						width:170rpx;
+						height:170rpx;
+						border-radius:10rpx;
+					}
+					.img2{
+						position: absolute;
+						top: 0;
+						left: 16rpx;
+						width:80rpx;
+						height:32rpx;
+						border-radius:5px;
+					}
+				}
+				.row-2{
+					padding: 20rpx 0 20rpx 0;
+					width:calc(100% - 210rpx);
+					position: relative;
+					
+					border-bottom: 1px solid #EAEAEA;
+					.word-1{
+						font-size:32rpx;
+						font-weight:bold;
+						color:#141821;
+						margin-left: 10rpx;
+						overflow: hidden;
+						text-overflow: ellipsis;
+						white-space: nowrap;
+					}
+					.word-2{
+						margin-top: 10rpx;
+						font-size:24rpx;
+						color:#979797;
+					}
+					.word-3{
+						margin-top: 10rpx;
+						position: relative;
+						font-size:20rpx;
+						color:#ffffff;
+						image{
+							width: 235rpx;
+							height: 50rpx;
+						}
+						.word-3-1{
+							position: absolute;
+							top:8px;
+							left:2px;
+							width: 230rpx;
+							text-align: center;
+							.word-3-1-1{
+								display: inline-block;
+								color:#FD1B2A;
+								width: 50%;
+							}
+							
+						}
+					}
+					.word-4{
+						margin-top: 15rpx;
+						font-size:23rpx;
+						color:#fd1b2a;
+						margin-left: 10rpx;
+						text{
+							font-size:23rpx;
+							font-weight:bold;
+						}
+						.word-4-1{
+							font-size:36rpx;
+						}
+					}
+					.word-5{
+						margin-top: 15rpx;
+						font-size:21rpx;
+						color:#868686;
+					}
+					.button{
+						width:145rpx;
+						height:60rpx;
+						background:linear-gradient(14deg,#ff7425,#ff1e29);
+						border-radius:30rpx;
+						font-size:27rpx;
+						font-weight:bold;
+						color:#ffffff;
+						line-height:60rpx;
+						text-align: center;
+						
+						position: absolute;
+						bottom: 20rpx;
+						right: 0;
+					}
+				}
+			}
+		}
+	}
+</style>

+ 68 - 0
components/returnButton.vue

@@ -0,0 +1,68 @@
+<template>
+	<view class="content">
+		<view class="retun-Box" @click="navTo('/pages/order/order?state=0')">
+			<image class="return-img" src=".././static/tabBar/dingdan.png"></image>
+			<view class="return-text">订单</view>
+		</view>
+		<view class="retun-Box" @click="GoHome">
+			<image class="return-img" src=".././static/tabBar/home.png" ></image>
+			<view class="return-text">首页</view>
+		</view>
+	</view>
+</template>
+
+<script>
+export default {
+	props: {
+		
+	},
+	data() {
+		return {
+			
+		}
+	},
+	methods: {
+		navTo(url) {
+			uni.navigateTo({
+				url: url
+			})
+		},
+		GoHome() {
+			// uni.navigateTo({
+			// 	url: '/pages/groupBooking/index'
+			// })
+			uni.switchTab({
+				url: '/pages/index/index'
+			})
+		}
+	}
+}
+</script>
+
+<style lang="scss">
+.content {
+	position: fixed;
+	right: 0;
+	bottom: 330rpx;
+	.retun-Box {
+		border-radius: 50%;
+		background: #FFFFFF;
+		width: 100rpx;
+		height: 100rpx;
+		margin-top: 30rpx;
+		display: flex;
+		flex-direction: column;
+		align-items: center;
+		justify-content: center;
+		box-shadow: 0 6rpx 20rpx #888888;
+		.return-img {
+			width: 40rpx;
+			height: 40rpx;
+		}
+		.return-text {
+			font-size: $font-sm;
+			margin-top: 8rpx;
+		}
+	}
+}
+</style>

+ 246 - 0
components/seckill/seckill.vue

@@ -0,0 +1,246 @@
+<template>
+	<view class="seckill-section m-t" v-if="show">
+		<view class="s-header">
+			<view class="f-left-icon"></view>
+			<view class="tit-box"><text class="tit">限时秒杀</text></view>
+			<view class="tip-box">
+				<text class="tip" v-if="status == 1">{{ showTime }}点场结束</text>
+				<text class="tip" v-if="status == 2">距离下场开始</text>
+				<text class="tip" v-if="status == 0">当天活动已结束</text>
+				<uni-countdown v-if="status == 1 || status == 2" :show-day="false" :hour="stopTimeH" :minute="stopTimeM" :second="stopTimeS"></uni-countdown>
+			</view>
+			<view class="textNav iconfont iconenter" @click="navTo('/pages/product/seckill')">更多</view>
+		</view>
+		<scroll-view class="floor-list" scroll-x>
+			<view class="scoll-wrapper position-relative" @click="navTo('/pages/product/seckill')">
+				<view v-for="(item, index) in list" :key="index" class="floor-item">
+					<image class="list-image" :src="item.image" mode="aspectFill"></image>
+					<text class="title clamp">{{ item.title }}</text>
+					<text class="price">¥{{ item.price }}</text>
+				</view>
+				<view v-if="list.length == 0" class="floor-item ">
+					<image class="list-image" mode="aspectFill"></image>
+					<text class="title clamp"></text>
+					<text class="price"></text>
+				</view>
+				<view v-if="list.length == 0" class="noGoodsBg"><view>敬请期待</view></view>
+			</view>
+		</scroll-view>
+	</view>
+</template>
+
+<script>
+import uniCountdown from '@/components/uni-countdown/uni-countdown.vue';
+import { getSeckillList, getSeckillClass } from '@/api/product.js';
+import { timeComputed } from '@/utils/rocessor.js';
+export default {
+	components: {
+		uniCountdown
+	},
+	data() {
+		return {
+			list: [],
+			page: 1,
+			limit: 10,
+			showTime: '', //显示的时间
+			showTImeId: '', //显示时间id用于查询数据
+			stopTimeH: 0,
+			stopTimeM: 0,
+			stopTimeS: 0,
+			// 判断是否所有活动已经结束
+			stop: false, //活动是否已经结束
+			show: false, //是否显示活动
+			status: 0 //获取状态值1为有活动开始中 2为活动未开始 0为活动已经结束
+		};
+	},
+	created: function(e) {
+		// 载入分类
+		this.getClass();
+	},
+	methods: {
+		navTo(url) {
+			uni.navigateTo({
+				url
+			});
+		},
+		getList() {
+			getSeckillList(
+				{
+					page: this.page,
+					limit: this.limit
+				},
+				this.showTImeId
+			)
+				.then(e => {
+					this.list = e.data;
+				})
+				.catch(e => {
+					console.log(e);
+				});
+		},
+		getClass() {
+			let obj = this;
+			getSeckillClass({})
+				.then(({ data }) => {
+					let arr = data.seckillTime;
+					// 用于判断是否有数据
+					let showDate = false;
+					for (var i = 0; i < arr.length; i++) {
+						let ar = arr[i];
+						if (ar.status === 1 || ar.status === 2) {
+							obj.status = ar.status;
+							// 保存要显示的场次时间
+							obj.showTime = ar.time;
+							// 保存要显示活动商品的id
+							obj.showTImeId = ar.id;
+							// 保存当前状态值
+							// 计算倒计时时间
+							if (ar.status === 1) {
+								obj.timeComputed(ar.stop * 1000);
+							} else {
+								// 获取需要开始
+								let arTime = ar.time.split(':');
+								let h = arTime[0];
+								let m = arTime[1];
+								let time = new Date();
+								// 设置时间
+								time.setHours(h, m, 0);
+								obj.timeComputed(time.getTime());
+							}
+							// 获取商品列表
+							obj.getList();
+							// 保存当前有活动在举行
+							showDate = true;
+							// 任务查询结束跳出循环
+							break;
+						}
+					}
+					// 判断是否有活动
+					if (arr.length > 0) {
+						obj.show = true;
+					}
+					// 判断今天活动是否已经全部结束
+					if (!showDate) {
+						// 保存活动结束最后一个小时的活动商品
+						obj.showTImeId = arr[arr.length - 1].id;
+						// 活动已经结束
+						obj.status = 0;
+						// 获取结束时的商品
+						obj.getList();
+						console.log(obj.status);
+					}
+					// 如果所有场次均已经结束
+				})
+				.catch(e => {
+					uni.showModal({
+						title: JSON.stringify(e)
+					});
+				});
+		},
+		// 计算倒计时时间
+		timeComputed(da) {
+			let obj = this;
+			let stopTime = timeComputed(da)
+			obj.stopTimeH =stopTime.hours;
+			obj.stopTimeM = stopTime.minutes;
+			obj.stopTimeS =stopTime.seconds;
+		}
+	}
+};
+</script>
+
+<style lang="scss">
+/* 秒杀专区 */
+.seckill-section {
+	padding: 4rpx 30rpx 24rpx;
+	.s-header {
+		display: flex;
+		align-items: center;
+		height: 92rpx;
+		line-height: 1;
+		.tit-box {
+			flex-shrink: 0;
+		}
+		.tit {
+			@extend %font-title;
+		}
+		.f-left-icon {
+			@extend %f-left-icon;
+		}
+		.textNav {
+			line-height: 1;
+			padding: 15rpx 0;
+			flex-shrink: 0;
+			flex-grow: 1;
+			min-width: 100rpx;
+		}
+		.tip-box {
+			flex-grow: 1;
+			display: flex;
+			justify-content: flex-start;
+			align-items: center;
+		}
+		.tip {
+			font-size: $font-sm;
+			color: $font-color-light;
+			padding-left: 10rpx;
+			padding-right: 10rpx;
+		}
+		.timer {
+			display: inline-block;
+			width: 40rpx;
+			height: 36rpx;
+			text-align: center;
+			line-height: 36rpx;
+			margin-right: 14rpx;
+			font-size: $font-sm + 2rpx;
+			color: #fff;
+			border-radius: 2px;
+			background: rgba(0, 0, 0, 0.8);
+		}
+		.iconenter {
+			font-size: $font-sm;
+			color: $font-color-light;
+			flex: 1;
+			text-align: right;
+		}
+	}
+	.floor-list {
+		white-space: nowrap;
+		background-color: white;
+		padding: 20rpx;
+		border-radius: 5rpx;
+		box-shadow: $box-shadow;
+	}
+	.scoll-wrapper {
+		display: flex;
+		align-items: flex-start;
+		.noGoodsBg {
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			height: 100%;
+			position: absolute;
+			top: 0;
+			left: 0;
+			width: 100%;
+			color: $font-color-light;
+		}
+		.floor-item {
+			width: 150rpx;
+			margin-right: 20rpx;
+			font-size: $font-sm + 2rpx;
+			color: $font-color-dark;
+			line-height: 1.8;
+			.list-image {
+				width: 150rpx;
+				height: 150rpx;
+				border-radius: 6rpx;
+			}
+			.price {
+				color: $color-red;
+			}
+		}
+	}
+}
+</style>

+ 6 - 27
components/ss-calendar/ss-calendar.vue

@@ -1,7 +1,6 @@
 <template>
 	<view class="calendar__wrap">
 		<view class="header">
-			<view class="leiji-data">您已累计签到<text class="lj-date-num">{{ allSign }}</text>天</view>
 			<view class="current-date">{{ currentDate }}</view>
 		</view>
 		<view class="body">
@@ -33,10 +32,6 @@ export default {
 				return [];
 			}
 		},
-		allSign: {
-			type: Number,
-			default: '0'
-		},
 		// 选中物品的样式类
 		checksClass: {
 			type: String,
@@ -91,6 +86,7 @@ export default {
 		},
 		// 获取当前日期
 		getDate(current) {
+			console.log(current);
 			const date = current ? new Date(current) : new Date();
 			const year = date.getFullYear();
 			// 月份值默认从0开始
@@ -149,32 +145,15 @@ export default {
 
 <style lang="scss" scoped>
 .calendar__wrap {
-	border-radius: 20rpx;
 	background-color: #fff;
 	color: $uni-text-color;
 	.header {
-		padding: 24rpx;
-		display: flex;
-		align-items: center;
-		justify-content: space-between;
-		.leiji-data {
-			font-size: 22rpx;
-			font-family: PingFang SC;
-			font-weight: 500;
-			color: #999999;
-			.lj-date-num {
-				color: #F85007;
-			}
-		}
+		padding: 0 24rpx;
 		.current-date {
-			// text-align: center;
-			// font-size: $font-lg + 2rpx;
+			text-align: center;
+			font-size: $font-lg + 2rpx;
 			// border-bottom: 2rpx solid #eee;
-			// padding: 32rpx 0;
-			font-size: 28rpx;
-			font-family: PingFang SC;
-			font-weight: 500;
-			color: #333333;
+			padding: 32rpx 0;
 		}
 	}
 	.body {
@@ -196,7 +175,7 @@ export default {
 				justify-content: center;
 				width: 14.285%;
 				text-align: center;
-				padding: 20rpx 0;
+				padding: 30rpx 0;
 				font-size: 34rpx;
 				color: $font-color-light;
 				.checked-box,

+ 5 - 10
components/tki-qrcode/qrcode.js

@@ -1084,7 +1084,7 @@ let QRCode = {};
         }
         // 创建canvas
         let createCanvas = function (options) {
-            if(options.showLoading){
+            if (options.showLoading) {
                 uni.showLoading({
                     title: options.loadingText,
                     mask: true
@@ -1150,14 +1150,7 @@ let QRCode = {};
                             quality: Number(1),
                             success: function (res) {
                                 if (options.cbResult) {
-                                    // 由于官方还没有统一此接口的输出字段,所以先判定下  支付宝为 res.apFilePath
-                                    if (!empty(res.tempFilePath)) {
-                                        options.cbResult(res.tempFilePath)
-                                    } else if (!empty(res.apFilePath)) {
-                                        options.cbResult(res.apFilePath)
-                                    } else {
-                                        options.cbResult(res.tempFilePath)
-                                    }
+                                    options.cbResult(res.tempFilePath)
                                 }
                             },
                             fail: function (res) {
@@ -1166,7 +1159,9 @@ let QRCode = {};
                                 }
                             },
                             complete: function () {
-                                uni.hideLoading();
+                                if (options.showLoading){
+                                    uni.hideLoading();
+                                }
                             },
                         }, options.context);
                     }, options.text.length + 100);

+ 15 - 19
components/tki-qrcode/tki-qrcode.vue

@@ -1,9 +1,15 @@
 <template xlang="wxml" minapp="mpvue">
 	<view class="tki-qrcode">
+		<!-- #ifndef MP-ALIPAY -->
 		<canvas class="tki-qrcode-canvas" :canvas-id="cid" :style="{width:cpSize+'px',height:cpSize+'px'}" />
-		<image class="img" v-show="show" :src="result" :style="{width:cpSize+'px',height:cpSize+'px'}" />
+		<!-- #endif -->
+		<!-- #ifdef MP-ALIPAY -->
+		<canvas :id="cid" :width="cpSize" :height="cpSize" class="tki-qrcode-canvas" />
+		<!-- #endif -->
+		<image v-show="show" :src="result" :style="{width:cpSize+'px',height:cpSize+'px'}" />
 	</view>
 </template>
+
 <script>
 import QRCode from "./qrcode.js"
 let qrcode
@@ -20,7 +26,7 @@ export default {
 		},
 		unit: {
 			type: String,
-			default: 'rpx'
+			default: 'upx'
 		},
 		show: {
 			type: Boolean,
@@ -82,7 +88,6 @@ export default {
 	},
 	methods: {
 		_makeCode() {
-			// console.log(this.val,55)
 			let that = this
 			if (!this._empty(this.val)) {
 				qrcode = new QRCode({
@@ -123,9 +128,8 @@ export default {
 					success: function () {
 						uni.showToast({
 							title: '二维码保存成功',
-							icon: 'none',
-							duration: 2000,
-							
+							icon: 'success',
+							duration: 2000
 						});
 					}
 				});
@@ -154,7 +158,6 @@ export default {
 	},
 	watch: {
 		size: function (n, o) {
-			// console.log(11)
 			if (n != o && !this._empty(n)) {
 				this.cSize = n
 				if (!this._empty(this.val)) {
@@ -196,19 +199,12 @@ export default {
 </script>
 <style>
 .tki-qrcode {
-	height: 100%;
+  position: relative;
 }
 .tki-qrcode-canvas {
-  position: relative;
- top: 0rpx;
-  left: -99999rpx;
-  /* z-index: -99999; */
+  position: fixed;
+  top: -99999upx;
+  left: -99999upx;
+  z-index: -99999;
 }
-/* canvas{
-	display: none;
-	} */
-	.img{
-		margin-top: -240rpx !important;
-		height: 100%;
-	}
 </style>

+ 18 - 30
components/uni-countdown/uni-countdown.vue

@@ -1,12 +1,12 @@
 <template>
 	<view class="uni-countdown">
-		<text v-if="showDay" :style="{ borderColor: borderColor, width: width, color: color, backgroundColor: backgroundColor }" class="uni-countdown__number">{{ d }}</text>
+		<text v-if="showDay" :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }" class="uni-countdown__number">{{ d }}</text>
 		<text v-if="showDay" :style="{ color: splitorColor }" class="uni-countdown__splitor">天</text>
-		<text :style="{ borderColor: borderColor, width: width, color: color, backgroundColor: backgroundColor }" class="uni-countdown__number">{{ h }}</text>
+		<text :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }" class="uni-countdown__number">{{ h }}</text>
 		<text :style="{ color: splitorColor }" class="uni-countdown__splitor">{{ showColon ? ':' : '时' }}</text>
-		<text :style="{ borderColor: borderColor, width: width, color: color, backgroundColor: backgroundColor }" class="uni-countdown__number">{{ i }}</text>
+		<text :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }" class="uni-countdown__number">{{ i }}</text>
 		<text :style="{ color: splitorColor }" class="uni-countdown__splitor">{{ showColon ? ':' : '分' }}</text>
-		<text :style="{ borderColor: borderColor, width: width, color: color, backgroundColor: backgroundColor }" class="uni-countdown__number">{{ s }}</text>
+		<text :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }" class="uni-countdown__number">{{ s }}</text>
 		<text v-if="!showColon" :style="{ color: splitorColor }" class="uni-countdown__splitor">秒</text>
 	</view>
 </template>
@@ -30,10 +30,6 @@
 				type: String,
 				default: '#000000'
 			},
-			width: {
-				type: String,
-				default: '52rpx'
-			},
 			color: {
 				type: String,
 				default: '#000000'
@@ -42,22 +38,10 @@
 				type: String,
 				default: '#000000'
 			},
-			day: {
-				type: Number,
-				default: 0
-			},
-			hour: {
-				type: Number,
-				default: 0
-			},
-			minute: {
-				type: Number,
-				default: 0
-			},
-			second: {
-				type: Number,
-				default: 0
-			}
+			day:0,
+			hour:0,
+			minute:0,
+			second:0
 		},
 		data() {
 			return {
@@ -93,7 +77,7 @@
 		},
 		methods: {
 			toSeconds(day, hours, minutes, seconds) {
-				return ( day || 0 ) * 60 * 60 * 24 + hours * 60 * 60 + minutes * 60 + seconds
+				return day * 60 * 60 * 24 + hours * 60 * 60 + minutes * 60 + seconds
 			},
 			timeUp() {
 				clearInterval(this.timer)
@@ -110,6 +94,7 @@
 				} else {
 					this.timeUp()
 				}
+				hour = hour + (day*24)
 				if (day < 10) {
 					day = '0' + day
 				}
@@ -145,6 +130,7 @@
 			changeFlag() {
 				if (!this.syncFlag) {
 					this.seconds = this.toSeconds(this.day, this.hour, this.minute, this.second)
+					console.log(this.seconds)
 					this.startData();
 					this.syncFlag = true;
 				}
@@ -154,8 +140,8 @@
 </script>
 <style lang="scss" scoped>
 	@import '~@/uni.scss';
-	$countdown-height: 48rpx;
-	$countdown-width: 52rpx;
+	$countdown-height: 40rpx;
+	$countdown-width: 40rpx;
 
 	.uni-countdown {
 		/* #ifndef APP-NVUE */
@@ -163,7 +149,9 @@
 		/* #endif */
 		flex-direction: row;
 		justify-content: flex-start;
-		padding: 2rpx 0;
+		position: relative;
+		top: 5rpx;
+		left: 15rpx;
 	}
 
 	.uni-countdown__splitor {
@@ -185,9 +173,9 @@
 		width: $countdown-width;
 		height: $countdown-height;
 		line-height: $countdown-height;
-		margin: 5rpx;
+		// margin: 5rpx;
 		text-align: center;
 		font-size: $uni-font-size-sm;
-		border-radius: 10rpx;
+		border-radius: 8rpx;
 	}
 </style>

+ 6 - 10
components/uni-countdown/uni-countdowns.vue

@@ -1,18 +1,18 @@
 <template>
 	<view class="uni-countdown">
-		<text v-if="showDay" :style="{ borderColor: borderColor, width: width, color: color, backgroundColor: backgroundColor }" class="uni-countdown__number">{{ d }}</text>
+		<text v-if="showDay" :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }" class="uni-countdown__number">{{ d }}</text>
 		<text v-if="showDay" :style="{ color: splitorColor }" class="uni-countdown__splitor">天</text>
-		<text :style="{ borderColor: borderColor, width: width, color: color, backgroundColor: backgroundColor }" class="uni-countdown__number">{{ h }}</text>
+		<text :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }" class="uni-countdown__number">{{ h }}</text>
 		<text :style="{ color: splitorColor }" class="uni-countdown__splitor">{{ showColon ? ':' : '时' }}</text>
-		<text :style="{ borderColor: borderColor, width: width, color: color, backgroundColor: backgroundColor }" class="uni-countdown__number">{{ i }}</text>
+		<text :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }" class="uni-countdown__number">{{ i }}</text>
 		<text :style="{ color: splitorColor }" class="uni-countdown__splitor">{{ showColon ? ':' : '分' }}</text>
-		<text :style="{ borderColor: borderColor, width: width, color: color, backgroundColor: backgroundColor }" class="uni-countdown__number">{{ s }}</text>
+		<text :style="{ borderColor: borderColor, color: color, backgroundColor: backgroundColor }" class="uni-countdown__number">{{ s }}</text>
 		<text v-if="!showColon" :style="{ color: splitorColor }" class="uni-countdown__splitor">秒</text>
 	</view>
 </template>
 <script>
 	export default {
-		name: 'UniCountdowns',
+		name: 'UniCountdown',
 		props: {
 			showDay: {
 				type: Boolean,
@@ -30,10 +30,6 @@
 				type: String,
 				default: '#000000'
 			},
-			width: {
-				type: String,
-				default: '52rpx'
-			},
 			color: {
 				type: String,
 				default: '#000000'
@@ -93,7 +89,7 @@
 		},
 		methods: {
 			toSeconds(day, hours, minutes, seconds) {
-				return ( day || 0 ) * 60 * 60 * 24 + hours * 60 * 60 + minutes * 60 + seconds
+				return day * 60 * 60 * 24 + hours * 60 * 60 + minutes * 60 + seconds
 			},
 			timeUp() {
 				clearInterval(this.timer)

文件差异内容过多而无法显示
+ 0 - 0
components/uni-icons/uni-icons.vue


+ 2 - 2
components/uni-list-item/uni-list-item.vue

@@ -21,7 +21,7 @@
 			</view>
 			<view v-if="showBadge || showArrow || showSwitch" class="uni-list-item__extra">
 				<uni-badge v-if="showBadge" :type="badgeType" :text="badgeText" />
-				<switch v-if="showSwitch" :color="switchColor" :disabled="disabled" :checked="switchChecked" @change="onSwitchChange" />
+				<switch class="itemSwitch" v-if="showSwitch" :color="switchColor" :disabled="disabled" :checked="switchChecked" @change="onSwitchChange" />
 				<uni-icons v-if="showArrow" :size="20" class="uni-icon-wrapper" color="#bbb" type="arrowright" />
 			</view>
 		</view>
@@ -220,7 +220,7 @@
 		width: $uni-img-size-base;
 	}
 	// 修改switch默认大小
-	switch{
+	.itemSwitch{
 		transform: translateX(16rpx) scale(.84);
 	}
 	.uni-list-item__slot{

+ 33 - 33
components/uni-load-more/uni-load-more.vue

@@ -1,23 +1,23 @@
 <template>
 	<view class="uni-load-more">
 		<view class="uni-load-more__img" v-show="status === 'loading' && showIcon">
-			<view class="load1">
-				<view :style="{background:color}"></view>
-				<view :style="{background:color}"></view>
-				<view :style="{background:color}"></view>
-				<view :style="{background:color}"></view>
+			<view class="load1 load">
+				<view class="item" :style="{background:color}"></view>
+				<view class="item" :style="{background:color}"></view>
+				<view class="item" :style="{background:color}"></view>
+				<view class="item" :style="{background:color}"></view>
 			</view>
-			<view class="load2">
-				<view :style="{background:color}"></view>
-				<view :style="{background:color}"></view>
-				<view :style="{background:color}"></view>
-				<view :style="{background:color}"></view>
+			<view class="load2 load">
+				<view class="item" :style="{background:color}"></view>
+				<view class="item"  :style="{background:color}"></view>
+				<view class="item" :style="{background:color}"></view>
+				<view class="item" :style="{background:color}"></view>
 			</view>
-			<view class="load3">
-				<view :style="{background:color}"></view>
-				<view :style="{background:color}"></view>
-				<view :style="{background:color}"></view>
-				<view :style="{background:color}"></view>
+			<view class="load3 load">
+				<view class="item" :style="{background:color}"></view>
+				<view class="item" :style="{background:color}"></view>
+				<view class="item" :style="{background:color}"></view>
+				<view class="item" :style="{background:color}"></view>
 			</view>
 		</view>
 		<text class="uni-load-more__text" :style="{color:color}">{{status === 'more' ? contentText.contentdown : (status === 'loading' ? contentText.contentrefresh : contentText.contentnomore)}}</text>
@@ -80,11 +80,11 @@
 		margin-right: 10px
 	}
 
-	.uni-load-more__img>view {
+	.uni-load-more__img>.load {
 		position: absolute
 	}
 
-	.uni-load-more__img>view view {
+	.uni-load-more__img>.load .item {
 		width: 6px;
 		height: 2px;
 		border-top-left-radius: 1px;
@@ -96,25 +96,25 @@
 		animation: load 1.56s ease infinite
 	}
 
-	.uni-load-more__img>view view:nth-child(1) {
+	.uni-load-more__img>.load .item:nth-child(1) {
 		transform: rotate(90deg);
 		top: 2px;
 		left: 9px
 	}
 
-	.uni-load-more__img>view view:nth-child(2) {
+	.uni-load-more__img>.load .item:nth-child(2) {
 		transform: rotate(180deg);
 		top: 11px;
 		right: 0
 	}
 
-	.uni-load-more__img>view view:nth-child(3) {
+	.uni-load-more__img>.load .item:nth-child(3) {
 		transform: rotate(270deg);
 		bottom: 2px;
 		left: 9px
 	}
 
-	.uni-load-more__img>view view:nth-child(4) {
+	.uni-load-more__img>.load .item:nth-child(4) {
 		top: 11px;
 		left: 0
 	}
@@ -134,51 +134,51 @@
 		transform: rotate(60deg)
 	}
 
-	.load1 view:nth-child(1) {
+	.load1 .item:nth-child(1) {
 		animation-delay: 0s
 	}
 
-	.load2 view:nth-child(1) {
+	.load2 .item:nth-child(1) {
 		animation-delay: .13s
 	}
 
-	.load3 view:nth-child(1) {
+	.load3 .item:nth-child(1) {
 		animation-delay: .26s
 	}
 
-	.load1 view:nth-child(2) {
+	.load1 .item:nth-child(2) {
 		animation-delay: .39s
 	}
 
-	.load2 view:nth-child(2) {
+	.load2 .item:nth-child(2) {
 		animation-delay: .52s
 	}
 
-	.load3 view:nth-child(2) {
+	.load3 .item:nth-child(2) {
 		animation-delay: .65s
 	}
 
-	.load1 view:nth-child(3) {
+	.load1 .item:nth-child(3) {
 		animation-delay: .78s
 	}
 
-	.load2 view:nth-child(3) {
+	.load2 .item:nth-child(3) {
 		animation-delay: .91s
 	}
 
-	.load3 view:nth-child(3) {
+	.load3 .item:nth-child(3) {
 		animation-delay: 1.04s
 	}
 
-	.load1 view:nth-child(4) {
+	.load1 .item:nth-child(4) {
 		animation-delay: 1.17s
 	}
 
-	.load2 view:nth-child(4) {
+	.load2 .item:nth-child(4) {
 		animation-delay: 1.3s
 	}
 
-	.load3 view:nth-child(4) {
+	.load3 .item:nth-child(4) {
 		animation-delay: 1.43s
 	}
 

+ 49 - 27
components/uni-notice-bar/uni-notice-bar.vue

@@ -8,24 +8,20 @@
 			<uni-icons type="sound" :color="color" size="14" />
 		</view>
 		<!-- #endif -->
-		
-		
 		<!-- #ifndef MP-ALIPAY -->
 		<uni-icons v-if="showClose === true || showClose === 'true'" class="uni-noticebar-close" type="closefill" :color="color"
 		 size="12" @click="close" />
 		<uni-icons v-if="showIcon === true || showIcon === 'true'" class="uni-noticebar-icon" type="sound" :color="color"
 		 size="14" />
 		<!-- #endif -->
-		
-		
 		<view ref="textBox" class="uni-noticebar__content-wrapper" :class="{'uni-noticebar__content-wrapper--scrollable':scrollable, 'uni-noticebar__content-wrapper--single':!scrollable && (single || moreText)}">
 			<view :id="elIdBox" class="uni-noticebar__content" :class="{'uni-noticebar__content--scrollable':scrollable, 'uni-noticebar__content--single':!scrollable && (single || moreText)}">
 				<text :id="elId" ref="animationEle" class="uni-noticebar__content-text" :class="{'uni-noticebar__content-text--scrollable':scrollable,'uni-noticebar__content-text--single':!scrollable && (single || moreText)}"
-				 :style="{color:color, width:wrapWidth+'px', 'animationDuration': animationDuration, '-webkit-animationDuration': animationDuration ,animationPlayState: webviewHide?'paused':animationPlayState,'-webkit-animationPlayState':webviewHide?'paused':animationPlayState, animationDelay: animationDelay, '-webkit-animationDelay':animationDelay}">{{text}}111</text>
+				 :style="{color:color, width:wrapWidth+'px', 'animationDuration': animationDuration, '-webkit-animationDuration': animationDuration ,animationPlayState: webviewHide?'paused':animationPlayState,'-webkit-animationPlayState':webviewHide?'paused':animationPlayState, animationDelay: animationDelay, '-webkit-animationDelay':animationDelay}">{{text}}</text>
 			</view>
 		</view>
 		<view v-if="showGetMore === true || showGetMore === 'true'" class="uni-noticebar__more" @click="clickMore">
-			<text v-if="moreText" :style="{ color: moreColor }" class="uni-noticebar__more-text">{{ moreText }}222</text>
+			<text v-if="moreText" :style="{ color: moreColor }" class="uni-noticebar__more-text">{{ moreText }}</text>
 			<uni-icons type="arrowright" :color="moreColor" size="14" />
 		</view>
 	</view>
@@ -37,6 +33,27 @@
 	const dom = weex.requireModule('dom');
 	const animation = weex.requireModule('animation');
 	// #endif
+
+	/**
+	 * NoticeBar 自定义导航栏
+	 * @description 通告栏组件
+	 * @tutorial https://ext.dcloud.net.cn/plugin?id=30
+	 * @property {Number} speed 文字滚动的速度,默认100px/秒
+	 * @property {String} text 显示文字
+	 * @property {String} backgroundColor 背景颜色
+	 * @property {String} color 文字颜色
+	 * @property {String} moreColor 查看更多文字的颜色
+	 * @property {String} moreText 设置“查看更多”的文本
+	 * @property {Boolean} single = [true|false] 是否单行
+	 * @property {Boolean} scrollable = [true|false] 是否滚动,为true时,NoticeBar为单行
+	 * @property {Boolean} showIcon = [true|false] 是否显示左侧喇叭图标
+	 * @property {Boolean} showClose = [true|false] 是否显示左侧关闭按钮
+	 * @property {Boolean} showGetMore = [true|false] 是否显示右侧查看更多图标,为true时,NoticeBar为单行
+	 * @event {Function} click 点击 NoticeBar 触发事件
+	 * @event {Function} close 关闭 NoticeBar 触发事件
+	 * @event {Function} getmore 点击”查看更多“时触发事件
+	 */
+
 	export default {
 		name: 'UniNoticeBar',
 		components: {
@@ -53,16 +70,16 @@
 			},
 			backgroundColor: {
 				type: String,
-				default: '#ffffff'
+				default: '#fffbe8'
 			},
 			speed: {
 				// 默认1s滚动100px
-				type: [String, Number],
+				type: Number,
 				default: 100
 			},
 			color: {
 				type: String,
-				default: '#606266'
+				default: '#de8c17'
 			},
 			moreColor: {
 				type: String,
@@ -70,27 +87,27 @@
 			},
 			single: {
 				// 是否单行
-				type: [String, Boolean],
+				type: [Boolean, String],
 				default: false
 			},
 			scrollable: {
 				// 是否滚动,添加后控制单行效果取消
-				type: [String, Boolean],
+				type: [Boolean, String],
 				default: false
 			},
 			showIcon: {
 				// 是否显示左侧icon
-				type: [String, Boolean],
+				type: [Boolean, String],
 				default: false
 			},
 			showGetMore: {
 				// 是否显示右侧查看更多
-				type: [String, Boolean],
+				type: [Boolean, String],
 				default: false
 			},
 			showClose: {
 				// 是否显示左侧关闭按钮
-				type: [String, Boolean],
+				type: [Boolean, String],
 				default: false
 			}
 		},
@@ -110,13 +127,7 @@
 				show: true,
 				animationDuration: 'none',
 				animationPlayState: 'paused',
-				animationDelay: '0s',
-				textList:[
-					{id:0,name:'首页'},
-					{id:1,name:'分类'},
-					{id:2,name:'资讯'},
-					{id:3,name:'我的'},
-				]
+				animationDelay: '0s'
 			}
 		},
 		mounted() {
@@ -149,7 +160,9 @@
 						textWidth = 0;
 					let textQuery = new Promise((resolve, reject) => {
 						uni.createSelectorQuery()
+							// #ifndef MP-ALIPAY
 							.in(this)
+							// #endif
 							.select(`#${this.elId}`)
 							.boundingClientRect()
 							.exec(ret => {
@@ -159,7 +172,9 @@
 					})
 					let boxQuery = new Promise((resolve, reject) => {
 						uni.createSelectorQuery()
+							// #ifndef MP-ALIPAY
 							.in(this)
+							// #endif
 							.select(`#${this.elIdBox}`)
 							.boundingClientRect()
 							.exec(ret => {
@@ -265,11 +280,8 @@
 		/* #endif */
 		flex-direction: row;
 		align-items: center;
-		// padding: 6px 12px;
-		height: 88rpx;
+		padding: 6px 12px;
 		margin-bottom: 10px;
-		font-size: 14px;
-		background-color: #FFFFFF;
 	}
 
 	.uni-noticebar-close {
@@ -297,6 +309,13 @@
 		flex-direction: row;
 	}
 
+	/* #ifndef APP-NVUE */
+	.uni-noticebar__content-wrapper--scrollable {
+		position: relative;
+		height: 18px;
+	}
+	/* #endif */
+
 	.uni-noticebar__content--scrollable {
 		/* #ifdef APP-NVUE */
 		flex: 0;
@@ -330,7 +349,7 @@
 		lines: 1;
 		/* #endif */
 		/* #ifndef APP-NVUE */
-		display: inline-block;
+		display: block;
 		width: 100%;
 		white-space: nowrap;
 		/* #endif */
@@ -344,7 +363,10 @@
 		padding-left: 750rpx;
 		/* #endif */
 		/* #ifndef APP-NVUE */
-		display: inline-block;
+		position: absolute;
+		display: block;
+		height: 18px;
+		line-height: 18px;
 		white-space: nowrap;
 		padding-left: 100%;
 		animation: notice 10s 0s linear infinite both;

+ 5 - 9
components/uni-number-box.vue

@@ -151,23 +151,18 @@
 		align-items: center;
 		width:230rpx;
 		height: 70rpx;
-		background:#FFFFFF;
-		border:1px solid #cfcfcf;
-		border-radius:4px;
+		background:#f5f5f5;
 	}
 
 	.uni-numbox-minus,
 	.uni-numbox-plus {
 		margin: 0;
-		background-color: #F6F6F6;
+		background-color: #f5f5f5;
 		width: 70rpx;
 		height: 100%;
 		line-height: 70rpx;
 		text-align: center;
 		position: relative;
-		display: flex;
-		align-items:center;
-		justify-content: center;
 	}
 	.uni-numbox-minus .yticon,
 	.uni-numbox-plus .yticon{
@@ -189,11 +184,12 @@
 
 	.uni-numbox-value {
 		position: relative;
-		background-color: #FFFFFF;
+		background-color: #f5f5f5;
 		width: 90rpx;
+		height: 50rpx;
 		text-align: center;
 		padding: 0;
-		font-size: 18rpx;
+		font-size: 30rpx;
 	}
 
 	.uni-numbox-disabled.iconfont {

+ 243 - 0
components/uni-popup/uni-popup-dialog.vue

@@ -0,0 +1,243 @@
+<template>
+	<view class="uni-popup-dialog">
+		<view class="uni-dialog-title">
+			<text class="uni-dialog-title-text" :class="['uni-popup__'+dialogType]">{{title}}</text>
+		</view>
+		<view class="uni-dialog-content">
+			<text class="uni-dialog-content-text" v-if="mode === 'base'">{{content}}</text>
+			<input v-else class="uni-dialog-input" v-model="val" type="text" :placeholder="placeholder" :focus="focus" >
+		</view>
+		<view class="uni-dialog-button-group">
+			<view class="uni-dialog-button" @click="close">
+				<text class="uni-dialog-button-text">取消</text>
+			</view>
+			<view class="uni-dialog-button uni-border-left" @click="onOk">
+				<text class="uni-dialog-button-text uni-button-color">确定</text>
+			</view>
+		</view>
+
+	</view>
+</template>
+
+<script>
+	/**
+	 * PopUp 弹出层-对话框样式
+	 * @description 弹出层-对话框样式
+	 * @tutorial https://ext.dcloud.net.cn/plugin?id=329
+	 * @property {String} value input 模式下的默认值
+	 * @property {String} placeholder input 模式下输入提示
+	 * @property {String} type = [success|warning|info|error] 主题样式
+	 *  @value success 成功
+	 * 	@value warning 提示
+	 * 	@value info 消息
+	 * 	@value error 错误
+	 * @property {String} mode = [base|input] 模式、
+	 * 	@value base 基础对话框
+	 * 	@value input 可输入对话框
+	 * @property {String} content 对话框内容
+	 * @property {Boolean} beforeClose 是否拦截取消事件
+	 * @event {Function} confirm 点击确认按钮触发
+	 * @event {Function} close 点击取消按钮触发
+	 */
+
+	export default {
+		name: "uniPopupDialog",
+		props: {
+			value: {
+				type: [String, Number],
+				default: ''
+			},
+			placeholder: {
+				type: [String, Number],
+				default: '请输入内容'
+			},
+			/**
+			 * 对话框主题 success/warning/info/error	  默认 success
+			 */
+			type: {
+				type: String,
+				default: 'error'
+			},
+			/**
+			 * 对话框模式 base/input
+			 */
+			mode: {
+				type: String,
+				default: 'base'
+			},
+			/**
+			 * 对话框标题
+			 */
+			title: {
+				type: String,
+				default: '提示'
+			},
+			/**
+			 * 对话框内容
+			 */
+			content: {
+				type: String,
+				default: ''
+			},
+			/**
+			 * 拦截取消事件 ,如果拦截取消事件,必须监听close事件,执行 done()
+			 */
+			beforeClose: {
+				type: Boolean,
+				default: false
+			}
+		},
+		data() {
+			return {
+				dialogType: 'error',
+				focus: false,
+				val: ""
+			}
+		},
+		inject: ['popup'],
+		watch: {
+			type(val) {
+				this.dialogType = val
+			},
+			mode(val) {
+				if (val === 'input') {
+					this.dialogType = 'info'
+				}
+			},
+			value(val) {
+				this.val = val
+			}
+		},
+		created() {
+			// 对话框遮罩不可点击
+			this.popup.mkclick = false
+			if (this.mode === 'input') {
+				this.dialogType = 'info'
+				this.val = this.value
+			} else {
+				this.dialogType = this.type
+			}
+		},
+		mounted() {
+			this.focus = true
+		},
+		methods: {
+			/**
+			 * 点击确认按钮
+			 */
+			onOk() {
+				this.$emit('confirm', () => {
+					this.popup.close()
+					if (this.mode === 'input') this.val = this.value
+				}, this.mode === 'input' ? this.val : '')
+			},
+			/**
+			 * 点击取消按钮
+			 */
+			close() {
+				if (this.beforeClose) {
+					this.$emit('close', () => {
+						this.popup.close()
+					})
+					return
+				}
+				this.popup.close()
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.uni-popup-dialog {
+		width: 300px;
+		border-radius: 15px;
+		background-color: #fff;
+	}
+
+	.uni-dialog-title {
+		/* #ifndef APP-NVUE */
+		display: flex;
+		/* #endif */
+		flex-direction: row;
+		justify-content: center;
+		padding-top: 15px;
+		padding-bottom: 5px;
+	}
+
+	.uni-dialog-title-text {
+		font-size: 16px;
+		font-weight: 500;
+	}
+
+	.uni-dialog-content {
+		/* #ifndef APP-NVUE */
+		display: flex;
+		/* #endif */
+		flex-direction: row;
+		justify-content: center;
+		align-items: center;
+		padding: 5px 15px 15px 15px;
+	}
+
+	.uni-dialog-content-text {
+		font-size: 14px;
+		color: #6e6e6e;
+	}
+
+	.uni-dialog-button-group {
+		/* #ifndef APP-NVUE */
+		display: flex;
+		/* #endif */
+		flex-direction: row;
+		border-top-color: #f5f5f5;
+		border-top-style: solid;
+		border-top-width: 1px;
+	}
+
+	.uni-dialog-button {
+		/* #ifndef APP-NVUE */
+		display: flex;
+		/* #endif */
+
+		flex: 1;
+		flex-direction: row;
+		justify-content: center;
+		align-items: center;
+		height: 45px;
+	}
+
+	.uni-border-left {
+		border-left-color: #f0f0f0;
+		border-left-style: solid;
+		border-left-width: 1px;
+	}
+
+	.uni-dialog-button-text {
+		font-size: 14px;
+	}
+
+	.uni-button-color {
+		color: $uni-color-primary;
+	}
+
+	.uni-dialog-input {
+		flex: 1;
+		font-size: 14px;
+	}
+
+	.uni-popup__success {
+		color: $uni-color-success;
+	}
+
+	.uni-popup__warn {
+		color: $uni-color-warning;
+	}
+
+	.uni-popup__error {
+		color: $uni-color-error;
+	}
+
+	.uni-popup__info {
+		color: #909399;
+	}
+</style>

+ 116 - 0
components/uni-popup/uni-popup-message.vue

@@ -0,0 +1,116 @@
+<template>
+	<view class="uni-popup-message" :class="'uni-popup__'+[type]">
+		<text class="uni-popup-message-text" :class="'uni-popup__'+[type]+'-text'">{{message}}</text>
+	</view>
+</template>
+
+<script>
+	
+	/**
+	 * PopUp 弹出层-消息提示
+	 * @description 弹出层-消息提示
+	 * @tutorial https://ext.dcloud.net.cn/plugin?id=329
+	 * @property {String} type = [success|warning|info|error] 主题样式
+	 *  @value success 成功
+	 * 	@value warning 提示
+	 * 	@value info 消息
+	 * 	@value error 错误
+	 * @property {String} message 消息提示文字
+	 * @property {String} duration 显示时间,设置为 0 则不会自动关闭
+	 */
+	
+	export default {
+		name: 'UniPopupMessage',
+		props: {
+			/**
+			 * 主题 success/warning/info/error	  默认 success
+			 */
+			type: {
+				type: String,
+				default: 'success'
+			},
+			/**
+			 * 消息文字
+			 */
+			message: {
+				type: String,
+				default: ''
+			},
+			/**
+			 * 显示时间,设置为 0 则不会自动关闭
+			 */
+			duration: {
+				type: Number,
+				default: 3000
+			}
+		},
+		inject: ['popup'],
+		data() {
+			return {}
+		},
+		created() {
+			this.popup.childrenMsg = this
+		},
+		methods: {
+			open() {
+				if (this.duration === 0) return
+				clearTimeout(this.popuptimer)
+				this.popuptimer = setTimeout(() => {
+					this.popup.close()
+				}, this.duration)
+			},
+			close() {
+				clearTimeout(this.popuptimer)
+			}
+		}
+	}
+</script>
+<style lang="scss" scoped>
+	.uni-popup-message {
+		/* #ifndef APP-NVUE */
+		display: flex;
+		/* #endif */
+		flex-direction: row;
+		background-color: #e1f3d8;
+		padding: 10px 15px;
+		border-color: #eee;
+		border-style: solid;
+		border-width: 1px;
+	}
+	.uni-popup-message-text {
+		font-size: 14px;
+		padding: 0;
+	}
+
+	.uni-popup__success {
+		background-color: #e1f3d8;
+	}
+
+	.uni-popup__success-text {
+		color: #67C23A;
+	}
+
+	.uni-popup__warn {
+		background-color: #faecd8;
+	}
+
+	.uni-popup__warn-text {
+		color: #E6A23C;
+	}
+
+	.uni-popup__error {
+		background-color: #fde2e2;
+	}
+
+	.uni-popup__error-text {
+		color: #F56C6C;
+	}
+
+	.uni-popup__info {
+		background-color: #F2F6FC;
+	}
+
+	.uni-popup__info-text {
+		color: #909399;
+	}
+</style>

+ 263 - 0
components/uni-popup/uni-popup-ori.vue

@@ -0,0 +1,263 @@
+<template>
+	<view v-if="showPopup" class="uni-popup" @touchmove.stop.prevent="clear">
+		<uni-transition :mode-class="['fade']" :styles="maskClass" :duration="duration" :show="showTrans" @click="onTap" />
+		<uni-transition :mode-class="ani" :styles="transClass" :duration="duration" :show="showTrans" @click="onTap">
+			<view class="uni-popup__wrapper-box" @click.stop="clear">
+				<slot />
+			</view>
+		</uni-transition>
+	</view>
+</template>
+
+<script>
+	import uniTransition from '../uni-transition/uni-transition.vue'
+
+	/**
+	 * PopUp 弹出层
+	 * @description 弹出层组件,为了解决遮罩弹层的问题
+	 * @tutorial https://ext.dcloud.net.cn/plugin?id=329
+	 * @property {String} type = [top|center|bottom] 弹出方式
+	 * 	@value top 顶部弹出
+	 * 	@value center 中间弹出
+	 * 	@value bottom 底部弹出
+	 * @property {Boolean} animation = [ture|false] 是否开启动画
+	 * @property {Boolean} maskClick = [ture|false] 蒙版点击是否关闭弹窗
+	 * @event {Function} change 打开关闭弹窗触发,e={show: false}
+	 */
+
+	export default {
+		name: 'UniPopup',
+		components: {
+			uniTransition
+		},
+		props: {
+			// 开启动画
+			animation: {
+				type: Boolean,
+				default: true
+			},
+			// 弹出层类型,可选值,top: 顶部弹出层;bottom:底部弹出层;center:全屏弹出层
+			type: {
+				type: String,
+				default: 'center'
+			},
+			// maskClick
+			maskClick: {
+				type: Boolean,
+				default: true
+			}
+		},
+		data() {
+			return {
+				duration: 300,
+				ani: [],
+				showPopup: false,
+				showTrans: false,
+				maskClass: {
+					'position': 'fixed',
+					'bottom': 0,
+					'top': 0,
+					'left': 0,
+					'right': 0,
+					'backgroundColor': 'rgba(0, 0, 0, 0.4)'
+				},
+				transClass: {
+					'position': 'fixed',
+					'left': 0,
+					'right': 0,
+				}
+			}
+		},
+		watch: {
+			type: {
+				handler: function(newVal) {
+					switch (this.type) {
+						case 'top':
+							this.ani = ['slide-top']
+							this.transClass = {
+								'position': 'fixed',
+								'left': 0,
+								'right': 0,
+							}
+							break
+						case 'bottom':
+							this.ani = ['slide-bottom']
+							this.transClass = {
+								'position': 'fixed',
+								'left': 0,
+								'right': 0,
+								'bottom': 0
+							}
+							break
+						case 'center':
+							this.ani = ['zoom-out', 'fade']
+							this.transClass = {
+								'position': 'fixed',
+								/* #ifndef APP-NVUE */
+								'display': 'flex',
+								'flexDirection': 'column',
+								/* #endif */
+								'bottom': 0,
+								'left': 0,
+								'right': 0,
+								'top': 0,
+								'justifyContent': 'center',
+								'alignItems': 'center'
+							}
+
+							break
+					}
+				},
+				immediate: true
+			}
+		},
+		created() {
+			if (this.animation) {
+				this.duration = 300
+			} else {
+				this.duration = 0
+			}
+		},
+		methods: {
+			clear(e) {
+				// TODO nvue 取消冒泡
+				e.stopPropagation()
+			},
+			open() {
+				this.showPopup = true
+				this.$nextTick(() => {
+					clearTimeout(this.timer)
+					this.timer = setTimeout(() => {
+						this.showTrans = true
+					}, 50);
+				})
+				this.$emit('change', {
+					show: true
+				})
+			},
+			close(type) {
+				this.showTrans = false
+				this.$nextTick(() => {
+					clearTimeout(this.timer)
+					this.timer = setTimeout(() => {
+						this.$emit('change', {
+							show: false
+						})
+						this.showPopup = false
+					}, 300)
+				})
+			},
+			onTap() {
+				if (!this.maskClick) return
+				this.close()
+			}
+		}
+	}
+</script>
+<style lang="scss" scoped>
+	.uni-popup {
+		position: fixed;
+		/* #ifdef H5 */
+		top: var(--window-top);
+		/* #endif */
+		/* #ifndef H5 */
+		top: 0;
+		/* #endif */
+		bottom: 0;
+		left: 0;
+		right: 0;
+		/* #ifndef APP-NVUE */
+		z-index: 99;
+		/* #endif */
+	}
+
+	.uni-popup__mask {
+		position: absolute;
+		top: 0;
+		bottom: 0;
+		left: 0;
+		right: 0;
+		background-color: $uni-bg-color-mask;
+		opacity: 0;
+	}
+
+	.mask-ani {
+		transition-property: opacity;
+		transition-duration: 0.2s;
+	}
+
+	.uni-top-mask {
+		opacity: 1;
+	}
+
+	.uni-bottom-mask {
+		opacity: 1;
+	}
+
+	.uni-center-mask {
+		opacity: 1;
+	}
+
+	.uni-popup__wrapper {
+		/* #ifndef APP-NVUE */
+		display: block;
+		/* #endif */
+		position: absolute;
+	}
+
+	.top {
+		top: 0;
+		left: 0;
+		right: 0;
+		transform: translateY(-500px);
+	}
+
+	.bottom {
+		bottom: 0;
+		left: 0;
+		right: 0;
+		transform: translateY(500px);
+	}
+
+	.center {
+		/* #ifndef APP-NVUE */
+		display: flex;
+		flex-direction: column;
+		/* #endif */
+		bottom: 0;
+		left: 0;
+		right: 0;
+		top: 0;
+		justify-content: center;
+		align-items: center;
+		transform: scale(1.2);
+		opacity: 0;
+	}
+
+	.uni-popup__wrapper-box {
+		/* #ifndef APP-NVUE */
+		display: block;
+		/* #endif */
+		position: relative;
+	}
+
+	.content-ani {
+		// transition: transform 0.3s;
+		transition-property: transform, opacity;
+		transition-duration: 0.2s;
+	}
+
+
+	.uni-top-content {
+		transform: translateY(0);
+	}
+
+	.uni-bottom-content {
+		transform: translateY(0);
+	}
+
+	.uni-center-content {
+		transform: scale(1);
+		opacity: 1;
+	}
+</style>

+ 282 - 0
components/uni-popup/uni-popup-share.vue

@@ -0,0 +1,282 @@
+<template>
+	<view>
+		<uni-popup-ori ref="showshare" type="bottom">
+			<view class="uni-share">
+				<text class="uni-share-title">分享到</text>
+				<view class="uni-share-content">
+					<view v-for="(item, index) in bottomData" :key="index" class="uni-share-content-box" @click="shareTo(item.name)">
+						<view class="uni-share-content-image"><image :src="item.icon" class="content-image" mode="widthFix" /></view>
+						<text class="uni-share-content-text">{{ item.text }}</text>
+					</view>
+				</view>
+				<text class="uni-share-btn" @click="cancel()">取消分享</text>
+			</view>
+		</uni-popup-ori>
+		<uni-popup-ori ref="showPast" type="center" class="popupPast">
+			<view class="backPop">
+				<view class="popPast">
+					<view class="popTitle">口令已复制</view>
+					<view class="popContent">
+						<view>{{ describe }}</view>
+					</view>
+					<view class="popBtn" @click="goWhere(1)" v-if="popType == 'wx'">
+						<!-- <image src="../../static/spend/wxin.png" mode="widthFix"></image> -->
+						<view>去微信粘贴给好友</view>
+					</view>
+					<view class="popBtn" @click="goWhere(2)" v-if="popType == 'timeline'">
+						<!-- <image src="../../static/spend/wechat.png" mode="widthFix"></image> -->
+						<view>粘贴到朋友圈</view>
+					</view>
+				</view>
+				<icon type="cancel" size="26" color="white" style="margin-top: 40rpx;" @click="cancelPo" />
+			</view>
+		</uni-popup-ori>
+	</view>
+</template>
+
+<script>
+import uniPopupOri from '@/components/uni-popup/uni-popup-ori.vue';
+import { mapState, mapMutations } from 'vuex';
+import { getActionPage } from '@/utils/loginUtils.js';
+export default {
+	name: 'SharePopup',
+	components: {
+		uniPopupOri
+	},
+	props: ['opt', 'type','option'],
+	data() {
+		return {
+			describe: '',
+			shareoption: '',
+			bottomData: [
+				{
+					text: '微信',
+					icon: '../../static/spend/wxin.png',
+					name: 'wx'
+				},
+				{
+					text: '朋友圈',
+					icon: '../../static/spend/wechat.png',
+					name: 'timeline'
+				}
+			],
+			popType: '',
+			uid: ''
+		};
+	},
+	computed: {
+		...mapState(['userInfo', 'baseURL'])
+	},
+	mounted() {},
+	methods: {
+		loadData() {
+			try {
+				let prePage = getActionPage();
+				var path = prePage.route;
+				this.uid = this.userInfo.uid;
+				//获取object转化成
+				var parm = '';
+				var i = 0;
+				var option = this.option; //其他页面传值
+				console.log(option,'option')
+				if(this.type == 4){
+					parm = parm + '?' + 'promo_code=' + option;
+				}else{
+					for (let item in option) {
+						//拼接参数
+						if (i == 0) {
+							parm = '?' + item + '=' + option[item];
+						} else {
+							parm = parm + '&' + item + '=' + option[item];
+						}
+						i++;
+					}
+				}
+				if(this.type == 4){
+					var url = 'pages/index/index' + parm;
+				}else{
+					var url = path + parm;
+				}
+				console.log(path,'path')
+				console.log(parm,'parm')
+				//用后台加密
+				//第一个参数是判断是不是我们的链接
+				//第二个参数是访问地址
+				//第三个参数是,类型,type:0商品,type=1拼团,type=2邀请注册,type=3邀请好友参团,type=4邀请好友助力
+				//第四个参数是share的id
+				console.log(option,'option')
+				if(this.type == 4){
+					this.describe = this.baseURL + '@' + url + '@' + this.type + '@' + this.uid + '@复制这段话进入美美赚,自动打开页面';
+				}else{
+					this.describe = this.baseURL + '@' + url + '@' + this.type + '@' + this.uid + '@复制这段话进入美美赚,自动打开页面';
+				}
+				console.log(this.describe);
+				let obj = this;
+				// #ifndef H5
+				uni.setClipboardData({
+					data: this.describe,
+					  success: function () {
+					        uni.hideToast();
+					    }
+				});
+				// #endif
+			} catch (e) {
+				console.log(e);
+				//TODO handle the exception
+			}
+		},
+		goWhere(type) {
+			this.$api.msg('复制成功');
+		},
+		cancelPo() {
+			this.$nextTick(() => {
+				this.$refs['showPast'].close();
+			});
+		},
+		shareTo(name) {
+			this.popType = name;
+			this.$nextTick(() => {
+				this.$refs.showPast.open();
+				this.$refs['showshare'].close();
+			});
+		},
+		cancel() {
+			this.$nextTick(() => {
+				this.$refs['showshare'].close();
+			});
+		},
+		open() {
+			this.$nextTick(() => {
+				this.$refs['showshare'].open();
+			});
+		}
+	}
+};
+</script>
+<style lang="scss" scoped>
+.backPop {
+	padding: 0rpx 25rpx;
+	display: flex;
+	flex-direction: column;
+	justify-content: center;
+	align-items: center;
+}
+.popupPast {
+	display: flex;
+	flex-direction: column;
+	justify-content: center;
+	align-items: center;
+	text-align: center;
+}
+.popPast {
+	display: flex;
+	flex-direction: column;
+	justify-content: center;
+	padding: 40rpx 30rpx;
+	width: 90%;
+	background-color: white;
+	border-radius: 18rpx;
+	align-items: center;
+	.popTitle {
+		color: #2f2f2f;
+		font-size: 32rpx;
+		font-weight: bold;
+		margin-bottom: 40rpx;
+	}
+	.popContent {
+		background-color: #f4f4f4;
+		padding: 30rpx 24rpx;
+		border-radius: 16rpx;
+		view {
+			font-size: 24rpx;
+			color: #939393;
+		}
+		margin-bottom: 40rpx;
+	}
+	.popBtn {
+		display: flex;
+		align-items: center;
+		padding: 20rpx 40rpx;
+		background-color: #04be02;
+		border-radius: 60rpx;
+		image {
+			width: 36rpx;
+		}
+		view {
+			color: white;
+			font-size: 36rpx;
+			margin-left: 10rpx;
+		}
+	}
+}
+/* 底部分享 */
+.uni-share {
+	/* #ifndef APP-NVUE */
+	display: flex;
+	flex-direction: column;
+	/* #endif */
+	background-color: #fff;
+}
+
+.uni-share-title {
+	line-height: 60rpx;
+	font-size: 24rpx;
+	padding: 15rpx 0;
+	text-align: center;
+}
+
+.uni-share-content {
+	/* #ifndef APP-NVUE */
+	display: flex;
+	/* #endif */
+	flex-direction: row;
+	flex-wrap: wrap;
+	justify-content: center;
+	padding: 15px;
+}
+
+.uni-share-content-box {
+	/* #ifndef APP-NVUE */
+	display: flex;
+	/* #endif */
+	flex-direction: column;
+	align-items: center;
+	width: 200rpx;
+}
+
+.uni-share-content-image {
+	/* #ifndef APP-NVUE */
+	display: flex;
+	/* #endif */
+	flex-direction: row;
+	justify-content: center;
+	align-items: center;
+	width: 60rpx;
+	height: 60rpx;
+	overflow: hidden;
+	border-radius: 10rpx;
+}
+
+.content-image {
+	width: 60rpx;
+	height: 60rpx;
+}
+
+.uni-share-content-text {
+	font-size: 26rpx;
+	color: #333;
+	padding-top: 5px;
+	padding-bottom: 10px;
+}
+
+.uni-share-btn {
+	height: 90rpx;
+	line-height: 90rpx;
+	font-size: 14px;
+	border-top-color: #f5f5f5;
+	border-top-width: 1px;
+	border-top-style: solid;
+	text-align: center;
+	color: #666;
+}
+</style>

+ 12 - 14
components/uni-popup/uni-popup.vue

@@ -1,6 +1,6 @@
 <template>
-	<view v-if="showPopup" class="uni-popup" @touchmove.stop.prevent="clear" @click="onTap">
-		<uni-transition :mode-class="['fade']" :styles="maskClass" :duration="duration"  :show="showTrans" @click="onTap" />
+	<view v-if="showPopup" class="uni-popup" @touchmove.stop.prevent="clear">
+		<uni-transition :mode-class="['fade']" :styles="maskClass" :duration="duration" :show="showTrans" @click="onTap" />
 		<uni-transition :mode-class="ani" :styles="transClass" :duration="duration" :show="showTrans" @click="onTap">
 			<view class="uni-popup__wrapper-box" @click.stop="clear">
 				<slot />
@@ -124,15 +124,14 @@
 				e.stopPropagation()
 			},
 			open() {
-				let obj = this;
-				obj.showPopup = true
-				obj.$nextTick(() => {
-					clearTimeout(obj.timer)
-					obj.timer = setTimeout(() => {
-						obj.showTrans = true
+				this.showPopup = true
+				this.$nextTick(() => {
+					clearTimeout(this.timer)
+					this.timer = setTimeout(() => {
+						this.showTrans = true
 					}, 50);
 				})
-				obj.$emit('change', {
+				this.$emit('change', {
 					show: true
 				})
 			},
@@ -155,7 +154,7 @@
 		}
 	}
 </script>
-<style scoped>
+<style lang="scss" scoped>
 	.uni-popup {
 		position: fixed;
 		/* #ifdef H5 */
@@ -178,7 +177,7 @@
 		bottom: 0;
 		left: 0;
 		right: 0;
-		background-color: rgba(0, 0, 0, 0.4);
+		background-color: $uni-bg-color-mask;
 		opacity: 0;
 	}
 
@@ -243,8 +242,7 @@
 	}
 
 	.content-ani {
-		/* transition: transform 0.3s;
- */
+		// transition: transform 0.3s;
 		transition-property: transform, opacity;
 		transition-duration: 0.2s;
 	}
@@ -262,4 +260,4 @@
 		transform: scale(1);
 		opacity: 1;
 	}
-</style>
+</style>

+ 20 - 2
components/uni-transition/uni-transition.vue

@@ -1,7 +1,7 @@
 <template>
 	<view v-if="isShow" ref="ani" class="uni-transition" :class="[ani.in]" :style="'transform:' +transform+';'+stylesObject"
 	 @click="change">
-		<slot></slot>
+		 <slot></slot>
 	</view>
 </template>
 
@@ -9,6 +9,22 @@
 	// #ifdef APP-NVUE
 	const animation = uni.requireNativePlugin('animation');
 	// #endif
+	/**
+	 * Transition 过渡动画
+	 * @description 简单过渡动画组件
+	 * @tutorial https://ext.dcloud.net.cn/plugin?id=985
+	 * @property {Boolean} show = [false|true] 控制组件显示或隐藏
+     * @property {Array} modeClass = [fade|slide-top|slide-right|slide-bottom|slide-left|zoom-in|zoom-out] 过渡动画类型
+     *  @value fade 渐隐渐出过渡
+     *  @value slide-top 由上至下过渡
+     *  @value slide-right 由右至左过渡
+     *  @value slide-bottom 由下至上过渡
+     *  @value slide-left 由左至右过渡
+     *  @value zoom-in 由小到大过渡
+     *  @value zoom-out 由大到小过渡
+	 * @property {Number} duration 过渡动画持续时间
+	 * @property {Object} styles 组件样式,同 css 样式,注意带’-‘连接符的属性需要使用小驼峰写法如:`backgroundColor:red`
+	 */
 	export default {
 		name: 'uniTransition',
 		props: {
@@ -83,6 +99,7 @@
 				})
 			},
 			open() {
+				clearTimeout(this.timer)
 				this.isShow = true
 				this.transform = ''
 				this.ani.in = ''
@@ -101,6 +118,7 @@
 
 			},
 			close(type) {
+				clearTimeout(this.timer)
 				this._animation(false)
 			},
 			_animation(type) {
@@ -131,7 +149,6 @@
 						this.transform += `${styles[i]} `
 					}
 				}
-				clearTimeout(this.timer)
 				this.timer = setTimeout(() => {
 					if (!type) {
 						this.isShow = false
@@ -197,6 +214,7 @@
 		}
 	}
 </script>
+
 <style>
 	.uni-transition {
 		transition-timing-function: ease;

+ 1 - 1
components/wangding-pickerAddress/wangding-pickerAddress.vue

@@ -6,7 +6,7 @@
 
 <script>
 	import AllAddress from './data.js'
-	let selectVal = ['','','']
+	let selectVal = ['','',''];
 	
 	export default {
 		data() {

+ 18 - 0
config/app.js

@@ -0,0 +1,18 @@
+module.exports = {
+	// 请求域名 格式: https://您的域名
+	
+	HTTP_REQUEST_URL:'http://base.liuniu946.com',
+
+	
+	
+	// #ifdef H5
+	// HTTP_REQUEST_URL: window.location.protocol+"//"+window.location.host,
+	// #endif
+	HEADER:{
+		'content-type': 'application/json'
+	},
+	// 回话密钥名称 请勿修改此配置
+	TOKENNAME: 'Authori-zation',
+	// 缓存时间 0 永久
+	EXPIRE:0,
+};

+ 32 - 0
config/cache.js

@@ -0,0 +1,32 @@
+module.exports = {
+	//token
+	LOGIN_STATUS: 'LOGIN_STATUS_TOKEN',
+	// uid
+	UID:'UID',
+	//�û�
+	USER_INFO: 'USER_INFO',
+	//token�����¼�
+	EXPIRES_TIME: 'EXPIRES_TIME',
+	//�Ƿ���Ȩ
+	WX_AUTH: 'WX_AUTH',
+	//���ں���Ȩcode
+	STATE_KEY: 'wx_authorize_state',
+	//�û�����
+	LOGINTYPE: 'loginType',
+	//���ں���ת����
+	BACK_URL: 'login_back_url',
+	// ����code
+	STATE_R_KEY: 'roution_authorize_state',
+	//��ȨlogoС����
+	LOGO_URL: 'LOGO_URL',
+	//模板缓存
+	SUBSCRIBE_MESSAGE: 'SUBSCRIBE_MESSAGE',
+
+	TIPS_KEY: 'TIPS_KEY',
+
+	SPREAD: 'spread',
+	//缓存经度
+	CACHE_LONGITUDE: 'LONGITUDE',
+	//缓存纬度
+	CACHE_LATITUDE: 'LATITUDE',
+}

+ 39 - 0
libs/log.js

@@ -0,0 +1,39 @@
+
+const logLength=100;//缓存存储上限
+const name = 'log';//缓存名字
+export function addLog (data,content='') {
+	let log = uni.getStorageSync(name)||[];
+	log.unshift({
+		title:data,
+		content:content
+	});
+	uni.setStorageSync(name,log);
+	initLog(log);
+}
+
+
+export function delLog () {
+	return uni.setStorageSync(name,'');
+}
+
+export function getLog () {
+	return uni.getStorageSync(name);
+}
+
+export function initLog (log) {
+	if(log.length>logLength){
+		const newarr = log.slice(log.length-logLength);
+		uni.setStorageSync(name,newarr);
+	}
+}
+export function showLog (log) {
+	
+	let str = '';
+	uni.getStorageSync(name).forEach((e) => {
+		str+=e.title+':'+JSON.stringify(e.content)
+	})
+	uni.showModal({
+		title:"日志",
+		content:str
+	})
+}

+ 84 - 0
libs/login.js

@@ -0,0 +1,84 @@
+import store from "../store";
+import Cache from '../utils/cache';
+// #ifdef H5 || APP-PLUS
+import {
+	isWeixin
+} from "../utils";
+import auth from './wechat';
+// #endif
+
+import {
+	LOGIN_STATUS,
+	USER_INFO,
+	EXPIRES_TIME,
+	STATE_R_KEY
+} from './../config/cache';
+
+function prePage() {
+	let pages = getCurrentPages();
+	let prePage = pages[pages.length - 2];
+	// #ifdef H5
+	return prePage;
+	// #endif
+	return prePage.$vm;
+}
+
+export function toLogin(push, pathLogin) {
+	// store.commit("LOGOUT");
+	let path = prePage();
+	if (path) {
+		path = path.router;
+		if (path == undefined) {
+			path = location.pathname;
+		}
+	}
+	// #ifdef H5
+	else {
+		path = location.pathname;
+	}
+	// #endif
+
+	if (!pathLogin)
+		pathLogin = '/page/users/login/index'
+	Cache.set('login_back_url', path);
+	// #ifdef H5 || APP-PLUS
+	if (isWeixin()) {
+		auth.oAuth();
+	} else {
+		if (path !== pathLogin) {
+			push ? uni.navigateTo({
+				url: '/pages/users/login/index'
+			}) : uni.reLaunch({
+				url: '/pages/users/login/index'
+			});
+		}
+	}
+	// #endif
+
+	// #ifdef MP 
+
+
+	// #endif
+}
+
+
+export function checkLogin() {
+	let token = Cache.get(LOGIN_STATUS);
+	let expiresTime = Cache.get(EXPIRES_TIME);
+	let newTime = Math.round(new Date() / 1000);
+	if (expiresTime < newTime || !token) {
+		Cache.clear(LOGIN_STATUS);
+		Cache.clear(EXPIRES_TIME);
+		Cache.clear(USER_INFO);
+		Cache.clear(STATE_R_KEY);
+		return false;
+	} else {
+		store.commit('UPDATE_LOGIN', token);
+		let userInfo = Cache.get(USER_INFO, true);
+		if (userInfo) {
+			store.commit('UPDATE_USERINFO', userInfo);
+		}
+		return true;
+	}
+
+}

+ 253 - 0
libs/wechat.js

@@ -0,0 +1,253 @@
+// #ifdef H5
+import WechatJSSDK from "@/plugin/jweixin-module/index.js";
+// #endif
+
+import {
+	wechatConfig,
+	wechatAuth
+} from "@/api/wx.js";
+import {
+	WX_AUTH,
+	STATE_KEY,
+	LOGINTYPE,
+	BACK_URL
+} from '@/config/cache';
+import {
+	parseQuery
+} from '@/utils';
+import store from '@/store';
+import Cache from '@/utils/cache';
+
+class AuthWechat {
+	// #ifdef H5
+	constructor() {
+		//微信实例化对象
+		this.instance = WechatJSSDK;
+		//是否实例化
+		this.status = false;
+
+		this.initConfig = {};
+
+	}
+	// #endif
+	
+	isAndroid(){
+		let u = navigator.userAgent;
+		return u.indexOf('Android') > -1 || u.indexOf('Adr') > -1;
+	}
+
+	/**
+	 * 初始化wechat(分享配置)
+	 */
+	wechat() {
+		return new Promise((resolve, reject) => {
+			// if (this.status && !this.isAndroid()) return resolve(this.instance);
+			wechatConfig()
+				.then(res => {
+					this.instance.config(res.data);
+					this.initConfig = res.data;
+					this.status = true;
+					this.instance.ready(() => {
+						resolve(this.instance);
+					})
+				}).catch(err => {
+					console.log(err);
+					this.status = false;
+					reject(err);
+				});
+		});
+	}
+
+	/**
+	 * 验证是否初始化
+	 */
+	verifyInstance() {
+		let that = this;
+		return new Promise((resolve, reject) => {
+			if (that.instance === null && !that.status) {
+				that.wechat().then(res => {
+					resolve(that.instance);
+				}).catch(() => {
+					return reject();
+				})
+			} else {
+				return resolve(that.instance);
+			}
+		})
+	}
+	// 微信公众号的共享地址
+	openAddress() {
+		return new Promise((resolve, reject) => {
+			this.wechat().then(wx => {
+				this.toPromise(wx.openAddress).then(res => {
+					resolve(res);
+				}).catch(err => {
+					reject(err);
+				});
+			}).catch(err => {
+				reject(err);
+			})
+		});
+	}
+
+	/**
+	 * 微信支付
+	 * @param {Object} config
+	 */
+	pay(config) {
+		return new Promise((resolve, reject) => {
+			this.wechat().then((wx) => {
+				this.toPromise(wx.chooseWXPay, config).then(res => {
+					resolve(res);
+				}).catch(res => {
+					reject(res);
+				});
+			}).catch(res => {
+				reject(res);
+			});
+		});
+	}
+
+	toPromise(fn, config = {}) {
+		return new Promise((resolve, reject) => {
+			fn({
+				...config,
+				success(res) {
+					resolve(res);
+				},
+				fail(err) {
+					reject(err);
+				},
+				complete(err) {
+					reject(err);
+				},
+				cancel(err) {
+					reject(err);
+				}
+			});
+		});
+	}
+
+	/**
+	 * 自动去授权
+	 */
+	oAuth() {
+		if (uni.getStorageSync(WX_AUTH) && store.state.app.token) return;
+		const {
+			code
+		} = parseQuery();
+		if (!code) return this.toAuth();
+	}
+
+	clearAuthStatus() {
+
+	}
+
+	/**
+	 * 授权登陆获取token
+	 * @param {Object} code
+	 */
+	auth(code) {
+		return new Promise((resolve, reject) => {
+			let loginType = Cache.get(LOGINTYPE);
+			wechatAuth(code, parseInt(Cache.get("spread")), loginType)
+				.then(({
+					data
+				}) => {
+					let expires_time = data.expires_time.substring(0, 19);
+					expires_time = expires_time.replace(/-/g, '/');
+					expires_time = new Date(expires_time).getTime();
+					let newTime = Math.round(new Date() / 1000);
+					store.commit("LOGIN", {
+						token: data.token,
+						time: expires_time - newTime
+					});
+					Cache.set(WX_AUTH, code);
+					Cache.clear(STATE_KEY);
+					loginType && Cache.clear(LOGINTYPE);
+					resolve();
+				})
+				.catch(reject);
+		});
+	}
+
+	/**
+	 * 获取跳转授权后的地址
+	 * @param {Object} appId
+	 */
+	getAuthUrl(appId) {
+		const redirect_uri = encodeURIComponent(
+			`${location.origin}/pages/auth/index?back_url=` +
+			encodeURIComponent(
+				encodeURIComponent(
+					uni.getStorageSync(BACK_URL) ?
+					uni.getStorageSync(BACK_URL) :
+					location.pathname + location.search
+				)
+			)
+		);
+		uni.removeStorageSync(BACK_URL);
+		const state = encodeURIComponent(
+			("" + Math.random()).split(".")[1] + "authorizestate"
+		);
+		uni.setStorageSync(STATE_KEY, state);
+		return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appId}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=${state}#wechat_redirect`;
+	}
+
+	/**
+	 * 跳转自动登陆
+	 */
+	toAuth() {
+		let that = this;
+		this.wechat().then(wx => {
+			location.href = this.getAuthUrl(that.initConfig.appId);
+		})
+	}
+
+	/**
+	 * 绑定事件
+	 * @param {Object} name 事件名
+	 * @param {Object} config 参数
+	 */
+	wechatEvevt(name, config) {
+		let that = this;
+		return new Promise((resolve, reject) => {
+			let configDefault = {
+				fail(res) {
+					console.log(res,11111);
+					if (that.instance) return reject({
+						is_ready: true,
+						wx: that.instance
+					});
+					that.verifyInstance().then(wx => {
+						return reject({
+							is_ready: true,
+							wx: wx
+						});
+					})
+				},
+				success(res) {
+					return resolve(res,2222);
+				}
+			};
+			Object.assign(configDefault, config);
+			that.wechat().then(wx => {
+				if (typeof name === 'object') {
+					name.forEach(item => {
+						wx[item] && wx[item](configDefault)
+					})
+				} else {
+					wx[name] && wx[name](configDefault)
+				}
+			})
+		});
+	}
+
+	isWeixin() {
+		return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1;
+	}
+
+}
+
+export default new AuthWechat();
+

+ 36 - 0
main.js

@@ -1,7 +1,43 @@
 import Vue from 'vue'
+import store from './store'
 import App from './App'
+/**
+ *  所有测试用数据均存放于根目录json.js
+ *  
+ *  css部分使用了App.vue下的全局样式和iconfont图标,有需要图标库的可以留言。
+ *  示例使用了uni.scss下的变量, 除变量外已尽量移除特有语法,可直接替换为其他预处理器使用
+ */
+const msg = (title, duration=1500, mask=false, icon='none')=>{
+	//统一提示方便全局修改
+	if(Boolean(title) === false){
+		return;
+	}
+	uni.showToast({
+		title,
+		duration,
+		mask,
+		icon
+	});
+}
+
+const prePage = ()=>{
+	// 获取当前页面
+	let pages = getCurrentPages();
+	let prePage = pages[pages.length - 2];
+	// #ifdef H5
+	return prePage;
+	// #endif
+	return prePage.$vm;
+}
+
+
 Vue.config.productionTip = false
+Vue.prototype.$fire = new Vue();
+Vue.prototype.$store = store;
+Vue.prototype.$api = {msg, prePage};
+
 App.mpType = 'app'
+
 const app = new Vue({
     ...App
 })

+ 23 - 59
manifest.json

@@ -1,6 +1,6 @@
 {
-    "name" : "导航",
-    "appid" : "__UNI__B30FE18",
+    "name" : "基础项目",
+    "appid" : "__UNI__F0EBD91",
     "description" : "",
     "versionName" : "1.0.0",
     "versionCode" : "100",
@@ -28,22 +28,28 @@
                     "<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
                     "<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
                     "<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
-                    "<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
                     "<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
                     "<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
                     "<uses-permission android:name=\"android.permission.VIBRATE\"/>",
                     "<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
                     "<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>"
-                ]
+                ],
+                "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ]
+            },
+            "ios" : {
+                "idfa" : false
             },
-            "ios" : {},
             /* ios打包配置 */
             "sdkConfigs" : {
-                "maps" : {}
+                "maps" : {},
+                "oauth" : {
+                    "weixin" : {
+                        "appid" : "",
+                        "appsecret" : "",
+                        "UniversalLinks" : ""
+                    }
+                }
             }
-        },
-        "uniStatistics" : {
-            "enable" : false
         }
     },
     /* SDK配置 */
@@ -52,70 +58,28 @@
     "mp-weixin" : {
         /* 小程序特有相关 */
         "usingComponents" : true,
-        "appid" : "wx8f5ca89868d2faa3",
+        "appid" : "",
         "setting" : {
             "urlCheck" : true
-        },
-        "permission" : {
-            "scope.userLocation" : {
-                "desc" : "获取位置信息"
-            }
-        },
-        "uniStatistics" : {
-            "enable" : false
         }
     },
     "h5" : {
-        "title" : "学校",
+        "title" : "商城",
         "domain" : "",
         "router" : {
             "base" : "/index/",
             "mode" : "hash"
         },
         "devServer" : {
-            "port" : 8080, //端口号
-            "disableHostCheck" : true,
             "proxy" : {
-                "/ws/" : {
-                    "target" : "http://apis.map.qq.com/ws/", //目标接口域名
-                    "changeOrigin" : true, //是否跨域
-                    "secure" : false // 设置支持https协议的代理
-                }
-            },
-            "https" : false
-        },
-        "sdkConfigs" : {
-            "maps" : {
-                "qqmap" : {
-                    "key" : "VYZBZ-P2TRG-RMIQ3-ITAIN-2DKBK-CKFQQ"
+                "/api" : {
+                    "target" : "http://192.168.0.101/api",
+                    // "changeOrigin": true,
+                    "pathRewrite" : {
+                        "/api" : "" // rewrite path
+                    }
                 }
             }
-        },
-        "uniStatistics" : {
-            "enable" : false
-        }
-    },
-    "uniStatistics" : {
-        "enable" : false
-    },
-    "mp-alipay" : {
-        "uniStatistics" : {
-            "enable" : false
-        }
-    },
-    "mp-baidu" : {
-        "uniStatistics" : {
-            "enable" : false
-        }
-    },
-    "mp-qq" : {
-        "uniStatistics" : {
-            "enable" : false
-        }
-    },
-    "mp-toutiao" : {
-        "uniStatistics" : {
-            "enable" : false
         }
     }
 }

+ 32 - 0
pages.json

@@ -10,6 +10,38 @@
 		        }
 		    }
 		},
+		{
+			"path": "pages/public/register",
+			"style": {
+				"navigationBarTitleText": "注册",
+				"app-plus": {
+					"titleNView": {
+						"type": "transparent"
+					}
+				}
+			}
+		}, {
+			"path": "pages/public/login",
+			"style": {
+				"navigationBarTitleText": "登录",
+				"app-plus": {
+					"titleNView": {
+						"type": "transparent"
+					}
+				}
+			}
+		},
+		{
+			"path": "pages/public/wxLogin",
+			"style": {
+				"navigationBarTitleText": "微信登录",
+				"app-plus": {
+					"titleNView": {
+						"type": "transparent"
+					}
+				}
+			}
+		},
 		{
 			"path": "pages/index/message",
 			"style": {

+ 55 - 28
pages/course/course.vue

@@ -14,40 +14,67 @@
 </template>
 
 <script>
+	import getCourse from '@/api/course.js'
 	export default {
 		data() {
 			return {
+				page: 1,
+				limit: 10,
+				loadingType: 'more',
 				courseList: [
-					{
-						title: "暑假培训阅读精品课",
-						time: "2021年07月01日 16:00",
-						teacher: "授课科目:数学  林丹丹",
-						bzr: "班主任:王琳琳  13201202102"
-						
-					},
-					{
-						title: "暑假培训阅读精品课",
-						time: "2021年07月01日 16:00",
-						teacher: "授课科目:数学  林丹丹",
-						bzr: "班主任:王琳琳  13201202102"
-						
-					},
-					{
-						title: "暑假培训阅读精品课",
-						time: "2021年07月01日 16:00",
-						teacher: "授课科目:数学  林丹丹",
-						bzr: "班主任:王琳琳  13201202102"
-						
-					},
-					{
-						title: "暑假培训阅读精品课",
-						time: "2021年07月01日 16:00",
-						teacher: "授课科目:数学  林丹丹",
-						bzr: "班主任:王琳琳  13201202102"
-						
-					}
+					
 				],
 			}
+		},
+		onShow() {
+			this.loadData();
+		},
+		//下拉刷新
+		onPullDownRefresh() {
+			this.loadData('refresh');
+		},
+		//监听页面是否滚动到底部加载更多
+		onReachBottom() {
+			this.loadData();
+		},
+		methods: {
+			async loadData(type = 'add', loading) {
+				let obj = this;
+				if (type === 'add') {
+					if (obj.loadingType === 'nomore') {
+						return;
+					}
+					obj.loadingType = 'loading';
+				} else {
+					obj.loadingType = 'more';
+				}
+				if (type === 'refresh') {
+					// 清空数组
+					obj.courseList = [];
+					obj.page = 1
+				}
+				//获取课程
+				getCourse({
+					page: obj.page,
+					limit: obj.limit
+				}).then(e => {
+					obj.courseList = obj.courseList.concat(e.data);
+					//判断是否还有下一页,有是more  没有是nomore
+					if (obj.limit==e.data.length) {
+						obj.page++
+						obj.loadingType='more'
+					} else{
+						obj.loadingType='nomore'
+					}
+					if (type === 'refresh') {
+						if (loading == 1) {
+							uni.hideLoading();
+						} else {
+							uni.stopPullDownRefresh();
+						}
+					}
+				})
+			}
 		}
 	}
 </script>

+ 22 - 15
pages/user/user.vue

@@ -21,26 +21,29 @@
 <script>
 import { mapState, mapMutations } from 'vuex';
 import { saveUrl, interceptor } from '@/utils/loginUtils.js';
-import { userinfo,} from '@/api/user.js';
+import { getUserInfo,} from '@/api/user.js';
 export default {
 	computed: {
 		...mapState(['hasLogin', 'userInfo', 'baseURL', 'urlFile'])
 	},
+	onShow() {
+		// 判断是否已经登录
+		console.log(this.hasLogin)
+		if (this.hasLogin) {
+			console.log(this.hasLogin)
+			this.loadBaseData();
+		}
+	},
 	methods: {
+		...mapMutations( ['setUserInfo', 'setOrderInfo']),
 		loadBaseData() {
-			userinfo({})
+			getUserInfo({})
 				.then(({ data }) => {
+					
 					if (data.store_switch == '1') {
 						this.showBox = true;
 					}
 					this.setUserInfo(data);
-					orderData({})
-						.then(({ data }) => {
-							this.orderInfo = data;
-						})
-						.catch(e => {
-							this.orderinfo = {};
-						});
 				})
 				.catch(e => {
 					console.log(e);
@@ -52,7 +55,9 @@ export default {
 					title: '登录',
 					content: '您未登录,是否马上登陆?',
 					success: e => {
+						console.log(e)
 						if (e.confirm) {
+							console.log("1111")
 							interceptor();
 						}
 					},
@@ -61,10 +66,11 @@ export default {
 					}
 				});
 				return;
+			}else{
+				uni.switchTab({
+					url: '/pages/index/index'
+				})
 			}
-			uni.switchTab({
-				url: '/pages/index/index'
-			})
 		},
 		nav(){
 			if (!this.hasLogin) {
@@ -81,10 +87,11 @@ export default {
 					}
 				});
 				return;
+			}else{
+				uni.navigateTo({
+					url: '/pages/user/userInfo'
+				})
 			}
-			uni.navigateTo({
-				url: '/pages/user/userInfo'
-			})
 		}
 	}
 }

+ 147 - 0
plugin/image-tools/index.js

@@ -0,0 +1,147 @@
+function getLocalFilePath(path) {
+    if (path.indexOf('_www') === 0 || path.indexOf('_doc') === 0 || path.indexOf('_documents') === 0 || path.indexOf('_downloads') === 0) {
+        return path
+    }
+    if (path.indexOf('file://') === 0) {
+        return path
+    }
+    if (path.indexOf('/storage/emulated/0/') === 0) {
+        return path
+    }
+    if (path.indexOf('/') === 0) {
+        var localFilePath = plus.io.convertAbsoluteFileSystem(path)
+        if (localFilePath !== path) {
+            return localFilePath
+        } else {
+            path = path.substr(1)
+        }
+    }
+    return '_www/' + path
+}
+
+export function pathToBase64(path) {
+    return new Promise(function(resolve, reject) {
+        if (typeof window === 'object' && 'document' in window) {
+            if (typeof FileReader === 'function') {
+                var xhr = new XMLHttpRequest()
+                xhr.open('GET', path, true)
+                xhr.responseType = 'blob'
+                xhr.onload = function() {
+                    if (this.status === 200) {
+                        let fileReader = new FileReader()
+                        fileReader.onload = function(e) {
+                            resolve(e.target.result)
+                        }
+                        fileReader.onerror = reject
+                        fileReader.readAsDataURL(this.response)
+                    }
+                }
+                xhr.onerror = reject
+                xhr.send()
+                return
+            }
+            var canvas = document.createElement('canvas')
+            var c2x = canvas.getContext('2d')
+            var img = new Image
+            img.onload = function() {
+                canvas.width = img.width
+                canvas.height = img.height
+                c2x.drawImage(img, 0, 0)
+                resolve(canvas.toDataURL())
+                canvas.height = canvas.width = 0
+            }
+            img.onerror = reject
+            img.src = path
+            return
+        }
+        if (typeof plus === 'object') {
+            plus.io.resolveLocalFileSystemURL(getLocalFilePath(path), function(entry) {
+                entry.file(function(file) {
+                    var fileReader = new plus.io.FileReader()
+                    fileReader.onload = function(data) {
+                        resolve(data.target.result)
+                    }
+                    fileReader.onerror = function(error) {
+                        reject(error)
+                    }
+                    fileReader.readAsDataURL(file)
+                }, function(error) {
+                    reject(error)
+                })
+            }, function(error) {
+                reject(error)
+            })
+            return
+        }
+        if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) {
+            wx.getFileSystemManager().readFile({
+                filePath: path,
+                encoding: 'base64',
+                success: function(res) {
+                    resolve('data:image/png;base64,' + res.data)
+                },
+                fail: function(error) {
+                    reject(error)
+                }
+            })
+            return
+        }
+        reject(new Error('not support'))
+    })
+}
+
+export function base64ToPath(base64) {
+    return new Promise(function(resolve, reject) {
+        if (typeof window === 'object' && 'document' in window) {
+            base64 = base64.split(',')
+            var type = base64[0].match(/:(.*?);/)[1]
+            var str = atob(base64[1])
+            var n = str.length
+            var array = new Uint8Array(n)
+            while (n--) {
+                array[n] = str.charCodeAt(n)
+            }
+            return resolve((window.URL || window.webkitURL).createObjectURL(new Blob([array], { type: type })))
+        }
+        var extName = base64.match(/data\:\S+\/(\S+);/)
+        if (extName) {
+            extName = extName[1]
+        } else {
+            reject(new Error('base64 error'))
+        }
+        var fileName = Date.now() + '.' + extName
+        if (typeof plus === 'object') {
+            var bitmap = new plus.nativeObj.Bitmap('bitmap' + Date.now())
+            bitmap.loadBase64Data(base64, function() {
+                var filePath = '_doc/uniapp_temp/' + fileName
+                bitmap.save(filePath, {}, function() {
+                    bitmap.clear()
+                    resolve(filePath)
+                }, function(error) {
+                    bitmap.clear()
+                    reject(error)
+                })
+            }, function(error) {
+                bitmap.clear()
+                reject(error)
+            })
+            return
+        }
+        if (typeof wx === 'object' && wx.canIUse('getFileSystemManager')) {
+            var filePath = wx.env.USER_DATA_PATH + '/' + fileName
+            wx.getFileSystemManager().writeFile({
+                filePath: filePath,
+                data: base64.replace(/^data:\S+\/\S+;base64,/, ''),
+                encoding: 'base64',
+                success: function() {
+                    resolve(filePath)
+                },
+                fail: function(error) {
+                    reject(error)
+                }
+            })
+            return
+        }
+        reject(new Error('not support'))
+    })
+}

文件差异内容过多而无法显示
+ 0 - 0
plugin/jweixin-module/index.js


+ 551 - 0
static/css/cmy.css

@@ -0,0 +1,551 @@
+/*初始化类*/
+@font-face {
+	font-family: 'iconfont';
+	/* project id 1482221 */
+	src: url('https://at.alicdn.com/t/font_1482221_x9emymthrxs.eot');
+	src: url('https://at.alicdn.com/t/font_1482221_x9emymthrxs.eot?#iefix') format('embedded-opentype'),
+		url('https://at.alicdn.com/t/font_1482221_x9emymthrxs.woff2') format('woff2'),
+		url('https://at.alicdn.com/t/font_1482221_x9emymthrxs.woff') format('woff'),
+		url('https://at.alicdn.com/t/font_1482221_x9emymthrxs.ttf') format('truetype'),
+		url('https://at.alicdn.com/t/font_1482221_x9emymthrxs.svg#iconfont') format('svg');
+}
+
+.acea-row {
+	display: -webkit-box;
+	display: -moz-box;
+	display: -webkit-flex;
+	display: -ms-flexbox;
+	display: flex;
+	-webkit-box-lines: multiple;
+	-moz-box-lines: multiple;
+	-o-box-lines: multiple;
+	-webkit-flex-wrap: wrap;
+	-ms-flex-wrap: wrap;
+	flex-wrap: wrap
+}
+
+.acea-row.row-middle {
+	-webkit-box-align: center;
+	-moz-box-align: center;
+	-o-box-align: center;
+	-ms-flex-align: center;
+	-webkit-align-items: center;
+	align-items: center
+}
+
+.bg-color-red {
+	background-color: #e93323 !important;
+}
+
+.acea-row.row-right {
+	-webkit-box-pack: end;
+	-moz-box-pack: end;
+	-o-box-pack: end;
+	-ms-flex-pack: end;
+	-webkit-justify-content: flex-end;
+	justify-content: flex-end
+}
+
+.acea-row.row-between-wrapper {
+	-webkit-box-align: center;
+	-moz-box-align: center;
+	-o-box-align: center;
+	-ms-flex-align: center;
+	-webkit-align-items: center;
+	align-items: center;
+	-webkit-box-pack: justify;
+	-moz-box-pack: justify;
+	-o-box-pack: justify;
+	-ms-flex-pack: justify;
+	-webkit-justify-content: space-between;
+	justify-content: space-between
+}
+
+.acea-row.row-column-around {
+	-webkit-flex-direction: column;
+	-ms-flex-direction: column;
+	flex-direction: column;
+	justify-content: space-around;
+	-webkit-justify-content: space-around
+}
+
+.acea-row.row-center-wrapper {
+	-webkit-box-align: center;
+	-moz-box-align: center;
+	-o-box-align: center;
+	-ms-flex-align: center;
+	-webkit-align-items: center;
+	align-items: center;
+	-webkit-box-pack: center;
+	-moz-box-pack: center;
+	-o-box-pack: center;
+	-ms-flex-pack: center;
+	-webkit-justify-content: center;
+	justify-content: center
+}
+
+.iconfont {
+	font-family: "iconfont" !important;
+	font-size: 34rpx;
+	font-style: normal;
+	-webkit-font-smoothing: antialiased;
+	-webkit-text-stroke-width: 0rpx;
+	-moz-osx-font-smoothing: grayscale;
+}
+
+.iconedit:before {
+	content: "\e649";
+}
+
+.iconfavorfill:before {
+	content: "\e64b";
+}
+
+.iconfavor:before {
+	content: "\e64c";
+}
+
+.iconlocation:before {
+	content: "\e651";
+}
+
+.iconroundcheckfill:before {
+	content: "\e656";
+}
+
+.iconroundcheck:before {
+	content: "\e657";
+}
+
+.iconunfold:before {
+	content: "\e661";
+}
+
+.iconlikefill:before {
+	content: "\e668";
+}
+
+.iconlike:before {
+	content: "\e669";
+}
+
+.iconshop:before {
+	content: "\e676";
+}
+
+.iconcart:before {
+	content: "\e6af";
+}
+
+.icondelete:before {
+	content: "\e6b4";
+}
+
+.iconhome:before {
+	content: "\e6b8";
+}
+
+.iconcartfill:before {
+	content: "\e6b9";
+}
+
+.iconhomefill:before {
+	content: "\e6bb";
+}
+
+.iconlock:before {
+	content: "\e6c0";
+}
+
+.iconfriendadd:before {
+	content: "\e6ca";
+}
+
+.iconfold:before {
+	content: "\e6de";
+}
+
+.iconapps:before {
+	content: "\e729";
+}
+
+.iconadd:before {
+	content: "\e767";
+}
+
+.iconmove:before {
+	content: "\e768";
+}
+
+.icontriangledownfill:before {
+	content: "\e79b";
+}
+
+.icontriangleupfill:before {
+	content: "\e79c";
+}
+
+.iconshaixuan:before {
+	content: "\e74a";
+}
+
+.iconyanzhengma:before {
+	content: "\e684";
+}
+
+.iconjifen:before {
+	content: "\e60f";
+}
+
+.iconwuliuxinxi:before {
+	content: "\e62b";
+}
+
+.iconmessage:before {
+	content: "\e78a";
+}
+
+.iconsetting:before {
+	content: "\e78e";
+}
+
+.iconaddition:before {
+	content: "\e6e0";
+}
+
+.iconclose:before {
+	content: "\e6e9";
+}
+
+.iconenter:after {
+	content: "\e6f8";
+}
+
+.iconprompt:before {
+	content: "\e71b";
+}
+
+.iconreturn:before {
+	content: "\e720";
+}
+
+.iconsearch:before {
+	content: "\e741";
+}
+
+.iconpengyouquan:before {
+	content: "\e62c";
+}
+
+.iconweixin:before {
+	content: "\e60e";
+}
+
+.iconzhifubao:before {
+	content: "\e673";
+}
+
+.iconyue:before {
+	content: "\e618";
+}
+
+.iconweixin1:before {
+	content: "\e622";
+}
+
+.iconlock1:before {
+	content: "\e64d";
+}
+
+.iconuser:before {
+	content: "\e64e";
+}
+
+.iconchenggongtixianshouyi:before {
+	content: "\e64f";
+}
+
+.iconviptuiguangdingdan:before {
+	content: "\e650";
+}
+
+.icondaifukuan:before {
+	content: "\e652";
+}
+
+.icondaijiesuanshouyi:before {
+	content: "\e653";
+}
+
+.icondaidakuanshouyi:before {
+	content: "\e654";
+}
+
+.icondaifahuo:before {
+	content: "\e655";
+}
+
+.icondaishouhuoshouyi:before {
+	content: "\e658";
+}
+
+.icondaishouhuo:before {
+	content: "\e659";
+}
+
+.iconwuxiaoshouyi:before {
+	content: "\e65a";
+}
+
+.icontixianmingxi:before {
+	content: "\e65b";
+}
+
+.iconshouyi:before {
+	content: "\e65c";
+}
+
+.iconkouchutixianshouxufei:before {
+	content: "\e65d";
+}
+
+.iconyishenqingshouyi:before {
+	content: "\e65e";
+}
+
+.icontuihuanhuo:before {
+	content: "\e65f";
+}
+
+
+/*水平线*/
+.hr {
+	width: 100%;
+	position: relative;
+	border-bottom: 1px solid #dddddd;
+	/* height: 0.5rpx; */
+}
+
+/* 一行显示 */
+.clamp {
+	overflow: hidden;
+	text-overflow: ellipsis;
+	white-space: nowrap;
+	display: block;
+}
+
+/* 二行显示 */
+.clamp2 {
+	overflow: hidden;
+	text-overflow: ellipsis;
+	display: -webkit-box;
+	-webkit-line-clamp: 2;
+	-webkit-box-orient: vertical;
+}
+
+/* 二行显示 */
+.ellipsis {
+	overflow: hidden;
+	text-overflow: ellipsis;
+	display: -webkit-box;
+	-webkit-box-orient: vertical;
+	-webkit-line-clamp: 2;
+}
+
+.common-hover {
+	background: #f5f5f5;
+}
+
+/* 角标 */
+.corner {
+	background-color: #e51c23;
+	position: absolute;
+	right: -18rpx;
+	top: -18rpx;
+	color: #FFFFFF;
+	text-align: center;
+	border-radius: 999px;
+	font-size: 24rpx !important;
+	min-width: 35rpx;
+	min-height: 35rpx;
+	display: flex;
+	align-items: center;
+	justify-content: center;
+	line-height: 1;
+}
+
+.flex_item {
+	display: flex;
+	align-items: center;
+	/* justify-content: space-between; */
+}
+
+/* 左右顶格加上下居中 */
+.flex-between-center {
+	display: flex;
+	justify-content: space-between;
+	align-items: center;
+}
+
+/* flex布局-整体居中 */
+.flex-center {
+	display: flex;
+	align-items: center;
+	justify-content: center;
+}
+
+.flex-start {
+	display: flex;
+	align-items: center;
+	justify-content: flex-start;
+}
+
+/*文字对齐*/
+.text-left {
+	text-align: left !important;
+}
+
+.text-center {
+	text-align: center !important;
+}
+
+.text-justify {
+	text-align: justify !important;
+}
+
+.text-right {
+	text-align: right !important;
+}
+
+.text-default {
+	color: #212121 !important;
+}
+
+.text-white {
+	color: #ffffff !important;
+}
+
+.text-primary {
+	color: #00bcd4 !important;
+}
+
+.text-success {
+	color: #009688 !important;
+}
+
+.text-info {
+	color: #03a9f4 !important;
+}
+
+.text-warning {
+	color: #ffc107 !important;
+}
+
+.text-danger {
+	color: #e51c23 !important;
+}
+
+.text-pink {
+	color: #e91e63 !important;
+}
+
+.text-purple {
+	color: #673ab7 !important;
+}
+
+.text-indigo {
+	color: #3f51b5 !important;
+}
+
+.text-gray {
+	color: #999999 !important;
+}
+
+.bg-default {
+	background-color: #f5f5f5 !important;
+}
+
+.bg-primary {
+	background-color: #00bcd4 !important;
+}
+
+.bg-success {
+	background-color: #009688 !important;
+}
+
+.bg-info {
+	background-color: #03a9f4 !important;
+}
+
+.bg-warning {
+	background-color: #FFB238 !important;
+}
+
+.bg-danger {
+	background-color: #DC4D46 !important;
+}
+
+.bg-pink {
+	background-color: #e91e63 !important;
+}
+
+.bg-purple {
+	background-color: #673ab7 !important;
+}
+
+.bg-indigo {
+	background-color: #3f51b5 !important;
+}
+
+.bg-white {
+	background-color: white !important;
+}
+
+.bg-gray {
+	background-color: #e3e3e3 !important;
+}
+
+/* 边框 */
+.border-radius-15 {
+	border-radius: 15rpx;
+}
+
+.border-radius-10 {
+	border-radius: 10rpx;
+}
+
+.border-radius-all {
+	border-radius: 1000rpx;
+}
+
+/* 底部边线 */
+.borde-b {
+	border-bottom: 1px solid #dddddd;
+}
+
+/* 弹性盒子 */
+.flex {
+	display: flex;
+	align-items: center;
+	justify-content: space-between;
+}
+
+.items-left {
+	justify-content: flex-start;
+}
+
+.items-right {
+	justify-content: flex-end;
+}
+
+.flex-shrink-false {
+	flex-shrink: 0;
+}
+
+.flex-grow-true {
+	flex-grow: 1;
+}
+
+.position-relative {
+	position: relative;
+}

+ 1 - 1
store/index.js

@@ -5,7 +5,7 @@ Vue.use(Vuex)
 
 const store = new Vuex.Store({
 	state: {
-		baseURL: 'http://js.frp.liuniu946.com/',
+		baseURL: 'http://js.frp.liuniu946.com',
 		// baseURL: 'https://zhibo.liuniu946.com', //请求地址配置
 		urlFile: '/index', //项目部署所在文件夹
 		hasLogin: false, //是否登录

+ 8 - 8
uni.scss

@@ -4,11 +4,11 @@ $page-row-spacing: 30rpx;
 $page-color-base: #f8f8f8;//页面背景颜色
 $page-color-light: #f8f6fc;
 // 主题颜色
-$base-color: #6786FB;//项目颜色
-$box-shadow-color:#6786FB;//阴影颜色
-$font-color:#6786FB;//字体颜色
-$font-color-spec: #6786FB;//可操作文字颜色
-$background-color:#6786FB;//按钮背景颜色
+$base-color: #5dbc7c;//项目颜色
+$box-shadow-color:#5dbc7c;//阴影颜色
+$font-color:#5dbc7c;//字体颜色
+$font-color-spec: #5dbc7c;//可操作文字颜色
+$background-color:#5dbc7c;//按钮背景颜色
 // 小图标大小
 $uni-img-size-base:36rpx;
 /* 文字尺寸 */
@@ -18,6 +18,7 @@ $font-lg: 32rpx;
 /*文字颜色*/
 $font-color-dark: #303133;//黑
 $font-color-base: #606266;//基础
+$font-color-white:#ffffff;//白色
 $font-color-light: #909399;//灰色
 $font-color-disabled: #c0c4cc;//禁用
 /* 边框颜色 */
@@ -31,11 +32,10 @@ $color-yellow: #fd5b23;
 $color-gray: #999999;
 $color-green: #5dbc7c;
 $color-red: #dd524d;
-$color-red1: #FC4141;
 /* 图片加载中颜色 */
 $image-bg-color: #eee;
 /* 行为相关颜色 */
-$uni-color-primary: #dd524d;
+$uni-color-primary: #5dbc7c;
 $uni-color-success: #4cd964;
 $uni-color-warning: #f0ad4e;
 $uni-color-error: #dd524d;
@@ -44,7 +44,7 @@ $box-shadow: 0rpx 0rpx 10rpx 10rpx #f3f3f3;
 // 圆角
 $border-radius-sm: 15rpx;
 // 渐变背景颜色
-$bg-green-gradual: linear-gradient(#6786FB, #6786FB);
+$bg-green-gradual: linear-gradient(#5dbc7c, #71d094);
 /* 功能栏字体大小 */
 %font-title {
 	font-size: $font-lg + 2rpx;

+ 110 - 0
utils/SubscribeMessage.js

@@ -0,0 +1,110 @@
+import {
+	SUBSCRIBE_MESSAGE
+} from '../config/cache.js';
+
+export function auth() {
+	let tmplIds = {};
+	let messageTmplIds = uni.getStorageSync(SUBSCRIBE_MESSAGE);
+	tmplIds = messageTmplIds ? JSON.parse(messageTmplIds) : {};
+	return tmplIds;
+}
+
+/**
+ * 支付成功后订阅消息id
+ * 订阅  确认收货通知 订单支付成功  新订单管理员提醒 
+ */
+export function openPaySubscribe() {
+	let tmplIds = auth();
+	return subscribe([
+		tmplIds.oreder_takever,
+		tmplIds.order_pay_success,
+		tmplIds.order_new,
+	]);
+}
+
+/**
+ * 订单相关订阅消息
+ * 送货 发货 取消订单
+ */
+export function openOrderSubscribe() {
+	let tmplIds = auth();
+	return subscribe([
+		tmplIds.order_deliver_success,
+		tmplIds.order_postage_success,
+		tmplIds.order_clone
+	]);
+}
+
+/**
+ * 提现消息订阅
+ * 成功 和 失败 消息
+ */
+export function openExtrctSubscribe() {
+	let tmplIds = auth();
+	return subscribe([
+		tmplIds.user_extract
+	]);
+}
+
+/**
+ * 拼团成功
+ */
+export function openPinkSubscribe() {
+	let tmplIds = auth();
+	return subscribe([
+		tmplIds.pink_true
+	]);
+}
+
+/**
+ * 砍价成功
+ */
+export function openBargainSubscribe() {
+	let tmplIds = auth();
+	return subscribe([
+		tmplIds.bargain_success
+	]);
+}
+
+/**
+ * 订单退款
+ */
+export function openOrderRefundSubscribe() {
+	let tmplIds = auth();
+	return subscribe([tmplIds.order_refund]);
+}
+
+/**
+ * 充值成功
+ */
+export function openRechargeSubscribe() {
+	let tmplIds = auth();
+	return subscribe([tmplIds.recharge_success]);
+}
+
+/**
+ * 提现
+ */
+export function openEextractSubscribe() {
+	let tmplIds = auth();
+	return subscribe([tmplIds.user_extract]);
+}
+
+/**
+ * 调起订阅界面
+ * array tmplIds 模板id
+ */
+export function subscribe(tmplIds) {
+	 let wecaht = wx;
+	return new Promise((reslove, reject) => {
+		wecaht.requestSubscribeMessage({
+			tmplIds: tmplIds,
+			success(res) {
+				return reslove(res);
+			},
+			fail(res) {
+				return reslove(res);
+			}
+		})
+	});
+}

+ 134 - 0
utils/cache.js

@@ -0,0 +1,134 @@
+class Cache {
+	constructor(handler) {
+		this.cacheSetHandler = uni.setStorageSync;
+		this.cacheGetHandler = uni.getStorageSync;
+		this.cacheClearHandler = uni.removeStorageSync;
+		this.cacheExpire = '_expire_2019_12_17_18_44';
+	}
+	/**
+	 * 获取当前时间戳
+	 */
+	time() {
+		return Math.round(new Date() / 1000);
+	}
+	/**
+	 * 设置过期时间缓存
+	 * @param {Object} key
+	 * @param {Object} expire
+	 */
+	setExpireCahe(key, expire) {
+		expire = expire !== undefined ? expire : 0;
+		if (expire) {
+			this.cacheSetHandler(key + this.cacheExpire, this.time() + expire)
+		}
+	}
+	/**
+	 * 缓存是否过期,过期自动删除
+	 * @param {Object} key
+	 * @param {Object} $bool true = 删除,false = 不删除
+	 */
+	getExpireCahe(key, $bool) {
+		try {
+			let time = this.cacheGetHandler(key + this.cacheExpire);
+			if (time) {
+				let newTime = parseInt(time);
+				if (time && time < this.time() && !Number.isNaN(newTime)) {
+					if ($bool === undefined || $bool === true) {
+						this.cacheClearHandler(key);
+						this.cacheClearHandler(key + this.cacheExpire);
+					}
+					return false;
+				} else
+					return true;
+			} else {
+				return !!this.cacheGetHandler(key);
+			}
+		} catch (e) {
+			return false;
+		}
+	}
+
+	/**
+	 * 设置缓存
+	 * @param {Object} key
+	 * @param {Object} data
+	 */
+	set(key, data, expire) {
+		if (typeof data === 'object')
+			data = JSON.stringify(data);
+		try {
+			this.setExpireCahe(key, expire);
+			return this.cacheSetHandler(key, data);
+		} catch (e) {
+			return false;
+		}
+	}
+
+	/**
+	 * 检测缓存是否存在
+	 * @param {Object} key
+	 */
+	has(key) {
+		return this.getExpireCahe(key);
+	}
+
+	/**
+	 * 获取缓存
+	 * @param {Object} key
+	 * @param {Object} $default
+	 * @param {Object} expire
+	 */
+	get(key, $default, expire) {
+		try {
+			let isBe = this.getExpireCahe(key);
+			let data = this.cacheGetHandler(key);
+			if (data && isBe) {
+				if (typeof $default === 'boolean')
+					return JSON.parse(data);
+				else
+					return data;
+			} else {
+				if (typeof $default === 'function') {
+					let value = $default();
+					this.set(key, value, expire);
+					return value;
+				} else {
+					this.set(key, $default, expire);
+					return $default;
+				}
+			}
+		} catch (e) {
+			return null;
+		}
+	}
+
+	/**
+	 * 删除缓存
+	 * @param {Object} key
+	 */
+	clear(key) {
+		try {
+			let cahceValue = this.cacheGetHandler(key + this.cacheExpire);
+			if (cahceValue)
+				this.cacheClearHandler(key + this.cacheExpire);
+			return this.cacheClearHandler(key);
+		} catch (e) {
+			return false;
+		}
+	}
+
+	/**
+	 * 清除过期缓存
+	 */
+	clearOverdue() {
+		// let cacheList = uni.getStorageInfoSync(),that = this;
+		// if (typeof cacheList.keys === 'object'){
+		// 	cacheList.keys.forEach(item=>{
+		// 		that.getExpireCahe(item);
+		// 	})
+		// }
+	}
+}
+
+
+export default new Cache;

+ 89 - 0
utils/index.js

@@ -0,0 +1,89 @@
+import { spread } from "@/api/user";
+import Cache from "@/utils/cache";
+
+/**
+ * 绑定用户授权
+ * @param {Object} puid
+ */
+export function silenceBindingSpread()
+{
+	
+	
+	//#ifdef H5
+	let puid = Cache.get('spread');
+	//#endif
+	
+	//#ifdef MP
+	let puid = getApp().globalData.spid;
+	if(!puid){
+		puid = getApp().globalData.code;
+	}
+	//#endif
+	
+	//#ifdef APP-PLUS
+	let puid
+	//#endif
+	
+	puid = parseInt(puid);
+	if(Number.isNaN(puid)){
+		puid = 0;
+	}
+	if(puid){
+		spread(puid).then(res=>{
+			console.log(res);
+			//#ifdef H5
+			 Cache.clear('spread');
+			//#endif
+			
+			//#ifdef MP
+			 getApp().globalData.spid = 0;
+			 getApp().globalData.code = 0;
+			//#endif
+			
+		}).catch(res=>{
+			console.log(res);
+		});
+	}
+}
+
+export function isWeixin() {
+  return navigator.userAgent.toLowerCase().indexOf("micromessenger") !== -1;
+}
+
+export function parseQuery() {
+  const res = {};
+
+  const query = (location.href.split("?")[1] || "")
+    .trim()
+    .replace(/^(\?|#|&)/, "");
+
+  if (!query) {
+    return res;
+  }
+
+  query.split("&").forEach(param => {
+    const parts = param.replace(/\+/g, " ").split("=");
+    const key = decodeURIComponent(parts.shift());
+    const val = parts.length > 0 ? decodeURIComponent(parts.join("=")) : null;
+
+    if (res[key] === undefined) {
+      res[key] = val;
+    } else if (Array.isArray(res[key])) {
+      res[key].push(val);
+    } else {
+      res[key] = [res[key], val];
+    }
+  });
+
+  return res;
+}
+
+// #ifdef H5
+	const VUE_APP_WS_URL = process.env.VUE_APP_WS_URL || `ws://mmz.liuniu946.com:19003`;
+	// const VUE_APP_WS_URL = process.env.VUE_APP_WS_URL || `ws://admin.crmeb.net:21001`
+	export {VUE_APP_WS_URL}
+// #endif
+
+
+
+export default parseQuery;

+ 39 - 0
utils/log.js

@@ -0,0 +1,39 @@
+
+const logLength=100;//缓存存储上限
+const name = 'log';//缓存名字
+export function addLog (data,content='') {
+	let log = uni.getStorageSync(name)||[];
+	log.unshift({
+		title:data,
+		content:content
+	});
+	uni.setStorageSync(name,log);
+	initLog(log);
+}
+
+
+export function delLog () {
+	return uni.setStorageSync(name,'');
+}
+
+export function getLog () {
+	return uni.getStorageSync(name);
+}
+
+export function initLog (log) {
+	if(log.length>logLength){
+		const newarr = log.slice(log.length-logLength);
+		uni.setStorageSync(name,newarr);
+	}
+}
+export function showLog (log) {
+	
+	let str = '';
+	uni.getStorageSync(name).forEach((e) => {
+		str+=e.title+':'+JSON.stringify(e.content)
+	})
+	uni.showModal({
+		title:"日志",
+		content:str
+	})
+}

+ 23 - 54
utils/loginUtils.js

@@ -27,64 +27,33 @@ export function interceptor() {
 
 // 保存页面
 export function saveUrl() {
-	// 获取当前页面
+	let path = getPageUrl(true)
+	uni.setStorageSync('present', path);
+}
+
+// 处理分享链接地址
+export function getPageUrl(showSpeard=false) {
 	let page = getActionPage();
-	// 获取跳转前路由地址
 	let path = '/' + page.route;
-	// 判断是否在商品页
-	if (path == '/pages/product/product') {
-		if (page.spread) {
-			if (page.type) {
-				path = path + '?id=' + page.id +'&type='+page.goodsType+'&spread='+page.spread;
+	let url = '';
+	// 获取对象可枚举键值列表
+	let objKeys = Object.keys(page.options);
+	// 判断有无传值
+	if (objKeys.length > 0) {
+		// 循环赋值对象数据
+		for (let a in page.options) {
+			// 判断有无邀请人
+			if (a != 'speard') {
+				url += a + "=" + page.options[a] + "&"
 			}else{
-				path = path + '?id=' + page.id+'&spread='+page.spread;
+				// 判断是否需要存储邀请人
+				if(showSpeard){
+					url += a + "=" + page.options[a] + "&"
+				}
 			}
-		}else{
-			if (page.type) {
-				path = path + '?id=' + page.id +'&type=' + page.goodsType;
-			}else{
-				path = path + '?id=' + page.id;
-			}
-		}
-	}
-	//订单支付页面
-	if (path == '/pages/order/createOrder') {
-		// 判断是否为参团订单
-		if (page.option.type == "pink") {
-			const data = page.option;
-			path = path + '?pinkid=' + data.pinkid + '&type=pink' + '&pid=' + data.pid + '&gid=' + data.gid;
 		}
+		path += '?' + url.substr(0, url.length - 1);
 	}
-	//邀请好友拼团页面
-	if (path == '/pages/product/details') {
-		if (page.spread) {
-			path = path + '?pink_id=' + page.gp_id + '&spread=' + page.spread +'&teamid='+page.teamid;
-		}else{
-			path = path + '?pink_id=' + page.gp_id +'&teamid='+ page.teamid;
-		}
-	}
-	//我的订单页面
-	if (path == '/pages/order/order') {
-		if (page.state) {
-			path = path + '?state='+page.state;
-		}
-	}
-	//我的订单页面
-	if (path == '/pages/index/index') {
-		if (page.bingding) {
-			path = path + '?bingding='+page.bingding;
-		}
-			console.log(path)
-	}
-	//文章详情页面
-	if (path == '/pages/moments/details') {
-		if (page.spread) {
-			path = path +'?id=' + page.id + '&spread='+ page.spread;
-		}else{
-			path = path +'?id=' + page.id;
-		}
-	}
-	// 判断是否在登录页
-	// 保存当前过去页面
-	uni.setStorageSync('present', path);
+	// 返回处理邀请人后的邀请地址
+	return path
 }

+ 31 - 110
utils/newRequest.js

@@ -43,12 +43,26 @@ let service = {
 	open: async function(data) {
 		return await new Promise(function(resolve, reject) {
 			let requestData = ''; //保存处理完成后请求数据
+			let url =''//保存链接地址
 			//console.log(data);
 			// 请求前数据处理
 			requestData = service.request.success(data);
+			// #ifdef H5
+			
+			if(process.env.NODE_ENV === 'development'){
+				url= requestData.url;
+			    console.log('开发环境')
+			}else{
+				url=service.baseURL + requestData.url;
+			    console.log('生产环境')
+			}
+			// #endif
+			// #ifndef H5
+			url=service.baseURL + requestData.url;
+			// #endif
 			// 数据复制用于请求
 			uni.request({
-				url: service.baseURL + requestData.url,
+				url:url,
 				method: requestData.method || 'GET',
 				data: requestData.data,
 				header: data.header || service.header,
@@ -60,7 +74,7 @@ let service = {
 							service.response.error(e)
 						}
 					}
-					
+
 				},
 				// 请求失败数据处理
 				fail: (err) => {
@@ -71,9 +85,9 @@ let service = {
 	},
 	// 上传文件
 	upFilse: async function(data) {
-		console.log('--上传文件--upFilse',data)
 		return await new Promise(function(resolve, reject) {
 			let requestData = ''; //保存处理完成后请求数据
+			let url = '' //保存请求地址
 			try {
 				// 请求前数据处理
 				requestData = service.request.success(data);
@@ -81,9 +95,21 @@ let service = {
 				// 请求报错拦截
 				service.request.error(e);
 			}
+			// #ifdef H5
+			if(process.env.NODE_ENV === 'development'){
+				url= requestData.url;
+			    console.log('开发环境')
+			}else{
+				url=service.baseURL + requestData.url;
+			    console.log('生产环境')
+			}
+			// #endif
+			// #ifndef H5
+			url=service.baseURL + requestData.url;
+			// #endif
 			let config = {
 				// 上传图片的API
-				upload_img_url: service.baseURL + requestData.url
+				upload_img_url:url
 			}
 
 			let Uploader = {
@@ -92,8 +118,6 @@ let service = {
 					return new Promise((resolve, reject) => {
 						uni.chooseImage({
 							count: num,
-							sourceType:['album'],
-							sizeType:['compressed'],
 							success(res) {
 								// console.log(res);
 								// 缓存文件路径
@@ -105,6 +129,7 @@ let service = {
 							}
 						})
 					})
+
 				},
 				// 上传图片
 				upload_one(path) {
@@ -165,110 +190,6 @@ let service = {
 			})
 		})
 	},
-	// 上传文件
-	upFilse1: async function(data) {
-		console.log('--上传文件--upFilse1',data)
-		return await new Promise(function(resolve, reject) {
-			let requestData = ''; //保存处理完成后请求数据
-			try {
-				// 请求前数据处理
-				requestData = service.request.success(data);
-				console.log('请求前数据处理',data)
-			} catch (e) {
-				// 请求报错拦截
-				service.request.error(e);
-			}
-			let config = {
-				// 上传图片的API
-				upload_img_url: service.baseURL + requestData.url
-			}
-			console.log('--config--',config)
-			
-	
-			let Uploader = {
-				// 选择图片
-				choose(num) {
-					console.log('选择图片num',num)
-					return new Promise((resolve, reject) => {
-						resolve(data.data.filename)
-						// uni.chooseImage({
-						// 	count: num,
-						// 	sourceType:['album'],
-						// 	sizeType:['compressed'],
-						// 	success(res) {
-						// 		// console.log(res);
-						// 		// 缓存文件路径
-						// 		resolve(res.tempFilePaths)
-						// 	},
-						// 	fail(err) {
-						// 		console.log(err)
-						// 		reject(err)
-						// 	}
-						// })
-					})
-				},
-				// 上传图片
-				upload_one(path) {
-					return new Promise((resolve, reject) => {
-						uni.showLoading({
-							title: '上传中'
-						})
-						console.log('sc');
-						uni.uploadFile({
-							url: config.upload_img_url, //仅为示例,非真实的接口地址
-							filePath: path,
-							name: 'file',
-							header: {
-								"Authori-zation": 'Bearer ' + uni.getStorageSync('token')
-							},
-							success: (uploadFileRes) => {
-								if ("string" === typeof uploadFileRes.data) {
-									resolve(JSON.parse(uploadFileRes.data).data)
-								} else {
-									resolve(uploadFileRes.data.data)
-								}
-							},
-							complete() {
-								uni.hideLoading()
-							},
-							fail:function (e) {
-								console.log(e);
-							}
-						});
-					})
-				},
-				// 上传多个图片
-				upload(path_arr) {
-					let num = path_arr.length;
-					return new Promise(async (resolve, reject) => {
-						let img_urls = [];
-						let img_url = await this.upload_one(path_arr);
-							img_urls.push(img_url)
-						resolve(img_urls)
-					})
-				},
-				// 触发上传图片事件
-				choose_and_upload(num) {
-					return new Promise(async (resolve, reject) => {
-						// 选择图片
-						let path_arr = await this.choose(num);
-						console.log(path_arr,'kaishi')
-						// 上传图片
-						await this.upload(path_arr).then((e) => {
-							resolve(e);
-						}).catch((e) => {
-							reject(e)
-						});
-					})
-				}
-			};
-			Uploader.choose_and_upload(1).then((e) => {
-				resolve(e);
-			}).catch((e) => {
-				console.log(e);
-			})
-		})
-	},
 };
 
 

+ 24 - 0
utils/platform.js

@@ -0,0 +1,24 @@
+export function isAndroid() {  
+    var ua = navigator.userAgent,  
+            _isAndroid = ua.indexOf('Android') > -1 || ua.indexOf('Linux') > -1;  
+    return _isAndroid;  
+}  
+
+export function isIOS() {  
+    return !!navigator.userAgent.match(/(i[^;]+\;(U;)? CPU.+Mac OS X)/);  
+}  
+
+export function isPad() {  
+    return navigator.userAgent.toLowerCase().match(/iPad/i) == "ipad";  
+}  
+
+export function isWinPad() {  
+    return navigator.userAgent.indexOf("Windows NT") >= 0;  
+}  
+
+export default {
+	isAndroid,
+	isIOS,
+	isPad,
+	isWinPad
+}

+ 18 - 24
utils/request.js

@@ -8,40 +8,39 @@ import {
 service.interceptors.response(
 	response => {
 		try {
-			let res = response.data||{};
+			let res = response.data;
 			// 解析字符串为数字
 			if (res.status !== 200) {
+				console.log(res.status);
 				if (res.status == 410000) {
-					// 存储当前地址
-					saveUrl()
 					// 调用退出登录方法清空用户信息
-					store.commit('logout');
+					store.commit('user/logout');
 					// 判断是否开启强制登录
 					uni.showModal({
-						title: "您未登录!是否马上登录?",
+						title: "登陆",
+						content: '您未登录!是否马上登录?',
 						success: (e) => {
+							// 判断是否点击确认按钮
 							if (e.confirm) {
 								// 保存当前页面地址
+								saveUrl()
 								// 跳转页面
 								interceptor()
 							}
 						}
 					})
 				} else {
-					if (res.msg.indexOf('人数过多')  == -1) {
-						if(res.msg!='系统出现异常' && res.msg != '0' && res.msg != 'ok' && res.msg != '找不到订单' ){
-							uni.showToast({
-								title: res.msg,
-								duration: 1500,
-								mask: true,
-								icon: 'none',
-							})
-						} 
+					if (res.msg != '系统出现异常') {
+						uni.showToast({
+							title: res.msg,
+							duration: 1500,
+							mask: false,
+							icon: 'none',
+						})
+
 					}
-					
 				}
-				// return res
-				return Promise.reject(new Error(res.msg || 'Error'))
+				return Promise.reject(res)
 			} else {
 				return res
 			}
@@ -63,19 +62,15 @@ service.interceptors.response(
 // 请求前拦截器
 service.interceptors.request(
 	config => {
-		// config.data.token = getToken();
+		let token = uni.getStorageSync('token') || '';
 		// console.log(config);
-		let token = uni.getStorageSync('token');
-		// console.log(token);
 		if (!config.header) {
 			config.header = {
 				"Authori-zation": 'Bearer ' + token,
-				// "Authori-zation": 'Bearer ' + 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0bXAwMS5ra3R2Ni5jb20iLCJhdWQiOiJ0bXAwMS5ra3R2Ni5jb20iLCJpYXQiOjE2MTQ3Mzg1ODMsIm5iZiI6MTYxNDczODU4MywiZXhwIjoxNjE1MzQzMzgzLCJqdGkiOnsiaWQiOjIsInR5cGUiOiJyb3V0aW5lIn19.AgLlkg3V8--Rkp-uG-YAY123N6aYVHV4zhjYOPbg1ew',
 			}
 		} else {
 			// 添加key请求头
 			config.header["Authori-zation"] = 'Bearer ' + token;
-	 // config.header["Authori-zation"] = 'Bearer ' +'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ0bXAwMS5ra3R2Ni5jb20iLCJhdWQiOiJ0bXAwMS5ra3R2Ni5jb20iLCJpYXQiOjE2MTQ3Mzg1ODMsIm5iZiI6MTYxNDczODU4MywiZXhwIjoxNjE1MzQzMzgzLCJqdGkiOnsiaWQiOjIsInR5cGUiOiJyb3V0aW5lIn19.AgLlkg3V8--Rkp-uG-YAY123N6aYVHV4zhjYOPbg1ew'
 		}
 		return config
 	},
@@ -86,8 +81,7 @@ service.interceptors.request(
 	}
 )
 let upFilse = service.upFilse;
-let upFilse1= service.upFilse1;
 export {
-	upFilse,upFilse1
+	upFilse
 };
 export default service.open;

+ 78 - 33
utils/rocessor.js

@@ -1,3 +1,4 @@
+//身份证验证	
 export function isCardNo(card) {
 	// 身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X 
 	var reg =
@@ -5,30 +6,13 @@ export function isCardNo(card) {
 	if (reg.test(card) === false) {
 		console.log(card);
 		return false;
-		
+
 	}
 	return true
 }
 
-// 名字中间用*
-export function formatName(name) {
-		let newStr;
-		if (name.length === 2) {
-		newStr = name.substr(0, 1) + '*';
-		} else if (name.length > 2) {
-			let charr = '';
-			for (let i = 0, len = name.length - 7; i < len; i++) {
-				charr += '*';
-			}
-			newStr = name.substr(0, 3) + charr + name.substr(-3, 3);
-		} else {
-			newStr = name;
-		}
-		
-		return newStr;
-}
-
-export function getMoneyStyle(value=0) {
+// 金额显示变化
+export function getMoneyStyle(value = 0) {
 	if (typeof value == 'string') {
 		value = (+value).toFixed(2)
 	}
@@ -50,26 +34,87 @@ export function getMoneyStyle(value=0) {
 	arr = arr.reverse().join('')
 	return arr;
 }
+
 // 倒计时计算
 // 计算倒计时时间
 export function timeComputed(time) {
 	// 获取当前时间
-	let actTime = (new Date()).getTime();
+	const actTime = (new Date()).getTime();
 	// 获取到期时间
-	let stopTime = time-actTime;
-	let daytime = Math.floor(stopTime/24/3600/1000)
+	let stopTime = time - actTime;
 	// 判断是否小于0
-	if(stopTime <0){
-		stopTime  = stopTime*-1
+	if (stopTime < 0) {
+		stopTime = stopTime * -1
 	}
-	let day = daytime;//获取剩余小时
-	let hours = Math.floor((stopTime/1000/60/60)%24);//获取剩余小时数
-	let minutes =  Math.floor((stopTime/1000/60)%60);//获取分钟
-	let seconds = Math.floor((stopTime/1000)%60);//获取秒数
+	let day = Math.floor(stopTime / 1000 / 60 / 60 / 24) //获取剩余天
+	let hours = Math.floor((stopTime / 1000 / 60 / 60) % 24); //获取剩余小时数
+	let minutes = Math.floor((stopTime / 1000 / 60) % 60); //获取分钟
+	let seconds = Math.floor((stopTime / 1000) % 60); //获取秒数
 	return {
-		day,//倒计时天数
-		hours,//倒计时小时数
-		minutes,//倒计时分钟数
-		seconds//倒计时秒数
+		hours, //倒计时小时数
+		minutes, //倒计时分钟数
+		seconds, //倒计时秒数
+		day //倒计时天数
+	}
+}
+
+// 调用打开地图方法
+export function openMap(e) {
+	const that = this
+	return new Promise((resolve, reject) => {
+		wx.getSetting({
+			success(res) {
+				//这里判断是否有地位权限
+				if (!res.authSetting['scope.userLocation']) {
+					wx.showModal({
+						title: '提示',
+						content: '请求获取位置权限',
+						success: function(res) {
+							if (res.confirm == false) {
+								// 授权失败
+								reject()
+								return false;
+							}
+							wx.openSetting({
+								success(res) {
+									//如果再次拒绝则返回页面并提示
+									if (!res.authSetting['scope.userLocation']) {
+										wx.showToast({
+											title: '此功能需获取位置信息,请重新设置',
+											duration: 3000,
+											icon: 'none'
+										})
+									} else {
+										//允许授权,调用地图
+										resolve()
+									}
+								}
+							})
+						}
+					})
+				} else {
+					//如果有定位权限,调用地图
+					resolve()
+				}
+			}
+		})
+	})
+}
+//时间戳转换成时间
+export function getTime(time) {
+	const num =13 - (time+'').length;
+	let l = 1;//倍数
+	for (let i = 0; i < num; i++) {
+		l+='0';
 	}
+	// 重新解析为数字
+	l = parseInt(l)
+	const date = new Date(parseInt(time) * l);
+	const year = date.getFullYear();
+	const mon = date.getMonth() + 1;
+	const day = date.getDate();
+	const hours = date.getHours();
+	const minu = date.getMinutes();
+	const sec = date.getSeconds();
+	return year + '-' + mon + '-' + day + ' ' + hours + ':' + minu + ':' + sec;
 }

+ 42 - 0
utils/uni-copy.js

@@ -0,0 +1,42 @@
+export default function uniCopy({content,success,error}) {
+	if(!content) return error('复制的内容不能为空 !')
+	content = typeof content === 'string' ? content : content.toString() // 复制内容,必须字符串,数字需要转换为字符串
+	/**
+	 * 小程序端 和 app端的复制逻辑
+	 */
+	//#ifndef H5
+	uni.setClipboardData({
+		data: content,
+		success: function() {
+			success("复制成功~")
+			console.log('success');
+		},
+		fail:function(){
+			success("复制失败~")
+		}
+	});
+	//#endif
+	
+	/**
+	 * H5端的复制逻辑
+	 */
+	// #ifdef H5
+	if (!document.queryCommandSupported('copy')) { //为了兼容有些浏览器 queryCommandSupported 的判断
+		// 不支持
+		error('浏览器不支持')
+	}
+	let textarea = document.createElement("textarea")
+	textarea.value = content
+	textarea.readOnly = "readOnly"
+	document.body.appendChild(textarea)
+	textarea.select() // 选择对象
+	textarea.setSelectionRange(0, content.length) //核心
+	let result = document.execCommand("copy") // 执行浏览器复制命令
+	if(result){
+		success("复制成功~")
+	}else{
+		error("复制失败,请检查h5中调用该方法的方式,是不是用户点击的方式调用的,如果不是请改为用户点击的方式触发该方法,因为h5中安全性,不能js直接调用!")
+	}	
+	textarea.remove()
+	// #endif
+}

+ 111 - 0
utils/upApp.js

@@ -0,0 +1,111 @@
+import store from '../store/index.js'
+const getUpAppUrl = 'https://itunes.apple.com/cn/lookup?id=1524593346'
+const iosAppStroeUrl =
+	'https://apps.apple.com/cn/app/%E6%BB%A1%E5%9B%AD%E6%98%A5%E7%BA%BF%E4%B8%8A%E5%95%86%E5%9F%8E/id1524593346';
+
+// 获取app是否需要升级
+export function getUpApp () {
+	// 获取当前运行系统
+	let hj = uni.getSystemInfoSync().platform;
+	// 获取仓库app数据对象
+	let app = store.state.isShowIllegality;
+	// 当前系统为安卓则显示数据
+	if (hj === 'android') {
+		// 设置默认显示数据
+		app = true;
+		store.commit('changeState', {
+			name: 'app',
+			value: app
+		});
+	}
+	uni.request({
+		url: getUpAppUrl,
+		method: 'POST',
+		data: {},
+		success: res => {
+			let r = res.data;
+			plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
+				// 保存线上版本号
+				let version = r.results[0].version;
+				// 获取线上版本
+				const arr = r.results[0].version.split('.');
+				// 获取当前系统
+				const arr1 = wgtinfo.version.split('.');
+				for (let i = 0; i < arr.length; i++) {
+					// 线上版本号
+					const x = +arr[i];
+					// 线下版本号
+					const y = +arr1[i];
+					// 判断当前版本是否为小于等于线上版本
+					if (x <= y) {
+						// 只有ios才需要显示
+						if (hj === 'ios') {
+							// 设置显示数据
+							app = true;
+							store.commit('changeState', {
+								name: 'app',
+								value: app
+							});
+						}
+						// 当版本较低时更新数据
+						if (x < y) {
+							uni.showModal({
+								title: '提示',
+								content: '请更新应用',
+								showCancel: false,
+								success(e) {
+									if (hj === 'ios') {
+										plus.runtime.openURL(
+											iosAppStroeUrl
+										);
+									}
+									if (hj === 'android') {
+										// plus.runtime.openURL('http://lxscimg.liuniu946.com/lxscV' + version + '.apk');
+										_self.downApp(version);
+									}
+								}
+							});
+						}
+						return;
+					}
+				}
+			});
+		},
+	});
+}
+// 下载app
+export function downApp (version) {
+	plus.nativeUI.showWaiting('下载升级包...');
+	plus.downloader
+		.createDownload('http://lxscimg.liuniu946.com/lxscV' + version + '.apk', {}, (d, status) => {
+			if (status == 200) {
+				installApp(d.filename); // 安装app
+			} else {
+				plus.nativeUI.alert('下载升级包失败!');
+			}
+			plus.nativeUI.closeWaiting();
+		})
+		.start();
+}
+// 安装app
+export function installApp (path) {
+	plus.nativeUI.showWaiting('安装升级包...');
+	plus.runtime.install(
+		path, {},
+		function() {
+			plus.nativeUI.closeWaiting();
+			uni.showToast({
+				icon: 'none',
+				title: '升级完成,准备重新载入'
+			});
+			setTimeout(_ => {
+				uni.hideToast();
+				plus.runtime.restart();
+			}, 1000);
+		},
+		function(e) {
+			plus.nativeUI.closeWaiting();
+			plus.nativeUI.alert('安装升级包失败[' + e.code + ']:' + e.message);
+		}
+	);
+}

+ 550 - 0
utils/util.js

@@ -0,0 +1,550 @@
+import {
+ 	TOKENNAME,
+ 	HTTP_REQUEST_URL
+ } from '../config/app.js';
+ import store from '../store';
+ import {
+ 	pathToBase64
+ } from '@/plugin/image-tools/index.js';
+ // #ifdef APP-PLUS
+ // import permision from "permission.js"
+ // #endif
+ export default {
+ 	/**
+ 	 * opt  object | string
+ 	 * to_url object | string
+ 	 * 例:
+ 	 * this.Tips('/pages/test/test'); 跳转不提示
+ 	 * this.Tips({title:'提示'},'/pages/test/test'); 提示并跳转
+ 	 * this.Tips({title:'提示'},{tab:1,url:'/pages/index/index'}); 提示并跳转值table上
+ 	 * tab=1 一定时间后跳转至 table上
+ 	 * tab=2 一定时间后跳转至非 table上
+ 	 * tab=3 一定时间后返回上页面
+ 	 * tab=4 关闭所有页面跳转至非table上
+ 	 * tab=5 关闭当前页面跳转至table上
+ 	 */
+ 	Tips: function(opt, to_url) {
+ 		if (typeof opt == 'string') {
+ 			to_url = opt;
+ 			opt = {};
+ 		}
+ 		let title = opt.title || '',
+ 			icon = opt.icon || 'none',
+ 			endtime = opt.endtime || 2000,
+ 			success = opt.success;
+ 		if (title) uni.showToast({
+ 			title: title,
+ 			icon: icon,
+ 			duration: endtime,
+ 			success
+ 		})
+ 		if (to_url != undefined) {
+ 			if (typeof to_url == 'object') {
+ 				let tab = to_url.tab || 1,
+ 					url = to_url.url || '';
+ 				switch (tab) {
+ 					case 1:
+ 						//一定时间后跳转至 table
+ 						setTimeout(function() {
+ 							uni.switchTab({
+ 								url: url
+ 							})
+ 						}, endtime);
+ 						break;
+ 					case 2:
+ 						//跳转至非table页面
+ 						setTimeout(function() {
+ 							uni.navigateTo({
+ 								url: url,
+ 							})
+ 						}, endtime);
+ 						break;
+ 					case 3:
+ 						//返回上页面
+ 						setTimeout(function() {
+ 							// #ifndef H5
+ 							uni.navigateBack({
+ 								delta: parseInt(url),
+ 							})
+ 							// #endif
+ 							// #ifdef H5
+ 							history.back();
+ 							// #endif
+ 						}, endtime);
+ 						break;
+ 					case 4:
+ 						//关闭当前所有页面跳转至非table页面
+ 						setTimeout(function() {
+ 							uni.reLaunch({
+ 								url: url,
+ 							})
+ 						}, endtime);
+ 						break;
+ 					case 5:
+ 						//关闭当前页面跳转至非table页面
+ 						setTimeout(function() {
+ 							uni.redirectTo({
+ 								url: url,
+ 							})
+ 						}, endtime);
+ 						break;
+ 				}
+
+ 			} else if (typeof to_url == 'function') {
+ 				setTimeout(function() {
+ 					to_url && to_url();
+ 				}, endtime);
+ 			} else {
+ 				//没有提示时跳转不延迟
+ 				setTimeout(function() {
+ 					uni.navigateTo({
+ 						url: to_url,
+ 					})
+ 				}, title ? endtime : 0);
+ 			}
+ 		}
+ 	},
+ 	/**
+ 	 * 移除数组中的某个数组并组成新的数组返回
+ 	 * @param array array 需要移除的数组
+ 	 * @param int index 需要移除的数组的键值
+ 	 * @param string | int 值
+ 	 * @return array
+ 	 * 
+ 	 */
+ 	ArrayRemove: function(array, index, value) {
+ 		const valueArray = [];
+ 		if (array instanceof Array) {
+ 			for (let i = 0; i < array.length; i++) {
+ 				if (typeof index == 'number' && array[index] != i) {
+ 					valueArray.push(array[i]);
+ 				} else if (typeof index == 'string' && array[i][index] != value) {
+ 					valueArray.push(array[i]);
+ 				}
+ 			}
+ 		}
+ 		return valueArray;
+ 	},
+ 	/**
+ 	 * 生成海报获取文字
+ 	 * @param string text 为传入的文本
+ 	 * @param int num 为单行显示的字节长度
+ 	 * @return array 
+ 	 */
+ 	textByteLength: function(text, num) {
+ 		let strLength = 0;
+ 		let rows = 1;
+ 		let str = 0;
+ 		let arr = [];
+ 		for (let j = 0; j < text.length; j++) {
+ 			if (text.charCodeAt(j) > 255) {
+ 				strLength += 2;
+ 				if (strLength > rows * num) {
+ 					strLength++;
+ 					arr.push(text.slice(str, j));
+ 					str = j;
+ 					rows++;
+ 				}
+ 			} else {
+ 				strLength++;
+ 				if (strLength > rows * num) {
+ 					arr.push(text.slice(str, j));
+ 					str = j;
+ 					rows++;
+ 				}
+ 			}
+ 		}
+ 		arr.push(text.slice(str, text.length));
+ 		return [strLength, arr, rows] //  [处理文字的总字节长度,每行显示内容的数组,行数]
+ 	},
+
+ 	/**
+ 	 * 获取分享海报
+ 	 * @param array arr2 海报素材
+ 	 * @param string store_name 素材文字
+ 	 * @param string price 价格
+ 	 * @param function successFn 回调函数
+ 	 * 
+ 	 * 
+ 	 */
+ 	PosterCanvas: function(arr2, store_name, price, successFn) {
+ 		let that = this;
+ 		uni.showLoading({
+ 			title: '海报生成中',
+ 			mask: true
+ 		});
+ 		const ctx = uni.createCanvasContext('myCanvas');
+ 		ctx.clearRect(0, 0, 0, 0);
+ 		/**
+ 		 * 只能获取合法域名下的图片信息,本地调试无法获取
+ 		 * 
+ 		 */
+ 		uni.getImageInfo({
+ 			src: arr2[0],
+ 			success: function(res) {
+				console.log(res,'getImageInfo')
+ 				const WIDTH = res.width;
+ 				const HEIGHT = res.height;
+ 				ctx.drawImage(arr2[0], 0, 0, WIDTH, HEIGHT);
+ 				ctx.drawImage(arr2[1], 0, 0, WIDTH, WIDTH);
+ 				ctx.save();
+ 				let r = 90;
+ 				let d = r * 2;
+ 				let cx = 40;
+ 				let cy = 990;
+ 				ctx.arc(cx + r, cy + r, r, 0, 2 * Math.PI);
+ 				// ctx.clip();
+ 				ctx.drawImage(arr2[2], cx, cy,d,d);
+ 				ctx.restore();
+ 				const CONTENT_ROW_LENGTH = 40;
+ 				let [contentLeng, contentArray, contentRows] = that.textByteLength(store_name, CONTENT_ROW_LENGTH);
+ 				if (contentRows > 2) {
+ 					contentRows = 2;
+ 					let textArray = contentArray.slice(0, 2);
+ 					textArray[textArray.length - 1] += '……';
+ 					contentArray = textArray;
+ 				}
+ 				ctx.setTextAlign('center');
+ 				ctx.setFontSize(32);
+ 				let contentHh = 32 * 1.3;
+ 				for (let m = 0; m < contentArray.length; m++) {
+ 					ctx.fillText(contentArray[m], WIDTH / 2, 820 + contentHh * m);
+ 				}
+ 				ctx.setTextAlign('center')
+ 				ctx.setFontSize(48);
+ 				ctx.setFillStyle('red');
+ 				ctx.fillText('¥' + price, WIDTH / 2, 880 + contentHh);
+ 				ctx.draw(true, function() {
+ 					uni.canvasToTempFilePath({
+ 						canvasId: 'myCanvas',
+ 						fileType: 'png',
+ 						destWidth: WIDTH,
+ 						destHeight: HEIGHT,
+ 						success: function(res) {
+ 							uni.hideLoading();
+ 							successFn && successFn(res.tempFilePath);
+ 						}
+ 					})
+ 				});
+ 			},
+ 			fail: function(err) {
+ 				uni.hideLoading();
+ 				that.Tips({
+ 					title: '无法获取图片信息'
+ 				});
+ 			}
+ 		})
+ 	},
+ 	/*
+ 	 * 单图上传
+ 	 * @param object opt
+ 	 * @param callable successCallback 成功执行方法 data 
+ 	 * @param callable errorCallback 失败执行方法 
+ 	 */
+ 	uploadImageOne: function(opt, successCallback, errorCallback) {
+ 		let that = this;
+ 		if (typeof opt === 'string') {
+ 			let url = opt;
+ 			opt = {};
+ 			opt.url = url;
+ 		}
+ 		let count = opt.count || 1,
+ 			sizeType = opt.sizeType || ['compressed'],
+ 			sourceType = opt.sourceType || ['album', 'camera'],
+ 			is_load = opt.is_load || true,
+ 			uploadUrl = opt.url || '',
+ 			inputName = opt.name || 'pics';
+ 		uni.chooseImage({
+ 			count: count, //最多可以选择的图片总数  
+ 			sizeType: sizeType, // 可以指定是原图还是压缩图,默认二者都有  
+ 			sourceType: sourceType, // 可以指定来源是相册还是相机,默认二者都有  
+ 			success: function(res) {
+				console.log()
+ 				//启动上传等待中...  
+ 				uni.showLoading({
+ 					title: '图片上传中',
+ 				});
+				uni.uploadFile({
+					url: HTTP_REQUEST_URL + '/api/' + uploadUrl,
+					filePath: res.tempFilePaths[0],
+					name: inputName,
+					formData: {
+						'filename': inputName
+					},
+					header: {
+						// #ifdef MP
+						"Content-Type": "multipart/form-data",
+						// #endif
+						[TOKENNAME]: 'Bearer ' + store.state.app.token
+					},
+					success: function(res) {
+						uni.hideLoading();
+						if (res.statusCode == 403) {
+							that.Tips({
+								title: res.data
+							});
+						} else {
+							let data = res.data ? JSON.parse(res.data) : {};
+							if (data.status == 200) {
+								successCallback && successCallback(data)
+							} else {
+								errorCallback && errorCallback(data);
+								that.Tips({
+									title: data.msg
+								});
+							}
+						}
+					},
+					fail: function(res) {
+						uni.hideLoading();
+						that.Tips({
+							title: '上传图片失败'
+						});
+					}
+				})
+ 				// pathToBase64(res.tempFilePaths[0])
+ 				// 	.then(imgBase64 => {
+ 				// 		console.log(imgBase64);
+ 						
+ 				// 	})
+ 				// 	.catch(error => {
+ 				// 		console.error(error)
+ 				// 	})
+ 			}
+ 		})
+ 	},
+ 	/**
+ 	 * 处理服务器扫码带进来的参数
+ 	 * @param string param 扫码携带参数
+ 	 * @param string k 整体分割符 默认为:&
+ 	 * @param string p 单个分隔符 默认为:=
+ 	 * @return object
+ 	 * 
+ 	 */
+ 	// #ifdef MP
+ 	getUrlParams: function(param, k, p) {
+ 		if (typeof param != 'string') return {};
+ 		k = k ? k : '&'; //整体参数分隔符
+ 		p = p ? p : '='; //单个参数分隔符
+ 		var value = {};
+ 		if (param.indexOf(k) !== -1) {
+ 			param = param.split(k);
+ 			for (var val in param) {
+ 				if (param[val].indexOf(p) !== -1) {
+ 					var item = param[val].split(p);
+ 					value[item[0]] = item[1];
+ 				}
+ 			}
+ 		} else if (param.indexOf(p) !== -1) {
+ 			var item = param.split(p);
+ 			value[item[0]] = item[1];
+ 		} else {
+ 			return param;
+ 		}
+ 		return value;
+ 	},
+ 	// #endif
+ 	/*
+ 	 * 合并数组
+ 	 */
+ 	SplitArray(list, sp) {
+ 		if (typeof list != 'object') return [];
+ 		if (sp === undefined) sp = [];
+ 		for (var i = 0; i < list.length; i++) {
+ 			sp.push(list[i]);
+ 		}
+ 		return sp;
+ 	},
+ 	trim(str) {
+ 		return String.prototype.trim.call(str);
+ 	},
+ 	$h: {
+ 		//除法函数,用来得到精确的除法结果
+ 		//说明:javascript的除法结果会有误差,在两个浮点数相除的时候会比较明显。这个函数返回较为精确的除法结果。
+ 		//调用:$h.Div(arg1,arg2)
+ 		//返回值:arg1除以arg2的精确结果
+ 		Div: function(arg1, arg2) {
+ 			arg1 = parseFloat(arg1);
+ 			arg2 = parseFloat(arg2);
+ 			var t1 = 0,
+ 				t2 = 0,
+ 				r1, r2;
+ 			try {
+ 				t1 = arg1.toString().split(".")[1].length;
+ 			} catch (e) {}
+ 			try {
+ 				t2 = arg2.toString().split(".")[1].length;
+ 			} catch (e) {}
+ 			r1 = Number(arg1.toString().replace(".", ""));
+ 			r2 = Number(arg2.toString().replace(".", ""));
+ 			return this.Mul(r1 / r2, Math.pow(10, t2 - t1));
+ 		},
+ 		//加法函数,用来得到精确的加法结果
+ 		//说明:javascript的加法结果会有误差,在两个浮点数相加的时候会比较明显。这个函数返回较为精确的加法结果。
+ 		//调用:$h.Add(arg1,arg2)
+ 		//返回值:arg1加上arg2的精确结果
+ 		Add: function(arg1, arg2) {
+ 			arg2 = parseFloat(arg2);
+ 			var r1, r2, m;
+ 			try {
+ 				r1 = arg1.toString().split(".")[1].length
+ 			} catch (e) {
+ 				r1 = 0
+ 			}
+ 			try {
+ 				r2 = arg2.toString().split(".")[1].length
+ 			} catch (e) {
+ 				r2 = 0
+ 			}
+ 			m = Math.pow(100, Math.max(r1, r2));
+ 			return (this.Mul(arg1, m) + this.Mul(arg2, m)) / m;
+ 		},
+ 		//减法函数,用来得到精确的减法结果
+ 		//说明:javascript的加法结果会有误差,在两个浮点数相加的时候会比较明显。这个函数返回较为精确的减法结果。
+ 		//调用:$h.Sub(arg1,arg2)
+ 		//返回值:arg1减去arg2的精确结果
+ 		Sub: function(arg1, arg2) {
+ 			arg1 = parseFloat(arg1);
+ 			arg2 = parseFloat(arg2);
+ 			var r1, r2, m, n;
+ 			try {
+ 				r1 = arg1.toString().split(".")[1].length
+ 			} catch (e) {
+ 				r1 = 0
+ 			}
+ 			try {
+ 				r2 = arg2.toString().split(".")[1].length
+ 			} catch (e) {
+ 				r2 = 0
+ 			}
+ 			m = Math.pow(10, Math.max(r1, r2));
+ 			//动态控制精度长度
+ 			n = (r1 >= r2) ? r1 : r2;
+ 			return ((this.Mul(arg1, m) - this.Mul(arg2, m)) / m).toFixed(n);
+ 		},
+ 		//乘法函数,用来得到精确的乘法结果
+ 		//说明:javascript的乘法结果会有误差,在两个浮点数相乘的时候会比较明显。这个函数返回较为精确的乘法结果。
+ 		//调用:$h.Mul(arg1,arg2)
+ 		//返回值:arg1乘以arg2的精确结果
+ 		Mul: function(arg1, arg2) {
+ 			arg1 = parseFloat(arg1);
+ 			arg2 = parseFloat(arg2);
+ 			var m = 0,
+ 				s1 = arg1.toString(),
+ 				s2 = arg2.toString();
+ 			try {
+ 				m += s1.split(".")[1].length
+ 			} catch (e) {}
+ 			try {
+ 				m += s2.split(".")[1].length
+ 			} catch (e) {}
+ 			return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m);
+ 		},
+ 	},
+ 	// 获取地理位置;
+ 	$L: {
+ 		async getLocation() {
+ 			// #ifdef APP-PLUS
+ 			let status = await this.checkPermission();
+ 			if (status !== 1) {
+ 				return;
+ 			}
+ 			// #endif
+ 			// #ifdef MP-WEIXIN || MP-TOUTIAO || MP-QQ
+ 			let status = await this.getSetting();
+ 			if (status === 2) {
+ 				this.openSetting();
+ 				return;
+ 			}
+ 			// #endif
+
+ 			this.doGetLocation();
+ 		},
+ 		doGetLocation() {
+ 			uni.getLocation({
+ 				success: (res) => {
+ 					uni.removeStorageSync('CACHE_LONGITUDE');
+ 					uni.removeStorageSync('CACHE_LATITUDE');
+ 					uni.setStorageSync('CACHE_LONGITUDE', res.longitude);
+ 					uni.setStorageSync('CACHE_LATITUDE', res.latitude);
+ 				},
+ 				fail: (err) => {
+ 					// #ifdef MP-BAIDU
+ 					if (err.errCode === 202 || err.errCode === 10003) { // 202模拟器 10003真机 user deny
+ 						this.openSetting();
+ 					}
+ 					// #endif
+ 					// #ifndef MP-BAIDU
+ 					if (err.errMsg.indexOf("auth deny") >= 0) {
+ 						uni.showToast({
+ 							title: "访问位置被拒绝"
+ 						})
+ 					} else {
+ 						uni.showToast({
+ 							title: err.errMsg
+ 						})
+ 					}
+ 					// #endif
+ 				}
+ 			})
+ 		},
+ 		getSetting: function() {
+ 			return new Promise((resolve, reject) => {
+ 				uni.getSetting({
+ 					success: (res) => {
+ 						if (res.authSetting['scope.userLocation'] === undefined) {
+ 							resolve(0);
+ 							return;
+ 						}
+ 						if (res.authSetting['scope.userLocation']) {
+ 							resolve(1);
+ 						} else {
+ 							resolve(2);
+ 						}
+ 					}
+ 				});
+ 			});
+ 		},
+ 		openSetting: function() {
+ 			uni.openSetting({
+ 				success: (res) => {
+ 					if (res.authSetting && res.authSetting['scope.userLocation']) {
+ 						this.doGetLocation();
+ 					}
+ 				},
+ 				fail: (err) => {}
+ 			})
+ 		}
+ 		// async checkPermission() {
+ 		// 	let status = permision.isIOS ? await permision.requestIOS('location') :
+ 		// 		await permision.requestAndroid('android.permission.ACCESS_FINE_LOCATION');
+
+ 		// 	if (status === null || status === 1) {
+ 		// 		status = 1;
+ 		// 	} else if (status === 2) {
+ 		// 		uni.showModal({
+ 		// 			content: "系统定位已关闭",
+ 		// 			confirmText: "确定",
+ 		// 			showCancel: false,
+ 		// 			success: function(res) {}
+ 		// 		})
+ 		// 	} else if (status.code) {
+ 		// 		uni.showModal({
+ 		// 			content: status.message
+ 		// 		})
+ 		// 	} else {
+ 		// 		uni.showModal({
+ 		// 			content: "需要定位权限",
+ 		// 			confirmText: "设置",
+ 		// 			success: function(res) {
+ 		// 				if (res.confirm) {
+ 		// 					permision.gotoAppSetting();
+ 		// 				}
+ 		// 			}
+ 		// 		})
+ 		// 	}
+ 		// 	return status;
+ 		// },
+ 	}
+
+ }

+ 161 - 95
utils/wxAuthorized.js

@@ -2,22 +2,26 @@ import {
 	wechatConfig,
 	share
 } from '@/api/wx';
+// 加载日志
+import * as log from './log.js'
+import {
+	isAndroid
+} from './platform.js'
 import store from '../store';
 // 保存wx对象
-// #ifdef H5
-let weixinObj = require('jweixin-module');
-// #endif
-
+import weixinObj from "@/plugin/jweixin-module/index.js";
 // 保存分享数据
 let shareData = '';
 // 保存注册返回appId数据
 let appId = '';
-
+//保存路由对象
+let router = '';
 //微信登录
 /**
  * @param {string} 当前页面地址信息
  */
 export function loginWinxin() {
+	console.log('1');
 	let pages, page, path;
 	try {
 		pages = getCurrentPages();
@@ -27,34 +31,30 @@ export function loginWinxin() {
 		path = page.route;
 	} catch (e) {
 		console.log(e);
+		//TODO handle the exception
 	}
 	// 判断是否在登录页
 	if (path != 'pages/redirect/redirect') {
-		setTimeout((e) => {
-			weixinObj.ready(() => {
-				console.log('weixinObj.ready');
-				// 调用
-				try {
-					console.log(shareData);
-					weixinSq(shareData, path);
-				} catch (e) {
-					console.log(e);
-					//TODO handle the exception
-				}
-			});
-			weixinObj.error((e) => {
+		log.addLog('开始注册微信')
+		weixindata().then(() => {
+			console.log('2');
+			// 调用
+			try {
+				weixinSq();
+			} catch (e) {
 				console.log(e);
-			})
-		}, 10)
-
+				//TODO handle the exception
+			}
+		});
 	}
 };
 // 微信授权登录
-function weixinSq(data, path) {
+function weixinSq() {
 	// 微信授权后跳转页面
 	try {
-		let ul = encodeURIComponent(store.state.baseURL + store.state.urlFile + '/pages/redirect/redirect');
-		console.log(ul, "ul")
+		// 判断是否真实路由模式
+		const type = router.mode === "history"?'':'/#'
+		let ul = encodeURIComponent(store.state.baseURL + store.state.urlFile +type+ '/pages/redirect/redirect');
 		// 打开微信授权页面
 		let url =
 			'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' +
@@ -65,98 +65,164 @@ function weixinSq(data, path) {
 			new Date().getTime() +
 			'#wechat_redirect';
 		window.location.href = url;
-		console.log(url, "url")
 	} catch (e) {
 		console.log(e);
+		//TODO handle the exception
 	}
 };
 
 // 微信注册
 export function weixindata(config) {
-	//注册微信信息
-	let weixinObj = require('jweixin-module');
-	// 保存微信对象到全局仓库
-	store.commit('setWeiChatObj', weixinObj)
-	wechatConfig({
-			url: window.location.href
-		})
-		.then(({
-			data
-		}) => {
-			// 保存appId
-			store.commit('setWeiChatInfo', data)
-			appId = data.appId
-			// 微信信息配置
-			weixinObj.config({
-				debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
-				appId: data.appId, // 必填,企业号的唯一标识,此处填写企业号corpid
-				timestamp: data.timestamp, // 必填,生成签名的时间戳
-				nonceStr: data.nonceStr, // 必填,生成签名的随机串
-				signature: data.signature, // 必填,签名,见附录1
-				jsApiList: data.jsApiList // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
-			});
-			weixinObj.ready((e) => {
-				if (shareData == '') {
+	let url;
+	try {
+		if (router.mode === "history") {
+			// 在ios中时候注册为微信刚进入时候的页面
+			if (window.entryUrl === '') {
+				window.entryUrl = location.href.split('#')[0]
+			}
+			url = isAndroid() ? location.href.split('#')[0] : window.entryUrl;
+		}
+		if (router.mode === "hash") {
+			url = location.href.split('#')[0];
+		}
+		log.addLog('注册开始', url)
+		console.log('开始注册', url);
+
+	} catch (e) {
+		console.log('错误', e);
+	}
+	return new Promise((ok, error) => {
+		try {
+			//注册微信信息
+			wechatConfig({
+					url
+				})
+				.then(({
+					data
+				}) => {
+					try {
+						// 保存appId
+						appId = data.appId
+						// 微信信息配置
+						weixinObj.config({
+							debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
+							appId: data.appId, // 必填,企业号的唯一标识,此处填写企业号corpid
+							timestamp: data.timestamp, // 必填,生成签名的时间戳
+							nonceStr: data.nonceStr, // 必填,生成签名的随机串
+							signature: data.signature, // 必填,签名,见附录1
+							jsApiList: data.jsApiList // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
+						});
+						weixinObj.ready((e) => {
+							log.addLog("注册完毕", data)
+							console.log('注册完毕');
+							ok(data)
+						})
+					} catch (e) {
+						console.log(e)
+					}
+				})
+				.catch(e => {
+					error(e);
+					console.log(e);
+				});
+		} catch (e) {
+			console.log(e);
+			//TODO handle the exception
+		}
+	})
+}
+
+// 判断分享调用方法
+export function shareLoad(config) {
+	console.log('开始调用分享')
+	try {
+		weixindata().then((e) => {
+			// 判断有无自定义数据
+			if (config) {
+				shareFun(config)
+			} else {
+				// 判断是否已经缓存了默认数据
+				if (shareData) {
+					shareFun()
+				} else {
+					// 请求获取默认数据
 					share({}).then(({
 						data
 					}) => {
 						shareData = data.data
-						shareLoad(config)
+						shareFun()
 					});
-				} else {
-					shareLoad(config)
 				}
-			})
-
+			}
 		})
-		.catch(e => {
-			console.log(e);
-		});
+	} catch (e) {
+		console.log('报错', e)
+		//TODO handle the exception
+	}
 }
-// 加载分享数据
-function shareLoad(config) {
-	let mess;
-	if (config) {
-		mess = {
-			link: config.link, // 分享链接
-			imgUrl: config.imgUrl,
-			desc: config.desc,
-			title: config.title,
-			success: config.success,
-			fail: config.fail
-		}
-	} else {
-		console.log(window.location.href, 55)
-		let url = window.location.href + '?spread=' + store.state.userInfo.uid;
-		url = url.replace(/[\?,&]{0,1}from=singlemessage/g, '');
-		mess = {
-			title: shareData.title,
-			link: url, // 分享链接
-			imgUrl: shareData.img, // 分享图标
-			desc: shareData.synopsis,
-			success: function() {
-				// uni.showModal({
-				// 	title: '分享',
-				// 	content: '分享成功',
-				// 	showCancel: false,
-				// 	success: res => {
-				//    console.log('分享成功回调接口');
-				// 	},
-				// 	fail: () => {},
-				// 	complete: () => {}
-				// });
+// 配置分享数据
+function shareFun(config) {
+	try {
+		console.log('再付分享内容', config);
+		let mess;
+		if (config) {
+			mess = {
+				link: config.link, // 分享链接
+				imgUrl: config.imgUrl,
+				desc: config.desc,
+				title: config.title,
+				success: config.success || function(e) {
+					console.log(e);
+				},
+				fail: config.fail || function(e) {
+					console.log(e);
+				}
+			}
+		} else {
+			const userInfo = uni.getStorageSync('userInfo')
+			console.log(userInfo);
+			const url = window.location.href + '?spread=' + userInfo.uid;
+			url = url.replace(/[\?,&]{0,1}from=singlemessage/g, '');
+			mess = {
+				title: shareData.title,
+				link: url, // 分享链接
+				imgUrl: shareData.img, // 分享图标
+				desc: shareData.synopsis,
+				success: function() {
+					// uni.showModal({
+					// 	title: '分享',
+					// 	content: '分享成功',
+					// 	showCancel: false,
+					// 	success: res => {
+					//    console.log('分享成功回调接口');
+					// 	},
+					// 	fail: () => {},
+					// 	complete: () => {}
+					// });
+				}
 			}
 		}
+		// 获取仓库数据
+		// 分享好友
+		weixinObj.updateAppMessageShareData(mess);
+
+		// 分享朋友圈
+		weixinObj.updateTimelineShareData(mess)
+	} catch (e) {
+		console.log(e);
+		//TODO handle the exception
 	}
-	// 获取仓库数据
-	// 分享好友
-	weixinObj.updateAppMessageShareData(mess);
-	// 分享朋友圈
-	weixinObj.updateTimelineShareData(mess)
+}
+
+// 保存路由对象
+export function setRouter(route) {
+	router = route
 }
 
 export default {
 	weixinObj,
 	shareData,
-	appId
+	appId,
+	setRouter,
+	shareLoad
 }

+ 0 - 4
utils/wxMinProgram.js

@@ -18,10 +18,6 @@ export function loginWinxinMp() {
 	return new Promise(function (resolve,reject) {
 		wx.login({
 			success(e) {
-				// uni.showModal({
-				// 	title:'zhi1',
-				// 	content:JSON.stringify(e)
-				// })
 				console.log(e);
 				resolve(e)
 			},

部分文件因为文件数量过多而无法显示