Commit f9d14087 authored by 李苏's avatar 李苏 💬

初始化

parent de936996
Pipeline #290 failed with stages
/package-lock.json
node_modules/
.project unpackage/
.DS_Store
unpackage/
<style lang="scss">
@import "appcommon/uview-ui/index.scss";
</style>
<script>
import Vue from 'vue'
export default {
onLaunch: function() {
// appUpdate()
uni.getSystemInfo({
success: function(e) {
// #ifndef MP
Vue.prototype.StatusBar = e.statusBarHeight;
if (e.platform == 'android') {
Vue.prototype.CustomBar = e.statusBarHeight + 50;
} else {
Vue.prototype.CustomBar = e.statusBarHeight + 45;
};
// #endif
// #ifdef MP-WEIXIN
Vue.prototype.StatusBar = e.statusBarHeight;
let custom = wx.getMenuButtonBoundingClientRect();
Vue.prototype.Custom = custom;
Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
// #endif
// #ifdef MP-ALIPAY
Vue.prototype.StatusBar = e.statusBarHeight;
Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
// #endif
// #ifdef APP-PLUS
// #endif
}
})
Vue.prototype.ColorList = [{
title: '嫣红',
name: 'red',
color: '#e54d42'
},
{
title: '桔橙',
name: 'orange',
color: '#f37b1d'
},
{
title: '明黄',
name: 'yellow',
color: '#fbbd08'
},
{
title: '橄榄',
name: 'olive',
color: '#8dc63f'
},
{
title: '森绿',
name: 'green',
color: '#39b54a'
},
{
title: '天青',
name: 'cyan',
color: '#1cbbb4'
},
{
title: '海蓝',
name: 'blue',
color: '#0081ff'
},
{
title: '姹紫',
name: 'purple',
color: '#6739b6'
},
{
title: '木槿',
name: 'mauve',
color: '#9c26b0'
},
{
title: '桃粉',
name: 'pink',
color: '#e03997'
},
{
title: '棕褐',
name: 'brown',
color: '#a5673f'
},
{
title: '玄灰',
name: 'grey',
color: '#8799a3'
},
{
title: '草灰',
name: 'gray',
color: '#aaaaaa'
},
{
title: '墨黑',
name: 'black',
color: '#333333'
},
{
title: '雅白',
name: 'white',
color: '#ffffff'
},
]
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
}
}
</script>
<style>
@import "plugin/colorui/main.css";
@import "plugin/colorui/icon.css";
@import "plugin/colorui/animation.css";
#router-loadding .loadding{
display: none;
}
.nav-list {
display: flex;
flex-wrap: wrap;
padding: 0px 40upx 0px;
justify-content: space-between;
}
.nav-li {
padding: 30upx;
border-radius: 12upx;
width: 45%;
margin: 0 2.5% 40upx;
background-image: url(https://cdn.nlark.com/yuque/0/2019/png/280374/1552996358352-assets/web-upload/cc3b1807-c684-4b83-8f80-80e5b8a6b975.png);
background-size: cover;
background-position: center;
position: relative;
z-index: 1;
}
.nav-li::after {
content: "";
position: absolute;
z-index: -1;
background-color: inherit;
width: 100%;
height: 100%;
left: 0;
bottom: -10%;
border-radius: 10upx;
opacity: 0.2;
transform: scale(0.9, 0.9);
}
.nav-li.cur {
color: #fff;
background: rgb(94, 185, 94);
box-shadow: 4upx 4upx 6upx rgba(94, 185, 94, 0.4);
}
.nav-title {
font-size: 32upx;
font-weight: 300;
}
.nav-title::first-letter {
font-size: 40upx;
margin-right: 4upx;
}
.nav-name {
font-size: 28upx;
text-transform: Capitalize;
margin-top: 20upx;
position: relative;
}
.nav-name::before {
content: "";
position: absolute;
display: block;
width: 40upx;
height: 6upx;
background: #fff;
bottom: 0;
right: 0;
opacity: 0.5;
}
.nav-name::after {
content: "";
position: absolute;
display: block;
width: 100upx;
height: 1px;
background: #fff;
bottom: 0;
right: 40upx;
opacity: 0.3;
}
.nav-name::first-letter {
font-weight: bold;
font-size: 36upx;
margin-right: 1px;
}
.nav-li text {
position: absolute;
right: 30upx;
top: 30upx;
font-size: 52upx;
width: 60upx;
height: 60upx;
text-align: center;
line-height: 60upx;
}
.text-light {
font-weight: 300;
}
@keyframes show {
0% {
transform: translateY(-50px);
}
60% {
transform: translateY(40upx);
}
100% {
transform: translateY(0px);
}
}
@-webkit-keyframes show {
0% {
transform: translateY(-50px);
}
60% {
transform: translateY(40upx);
}
100% {
transform: translateY(0px);
}
}
</style>
import { http } from 'appcommon/src/utils/service/index.js'
import configService from '@/common/service/config.service.js';
const apiService = {
/**
* 登录
*/
login(params) {
return http.post('/login',params)
},
/**
* 手机号码登录
*/
phoneNoLogin(params) {
return http.post('/sys/phoneLogin',params);
},
/**
* 退出
*/
logout(params) {
return http.post('/sys/logout',params);
},
/*数据请求 */
postData(url,params){
return http.post(url,params);
},
/**
* 获取文件访问路径
* @param avatar
* @param subStr
* @returns {*}
*/
getFileAccessHttpUrl(avatar,subStr){
if(!subStr) subStr = 'http'
if(avatar && avatar.startsWith(subStr)){
return avatar;
}else{
return configService.staticDomainURL + "/" + avatar;
}
}
};
export default apiService;
This diff is collapsed.
'use strict'
import isAbsoluteURL from '../helpers/isAbsoluteURL'
import combineURLs from '../helpers/combineURLs'
/**
* Creates a new URL by combining the baseURL with the requestedURL,
* only when the requestedURL is not already an absolute URL.
* If the requestURL is absolute, this function returns the requestedURL untouched.
*
* @param {string} baseURL The base URL
* @param {string} requestedURL Absolute or relative URL to combine
* @returns {string} The combined full path
*/
export default function buildFullPath(baseURL, requestedURL) {
if (baseURL && !isAbsoluteURL(requestedURL)) {
return combineURLs(baseURL, requestedURL)
}
return requestedURL
}
'use strict'
import * as utils from './../utils'
function encode(val) {
return encodeURIComponent(val).
replace(/%40/gi, '@').
replace(/%3A/gi, ':').
replace(/%24/g, '$').
replace(/%2C/gi, ',').
replace(/%20/g, '+').
replace(/%5B/gi, '[').
replace(/%5D/gi, ']')
}
/**
* Build a URL by appending params to the end
*
* @param {string} url The base of the url (e.g., http://www.google.com)
* @param {object} [params] The params to be appended
* @returns {string} The formatted url
*/
export default function buildURL(url, params) {
/*eslint no-param-reassign:0*/
if (!params) {
return url
}
var serializedParams
if (utils.isURLSearchParams(params)) {
serializedParams = params.toString()
} else {
var parts = []
utils.forEach(params, function serialize(val, key) {
if (val === null || typeof val === 'undefined') {
return
}
if (utils.isArray(val)) {
key = key + '[]'
} else {
val = [val]
}
utils.forEach(val, function parseValue(v) {
if (utils.isDate(v)) {
v = v.toISOString()
} else if (utils.isObject(v)) {
v = JSON.stringify(v)
}
parts.push(encode(key) + '=' + encode(v))
})
})
serializedParams = parts.join('&')
}
if (serializedParams) {
var hashmarkIndex = url.indexOf('#')
if (hashmarkIndex !== -1) {
url = url.slice(0, hashmarkIndex)
}
url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams
}
return url
}
'use strict'
/**
* Creates a new URL by combining the specified URLs
*
* @param {string} baseURL The base URL
* @param {string} relativeURL The relative URL
* @returns {string} The combined URL
*/
export default function combineURLs(baseURL, relativeURL) {
return relativeURL
? baseURL.replace(/\/+$/, '') + '/' + relativeURL.replace(/^\/+/, '')
: baseURL
}
'use strict'
/**
* Determines whether the specified URL is absolute
*
* @param {string} url The URL to test
* @returns {boolean} True if the specified URL is absolute, otherwise false
*/
export default function isAbsoluteURL(url) {
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
// by any combination of letters, digits, plus, period, or hyphen.
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url)
}
import Request from './core/Request'
export default Request
'use strict'
// utils is a library of generic helper functions non-specific to axios
var toString = Object.prototype.toString
/**
* Determine if a value is an Array
*
* @param {Object} val The value to test
* @returns {boolean} True if value is an Array, otherwise false
*/
export function isArray (val) {
return toString.call(val) === '[object Array]'
}
/**
* Determine if a value is an Object
*
* @param {Object} val The value to test
* @returns {boolean} True if value is an Object, otherwise false
*/
export function isObject (val) {
return val !== null && typeof val === 'object'
}
/**
* Determine if a value is a Date
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a Date, otherwise false
*/
export function isDate (val) {
return toString.call(val) === '[object Date]'
}
/**
* Determine if a value is a URLSearchParams object
*
* @param {Object} val The value to test
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
*/
export function isURLSearchParams (val) {
return typeof URLSearchParams !== 'undefined' && val instanceof URLSearchParams
}
/**
* Iterate over an Array or an Object invoking a function for each item.
*
* If `obj` is an Array callback will be called passing
* the value, index, and complete array for each item.
*
* If 'obj' is an Object callback will be called passing
* the value, key, and complete object for each property.
*
* @param {Object|Array} obj The object to iterate
* @param {Function} fn The callback to invoke for each item
*/
export function forEach (obj, fn) {
// Don't bother if no value provided
if (obj === null || typeof obj === 'undefined') {
return
}
// Force an array if not already something iterable
if (typeof obj !== 'object') {
/*eslint no-param-reassign:0*/
obj = [obj]
}
if (isArray(obj)) {
// Iterate over array values
for (var i = 0, l = obj.length; i < l; i++) {
fn.call(null, obj[i], i, obj)
}
} else {
// Iterate over object keys
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
fn.call(null, obj[key], key, obj)
}
}
}
}
/**
* 是否为boolean 值
* @param val
* @returns {boolean}
*/
export function isBoolean(val) {
return typeof val === 'boolean'
}
import modules from './modules'
import Vue from 'vue'
import Router from '@/plugin/uni-simple-router/index.js'
import {ACCESS_TOKEN} from '@/common/util/constants.js'
Vue.use(Router)
//初始化
const router = new Router({
encodeURI:true,
routes: [...modules]//路由表
});
const whiteList = ['/pages/login/login','/pages/login/fwqsz']
//全局路由前置守卫
router.beforeEach(
(to, from, next) => {
console.log(to, from,"afterEach");
let token=uni.getStorageSync(ACCESS_TOKEN);
if(token){
next()
}else{
if (whiteList.indexOf(to.path) !== -1) {
next()
}else{
next({ path: '/pages/login/login'})
}
next()
}
}
)
// 全局路由后置守卫
router.afterEach((to, from) => {
})
export default router;
\ No newline at end of file
const files = require.context('.', false, /\.js$/)
const modules = []
files.keys().forEach(key => {
if (key === './index.js') return
const item = files(key).default
modules.push(...item)
})
export default modules
\ No newline at end of file
const routes = [
{
path: "/pages/login/login",
name: 'login',
meta: {
title: '登录',
},
},
{
path: "/pages/login/fwqsz",
name: 'fwqsz',
meta: {
title: '服务器设置',
},
},
{
//注意:path必须跟pages.json中的地址对应,最前面别忘了加'/'哦
path: '/pages/homepage/index',
name: 'homepage',
meta: {
title: '主页',
},
},
{
//注意:path必须跟pages.json中的地址对应,最前面别忘了加'/'哦
path: '/pages/index/index',
name: 'index',
meta: {
title: '首页',
},
},
{
path: '/pages/user/people',
name: 'people',
meta: {
title: '个人中心',
},
},
{
path: '/pages/user/userdetail',
name: 'userdetail',
meta: {
title: '个人详情',
},
},
{
path: '/pages/user/useredit',
name: 'useredit',
meta: {
title: '个人编辑',
},
},
{
path: '/pages/common/exit',
name: 'exit',
meta: {
title: '退出',
},
},
{
path: '/pages/common/success',
name: 'success',
meta: {
title: 'success',
},
},
/* 测试页面 */
{
path: '/node_modules/appcommon/src/pages/test/index',
name: 'test',
meta: {
title: '测试页面',
},
},
{
path: '/pages/kqgl/gzrb/index',
name: 'kqgl-gzrb',
meta: {
title: '工作日报',
},
},
{
path: '/pages/kqgl/gzrb/xjgzrb/index',
name: 'kqgl-gzrb-xjgzrb',
meta: {
title: '新建工作日报',
},
},
{
path: '/pages/kqgl/gzrb/xzxm/index',
name: 'kqgl-gzrb-xzxm',
meta: {
title: '选择项目',
},
},
{
path: '/pages/kqgl/gzrb/xzsj/index',
name: 'kqgl-gzrb-xzsj',
meta: {
title: '选择商机',
},
},
{
path: '/pages/kqgl/gzrb/gzrbxq/index',
name: 'kqgl-gzrb-gzrbxq',
meta: {
title: '工作日报详情',
},
},
]
export default routes
let BASE_URL = ''
if (process.env.NODE_ENV == 'development') {
BASE_URL = 'http://119.3.92.249:18080/dmg' /* 开发环境*/
} else {
BASE_URL = '/app'// 生产环境
}
let staticDomainURL = BASE_URL+ '/sys/common/static';
const configService = {
apiUrl: BASE_URL,
staticDomainURL: staticDomainURL
};
export default configService
\ No newline at end of file
/* 选购商品 */
.flex1{
flex: 1;
}
.center{
display: flex;
justify-content: center;
align-items: center;
}
.goodsView{
padding: 10px;
// display: flex;
border-bottom: 1px #eee solid;
.goodsMain{
width: 100%;
display: flex;
.goodsMainLeft{
display: none;
width: 100px;
height: 100px;
}
.goodsMainRight{
flex: 1;
.goodsMainRightInfo{
width: 100%;
line-height: 20px;
}
.titleplay{
font-size: 16px;
line-height: 30px;
color: #666;
}
.numplay{
font-size: 15px;
line-height: 30px;
color: red;
}
}
}
.goodsBottom{
height: 20px;
width: 100%;
position: relative;
.goodsBottomRight{
position: absolute;
right: 10px;
bottom: 2px;
}
}
}
.picker{
text-align: left!important;
line-height: 35px!important;
}
.cu-form-group{
position: relative;
width: 100%;
}
.cu-form-group2{
width: 100%;
position: relative;
background-color: #ffffff;
padding: 0.5px 15px;
display: flex;
align-items: center;
min-height: 50px;
// justify-content: space-between;
border-bottom: .5px #eee solid;
}
.rightArrow::after {
font-family: cuIcon;
display: block;
content: "\e6a3";
position: absolute;
font-size: 17px;
color: #8799a3;
line-height: 50px;
width: 30px;
text-align: center;
top: 0;
bottom: 0;
right: 10px;
margin: auto;
}
.rightSearch::after {
font-family: cuIcon;
display: block;
content: "\e6a3";
position: absolute;
font-size: 17px;
color: #8799a3;
line-height: 50px;
width: 30px;
text-align: center;
top: 0;
bottom: 0;
right: 10px;
margin: auto;
}
.borderB{
border-bottom: .5px solid #eee;
}
.segment{
height: 10px;
width: 100%;
background-color: #eee;
}
.segment1{
height: 1px;
width: 100%;
background-color: #eee;
}
.wmsForm{
height: calc(100vh - 45px);
width: 100%;
overflow: auto;
// padding-top: 1vh;
.title{
width: 30%;
font-size: 13px;
border-right: 0px;
}
}
.full{
height: 100%;
width: 100%;
}
.float-right{
float: right;
}
\ No newline at end of file
let cacheMap = new Map()
let timeoutDefault = 1200
function isTimeout (name) {
const data = cacheMap.get(name)
if (!data) return true
if (data.timeout === 0) return false
const currentTime = Date.now()
const overTime = (currentTime - data.createTime) / 1000
if (overTime > data.timeout) {
cacheMap.delete(name)
if (name.startsWith('_')) {
try {
uni.removeStorageSync(name)
} catch (e) {
console.log(e)
}
}
return true
}
return false
}
class CacheCell {
constructor (data, timeout) {
this.data = data
this.timeout = timeout
this.createTime = Date.now()
}
}
class MinCache {
constructor (timeout) {
try {
const res = uni.getStorageInfoSync()
res.keys.forEach(name => {
try {
const value = uni.getStorageSync(name)
cacheMap.set(name, value)
} catch (e) {
console.log(e)
}
})
} catch (e) {
console.log(e)
}
timeoutDefault = timeout
}
set (name, data, timeout = timeoutDefault) {
const cachecell = new CacheCell(data, timeout)
let cache = null
if (name.startsWith('_')) {
try {
uni.setStorageSync(name, cachecell)
cache = cacheMap.set(name, cachecell)
} catch (e) {
console.log(e)
}
} else {
cache = cacheMap.set(name, cachecell)
}
return cache
}
get (name) {
return isTimeout(name) ? null : cacheMap.get(name).data
}
delete (name) {
let value = false
if (name.startsWith('_')) {
try {
uni.removeStorageSync(name)
value = cacheMap.delete(name)
} catch (e) {
console.log(e)
}
} else {
value = cacheMap.delete(name)
}
return value
}
has (name) {
return !isTimeout(name)
}
clear () {
let value = false
try {
uni.clearStorageSync()
cacheMap.clear()
value = true
} catch (e) {
console.log(e)
}
return value
}
}
MinCache.install = function (Vue, {timeout = 1200} = {}) {
Vue.prototype.$cache = new MinCache(timeout)
}
export default MinCache
//APP更新
import api from 'api/api.js'
export default function appUpdate() {
/* let url="http://119.3.92.249:17007/app/download/datacenter.apk";
plus.runtime.openURL(url, function(ress) {
console.log(ress);
}); */
api.postData('/getAppVersion',{
/* version: plus.runtime.version,
imei: plus.device.imei, */
apptype:"0",
// appid: plus.runtime.appid,
appid:"__UNI__5BC4E2F"
}).then((res) => {
if(res){
plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
let client_version = wgtinfo.version;
var flag_update_v =Number(client_version.split(".")[0]);
var flag_update_v2=Number(res.data.version);
console.log(flag_update_v)
console.log("getAppVersion")
console.log(res)
console.log(flag_update_v2)
var flag_hot =false;
if (flag_update_v<flag_update_v2) {
// 提醒用户更新
uni.showModal({
title: '更新提示',
content: "请进行版本更新,当前版本-"+flag_update_v+",更新版本-"+flag_update_v2,
success: (showResult) => {
if (showResult.confirm) {
plus.nativeUI.toast("正在准备环境,请稍后! ");
uni.showModal({
content:res.data.url
})
plus.runtime.openURL(res.data.url, function(ress) {
console.log(ress);
});
/* var dtask = plus.downloader.createDownload(res.data.url, {
method: 'GET',
filename: '_doc/update/'
}, function(d, status) {
if (status == 200) {
var path = d.filename; //下载apk
plus.runtime.install(path); // 自动安装apk文件
} else {
plus.nativeUI.alert('版本更新失败:' + status);
}
}); */
dtask.start();
}
}
})
} else if (flag_hot) {
uni.downloadFile({
url: res.data.url,
success: (downloadResult) => {
console.log(downloadResult.tempFilePath)
if (downloadResult.statusCode === 200) {
plus.nativeUI.toast(`正在热更新!${res.data.versionCode}`);
plus.runtime.install(downloadResult.tempFilePath, {
force: false
}, function() {
plus.nativeUI.toast("热更新成功");
plus.runtime.restart();
}, function(e) {
console.log(e)
plus.nativeUI.toast(`热更新失败:${e.message}`);
});
}
}
});
}
});
}
}).catch((err) => {
}).finally(()=>{
})
}
export const ACCESS_TOKEN = 'Access-Token'
export const USER_NAME = 'login_username'
export const USER_INFO = 'login_user_info'
const STORAGE_OPTIONS = {
namespace: 'pro__', // key prefix
name: 'ls', // name variable Vue.[ls] or this.[$ls],
storage: 'local', // storage name session, local, memory
}
export default STORAGE_OPTIONS;
// 对Date的扩展,将 Date 转化为指定格式的String
// 月(M)、日(d)、小时(h)、分(m)、秒(s)、季度(q) 可以用 1-2 个占位符,
// 年(y)可以用 1-4 个占位符,毫秒(S)只能用 1 个占位符(是 1-3 位的数字)
// (new Date()).Format("yyyy-MM-dd hh:mm:ss.S") ==> 2006-07-02 08:09:04.423
// (new Date()).Format("yyyy-M-d h:m:s.S") ==> 2006-7-2 8:9:4.18
Date.prototype.Format = function (fmt) {
var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"h+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt))
fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt))
fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}
export function formatTimeToStr(times, pattern) {
var d = new Date(times).Format("yyyy-MM-dd hh:mm:ss");
if (pattern) {
d = new Date(times).Format(pattern);
}
return d.toLocaleString();
}
\ No newline at end of file
This diff is collapsed.
import Vue from 'vue'
var eventBus = new Vue({});
export default eventBus;
\ No newline at end of file
This diff is collapsed.
export default [
/* 权限层级demo*/
{
mkid: '1804020000',
mkmc: '考勤管理',
image: 'null',
children: [{
mkid: '1804020000',
mkmc: '工作日报',
image: '/static/icon/oa/gzrb.png',
page: 'kqgl-gzrb'
},
]
}
]
\ No newline at end of file
/**
* 提示与加载工具类
*/
export default class Tips {
constructor() {
this.isLoading = false;
}
/**
* 弹出提示框
*/
static success(title, duration = 1000) {
setTimeout(() => {
uni.showToast({
title: title,
icon: "none",
mask: true,
duration: duration
});
}, 300);
if (duration > 0) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, duration);
});
}
}
/**
* 弹出确认窗口
*/
static confirm(text,showCancel, payload = {}, title = "提示") {
return new Promise((resolve, reject) => {
uni.showModal({
title: title,
content: text,
showCancel: showCancel,
success: res => {
if (res.confirm) {
resolve(payload);
} else if (res.cancel) {
reject(payload);
}
},
fail: res => {
reject(payload);
}
});
}).catch((e) => {});
}
static toast(title, onHide, icon = "none") {
setTimeout(() => {
uni.showToast({
title: title,
icon: icon,
mask: true,
duration:1000
});
}, 300);
// 隐藏结束回调
if (onHide) {
setTimeout(() => {
onHide();
}, 500);
}
}
/**
* 警告框
*/
static alert(title) {
uni.showToast({
title: title,
icon:"none",
mask: true,
duration: 1500
});
}
/**
* 错误框
*/
static error(title, onHide) {
uni.showToast({
title: title,
// image: "../../static/error.png",
mask: true,
duration: 1500
});
// 隐藏结束回调
if (onHide) {
setTimeout(() => {
onHide();
}, 500);
}
}
/**
* 弹出加载提示
*/
static loading(title = "加载中") {
if (Tips.isLoading) {
return;
}
Tips.isLoading = true;
uni.showLoading({
title: title,
mask: true
});
}
/**
* 加载完毕
*/
static loaded() {
if (Tips.isLoading) {
Tips.isLoading = false;
uni.hideLoading();
}
}
}
/**
* 静态变量,是否加载中
*/
Tips.isLoading = false;
import Vconsole from 'vconsole'
const vConsole = new Vconsole()
export default vConsole
\ No newline at end of file
<template>
<view style="width: 100%; height: 100%;background-color: #fff;">
<view class="tabs fixed-top" :style="[{top:70 + 'px'}]">
<view v-for="(tab, index) in tabs" class="tab-item" :class="current==index&&'active'" @click="current = index">
{{tab.title}}
</view>
</view>
<swiper :disable-touch="disable" :current="current" class="swiper-box" @change="onChange" >
<!-- #ifdef H5 -->
<swiper-item v-for="(item ,index) in tabs" :key="index" >
<!-- #endif -->
<!-- #ifdef APP-PLUS -->
<swiper-item @touchstart="touchstart" @touchmove="touchend" v-for="(item ,index) in tabs" :key="index" >
<!-- #endif -->
<scroll-view scroll-y="true" style="height: 100%;" @scrolltolower="scrolltolower">
<!-- #ifdef MP -->
<slot name="{{'content' + index}}"></slot>
<!-- #endif -->
<!-- #ifndef MP -->
<slot :name="'content'+index"></slot>
<!-- #endif -->
</scroll-view>
</swiper-item>
</swiper>
</view>
</template>
<script>
export default {
name: 'swiperTab',
props: {
currentTab: {
type: Number,
default: 0
},
tabs: {
type: Array,
default: []
}
},
mounted() {
setTimeout(()=>{
this.current=this.currentTab
},600)
},
data() {
return {
disable:false,
current: this.currentTab,
CustomBar:this.CustomBar,
};
},
methods: {
touchstart(e){
this.disable=true
this.start=0
this.start=e.changedTouches[0].pageX
},
touchend(e){
this.end=0
this.end=e.changedTouches[0].pageX
if(this.end>this.start){
if(this.current==0){
this.disable=true
}else{
this.disable=false
}
}else{
if(this.current==1){
this.disable=true
}else{
this.disable=false
}
}
},
// test(e){
// if(this.current==0&&e.detail.dx<0){
// this.disable=true
// }
// else if(this.current==1&&e.detail.dx>0){
// this.disable=true
// }
// else{
// this.disable=false
// }
// this.disable=true
// console.log(this.current)
// console.log(e.detail.dx)
// },
onChange(e) {
this.current = e.detail.current;
this.$emit('change', e.detail.current);
},
scrolltolower(e) {
this.$emit('onReachBottom', this.current);
console.log(this.current)
}
}
}
</script>
<style>
swiper-tab{
display: block;
height: 100%;
}
</style>
<style lang="scss" scoped>
.fixed-top {
position: fixed;
top: -88rpx;
line-height: 88rpx;
border-bottom: solid 1rpx #F1F1F1;
padding: 0 30rpx;
box-sizing: border-box;
transition: all 0.3s ease;
background-color: #FFFFFF;
z-index: 999;
}
.tabs{
width: 100%;
height: 75rpx;
display: flex;
.tab-item {
// flex: 1;
text-align: center;
color: grey;
line-height: 73rpx;
font-size: 28rpx;
font-weight: 500;
height: 100%;
width: 140rpx;
box-sizing: border-box;
&.active{
// font-size: 38rpx;
color: #666;
font-weight: 600;
border-bottom: 2rpx solid #666;
}
}
}
.swiper-box{
width: 100%;
height: 100%;
overflow: auto;
}
</style>
<template>
<view
class="u-mask"
hover-stop-propagation
:style="[maskStyle, zoomStyle]"
@tap="click"
@touchmove.stop.prevent="() => {}"
:class="{
'u-mask-zoom': zoom,
'u-mask-show': show,
}"
>
<slot />
</view>
</template>
<script>
/**
* mask 遮罩
* @description 创建一个遮罩层,用于强调特定的页面元素,并阻止用户对遮罩下层的内容进行操作,一般用于弹窗场景
* @tutorial https://www.uviewui.com/components/mask.html
* @property {Boolean} show 是否显示遮罩(默认false)
* @property {String Number} z-index z-index 层级(默认1070)
* @property {Object} custom-style 自定义样式对象,见上方说明
* @property {String Number} duration 动画时长,单位毫秒(默认300)
* @property {Boolean} zoom 是否使用scale对这招进行缩放(默认true)
* @property {Boolean} mask-click-able 遮罩是否可点击,为false时点击不会发送click事件(默认true)
* @event {Function} click mask-click-able为true时,点击遮罩发送此事件
* @example <u-mask :show="show" @click="show = false"></u-mask>
*/
export default {
name: "u-mask",
props: {
// 是否显示遮罩
show: {
type: Boolean,
default: false,
},
// 层级z-index
zIndex: {
type: [Number, String],
default: "",
},
// 用户自定义样式
customStyle: {
type: Object,
default() {
return {};
},
},
// 遮罩的动画样式, 是否使用使用zoom进行scale进行缩放
zoom: {
type: Boolean,
default: true,
},
// 遮罩的过渡时间,单位为ms
duration: {
type: [Number, String],
default: 300,
},
// 是否可以通过点击遮罩进行关闭
maskClickAble: {
type: Boolean,
default: true,
},
},
data() {
return {
zoomStyle: {
transform: "",
},
scale: "scale(1.2, 1.2)",
};
},
watch: {
show(n) {
if (n && this.zoom) {
// 当展示遮罩的时候,设置scale为1,达到缩小(原来为1.2)的效果
this.zoomStyle.transform = "scale(1, 1)";
} else if (!n && this.zoom) {
// 当隐藏遮罩的时候,设置scale为1.2,达到放大(因为显示遮罩时已重置为1)的效果
this.zoomStyle.transform = this.scale;
}
},
},
computed: {
maskStyle() {
let style = {};
style.backgroundColor = "rgba(0, 0, 0, 0.6)";
if (this.show)
style.zIndex = this.zIndex ? this.zIndex : this.$u.zIndex.mask;
else style.zIndex = -1;
style.transition = `all ${this.duration / 1000}s ease-in-out`;
// 判断用户传递的对象是否为空,不为空就进行合并
if (Object.keys(this.customStyle).length)
style = {
...style,
...this.customStyle,
};
return style;
},
},
methods: {
click() {
if (!this.maskClickAble) return;
this.$emit("click");
},
},
};
</script>
<style lang="scss" scoped>
.u-mask {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
opacity: 0;
transition: transform 0.3s;
}
.u-mask-show {
opacity: 1;
}
.u-mask-zoom {
transform: scale(1.2, 1.2);
}
</style>
This diff is collapsed.
## 导入即用 全端支持
### 有 + wx : zy597172583 标注来意 可评论 看到及时回复
1.使用方式
```javascript
<template>
<filter-popup :data="filterData" :form.sync="filterForm" v-model="popup.filter" title="全部筛选" height="1104rpx" @finsh="subFinsh"></filter-popup>
</template>
<script>
import FilterPopup from "@/components/filter-popup/filter-popup";
export default {
components: {
FilterPopup,
},
data() {
return {
//筛选表单数据
filterData: [
{
children: false,//是否有子项
title: "意向度",
key: "intention_type", //键名 接收对象名字
keyValue: "value", //获取的值是哪个
isRadio: true, //是否单选 否则多选
data: [
{
title: "一般意向",
id: 1,
value: 1,
},
{
title: "中意向度",
id: 2,
value: 2,
},
{
title: "高意向度",
id: 3,
value: 3,
},
],
},
{
children: false,//是否有子项
title: "手机号码",
key: "is_bind_phone", //键名 接收对象名字
keyValue: "value", //获取的值是哪个
isRadio: true, //是否单选 否则多选
data: [
{
title: "未绑定",
value: 0,
},
{
title: "已绑定",
value: 1,
},
],
},
{
children: false,//是否有子项
title: "企微好友",
key: "is_work_customer", //键名 接收对象名字
keyValue: "value", //获取的值是哪个
isRadio: true, //是否单选 否则多选
data: [
{
title: "未添加",
value: 0,
},
{
title: "已添加",
value: 1,
},
],
},
{
children: true,//是否有子项
isRadio: false, //是否单选
title: "标签内容",
key: "label", //键名 接收对象名字
keyValue: "id", //获取的值是哪个
data: [
{
title: "客户重要程度",
id: 22,
children: [
{
title: "一般意向2",
id: 32,
value: 1,
},
{
title: "一般意向3",
id: 12,
value: 1,
},
],
},
{
title: "客户重要程度2",
id: 122,
children: [
{
title: "一般意向2",
id: 43,
value: 1,
},
{
title: "一般意向3",
id: 23,
value: 1,
},
],
},
],
},
], //筛选数据
filterForm: {}, //选中的表单
};
},
}
```
2.组件props
| 参数名 | 类型 | 介绍 |
| ---------- | ------- | ------------------------------------------------- |
| form | Object | .sync双向绑定的表单值 , 可传入显示初始哪些被选中 |
| data | Array | 动态渲染选项的数据数组 |
| title | String | 标题 |
| height | String | 弹出层高度 单位 rpx px upx 百分比 vw等 |
| themeColor | String | 组件主体颜色 默认:\#0066ff |
| mask | Boolean | 是否显示弹出遮盖层 |
3.data 参数
| 参数名 | 类型 | 是否必填 | 介绍 |
| -------- | ------- | -------- | ------------------------------------------------------------ |
| children | Boolean | 是 | 是否有子项 |
| data | Array | 是 | 渲染出来的选项数据 |
| isRadio | Boolean | 是 | 是否单选 单个选项指定,单选还是多选 |
| title | String | 是 | 标签内容标题 |
| key | String | 是 | 接收对象名字 会作为@finsh返回对象的键名 |
| keyValue | String | 是 | 获取的值是哪个 自定义指定获取哪个键值 value还是id或者自己定义的 |
4.事件
| 事件名 | 返回参数 | 简介 |
| ------ | -------- | ----------------------------------------- |
| finsh | Object | 点击确定时触发 返回参数为选中值的对象数组 |
| close | 无 | 组件点击关闭时触发 |
![image-20210730095456900](https://yzhsaas-cdn.qietongvip.com/asd.png)
This diff is collapsed.
<template>
<view class="cu-form-group" style="z-index:10">
<view class="flex align-center">
<view class="title">
<text class="text-red" v-if="required">*</text>
<text space="ensp">{{label}}</text>
</view>
<picker
@change="pickerChange"
:range="selections"
:value="valueIndex"
:disabled="disabled">
<input
:placeholder="placeholder"
name="input"
v-model="selected"
:disabled="true"
></input>
</picker>
</view>
</view>
</template>
<script>
export default {
name: "AppSecelt",
behaviors: ['uni://form-field'],
props:{
display:{
type:String,
default:'inline-block',
required:false
},
placeholder:{
type:String,
default:'请选择',
required:false
},
label:{
type:String,
default:'',
required:false
},
value:{
type:String,
required:false
},
border:{
type:Boolean,
default:false,
required:false
},
dict:{
type:Array,
default:()=>[],
required:true
},
name:{
type:String,
default:'',
required:false
},
required:{
type:Boolean,
default:false,
required:false
},
disabled:{
type:Boolean,
default:false,
required:false
},
space:{
type:Boolean,
default:false,
required:false
}
},
data(){
return {
show:false,
selected:'',
valueIndex:0,
selections:[]
}
},
watch:{
value:{
immediate:true,
handler(val){
if(!val){
this.selected = ''
this.valueIndex = 0
}else{
this.dict.map((item,index)=>{
if(item.value == val){
this.selected = item.text;
this.valueIndex = index
}
})
}
}
},
dict(){
this.initSelections();
}
},
created(){
this.initSelections();
},
methods:{
initSelections(){
let arr = [];
this.dict.map(item=>{
arr.push(item.text)
});
this.selections = arr
},
pickerChange(e){
console.log("appselect::pickerChange",e.detail.value)
let backString = '';
let obj=this.dict[e.detail.value];
this.selected=obj.text;
backString=obj.value;
console.log("backString",backString)
console.log("this.selected",this.selected)
this.$emit('input',backString);
// #ifndef MP-WEIXIN
this.$emit('change',backString);
// #endif
}
},
model: {
prop: 'value',
event:'change'
}
}
</script>
<style scoped>
.cu-form-group uni-picker::after {
font-family: cuIcon;
display: block;
content: "\e6a3";
position: absolute;
font-size: 14px;
color: #FFFFFF;
line-height: 42px;
width: 25px;
text-align: center;
top: 0;
bottom: 0;
right: -8px;
margin: auto;
}
</style>
<template>
<view>
<view class="cu-custom cu-header" :style="[{height:CustomBar + 'px'}]">
<view class="cu-bar fixed" :style="style" :class="[bgImage!=''?'none-bg text-white bg-img':'',bgColor]">
<view class="action" @tap="BackPage" v-if="isBack">
<text class="cuIcon-back"></text>
<slot name="backText"></slot>
</view>
<view class="content" :style="[{top:StatusBar + 'px'}]">
<slot name="content"></slot>
</view>
<view class="action" @tap="tapBind">
<slot name="right"></slot>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
StatusBar: this.StatusBar,
CustomBar: this.CustomBar
};
},
name: 'cu-custom',
computed: {
style() {
var StatusBar= this.StatusBar;
var CustomBar= this.CustomBar;
var bgImage = this.bgImage;
var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
if (this.bgImage) {
style = `${style}background-image:url(${bgImage});`;
}
return style
}
},
props: {
bgColor: {
type: String,
default: ''
},
isBack: {
type: [Boolean, String],
default: false
},
bgImage: {
type: String,
default: ''
},
},
methods: {
BackPage() {
uni.navigateBack({
delta: 1
});
// if (getCurrentPages().length < 2 && 'undefined' !== typeof __wxConfig) {
// let url = '/' + __wxConfig.pages[0]
// return uni.redirectTo({url})
// }
// uni.navigateBack({
// delta: 1
// });
},
tapBind(){
this.$emit("tapBind")
},
backFunc(){
}
}
}
</script>
<style scoped>
/deep/ .cu-header .cu-bar .content{
text-align: left;
width: calc(100%);
margin-left:20rpx;
margin-right: 60px;
pointer-events: auto;
font-size: 16px;
}
</style>
<template>
<view>
<view class="cu-custom" :style="[{height:CustomBar + 'px'}]">
<view class="cu-bar fixed" :style="style" :class="[bgImage!=''?'none-bg text-white bg-img':'',bgColor]">
<view class="content" @click="ClickChange" :style="[{top:StatusBar + 'px'}]" >
<slot name="content"></slot>
</view>
<view style="margin-right: 15px;" @click="openmodal()" v-if="cx">
<text class="lg grey" :class="'cuIcon-' + 'search'">查询</text>
</view>
<view class="action" @tap="tapBind">
<slot name="right"></slot>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
StatusBar: this.StatusBar,
CustomBar: '70'
};
},
name: 'cu-custom',
computed: {
style() {
var StatusBar= this.StatusBar;
var CustomBar= this.CustomBar;
var bgImage = this.bgImage;
var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
if (this.bgImage) {
style = `${style}background-image:url(${bgImage});`;
}
return style
}
},
props: {
modalName:{
default:null
},
modal:{
default:null
},
cx: {
default: false
},
bgColor: {
type: String,
default: ''
},
isBack: {
type: [Boolean, String],
default: false
},
bgImage: {
type: String,
default: ''
},
},
methods: {
BackPage() {
uni.navigateBack({
delta: 1
});
},
openmodal(){
if(this.modalName){
this.$emit('open',this.modalName)
}else{
this.$emit('open',"bottomModal")
}
// if(this.modalName){
// this.$emit('open',null)
// }else{
// this.$emit('open','bottomModal')
// }
},
ClickChange(){
this.$emit("clickChange")
},
tapBind(){
this.$emit("tapBind")
}
}
}
</script>
<style scoped>
.cu-custom .cu-bar .content {
width: calc(100%);
}
</style>
<template>
<view>
<view class="cu-custom cu-header" :style="[{height:CustomBar + 'px'}]">
<view class="cu-bar fixed" style="background-color: rgba(102, 153, 255, 1);" :style="style" :class="[bgImage!=''?'none-bg text-white bg-img':'',bgColor]">
<view class="action" @tap="BackPage" v-if="isBack">
<text class="cuIcon-back"></text>
<slot name="backText"></slot>
</view>
<view class="action" @tap="goback" v-if="showBack">
<text class="cuIcon-back"></text>
<slot name="backText"></slot>
</view>
<view class="content" :style="[{top:StatusBar + 'px'}]">
<slot name="content"></slot>
</view>
<view class="action-t" @tap="tapBind">
<slot name="right"></slot>
</view>
<view v-if="showBuinfo" style="width: 55px;" class="action" @tap="butinfo">
<view class="but" style="">
保存
</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
StatusBar: this.StatusBar,
CustomBar: 70
};
},
name: 'cu-custom',
computed: {
style() {
var StatusBar= this.StatusBar;
var CustomBar= this.CustomBar;
var bgImage = this.bgImage;
var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
if (this.bgImage) {
style = `${style}background-image:url(${bgImage});`;
}
return style
}
},
props: {
showBuinfo:{
type: [Boolean],
default: false
},
showBack:{
type: [Boolean],
default: false
},
bgColor: {
type: String,
default: ''
},
isBack: {
type: [Boolean, String],
default: false
},
bgImage: {
type: String,
default: ''
},
},
methods: {
butinfo(){
this.$emit('butinfo')
},
goback(){
this.$emit('goback')
},
BackPage() {
if (getCurrentPages().length < 2 && 'undefined' !== typeof __wxConfig) {
let url = '/' + __wxConfig.pages[0]
return uni.redirectTo({url})
}
uni.navigateBack({
delta: 1
});
},
tapBind(){
this.$emit("tapBind")
},
backFunc(){
}
}
}
</script>
<style scoped>
.but{
height: 30px;width: 55px;border-radius: 5px;line-height: 30px;text-align: center;background-color: #5697f3;color: #fff;
}
/deep/ .cu-header .cu-bar .content{
text-align: center;
width: calc(100% - 120px);
margin-left: 60px;
margin-right: 60px;
pointer-events: auto;
}
/deep/ .cu-custom .cu-bar .action-t{
position: absolute;
right: 80px;
margin: auto;
/* height: 16px; */
font-size: 16px;
line-height: 20px;
z-index: 99;
}
</style>
<template>
<view class="cu-form-group" @click="timechange">
<view class="title"><text class="text-red" v-if="required">*</text>{{label}}</view>
<input
:placeholder="placeholder"
name="input"
v-model="selected"
disabled="true"
></input>
<w-picker
:visible.sync="visible"
ref="picker"
mode="date"
startYear="2020"
endYear="2100"
:value="value"
:fields="fields"
@confirm="onConfirm($event,'date')"
></w-picker>
</view>
</template>
<script>
export default {
name: "AppSecelt",
props:{
placeholder:{
type:String,
default:'请选择',
required:false
},
label:{
type:String,
default:'',
required:false
},
fields:{
type:String,
default:'second',
required:false
},
value:{
type:String,
required:false
} ,
required:{
type:Boolean,
default:false,
required:false
}
},
data(){
return {
visible:false,
selected:''
}
},
watch:{
value:{
immediate:true,
handler(val){
if(!val){
this.selected = ''
}else{
this.selected = val;
}
}
}
},
created(){
},
methods:{
timechange(){
this.$refs.picker.show()
},
onConfirm(e){
console.log("confirm",e)
let backString = e.value;
this.selected=e.value;
this.$emit('input',backString);
}
},
model: {
prop: 'value',
event: 'input'
}
}
</script>
<style scoped>
</style>
\ No newline at end of file
<template>
<view class="margin-top">
<view class="cu-bar bg-white ">
<view class="action">
{{label}}
</view>
<view class="action">
{{imgList.length}}/{{maxImg}}
</view>
</view>
<view class="cu-form-group">
<view class="grid col-4 grid-square flex-sub">
<view class="bg-img" v-for="(item,index) in imgList" :key="index" @tap="ViewImage" :data-url="imgList[index]">
<image :src="imgList[index]" mode="aspectFill"></image>
<view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="index">
<text class='cuIcon-close'></text>
</view>
</view>
<view class="solids" @tap="ChooseImage" v-if="imgList.length<maxImg">
<text class='cuIcon-cameraadd'></text>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
name: 'MyImageUpoad',
props: {
value: {type:String,default:''},
label:{type:String,default:'图片上传'},
maxImg: {
type: Number,
default: 3
},
},
mounted:function(){
if (this.value.split(',')!=''){
this.value.split(',').forEach(res=>{
this.imgList.push(baseurl+res)
})
}
},
data() {
return {
imgList: [],
pathlist:[],
}
},
methods: {
ChooseImage() {
uni.chooseImage({
count: this.maxImg, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album','camera'], //从相册选择
success: (res) => {
uni.uploadFile({
url: `${baseurl}systemController/filedeal.do?isup=1`,
filePath: res.tempFilePaths[0],
name: 'file',
success: (uploadFileRes) => {
let path = JSON.parse(uploadFileRes.data).obj
this.pathlist.push(path);
this.$emit('input',this.pathlist.join(','))
if (this.imgList.length != 0) {
this.imgList = this.imgList.concat(res.tempFilePaths)
} else {
this.imgList = res.tempFilePaths
}
}
})
}
});
},
ViewImage(e) {
uni.previewImage({
urls: this.imgList,
current: e.currentTarget.dataset.url
});
},
DelImg(e) {
uni.showModal({
title: '提示',
content: '确认要删除吗',
cancelText: '取消',
confirmText: '确认',
success: res => {
if (res.confirm) {
this.pathlist.splice(e.currentTarget.dataset.index,1)
this.imgList.splice(e.currentTarget.dataset.index, 1)
this.$emit('input',this.pathlist.join(','))
}
}
})
},
}
}
</script>
<style>
</style>
<template>
<view>
<map
style="width: 100%; height:250px;"
:latitude="latitude"
:longitude="longitude"
:markers="marker"
:scale="scale"
:circles="circles"
>
<!-- :circles="circles" -->
</map>
</view>
</template>
<script>
import { geoDistance } from '@/common/util/util.js'
import amap from "@/common/js-sdk/js-amap/amap-wx.js";
// #ifdef H5
import AMap from "@/common/js-sdk/js-amap/amap-h5.js";
// #endif
export default {
props:{
compLatitude:{
type:Number,
default:40.009390,
required:false
},
compLongitude:{
type:Number,
default:116.374322,
required:false
}
},
data() {
return {
amapPlugin:null,
wxMapKey:"53324ee357405c4a65f35a1aa05ffaf2",
id:0,
title: 'map',
distance:0,
address:"",
  latitude: this.compLatitude, //纬度
longitude: this.compLongitude, //经度
scale:16,//地图缩放程度
tipText:'打卡范围',
bgColor:'#00c16f',
marker: [],
  circles:[{//在地图上显示圆
  latitude: this.compLatitude,
  longitude: this.compLongitude,
  radius:80,//半径
fillColor:"#ffffffAA",//填充颜色
  color:"#55aaffAA",//描边的颜色
   strokeWidth:1//描边的宽度
}],
resAmap:null
}
},
created() {
// #ifdef MP-WEIXIN || APP-PLUS
this.amapPlugin = new amap.AMapWX({
key: this.wxMapKey
});
// #endif
// #ifdef H5
this.initAMap()
// #endif
},
mounted() {
// #ifdef MP-WEIXIN
this.getAuthorizeInfo();
// #endif
// #ifdef APP-PLUS
this.getLocationInfoWx();
// #endif
// #ifdef H5
//this.getLocationInfo()
// #endif
},
computed:{
inCircle(){
return this.address && this.distance <= 80
}
},
methods: {
allowed(){
return this.inCircle
},
getMyAddress(){
return this.address
},
refreshLocation(){
// #ifdef MP-WEIXIN
this.getAuthorizeInfo();
// #endif
// #ifdef APP-PLUS
this.getLocationInfoWx();
// #endif
// #ifdef H5
this.initAMap()
// #endif
},
getAuthorizeInfo(){
//1. uniapp弹窗弹出获取授权(地理,个人微信信息等授权信息)弹窗
var _this=this;
uni.authorize({
scope: "scope.userLocation",
success() { //1.1 允许授权
_this.getLocationInfoWx();
},
fail(){ //1.2 拒绝授权
console.log("你拒绝了授权,无法获得周边信息")
_this.openConfirm();
}
})
},
getLocationInfoWx(){
var that=this;
this.amapPlugin.getRegeo({
type: 'gcj02', //map 组件使用的经纬度是国测局坐标, type 为 gcj02
success: function(res) {
console.log("success",res);
that.latitude = res[0].latitude;
that.longitude = res[0].longitude;
that.address = res[0].name + res[0].desc;
that.distance=geoDistance(that.longitude, that.latitude,that.compLongitude,that.compLatitude)
console.log("that.distance",that.distance);
let tipText=(that.distance>80?"未在":"已在")+"打卡范围内";
let bgColor=that.distance>80?"#ff0000":"#00c16f";
let marker={
id:0,
  latitude:that.latitude,//纬度
  longitude:that.longitude,//经度
iconPath: '/static/location.png',
width:35,
height:35,
// #ifdef MP-WEIXIN
label:{//为标记点旁边增加标签
   content:tipText,//文本
    color:'#ffffff',//文本颜色
  fontSize:14,//文字大小
borderWidth:2,//边框宽度
borderColor:bgColor,//边框颜色
bgColor:bgColor,//背景颜色
  borderRadius:2,//边框圆角
  padding:5,//文本边缘留白
textAlign:'center',//文本对齐方式
x:0,//label的坐标,原点是 marker 对应的经纬度
y:0,//label的坐标,原点是 marker 对应的经纬度
},
// #endif
// #ifdef APP-PLUS
callout:{//自定义标记点上方的气泡窗口 点击有效
  content:tipText,//文本
  color:'#ffffff',//文字颜色
  fontSize:14,//文本大小
  //borderRadius:2,//边框圆角
   bgColor:bgColor,//背景颜色
  display:'ALWAYS',//常显
textAlign:'center'
},
// #endif
}
that.marker=[marker];
},
fail: (res) => {
console.log(JSON.stringify(res));
}
});
},
getLocationInfo() {
var _this=this;
uni.showLoading({
title: '获取信息中',
mask:true
});
uni.getLocation({
//type: 'wgs84',
type:'gcj02',
success: function (res) {
console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude);
_this.distance=geoDistance(res.longitude, res.latitude,_this.compLongitude,_this.compLatitude)
let tipText=(_this.distance>80?"未在":"已在")+"打卡范围内";
let bgColor=_this.distance>80?"#ff0000":"#00c16f";
_this.longitude=res.longitude
_this.latitude=res.latitude
let marker={
  latitude: res.latitude,//纬度
  longitude:res.longitude,//经度
  callout:{//自定义标记点上方的气泡窗口 点击有效
  content:tipText,//文本
  color:'#ffffff',//文字颜色
  fontSize:14,//文本大小
  borderRadius:2,//边框圆角
   bgColor:bgColor,//背景颜色
  display:'ALWAYS'//常显
}
}
_this.marker=[marker];
},
fail: function (res){
console.log('getLocation==> fail:' + res);
console.log(res);
}
});
uni.hideLoading();
},
// 当用户第一次拒绝后再次请求授权
openConfirm(){
uni.showModal({
title: '请求授权当前位置',
content: '需要获取您的地理位置,请确认授权',
success: (res)=> {
if (res.confirm) {
uni.openSetting();// 打开地图权限设置
} else if (res.cancel) {
uni.showToast({
title: '你拒绝了授权,无法获得位置信息',
icon: 'none',
duration: 1000
})
}
}
});
},
// 根据坐标返回地址(逆地理编码)
/* async getAddress (points) {
try {
this.resAmap = await AMap();
this.$nextTick(function() {
this.resAmap.plugin('AMap.Geocoder', () => {
var geocoder = new this.resAmap.Geocoder({
radius: 1000,
});
geocoder.getAddress(points, (status, result) => {
if (status === 'complete' && result.regeocode) {
this.address = result.regeocode.formattedAddress
}
})
});
})
} catch (e) {
console.log(e)
}
}, */
// #ifdef H5
async initAMap() {
try {
uni.showLoading({
title: '定位中...',
mask:true
});
this.resAmap = await AMap();
this.$nextTick(function() {
this.resAmap.plugin('AMap.Geolocation', () => {
var geolocation = new this.resAmap.Geolocation({
enableHighAccuracy: true, //是否使用高精度定位,默认:true
timeout: 10000, //超过10秒后停止定位,默认:5s
buttonPosition: 'RB', //定位按钮的停靠位置
// buttonOffset: new AMap.Pixel(10, 20),//定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)
zoomToAccuracy: true, //定位成功后是否自动调整地图视野到定位点
});
geolocation.getCurrentPosition(function(status, result) {
if (status == 'complete') {
onComplete(result)
} else {
onError(result)
}
});
});
//解析定位结果
var _this = this;
function onComplete(data) {
console.log("H5高德定位",data)
console.log('当前位置的经度:' + data.position.lat);
console.log('当前位置的纬度:' + data.position.lng);
_this.distance=geoDistance(data.position.lng, data.position.lat,_this.compLongitude,_this.compLatitude)
let tipText=(_this.distance>80?"未在":"已在")+"打卡范围内";
let bgColor=_this.distance>80?"#ff0000":"#00c16f";
_this.longitude=data.position.lng
_this.latitude=data.position.lat
_this.address=data.formattedAddress
let marker={
  latitude: _this.latitude,//纬度
  longitude:_this.longitude,//经度
  callout:{//自定义标记点上方的气泡窗口 点击有效
  content:tipText,//文本
  color:'#ffffff',//文字颜色
  fontSize:14,//文本大小
  borderRadius:2,//边框圆角
   bgColor:bgColor,//背景颜色
  display:'ALWAYS'//常显
}
}
_this.marker=[marker];
uni.hideLoading();
_this.$tip.success("定位成功")
}
function onError(data) {
console.log(data) // 定位失败的信息
}
})
} catch (e) {
console.log(e)
_this.$tip.alert("定位失败")
}
},
// #endif
}
}
</script>
<style>
</style>
<template>
<view>
<view class="cu-custom" :style="[{height:CustomBar + 'px',zIndex:zIndex}]">
<view class="cu-bar fixed" :style="style" :class="[bgImage!=''?'none-bg text-white bg-img':'',bgColor]">
<view class="action" @tap="BackPage" v-if="isBack">
<text class="cuIcon-back"></text>
<slot name="backText"></slot>
</view>
<view class="content" :style="[{top:StatusBar + 'px'}]">
<slot name="content"></slot>
</view>
<view class="action">
<slot name="right"></slot>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
StatusBar: this.StatusBar,
CustomBar: this.CustomBar
};
},
name: 'cu-custom',
computed: {
style() {
var StatusBar= this.StatusBar;
var CustomBar= this.CustomBar;
var bgImage = this.bgImage;
var style = `height:${CustomBar}px;padding-top:${StatusBar}px;`;
if (this.bgImage) {
style = `${style}background-image:url(${bgImage});`;
}
return style
}
},
props: {
bgColor: {
type: String,
default: ''
},
isBack: {
type: [Boolean, String],
default: false
},
bgImage: {
type: String,
default: ''
},
zIndex:{
type: String,
default: '10'
},
backRouterName:{
type: String,
default: ''
}
},
methods: {
BackPage() {
if(!this.backRouterName){
uni.navigateBack({
delta: 1
});
}else{
this.$Router.replace({name:this.backRouterName})
}
}
}
}
</script>
<style>
</style>
<template>
<view>
<scroll-view :scroll-y="modalName==null" class="page" :class="modalName!=null?'show':''">
<cu-custom bgColor="bg-gradual-pink" :isBack="true">
<block slot="backText">{{back}}</block>
<block slot="content">{{title}}</block>
</cu-custom>
<slot></slot>
</scroll-view>
</view>
</template>
<script>
export default {
name: 'MyPage',
props: {
title: {
type: String,
default: '标题'
},
back: {
type: String,
default: '返回'
},
modalName: {
type: String,
default: null
},
},
watch: {
},
computed: {
},
data() {
return {
}
},
methods: {}
}
</script>
<style>
</style>
This diff is collapsed.
This diff is collapsed.
@font-face {
font-family: 'sl-font';
src: url('data:font/truetype;charset=utf-8;base64,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') format('truetype');
}
.sl-font {
font-family: "sl-font" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.sl-down:before {
content: "\e61a";
}
.sl-up:before {
content: "\e61c";
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import { proxyLaunchHook } from './hooks';
/**
* 开始初始化app端路由配置
*
* @param {Object} Router 当前Router对象
*
* this 为当前 page 对象
*/
const appletsInit = function () {
proxyLaunchHook.call(this);
};
export default appletsInit;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment