Commit 8299475f by tan7

司机端

parents
<script>
import {
mapMutations,
mapActions,
} from 'vuex';
import {
SCAN_RESULT
} from '@/env.js';
export default {
onLaunch: function() {
this.initScreenAdaptation();
},
onShow: function() {
console.log('App Show')
},
onHide: function() {
console.log('App Hide')
},
methods: {
...mapActions(['initScreenAdaptation']),
},
}
</script>
<style>
/*每个页面公共css */
</style>
\ No newline at end of file
// 图片转base64
function detailImage(path, callback) {
// #ifdef APP-PLUS
plus.io.resolveLocalFileSystemURL(path, function(entry) {
entry.file(function(file) {
var fileReader = new plus.io.FileReader();
fileReader.readAsDataURL(file);
fileReader.onloadend = function(evt) {
// 回调函数返回base64的值
callback(evt.target.result);
}
})
})
// #endif
// #ifdef H5
var img = new Image();
img.src = path;
img.onload = function() {
//默认按比例压缩
var w = this.width,
h = this.height;
var quality = 0.95; // 默认图片质量为0.7
//生成canvas
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
// 创建属性节点
canvas.setAttribute("width", w);
canvas.setAttribute("height", h);
ctx.drawImage(this, 0, 0, w, h);
// quality值越小,所绘制出的图像越模糊
var base64 = canvas.toDataURL('image/jpeg', quality);
// 回调函数返回base64的值
callback(base64);
};
// #endif
}
module.exports = detailImage;
<template>
<view class="box-foot" :style="[{height:customTabBarHeight + 'px'}]">
<view class="top-line"></view>
<view class="btn-box">
<slot>button</slot>
</view>
</view>
</template>
<script>
import {
mapGetters,
} from 'vuex';
export default {
name: "bottom-btn-box",
data() {
return {
tabBarHeight: 0,
};
},
computed: {
...mapGetters(['customTabBarHeight'])
},
}
</script>
<style lang="scss" scoped>
/* 只限制上下,不限制左右,可以右更多的自定义空间 */
.box-foot {
position: fixed;
bottom: 0;
/* padding: 14rpx 72rpx 84rpx 42rpx; */
width: 100%;
display: flex;
flex-direction: column;
z-index: 999;
.btn-box {
flex: 1;
background-color: #fff;
padding: 9px 0rpx 0rpx 0rpx;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: flex-start;
}
/* 线条粗细和颜色 */
.top-line {
height: 1px;
background-color: #DDDDDD;
width: 100%;
scaleX: 0.5;
}
}
</style>
\ No newline at end of file
<template>
<view class="box-foot">
<view class="btn-box" :hover-class="btnHover" @click="$u.throttle(btnClick)">
<slot></slot>
</view>
<lineView :left="left" />
</view>
</template>
<script>
import {
mapGetters,
} from 'vuex';
import lineView from "@/components/form/lineView.vue";
export default {
name: "btnView",
components: {
lineView,
},
props: {
isOpacity: { //按钮颜色是透明度还是颜色
type: Boolean,
default: false,
},
readonly: { //按钮颜色是透明度还是颜色
type: Boolean,
default: false,
},
},
data() {
return {
tabBarHeight: 0,
left: 15,
btnHover: "btn-hover-class"
};
},
methods: {
btnClick() {
if (this.readonly) {
return;
}
this.$emit('click');
}
},
mounted() {
if (this.readonly) {
//只读状态没有状态
this.btnHover = "none";
} else if (this.isOpacity) {
this.btnHover = "btn-opacity-hover-class"
} else {
this.btnHover = "btn-hover-class"
}
}
}
</script>
<style lang="scss" scoped>
/* 只限制上下,不限制左右,可以右更多的自定义空间 */
.box-foot {
width: 750rpx;
display: flex;
flex-direction: column;
background-color: #ffffff;
.btn-box {
width: 750rpx;
display: flex;
min-height: 50px;
align-items: center;
justify-content: space-between;
background-color: #ffffff;
}
.btn-hover-class {
color: $uni-describe-text-color !important;
background: $btn-default-btn-hover-color !important;
}
.btn-opacity-hover-class {
&:before {
opacity: $btn-default-btn-hover-opticty !important;
}
}
}
</style>
\ No newline at end of file
<template>
<view class="" v-if="Show">
<view class="cu-modal" :class="{ show: showMask }" @tap="hideMask"></view>
<!-- 悬浮按钮菜单 -->
<view class="shopro-float-btn">
<button class="wechat-btn u-reset-button" @tap="onBtn">
<image class="wechat_img" src="@/static/report/search_gray_icon.png" mode="widthFix"></image>
</button>
</view>
<u-modal :title="title+'搜索'" :show="showModal" showCancelButton closeOnClickOverlay @cancel="cancel" @confirm="confirm"
@close="cancel">
<u--input v-model="search_value" :value="search_value" :placeholder="'请输入'+title+'名称'" border="surround"
clearable></u--input>
</u-modal>
</view>
</template>
<script>
export default {
name: "floatBtn",
components: {},
data() {
return {
search_value: '', //输入的文本
showBtnList: true, //列表弹出
modalImg: '', //子项图片弹出
showModal: false, //modal层
showMask: false,
platform: this.$platform.get(),
Show:this.show
};
},
props: {
title: {
type: String, //参数的类型
default: "人员" //参数的默认值
},
show: {
type:Boolean, //参数的类型
default:true //参数的默认值
}
},
computed: {
},
created() {},
methods: {
cancel() {
this.showModal = false;
this.search_value = '';
},
hideMask() {
this.showMask = false;
},
confirm() {
let search_value = this.search_value;
this.cancel();
this.$emit('onBtnAction', search_value);
},
// 点击悬浮按钮
onBtn() {
let type = 'search';
// this.$emit('onBtnAction',type);
this.showModal = true;
},
}
};
</script>
<style lang="scss">
.shopro-float-btn {
position: fixed;
bottom: calc(var(--window-bottom) + 200rpx);
right: 30rpx;
z-index:99;
.float--active {
position: absolute;
bottom: 80rpx;
right: 0;
left: 0;
margin: 0 auto;
z-index: 1001;
transform: scale(1);
transition: all 0.2s linear;
}
.float-list-box {
position: absolute;
z-index: 1001;
bottom: 0;
right: 0;
left: 0;
margin: 0 auto;
transform: scale(0);
transform-origin: bottom;
opacity: 0;
transition: all 0.2s linear;
}
.btn-item {
margin-bottom: 20rpx;
.btn-img {
width: 60rpx;
height: 60rpx;
}
.btn-name {
font-size: 20rpx;
color: #fff;
text-align: center;
white-space: nowrap;
}
}
.wechat-btn {
box-shadow: 0px 0px 20px 4px rgba(199, 199, 199, 0.22);
border-radius: 50%;
width: 80rpx;
height: 80rpx;
.wechat_img {
width: 80rpx;
height: 80rpx;
}
}
}
.img-box {
position: relative;
width: 610rpx;
.modal-img {
width: 100%;
will-change: transform;
height: 830rpx;
}
}
/* ==================
模态窗口
==================== */
.cu-modal {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1110;
opacity: 0;
outline: 0;
text-align: center;
-ms-transform: scale(1.185);
transform: scale(1.185);
backface-visibility: hidden;
perspective: 2000upx;
background: rgba(0, 0, 0, 0.6);
transition: all 0.3s ease-in-out 0s;
pointer-events: none;
}
.cu-modal::before {
content: "\200B";
display: inline-block;
height: 100%;
vertical-align: middle;
}
.cu-modal.show {
opacity: 1;
transition-duration: 0.3s;
-ms-transform: scale(1);
transform: scale(1);
overflow-x: hidden;
overflow-y: auto;
pointer-events: auto;
}
</style>
\ No newline at end of file
<template>
<view class="btnBox">
<u-button v-if="!custom_style" @click="btnClick" data-name="3333" :loading="loading" :plain="plain"
:shape="shape" :size="size" :hairline="hairline" :type="type">{{btnTitle}}</u-button>
<u-button v-if="custom_style" :custom-style="custom_style" @click="btnClick" data-name="3333" :loading="loading"
:hairline="hairline">{{btnTitle}}</u-button>
</view>
</template>
<script>
import {
mapGetters,
} from 'vuex';
export default {
name: "generalButton",
props: {
btnTitle: {
type: String,
default: ""
},
btnStyle: {
type: String,
default: "default", //预留,用于自定义一些默认按钮
},
loading: {
type: Boolean,
default: false, //是否在加载中
},
type: {
type: String,
default: 'primary', //主题 //primary//error/warning//success
},
size: {
type: String,
default: 'normal', //medium,mini
},
shape: {
type: String,
default: 'square', //直角'square' 圆角'circle';
},
hairline: {
type: Boolean,
default: false, //细线;
},
plain: {
type: Boolean,
default: false, //是否镂空
},
btnKey: {
type: String,
default: 'customKey', //按钮自定义标识,任意字符串
},
custom_style: {
type: Object,
default: () => { // 注意驼峰命名,并且值必须用引号包括,因为这是对象
return null;
// return {
// marginLeft: "100px",
// marginRight: "100px",
// }
},
},
},
mounted() {
this.typeChange(this.btnStyle);
},
data() {
return {
};
},
computed: {
...mapGetters(['customTabBarHeightRpx'])
},
methods: {
typeChange(btnStyle) {
switch (btnStyle) {
case 'default': //用于自定义样式改变按钮样式
break;
}
},
btnClick() {
this.$emit('click', this.btnKey);
}
}
}
</script>
<style lang="scss" scoped>
/* 只限制上下,不限制左右,可以右更多的自定义空间 */
.btnBox {
display: flex;
flex: 1,
}
</style>
\ No newline at end of file
<template>
<view class="searchBox">
<!-- <view class="set" style="width:28%;margin-right: 15rpx;">
<select-lay :showplaceholder='false' class="seclectpaytype" :value="type_name" slabel="name"
svalue="id" placeholder="请选择" :options="type_data" height="150rpx" @selectitem="changeType"
:disabled="disable" :clean="false" :uninput="true"></select-lay>
</view> -->
<view class="search">
<u-search v-model="searchResult" :showAction="false" actionText="搜索" @clear="clearSearch"
@custom="search_rw" @search="search_rw" :clearabled='true' :disabled="true"
@click="$u.throttle(search_sel)" :placeholder="placeholder" :hover-class="btnHover"></u-search>
<view class="icon" @click="$u.throttle(scanAction)" :hover-class="btnHover" style="margin-right: 4px;">
<u-icon size="35" name="scan" color="$main-bg-color"></u-icon>
</view>
</view>
<lineView v-if="showLine" :left="left" />
</view>
</template>
<script>
import lineView from "@/components/form/lineView.vue";
export default {
name: "searchScanBtn",
components: {
lineView,
},
props: {
placeholder: {
type: String,
default: "请选择"
},
value: {
type: String,
default: ""
},
showLine: {
type: Boolean,
default: true, //是否展示底部细线
},
left: {
type: Number,
default: 0,
}
},
mounted() {},
data() {
return {
searchResult: '',
btnHover: "btn-hover-class",
};
},
watch: {
value: {
immediate: true,
handler(newVal, oldVal) {
this.searchResult = newVal;
},
},
},
computed: {},
methods: {
search_sel() {
//使用中
this.$emit('click');
},
search_rw() {
//不使用
},
clearSearch() {
},
scanAction() {
let sigin = "searchScan";
uni.$off(sigin)
uni.$once(sigin, (data) => {
//一码多用扫描结果处理
//扫码页面返回数据
let result = JSON.parse(data);
this.$emit('callbackScanResult', result);
})
let url = "/pages/generalPage/scan/scanDefault?page=" + sigin;
uni.navigateTo({
url: url,
})
}
}
}
</script>
<style lang="scss" scoped>
.searchBox {
width: 750rpx;
display: flex;
flex-direction: column;
.search {
width: 750rpx;
display: flex;
padding-right: 0px;
padding-left: 15px;
height: 50px;
align-items: center;
justify-content: center;
.icon {
width: 45px;
background-color: #fff;
display: flex;
height: 50px;
justify-content: center;
align-items: center;
}
.btn-hover-class {
color: #ffffff !important;
background: $btn-default-btn-hover-color !important;
}
}
}
</style>
\ No newline at end of file
<template>
<view class="pageBox" :style="{'height':pageHeight + 'px'}">
<scroll-view :scroll-y="scrollY" :style="{'height':pageHeight + 'px'}" class="pageScrollBox" :enhanced="true"
:bounces="false" :show-scrollbar="false" @scroll="scroll" :scroll-top="scrollTop">
<slot></slot>
</scroll-view>
<!-- <backtop @back="topback" :show="topshow"></backtop> -->
<!-- 日历组件 -->
<!-- <u-calendar :show="calendarShow" :mode="mode" :monthNum="25" :closeOnClickOverlay="true"
@confirm="dateSelectAction" @close="closeCalendar" :minDate="minDate" :maxDate="maxDate" :title="title">
</u-calendar>
<u-datetime-picker :formatter="formatters" :show="datetimePickerShow" @confirm="dateSelectAction"
@cancel="closeCalendar" mode="datetime" :minDate="pickerMinDate" :maxDate="pickerMaxDate"
:closeOnClickOverlay="true" v-model="defaultDate" @close="close"></u-datetime-picker>
<noteDialog :show="textAreaShow" :title="textAreaTitle" :note="textAreaValue" @save_note="get_note"
@close="closeNoteDialog">
</noteDialog>
<tabspopup :tag="tags" :data="list" :type="true" :name="titles" :show_="show"></tabspopup> -->
<!-- 选择器 块状 或 列表状 根据 传 selectionMode参数区分 -->
<!-- <block-select :popupShow="blockSelectShow" :blockSelectTitle="blockSelectTitle" :selectionMode="selectionMode"
:selectData="orderList" :typeList="typeList" ref="child">
</block-select> -->
</view>
</template>
<script>
import {
mapGetters,
mapActions
} from 'vuex'
// import backtop from '@/pages/mobile_order/sale_order/coms/backtop.vue'
// import tabspopup from '@/pages/mobile_order/sale_order/coms/tabspopup.vue'
// import noteDialog from '@/components/form/new-form/note_dialog.vue';
const d = new Date().getTime()
export default {
name: "default-pages-box",
props: {
scrollY: {
type: Boolean,
default: true,
},
isButtonBox: {
type: Boolean,
default: true,
}
},
// components: {
// backtop,
// noteDialog,
// tabspopup
// },
data() {
return {
topshow: false,
scrollTop: 0,
oldScrollTop: 0,
defaultDate: d,
};
},
onPageScroll(e) {
// e.scrollTop 表示当前页面滚动的距离
console.log('页面滚动距离:', e.scrollTop);
// 在这里编写你的滚动相关逻辑
},
created() {
},
computed: {
...mapGetters(['screenHeight', 'customTabBarHeight', 'naviStatusHeight']),
pageHeight() {
if (this.isButtonBox) {
return this.screenHeight - this.naviStatusHeight - this.customTabBarHeight;
} else {
return this.screenHeight - this.naviStatusHeight
}
},
},
methods: {
...mapActions(['closeCalendar', 'dateSelect', 'confirmTextArea', 'closeTextArea']),
//备注弹窗vuex管理示例
get_note(textAreaValue) {
let option = {
textAreaValue: textAreaValue,
}
console.log(option)
this.confirmTextArea(option);
},
closeNoteDialog() {
this.closeTextArea();
},
//时间组件vuex管理示例
dateSelectAction(e) {
if (this.mode == 'datetime') {
//滚轮选择器
let valueStart = this.$moment(e.value).format('YYYY-MM-DD HH:mm');
let option = {
valueStart: valueStart,
valueEnd: '',
}
this.dateSelect(option);
} else {
let option = {
valueStart: e[0],
valueEnd: '',
}
if (e.length > 0) {
option.valueEnd = e[1];
}
this.dateSelect(option);
}
},
close() {
this.closeCalendar();
},
scroll(e) {
this.oldScrollTop = e.detail.scrollTop
if (e.detail.scrollTop >= 1.5 * this.screenHeight) {
this.topshow = true
} else {
this.topshow = false
}
},
topback() {
//视图会发生重新渲染
this.scrollTop = this.oldScrollTop
//当视图渲染结束 重新设置为0
this.$nextTick(() => {
this.scrollTop = 0
});
},
formatters(type, value) {
if (type === 'year') {
return `${value}年`
}
if (type === 'month') {
return `${value}月`
}
if (type === 'day') {
return `${value}日`
}
if (type === 'hour') {
return `${value}时`
}
if (type === 'minute') {
return `${value}分`
}
return value
},
que_ding_click() {
}
},
}
</script>
<style>
.pageBox {
background-color: #FAFAFAFF;
z-index: 921;
}
.pageScrollBox {
z-index: 922;
}
</style>
\ No newline at end of file
<template>
<bottom-btn-box>
<view class="onebox" v-if="pageType=='default'">
<generalButton :btnTitle="leftBtnTitle" @click="leftBtnAction" :shape="shape" />
</view>
</bottom-btn-box>
</template>
<script>
import generalButton from "@/components/btn/general-button.vue"
export default {
name: "mobileBottomBtn",
components: {
generalButton
},
data() {
return {};
},
props: {
pageType: {
type: String,
default: 'default', //twoBtn
},
leftBtnTitle: {
type: String,
default: '左按钮'
},
rightBtnTitle: {
type: String,
default: '右按钮'
},
shape: {
type: String,
default: 'circle' //直角'square' 圆角'circle';
}
},
methods: {
leftBtnAction() {
this.$emit("leftClick", "");
},
rightBtnAction(index) {
this.$emit("rightClick", index);
},
}
}
</script>
<style lang="scss" scoped>
.onebox {
display: flex;
width: 100%;
justify-content:center;
align-items: center;
// padding-left: 16px;
// padding-right: 16px;
padding: 0 50rpx;
z-index: 1999;
}
</style>
\ No newline at end of file
<template>
<view :class="button?'topClass haveIcon':'topClass noIcon'">
<u-search id="search" :placeholder="placeholder" v-model="searchModel" @search="search()" :show-action="false"
:showAction="false" @click="click_search" actionText="搜索" @custom="search()" @change="change" shape="square"
:clearabled="true" :disabled="open" @clear="clearHandle"></u-search>
<view class="btn" v-if="button">
<button type="default" @click="scan">扫码</button>
</view>
</view>
</template>
<script>
import {
setWeixinConfig,
onScanH5Weixin,
} from './weixinSdkManager.js'
export default { //搜索框,带扫描图标
name: "searchBar",
props: {
value: {
type: String,
default: ""
},
showScan: { //是否展示扫描组件
type: Boolean,
default: true,
},
placeholder: { //非只读状态无内容时的显示
type: String,
default: "请输入搜索内容"
},
open: {
type: Boolean,
default: false,
},
button:{
type: Boolean,
default: false,
}
},
data() {
return {
searchModel: '',
btnHover: "btn-hover-class",
}
},
watch: {
value: {
immediate: true,
handler(newVal, oldVal) {
this.searchModel = newVal;
},
deep: true
},
},
created() {
// 微信授权
// #ifdef H5
setWeixinConfig()
// #endif
},
methods: {
search() {
this.$emit('search', this.searchModel);
},
scan(){
this.$emit('scan');
},
scanAction() {
// #ifdef H5
onScanH5Weixin((res) => {
// 二维码识别成功
this.$emit('callbackScanResult', res)
})
// #endif
// app扫码
// #ifdef APP-PLUS
let sigin = "searchScan1";
uni.$off(sigin)
uni.$once(sigin, (data) => {
//一码多用扫描结果处理
//扫码页面返回数据
let result = JSON.parse(data);
this.$emit('callbackScanResult', result.result);
})
let url = "/pages/generalPage/scan/scanDefault?page=" + sigin;
uni.navigateTo({
url: url,
})
// #endif
},
change(e) {
this.$emit('input', e)
},
click_search() {
this.$emit('click');
},
// 清除事件
clearHandle() {
this.$emit('clear');
}
}
}
</script>
<style lang="scss" scoped>
.topClass {
display: flex;
justify-content: space-between;
width: 100%;
background-color: white;
align-items: center;
box-sizing: border-box;
height: 50px;
padding-left: 15px;
}
.haveIcon {
padding-right: 2px;
}
.noIcon {
padding-right: 15px;
}
.icon {
padding-left: 10px;
padding-right: 15px;
background-color: #fff;
display: flex;
height: 50px;
justify-content: center;
align-items: center;
}
.btn-hover-class {
color: #ffffff !important;
// background: $btn-default-btn-hover-color !important;
}
.btn{
padding: 0rpx 15rpx;
button{
padding: 0rpx 20rpx;
font-size: 28rpx;
background-color:#003D54;
border-color: #003D54;
color: #fff;
}
}
</style>
\ No newline at end of file
/**
* 扫码结果处理工具
*/
import http from "@/rokeTools/request/index.js";
// #ifdef H5
import wx from "weixin-js-sdk";
import Qrcode from '@/components/qrcode.js';
import H5_ObjectURL from '@/store/package_method.js'
// #endif
import {
wx_code_get_openid
} from '../pages/api.js'
//保存首次进入时的url ,在iOS中,获取微信Api权限用的是,第一个进入页面的url,所以在main.js中,调用
export function saveWeixinSdkUrl() {
// #ifdef H5
let url = window.location.href.split('#')[0];
window.sessionStorage.setItem('scanQRCode', 'false');
if (url) {
window.sessionStorage.setItem('firstEntryUrl', url);
}
console.log('首次获取' + url);
// #endif
}
//获取微信权限请求后台授权服务所需要的url
export function getCurrentPageUrl() {
//安卓机型获取当前页面路径
let url = window.location.href.split('#')[0];
// url = encodeURIComponent(url)
//ios机型获取当前页面路径
let ua = navigator.userAgent.toLowerCase();
let isWeixin = ua.indexOf('micromessenger') !== -1;
if (isWeixin) {
let isiOS = /(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent); //ios终端
if (isiOS && window.sessionStorage.getItem('firstEntryUrl')) {
url = window.sessionStorage.getItem('firstEntryUrl').split('#')[0];
}
}
return url;
}
//如果页面需要用微信扫一扫,一定现在onLoad中调用一下这个方法,申请的微信Api权限
export function setWeixinConfig() {
// #ifdef H5
//把之前登录页存的拿出来传给后台当授权回调页
let ua = navigator.userAgent.toLowerCase();
let isWeixin = ua.indexOf('micromessenger') !== -1;
if (isWeixin) {
let url = getCurrentPageUrl();
let msg = {
url: url //这个参数是需要给后台回调的授权页面(就是当前访问的页面,网上很多包括我都是在这里出的问题,下面详细讲解)
}
http('wx.wx_information', msg).then(data => {
if (data?.result?.timestamp) {
let result = data.result;
wxConfig(result.appId, result.timestamp, result.nonceStr, result.signature);
} else if (data?.result?.message) {
// uni.showToast({
// title: data.result.message,
// icon: 'none',
// duration: 1300
// })
}
}).catch((err) => {})
}
// #endif
}
// 配置config 获取微信Api权限需要的配置
export function wxConfig(appId, timestamp, nonceStr, signature) {
wx.config({
debug: false, // 开启调试模式,
// appId:appId,
appId: 'wxaa6cf2955c720fe6',
timestamp: timestamp, // 必填,生成签名的时间戳
nonceStr: nonceStr, // 必填,生成签名的随机串
signature: signature, // 必填,签名
jsApiList: ['login', 'scanQRCode', 'checkJsApi', 'openLocation', 'getLocation'], // 必填,需要使用的JS接口列表
openTagList: ['wx-open-launch-weapp']
});
wx.ready((res) => {
setTimeout(() => {
window.sessionStorage.setItem('scanQRCode', 'false');
wx.checkJsApi({
jsApiList: ['scanQRCode', 'getLocation'],
success: function(res) {
if (res?.checkResult?.scanQRCode) {
//允许调用扫一扫
window.sessionStorage.setItem('scanQRCode', 'true');
}
wx.getLocation({
type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
success: function(res) {
try {
console.log("微信data" + res);
var latitude = res
.latitude; // 纬度,浮点数,范围为90 ~ -90
var speed = res.speed; // 速度,以米/每秒计
var accuracy = res.accuracy; // 位置精度
var longitude = res
.longitude; // 经度,浮点数,范围为180 ~ -180。
uni.setStorageSync('longitude',longitude)
uni.setStorageSync('latitude',latitude)
} catch (error) {
alert('解析地理位置错误');
}
},
cancel: function(res) {
alert('用户拒绝授权获取地理位置');
},
fail: function(res) {
//alert(JSON.stringify(res));
alert("未能获取地理位置,首先检查手机是否启用微信定位");
}
});
},
fail: function(response) {
},
})
},
500)
})
wx.error(function(res) {});
}
/*
* h5 扫码,在微信中用微信扫一扫
*/
// 开始扫码
export function onScanH5Weixin(callback) {
let ua = navigator.userAgent.toLowerCase();
let isWeixin = ua.indexOf('micromessenger') !== -1;
let canScan = window.sessionStorage.getItem('scanQRCode');
console.log(canScan);
if (isWeixin && 'true' === canScan) {
// 可以使用扫码
wx.scanQRCode({
needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
success: function(res) {
let result = res.resultStr; // 扫码的结果
//回传扫描结果
if (result) {
if (result.includes(',') && (result.includes('UPC_E') || result.includes('UPC_A') ||
result.includes('CODE_39') || result.includes('CODE_128') || result.includes(
'EAN_8') || result.includes('EAN_13') ||
result.includes('CODE_25'))) {
//条形码返回结果前面会加上条码类型,所以结果要处理一下
result = result.split(',')[1];
}
callback && callback(result);
} else {
uni.showToast({
title: '没有识别到有效内容',
icon: 'none',
duration: 2000
})
}
},
fail: function(response) {
uni.showToast({
title: '识别失败',
icon: 'none',
duration: 2000
})
}
});
} else {
if (isWeixin) {
//防止没有请求权限,再请求一遍
setWeixinConfig();
}
//只能使用h5扫码
uni.chooseImage({
count: 1,
success: imgRes => {
Qrcode.qrcode.decode(H5_ObjectURL.getObjectURL(imgRes.tempFiles[0]))
Qrcode.qrcode.callback = (codeRes) => {
if (codeRes.indexOf('error') >= 0) {
// 二维码识别失败
// this.qrCodeRes = '不合法二维码:' + codeRes
uni.showToast({
title: '扫码失败',
icon: 'error',
duration: 2000
})
} else {
// 二维码识别成功
let result = H5_ObjectURL.decodeStr(codeRes)
callback && callback(result);
}
}
}
});
}
}
\ No newline at end of file
/**
* Roke全局配置文件
*/
// //base_url 存放
export const CLIENT_URL_KEY = 'client_url'
// //session_id 存放
export const SESSION_ID_KEY = 'session_id'
// export const API_URL = `${BASE_URL}/addons/shopro/`
// 存放更新报错的版本,下次进入将不再进行更新此版本
export const ERR_UPDATE_VERSION = 'err_update_version'
// 存放从后台请求的版本号,已经请求的不用重复请求
export const RIS_APP_VERSION_KEY = 'mobile_app_version'
//扫码返回数据名称后缀
export const SCAN_RESULT = "ScanResult"
export const SHARE_FILES = "shareFiles"
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)'))
document.write(
'<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' +
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script>
<title></title>
<!--preload-links-->
<!--app-context-->
</head>
<body>
<div id="app"><!--app-html--></div>
<script type="module" src="/main.js"></script>
</body>
</html>
import App from './App'
import rokeTools from "@/rokeTools";
// #ifndef VUE3
import Vue from 'vue'
// import myMixin from '@/components/mixin.js';
// Vue.use(myMixin);
//vuex 文件注册
// import store2 from '@/store';
import store from '@/rokeTools/store';
import {
mapGetters,
mapMutations,
mapActions
} from 'vuex';
async function bootstrap() {
App.mpType = 'app'
// Vue.component('general-button', generalButton)
Vue.config.productionTip = false
Vue.use(rokeTools);
const app = new Vue({
store,
...App,
})
app.$mount()
}
bootstrap();
// #endif
// #ifdef VUE3
import {
createSSRApp
} from 'vue'
export function createApp() {
const app = createSSRApp(App)
return {
app
}
}
// #endif
import uView from '@/uni_modules/uview-ui'
Vue.use(uView)
\ No newline at end of file
{
"name" : "yksjd",
"appid" : "__UNI__F9DD869",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
"usingComponents" : true,
"nvueStyleCompiler" : "uni-app",
"compilerVersion" : 3,
"splashscreen" : {
"alwaysShowBeforeRender" : true,
"waiting" : true,
"autoclose" : true,
"delay" : 0
},
/* 模块配置 */
"modules" : {},
/* 应用发布信息 */
"distribute" : {
/* android打包配置 */
"android" : {
"permissions" : [
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/* ios打包配置 */
"ios" : {},
/* SDK配置 */
"sdkConfigs" : {}
}
},
/* 快应用特有相关 */
"quickapp" : {},
/* 小程序特有相关 */
"mp-weixin" : {
"appid" : "",
"setting" : {
"urlCheck" : false
},
"usingComponents" : true
},
"mp-alipay" : {
"usingComponents" : true
},
"mp-baidu" : {
"usingComponents" : true
},
"mp-toutiao" : {
"usingComponents" : true
},
"uniStatistics" : {
"enable" : false
},
"vueVersion" : "2"
}
{
"weixin-js-sdk": [
"1.6.5"
]
}
\ No newline at end of file
MIT License
Copyright (c) 2023 Yanxi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
微信官方 js-sdk
----
说明: 仅将官方 js-sdk 发布到 npm,支持 CommonJS,便于 browserify, webpack 等直接使用,支持 TypeScript。
官方 JS 源码: https://res.wx.qq.com/open/js/jweixin-1.6.0.js
官方使用说明: https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html
安装:
```shell
npm install weixin-js-sdk
```
使用:
```javascript
// commonjs
var wx = require('weixin-js-sdk');
// es module
import wx from 'weixin-js-sdk'
```
### Old versions
* [1.0.0](https://github.com/yanxi123-com/weixin-js-sdk/tree/1.0.0)
* [1.2.0](https://github.com/yanxi123-com/weixin-js-sdk/tree/1.2.0)
### 个人主页
* [https://yanxi123.com/](https://yanxi123.com/)
### 感谢
TypeScript 定义文件来自 [wx-jssdk-ts](https://github.com/zhaoky/wx-jssdk-ts/blob/master/index.d.ts)
{
"name": "weixin-js-sdk",
"version": "1.6.5",
"license": "MIT",
"main": "index.js",
"description": "微信官方 js-sdk npm 安装版,支持 typescript",
"repository": {
"type": "git",
"url": "https://github.com/yanxi123-com/weixin-js-sdk"
},
"homepage": "https://yanxi123.com/",
"__npminstall_done": true,
"_from": "weixin-js-sdk@1.6.5",
"_resolved": "https://registry.npmmirror.com/weixin-js-sdk/-/weixin-js-sdk-1.6.5.tgz"
}
\ No newline at end of file
MIT License
Copyright (c) 2023 Yanxi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
微信官方 js-sdk
----
说明: 仅将官方 js-sdk 发布到 npm,支持 CommonJS,便于 browserify, webpack 等直接使用,支持 TypeScript。
官方 JS 源码: https://res.wx.qq.com/open/js/jweixin-1.6.0.js
官方使用说明: https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/JS-SDK.html
安装:
```shell
npm install weixin-js-sdk
```
使用:
```javascript
// commonjs
var wx = require('weixin-js-sdk');
// es module
import wx from 'weixin-js-sdk'
```
### Old versions
* [1.0.0](https://github.com/yanxi123-com/weixin-js-sdk/tree/1.0.0)
* [1.2.0](https://github.com/yanxi123-com/weixin-js-sdk/tree/1.2.0)
### 个人主页
* [https://yanxi123.com/](https://yanxi123.com/)
### 感谢
TypeScript 定义文件来自 [wx-jssdk-ts](https://github.com/zhaoky/wx-jssdk-ts/blob/master/index.d.ts)
{
"name": "weixin-js-sdk",
"version": "1.6.5",
"license": "MIT",
"main": "index.js",
"description": "微信官方 js-sdk npm 安装版,支持 typescript",
"repository": {
"type": "git",
"url": "https://github.com/yanxi123-com/weixin-js-sdk"
},
"homepage": "https://yanxi123.com/",
"__npminstall_done": true,
"_from": "weixin-js-sdk@1.6.5",
"_resolved": "https://registry.npmmirror.com/weixin-js-sdk/-/weixin-js-sdk-1.6.5.tgz"
}
\ No newline at end of file
{
"name": "a",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"weixin-js-sdk": {
"version": "1.6.5",
"resolved": "https://registry.npmmirror.com/weixin-js-sdk/-/weixin-js-sdk-1.6.5.tgz",
"integrity": "sha512-Gph1WAWB2YN/lMOFB/ymb+hbU/wYazzJgu6PMMktCy9cSCeW5wA6Zwt0dpahJbJ+RJEwtTv2x9iIu0U4enuVSQ=="
}
}
}
{
"name": "a",
"version": "1.0.0",
"main": "main.js",
"scripts": {
"test": "1"
},
"keywords": [
"1"
],
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"weixin-js-sdk": "^1.6.5"
}
}
{
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "入厂预约"
}
},
{
"path": "pages/info/info",
"style": {
"navigationBarTitleText": "预约信息"
}
}
],
"globalStyle": {
"navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#F8F8F8",
"backgroundColor": "#F8F8F8"
},
"uniIdRouter": {}
}
import http from "@/rokeTools/request/index.js";
//获取微信openid和token
export function wx_code_get_openid(code) {
return new Promise((resolve, reject) => {
uni.showLoading({
title: '',
mask: true,
})
http('wx.wx_code_get_openid', {
code: code ? code : ''
}).then((data) => {
uni.hideLoading();
if (data?.result?.state == 'success') {
resolve(data.result);
} else {
uni.showToast({
title: data?.result?.msgs,
icon: 'none'
})
reject({});
}
}).catch((err) => {
uni.hideLoading();
uni.showToast({
title: data?.result?.msgs,
icon: 'none'
})
reject(err);
})
});
}
//获取设备信息
export function mix_barcode_get_device(code) {
return new Promise((resolve, reject) => {
uni.showLoading({
title: '',
mask: true,
})
http('sh.mix_barcode_get_device', {
product_lot: code ? code : ''
}).then((data) => {
uni.hideLoading();
if (data?.result?.state == 'success') {
resolve(data.result);
} else {
uni.showToast({
title: data?.result?.msgs,
icon: 'none'
})
reject({});
}
}).catch((err) => {
uni.hideLoading();
uni.showToast({
title: '请求详情数据失败',
icon: 'none'
})
reject(err);
})
});
}
//创建售后工单
export function mix_create_aso(data) {
return new Promise((resolve, reject) => {
uni.showLoading({
title: '',
mask: true,
})
http('sh.mix_create_aso', {
"wx_open_id": data.wx_open_id ? data.wx_open_id : '',
"product_lot": data.product_lot ? data.product_lot : '',
"company_name": data.company_name ? data.company_name : '',
"contacts": data.contacts ? data.contacts : '',
"contact_phone": data.contact_phone ? data.contact_phone : '',
"problem_note": data.problem_note ? data.problem_note : '',
"problem_images": data.problem_images ? data.problem_images : ''
}).then((data) => {
uni.hideLoading();
if (data?.result?.state == 'success') {
resolve(data.result);
} else {
uni.showToast({
title: data?.result?.msgs,
icon: 'none'
})
reject({});
}
}).catch((err) => {
uni.hideLoading();
uni.showToast({
title: '请求详情数据失败',
icon: 'none'
})
reject(err);
})
});
}
//获取售后工单列表
export function mix_get_aso_list(num, size, query) {
return new Promise((resolve, reject) => {
uni.showLoading({
title: '',
mask: true,
})
http('sh.mix_get_aso_list', {
page_no: num ? num : '',
page_size: size ? size : '',
query: query ? query : ''
}).then((data) => {
uni.hideLoading();
if (data?.result?.state == 'success') {
resolve(data.result);
} else {
uni.showToast({
title: data?.result?.msgs,
icon: 'none'
})
reject({});
}
}).catch((err) => {
uni.hideLoading();
uni.showToast({
title: '请求详情数据失败',
icon: 'none'
})
reject(err);
})
});
}
//获取售后工单详情
export function mix_get_aso_detail(id) {
return new Promise((resolve, reject) => {
uni.showLoading({
title: '',
mask: true,
})
http('sh.mix_get_aso_detail', {
aso_id: id ? id : ''
}).then((data) => {
uni.hideLoading();
if (data?.result?.state == 'success') {
resolve(data.result);
} else {
uni.showToast({
title: data?.result?.msgs,
icon: 'none'
})
reject({});
}
}).catch((err) => {
uni.hideLoading();
uni.showToast({
title: '请求详情数据失败',
icon: 'none'
})
reject(err);
})
});
}
//提交评价
export function submit_evaluation(id, evaluation, note) {
return new Promise((resolve, reject) => {
uni.showLoading({
title: '',
mask: true,
})
http('sh.submit_evaluation', {
aso_id: id ? id : '',
evaluation:evaluation?evaluation:'',
"evaluation_note":note?note:''
}).then((data) => {
uni.hideLoading();
if (data?.result?.state == 'success') {
resolve(data.result);
} else {
uni.showToast({
title: data?.result?.msgs,
icon: 'none'
})
reject({});
}
}).catch((err) => {
uni.hideLoading();
uni.showToast({
title: '请求详情数据失败',
icon: 'none'
})
reject(err);
})
});
}
\ No newline at end of file
<template>
<view class="content" :style="[{height:pageHeight+'px'}]">
<view class="center">
<view class="input">
车牌号:<u-input placeholder="请输入车牌号" border="bottom" v-model="car_code"
:customStyle="{border:'1rpx solid','border-radius':'10rpx'}"></u-input>
</view>
<view class="input">
制卡码:<u-input placeholder="请输入制卡码" border="bottom" v-model="card_code"
:customStyle="{border:'1rpx solid','border-radius':'10rpx'}"></u-input>
</view>
</view>
<view class="msg" style="bottom: 270rpx;" v-if="is_appointment">
请确认当前位置离兖矿国际焦化{{appointment_fence}}公里范围内
</view>
<view class="msg">
预约成功后,请在<text style="color:red;">{{limit_time}}</text>分钟内入场,超过<text
style="color:red;">{{limit_time}}</text>分钟视为放弃预约,预约将失效,需要重新预约。
</view>
<mobileButton leftBtnTitle="立即预约" @leftClick="submit"></mobileButton>
</view>
</template>
<script>
import {
setWeixinConfig,
onScanH5Weixin,
getLocation
} from '../../components/weixinSdkManager.js'
import mobileButton from "../../components/mobile-bottom-btn.vue"
import {
mapGetters,
mapActions
} from 'vuex'
export default {
data() {
return {
car_code: '',
card_code: '',
is_appointment: '',
appointment_fence: '',
limit_time: '',
longitude:uni.getStorageSync('longitude')?uni.getStorageSync('longitude'):0,
latitude:uni.getStorageSync('latitude')?uni.getStorageSync('latitude'):0,
}
},
components: {
mobileButton
},
onLoad() {
this.get_state()
let url = location.href
let client_url = url.split('/')[0] + '//' + url.split('/')[2]
let link = window.location.href;
if (link.indexOf('code=') === -1) {
let url = encodeURIComponent(link);
let appid = 'wxaa6cf2955c720fe6'
let authURL =
`https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${url}&response_type=code&scope=snsapi_userinfo&state=abcdef&connect_redirect=1#wechat_redirect`
window.location.href = authURL;
} else {
let temp = link.split("code=")[1];
let code = link.split("code=")[1].split("&")[0]
wx.request({
url: 'http://ykykt.newerp.rokedata.com/ykt/get_openid',
method: "POST",
header: {
'Content-Type': 'application/json'
},
data: {
code: code
},
success: function(res) {
uni.setStorageSync('openid', res.data.result.openid)
}
})
}
setWeixinConfig();
},
computed: {
...mapGetters(['screenHeight', 'customTabBarHeight', 'naviStatusHeight']),
pageHeight() {
return this.screenHeight - this.naviStatusHeight
},
},
methods: {
get_state() {
let that = this
wx.request({
url: 'http://ykykt.newerp.rokedata.com/ykt/get_appointment_state',
method: "POST",
data: {},
success(res) {
console.log('appointment_state', res)
that.is_appointment = res.data.result.is_appointment,
that.appointment_fence = res.data.result.is_appointment ? res.data.result
.appointment_fence : ''
that.limit_time = res.data.result.limit_time
}
})
},
get_wz() {
var that = this
wx.getLocation({
type: 'wgs84', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
success: function(res) {
try {
console.log("微信data" + res);
var latitude = res.latitude; // 纬度,浮点数,范围为90 ~ -90
var speed = res.speed; // 速度,以米/每秒计
var accuracy = res.accuracy; // 位置精度
var longitude = res.longitude; // 经度,浮点数,范围为180 ~ -180。
console.log("微信经度:" + longitude);
console.log("微信纬度:" + latitude);
that.longitude = longitude
that.latitude = latitude
} catch (error) {
alert('解析地理位置错误');
}
},
cancel: function(res) {
alert('用户拒绝授权获取地理位置');
},
fail: function(res) {
//alert(JSON.stringify(res));
alert("未能获取地理位置,首先检查手机是否启用微信定位");
}
});
},
submit() {
let that = this
if (this.car_code == '') {
uni.showToast({
title: '车牌号不能为空',
icon: 'none'
})
} else if (this.card_code == '') {
uni.showToast({
title: '制卡码不能为空',
icon: 'none'
})
} else {
wx.request({
url: 'http://ykykt.newerp.rokedata.com/ykt/create_appointment',
method: "POST",
data: {
car_code: that.car_code,
card_code: that.card_code,
wx_id: uni.getStorageSync('openid'),
position_lat: that.latitude,
position_lng: that.longitude
},
success(res) {
console.log('create_appointment', res)
if (res.data.result.state == 'error') {
wx.showModal({
title: '提示',
content: res.data.result.msg,
showCancel: false
})
} else if (res.data.result.state == 'success') {
// wx.showModal({
// title: '提示',
// content: res.data.result.msg,
// showCancel: false
// })
uni.navigateTo({
url: '/pages/info/info?data=' + JSON.stringify(res.data.result
.appointment_info) + '&car_code=' + that.car_code +
'&card_code=' + that.card_code
})
console.log(res.data.result.appointment_info)
}
}
})
}
}
}
}
</script>
<style>
.content {
display: flex;
position: relative;
}
.center {
margin: auto;
}
.msg {
position: absolute;
text-align: center;
width: 100%;
bottom: 160rpx;
color: #999;
}
.input {
display: flex;
align-items: center;
font-size: 32rpx;
margin-top: 20rpx;
padding: 20rpx 0rpx;
}
</style>
\ No newline at end of file
<template>
<!--pages/appointmentInfo/appointmentInfo.wxml-->
<view>
<!-- 叫号 -->
<view v-if="appointment_state=='call'">
<!-- <view style="text-align:center;"> -->
<view class="wt_title">
叫号中...
</view>
<view class="line-head" style="color:green">
<view>
<image src="../../static/img/success.png" style="width:50px;height:50px;"></image>
</view>
预约成功!
</view>
<view style="font-size:20px;text-align:center;margin-top:10%;">{{call_time}}</view>
<view style="text-align:center;padding:5% 10%;font-size:20px;">
车辆{{car_code}},请在<text style="color:red;">{{time_restrict}}</text>分钟内入场,超过<text
style="color:red;">{{time_restrict}}</text>分钟视为放弃预约,预约将失效,需要重新预约。
</view>
<button style="color:ef393939;background:#f7f7f7;border: 1px solid #ccc;" hover-class="btn-hover"
@click="CancelAppointment">取消预约</button>
</view>
<!-- 排队 -->
<view v-if="appointment_state=='queue'">
<!-- <view class="wt_title">
预约排队中...
</view>
<view>
<image src="/static/img/queue.png" style="width: 50px;height: 50px;"></image>
</view> -->
<view class="line-head" style="color:green">
<view>
<image src="../../static/img/queue.png" style="width:50px;height:50px;"></image>
</view>
排队中...
</view>
<view class="line-head">
当前排队人数:
<view :style="{color:total>=50?'red':'green','font-weight':total>=50?900:500}">
{{total}}
</view>
</view>
<view class="line-head">
您位于第
<text
:style="{color:curr_number>=50?'red':'green','font-weight':curr_number>=50?900:500}">{{curr_number}}</text>
</view>
<view style="margin-top:20vh;">
<button style="color:ef393939;background:#f7f7f7;border: 1px solid #ccc;" hover-class="btn-hover"
@click="CancelAppointment">取消预约</button>
</view>
</view>
<!-- 取消、超时、进/出场 -->
<view v-else>
<view v-if="appointment_state=='card'" class="line-head">
<view>
<image src="../../static/img/card.png" style="width: 50px;height: 50px;"></image>
</view>
已制卡
</view>
<view v-if="appointment_state=='in'" class="line-head">
<view>
<image src="../../static/img/in.png" style="width: 50px;height: 50px;"></image>
</view>
入厂
</view>
<view v-if="appointment_state=='out'" class="line-head">
<view>
<image src="../../static/img/out.png" style="width: 50px;height: 50px;"></image>
</view>
出厂
</view>
<view v-if="appointment_state=='cancel'" class="line-head">
<view>
<image src="../../static/img/cancel.png" style="width: 50px;height: 50px;"></image>
</view>
已取消
<view class="wt_title" style="font-size:20px;margin-top:10%;">
如需预约,请点击下方按钮,重新预约
</view>
<button style="margin-top:50%;" bindtap="Appointment">重新预约</button>
</view>
<view v-if="appointment_state=='overtime'" class="line-head">
<view>
<image src="../../static/img/overtime.png" style="width: 50px;height: 50px;"></image>
</view>
您已超时
</view>
<view v-if="appointment_state=='overtime'" class="wt_title" style="margin-top:10%;">
请点击下方按钮,重新预约
</view>
<button v-if="appointment_state=='overtime'" style="margin-top:50%;" @click="Appointment">重新预约</button>
</view>
</view>
</template>
<script>
export default {
data() {
return {
appointment_state: '',
call_time: '',
time_restrict: '',
curr_number: '',
total: '',
appointment_time: '',
car_code:'',
card_code:''
}
},
onLoad(option) {
if (option.data) {
let data = JSON.parse(option.data)
console.log(data)
this.appointment_state = data.state ? data.state : ''
this.call_time = data.call_time ? data.call_time : ''
this.time_restrict = data.time_restrict ? data.time_restrict : ''
this.total = data.total ? data.total : ''
this.curr_number = data.curr_number ? data.curr_number : ''
this.appointment_time = data.appointment_time ? data.appointment_time : ''
this.car_code=option.car_code
this.card_code=option.card_code
}
},
methods: {
CancelAppointment(e) {
var that = this
wx.showModal({
title: '提示',
content: '取消后将清空您的预约信息',
success(res) {
if (res.confirm) {
wx.clearStorageSync()
wx.showToast({
title: '已取消!'
})
wx.request({
url: 'http://ykykt.newerp.rokedata.com/ykt/cancel_appointment',
method: "POST",
data: {
car_code: that.car_code,
card_code: that.card_code,
},
success(res) {
uni.navigateBack()
}
})
}
}
})
},
Appointment() {
uni.navigateBack()
}
}
}
</script>
<style lang="scss" scoped>
.wt_title {
text-align: center;
}
.line-head {
font-size: 60rpx;
text-align: center;
margin-top: 10vh;
}
</style>
\ No newline at end of file
// 引入公共的bus,来做为中间传值的工具
import Vue from 'vue'
export default new Vue()
\ No newline at end of file
// import store from '@/rokeTools/store';
import http from '@/rokeTools/request';
import platform from '@/rokeTools/platform';
import rokeNavigate from '@/rokeTools/navigateManager';
import {
CLIENT_URL_KEY,
SESSION_ID_KEY,
} from '../env.js';
const install = Vue => {
//base_url 存放
Vue.prototype.$CLIENT_URL_KEY = CLIENT_URL_KEY;
//session_id 存放
Vue.prototype.$SESSION_ID_KEY = SESSION_ID_KEY;
// 挂载请求
Vue.prototype.$http = http;
// 平台判断
Vue.prototype.$platform = platform;
// 跳转事件管理
Vue.prototype.$rokeNavigate = rokeNavigate;
}
export async function init(options) {
//可以在这里写一些初始化信息
}
export default {
install
}
\ No newline at end of file
export default {
redirectTo(url, options) {
if (options && JSON.stringify(options) !== '{}') {
let query = this.addQueryString(options);
url += url.indexOf('?') === -1 ? `?${query}` : `&${query}`
}
uni.redirectTo({
url: url,
})
},
navigateTo(url, options) {
if (options && JSON.stringify(options) !== '{}') {
let query = this.addQueryString(options);
url += url.indexOf('?') === -1 ? `?${query}` : `&${query}`
}
uni.navigateTo({
url: url,
})
},
addQueryString(params) {
let paramsData = ''
Object.keys(params).forEach(key => {
paramsData += key + '=' + encodeURIComponent(params[key]) + '&'
})
return paramsData.substring(0, paramsData.length - 1)
},
// 判断是否是某个页面
checkCurrentPages(path, perPage) {
var pages = getCurrentPages(); //获取所有页面的数组对象
if (perPage) {
//判断前一个页面是否是某个页面
if (pages.length > 1) {
var currPage = pages[pages.length - 2]; //前一个页面
let url = currPage.route;
if (url.indexOf(path) != -1) {
return true;
}
}
} else {
//判断当前页面是否是某个页面
var currPage = pages[pages.length - 1]; //当前页面
let url = currPage.route;
if (url.indexOf(path) != -1) {
return true;
}
}
return false;
}
}
\ No newline at end of file
/**
* Platform v1.0.0
* @Class Platform
* @description shopro-platform 1.0.0 全平台兼容
* @Author lidongtony
* @Date 2021-04-07
* @Email lidongtony@qq.com
*/
export default {
// 获取当前运行平台
get() {
let platform = '';
// #ifdef H5
platform = 'H5';
// #endif
// #ifdef APP-PLUS
platform = 'App';
// #endif
// #ifdef MP-WEIXIN
platform = 'wxMiniProgram';
// #endif
// #ifdef MP-ALIPAY
platform = 'alipayMiniProgram';
// #endif
if (platform !== '') {
uni.setStorageSync('platform', platform);
} else {
uni.showToast({
title: '暂不支持该平台',
icon: 'none'
});
}
return platform;
},
set(platform) {
uni.setStorageSync('platform', platform);
return platform;
},
// 检测当前运行机型
device() {
// 客户端平台,值域为:ios、android、mac(3.1.10+)、windows(3.1.10+)、linux(3.1.10+)
return uni.getSystemInfoSync().platform;
},
// 检测当前的原生版本号
getNativeVersion() {
return uni.getSystemInfoSync().appVersion;
},
}
\ No newline at end of file
import {
CLIENT_URL_KEY,
SESSION_ID_KEY,
ERR_UPDATE_VERSION,
RIS_APP_VERSION_KEY
} from '../../env.js';
import http from "@/rokeTools/request/index.js";
/**
* App版本更新的方法
*/
export function wgtUrlupload() {
//系统版本升级判断接口(后台获取服务器)
// #ifdef APP-PLUS
/** 锁定屏幕方向 */
plus.screen.lockOrientation('portrait-primary');
/** 检测升级 */
// 取得版本号
plus.runtime.getProperty(plus.runtime.appid, function(info) {
// 版本号变量持久化存储
let platform = '';
getApp().globalData.editionnum = info.version; //版本号持久化存储做其它备用
// console.log("当前应用版本:" + info.version + "-2-33d-" + plus.runtime.version);
// console.log("appid:" + plus.runtime.appid);
// console.log("appid基座版本号:" + plus.runtime.version);
platform = uni.getSystemInfoSync().platform;
//请求版本好信息
requestAppVersion().then((data) => {
if (data) {
checkVersionToLoadUpdate(platform, info.version,
data);
}
})
})
// #endif
}
export function checkVersionToLoadUpdate(platform, server_version, data) {
let baseUrl = uni.getStorageSync(CLIENT_URL_KEY);
let that = this;
const {
ios_lowest_frame_version,
ios_reject_updates,
ios_wgt_version,
android_lowest_frame_version,
android_reject_updates,
android_wgt_version
} = data;
if (platform == 'android' && android_lowest_frame_version) {
let appVersion = uni.getSystemInfoSync().appVersion;
//检测版本是否可以更新
let rejectUpdate = checkRejectUpdates(appVersion, android_reject_updates);
if (rejectUpdate) {
//禁止更新
return;
}
//Android APK 版本判断
compareVersion(appVersion, android_lowest_frame_version).then((isNeedUpdata) => {
if (isNeedUpdata) {
var android_apk_upgradeUrl = baseUrl + '/roke/app_upgrade'
//测试地址
// android_apk_upgradeUrl =
// "http://dev-ybx.oss-cn-qingdao.aliyuncs.com/private_packages/pdf/__UNI__273_440.apk";
getAppInfo(1, android_apk_upgradeUrl, android_lowest_frame_version);
} else {
//Android wgt 版本判断
compareVersion(server_version, android_wgt_version).then((isNeed) => {
if (!isNeed) {
return;
}
var android_wgt_upgradeUrl = baseUrl + '/roke/app_upgrade_wgt';
//测试地址
// android_wgt_upgradeUrl =
// "http://dev-ybx.oss-cn-qingdao.aliyuncs.com/private_packages/pdf/__UNI__51E368D.wgt";
console.log(android_wgt_version);
getAppInfo(1, android_wgt_upgradeUrl, android_wgt_version)
});
}
});
} else if (platform == 'ios' && ios_lowest_frame_version) {
let appVersion = uni.getSystemInfoSync().appVersion;
//检测版本是否可以更新
let rejectUpdate = checkRejectUpdates(appVersion, ios_reject_updates);
if (rejectUpdate) {
//禁止更新
return;
}
compareVersion(appVersion, ios_lowest_frame_version).then((isNeedUpdata) => {
if (isNeedUpdata) {
uni.showModal({
title: "更新提示",
content: "融科睿思有新的框架需要更新,请前往苹果应用商店进行更新",
showCancel: false,
confirmText: "立即更新",
success: (res) => {
if (res.confirm) {
//跳转appStore 的方法
let appleId = 6458679161
plus.runtime.launchApplication({
action: `itms-apps://itunes.apple.com/cn/app/id${appleId}?mt=8`
}, function(e) {});
}
}
})
} else {
compareVersion(server_version, ios_wgt_version).then((isNeed) => {
if (!isNeed) {
return;
}
var ios_upgradeUrl = baseUrl + '/roke/ios_upgrade'
getAppInfo(1, ios_upgradeUrl, ios_wgt_version);
});
}
});
// if (compareVersion(appVersion,ios_lowest_frame_version)) {
// } else {
// // ios下载升级文件的url
// ;
// // ios_wgt_version 用于判断 ios wgt包是否需要更新,ios_lowest_frame_version 判断不需要更新后,才进行此版本号判断
// if (info_version < ios_wgt_version) {
// }
// }
}
}
/**
* 进行版本型号的比对 以及下载更新请求
* @param {Object} data 服务器最新 应用版本号
* @param {Object} server_version 当前应用版本号
* //检测当前框架版本是否是禁止更新的版本 true 禁止更新 return false; 可以更新
*/
export function checkRejectUpdates(appVersion, reject_updates) {
if (!reject_updates) {
return true;
} else if (reject_updates.includes(appVersion)) {
return true;
}
return false;
}
/**
* 请求App版本号
*/
export function requestAppVersion() {
return new Promise((reolve, reject) => {
// #ifdef APP-PLUS
let cacheData = uni.getStorageSync(RIS_APP_VERSION_KEY);
if (cacheData) {
http('login.mobile_app_version').then(data => {
if (data.state == 'success') {
uni.setStorage({
key: RIS_APP_VERSION_KEY,
data: data,
success: function() {}
});
}
}).catch((err) => {});
return reolve(cacheData);
} else {
http('login.mobile_app_version').then(data => {
if (data.state == 'success') {
return reolve(data);
} else {
return reject(null);
}
}).catch((err) => {
console.log(err);
return reject(null);
});
}
// #endif
// #ifdef H5
return reject(null);
// #endif
})
}
// 调用更新版本方法
export function getAppInfo(type, url, res_version) {
const platform = uni.getSystemInfoSync().platform; //本机设备操作系统 (android || ios)
if (platform != 'ios' && platform != 'android') false; //如果不是安卓或ios 返回false
//这里自行请求API获取版本信息 建议传入操作系统标识,返回本机对应的操作系统最新版本信息,也就是安卓的返回就是安卓的版本信息 ios返回就是ios的版本信息
//请求获取最新版本
//测试用的链接正式版要屏蔽
// url = "http://dev-ybx.oss-cn-qingdao.aliyuncs.com/private_packages/pdf/__UNI__51E368D.wgt";
setTimeout(() => {
let update_info = {
version: res_version, //线上版本
now_url: url, //更新链接
silent: 0, //是否是静默更新
force: 1, //是否是强制更新
net_check: 1, //非WIfi是否提示
// note: "", //更新内容
}
checkUpdate(update_info, type).then(res => {
if (res.msg) {
// plus.nativeUI.toast(res.msg);
}
}); ///检查更新
//checkUpdate 线上版本号 与 本地版本号做对比 ,如果需要更新 根据静默,强制、wifi等信息执行静默更新或跳转到升级页面
//跳转升级页面的前提是,需要新建并在pages.json中配置升级页面
}, 200)
}
//对比版本号
export function compareVersion(ov, nv) {
return new Promise((reolve, reject) => {
if (!ov || !nv || ov == "" || nv == "") {
return reolve(false);
}
// console.log(ov);
// console.log(nv);
let b = false;
let ova = ov.split(".", 4);
let nva = nv.split(".", 4);
for (let i = 0; i < ova.length && i < nva.length; i++) {
let so = ova[i],
no = parseInt(so),
sn = nva[i],
nn = parseInt(sn);
if (nn > no || sn.length > so.length) {
return reolve(true);
} else if (nn < no) {
return reolve(false);
}
}
if (nva.length > ova.length && 0 == nv.indexOf(ov)) {
return reolve(true);
} else {
return reolve(false);
}
})
}
// type 1手动点击更新 0是自动检查
export function checkUpdate(update_info, type = 0) {
return new Promise((reolve, reject) => {
//需要更新,判断是不是静默更新
if (/\.wgt$/.test(update_info.now_url) && update_info.silent == 1) {
console.log("静默更新");
if (type == 1) {
return reolve({
msg: "已经是最新版本了"
})
}
startSilentUpdate(update_info.now_url); //开始静默更新
return reolve({
msg: ""
})
}
//判断当前版本是不是点击过暂不更新
let update_ignore_version = uni.getStorageSync("update_ignore") || "0.0.0";
console.log("强制更新", update_info.force);
if (type === 0 && update_ignore_version == update_info.version && update_info.force ===
0) {
console.log("之前取消过这个版本,就不再提示了");
return reolve({
msg: ''
})
}
let err_update_version = uni.getStorageSync(ERR_UPDATE_VERSION) || "0.0.0";
if (err_update_version == update_info.version) {
console.log("这个版本之前更新报过错,所以不再进行更新了,再更改其他版本号的时候再进行更新 ");
return reolve({
msg: ''
})
}
//弹出更新
uni.navigateTo({
url: "/pages/app-update/app-update?updata_info=" + JSON.stringify(
update_info),
animationType: "fade-in"
})
})
}
//开始静默更新
function startSilentUpdate(url) {
let options = {
method: "get"
};
console.log("开始静默更新", url);
let dtask = plus.downloader.createDownload(url, options);
dtask.addEventListener("statechanged", function(task, status) {
if (status === null) {} else if (status == 200) {
//在这里打印会不停的执行,请注意,正式上线切记不要在这里打印东西///////////////////////////////////////////////////
switch (task.state) {
case 4:
console.log("下载结束", task.filename);
installWgt(task.filename); // 安装
break;
}
}
});
dtask.start();
}
// 安装文件
function installWgt(path) {
plus.runtime.install(path);
}
\ No newline at end of file
/**
* 接口列表文件
* @param {String} method 默认是GET GET请求不用写,POST 请求写上POST
* @param {Boolean} noSetContentType - 默认ContentType是“application/json” 如果接口不需要设置这个,这个值设置true会在请求前去掉ContentType
* @param {String} value - 搜索的关键字
*/
export default {
/** 公共 ↓ **/
main: {
banner_list: {
url: "/roke/pub/get_banner_list",
method: "POST",
// desc: '首页轮播图数据'
},
roke_get_mobile_order: {
url: "/roke/get_mobile_order",
method: "POST",
// desc: '一码多用'
},
},
wx: {
// 获取微信注册码
wx_information: {
url: "/roke/get/wx/information",
method: "POST",
},
//获取微信openid、access_token
wx_code_get_openid: {
url: "/roke/mes/wx_code_get_openid",
method: "POST",
},
},
/** 售后 ↓ **/
sh: {
// 获取设备信息
mix_barcode_get_device: {
url: "/roke/mix_barcode_get_device",
method: "POST",
},
// 创建售后工单
mix_create_aso: {
url: "/roke/mix_create_aso",
method: "POST",
},
// 获取售后工单列表
mix_get_aso_list: {
url: "/roke/mix_get_aso_list",
method: "POST",
},
// 获取售后工单列表
mix_get_aso_detail: {
url: "/roke/mix_get_aso_detail",
method: "POST",
},
// 获取售后工单列表
submit_evaluation: {
url: "/roke/mix_aso_submit_evaluation",
method: "POST",
}
},
};
\ No newline at end of file
import http from "@/rokeTools/request/index.js";
// success 每次请求成功的返回值, callback 全部请求完成的返回
// const urlObjs = [{url_tag:'',data:{type_code:''}}];
/*
* test1,请求方法使用示例,用法参考
* success单条请求成功返回数据,请求失败不返回
* callback 全部请求完成发挥数据,包括错误请求
* */
export function test1() {
console.log('1111')
let urlObjs = [{
url_tag: 'report.get_process_category',
data: {}
}, {
url_tag: "report.get_work_center_list",
data: {}
}];
let max = 5;
batchFetchQueue(urlObjs, max, (results) => {
//所有请求结束再返回数据
console.log(JSON.stringify(results));
}, (requestData) => {
//每次请求成功的数据都立即返回
console.log(JSON.stringify(requestData));
})
}
// 参数格式
//
/*
* max 最大并发条数,
* success单条请求成功返回数据,请求失败不返回
* callback 全部请求完成返回数据,包括错误请求
* */
export function batchFetchQueue(urlObjs, max, callback, success) {
console.log(JSON.stringify(urlObjs));
const urlCount = urlObjs.length;
if (max > urlObjs.length) {
max = urlObjs.length;
}
const requestsQueue = [];
const results = [];
let i = 0;
const handleRequest = (urlObj) => {
const req = fetch(urlObj).then(requestData => {
requestData['url_tag'] = urlObj.url_tag;
requestData['obj'] = urlObj.data;
'function' === typeof success && success(requestData);
const len = results.push(requestData);
if (len < urlCount && i + 1 < urlCount) {
requestsQueue.shift();
handleRequest(urlObjs[++i]);
} else if (len === urlCount) {
'function' === typeof callback && callback(results)
}
}).catch(err => {
err['url'] = urlObj.url;
err['obj'] = urlObj.obj;
results.push(err);
if (results.length < urlCount && i + 1 < urlCount) {
requestsQueue.shift();
handleRequest(urlObjs[++i]);
} else if (results.length === urlCount) {
'function' === typeof callback && callback(results)
}
});
if (requestsQueue.push(req) < max) {
if (i + 1 < urlCount) {
handleRequest(urlObjs[++i]);
}
}
};
handleRequest(urlObjs[i])
}
const fetch = function(urlObj) {
return new Promise(resolve => {
let url_tag = urlObj.url_tag;
let data = urlObj.data;
if (!data) {
data = {};
}
http(url_tag, data).then((requestData) => {
resolve(requestData);
}).catch((err) => {
resolve(err);
})
})
}
\ No newline at end of file
import Request from './request'
import apiList from './apis.js'
import store from '@/rokeTools/store/index.js'
import {
CLIENT_URL_KEY,
SESSION_ID_KEY
} from '../../env.js';
/*
网络请求工具,使用参考,App的版本判断中已使用
this.$http('login.mobile_app_version').then(data => {
if (data.state == 'success') {
} else {
}
}).catch((err) => {
});
*/
const rokeRequest = new Request();
export default function http(
url,
data = {},
toastBefore = '', // 请求前加载提示
toastAfter = false, // 请求后错误提示
) {
let api = getApiPath(url);
/* 请求之前拦截器 */
rokeRequest.interceptor.request((config, cancel) => {
// let token = uni.getStorageSync('token');
// if (api.auth && !token) {
// store.dispatch('showAuthModal');
// uni.hideLoading()
// throw (`暂未登录,已阻止此次API请求: '${api.url}'`);
// }
// token && rokeRequest.setConfig(config => {
// config.header.token = token
// })
//设置baseUrl
rokeRequest.setConfig(config_this => {
if (api.noSetContentType) {
//有些接口使用'Content-Type': 'application/json',请求会报错,根据api返回信息清除
config_this.header['Content-Type'] = "";
}
let baseUrl = uni.getStorageSync(CLIENT_URL_KEY);
// let baseUrl = "http://58.56.9.105:8011"
let xSessionId = uni.getStorageSync(SESSION_ID_KEY);
config_this.baseUrl = baseUrl;
config_this.header['x-session-id'] = xSessionId;
})
if (toastBefore !== '') {
uni.showLoading({
title: toastBefore,
mask: true
});
}
return config
});
/* 请求之后拦截器 */
rokeRequest.interceptor.response((response) => {
uni.hideLoading();
if (response.code === 0) {
if (toastAfter) {
uni.showToast({
title: response.msg || '请求出错,稍后重试',
icon: 'none',
duration: 1000,
mask: true
});
}
}
// token过期注销
if (response.code === 401) {
// store.dispatch('logout');
// store.dispatch('showAuthModal');
// throw (`登录已过期或注销,已阻止此次API请求: '${api.url}'`);
}
return response
})
// console.log(JSON.stringify(api));
return rokeRequest.request({
url: api.url,
data,
method: api.method
})
}
// 组装接口路径
function getApiPath(url) {
let apiArray = url.split(".");
let api = apiList;
apiArray.forEach(v => {
api = api[v];
});
return api;
}
\ No newline at end of file
/**
* Request:请求封装
* @property {Object} config = 私有属性,默认值
* @property {Function} isUrl = 私有方法,url是否完整
* @property {Function} requestBefore = 私有方法,请求前
* @property {Function} requestAfter = 私有方法,请求后
*/
import {} from '@/env'
import platform from '@/rokeTools/platform/index';
import _ from 'lodash';
export default class Request {
constructor() {
// 默认配置
this.configDefault = {
baseUrl: '',
header: {
'Content-Type': 'application/json',
'platform': platform.get()
},
data: {},
params: {},
method: 'GET',
dataType: 'json',
// #ifndef MP-ALIPAY || APP-PLUS
responseType: 'text',
// #endif
custom: {},
// #ifdef APP-PLUS
sslVerify: false
// #endif
}
this.config = JSON.parse(JSON.stringify(this.configDefault));
/* 拦截器 */
this.interceptor = {
request: cb => {
if (cb) {
this.requestBefore = cb
} else {
this.requestBefore = request => request
}
},
response: (cb) => {
if (cb) {
this.requestAfter = cb
} else {
this.requestAfter = response => response
}
}
}
}
/* 判断url是否完整 */
static isUrl(url) {
return /(http|https):\/\/([\w.]+\/?)\S*/.test(url)
}
static addQueryString(params) {
let paramsData = ''
Object.keys(params).forEach(key => {
paramsData += key + '=' + encodeURIComponent(params[key]) + '&'
})
return paramsData.substring(0, paramsData.length - 1)
}
/* 请求前 */
static requestBefore(config) {
return config
}
/* 请求后 */
static requestAfter(response) {
return response
}
/*设置全局配置*/
setConfig(func) {
this.config = JSON.parse(JSON.stringify(this.configDefault));
return func(this.config)
}
/**
* @Function
* @param {Object} options - 请求配置项
* @prop {String} options.url - 请求路径
* @prop {Object} options.data - 请求参数
* @prop {Object} [options.responseType = config.responseType] [text|arraybuffer] - 响应的数据类型
* @prop {Object} [options.dataType = config.dataType] - 如果设为 json,会尝试对返回的数据做一次 JSON.parse
* @prop {Object} [options.header = config.header] - 请求header
* @prop {Object} [options.method = config.method] - 请求方法
* @returns {Promise<unknown>}
*/
async request(options = {}) {
let opt = this.requestBefore(options)
options = _.merge(this.config, opt);
return new Promise((resolve, reject) => {
let mergeUrl = Request.isUrl(options.url) ? options.url : (options.baseUrl + options.url)
if (JSON.stringify(options.params) !== '{}') {
let query = Request.addQueryString(options.params);
mergeUrl += mergeUrl.indexOf('?') === -1 ? `?${query}` : `&${query}`
}
options.url = mergeUrl;
// console.log(JSON.stringify(options));
options.success = res => {
resolve(this.requestAfter(res.data))
}
options.fail = err => {
reject(this.requestAfter(err))
}
uni.request(options)
})
}
get(url, options = {}) {
return this.request({
url,
method: 'GET',
...options
})
}
post(url, data, options = {}) {
return this.request({
url,
data,
method: 'POST',
...options
})
}
}
\ No newline at end of file
export default {
/**
* 本地中文搜索
* @param {String} key - 姓名
* @param {Array} data - 搜索的原数据
* @param {String} value - 搜索的关键字
*/
searchWithChinese(data,key,value,callBack) {
var value = value;
var sel = [];
// 设置防抖
let timeout;
if (data.length<1){
uni.showToast({
title: '当前没有可搜索的数据',
icon: 'none'
})
callBack([],false);
return;
}
uni.showLoading({
title: '搜索中...'
})
timeout && clearTimeout(timeout);
timeout = setTimeout((res) => {
for (var i = 0; i < data.length; i++) {
if (data[i][key].name.indexOf(value) != -1) {
data[i]['parent_key'] = data[i]['key'];
sel.push(data[i])
}
}
callBack(sel,true);
}, 1000)
}
}
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
import user from './modules/user.js'
import nightMode from './modules/nightMode.js'
import screenAdaptation from './modules/screenAdaptation.js'
import bgbgTwoDimensional from './modules/bgbgTwoDimensional.js'
import formReport from './modules/formReport.js'
import tabBarManager from './modules/tabBarManager.js'
import scanMode from './modules/scanModule/scanMode.js'
const store = new Vuex.Store({
modules: {
user,
tabBarManager,
nightMode,
screenAdaptation,
bgbgTwoDimensional,
scanMode,
}
})
export default store
\ No newline at end of file
import Bus from '@/rokeTools/bus/bus.js'
const state = {
blockSelectShow: false, //输入框展示
blockSelectTitle: '', //选择器标题
orderList: [],
typeList: [],
}
const getters = {
blockSelectShow: state => {
return state.blockSelectShow;
},
blockSelectTitle: state => {
return state.blockSelectTitle;
},
}
const actions = {
//检测是否是引流版并保存数据
showBlockSelectAction({
commit,
dispatch,
getters,
state
}, option = null) {
commit('SHOWBLOCKSELECT', option)
},
confirmTextArea({
commit,
dispatch,
getters,
state
}, option = null) {
commit('COMFIRMS', option)
},
closeTextArea({
commit,
dispatch,
getters,
state
}) {
commit('CLOSETEXTAREA', false)
}
}
const mutations = {
// let option = {
// minDate: this.props.minDate,
// maxDate:this.props.maxDate,
// value: this.props.value,
// tag:this.props.tag,
// }
SHOWBLOCKSELECT(state, option) {
state.blockSelectTitle = ''; //
state.textAreaValue = '';
state.textAreaTitle = '';
if (option) {
state.blockSelectTitle = option.blockSelectTitle;
state.textAreaValue = option.textAreaValue;
state.textAreaTitle = option.textAreaTitle;
}
state.blockSelectShow = true;
},
COMFIRMS(state, option) {
if (option) {
// Bus.$emit(state.textAreaTag, option);
}
state.textAreaShow = false;
},
CLOSETEXTAREA(state, isShow) {
state.textAreaShow = false;
}
}
export default {
state,
mutations,
actions,
getters
}
\ No newline at end of file
import Bus from '@/rokeTools/bus/bus.js'
const state = {
calendarShow: false, //日历展示
datetimePickerShow: false, //带时间的轮式日期显示
tag: '', //
minDate: 0,
maxDate: 0,
valueStart: '',
valueEnd: '',
mode: 'single',
title: '',
}
const getters = {
calendarShow: state => {
return state.calendarShow;
},
datetimePickerShow: state => {
return state.datetimePickerShow;
},
datetimeShow: state => {
return state.datetimeShow;
},
tag: state => {
return state.tag;
},
minDate: state => {
return state.minDate;
},
maxDate: state => {
return state.maxDate;
},
valueStart: state => {
return state.valueStart;
},
valueEnd: state => {
return state.valueEnd;
},
mode: state => {
return state.mode;
},
title: state => {
return state.title;
}
}
const actions = {
//检测是否是引流版并保存数据
showCalendar({
commit,
dispatch,
getters,
state
}, option = null) {
commit('SHOW_CALENDAR', option)
},
showDatetimePicker({
commit,
dispatch,
getters,
state
}, option = null) {
commit('SHOW_PICKER', option)
},
dateSelect({
commit,
dispatch,
getters,
state
}, option = null) {
commit('DATE_SELECT', option)
},
closeCalendar({
commit,
dispatch,
getters,
state
}) {
commit('CLOSE_CALENDAR', false)
}
}
const mutations = {
// let option = {
// minDate: this.props.minDate,
// maxDate:this.props.maxDate,
// value: this.props.value,
// tag:this.props.tag,
// }
SHOW_CALENDAR(state, option) {
state.minDate = 0;
state.maxDate = 0;
state.valueStart = '';
state.valueEnd = '';
state.title = '';
if (option) {
state.minDate = option.minDate;
state.maxDate = option.maxDate;
state.valueStart = option.valueStart;
state.valueEnd = option.valueEnd;
state.tag = option.tag;
state.mode = option.mode;
state.title = option.title;
}
if (!state.minDate) {
//如果没有给最小值,就默认取今天以前一年的时间为最小值
const d = new Date()
const year = d.getFullYear()
// year 此处手动减一年,筛选选择日期前置一年时间
const year22 = d.getFullYear() - 1
let month = d.getMonth() + 1
month = month < 10 ? `0${month}` : month
let date = d.getDate()
date = date < 10 ? `0${date}` : date
state.minDate = `${year22}-${month}-${date}` //当前时间 year 此处手动减一年
}
console.log(state.minDate + '-----option--------');
state.datetimePickerShow = false;
state.calendarShow = true;
},
SHOW_PICKER(state, option) {
state.minDate = 0;
state.maxDate = 0;
state.valueStart = '';
state.valueEnd = '';
state.title = '';
if (option) {
state.minDate = option.minDate;
state.maxDate = option.maxDate;
state.valueStart = option.valueStart;
state.valueEnd = option.valueEnd;
state.tag = option.tag;
state.mode = option.mode;
state.title = option.title;
}
state.calendarShow = false;
state.datetimePickerShow = true;
},
DATE_SELECT(state, option) {
if (option) {
Bus.$emit(state.tag, option);
}
state.calendarShow = false;
state.datetimePickerShow = false;
},
CLOSE_CALENDAR(state, isShow) {
state.calendarShow = false;
state.datetimePickerShow = false;
}
}
export default {
state,
mutations,
actions,
getters
}
\ No newline at end of file
import Bus from '@/rokeTools/bus/bus.js'
const state = {
textAreaShow: false, //输入框展示
textAreaTag: '', //
textAreaValue: '',
textAreaTitle: '',
}
const getters = {
textAreaShow: state => {
return state.textAreaShow;
},
textAreaTag: state => {
return state.textAreaTag;
},
textAreaValue: state => {
return state.textAreaValue;
},
textAreaTitle: state => {
return state.textAreaTitle;
},
}
const actions = {
//检测是否是引流版并保存数据
showTextArea({
commit,
dispatch,
getters,
state
}, option = null) {
commit('SHOWTEXTAREA', option)
},
confirmTextArea({
commit,
dispatch,
getters,
state
}, option = null) {
commit('COMFIRM', option)
},
closeTextArea({
commit,
dispatch,
getters,
state
}) {
commit('CLOSETEXTAREA', false)
}
}
const mutations = {
// let option = {
// minDate: this.props.minDate,
// maxDate:this.props.maxDate,
// value: this.props.value,
// tag:this.props.tag,
// }
SHOWTEXTAREA(state, option) {
state.textAreaTag = ''; //
state.textAreaValue = '';
state.textAreaTitle = '';
if (option) {
state.textAreaTag = option.textAreaTag;
state.textAreaValue = option.textAreaValue;
state.textAreaTitle = option.textAreaTitle;
}
state.textAreaShow = true;
},
COMFIRM(state, option) {
if (option) {
Bus.$emit(state.textAreaTag, option);
}
state.textAreaShow = false;
},
CLOSETEXTAREA(state, isShow) {
state.textAreaShow = false;
}
}
export default {
state,
mutations,
actions,
getters
}
\ No newline at end of file
const state = {
isAux: false,
}
const getters = {
isAux: state => state.isAux,
}
const actions = {
// initScreenAdaptation
showAux({
commit,
dispatch,
getters,
state
}) {
uni.request({
url: uni.getStorageSync('client_url') + "/roke/get_auxiliary_is_installed",
method: "post",
header: {
'Content-Type': 'application/json',
'x-session-id': uni.getStorageSync("session_id"),
},
data: {},
success: (res) => {
console.log(res)
commit('aux', res.data.result.state);
},
fail: (res) => {
commit('aux',false);
}
})
}
}
const mutations = {
aux(state, auxshow) {
state.isAux = auxshow;
}
}
export default {
state,
mutations,
actions,
getters
}
\ No newline at end of file
const state = {
}
const getters = {
}
const actions = {
// initScreenAdaptation
initScreenAdaptation({
commit,
dispatch,
getters,
state
}) {
uni.getSystemInfo({
success: (res) => {
// 可使用窗口高度,将px转换rpx
}
});
}
}
const mutations = {
phoneHeight(state, screenHeightRpx) {
}
}
export default {
state,
mutations,
actions,
getters
}
\ No newline at end of file
import Vue from 'vue'
import Vuex from 'vuex'
const state = {
team: "",
}
const mutations = {
updateTeam(state, team) {
state.team = team;
}
}
const actions = {
}
const getters = {
}
export default {
state,
mutations,
actions,
getters
}
\ No newline at end of file
import Vue from 'vue'
import Vuex from 'vuex'
const state = {
curThemeType: 'light',
}
const mutations = {
}
const actions = {
handleActionAgree({
commit
}, boo) {
commit('handleAgree', boo);
},
setCurThemeType({
commit,
dispatch,
getters,
state
}, data) {
//设置主题是给原生tabBar设置主题
dispatch('tabBarChangeTheme', data)
state.curThemeType = data;
},
//原生tabBar主题不刷新,进入到首页再刷新一次
updateTabBarTheme({
dispatch,
state
}) {
//设置主题是给原生tabBar设置主题
dispatch('tabBarChangeTheme', state.curThemeType);
},
}
const getters = {
themeType(
state
) {
return state.curThemeType;
}
}
export default {
state,
mutations,
actions,
getters
}
\ No newline at end of file
import Vue from 'vue'
import Vuex from 'vuex'
const state = {
tab_ids: [{
"name": "工艺路线",
"index": "roke.routing",
"function_id": 13,
"general_order": true,
"icon": "../../static/roke.routing.png",
"default": false,
"custom_report": false,
"report_url": "",
"table": false
},
{
"name": "生产订单",
"index": "roke.production.order",
"function_id": 16,
"general_order": true,
"icon": "../../static/roke.production.order.png",
"default": false,
"custom_report": false,
"report_url": "",
"table": false
},
{
"name": "生产任务",
"index": "roke.production.task",
"function_id": 17,
"general_order": true,
"icon": "../../static/roke.production.task.png",
"default": false,
"custom_report": false,
"report_url": "",
"table": false
},
{
"name": "文档管理",
"index": "wendangguanli",
"function_id": 38,
"general_order": false,
"icon": "../../static/wendangguanli.png",
"default": false,
"custom_report": false,
"report_url": "",
"table": false
},
{
"name": "仓库调拨单",
"index": "roke.mes.stock.picking",
"function_id": 56,
"general_order": true,
"icon": "../../static/roke.mes.stock.picking.png",
"default": false,
"custom_report": false,
"report_url": "",
"table": false
},
{
"name": "采购订单",
"index": "roke.purchase.order",
"function_id": 57,
"general_order": true,
"icon": "../../static/roke.purchase.order.png",
"default": false,
"custom_report": false,
"report_url": "",
"table": false
},
{
"name": "销售订单",
"index": "roke.sale.order",
"function_id": 58,
"general_order": true,
"icon": "../../static/roke.sale.order.png",
"default": false,
"custom_report": false,
"report_url": "",
"table": false
},
{
"name": "设备运行记录",
"index": "roke.mes.equipemnt.record",
"function_id": 61,
"general_order": true,
"icon": "../../static/roke.mes.equipemnt.record.png",
"default": false,
"custom_report": false,
"report_url": "",
"table": false
},
{
"name": "条码打包",
"index": "roke.barcode.package",
"function_id": 87,
"general_order": true,
"icon": "../../static/roke.barcode.package.png",
"default": false,
"custom_report": false,
"report_url": "",
"table": false
},
{
"name": "文档管理",
"index": "wendangguanli",
"function_id": 38,
"general_order": false,
"icon": "../../static/wendangguanli.png",
"default": false,
"custom_report": false,
"report_url": "",
"table": false
},
{
"name": "仓库调拨单",
"index": "roke.mes.stock.picking",
"function_id": 56,
"general_order": true,
"icon": "../../static/roke.mes.stock.picking.png",
"default": false,
"custom_report": false,
"report_url": "",
"table": false
},
{
"name": "采购订单",
"index": "roke.purchase.order",
"function_id": 57,
"general_order": true,
"icon": "../../static/roke.purchase.order.png",
"default": false,
"custom_report": false,
"report_url": "",
"table": false
},
{
"name": "销售订单",
"index": "roke.sale.order",
"function_id": 58,
"general_order": true,
"icon": "../../static/roke.sale.order.png",
"default": false,
"custom_report": false,
"report_url": "",
"table": false
},
],
showTab: false,
}
const mutations = {
SHOW_TAB(state, tab_ids) {
if (tab_ids && tab_ids.length > 0) {
state.tab_ids = tab_ids;
state.showTab = true;
} else {
state.showTab = false;
}
},
OFF_TAB(state) {
state.showTab = false;
state.tab_ids = [];
}
}
const actions = {
scanShowTab({
commit,
dispatch,
getters,
state
}, tab_ids = []) {
commit('SHOW_TAB', tab_ids);
},
offTab({
commit,
}) {
commit('OFF_TAB');
}
}
const getters = {
tab_ids: state => state.tab_ids,
showTab: state => state.showTab,
}
export default {
state,
mutations,
actions,
getters
}
\ No newline at end of file
/*
使用参考,可以从 用计算属性直接导出
import {
mapGetters
} from "vuex";
export default {
components: {
},
data() {
return {
};
},
computed: {
...mapGetters(['screenHeightRpx', 'naviStatusHeightRpx']),
scrollViewHeight() {
return this.screenHeightRpx - this.naviStatusHeightRpx - 192 - 104;
}
},
*/
const state = {
//上面试rpx为单位的数据
statusBarHeightRpx: 0, //电池栏高度
screenHeightRpx: 0, //屏幕总高度
windowHeightRpx: 0, //屏幕可用高度(会自动去除系统tabbar的高度);
screenWidthRpx: 750, //屏幕宽度
naviBarHeightRpx: 0, //不含电池栏的高度
naviStatusHeightRpx: 0, //导航栏加电池栏的高度
tabBarHeightRpx: 130, //标准自定义tabBar高度,
customTabBarHeightRpx: 0, //自定义tabBar 高度,
//下面是px为单位的数据
customTabBarHeight: 60, //自定义tabBar 高度,
windowWidth: 0,
windowHeight: 0,
screenHeight: 0,
statusBarHeight: 0,
naviBarHeight: 0,
naviStatusHeight: 0,
//px转rpx的系数
rpxRatio: 0, //(750 / res.windowWidth)
isLiuHai: false,
isIos: false,
isAndroid: false,
safeAreaInsets: { //如果需要适配横屏,只能用getters方法动态计算,因为每个页面的安全距离不同
"top": 20,
"right": 0,
"bottom": 10,
"left": 0
}
}
const getters = {
screenHeightRpx: state => state.screenHeightRpx,
windowHeightRpx: state => state.windowHeightRpx,
statusBarHeightRpx: state => state.statusBarHeightRpx,
naviBarHeightRpx: state => state.naviBarHeightRpx,
naviStatusHeightRpx: state => state.naviStatusHeightRpx,
screenWidthRpx: state => state.screenWidthRpx,
tabBarHeightRpx: state => state.tabBarHeightRpx,
windowWidth: state => state.windowWidth,
windowHeight: state => state.windowHeight,
screenHeight: state => state.screenHeight,
statusBarHeight: state => state.statusBarHeight,
naviBarHeight: state => state.naviBarHeight,
naviStatusHeight: state => state.naviStatusHeight,
rpxRatio: state => state.rpxRatio,
isLiuHai: state => state.isLiuHai,
isIos: state => state.isIos,
isAndroid: state => state.isAndroid,
customTabBarHeightRpx: state => state.customTabBarHeightRpx,
//下面是px为单位的数据
customTabBarHeight: state => state.customTabBarHeight,
safeAreaInsets: (state) => {
let res = uni.getSystemInfoSync();
state.safeAreaInsets = res.safeAreaInsets;
return res.safeAreaInsets;
}
}
const actions = {
// initScreenAdaptation
initScreenAdaptation({
commit,
dispatch,
getters,
state
}) {
uni.getSystemInfo({
success: (res) => {
// 可使用窗口高度,将px转换rpx
let x = (750 / res.windowWidth);
let windowHeightRpx = (res.windowHeight * x);
let screenHeightRpx = (res.screenHeight * x);
commit('phoneHeight', screenHeightRpx);
commit('windowHeight', windowHeightRpx);
let statusBarHeight = res.statusBarHeight || 0;
let statusBarHeightRpx = res.statusBarHeight * x;
commit('changeStatusBarHeight', statusBarHeightRpx);
let naviBarHeight = 44;
let isLiuHai = false;
if (res.platform == 'android') {
naviBarHeight = 48;
} else if (res.platform == 'ios') {
if (statusBarHeight > 30) {
isLiuHai = true;
}
}
let naviBarHeightRpx = naviBarHeight * x;
commit('changeNavigationBarHeightRpx', naviBarHeightRpx);
commit('changeNaviStatusHeightRpx', naviBarHeightRpx + statusBarHeightRpx);
//px为计量单位的数据
let obj = {
windowWidth: res.windowWidth,
windowHeight: res.windowHeight,
screenHeight: res.screenHeight,
statusBarHeight: statusBarHeight,
naviBarHeight: naviBarHeight,
naviStatusHeight: naviBarHeight + statusBarHeight,
rpxRatio: x,
isLiuHai: isLiuHai,
platform: res.platform,
}
commit('pxNumberUpdate', obj);
}
});
},
getSafeAreaInsets({
commit,
dispatch,
getters,
state
}) {
let safeAreaInsets = { //如果需要适配横屏,只能用getters方法动态计算,因为每个页面的安全距离不同
"top": 20,
"right": 0,
"bottom": 10,
"left": 0
};
let info = uni.getSystemInfoSync();
//在App中,uni.getSystemInfoSync() 不准
// #ifdef APP-PLUS
safeAreaInsets = plus.navigator.getSafeAreaInsets();
// #endif
// #ifndef APP-PLUS
safeAreaInsets = info.safeAreaInsets;
// #endif
let x = (750 / info.windowWidth);
//自定义tabBar 标准高度
let customTabBarHeight = 65;
let tabBarHeightRpx = 0;
//页面刚启动时 bottom 没有值,deviceBottom 有值
let bottom = safeAreaInsets?.deviceBottom ? safeAreaInsets.deviceBottom : safeAreaInsets.bottom;
if (bottom > 10) {
customTabBarHeight = customTabBarHeight + bottom - 10;
}
let customTabBarHeightRpx = customTabBarHeight * x;
let obj = {
safeAreaInsets: safeAreaInsets ? safeAreaInsets : { //如果需要适配横屏,只能用getters方法动态计算,因为每个页面的安全距离不同
"top": 20,
"right": 0,
"bottom": 10,
"left": 0
},
customTabBarHeight: customTabBarHeight,
customTabBarHeightRpx: customTabBarHeightRpx,
}
commit('changeSafeAreaInsets', obj);
dispatch('initCustomTabBar'); //初始化是否用自定义Tabar;
}
}
const mutations = {
phoneHeight(state, screenHeightRpx) {
state.screenHeightRpx = screenHeightRpx;
},
windowHeight(state, windowHeightRpx) {
state.windowHeightRpx = windowHeightRpx;
},
changeStatusBarHeight(state, statusBarHeight) {
state.statusBarHeightRpx = statusBarHeight;
},
changeNavigationBarHeightRpx(state, naviBarHeightRpx) {
// console.log(naviBarHeightRpx);
state.naviBarHeightRpx = naviBarHeightRpx;
},
changeNaviStatusHeightRpx(state, naviStatusHeightRpx) {
state.naviStatusHeightRpx = naviStatusHeightRpx;
},
pxNumberUpdate(state, obj) {
state.windowWidth = obj.windowWidth;
state.windowHeight = obj.windowHeight;
state.screenHeight = obj.screenHeight;
state.statusBarHeight = obj.statusBarHeight;
state.naviBarHeight = obj.naviBarHeight;
state.naviStatusHeight = obj.naviStatusHeight;
state.rpxRatio = obj.rpxRatio;
state.isLiuHai = obj.isLiuHai;
state.isIos = obj.platform === 'ios' ? true : false;
state.isAndroid = obj.platform === 'android' ? true : false;
},
changeSafeAreaInsets(state, obj) {
state.safeAreaInsets = obj.safeAreaInsets;
state.customTabBarHeight = obj.customTabBarHeight;
state.customTabBarHeightRpx = obj.customTabBarHeightRpx;
}
}
export default {
state,
mutations,
actions,
getters
}
\ No newline at end of file
import http from "@/rokeTools/request/index.js";
const state = {
isYinLiu: true, //是否是引流版
isCustomTabBar: false, //是否是自定义tabbar
messageCount: 0, //消息数量
}
const getters = {
isYinLiu: state => state.isYinLiu,
isCustomTabBar: state => state.isCustomTabBar,
messageCount: state => state.messageCount,
}
const actions = {
//否是引流版并保存数据
checkIsYinLiuAction({
commit,
dispatch,
getters,
state
}, isYinliu = false) {
commit('checkIsYinLiu', isYinliu);
dispatch('setTabBarItem', isYinliu);
},
//改变tabBar设置
setTabBarItem({
state
}, isYinliu = false) {
if (isYinliu) {
if (state.isCustomTabBar) {
uni.reLaunch({
url: '/pages/main/yl-main_home'
})
return;
}
///引流版初始化tabBar
uni.setTabBarItem({
index: 0,
visible: false,
})
uni.setTabBarItem({
index: 1,
visible: true,
success: function(res) {
uni.switchTab({
url: '/pages/main/yl-main_home'
})
}
})
uni.setTabBarItem({
index: 2,
visible: false,
})
} else {
if (state.isCustomTabBar) {
//自定义TabBar 不走下面tabBar
uni.reLaunch({
url: '/pages/main/main'
})
return;
}
// uni.$emit('setTabBarItem');
//普通版初始化tabBar
uni.setTabBarItem({
index: 0,
visible: true,
success: function(res) {
uni.switchTab({
url: '/pages/main/main'
})
}
})
uni.setTabBarItem({
index: 1,
visible: false,
})
uni.setTabBarItem({
index: 2,
visible: true,
})
}
},
initCustomTabBar({
state
}) {
//初始化屏幕数据的时候一块初始化了这个数据
let isCustomTabBar = true;
// #ifdef APP-PLUS
isCustomTabBar = false;
// #endif
// #ifdef H5
isCustomTabBar = true;
// #endif
state.isCustomTabBar = isCustomTabBar;
if (isCustomTabBar) {
//自定义tabBar需要隐藏原生tabBar
uni.hideTabBar();
}
},
// 获取消息未读数量
getcount({
state
}) {
http('roke_pub_get_unread_count').then(res => {
if (res.error) {} else {
if (res.result.state === 'success') {
// that.count = res.result.result
if (state.isCustomTabBar) {
if (res.result.result !== 0) {
uni.setTabBarBadge({
index: 3,
text: res.result.result
})
} else {
uni.removeTabBarBadge({
index: 3
})
}
}
state.messageCount = res.result.result
} else {}
}
}).catch((err) => {});
},
//更改主题时更改tabBar的颜色
tabBarChangeTheme({
state
}, theme = 'light') {
//原生tabBar才需要在这里切换主题
if (theme == 'dark') {
uni.setTabBarStyle({
color: '#fff',
selectedColor: "#1ca0c5",
backgroundColor: '#37393D',
});
} else {
uni.setTabBarStyle({
color: '#8f8f8f',
selectedColor: "#1ca0c5",
backgroundColor: '#ffffff',
});
}
}
}
const mutations = {
changeRejectUpdateIos(state, iosRejectUpdate) {
state.iosRejectUpdate = iosRejectUpdate;
},
changeRejectUpdateAndroid(state, androidRejectUpdate) {
state.androidRejectUpdate = androidRejectUpdate;
},
checkIsYinLiu(state, isYinliu) {
state.isYinLiu = isYinliu;
},
}
export default {
state,
mutations,
actions,
getters
}
\ No newline at end of file
import Bus from '@/rokeTools/bus/bus.js'
const state = {
titles: '',
show: false,
type: false, //有无类别
list: [],
sellist:[],
tags:'tag',
sel_data:''
}
const getters = {
show: state => {
return state.show;
},
titles: state => {
return state.titles;
},
type: state => {
return state.type;
},
list: state => {
return state.list;
},
tags: state => {
return state.tags;
},
sel_data: state => {
return state.sel_data;
},
sellist:state => {
return state.sellist;
},
}
const actions = {
//检测是否是引流版并保存数据
show({
commit,
dispatch,
getters,
state
}, option = null) {
commit('SHOW_', option)
},
list({
commit,
dispatch,
getters,
state
}, option = null) {
commit('List', option)
},
sellist({
commit,
dispatch,
getters,
state
}, option = null) {
commit('Sel', option)
},
type({
commit,
dispatch,
getters,
state
}, option = null) {
},
titles({
commit,
dispatch,
getters,
state
}, option = null) {
commit('Titles', option)
},
tags({
commit,
dispatch,
getters,
state
}, option = null) {
commit('Tag', option)
},
sel_data({
commit,
dispatch,
getters,
state
}, option = null) {
commit('Sel', option)
}
}
const mutations = {
SHOW_(state, option) {
state.show = option.flag;
},
List(state, option) {
state.list = option.list
},
Sel(state, option){
state.sellist = option.list
},
Titles(state, option){
state.titles=option.title
},
Tag(state, option){
state.tags=option.tag
},
Sel(state, option){
state.sel_data=option.data
}
}
export default {
state,
mutations,
actions,
getters
}
\ No newline at end of file
// 用户数据模块
// import http from '@/shopro/request/index'
// import store from '@/shopro/store'
// import tools from '@/shopro/utils/tools'
// import wechat from '@/shopro/wechat/wechat'
// import share from '@/shopro/share'
const state = {
iosRejectUpdate: true, //是否禁止更新检测
androidRejectUpdate: true, //是否禁止更新检测
}
const getters = {
iosRejectUpdate: state => {
let platform = uni.getSystemInfoSync().platform;
if (platform != 'ios') {
return false;
} else {
return state.iosRejectUpdate;
}
},
androidRejectUpdate: state => {
let platform = uni.getSystemInfoSync().platform;
if (platform != 'android') {
return false;
} else {
return state.androidRejectUpdate;
}
},
}
const actions = {
//
// setRejectUpdate({
// commit,
// dispatch,
// getters,
// state
// }, iosRejectUpdate = true) {
// commit('changeRejectUpdate', iosRejectUpdate);
// },
//检测是否是引流版并保存数据
}
const mutations = {
changeRejectUpdateIos(state, iosRejectUpdate) {
state.iosRejectUpdate = iosRejectUpdate;
},
changeRejectUpdateAndroid(state, androidRejectUpdate) {
state.androidRejectUpdate = androidRejectUpdate;
},
}
export default {
state,
mutations,
actions,
getters
}
\ No newline at end of file
const decodeStr = {
// 获取窗口尺寸
get_systemInfo(){
let system_obj = {}
uni.getSystemInfo({
success: (res) => {
// 获取设备系统 安卓、ios、window
system_obj.platform = res.platform
// 宽度和高度
system_obj.winSize = {
"width": res.windowWidth,
"height": res.windowHeight
}
// 可使用窗口高度,将px转换rpx
system_obj.phoneHeight = (res.windowHeight * (750 / res.windowWidth))
}
})
return system_obj
},
// 获取文件地址函数
getObjectURL(file) {
var url = null
if (window.createObjectURL !== undefined) { // basic
url = window.createObjectURL(file)
} else if (window.URL !== undefined) { // mozilla(firefox)
url = window.URL.createObjectURL(file)
} else if (window.webkitURL !== undefined) { // webkit or chrome
url = window.webkitURL.createObjectURL(file)
}
return url
},
// 解码,输出:中文
decodeStr(str) {
var out, i, len, c;
var char2, char3;
out = "";
len = str.length;
i = 0;
while (i < len) {
c = str.charCodeAt(i++);
switch (c >> 4) {
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
// 0xxxxxxx
out += str.charAt(i - 1);
break;
case 12:
case 13:
// 110x xxxx 10xx xxxx
char2 = str.charCodeAt(i++);
out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F));
break;
case 14:
// 1110 xxxx 10xx xxxx 10xx xxxx
char2 = str.charCodeAt(i++);
char3 = str.charCodeAt(i++);
out += String.fromCharCode(((c & 0x0F) << 12) |
((char2 & 0x3F) << 6) |
((char3 & 0x3F) << 0));
break;
}
}
return out;
},
};
export default decodeStr;
uni.addInterceptor({
returnValue (res) {
if (!(!!res && (typeof res === "object" || typeof res === "function") && typeof res.then === "function")) {
return res;
}
return new Promise((resolve, reject) => {
res.then((res) => res[0] ? reject(res[0]) : resolve(res[1]));
});
},
});
\ No newline at end of file
/**
* 这里是uni-app内置的常用样式变量
*
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
*
*/
/**
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
*
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
*/
/* 颜色变量 */
@import '@/uni_modules/uview-ui/theme.scss';
//主题色
$main-bg-color:#033D53;
/*light background*/
$light-bg-main: #f5f5f5;
$light-bg-gross: #fff;
$light-bg-menu: #f5f5f5;
/* dark background*/
$dark-bg-main: #19223a;
$dark-bg-gross:#1C1D1F ;
$dark-bg-menu: #2b3757;
// light font
$light-font-title: #666;
$light-font-gross: #666;
// dark font
$dark-font-title: rgba(255, 255, 255, 0.7);
$dark-font-gross: rgba(255, 255, 255, 1);
// light border
$light-border-divide: #dfdfdf;
// dark border
$dark-border-divide: #364364;
//login
$light-font-login: rgba(51, 51, 51, 1);
$light-button-login: #666;
$dark-font-login: rgba(251, 226, 201, 1);
$dark-buttonstart-login: rgba(255, 235, 214, 1);
$dark-button-loginend: rgba(226, 173, 122, 1);
/* 行为相关颜色 */
$uni-color-primary: #023b56;
$uni-color-success: #4cd964;
$uni-color-warning: #f0ad4e;
$uni-color-error: #dd524d;
/* 按钮相关颜色 */
$btn-bg-color-primary: #023b56;
$btn-default-btn-hover-color: #e4e5e6;//from按钮点击时的背景色-在用
$btn-default-btn-hover-opticty:0.3;//from按钮点击时的透明度-在用
/* 文字基本颜色 */
$uni-text-color:#333;//基本色
$uni-text-color-inverse:#fff;//反色
$uni-text-color-grey:#999;//辅助灰色,如加载更多的提示信息
$uni-text-color-placeholder: #808080;
$uni-text-color-disable:#c0c0c0;
/* 背景颜色 */
$uni-bg-color:#ffffff;
$uni-bg-color-grey:#f8f8f8;
$uni-bg-color-hover:#f1f1f1;//点击状态颜色
$uni-bg-color-mask:rgba(0, 0, 0, 0.4);//遮罩颜色
/* 边框颜色 */
$uni-border-color:#c8c7cc;
/* 尺寸变量 */
/* 按钮大小参数 */
$uni-btn-height:45px;
$uni-btn-width:680rpx;;
$uni-btn-radius:45px;
/* 文字尺寸 */
$uni-font-size-sm:12px;
$uni-font-size-base:14px;
$uni-font-size-lg:16;
/* 图片尺寸 */
$uni-img-size-sm:20px;
$uni-img-size-base:26px;
$uni-img-size-lg:40px;
/* Border Radius */
$uni-border-radius-sm: 2px;
$uni-border-radius-base: 3px;
$uni-border-radius-lg: 6px;
$uni-border-radius-circle: 50%;
/* 水平间距 */
$uni-spacing-row-sm: 5px;
$uni-spacing-row-base: 10px;
$uni-spacing-row-xs: 8px;
$uni-spacing-row-s: 12px;
$uni-spacing-row-m: 16px; //使用中
$uni-spacing-row-l: 24px;
/* 垂直间距 */
$uni-spacing-col-sm: 4px;
$uni-spacing-col-base: 8px;
$uni-spacing-col-lg: 12px;
/* 透明度 */
$uni-opacity-disabled: 0.3; // 组件禁用态的透明度
/* 文章场景相关 */
$uni-color-title: #2C405A; // 文章标题颜色
$uni-font-size-title:20px;
$uni-color-subtitle: #555555; // 二级标题颜色
$uni-font-size-subtitle:26px;
$uni-color-paragraph: #3F536E; // 文章段落颜色
$uni-font-size-paragraph:15px;
/* 主题预制 */
/* 文字 */
$uni-main-text-color: #333333; // 主要文字颜色
$uni-minor-text-color: #848484; // 次要文字颜色
$uni-describe-text-color: #adadad; // 描述文字颜色
$uni-disable-text-color: #cecece; // 禁用文字颜色
$uni-placeholder-text-color: #f7f7f7; // 占位文字颜色
/* 背景色 */
$uni-page-bg-color: #f0f1f3; // 页面背景色
$uni-list-bg-color: #ffffff; // 列表背景色
$uni-block-bg-color: #ffffff; // 区块背景色
/* 分割线 */
$uni-light-divider-color: #ebecee; // 浅色分割线颜色
$uni-dark-divider-color: #e1e2e4; // 深色分割线颜色
/* 叠加色 */
$uni-dark-divider-color: #d7d7d7; // 叠加色
/* 主题色 */
$uni-theme-one-color: #023b56; // 主题色1
$uni-theme-two-color: #86a2ad; // 主题色2
$uni-theme-three-color: #e0e8ea; // 主题色3
$uni-theme-four-color: #1ca0c5; //主题色4
/* 信息色 */
$uni-message-green-one: #37a195; // 信息色绿色1
$uni-message-green-two: #9fd2cd; // 信息色绿色2
$uni-message-green-three: #e7f3f3; // 信息色绿色3
$uni-message-orange-one: #b67677; // 信息色红色1
$uni-message-orange-two: #dcbcbf; // 信息色红色2
$uni-message-orange-three: #f7edee; // 信息色红色3
$uni-message-red-one: #ff5218; // 信息色橙色1
$uni-message-red-two: #ffac90; // 信息色橙色2
$uni-message-red-three: #feeae3; // 信息色橙色3
/* 扩展色 */
$uni-extend-yellow-one: #d1bd66; // 扩展色黄色1
$uni-extend-yellow-two: #e8dfb6; // 扩展色橙黄色2
$uni-extend-yellow-three: #f9f6ef; // 扩展色黄色3
$uni-extend-purple-one: #90688d; // 扩展色紫色1
$uni-extend-purple-two: #c9b6c9; // 扩展色紫色2
$uni-extend-purple-three: #f2edf1; // 扩展色紫色3
$uni-extend-water-one: #4f80bb; // 扩展色水色1
$uni-extend-water-two: #acc1de; // 扩展色水色2
$uni-extend-water-three: #e9f0f8; // 扩展色水色3
$uni-extend-crimson-one: #b67677; // 扩展色深红色1
$uni-extend-crimson-two: #dcbcbf; // 扩展色深红色2
$uni-extend-crimson-three: #f7edee; // 扩展色深红色3
$uni-extend-olive-one: #736c96; // 扩展色橄榄色1
$uni-extend-olive-two: #bbb8cb; // 扩展色橄榄色2
$uni-extend-olive-three: #eeedf2;
\ No newline at end of file
MIT License
Copyright (c) 2020 www.uviewui.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
\ No newline at end of file
<p align="center">
<img alt="logo" src="https://uviewui.com/common/logo.png" width="120" height="120" style="margin-bottom: 10px;">
</p>
<h3 align="center" style="margin: 30px 0 30px;font-weight: bold;font-size:40px;">uView 2.0</h3>
<h3 align="center">多平台快速开发的UI框架</h3>
[![stars](https://img.shields.io/github/stars/umicro/uView2.0?style=flat-square&logo=GitHub)](https://github.com/umicro/uView2.0)
[![forks](https://img.shields.io/github/forks/umicro/uView2.0?style=flat-square&logo=GitHub)](https://github.com/umicro/uView2.0)
[![issues](https://img.shields.io/github/issues/umicro/uView2.0?style=flat-square&logo=GitHub)](https://github.com/umicro/uView2.0/issues)
[![Website](https://img.shields.io/badge/uView-up-blue?style=flat-square)](https://uviewui.com)
[![release](https://img.shields.io/github/v/release/umicro/uView2.0?style=flat-square)](https://gitee.com/umicro/uView2.0/releases)
[![license](https://img.shields.io/github/license/umicro/uView2.0?style=flat-square)](https://en.wikipedia.org/wiki/MIT_License)
## 说明
uView UI,是[uni-app](https://uniapp.dcloud.io/)全面兼容nvue的uni-app生态框架,全面的组件和便捷的工具会让您信手拈来,如鱼得水
## [官方文档:https://uviewui.com](https://uviewui.com)
## 预览
您可以通过**微信**扫码,查看最佳的演示效果。
<br>
<br>
<img src="https://uviewui.com/common/weixin_mini_qrcode.png" width="220" height="220" >
## 链接
- [官方文档](https://www.uviewui.com/)
- [更新日志](https://www.uviewui.com/components/changelog.html)
- [升级指南](https://www.uviewui.com/components/changeGuide.html)
- [关于我们](https://www.uviewui.com/cooperation/about.html)
## 交流反馈
欢迎加入我们的QQ群交流反馈:[点此跳转](https://www.uviewui.com/components/addQQGroup.html)
## 关于PR
> 我们非常乐意接受各位的优质PR,但在此之前我希望您了解uView2.0是一个需要兼容多个平台的(小程序、h5、ios app、android app)包括nvue页面、vue页面。
> 所以希望在您修复bug并提交之前尽可能的去这些平台测试一下兼容性。最好能携带测试截图以方便审核。非常感谢!
## 安装
#### **uni-app插件市场链接** —— [https://ext.dcloud.net.cn/plugin?id=1593](https://ext.dcloud.net.cn/plugin?id=1593)
请通过[官网安装文档](https://www.uviewui.com/components/install.html)了解更详细的内容
## 快速上手
请通过[快速上手](https://uviewui.com/components/quickstart.html)了解更详细的内容
## 使用方法
配置easycom规则后,自动按需引入,无需`import`组件,直接引用即可。
```html
<template>
<u-button text="按钮"></u-button>
</template>
```
## 版权信息
uView遵循[MIT](https://en.wikipedia.org/wiki/MIT_License)开源协议,意味着您无需支付任何费用,也无需授权,即可将uView应用到您的产品中。
###16330624-37d2-442d-8d3e-477b7bc5a8f0
\ No newline at end of file
<template>
<uvForm
ref="uForm"
:model="model"
:rules="rules"
:errorType="errorType"
:borderBottom="borderBottom"
:labelPosition="labelPosition"
:labelWidth="labelWidth"
:labelAlign="labelAlign"
:labelStyle="labelStyle"
:customStyle="customStyle"
>
<slot />
</uvForm>
</template>
<script> import aTNqDOt53c00b647e0d4c3b8475ebe82d757d7a from 'static/image/aTNqDOt53c00b647e0d4c3b8475ebe82d757d7a.png'
/**
* 此组件存在的理由是,在nvue下,u-form被uni-app官方占用了,u-form在nvue中相当于form组件
* 所以在nvue下,取名为u--form,内部其实还是u-form.vue,只不过做一层中转
*/
import uvForm from '../u-form/u-form.vue';
import props from '../u-form/props.js'
export default {
// #ifdef MP-WEIXIN
name: 'u-form',
// #endif
// #ifndef MP-WEIXIN
name: 'u--form',
// #endif
mixins: [uni.$u.mpMixin, props, uni.$u.mixin],
components: {
uvForm
},
created() {
this.children = []
},
methods: {flE(){},
// 手动设置校验的规则,如果规则中有函数的话,微信小程序中会过滤掉,所以只能手动调用设置规则
setRules(rules) {
this.$refs.uForm.setRules(rules)
},
validate() {
/**
* 在微信小程序中,通过this.$parent拿到的父组件是u--form,而不是其内嵌的u-form
* 导致在u-form组件中,拿不到对应的children数组,从而校验无效,所以这里每次调用u-form组件中的
* 对应方法的时候,在小程序中都先将u--form的children赋值给u-form中的children
*/
// #ifdef MP-WEIXIN
this.setMpData()
// #endif
return this.$refs.uForm.validate()
},
validateField(value, callback) {
// #ifdef MP-WEIXIN
this.setMpData()
// #endif
return this.$refs.uForm.validateField(value, callback)
},
resetFields() {
// #ifdef MP-WEIXIN
this.setMpData()
// #endif
return this.$refs.uForm.resetFields()
},
clearValidate(props) {
// #ifdef MP-WEIXIN
this.setMpData()
// #endif
return this.$refs.uForm.clearValidate(props)
},
setMpData() {
this.$refs.uForm.children = this.children
}
},
}
</script>
<template>
<uvImage
:src="src"
:mode="mode"
:width="width"
:height="height"
:shape="shape"
:radius="radius"
:lazyLoad="lazyLoad"
:showMenuByLongpress="showMenuByLongpress"
:loadingIcon="loadingIcon"
:errorIcon="errorIcon"
:showLoading="showLoading"
:showError="showError"
:fade="fade"
:webp="webp"
:duration="duration"
:bgColor="bgColor"
:customStyle="customStyle"
@click="$emit('click')"
@error="$emit('error')"
@load="$emit('load')"
>
<template v-slot:loading>
<slot name="loading"></slot>
</template>
<template v-slot:error>
<slot name="error"></slot>
</template>
</uvImage>
</template>
<script> import NXc8381e596afa4580917ec4b0cf4fb89f from 'static/image/NXc8381e596afa4580917ec4b0cf4fb89f.png'
/**
* 此组件存在的理由是,在nvue下,u-image被uni-app官方占用了,u-image在nvue中相当于image组件
* 所以在nvue下,取名为u--image,内部其实还是u-iamge.vue,只不过做一层中转
*/
import uvImage from '../u-image/u-image.vue';
import props from '../u-image/props.js';
export default {
name: 'u--image',
mixins: [uni.$u.mpMixin, props, uni.$u.mixin],
components: {
uvImage
},
}
</script>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
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