From f811c0ee827dd4149ac1d09ce52694abb6156bb8 Mon Sep 17 00:00:00 2001
From: jia <1451658316@qq.com>
Date: Sat, 28 Oct 2023 21:10:48 +0800
Subject: [PATCH] =?UTF-8?q?=E7=9B=B4=E6=92=AD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
App.vue | 73 ++++++++++++
androidPrivacy.json | 3 +
main.js | 79 +++++++++++++
manifest.json | 216 ++++++++++++++++++++++++++++++++++++
pages.json | 55 +++++++++
project.private.config.json | 9 ++
sitemap.json | 6 +
template.html | 31 ++++++
uni.scss | 78 +++++++++++++
utils/cache.js | 155 ++++++++++++++++++++++++++
utils/dayjs.min.js | 1 +
utils/index.js | 138 +++++++++++++++++++++++
utils/request.js | 76 +++++++++++++
utils/requesta.js | 70 ++++++++++++
utils/util.js | 192 ++++++++++++++++++++++++++++++++
utils/validate.js | 47 ++++++++
vue.config.js | 11 ++
17 files changed, 1240 insertions(+)
create mode 100644 App.vue
create mode 100644 androidPrivacy.json
create mode 100644 main.js
create mode 100644 manifest.json
create mode 100644 pages.json
create mode 100644 project.private.config.json
create mode 100644 sitemap.json
create mode 100644 template.html
create mode 100644 uni.scss
create mode 100644 utils/cache.js
create mode 100644 utils/dayjs.min.js
create mode 100644 utils/index.js
create mode 100644 utils/request.js
create mode 100644 utils/requesta.js
create mode 100644 utils/util.js
create mode 100644 utils/validate.js
create mode 100644 vue.config.js
diff --git a/App.vue b/App.vue
new file mode 100644
index 0000000..b449c4b
--- /dev/null
+++ b/App.vue
@@ -0,0 +1,73 @@
+
+
\ No newline at end of file
diff --git a/androidPrivacy.json b/androidPrivacy.json
new file mode 100644
index 0000000..12df862
--- /dev/null
+++ b/androidPrivacy.json
@@ -0,0 +1,3 @@
+{
+ "prompt": "template"
+}
diff --git a/main.js b/main.js
new file mode 100644
index 0000000..ab2fc91
--- /dev/null
+++ b/main.js
@@ -0,0 +1,79 @@
+// +----------------------------------------------------------------------
+// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
+// +----------------------------------------------------------------------
+// | Author: CRMEB Team
+// +----------------------------------------------------------------------
+import Vue from 'vue'
+import App from './App'
+import store from './store'
+import Cache from './utils/cache'
+import util from 'utils/util'
+import {
+ HTTP_REQUEST_URL
+} from '@/config/app';
+
+import uView from '@/uni_modules/uview-ui'
+Vue.use(uView)
+
+Vue.prototype.$util = util;
+Vue.prototype.$Cache = Cache;
+Vue.config.productionTip = false
+Vue.prototype.$bus = new Vue();
+// #ifdef H5
+import {
+ parseQuery
+} from "./utils";
+
+import {
+ SPREAD
+} from './config/cache';
+// import wx from '@/node_modules/jweixin-module/lib/index'
+var __s = document.createElement('script');
+__s.src = HTTP_REQUEST_URL + "/api/script";
+document.head.appendChild(__s);
+
+
+
+
+// 注册全局防抖指令
+Vue.directive('debounce', {
+ inserted: (el, binding) => {
+ let debounceTime = binding.value || 2000
+ let timer
+ el.addEventListener('click', e => {
+ el.style.pointerEvents = 'none';
+ if (!el.disabled) {
+ timer = setTimeout(() => {
+ el.style.pointerEvents = 'auto'
+ }, debounceTime)
+ }
+ }, true)
+ }
+})
+
+// if(!!!Auth.isAndroid() && Auth.isWeixin()){
+// Auth.wechat()
+// }
+
+// Auth.isWeixin() && Auth.oAuth();
+
+// #endif
+
+let appInfo = uni.getSystemInfo().then(res => {
+ Vue.prototype.$appInfo = res[1];
+});
+
+
+App.mpType = 'app'
+
+
+const app = new Vue({
+ ...App,
+ store,
+ Cache
+})
+app.$mount();
\ No newline at end of file
diff --git a/manifest.json b/manifest.json
new file mode 100644
index 0000000..b0fb733
--- /dev/null
+++ b/manifest.json
@@ -0,0 +1,216 @@
+{
+ "name" : "惠农直播",
+ "appid" : "__UNI__0E46DAD",
+ "description" : "",
+ "versionName" : "1.1.0",
+ "versionCode" : 110,
+ "transformPx" : false,
+ /* 5+App特有相关 */
+ "app-plus" : {
+ "titleNView" : true,
+ "usingComponents" : true,
+ "nvueCompiler" : "uni-app",
+ "nvueStyleCompiler" : "uni-app",
+ "compilerVersion" : 3,
+ "splashscreen" : {
+ "alwaysShowBeforeRender" : true,
+ "waiting" : true,
+ "autoclose" : true,
+ "delay" : 0
+ },
+ /* 模块配置 */
+ "modules" : {
+ "VideoPlayer" : {},
+ "iBeacon" : {},
+ "Barcode" : {},
+ "Camera" : {},
+ "Payment" : {},
+ "Share" : {},
+ "OAuth" : {},
+ "UniMP" : {
+ "description" : "uni小程序"
+ },
+ "Push" : {},
+ "LivePusher" : {}
+ },
+ "safearea" : {
+ "bottom" : {
+ "offset" : "none"
+ }
+ },
+ /* 应用发布信息 */
+ "distribute" : {
+ /* android打包配置 */
+ "android" : {
+ "resizeableActivity" : true,
+ "permissions" : [
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ ""
+ ],
+ "abiFilters" : [ "armeabi-v7a", "arm64-v8a", "x86" ],
+ "permissionExternalStorage" : {
+ "request" : "none",
+ "prompt" : "应用保存运行状态等信息,需要获取读写手机存储(系统提示为访问设备上的照片、媒体内容和文件)权限,请允许。"
+ },
+ "permissionPhoneState" : {
+ "request" : "none" //拨打电话权限关闭
+ }
+ },
+ /* ios打包配置 */
+ "ios" : {
+ "privacyDescription" : {
+ "NSPhotoLibraryUsageDescription" : "上传用户头像保存分享海报",
+ "NSPhotoLibraryAddUsageDescription" : "上传用户头像保存分享海报",
+ "NSCameraUsageDescription" : "上传用户头像保存分享海报",
+ "NSLocationWhenInUseUsageDescription" : "根据客户地理位置推荐最近门店",
+ "NSLocationAlwaysUsageDescription" : "根据客户地理位置推荐最近门店",
+ "NSLocationAlwaysAndWhenInUseUsageDescription" : "根据客户地理位置推荐最近门店"
+ },
+ "idfa" : false,
+ "dSYMs" : false
+ },
+ /* SDK配置 */
+ "sdkConfigs" : {
+ "maps" : {
+ "amap" : {
+ "appkey_ios" : "82af93ec51139c712c4118d84ba684ee",
+ "appkey_android" : "0799f37420c0784f1e6cba230a68bdb1"
+ }
+ },
+ "payment" : {
+ "weixin" : {
+ "__platform__" : [ "ios", "android" ],
+ "appid" : "wx9d68c92b550ddd1e",
+ "UniversalLinks" : "https://shop.lihaink.cn/"
+ }
+ },
+ "share" : {
+ "weixin" : {
+ "appid" : "wx9d68c92b550ddd1e",
+ "UniversalLinks" : "https://shop.lihaink.cn/"
+ }
+ },
+ "geolocation" : {
+ "amap" : {
+ "__platform__" : [ "ios", "android" ],
+ "appkey_ios" : "82af93ec51139c712c4118d84ba684ee",
+ "appkey_android" : "0799f37420c0784f1e6cba230a68bdb1"
+ }
+ },
+ "oauth" : {},
+ "ad" : {},
+ "push" : {}
+ },
+ "icons" : {
+ "android" : {
+ "hdpi" : "",
+ "xhdpi" : "",
+ "xxhdpi" : "",
+ "xxxhdpi" : ""
+ },
+ "ios" : {
+ "appstore" : "",
+ "ipad" : {
+ "app" : "",
+ "app@2x" : "",
+ "notification" : "",
+ "notification@2x" : "",
+ "proapp@2x" : "",
+ "settings" : "",
+ "settings@2x" : "",
+ "spotlight" : "",
+ "spotlight@2x" : ""
+ },
+ "iphone" : {
+ "app@2x" : "",
+ "app@3x" : "",
+ "notification@2x" : "",
+ "notification@3x" : "",
+ "settings@2x" : "",
+ "settings@3x" : "",
+ "spotlight@2x" : "",
+ "spotlight@3x" : ""
+ }
+ }
+ },
+ "splashscreen" : {
+ "useOriginalMsgbox" : true
+ }
+ },
+ "nativePlugins" : {}
+ },
+ /* 快应用特有相关 */
+ "quickapp" : {},
+ /* 小程序特有相关 */
+ "mp-weixin" : {
+ "appid" : "wxfb4695444ab8d0d0",
+ "setting" : {
+ "urlCheck" : false,
+ "minified" : true,
+ "postcss" : true,
+ "es6" : true
+ },
+ "permission" : {
+ "scope.userLocation" : {
+ "desc" : "获取您的位置"
+ }
+ },
+ "requiredPrivateInfos" : [ "getLocation", "chooseAddress" ],
+ "usingComponents" : true
+ },
+ "mp-alipay" : {
+ "usingComponents" : true
+ },
+ "mp-baidu" : {
+ "usingComponents" : true
+ },
+ "mp-toutiao" : {
+ "usingComponents" : true
+ },
+ "h5" : {
+ "devServer" : {
+ "https" : false
+ },
+ "router" : {
+ "mode" : "history",
+ "base" : ""
+ },
+ "domain" : "",
+ "sdkConfigs" : {
+ "maps" : {
+ "qqmap" : {
+ "key" : "SMJBZ-WCHK4-ZPZUA-DSIXI-XDDVQ-XWFX7"
+ }
+ }
+ },
+ "title" : "加载中...",
+ "template" : "template.html"
+ }
+}
+//拨打电话权限关闭
+/* ios打包配置 */
+
diff --git a/pages.json b/pages.json
new file mode 100644
index 0000000..23b3db5
--- /dev/null
+++ b/pages.json
@@ -0,0 +1,55 @@
+{
+ "pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
+ {
+ "path": "pages/room/room_list",
+ "style": {
+ "navigationBarTitleText": "直播列表"
+ // "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/room/create_room",
+ "style": {
+ "navigationBarTitleText": "创建直播间"
+
+
+ }
+ },
+ {
+ "path": "pages/live/anchor",
+ "style": {
+ "navigationBarTitleText": "",
+ "navigationStyle": "custom"
+
+ }
+ },
+ {
+ "path": "pages/live/spectator",
+ "style": {
+ "navigationBarTitleText": "观众直播间",
+ "navigationStyle": "custom"
+ }
+ },{
+ "path": "pages/live/histroyroom",
+ "style": {
+ "navigationBarTitleText": "历史直播间",
+ "navigationStyle": "custom"
+ }
+ },
+ {
+ "path": "pages/login/login",
+ "style": {
+ "navigationBarTitleText": "登录",
+ "navigationStyle": "custom"
+ }
+ }
+
+ ],
+ "globalStyle": {
+ "navigationBarTextStyle": "black",
+ "navigationBarTitleText": "uni-app",
+ "navigationBarBackgroundColor": "#F8F8F8",
+ "backgroundColor": "#F8F8F8"
+ },
+ "uniIdRouter": {}
+}
diff --git a/project.private.config.json b/project.private.config.json
new file mode 100644
index 0000000..ff905cb
--- /dev/null
+++ b/project.private.config.json
@@ -0,0 +1,9 @@
+{
+ "libVersion": "2.32.1",
+ "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
+ "projectname": "nk-shop2.0",
+ "setting": {
+ "compileHotReLoad": true,
+ "urlCheck": false
+ }
+}
\ No newline at end of file
diff --git a/sitemap.json b/sitemap.json
new file mode 100644
index 0000000..52f2d27
--- /dev/null
+++ b/sitemap.json
@@ -0,0 +1,6 @@
+{
+ "rules": [{
+ "action": "allow",
+ "page": "*"
+ }]
+}
\ No newline at end of file
diff --git a/template.html b/template.html
new file mode 100644
index 0000000..50798a8
--- /dev/null
+++ b/template.html
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+ <%= htmlWebpackPlugin.options.title %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/uni.scss b/uni.scss
new file mode 100644
index 0000000..45776b4
--- /dev/null
+++ b/uni.scss
@@ -0,0 +1,78 @@
+/**
+ * 这里是uni-app内置的常用样式变量
+ *
+ * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
+ * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
+ *
+ */
+
+/**
+ * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
+ *
+ * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
+ */
+@import '@/uni_modules/uview-ui/theme.scss';
+/* 颜色变量 */
+$uni-theme-color: #f45846;
+$uni-theme-bg-color: linear-gradient(180deg, #f98649 0%, #f34e45 100%);
+
+/* 行为相关颜色 */
+$uni-color-primary: #007aff;
+$uni-color-success: #4cd964;
+$uni-color-warning: #f0ad4e;
+$uni-color-error: #dd524d;
+
+$uni-nothing-text: #999; //空白页文字
+
+$theme-color: #e93323;
+$theme-color-opacity: rgba(233, 51, 35, 0.6);
+$bg-star: #f62c2c;
+$bg-end: #f96e29;
+
+/* 背景颜色 */
+$uni-bg-color: #ffffff;
+$uni-bg-color-grey: #f8f8f8;
+$uni-bg-color-hover: #f1f1f1; //点击状态颜色
+$uni-bg-color-mask: rgba(0, 0, 0, 0.4); //遮罩颜色
+
+/* 边框颜色 */
+$uni-border-color: #c8c7cc;
+
+/* 尺寸变量 */
+
+/* 文字尺寸 */
+$uni-font-size-sm: 24upx;
+$uni-font-size-base: 28upx;
+$uni-font-size-lg: 32upx;
+
+/* 图片尺寸 */
+$uni-img-size-sm: 40upx;
+$uni-img-size-base: 52upx;
+$uni-img-size-lg: 80upx;
+
+/* Border Radius */
+$uni-border-radius-sm: 4upx;
+$uni-border-radius-base: 6upx;
+$uni-border-radius-lg: 12upx;
+$uni-border-radius-circle: 50%;
+
+/* 水平间距 */
+$uni-spacing-row-sm: 10px;
+$uni-spacing-row-base: 20upx;
+$uni-spacing-row-lg: 30upx;
+
+/* 垂直间距 */
+$uni-spacing-col-sm: 8upx;
+$uni-spacing-col-base: 16upx;
+$uni-spacing-col-lg: 24upx;
+
+/* 透明度 */
+$uni-opacity-disabled: 0.3; // 组件禁用态的透明度
+
+/* 文章场景相关 */
+$uni-color-title: #2c405a; // 文章标题颜色
+$uni-font-size-title: 40upx;
+$uni-color-subtitle: #555555; // 二级标题颜色
+$uni-font-size-subtitle: 36upx;
+$uni-color-paragraph: #3f536e; // 文章段落颜色
+$uni-font-size-paragraph: 30upx;
diff --git a/utils/cache.js b/utils/cache.js
new file mode 100644
index 0000000..f4e5c3c
--- /dev/null
+++ b/utils/cache.js
@@ -0,0 +1,155 @@
+// +----------------------------------------------------------------------
+// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
+// +----------------------------------------------------------------------
+// | Author: CRMEB Team
+// +----------------------------------------------------------------------
+import { EXPIRE } from '../config/app';
+
+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 : EXPIRE;
+ 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;
\ No newline at end of file
diff --git a/utils/dayjs.min.js b/utils/dayjs.min.js
new file mode 100644
index 0000000..47ebdde
--- /dev/null
+++ b/utils/dayjs.min.js
@@ -0,0 +1 @@
+!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.dayjs=e()}(this,function(){"use strict";var t="millisecond",e="second",n="minute",r="hour",i="day",s="week",u="month",o="quarter",a="year",h=/^(\d{4})-?(\d{1,2})-?(\d{0,2})[^0-9]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?.?(\d{1,3})?$/,f=/\[([^\]]+)]|Y{2,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,c=function(t,e,n){var r=String(t);return!r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},d={s:c,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return(e<=0?"+":"-")+c(r,2,"0")+":"+c(i,2,"0")},m:function(t,e){var n=12*(e.year()-t.year())+(e.month()-t.month()),r=t.clone().add(n,u),i=e-r<0,s=t.clone().add(n+(i?-1:1),u);return Number(-(n+(e-r)/(i?r-s:s-r))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(h){return{M:u,y:a,w:s,d:i,D:"date",h:r,m:n,s:e,ms:t,Q:o}[h]||String(h||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},$={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},l="en",m={};m[l]=$;var y=function(t){return t instanceof v},M=function(t,e,n){var r;if(!t)return l;if("string"==typeof t)m[t]&&(r=t),e&&(m[t]=e,r=t);else{var i=t.name;m[i]=t,r=i}return!n&&r&&(l=r),r||!n&&l},g=function(t,e){if(y(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new v(n)},D=d;D.l=M,D.i=y,D.w=function(t,e){return g(t,{locale:e.$L,utc:e.$u,$offset:e.$offset})};var v=function(){function c(t){this.$L=this.$L||M(t.locale,null,!0),this.parse(t)}var d=c.prototype;return d.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(D.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(h);if(r)return n?new Date(Date.UTC(r[1],r[2]-1,r[3]||1,r[4]||0,r[5]||0,r[6]||0,r[7]||0)):new Date(r[1],r[2]-1,r[3]||1,r[4]||0,r[5]||0,r[6]||0,r[7]||0)}return new Date(e)}(t),this.init()},d.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},d.$utils=function(){return D},d.isValid=function(){return!("Invalid Date"===this.$d.toString())},d.isSame=function(t,e){var n=g(t);return this.startOf(e)<=n&&n<=this.endOf(e)},d.isAfter=function(t,e){return g(t){
+ i[v] = () => Store.getters.globalData[v];
+ return i;
+ }, init || {})
+ }else{
+ return Object.keys(args).reduce((i, v)=>{
+ i[v] = () => {
+ const val = Store.getters.globalData[v];
+ return (val === undefined || val === null || val === '') ? args[v] : val;
+ };
+ return i;
+ }, init || {})
+ }
+}
+
+export function redirect(url){
+ uni.switchTab({
+ url,
+ fail(){
+ uni.redirectTo({
+ url
+ })
+ }
+ })
+}
+
+/**
+ * 转换商户跳转链接, 自动追加商户 id
+ * @param {string} path
+ * @param {int} mer_id
+ * @param {string} name 商户id 参数名, 默认 mer_id
+ */
+export function merPath(path, mer_id, name){
+ if(!mer_id) return path;
+ path += ((path.indexOf('?') > -1 ? '&' : '?') + (name || 'mer_id') + '=' + mer_id);
+ return path;
+}
+
+/**
+ * 绑定用户授权
+ * @param {Object} puid
+ */
+export function silenceBindingSpread() {
+
+ //#ifdef H5
+ let puid = Cache.get('spread');
+ //#endif
+
+ //#ifdef MP || APP-PLUS
+ let puid = getApp().globalData.spid;
+ if (!puid) {
+ puid = getApp().globalData.code;
+ }
+ //#endif
+
+ puid = parseInt(puid);
+ if (Number.isNaN(puid)) {
+ puid = 0;
+ }
+ if (puid) {
+
+ //#ifdef H5
+ Cache.clear('spread');
+ //#endif
+
+ //#ifdef MP || APP-PLUS
+ getApp().globalData.spid = 0;
+ getApp().globalData.code = 0;
+ //#endif
+
+
+ }
+}
+
+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;
+ }
+ // const VUE_APP_WS_URL = process.env.VUE_APP_WS_URL || `ws://${location.hostname}:20003`;
+ // const ishttps = 'https:' == document.location.protocol ? true : false;
+ // const VUE_APP_WS_URL = ishttps ? `wss://mer.crmeb.net?type=user&token=${token}` : `ws://mer.crmeb.net?type=user&token=${token}`;
+ // export { VUE_APP_WS_URL }
+
+
+ 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;
+}
+// +----------------------------------------------------------------------
+// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
+// +----------------------------------------------------------------------
+// | Author: CRMEB Team
+// +----------------------------------------------------------------------
+let token = ''
+try {
+ token = uni.getStorageSync('LOGIN_STATUS_TOKEN')
+ // console.log(token, 'this')
+} catch (error) {
+
+}
+// const VUE_APP_WS_URL = process.env.VUE_APP_WS_URL || `ws://${location.hostname}?type=user&token=${token}`;
+// const VUE_APP_WS_URL = `wss://mer.crmeb.net?type=user&token=${token}`
+export default parseQuery;
diff --git a/utils/request.js b/utils/request.js
new file mode 100644
index 0000000..583102e
--- /dev/null
+++ b/utils/request.js
@@ -0,0 +1,76 @@
+// +----------------------------------------------------------------------
+// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
+// +----------------------------------------------------------------------
+// | Author: CRMEB Team
+// +----------------------------------------------------------------------
+import {
+ HTTP_REQUEST_URL_ONE,
+ HEADER,
+ TOKENNAME
+} from '@/config/app';
+import store from '../store';
+
+
+/**
+ * 发送请求
+ */
+function baseRequest(url, method, data, {
+ noAuth = false,
+ noVerify = false
+}) {
+ let Url = HTTP_REQUEST_URL_ONE,
+ header = HEADER;
+
+
+
+ if (store.state.app.token) header[TOKENNAME] = 'Bearer ' + store.state.app.token;
+
+ return new Promise((reslove, reject) => {
+ uni.request({
+ url: Url + '/api/' + url,
+ method: method || 'GET',
+ header: header,
+ data: data || {},
+ success: (res) => {
+ // #ifdef APP-PLUS
+ // console.log('app', Url + '/api/' + url, method);
+ // #endif
+ if (noVerify)
+ reslove(res.data, res);
+ else if (res.data.status == 200)
+ reslove(res.data, res);
+ else if ([410000, 410001, 410002, 40000].indexOf(res.data.status) !== -1) {
+
+ reject(res.data);
+ } else if (res.data.code==0||res.data.code==1) {
+
+ reslove(res.data, res);
+ }else if (res.data.status == 501) {
+ uni.reLaunch({
+ url: '/pages/error/index'
+ })
+ reject(res.data);
+ } else
+ reject(res.data.message || '系统错误');
+ },
+ fail: (message) => {
+ console.log(url, method, data)
+ reject('请求失败',message);
+ }
+ })
+ });
+}
+
+const request = {};
+
+['options', 'get', 'post', 'put', 'head', 'delete', 'trace', 'connect'].forEach((method) => {
+ request[method] = (api, data, opt) => baseRequest(api, method, data, opt || {})
+});
+
+
+
+export default request;
\ No newline at end of file
diff --git a/utils/requesta.js b/utils/requesta.js
new file mode 100644
index 0000000..09907d2
--- /dev/null
+++ b/utils/requesta.js
@@ -0,0 +1,70 @@
+// +----------------------------------------------------------------------
+// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
+// +----------------------------------------------------------------------
+// | Author: CRMEB Team
+// +----------------------------------------------------------------------
+import {
+ HTTP_REQUEST_URL,
+ HEADER,
+ TOKENNAME
+} from '@/config/app';
+import store from '../store';
+
+
+/**
+ * 发送请求
+ */
+function baseRequest(url, method, data, {
+ noAuth = false,
+ noVerify = false
+}) {
+ let Url = HTTP_REQUEST_URL,
+ header = HEADER;
+
+ if (store.state.app.token) header[TOKENNAME] = 'Bearer ' + store.state.app.token;
+
+ return new Promise((reslove, reject) => {
+ uni.request({
+ url: Url + '/api/' + url,
+ method: method || 'GET',
+ header: header,
+ data: data || {},
+ success: (res) => {
+ // #ifdef APP-PLUS
+ // console.log('app', Url + '/api/' + url, method);
+ // #endif
+ if (noVerify)
+ reslove(res.data, res);
+ else if (res.data.status == 200)
+ reslove(res.data, res);
+ else if ([410000, 410001, 410002, 40000].indexOf(res.data.status) !== -1) {
+
+ reject(res.data);
+ } else if (res.data.code==0||res.data.code==1) {
+ reslove(res.data, res);
+ }else if (res.data.status == 501) {
+ reject(res.data);
+ } else
+ reject(res.data.message || '系统错误');
+ },
+ fail: (message) => {
+ console.log(url, method, data)
+ reject('请求失败',message);
+ }
+ })
+ });
+}
+
+const request = {};
+
+['options', 'get', 'post', 'put', 'head', 'delete', 'trace', 'connect'].forEach((method) => {
+ request[method] = (api, data, opt) => baseRequest(api, method, data, opt || {})
+});
+
+
+
+export default request;
\ No newline at end of file
diff --git a/utils/util.js b/utils/util.js
new file mode 100644
index 0000000..1fe09f3
--- /dev/null
+++ b/utils/util.js
@@ -0,0 +1,192 @@
+// +----------------------------------------------------------------------
+// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
+// +----------------------------------------------------------------------
+// | Author: CRMEB Team
+// +----------------------------------------------------------------------
+import {
+ TOKENNAME,
+ HTTP_REQUEST_URL
+} from '../config/app.js';
+
+export default {
+ /*
+ * 合并数组
+ */
+ 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;
+ },
+ /**
+ * 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 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 || 'field';
+ uni.chooseImage({
+ count: count, //最多可以选择的图片总数
+ sizeType: sizeType, // 可以指定是原图还是压缩图,默认二者都有
+ sourceType: sourceType, // 可以指定来源是相册还是相机,默认二者都有
+ success: function(res) {
+ //启动上传等待中...
+ uni.showLoading({
+ title: '图片上传中',
+ });
+ uni.uploadFile({
+ url: HTTP_REQUEST_URL + '/api/' + uploadUrl + '/' + inputName,
+ filePath: res.tempFilePaths[0],
+ name: inputName,
+ formData: {
+ 'filename': inputName
+ },
+ header: {
+ // #ifdef MP
+ "Content-Type": "multipart/form-data",
+ // #endif
+ [TOKENNAME]: 'Bearer ' + uni.getStorageSync('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.message
+ });
+ }
+ }
+ },
+ fail: function(res) {
+ uni.hideLoading();
+ that.Tips({
+ title: '上传图片失败'
+ });
+ }
+ })
+ }
+ })
+ }
+
+
+}
diff --git a/utils/validate.js b/utils/validate.js
new file mode 100644
index 0000000..e07b0a4
--- /dev/null
+++ b/utils/validate.js
@@ -0,0 +1,47 @@
+// +----------------------------------------------------------------------
+// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
+// +----------------------------------------------------------------------
+// | Author: CRMEB Team
+// +----------------------------------------------------------------------
+/**
+ * 验证小数点后两位及多个小数
+ * money 金额
+ */
+
+export function isMoney(money) {
+ var reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/
+ if (reg.test(money)) {
+ return true
+ } else {
+ return false
+ }
+}
+
+/**
+ * 验证手机号码
+ */
+export function checkPhone(phone) {
+ var reg = /^1(3|4|5|6|7|8|9)\d{9}$/
+ if (reg.test(phone)) {
+ return true
+ } else {
+ return false
+ }
+}
+
+
+/**
+ * 验证邮箱
+ */
+export function isEmailAvailable(emailInput) {
+ var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
+ if (!myreg.test(emailInput)) {
+ return false;
+ } else {
+ return true;
+ }
+}
diff --git a/vue.config.js b/vue.config.js
new file mode 100644
index 0000000..3612e93
--- /dev/null
+++ b/vue.config.js
@@ -0,0 +1,11 @@
+module.exports = {
+ productionSourceMap: false, // 生产打包时不输出map文件,增加打包速度
+ configureWebpack: config => {
+ if (process.env.NODE_ENV === 'production') {
+ config.optimization.minimizer[0].options.terserOptions.compress.warnings = false
+ config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
+ config.optimization.minimizer[0].options.terserOptions.compress.drop_debugger = true
+ config.optimization.minimizer[0].options.terserOptions.compress.pure_funcs = ['console.log']
+ }
+ }
+}