@ -1,29 +1,40 @@ |
|||
<script> |
|||
export default { |
|||
onLaunch: function() {}, |
|||
onShow: function() {}, |
|||
onHide: function() {}, |
|||
globalData: {} //全局变量 |
|||
} |
|||
import APPUpdate from "plugins/APPUpdate/index.js"; |
|||
export default { |
|||
onLaunch: function() { |
|||
console.log("》》》》", 11111111); |
|||
/* #ifdef APP-PLUS */ |
|||
APPUpdate(); |
|||
/* #endif */ |
|||
console.log("》》》》", 22222222222); |
|||
}, |
|||
onShow: function() {}, |
|||
onHide: function() {}, |
|||
globalData: {} //全局变量 |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
/*每个页面公共css */ |
|||
@import '@/uni_modules/uni-scss/index.scss'; |
|||
/*每个页面公共css */ |
|||
@import '@/uni_modules/uni-scss/index.scss'; |
|||
|
|||
/* #ifndef APP-NVUE */ |
|||
@import '@/static/customicons.css'; |
|||
// 设置整个项目的背景色 |
|||
page { |
|||
background-color: #f5f5f5; |
|||
} |
|||
/* #endif */ |
|||
/* #ifndef APP-NVUE */ |
|||
@import '@/static/customicons.css'; |
|||
|
|||
@import '@/uni_modules/uview-ui/index.scss'; |
|||
@import '@/common/app.scss'; |
|||
.example-info { |
|||
font-size: 14px; |
|||
color: #333; |
|||
padding: 10px; |
|||
} |
|||
</style> |
|||
// 设置整个项目的背景色 |
|||
page { |
|||
height: 100%; |
|||
background-color: #f5f5f5; |
|||
} |
|||
|
|||
/* #endif */ |
|||
|
|||
@import '@/uni_modules/uview-ui/index.scss'; |
|||
@import '@/common/app.scss'; |
|||
|
|||
.example-info { |
|||
font-size: 14px; |
|||
color: #333; |
|||
padding: 10px; |
|||
} |
|||
</style> |
@ -0,0 +1,101 @@ |
|||
<template> |
|||
|
|||
<view class="user-item-content" @click="click"> |
|||
<view class="user-item-left"> |
|||
<image :src="src" style="width: 40rpx;height: 40rpx;" mode="aspectFit"></image> |
|||
<text class="user-item-textBlack">{{text}}</text> |
|||
</view> |
|||
<view class="user-item-right"> |
|||
<text class="user-item-textBlack2">{{notes}}</text> |
|||
<image class="user-item-right_img" src="../../static/baseIcon/zy.png"></image> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
props: { |
|||
src: { |
|||
type: String, |
|||
default: "" |
|||
}, |
|||
text: { |
|||
type: String, |
|||
default: "" |
|||
}, |
|||
notes: { |
|||
type: String, |
|||
default: "" |
|||
}, |
|||
clickId: { |
|||
type: String, |
|||
default: "0" |
|||
} |
|||
}, |
|||
data() { |
|||
return { |
|||
|
|||
}; |
|||
}, |
|||
methods: { |
|||
click() { |
|||
var clickId = this.$props.clickId; |
|||
this.$emit("click", clickId) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
.user-item-content { |
|||
width: 100%; |
|||
height: 120rpx; |
|||
display: flex; |
|||
flex-direction: row; |
|||
align-items: center; |
|||
padding-left: 40rpx; |
|||
justify-content: space-between; |
|||
border-bottom: 1px solid #f5f5f5; |
|||
box-sizing: border-box; |
|||
|
|||
.user-item-left { |
|||
display: flex; |
|||
flex-direction: row; |
|||
height: 89rpx; |
|||
align-items: center; |
|||
flex: 1; |
|||
box-sizing: border-box; |
|||
|
|||
.user-item-textBlack { |
|||
color: #333333; |
|||
margin-left: 15px; |
|||
font-size: 30rpx; |
|||
height: 89rpx; |
|||
line-height: 89rpx; |
|||
} |
|||
} |
|||
|
|||
.user-item-right { |
|||
display: flex; |
|||
flex-direction: row; |
|||
height: 89rpx; |
|||
align-items: center; |
|||
|
|||
.user-item-right_img { |
|||
width: 30rpx; |
|||
height: 30rpx; |
|||
margin-right: 35rpx; |
|||
} |
|||
|
|||
.user-item-textBlack2 { |
|||
color: #ccc; |
|||
font-size: 25rpx; |
|||
height: 89rpx; |
|||
line-height: 89rpx; |
|||
} |
|||
} |
|||
|
|||
} |
|||
</style> |
@ -1,141 +0,0 @@ |
|||
<template> |
|||
<view class="uni-section"> |
|||
<view class="uni-section-header" nvue> |
|||
<view v-if="type" class="uni-section__head"> |
|||
<view :class="type" class="uni-section__head-tag"/> |
|||
</view> |
|||
<view class="uni-section__content"> |
|||
<text :class="{'distraction':!subTitle}" :style="{color:color}" class="uni-section__content-title">{{ title }}</text> |
|||
<text v-if="subTitle" class="uni-section__content-sub">{{ subTitle }}</text> |
|||
</view> |
|||
</view> |
|||
<view :style="{padding: padding ? '10px' : ''}"> |
|||
<slot/> |
|||
</view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
|
|||
/** |
|||
* Section 标题栏 |
|||
* @description 标题栏 |
|||
* @property {String} type = [line|circle] 标题装饰类型 |
|||
* @value line 竖线 |
|||
* @value circle 圆形 |
|||
* @property {String} title 主标题 |
|||
* @property {String} subTitle 副标题 |
|||
*/ |
|||
|
|||
export default { |
|||
name: 'UniSection', |
|||
emits:['click'], |
|||
props: { |
|||
type: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
title: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
color:{ |
|||
type: String, |
|||
default: '#333' |
|||
}, |
|||
subTitle: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
padding: { |
|||
type: Boolean, |
|||
default: false |
|||
} |
|||
}, |
|||
data() { |
|||
return {} |
|||
}, |
|||
watch: { |
|||
title(newVal) { |
|||
if (uni.report && newVal !== '') { |
|||
uni.report('title', newVal) |
|||
} |
|||
} |
|||
}, |
|||
methods: { |
|||
onClick() { |
|||
this.$emit('click') |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
<style lang="scss" > |
|||
$uni-primary: #2979ff !default; |
|||
|
|||
.uni-section { |
|||
background-color: #fff; |
|||
// overflow: hidden; |
|||
margin-top: 10px; |
|||
padding-bottom: 1px; |
|||
} |
|||
.uni-section-header { |
|||
position: relative; |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
/* #endif */ |
|||
flex-direction: row; |
|||
align-items: center; |
|||
padding: 12px 10px; |
|||
// height: 50px; |
|||
font-weight: normal; |
|||
} |
|||
.uni-section__head { |
|||
flex-direction: row; |
|||
justify-content: center; |
|||
align-items: center; |
|||
margin-right: 10px; |
|||
} |
|||
|
|||
.line { |
|||
height: 12px; |
|||
background-color: $uni-primary; |
|||
border-radius: 10px; |
|||
width: 4px; |
|||
} |
|||
|
|||
.circle { |
|||
width: 8px; |
|||
height: 8px; |
|||
border-top-right-radius: 50px; |
|||
border-top-left-radius: 50px; |
|||
border-bottom-left-radius: 50px; |
|||
border-bottom-right-radius: 50px; |
|||
background-color: $uni-primary; |
|||
} |
|||
|
|||
.uni-section__content { |
|||
/* #ifndef APP-NVUE */ |
|||
display: flex; |
|||
/* #endif */ |
|||
flex-direction: column; |
|||
flex: 1; |
|||
color: #333; |
|||
} |
|||
|
|||
.uni-section__content-title { |
|||
font-size: 14px; |
|||
color: $uni-primary; |
|||
} |
|||
|
|||
.distraction { |
|||
flex-direction: row; |
|||
align-items: center; |
|||
} |
|||
|
|||
.uni-section__content-sub { |
|||
font-size: 12px; |
|||
color: #999; |
|||
line-height: 16px; |
|||
margin-top: 2px; |
|||
} |
|||
</style> |
@ -0,0 +1,220 @@ |
|||
<template> |
|||
<view class="content"> |
|||
|
|||
<view> |
|||
<view class="top_select"> |
|||
<text class="top_select_text">选择日期</text> |
|||
<uni-datetime-picker type="date" :clear-icon="false" v-model="queryParams.date" @change="dateChange" /> |
|||
</view> |
|||
|
|||
<view class="top_select" style="display: flex;"> |
|||
<text class="top_select_text">选择类型</text> |
|||
<uni-data-select style="flex-grow: 1;" v-model="queryParams.type" :localdata="range" |
|||
@change="typeChange"></uni-data-select> |
|||
</view> |
|||
|
|||
<view class="top_select_btn"> |
|||
|
|||
<button class="mini-btn" type="primary" size="mini" @click="doQuery()">查询</button> |
|||
|
|||
<button class="mini-btn" type="primary" size="mini" @click="doReset()">重置 </button> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
|
|||
<view style="margin-top: 20px;margin-left: 20px;"> |
|||
<text>当日数据</text> |
|||
<text style="margin-left: 10px;">{{newDate}}</text> |
|||
|
|||
</view> |
|||
|
|||
|
|||
<view style="margin-top: 15px;margin-left: 10px;margin-right: 10px;"> |
|||
<qiun-data-charts type="mix" :opts="opts" :chartData="chartData" /> |
|||
</view> |
|||
|
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
newDate: this.getDate(), |
|||
// 类型1.全部,2.常规商品3.烟草 |
|||
range: [{ |
|||
"value": 1, |
|||
"text": "全部", |
|||
}, |
|||
{ |
|||
"value": 2, |
|||
"text": "常规商品", |
|||
}, { |
|||
"value": 3, |
|||
"text": "烟草", |
|||
} |
|||
], |
|||
chartData: {}, |
|||
opts: { |
|||
color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", |
|||
"#ea7ccc" |
|||
], |
|||
padding: [15, 15, 0, 15], |
|||
enableScroll: false, |
|||
legend: {}, |
|||
xAxis: { |
|||
disableGrid: true, |
|||
title: "" |
|||
}, |
|||
yAxis: { |
|||
disabled: false, |
|||
disableGrid: false, |
|||
splitNumber: 5, |
|||
gridType: "dash", |
|||
dashLength: 4, |
|||
gridColor: "#CCCCCC", |
|||
padding: 10, |
|||
showTitle: true, |
|||
data: [{ |
|||
position: "left", |
|||
title: "折线" |
|||
}, |
|||
{ |
|||
position: "right", |
|||
min: 0, |
|||
max: 200, |
|||
title: "柱状图", |
|||
textAlign: "left" |
|||
} |
|||
] |
|||
}, |
|||
extra: { |
|||
mix: { |
|||
column: { |
|||
width: 20 |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
queryParams: { |
|||
customerSid: "", |
|||
date: "", |
|||
type: "", |
|||
} |
|||
}; |
|||
}, |
|||
onReady() { |
|||
this.getServerData(); |
|||
}, |
|||
methods: { |
|||
getDate() { |
|||
var tempDate = new Date() // 获取今天的日期 |
|||
tempDate.setDate(tempDate.getDate() - 1) // 今天的前N天的日期,N自定义 |
|||
var endDate = tempDate.getFullYear() + '-' + (tempDate.getMonth() + 1) + '-' + tempDate.getDate() |
|||
console.log(endDate) |
|||
return endDate |
|||
}, |
|||
dateChange(e) { |
|||
console.log('----dateChange事件:', e); |
|||
|
|||
}, |
|||
typeChange(e) { |
|||
console.log('e:', e); |
|||
this.queryParams.type = e |
|||
}, |
|||
doQuery() { |
|||
this.newDate = this.queryParams.date |
|||
this.getServerData(); |
|||
}, |
|||
doReset() { |
|||
this.queryParams = { |
|||
customerSid: "", |
|||
date: "", |
|||
type: "", |
|||
} |
|||
this.newDate = this.getDate() |
|||
this.getServerData(); |
|||
}, |
|||
getServerData() { |
|||
// var _this = this |
|||
// this.$api.getThresholdAnalysis(_this.queryParams).then((resp) => { |
|||
// // if (resp.success) { |
|||
// console.log('1111', resp.data) |
|||
// // const data = resp.data |
|||
// // _this.dataList = data.financialData |
|||
// // _this.listSalesChannelData = data.listSalesChannelData |
|||
// // _this.drawLine(data.financialAnalysisChartData) |
|||
// // this.tableLoading = false |
|||
// // } else { |
|||
// // // 根据resp.code进行异常情况处理 |
|||
// // _this.dataList = [] |
|||
// // _this.listSalesChannelData = [] |
|||
// } |
|||
// }).catch(e => { |
|||
// console.log('eeeee', e) |
|||
// _this.tableLoading = false |
|||
// }) |
|||
|
|||
setTimeout(() => { |
|||
//模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接 |
|||
let res = { |
|||
categories: ["2018", "2019", "2020", "2021", "2022", "2023"], |
|||
series: [{ |
|||
name: "柱1", |
|||
index: 1, |
|||
type: "column", |
|||
data: [40, { |
|||
"value": 30, |
|||
"color": "#f04864" |
|||
}, 55, 110, 24, 58] |
|||
}, |
|||
{ |
|||
name: "柱2", |
|||
index: 1, |
|||
type: "column", |
|||
data: [50, 20, 75, 60, 34, 38] |
|||
}, |
|||
{ |
|||
name: "折线", |
|||
type: "line", |
|||
color: "#2fc25b", |
|||
data: [120, 140, 105, 170, 95, 160] |
|||
} |
|||
] |
|||
}; |
|||
this.chartData = JSON.parse(JSON.stringify(res)); |
|||
}, 500); |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.content { |
|||
background: #fff; |
|||
padding-top: 10px; |
|||
} |
|||
|
|||
.top_select { |
|||
display: flex; |
|||
margin-left: 20px; |
|||
margin-right: 20px; |
|||
flex-direction: row; |
|||
margin-top: 10px; |
|||
align-items: center; |
|||
} |
|||
|
|||
.top_select_text { |
|||
margin-right: 10px; |
|||
} |
|||
|
|||
.top_select_btn { |
|||
display: flex; |
|||
margin-left: 20px; |
|||
margin-right: 20px; |
|||
flex-direction: row; |
|||
margin-top: 15px; |
|||
align-items: center; |
|||
} |
|||
</style> |
@ -0,0 +1,21 @@ |
|||
<template> |
|||
<view class="content"> |
|||
|
|||
|
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
|
|||
}; |
|||
}, |
|||
methods: {} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
|
|||
</style> |
@ -1,220 +1,151 @@ |
|||
<template> |
|||
<view class="content"> |
|||
<view class="page"> |
|||
|
|||
<view> |
|||
<view class="top_select"> |
|||
<text class="top_select_text">选择日期</text> |
|||
<uni-datetime-picker type="date" :clear-icon="false" v-model="queryParams.date" @change="dateChange" /> |
|||
</view> |
|||
|
|||
<view class="top_select" style="display: flex;"> |
|||
<text class="top_select_text">选择类型</text> |
|||
<uni-data-select style="flex-grow: 1;" v-model="queryParams.type" :localdata="range" |
|||
@change="typeChange"></uni-data-select> |
|||
</view> |
|||
<view class="top"> |
|||
|
|||
<view class="top_select_btn"> |
|||
<image class="img" src="https://jianguan.yyundong.com/img/uni.png" mode="aspectFit"></image> |
|||
|
|||
<button class="mini-btn" type="primary" size="mini" @click="doQuery()">查询</button> |
|||
<view class="top_right"> |
|||
|
|||
<button class="mini-btn" type="primary" size="mini" @click="doReset()">重置 </button> |
|||
<text class="top_right_text1">{{info.name}}</text> |
|||
<text class="top_right_text2">用户号:{{info.mobile}}</text> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
|
|||
<view style="margin-top: 20px;margin-left: 20px;"> |
|||
<text>当日数据</text> |
|||
<text style="margin-left: 10px;">{{newDate}}</text> |
|||
|
|||
<view class="user-item-bg"> |
|||
<UserItem src='https://jianguan.yyundong.com/img/user/wdxm.png' text="我的项目" @click="click" clickId="0"></UserItem> |
|||
</view> |
|||
|
|||
<view class="user-item-bg"> |
|||
<UserItem src='https://jianguan.yyundong.com/img/user/smxx.png' text="实名信息" notes="完善信息" @click="click" clickId="1"></UserItem> |
|||
|
|||
<view style="margin-top: 15px;margin-left: 10px;margin-right: 10px;"> |
|||
<qiun-data-charts type="mix" :opts="opts" :chartData="chartData" /> |
|||
</view> |
|||
|
|||
<view class="user-item-bg"> |
|||
<UserItem src='https://jianguan.yyundong.com/img/user/sz.png' text="设置" @click="click" clickId="2"></UserItem> |
|||
</view> |
|||
<!-- #ifdef APP-PLUS --> |
|||
<view class="user-item-bg"> |
|||
<!-- <UserItem src='https://jianguan.yyundong.com/img/user/zzjg.png' text="组织结构" @click="click" clickId="3"></UserItem> |
|||
<UserItem src='https://jianguan.yyundong.com/img/user/xmgl.png' text="项目管理" @click="click" clickId="4"></UserItem> |
|||
<UserItem src='https://jianguan.yyundong.com/img/user/ycgl.png' text="云仓管理" @click="click" clickId="5"></UserItem> |
|||
<UserItem src='https://jianguan.yyundong.com/img/user/xtgl.png' text="系统管理" @click="click" clickId="6"></UserItem> --> |
|||
<UserItem src='https://jianguan.yyundong.com/img/user/xtgl.png' text="检查更新" :notes="version" @click="click" clickId="7"> |
|||
</UserItem> |
|||
</view> |
|||
<!-- #endif --> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
import APPUpdate, { |
|||
getCurrentNo |
|||
} from '../../plugins/APPUpdate/index.js' |
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
newDate: this.getDate(), |
|||
// 类型1.全部,2.常规商品3.烟草 |
|||
range: [{ |
|||
"value": 1, |
|||
"text": "全部", |
|||
}, |
|||
{ |
|||
"value": 2, |
|||
"text": "常规商品", |
|||
}, { |
|||
"value": 3, |
|||
"text": "烟草", |
|||
} |
|||
], |
|||
chartData: {}, |
|||
opts: { |
|||
color: ["#1890FF", "#91CB74", "#FAC858", "#EE6666", "#73C0DE", "#3CA272", "#FC8452", "#9A60B4", |
|||
"#ea7ccc" |
|||
], |
|||
padding: [15, 15, 0, 15], |
|||
enableScroll: false, |
|||
legend: {}, |
|||
xAxis: { |
|||
disableGrid: true, |
|||
title: "" |
|||
}, |
|||
yAxis: { |
|||
disabled: false, |
|||
disableGrid: false, |
|||
splitNumber: 5, |
|||
gridType: "dash", |
|||
dashLength: 4, |
|||
gridColor: "#CCCCCC", |
|||
padding: 10, |
|||
showTitle: true, |
|||
data: [{ |
|||
position: "left", |
|||
title: "折线" |
|||
}, |
|||
{ |
|||
position: "right", |
|||
min: 0, |
|||
max: 200, |
|||
title: "柱状图", |
|||
textAlign: "left" |
|||
} |
|||
] |
|||
}, |
|||
extra: { |
|||
mix: { |
|||
column: { |
|||
width: 20 |
|||
} |
|||
} |
|||
} |
|||
baseUrl:"https://jianguan.yyundong.com/img", |
|||
info: { |
|||
name: "石家庄市宇信通电子有限公司", |
|||
mobile: "651651351651", |
|||
|
|||
}, |
|||
queryParams: { |
|||
customerSid: "", |
|||
date: "", |
|||
type: "", |
|||
} |
|||
version: "" |
|||
}; |
|||
}, |
|||
onReady() { |
|||
this.getServerData(); |
|||
onLoad() { |
|||
/* #ifdef APP-PLUS */ |
|||
let that = this; |
|||
getCurrentNo(version => { |
|||
that.version = version.version |
|||
console.log("version", version) |
|||
console.log("qqqq", that.version) |
|||
}) |
|||
|
|||
/* #endif */ |
|||
}, |
|||
methods: { |
|||
getDate() { |
|||
var tempDate = new Date() // 获取今天的日期 |
|||
tempDate.setDate(tempDate.getDate() - 1) // 今天的前N天的日期,N自定义 |
|||
var endDate = tempDate.getFullYear() + '-' + (tempDate.getMonth() + 1) + '-' + tempDate.getDate() |
|||
console.log(endDate) |
|||
return endDate |
|||
}, |
|||
dateChange(e) { |
|||
console.log('----dateChange事件:', e); |
|||
|
|||
}, |
|||
typeChange(e) { |
|||
console.log('e:', e); |
|||
this.queryParams.type = e |
|||
}, |
|||
doQuery() { |
|||
this.newDate = this.queryParams.date |
|||
this.getServerData(); |
|||
}, |
|||
doReset() { |
|||
this.queryParams = { |
|||
customerSid: "", |
|||
date: "", |
|||
type: "", |
|||
click(id) { |
|||
switch (id) { |
|||
case "0": |
|||
uni.navigateTo({ |
|||
url: '../index/MyProject' |
|||
}); |
|||
break; |
|||
case "1": |
|||
break; |
|||
case "2": |
|||
break; |
|||
case "3": |
|||
break; |
|||
case "4": |
|||
break; |
|||
case "5": |
|||
break; |
|||
case "6": |
|||
break; |
|||
case "7": |
|||
APPUpdate(true); |
|||
break; |
|||
} |
|||
this.newDate = this.getDate() |
|||
this.getServerData(); |
|||
}, |
|||
getServerData() { |
|||
// var _this = this |
|||
// this.$api.getThresholdAnalysis(_this.queryParams).then((resp) => { |
|||
// // if (resp.success) { |
|||
// console.log('1111', resp.data) |
|||
// // const data = resp.data |
|||
// // _this.dataList = data.financialData |
|||
// // _this.listSalesChannelData = data.listSalesChannelData |
|||
// // _this.drawLine(data.financialAnalysisChartData) |
|||
// // this.tableLoading = false |
|||
// // } else { |
|||
// // // 根据resp.code进行异常情况处理 |
|||
// // _this.dataList = [] |
|||
// // _this.listSalesChannelData = [] |
|||
// } |
|||
// }).catch(e => { |
|||
// console.log('eeeee', e) |
|||
// _this.tableLoading = false |
|||
// }) |
|||
|
|||
setTimeout(() => { |
|||
//模拟服务器返回数据,如果数据格式和标准格式不同,需自行按下面的格式拼接 |
|||
let res = { |
|||
categories: ["2018", "2019", "2020", "2021", "2022", "2023"], |
|||
series: [{ |
|||
name: "柱1", |
|||
index: 1, |
|||
type: "column", |
|||
data: [40, { |
|||
"value": 30, |
|||
"color": "#f04864" |
|||
}, 55, 110, 24, 58] |
|||
}, |
|||
{ |
|||
name: "柱2", |
|||
index: 1, |
|||
type: "column", |
|||
data: [50, 20, 75, 60, 34, 38] |
|||
}, |
|||
{ |
|||
name: "折线", |
|||
type: "line", |
|||
color: "#2fc25b", |
|||
data: [120, 140, 105, 170, 95, 160] |
|||
} |
|||
] |
|||
}; |
|||
this.chartData = JSON.parse(JSON.stringify(res)); |
|||
}, 500); |
|||
}, |
|||
|
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.content { |
|||
background: #fff; |
|||
padding-top: 10px; |
|||
} |
|||
<style lang="scss"> |
|||
.page { |
|||
width: 100%; |
|||
height: 100%; |
|||
|
|||
.top { |
|||
display: flex; |
|||
flex-direction: row; |
|||
align-items: center; |
|||
padding: 25px; |
|||
|
|||
.img { |
|||
margin-top: 10px; |
|||
margin-left: 10px; |
|||
width: 50px; |
|||
height: 50px; |
|||
} |
|||
|
|||
.top_right { |
|||
margin-top: 10px; |
|||
flex: 1; |
|||
margin-left: 20px; |
|||
display: flex; |
|||
flex-direction: column; |
|||
|
|||
.top_right_text1 { |
|||
width: 100%; |
|||
font-size: 20px; |
|||
font-weight: 800; |
|||
font-family: sans-serif; |
|||
overflow: hidden; |
|||
text-overflow: ellipsis; |
|||
display: -webkit-box; |
|||
-webkit-line-clamp: 1; |
|||
-webkit-box-orient: vertical; |
|||
|
|||
.top_select { |
|||
display: flex; |
|||
margin-left: 20px; |
|||
margin-right: 20px; |
|||
flex-direction: row; |
|||
margin-top: 10px; |
|||
align-items: center; |
|||
} |
|||
} |
|||
|
|||
.top_select_text { |
|||
margin-right: 10px; |
|||
} |
|||
.top_right_text2 { |
|||
margin-top: 5px; |
|||
font-size: 15px; |
|||
} |
|||
|
|||
} |
|||
} |
|||
|
|||
.user-item-bg { |
|||
background-color: #FFFFFF; |
|||
margin-top: 26rpx; |
|||
} |
|||
|
|||
.top_select_btn { |
|||
display: flex; |
|||
margin-left: 20px; |
|||
margin-right: 20px; |
|||
flex-direction: row; |
|||
margin-top: 15px; |
|||
align-items: center; |
|||
} |
|||
</style> |
|||
</style> |
@ -0,0 +1,544 @@ |
|||
<template> |
|||
<view class="content"> |
|||
|
|||
<view class="whiteBg" style="margin-top: 20px;"> |
|||
|
|||
<view class="top_item" @click="topClick('1')"> |
|||
|
|||
<view class="top_item_icon"> |
|||
<text class="top_item_icon_num" v-show="dbNum!=0">{{dbNum}}</text> |
|||
<image class="top_item_icon_img" src="https://jianguan.yyundong.com/img/newApp/dbgz.png"></image> |
|||
</view> |
|||
<text class="top_item_text">待办工作</text> |
|||
</view> |
|||
<view class="top_item" @click="topClick('2')"> |
|||
<view class="top_item_icon"> |
|||
<text class="top_item_icon_num" v-show="ybNum!=0">{{ybNum}}</text> |
|||
|
|||
<image class="top_item_icon_img" src="https://jianguan.yyundong.com/img/newApp/ybgz.png"></image> |
|||
</view> |
|||
<text class="top_item_text">已办工作</text> |
|||
</view> |
|||
<view class="top_item" @click="topClick('3')"> |
|||
<view class="top_item_icon"> |
|||
<text class="top_item_icon_num" v-show="dyNum!=0">{{dyNum}}</text> |
|||
|
|||
<image class="top_item_icon_img" src="https://jianguan.yyundong.com/img/newApp/dygz.png"></image> |
|||
</view> |
|||
<text class="top_item_text">待阅工作</text> |
|||
</view> |
|||
<view class="top_item" @click="topClick('4')"> |
|||
<view class="top_item_icon"> |
|||
<text class="top_item_icon_num" v-show="yyNum!=0">{{yyNum}}</text> |
|||
|
|||
<image class="top_item_icon_img" src="https://jianguan.yyundong.com/img/newApp/yygz.png"></image> |
|||
</view> |
|||
<text class="top_item_text">已阅工作</text> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
|
|||
<view style="display: flex;flex-direction: row; align-items: center;margin-top: 15px;" |
|||
v-show="textArr.length>0"> |
|||
|
|||
<image style="width: 20px;height: 20px;margin-left: 10px;" src="https://jianguan.yyundong.com/img/newApp/notices.png" |
|||
mode="aspectFit"></image> |
|||
<div class="textBox"> |
|||
|
|||
<!-- <transition name="slide"> |
|||
<text class="text" :key="text.id" @click="textClick(text)">{{text.val}} </text> |
|||
</transition> |
|||
--> |
|||
<div class="marquee-wrap"> |
|||
<div class="marquee-list" :class="{'animate-up': animateUp}"> |
|||
<li v-for="(item, index) in textArr" @click="textClick(item)">{{item}}</li> |
|||
</div> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
</view> |
|||
|
|||
<view class="whiteBg" style="display: flex;flex-direction: column; margin-top: 15px;"> |
|||
|
|||
<!--circular用来设置循环轮播 indicator-dots设置下面小圆点用来点击 --> |
|||
<swiper circular indicator-dots class="swiper" :autoplay="true" :interval="2000" v-show="swipers.length>0"> |
|||
<!-- v-for循环遍历数组 --> |
|||
<swiper-item v-for="(item,index) in swipers"> |
|||
<image :src="item" @click="swiperClick(index)"></image> |
|||
</swiper-item> |
|||
</swiper> |
|||
|
|||
|
|||
<view style="margin-top: 20px;display: flex;flex-direction: row;width: 100%;margin-bottom: 20px;"> |
|||
|
|||
<view class="centre" @click="businessClick('1')"> |
|||
<image class="centre_img" src="https://jianguan.yyundong.com/img/newApp/ywsp.png" mode="aspectFit"></image> |
|||
<text class="centre_text">业务审批</text> |
|||
</view> |
|||
<view class="centre" @click="businessClick('2')"> |
|||
<image class="centre_img" src="https://jianguan.yyundong.com/img/newApp/gzdd.png" mode="aspectFit"></image> |
|||
<text class="centre_text">工作调度</text> |
|||
</view> |
|||
<view class="centre" @click="businessClick('3')"> |
|||
<image class="centre_img" src="https://jianguan.yyundong.com/img/newApp/fkgl.png" mode="aspectFit"> </image> |
|||
<text class="centre_text">风控管理</text> |
|||
</view> |
|||
<view class="centre" @click="businessClick('4')"> |
|||
<image class="centre_img" src="https://jianguan.yyundong.com/img/newApp/sjbb.png" mode="aspectFit"></image> |
|||
<text class="centre_text">数据报表</text> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
<view class="whiteBg" style="margin-top: 25px;display: flex;flex-direction: column;padding-top: 20px;"> |
|||
|
|||
<view style="display: flex;flex-direction: row;margin-left: 20px;align-items: center;"> |
|||
|
|||
<image style="width: 25px;height: 25px;" src="https://jianguan.yyundong.com/img/newApp/icon.png" mode="aspectFit"></image> |
|||
<text style="margin-left: 5px;">云仓</text> |
|||
|
|||
</view> |
|||
|
|||
<view style=" height: 1px;background: #eee;margin-left: 25px;margin-right: 25px;margin-top: 15px;"></view> |
|||
|
|||
<view style="margin-top: 20px;display: flex;flex-direction: row;width: 100%;margin-bottom: 20px;"> |
|||
|
|||
<view class="centre" @click="warehouseClick('1')"> |
|||
<image class="centre_img" src="https://jianguan.yyundong.com/img/newApp/ycgl.png" mode="aspectFit"></image> |
|||
<text class="centre_text">云仓管理</text> |
|||
</view> |
|||
<view class="centre" @click="warehouseClick('2')"> |
|||
<image class="centre_img" src="https://jianguan.yyundong.com/img/newApp/kcfx.png" mode="aspectFit"></image> |
|||
<text class="centre_text">库存分析</text> |
|||
</view> |
|||
<view class="centre" @click="warehouseClick('3')"> |
|||
<image class="centre_img" src="https://jianguan.yyundong.com/img/newApp/hjjk.png" mode="aspectFit"></image> |
|||
<text class="centre_text">环境监控</text> |
|||
</view> |
|||
<view class="centre" @click="warehouseClick('4')"> |
|||
<image class="centre_img" src="https://jianguan.yyundong.com/img/newApp/jqrxk.png" mode="aspectFit"></image> |
|||
<text class="centre_text">机器人巡库</text> |
|||
</view> |
|||
|
|||
</view> |
|||
</view> |
|||
|
|||
|
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
dbNum: 0, |
|||
ybNum: 0, |
|||
dyNum: 0, |
|||
yyNum: 0, |
|||
animateUp: false, |
|||
timer: null, |
|||
textArr: [ |
|||
// '1 第一条公告', |
|||
// '2 第二条公告第二条公告', |
|||
// '3 第三条公告第三条公告第三条公告第三条公告第三条公告第三条公告第三条公告第三条公告第三条公告' |
|||
], |
|||
number: 0, |
|||
swipers: [ |
|||
// 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg', |
|||
// 'https://fuss10.elemecdn.com/1/34/19aa98b1fcb2781c4fba33d850549jpeg.jpeg', |
|||
// 'https://fuss10.elemecdn.com/9/bb/e27858e973f5d7d3904835f46abbdjpeg.jpeg', |
|||
// 'https://fuss10.elemecdn.com/d/e6/c4d93a3805b3ce3f323f7974e6f78jpeg.jpeg', |
|||
// 'https://fuss10.elemecdn.com/3/28/bbf893f792f03a54408b3b7a7ebf0jpeg.jpeg', |
|||
// 'https://fuss10.elemecdn.com/2/11/6535bcfb26e4c79b48ddde44f4b6fjpeg.jpeg' |
|||
], |
|||
|
|||
}; |
|||
}, |
|||
computed: { |
|||
text() { |
|||
return { |
|||
id: this.number, |
|||
val: this.textArr[this.number] |
|||
} |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.startMove() |
|||
this.timer = setInterval(this.scrollAnimate, 1500); |
|||
}, |
|||
// onLoad() { |
|||
|
|||
// }, |
|||
onShow() { |
|||
var userSid = getApp().globalData.sid |
|||
console.log(">>>>>", userSid) |
|||
this.getData(userSid) |
|||
|
|||
uni.setTabBarBadge({ //显示数字 |
|||
index: 0,//tabbar下标 |
|||
text: '100'//数字 |
|||
}) |
|||
// uni.removeTabBarBadge({ //隐藏数字标 |
|||
// index:2 |
|||
// }) |
|||
// uni.showTabBarRedDot({ //显示红点 |
|||
// index: 2 |
|||
// }) |
|||
// uni.hideTabBarRedDot({ //隐藏红点 |
|||
// index:2 |
|||
// }) |
|||
}, |
|||
destroyed() { |
|||
clearInterval(this.timer) |
|||
}, |
|||
|
|||
methods: { |
|||
scrollAnimate() { |
|||
this.animateUp = true |
|||
setTimeout(() => { |
|||
this.textArr.push(this.textArr[0]) |
|||
this.textArr.shift() |
|||
this.animateUp = false |
|||
}, 500) |
|||
}, |
|||
|
|||
getData(userSid) { |
|||
var _this = this |
|||
console.log("getData>>>>>", userSid) |
|||
this.$api.getWorkData(userSid).then((resp) => { |
|||
// if (resp.success) { |
|||
console.log('1111', resp) |
|||
this.dbNum = resp.todoNumber |
|||
this.dyNum = resp.pendingWork |
|||
this.textArr = resp.notice |
|||
this.swipers = resp.imageUrl |
|||
|
|||
}).catch(e => { |
|||
console.log('eeeee', e) |
|||
}) |
|||
}, |
|||
|
|||
topClick(index) { |
|||
switch (index) { |
|||
case "1": |
|||
// 待办 |
|||
uni.showToast({ |
|||
icon: "none", |
|||
title: '待办', |
|||
duration: 2000, |
|||
}); |
|||
break; |
|||
case "2": |
|||
// 已办 |
|||
uni.showToast({ |
|||
icon: "none", |
|||
title: '已办', |
|||
duration: 2000, |
|||
}); |
|||
break; |
|||
case "3": |
|||
// 待阅 |
|||
uni.showToast({ |
|||
icon: "none", |
|||
title: '待阅', |
|||
duration: 2000, |
|||
}); |
|||
break; |
|||
case "4": |
|||
// 已阅 |
|||
uni.showToast({ |
|||
icon: "none", |
|||
title: '已阅', |
|||
duration: 2000, |
|||
}); |
|||
break; |
|||
default: |
|||
break; |
|||
} |
|||
}, |
|||
|
|||
startMove() { |
|||
// eslint-disable-next-line |
|||
let timer = setTimeout(() => { |
|||
if (this.number === 2) { |
|||
this.number = 0; |
|||
} else { |
|||
this.number += 1; |
|||
} |
|||
this.startMove(); |
|||
}, 2000); // 滚动不需要停顿则将2000改成动画持续时间 |
|||
}, |
|||
textClick(item) { |
|||
|
|||
console.log("111", item) |
|||
uni.showToast({ |
|||
icon: "none", |
|||
title: '您点击了公告,内容为:' + item, |
|||
duration: 2000, |
|||
}); |
|||
}, |
|||
swiperClick(index) { |
|||
|
|||
uni.showToast({ |
|||
icon: "none", |
|||
title: '您点击了第' + (index + 1) + "张", |
|||
duration: 2000, |
|||
}); |
|||
}, |
|||
|
|||
businessClick(index) { |
|||
switch (index) { |
|||
case "1": |
|||
// 业务审批 |
|||
uni.showToast({ |
|||
icon: "none", |
|||
title: '业务审批', |
|||
duration: 2000, |
|||
}); |
|||
break; |
|||
case "2": |
|||
// 工作调度 |
|||
uni.showToast({ |
|||
icon: "none", |
|||
title: '工作调度', |
|||
duration: 2000, |
|||
}); |
|||
break; |
|||
case "3": |
|||
// 风控管理 |
|||
uni.showToast({ |
|||
icon: "none", |
|||
title: '风控管理', |
|||
duration: 2000, |
|||
}); |
|||
break; |
|||
case "4": |
|||
// 数据报表 |
|||
uni.showToast({ |
|||
icon: "none", |
|||
title: '数据报表', |
|||
duration: 2000, |
|||
}); |
|||
break; |
|||
default: |
|||
break; |
|||
} |
|||
}, |
|||
|
|||
warehouseClick(index) { |
|||
switch (index) { |
|||
case "1": |
|||
// 云仓管理 |
|||
uni.showToast({ |
|||
icon: "none", |
|||
title: '云仓管理', |
|||
duration: 2000, |
|||
}); |
|||
|
|||
uni.navigateTo({ |
|||
url: '../index/WarehouseManagement' |
|||
}); |
|||
|
|||
break; |
|||
case "2": |
|||
// 库存分析 |
|||
uni.showToast({ |
|||
icon: "none", |
|||
title: '库存分析', |
|||
duration: 2000, |
|||
}); |
|||
break; |
|||
case "3": |
|||
// 环境监控 |
|||
uni.showToast({ |
|||
icon: "none", |
|||
title: '环境监控', |
|||
duration: 2000, |
|||
}); |
|||
break; |
|||
case "4": |
|||
// 机器人巡库 |
|||
uni.showToast({ |
|||
icon: "none", |
|||
title: '机器人巡库', |
|||
duration: 2000, |
|||
}); |
|||
break; |
|||
default: |
|||
break; |
|||
} |
|||
}, |
|||
|
|||
|
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
.content { |
|||
display: flex; |
|||
flex-direction: column; |
|||
height: 100%; |
|||
margin-left: 12px; |
|||
margin-right: 12px; |
|||
|
|||
.whiteBg { |
|||
display: flex; |
|||
background-color: white; |
|||
border-radius: 20px; |
|||
|
|||
.top_item { |
|||
margin-top: 25px; |
|||
margin-bottom: 15px; |
|||
align-items: center; |
|||
flex: 1; |
|||
display: flex; |
|||
flex-direction: column; |
|||
|
|||
.top_item_icon { |
|||
display: flex; |
|||
flex-direction: column; |
|||
width: 50px; |
|||
height: 50px; |
|||
align-items: center; |
|||
justify-content: center; |
|||
background-image: url('https://jianguan.yyundong.com/img/newApp/round.png'); |
|||
background-size: 50px 50px; |
|||
|
|||
.top_item_icon_num { |
|||
display: flex; |
|||
align-items: center; |
|||
justify-content: center; |
|||
margin-left: 28px; |
|||
margin-top: -15px; |
|||
width: 10px; |
|||
height: 10px; |
|||
font-size: 6px; |
|||
background-color: red; |
|||
border-radius: 50%; |
|||
padding: 5px; |
|||
text-align: center; |
|||
color: white; |
|||
} |
|||
|
|||
.top_item_icon_img { |
|||
margin-top: -5px; |
|||
margin-left: 3px; |
|||
width: 30px; |
|||
height: 30px; |
|||
} |
|||
} |
|||
|
|||
.top_item_text { |
|||
margin-top: 5px; |
|||
color: #101010; |
|||
font-size: 15px; |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
.textBox { |
|||
flex: 1; |
|||
margin-right: 10px; |
|||
|
|||
// .textBox-swiper{ |
|||
// width: 100%; |
|||
// .text { |
|||
// font-size: 15px; |
|||
// font-weight: 600; |
|||
// font-family: sans-serif; |
|||
// color: #101010; |
|||
// overflow: hidden; |
|||
// text-overflow: ellipsis; |
|||
// display: -webkit-box; |
|||
// -webkit-line-clamp: 1; |
|||
// -webkit-box-orient: vertical; |
|||
// } |
|||
|
|||
// } |
|||
|
|||
.marquee-wrap { |
|||
width: 100%; |
|||
height: 40px; |
|||
overflow: hidden; |
|||
|
|||
.marquee-list { |
|||
li { |
|||
width: 100%; |
|||
height: 100%; |
|||
text-overflow: ellipsis; |
|||
overflow: hidden; |
|||
white-space: nowrap; |
|||
list-style: none; |
|||
line-height: 40px; |
|||
color: #000; |
|||
font-size: 18px; |
|||
font-weight: 400; |
|||
} |
|||
} |
|||
|
|||
.animate-up { |
|||
transition: all 0.8s ease-in-out; |
|||
transform: translateY(-40px); |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
// .slide-enter-active, |
|||
// .slide-leave-active { |
|||
// transition: all 0.5s linear; |
|||
// } |
|||
|
|||
// .slide-enter { |
|||
// transform: translateY(20px) scale(1); |
|||
// opacity: 1; |
|||
// } |
|||
|
|||
// .slide-leave-to { |
|||
// transform: translateY(-20px) scale(0.8); |
|||
// opacity: 0; |
|||
// } |
|||
} |
|||
|
|||
.swiper { |
|||
width: 100%; |
|||
height: 200px; |
|||
border-radius: 20rpx; |
|||
overflow: hidden; |
|||
/* 兼容IOS,否则在swiper组件内的布局都不受border-radius和overflow的约束 */ |
|||
transform: translateY(0); |
|||
|
|||
|
|||
image { |
|||
border-radius: 20rpx; |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
} |
|||
|
|||
|
|||
.centre { |
|||
flex: 1; |
|||
display: flex; |
|||
flex-direction: column; |
|||
align-items: center; |
|||
|
|||
.centre_img { |
|||
width: 50px; |
|||
height: 50px; |
|||
} |
|||
|
|||
.centre_text { |
|||
font-size: 15px; |
|||
color: #000; |
|||
margin-top: 5px; |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,132 @@ |
|||
<template> |
|||
<view class="page"> |
|||
|
|||
<view v-for="(item,index) in dataList" class="newslist"> |
|||
|
|||
<view class="item" @click="navToDetailPage(item.sid)"> |
|||
|
|||
|
|||
<view class="item-lift"> |
|||
|
|||
<text class="tetx1">{{item.entryName}}</text> |
|||
<text class="tetx2">{{item.enterpriseName}}</text> |
|||
|
|||
</view> |
|||
|
|||
<image src="../../static/user/zy.png" mode="aspectFill" style="width: 15px;height: 15px;"></image> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
dataList: [ |
|||
// { |
|||
// sid: "1", |
|||
// name: "瀚川商贸化工动产质押项目", |
|||
// custerName: "石家庄鸿彩字业制作有限公司", |
|||
// }, |
|||
// { |
|||
// sid: "2", |
|||
// name: "富荣食品快消品动产质押项目", |
|||
// custerName: "石家庄富荣食品有限公司", |
|||
// } |
|||
], |
|||
} |
|||
}, |
|||
onLoad() { |
|||
this.loadData(); |
|||
}, |
|||
methods: { |
|||
|
|||
loadData() { |
|||
this.$api.getProjectByUserSid(getApp().globalData.sid).then((resp) => { |
|||
// if (resp.success) { |
|||
console.log('1111', resp) |
|||
this.dataList = resp |
|||
|
|||
}).catch(e => { |
|||
console.log('eeeee', e) |
|||
}) |
|||
}, |
|||
//详情 |
|||
navToDetailPage(sid) { |
|||
console.log("sid>>>>", sid) |
|||
uni.navigateTo({ |
|||
url: 'ProjectDetail?sid=' + sid |
|||
}); |
|||
// uni.navigateTo({ |
|||
// url: 'WarehouseDetaile?sid='+sid, |
|||
// // // 版本2.8.9+ 支持 |
|||
// // success: (res) => { |
|||
// // // 和上面其实没差什么,但是这种方式是可以的 这里不是$emit |
|||
// // res.eventChannel.emit('sendTestValue', { |
|||
// // info: item |
|||
// // }) |
|||
// // } |
|||
// }); |
|||
}, |
|||
|
|||
editData() { |
|||
|
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
.page { |
|||
width: 100%; |
|||
height: 100%; |
|||
|
|||
.newslist { |
|||
|
|||
margin-top: 15px; |
|||
margin-left: 15px; |
|||
margin-right: 15px; |
|||
display: flex; |
|||
flex-direction: row; |
|||
align-items: center; |
|||
background: #fff; |
|||
border-radius: 10px; |
|||
padding: 15px 20px; |
|||
|
|||
.item { |
|||
width: 100%; |
|||
display: flex; |
|||
flex-direction: row; |
|||
align-items: center; |
|||
|
|||
.item-lift { |
|||
flex: 1; |
|||
display: flex; |
|||
flex-direction: column; |
|||
|
|||
.tetx1 { |
|||
color: #101010; |
|||
font-size: 16px; |
|||
overflow: hidden; |
|||
text-overflow: ellipsis; |
|||
display: -webkit-box; |
|||
-webkit-line-clamp: 1; |
|||
-webkit-box-orient: vertical; |
|||
} |
|||
|
|||
.tetx2 { |
|||
margin-top: 10px; |
|||
color: #999; |
|||
font-size: 14px; |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,265 @@ |
|||
<template> |
|||
|
|||
<view class="pages"> |
|||
|
|||
<view class="layout"> |
|||
|
|||
<view class="layout-item"> |
|||
<text class="text1">项目名称</text> |
|||
<text class="text2">{{info.entryName}}</text> |
|||
</view> |
|||
|
|||
<view class="layout-item"> |
|||
<text class="text1">所属行业</text> |
|||
<text class="text2">{{info.industryName}}</text> |
|||
</view> |
|||
|
|||
<view class="layout-item" style="border-bottom: none;"> |
|||
<text class="text1">企业名称</text> |
|||
<text class="text2">{{info.enterpriseName}}</text> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
<view class="layout" style="margin-top: 10px;"> |
|||
|
|||
<view class="layout-item"> |
|||
<text class="text1">授信额度</text> |
|||
<text class="text2">{{info.creditLimit}}</text> |
|||
</view> |
|||
|
|||
<view class="layout-item"> |
|||
<text class="text1">项目类型</text> |
|||
<text class="text2">{{info.typeName}}</text> |
|||
</view> |
|||
|
|||
<view class="layout-item" style="border-bottom: none;"> |
|||
<text class="text1">贷款银行</text> |
|||
<text class="text2">{{info.bankName}}</text> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
<view class="layout" style="margin-top: 10px;"> |
|||
|
|||
<text style="margin-top: 15px;margin-left: 13px;">项目仓库</text> |
|||
|
|||
<view class="list"> |
|||
|
|||
<view class="list-item" v-for="item in imageArr"> |
|||
|
|||
<view class="list-item-lay"> |
|||
<image class="item-img" :src="item.src" mode="aspectFill" @tap="previewImage(item.src)"></image> |
|||
<text class="item-text">{{item.title}}</text> |
|||
</view> |
|||
|
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
|
|||
</view> |
|||
|
|||
|
|||
|
|||
<view class="layout" style="margin-top: 10px;"> |
|||
|
|||
<view class="layout-item"> |
|||
<text class="text1">项目联系人</text> |
|||
<text class="text2">{{info.eContacts}}</text> |
|||
</view> |
|||
|
|||
<view class="layout-item"> |
|||
<text class="text1">监管负责人</text> |
|||
<text class="text2">{{info.regulatoryLeader}}</text> |
|||
</view> |
|||
|
|||
<view class="layout-item" style="border-bottom: none;"> |
|||
<text class="text1">客户经理</text> |
|||
<text class="text2">{{info.bManagerName}}</text> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
<view class="layout" style="margin-top: 10px;"> |
|||
|
|||
<view class="layout-item"> |
|||
<text class="text1">签约日期</text> |
|||
<text class="text2">{{info.signingDate}}</text> |
|||
</view> |
|||
|
|||
<view class="layout-item"> |
|||
<text class="text1">结束日期</text> |
|||
<text class="text2">{{info.endDate}}</text> |
|||
</view> |
|||
|
|||
<view class="layout-item" style="border-bottom: none;"> |
|||
<text class="text1">填表日期</text> |
|||
<text class="text2">{{info.fillInDate}}</text> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
<view class="layout" style="margin-top: 10px;"> |
|||
|
|||
<view class="layout-item" style="border-bottom: none;"> |
|||
<text class="text1">事业部经理</text> |
|||
<text class="text2">{{info.generalManager}}</text> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
<view class="layout" style="margin-top: 10px;padding: 20px; padding-bottom: 50px;"> |
|||
|
|||
<text |
|||
style="font-size: 14px;color: #919191;line-height: 25px;">项目说明:{{info.remarks}}</text> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
info: {}, |
|||
imageArr: [ |
|||
// { |
|||
// src: "https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg", |
|||
// title: "芙蓉" |
|||
// }, |
|||
// { |
|||
// src: "https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg", |
|||
// title: "芙蓉" |
|||
// }, |
|||
// { |
|||
// src: "https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg", |
|||
// title: "芙蓉" |
|||
// }, { |
|||
// src: "https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg", |
|||
// title: "芙蓉" |
|||
// }, |
|||
// { |
|||
// src: "https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg", |
|||
// title: "芙蓉" |
|||
// } |
|||
], |
|||
} |
|||
}, |
|||
onLoad(option) { |
|||
this.loadData1(option.sid); |
|||
this.loadData2(option.sid); |
|||
}, |
|||
methods: { |
|||
loadData1(sid) { |
|||
this.$api.getProjectBySid(sid).then((resp) => { |
|||
// if (resp.success) { |
|||
console.log('1111', resp) |
|||
this.info = resp |
|||
|
|||
}).catch(e => { |
|||
console.log('eeeee', e) |
|||
}) |
|||
}, |
|||
|
|||
loadData2(sid) { |
|||
this.$api.getStorehouseBySid(sid).then((resp) => { |
|||
// if (resp.success) { |
|||
console.log('222', resp) |
|||
// this.dataList = resp |
|||
this.imageArr =[] |
|||
for (var i = 0; i < resp.length; i++) { |
|||
let item = resp[i] |
|||
this.imageArr.push( |
|||
{ |
|||
src:item.picUrl, |
|||
title:item.simpleName |
|||
}) |
|||
} |
|||
|
|||
}).catch(e => { |
|||
console.log('eeeee', e) |
|||
}) |
|||
}, |
|||
|
|||
|
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
.pages { |
|||
width: 100%; |
|||
height: 100%; |
|||
display: flex; |
|||
flex-direction: column; |
|||
|
|||
.layout { |
|||
|
|||
display: flex; |
|||
flex-direction: column; |
|||
background: #fff; |
|||
padding-left: 20px; |
|||
padding-right: 20px; |
|||
|
|||
.layout-item { |
|||
padding: 10px 12px; |
|||
border-bottom: 1px solid #eee; |
|||
|
|||
display: flex; |
|||
flex-direction: row; |
|||
align-items: center; |
|||
|
|||
.text1 { |
|||
flex: 0.8; |
|||
font-size: 16px; |
|||
color: #494949; |
|||
} |
|||
|
|||
.text2 { |
|||
|
|||
flex: 1; |
|||
font-size: 15px; |
|||
color: #bcbcbc; |
|||
} |
|||
} |
|||
|
|||
|
|||
.list { |
|||
margin-top: 10px; |
|||
column-count: 2; |
|||
|
|||
.list-item { |
|||
width: 100%; |
|||
|
|||
.list-item-lay { |
|||
|
|||
.item-img { |
|||
width: 100%; |
|||
height: 105px; |
|||
border: 1px solid #4D72FF; |
|||
} |
|||
.item-text { |
|||
z-index: 1000; |
|||
position: relative; |
|||
top: -28px; |
|||
padding: 3px 15px 3px 15px; |
|||
color: #fff; |
|||
background: #4D72FF; |
|||
opacity:0.7; |
|||
font-size: 13px; |
|||
border-top-right-radius: 15px; |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,297 @@ |
|||
<template> |
|||
<view class="page"> |
|||
|
|||
<view class="banner"> |
|||
<!--circular用来设置循环轮播 indicator-dots设置下面小圆点用来点击 --> |
|||
<swiper circular indicator-dots class="swiper" :autoplay="true" :interval="2000"> |
|||
<!-- v-for循环遍历数组 --> |
|||
<swiper-item v-for="(item,index) in info.swipers"> |
|||
<image :src="item" @click="swiperClick(index)"></image> |
|||
</swiper-item> |
|||
</swiper> |
|||
|
|||
</view> |
|||
|
|||
<view class="top"> |
|||
|
|||
<view class="top-name"> |
|||
<text class="top-name-text1">{{info.name}}</text> |
|||
<text class="top-name-text2">{{info.custerName}}</text> |
|||
</view> |
|||
<view class="view"></view> |
|||
|
|||
<image class="top-img" src="https://jianguan.yyundong.com/img/newApp/phone.png" mode="aspectFit"></image> |
|||
|
|||
</view> |
|||
|
|||
<view class="top" style="margin-top: 10px;"> |
|||
<image style="width: 20px;height: 40px;" src="https://jianguan.yyundong.com/img/newApp/location.png" mode="aspectFit"></image> |
|||
<view style="display: flex; |
|||
flex-direction: column;margin-left: 10px;"> |
|||
<text class="top-name-text3">{{info.address}}</text> |
|||
</view> |
|||
|
|||
<!-- <view class="view"></view> --> |
|||
|
|||
</view> |
|||
|
|||
<view class="bottom" style="margin-top: 10px;"> |
|||
|
|||
<view class="bottom-title"> |
|||
<view class="bottom-title-view"></view> |
|||
<text class="bottom-title-text">基础信息</text> |
|||
</view> |
|||
|
|||
<view class="bottom-item"> |
|||
|
|||
<view class="bottom-item-lay"> |
|||
<text class="bottom-item-text1">仓库简称</text> |
|||
<text class="bottom-item-text2">{{info.simpleName}}</text> |
|||
</view> |
|||
|
|||
<view class="bottom-item-lay"> |
|||
<text class="bottom-item-text1">房源</text> |
|||
<text class="bottom-item-text2">{{info.housingResource}}</text> |
|||
</view> |
|||
|
|||
<view class="bottom-item-lay" style="border-bottom: none;"> |
|||
<text class="bottom-item-text1">高度</text> |
|||
<text class="bottom-item-text2">{{info.storeyHeight}}</text> |
|||
</view> |
|||
|
|||
|
|||
</view> |
|||
|
|||
<!-- <view class="bottom-title"> |
|||
<view class="bottom-title-view"></view> |
|||
<text class="bottom-title-text">具体描述</text> |
|||
</view> |
|||
<view style="margin-top: 10px;"> |
|||
<text style="display: flex;padding-bottom: 50px;">{{info.describe}}</text> |
|||
</view> --> |
|||
|
|||
</view> |
|||
|
|||
<view class="bottom" style="margin-top: 10px;padding-bottom: 50px;"> |
|||
|
|||
|
|||
<view class="bottom-title"> |
|||
<view class="bottom-title-view"></view> |
|||
<text class="bottom-title-text">详情信息</text> |
|||
</view> |
|||
<view class="bottom-item"> |
|||
<view class="bottom-item-lay"> |
|||
<text class="bottom-item-text1">库房面积</text> |
|||
<text class="bottom-item-text2">{{info.acreage}}㎡</text> |
|||
</view> |
|||
<view class="bottom-item-lay" style="border-bottom: none;"> |
|||
<text class="bottom-item-text1">月租金</text> |
|||
<text class="bottom-item-text2">{{info.monthlyPrice}}</text> |
|||
</view> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
|
|||
|
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
// infoSid: "", |
|||
info: { |
|||
// swipers: [ |
|||
// 'https://fuss10.elemecdn.com/a/3f/3302e58f9a181d2509f3dc0fa68b0jpeg.jpeg', |
|||
// 'https://fuss10.elemecdn.com/1/34/19aa98b1fcb2781c4fba33d850549jpeg.jpeg', |
|||
// 'https://fuss10.elemecdn.com/9/bb/e27858e973f5d7d3904835f46abbdjpeg.jpeg', |
|||
// 'https://fuss10.elemecdn.com/d/e6/c4d93a3805b3ce3f323f7974e6f78jpeg.jpeg', |
|||
// 'https://fuss10.elemecdn.com/3/28/bbf893f792f03a54408b3b7a7ebf0jpeg.jpeg', |
|||
// 'https://fuss10.elemecdn.com/2/11/6535bcfb26e4c79b48ddde44f4b6fjpeg.jpeg' |
|||
// ], |
|||
// name: "石家庄鸿彩字业制作有限公司", |
|||
// region: "河北省/石家庄市/长安区", |
|||
// address: "凌透村凌透西街北端(鑫禄驾校东北100米)", |
|||
// distance: "距您6Km", |
|||
// type: "厂房出租", |
|||
// lease: "12个月", |
|||
// pledge: "押0付12", |
|||
// leaseMethod: "整租", |
|||
// floor: "单层", |
|||
// height: "8m", |
|||
// isNew: "旧厂", |
|||
// structure: "砖混", |
|||
// describe: "厂房,仓库,暖棚,土地,长期代收租厂房仓库,办公楼厂房,仓库,暖棚,土地,长期代收租厂房仓库,办公楼厂房,仓库,暖棚,土地,长期代收租厂房仓库,办公楼" |
|||
} |
|||
} |
|||
}, |
|||
onLoad(option) { |
|||
console.log('option', option) |
|||
// this.infoSid = option.sid |
|||
this.getData(option.sid) |
|||
}, |
|||
methods: { |
|||
getData(sid) { |
|||
console.log('sid', sid) |
|||
this.$api.storeHouseDetail(sid).then((resp) => { |
|||
// if (resp.success) { |
|||
console.log('1111', resp) |
|||
this.info = resp |
|||
this.info.swipers =[] |
|||
this.info.swipers.push( |
|||
resp.picUrl) |
|||
|
|||
}).catch(e => { |
|||
console.log('eeeee', e) |
|||
}) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
.page { |
|||
width: 100%; |
|||
height: 100%; |
|||
display: flex; |
|||
flex-direction: column; |
|||
|
|||
.banner { |
|||
flex-shrink: 0; |
|||
width: 100%; |
|||
height: 200px; |
|||
|
|||
.swiper { |
|||
width: 100%; |
|||
height: 100%; |
|||
|
|||
image { |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
} |
|||
} |
|||
|
|||
.top { |
|||
display: flex; |
|||
flex-direction: row; |
|||
align-items: center; |
|||
background: #fff; |
|||
padding: 15px; |
|||
|
|||
.top-name { |
|||
width: 75%; |
|||
display: flex; |
|||
flex-direction: column; |
|||
|
|||
.top-name-text1 { |
|||
|
|||
font-size: 18px; |
|||
color: #000; |
|||
font-weight: 600; |
|||
font-family: sans-serif; |
|||
overflow: hidden; |
|||
text-overflow: ellipsis; |
|||
display: -webkit-box; |
|||
-webkit-line-clamp: 1; |
|||
-webkit-box-orient: vertical; |
|||
} |
|||
|
|||
.top-name-text2 { |
|||
margin-top: 5px; |
|||
font-size: 15px; |
|||
color: #919191; |
|||
} |
|||
|
|||
} |
|||
|
|||
.top-name-text3 { |
|||
|
|||
font-size: 13px; |
|||
color: #919191; |
|||
} |
|||
|
|||
.top-name-text4 { |
|||
margin-top: 5px; |
|||
font-size: 12px; |
|||
color: #919191; |
|||
} |
|||
|
|||
.view { |
|||
width: 1px; |
|||
margin-top: 15px; |
|||
margin-bottom: 15px; |
|||
min-height: 25px; |
|||
margin-left: 20px; |
|||
background: #1684FC; |
|||
} |
|||
|
|||
.top-img { |
|||
margin-left: 20px; |
|||
width: 35px; |
|||
height: 35px; |
|||
} |
|||
} |
|||
|
|||
.bottom { |
|||
display: flex; |
|||
flex-direction: column; |
|||
background-color: #fff; |
|||
padding: 5px 15px; |
|||
|
|||
.bottom-title { |
|||
margin-top: 20px; |
|||
display: flex; |
|||
flex-direction: row; |
|||
align-items: center; |
|||
|
|||
.bottom-title-view { |
|||
width: 2px; |
|||
height: 15px; |
|||
background-color: #1684FC; |
|||
} |
|||
|
|||
.bottom-title-text { |
|||
margin-left: 8px; |
|||
font-size: 15px; |
|||
color: #696969; |
|||
} |
|||
|
|||
} |
|||
|
|||
.bottom-item { |
|||
margin-top: 15px; |
|||
display: flex; |
|||
padding-left: 30px; |
|||
padding-right: 30px; |
|||
flex-direction: column; |
|||
|
|||
.bottom-item-lay{ |
|||
margin-top: 10px; |
|||
display: flex; |
|||
flex-direction: row; |
|||
padding: 8px 12px; |
|||
border-bottom: 1px solid #eee; |
|||
|
|||
.bottom-item-text1 { |
|||
flex: 1; |
|||
font-size: 14px; |
|||
color: #191919; |
|||
} |
|||
|
|||
.bottom-item-text2 { |
|||
|
|||
flex: 1; |
|||
font-size: 14px; |
|||
color: #717171; |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,283 @@ |
|||
<template> |
|||
<view class="page"> |
|||
|
|||
<view v-for="(item,index) in dataList" class="newslist"> |
|||
|
|||
<view class="listcard" :class="{'listcard2':index+1<dataList.length}" @click="navToDetailPage(item.sid)"> |
|||
|
|||
<image :src="item.picUrl" mode="aspectFill" class="img"></image> |
|||
|
|||
<view class="rightlayout"> |
|||
|
|||
<text class="rightlayout-top">{{item.name}}</text> |
|||
|
|||
<view class="rightlayout-centre"> |
|||
<text class="text">{{item.provinceName}}-{{item.cityName}}-{{item.countyName}}</text> |
|||
<!-- <text class="text">{{item.provinceName}}-{{item.cityName}}-{{item.countyName}}</text> --> |
|||
<!-- <text class="text" >{{item.attributeNames==''?'--':item.attributeNames}}</text> --> |
|||
<!-- <text class="btn2" :class="{'btn1':item.isEdit===1}" @click="editData">编辑</text> --> |
|||
</view> |
|||
|
|||
<view class="rightlayout-bootm"> |
|||
<text class="text">{{item.linkerName==''?'--':item.linkerName}}</text> |
|||
<text class="text">{{item.acreage==''?'--':item.acreage}}㎡</text> |
|||
<text class="text2" style="text-align: right;">{{item.monthlyPrice==''?'--':item.monthlyPrice}}/年</text> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
<uni-load-more :status="loadingType"></uni-load-more> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
listQuery: { |
|||
current: 1, |
|||
size: 10, |
|||
params: { |
|||
} |
|||
}, |
|||
loadingType: 'more', //加载更多状态 |
|||
dataList: [ |
|||
// { |
|||
// sid:"1", |
|||
// img: "https://pic3.zhimg.com/v2-c6ae9c3aff36b9b221258f6a90577902_r.jpg", |
|||
// name: "石家庄鸿彩字业制作有限公司", |
|||
// type: "库房", |
|||
// label: "物流仓储", |
|||
// isEdit: 1, |
|||
// userName: "孙宁", |
|||
// address: "长安区", |
|||
// distance: "6Km", |
|||
// }, |
|||
// { |
|||
// sid:"2", |
|||
// img: "https://pic3.zhimg.com/v2-c6ae9c3aff36b9b221258f6a90577902_r.jpg", |
|||
// name: "石家庄鸿彩字业制作有限公司2", |
|||
// type: "库房2", |
|||
// label: "物流仓储2", |
|||
// isEdit: 2, |
|||
// userName: "孙宁2", |
|||
// address: "长安区2", |
|||
// distance: "6Km2", |
|||
// } |
|||
], |
|||
} |
|||
}, |
|||
onShow() { |
|||
this.listQuery.current = 1 |
|||
this.dataList = []; |
|||
this.loadData(); |
|||
}, |
|||
onLoad() { |
|||
|
|||
}, |
|||
onPullDownRefresh() { |
|||
this.listQuery.current = 1 |
|||
this.loadData('refresh'); |
|||
setTimeout(function() { |
|||
uni.stopPullDownRefresh(); |
|||
}, 2000); |
|||
}, |
|||
//加载更多 |
|||
onReachBottom() { |
|||
this.listQuery.current = this.listQuery.current + 1 |
|||
this.loadData(); |
|||
}, |
|||
methods: { |
|||
//加载商品 ,带下拉刷新和上滑加载 |
|||
async loadData(type = 'add', loading) { |
|||
//没有更多直接返回 |
|||
if (type === 'add') { |
|||
if (this.loadingType === 'nomore') { |
|||
return; |
|||
} |
|||
this.loadingType = 'loading'; |
|||
} else { |
|||
this.loadingType = 'more'; |
|||
} |
|||
|
|||
var list = [] |
|||
|
|||
this.$api.storeHouseListPage(this.listQuery).then((resp) => { |
|||
// if (resp.success) { |
|||
console.log('1111', resp) |
|||
|
|||
this.listQuery ={ |
|||
current: resp.current, |
|||
size: 10, |
|||
params: { |
|||
|
|||
} |
|||
} |
|||
list = resp.records |
|||
|
|||
console.log("消息列表", list) |
|||
// this.goodsList = list; |
|||
// let goodsList = await this.$api.json('goodsList'); |
|||
if (type === 'refresh') { |
|||
this.dataList = []; |
|||
} |
|||
|
|||
this.dataList = this.dataList.concat(list); |
|||
console.log("消息列表>>>>>", this.dataList.length) |
|||
//判断是否还有下一页,有是more 没有是nomore(测试数据判断大于20就没有了) |
|||
this.loadingType = this.dataList.length > list.total ? 'nomore' : 'more'; |
|||
if (type === 'refresh') { |
|||
if (loading == 1) { |
|||
uni.hideLoading(); |
|||
} else { |
|||
uni.stopPullDownRefresh(); |
|||
} |
|||
} |
|||
|
|||
}).catch(e => { |
|||
console.log('eeeee', e) |
|||
}) |
|||
|
|||
}, |
|||
|
|||
//详情 |
|||
navToDetailPage(sid) { |
|||
console.log("sid>>>>", sid) |
|||
uni.navigateTo({ |
|||
url: 'WarehouseDetaile?sid='+sid |
|||
}); |
|||
// uni.navigateTo({ |
|||
// url: 'WarehouseDetaile?sid='+sid, |
|||
// // // 版本2.8.9+ 支持 |
|||
// // success: (res) => { |
|||
// // // 和上面其实没差什么,但是这种方式是可以的 这里不是$emit |
|||
// // res.eventChannel.emit('sendTestValue', { |
|||
// // info: item |
|||
// // }) |
|||
// // } |
|||
// }); |
|||
}, |
|||
|
|||
editData() { |
|||
|
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
.page { |
|||
width: 100%; |
|||
height: 100%; |
|||
|
|||
.newslist { |
|||
display: flex; |
|||
flex-direction: column; |
|||
|
|||
.listcard { |
|||
margin-left: 20px; |
|||
margin-right: 20px; |
|||
padding-bottom: 20px; |
|||
padding-top: 20px; |
|||
display: flex; |
|||
flex-direction: row; |
|||
align-items: center; |
|||
|
|||
.img { |
|||
width: 120px; |
|||
height: 80px; |
|||
border: 1px solid #1684FC; |
|||
flex-shrink: 0; |
|||
} |
|||
|
|||
.rightlayout { |
|||
margin-left: 10px; |
|||
display: flex; |
|||
flex: 1; |
|||
flex-direction: column; |
|||
|
|||
.rightlayout-top { |
|||
width: 100%; |
|||
font-size: 16px; |
|||
font-weight: 600; |
|||
font-family: sans-serif; |
|||
overflow: hidden; |
|||
text-overflow: ellipsis; |
|||
display: -webkit-box; |
|||
-webkit-line-clamp: 1; |
|||
-webkit-box-orient: vertical; |
|||
} |
|||
|
|||
.rightlayout-centre { |
|||
margin-top: 10px; |
|||
display: flex; |
|||
width: 100%; |
|||
flex-direction: row; |
|||
align-items: center; |
|||
|
|||
.text { |
|||
flex: 1; |
|||
font-size: 14px; |
|||
color: #5C5C5C; |
|||
} |
|||
|
|||
.btn1 { |
|||
text-align: center; |
|||
background: #1684FC; |
|||
border-radius: 5px; |
|||
color: #fff; |
|||
font-size: 12px; |
|||
padding: 2px 5px; |
|||
} |
|||
|
|||
.btn2 { |
|||
border-radius: 5px; |
|||
text-align: center; |
|||
background: #D5D5D5; |
|||
color: #fff; |
|||
font-size: 12px; |
|||
padding: 2px 5px; |
|||
} |
|||
} |
|||
|
|||
.rightlayout-bootm { |
|||
margin-top: 10px; |
|||
display: flex; |
|||
flex-direction: row; |
|||
align-items: center; |
|||
|
|||
.text { |
|||
flex: 1; |
|||
font-size: 14px; |
|||
color: #5C5C5C; |
|||
} |
|||
|
|||
.text2 { |
|||
flex: 1.2; |
|||
font-size: 14px; |
|||
color: red; |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
.view { |
|||
width: 100%; |
|||
background: #D5D5D5; |
|||
height: 1px; |
|||
margin-left: 10px; |
|||
margin-right: 10px; |
|||
} |
|||
} |
|||
|
|||
.listcard2 { |
|||
border-bottom: 1px solid #D5D5D5; |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,192 @@ |
|||
<template> |
|||
<view class="page"> |
|||
|
|||
<view class="layout"> |
|||
|
|||
<view class="item" style="margin-right: 10px;" @click="onClick('1')"> |
|||
|
|||
<image class="item_img" src="../../static/newApp/yclb.png" mode="aspectFit"></image> |
|||
<text class="item_text">云仓列表</text> |
|||
</view> |
|||
|
|||
<view class="item" style="margin-left: 10px;" @click="onClick('2')"> |
|||
|
|||
<image class="item_img" src="../../static/newApp/jczl.png" mode="aspectFit"></image> |
|||
<text class="item_text">基础资料</text> |
|||
</view> |
|||
|
|||
|
|||
</view> |
|||
|
|||
<view class="layout"> |
|||
|
|||
<view class="item" style="margin-right: 10px;" @click="onClick('3')"> |
|||
|
|||
<image class="item_img" src="../../static/newApp/rkgl.png" mode="aspectFit"></image> |
|||
<text class="item_text">入库管理</text> |
|||
</view> |
|||
|
|||
<view class="item" style="margin-left: 10px;" @click="onClick('4')"> |
|||
|
|||
<image class="item_img" src="../../static/newApp/ckgl.png" mode="aspectFit"></image> |
|||
<text class="item_text">出库管理</text> |
|||
</view> |
|||
|
|||
|
|||
</view> |
|||
|
|||
<view class="layout"> |
|||
|
|||
<view class="item" style="margin-right: 10px;" @click="onClick('5')"> |
|||
|
|||
<image class="item_img" src="../../static/newApp/ckdj.png" mode="aspectFit"></image> |
|||
<text class="item_text">仓库登记</text> |
|||
</view> |
|||
|
|||
<view style="margin-left: 10px;flex: 1; |
|||
padding: 30px 20px;"> |
|||
|
|||
<!-- <image class="item_img" src="../../static/newApp/gzdd.png"></image> --> |
|||
<!-- <text class="item_text">云仓列表</text> --> |
|||
</view> |
|||
|
|||
|
|||
</view> |
|||
|
|||
|
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
// href: '', |
|||
// gv: {}, |
|||
// resinfo: '' |
|||
} |
|||
}, |
|||
onLoad() { |
|||
this.initData() |
|||
}, |
|||
methods: { |
|||
initData() { |
|||
this.gv = getApp().globalData |
|||
console.log('hasLogin', this.$store.getters.hasLogin) |
|||
console.log('token', this.$store.getters.token) |
|||
console.log('uinfo', this.$store.getters.userinfo) |
|||
console.log('uinfo-id', this.$store.getters.userinfo.userid) |
|||
console.log('uinfo-name', this.$store.getters.userinfo.name) |
|||
getApp().globalData.uinfo = this.$store.getters.userinfo |
|||
}, |
|||
// sayhello() { |
|||
// this.$api.sayhello({name:'mynameislll'}).then(res => { |
|||
// this.resinfo = res |
|||
// }) |
|||
// }, |
|||
// logout() { |
|||
// this.$store.dispatch('logout').then(() => { |
|||
// console.log('NNNN:退出 ') |
|||
// }) |
|||
// }, |
|||
// gologin() { |
|||
// uni.reLaunch({ url: '/pages/login/index' }) |
|||
// } |
|||
|
|||
onClick(index) { |
|||
switch (index) { |
|||
case "1": |
|||
// 云仓列表 |
|||
uni.showToast({ |
|||
icon: "none", |
|||
title: '云仓列表', |
|||
duration: 2000, |
|||
}); |
|||
|
|||
uni.navigateTo({ |
|||
url: '../index/WarehouseList' |
|||
}); |
|||
|
|||
break; |
|||
case "2": |
|||
// 基础资料 |
|||
uni.showToast({ |
|||
icon: "none", |
|||
title: '基础资料', |
|||
duration: 2000, |
|||
}); |
|||
break; |
|||
case "3": |
|||
// 入库管理 |
|||
uni.showToast({ |
|||
icon: "none", |
|||
title: '入库管理', |
|||
duration: 2000, |
|||
}); |
|||
break; |
|||
case "4": |
|||
// 出库管理 |
|||
uni.showToast({ |
|||
icon: "none", |
|||
title: '出库管理', |
|||
duration: 2000, |
|||
}); |
|||
break; |
|||
case "5": |
|||
// 仓库登记 |
|||
uni.showToast({ |
|||
icon: "none", |
|||
title: '仓库登记', |
|||
duration: 2000, |
|||
}); |
|||
|
|||
uni.navigateTo({ |
|||
url: '../index/WarehouseRegistration' |
|||
}); |
|||
|
|||
break; |
|||
default: |
|||
break; |
|||
} |
|||
}, |
|||
|
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
.page { |
|||
background: #fff; |
|||
width: 100%; |
|||
height: 100%; |
|||
padding-top: 25px; |
|||
|
|||
.layout { |
|||
display: flex; |
|||
flex-direction: row; |
|||
margin-left: 20px; |
|||
margin-right: 20px; |
|||
|
|||
.item { |
|||
margin-top: 25px; |
|||
flex: 1; |
|||
display: flex; |
|||
align-items: center; |
|||
border-radius: 12px; |
|||
background: #F1F3F5 100%; |
|||
padding: 20px 10px; |
|||
|
|||
.item_img { |
|||
width: 35px; |
|||
height: 35px; |
|||
} |
|||
|
|||
.item_text { |
|||
margin-left: 10px; |
|||
font-size: 15px; |
|||
color: #757575; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</style> |
@ -0,0 +1,22 @@ |
|||
<template> |
|||
<view> |
|||
|
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
|
|||
} |
|||
}, |
|||
methods: { |
|||
|
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
|
|||
</style> |
@ -0,0 +1,261 @@ |
|||
<template> |
|||
|
|||
<view style="margin-left: 20px; margin-right: 20px;padding-bottom: 50px"> |
|||
|
|||
<view style="display: flex;width: 100%;"> |
|||
<view style="flex: 1;"></view> |
|||
<text style="size: 25px;font-family: sans-serif;font-weight: 600;color: white; |
|||
margin-top: 10px;margin-right: 5px;border: none; padding: 5px 15px; |
|||
border-radius: 5px 5px; |
|||
background: #0498FD;" @click="download"> |
|||
下载 |
|||
</text> |
|||
</view> |
|||
|
|||
|
|||
<view |
|||
style="display: flex;width: 100%;justify-content: center;size: 25px;font-family: sans-serif;font-weight: 600;margin-top: 10px;"> |
|||
每日回款审核报告 |
|||
</view> |
|||
|
|||
<view style="margin-top: 20px;font-family: sans-serif;font-weight: 600;">石家庄汇融农村合作银行振头支行:</view> |
|||
|
|||
<view style=" line-height: 30px; margin-top: 10px;text-indent:2em;"> |
|||
<text style="font-family: sans-serif;font-weight: 600;">{{info.companyName}}</text> |
|||
<text>昨日销售及今日回款情况如下:昨日销售总计:</text> |
|||
<text style="font-family: sans-serif;font-weight: 600;">{{info.totalSales}}</text> |
|||
<text> 元,今日应回款:</text> |
|||
<text style="font-family: sans-serif;font-weight: 600;">{{info.collection}}</text> |
|||
<text> 元,今日实际回款:</text> |
|||
<text style="font-family: sans-serif;font-weight: 600;">{{info.actualCollection}}</text> |
|||
<text> 元,回款差额:</text> |
|||
<text style="font-family: sans-serif;font-weight: 600;">{{info.difference}}</text> |
|||
<text> 元,未回款原因平台扣除手续费、服务费等。具体原因详见附件今日回款明细。</text> |
|||
|
|||
<view> |
|||
<text>截至</text> |
|||
<text style="font-family: sans-serif;font-weight: 600;">{{info.endTime}}</text> |
|||
<text>,今日支付完毕款项后,账户余额为:</text> |
|||
<text style="font-family: sans-serif;font-weight: 600;">{{info.balance}}</text> |
|||
<text> 元。</text> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
<view style="display: flex;flex-direction: column;margin-top: 15px; line-height: 30px;"> |
|||
<text style="size: 25px;font-family: sans-serif;font-weight: 600;">审核结果:</text> |
|||
<text style="text-indent:2em;">{{info.auditResult}}</text> |
|||
<!-- <view> |
|||
<text |
|||
style="margin-top: 10px;text-indent:2em;">实际回款资金已按要求回到{{info.companyName}}{{info.account}}(账号为</text> |
|||
<text style="font-family: sans-serif;font-weight: 600;">{{info.accountNumber}}</text> |
|||
<text>)。</text> |
|||
</view> --> |
|||
|
|||
</view> |
|||
|
|||
|
|||
<view style="display: flex;flex-direction: column;width: 100%;align-items: flex-end; margin-top: 30px;"> |
|||
|
|||
<text style="font-family: sans-serif;font-weight: 600;">{{info.reviewedBy}}</text> |
|||
<text style="margin-top:10px ; font-family: sans-serif;font-weight: 600;">{{info.date}}</text> |
|||
|
|||
</view> |
|||
|
|||
|
|||
<view style="margin-top: 50px; display: flex; flex-direction: column;"> |
|||
<text style="size: 25px;font-family: sans-serif;font-weight: 600;padding-bottom: 10px;">附件:今日回款明细</text> |
|||
<uni-table ref="table1" border stripe emptyText="暂无更多数据"> |
|||
<uni-tr> |
|||
<uni-th align="center">销售日期</uni-th> |
|||
<uni-th align="center">支付渠道</uni-th> |
|||
<uni-th align="center">金额(元)</uni-th> |
|||
<uni-th align="center">对应公司主体</uni-th> |
|||
<uni-th align="center">回款金额</uni-th> |
|||
<uni-th align="center">回款差额</uni-th> |
|||
<uni-th align="center">备注</uni-th> |
|||
</uni-tr> |
|||
<uni-tr v-for="(item, index) in tableData1" :key="index"> |
|||
<uni-td align="center">{{ item.salesDate }}</uni-td> |
|||
<uni-td align="center">{{ item.payChannels }}</uni-td> |
|||
<uni-td align="center">{{ item.money }}</uni-td> |
|||
<uni-td align="center">{{ item.mainBody }}</uni-td> |
|||
<uni-td align="center">{{ item.collection }}</uni-td> |
|||
<uni-td align="center">{{ item.different }}</uni-td> |
|||
<uni-td align="center">{{ item.notes }}</uni-td> |
|||
</uni-tr> |
|||
|
|||
</uni-table> |
|||
|
|||
</view> |
|||
|
|||
<view style="margin-top: 30px; display: flex; flex-direction: column;"> |
|||
<text style="size: 25px;font-family: sans-serif;font-weight: 600;padding-bottom: 10px;">附件:昨日销售报表</text> |
|||
|
|||
<uni-table ref="table2" border stripe emptyText="暂无更多数据"> |
|||
|
|||
<uni-tr> |
|||
<uni-th align="center">支付渠道</uni-th> |
|||
<uni-th align="center">金额(元)</uni-th> |
|||
<uni-th align="center">对应公司主体</uni-th> |
|||
<uni-th align="center">到账周期</uni-th> |
|||
</uni-tr> |
|||
<uni-tr v-for="(item, index) in tableData2" :key="index"> |
|||
<uni-td align="center">{{ item.payChannels }}</uni-td> |
|||
<uni-td align="center">{{ item.money }}</uni-td> |
|||
<uni-td align="center">{{ item.mainBody }}</uni-td> |
|||
<uni-td align="center">{{ item.cycle }}</uni-td> |
|||
</uni-tr> |
|||
|
|||
</uni-table> |
|||
</view> |
|||
|
|||
|
|||
|
|||
</view> |
|||
|
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
queryParams: { |
|||
dataDate: "2023-06-14", |
|||
companyName: "河北源蜂惠民科技集团有限公司" |
|||
}, |
|||
loading1: false, |
|||
loading2: false, |
|||
info: { |
|||
companyName: "", |
|||
totalSales: "", |
|||
collection: "", |
|||
actualCollection: "", |
|||
different: "", |
|||
endTime: "", |
|||
balance: "", |
|||
account: "", |
|||
accountNumber: "", |
|||
reviewedBy: "", |
|||
date: "", |
|||
}, |
|||
|
|||
tableData1: [ |
|||
// { |
|||
// "salesDate": "2023年6月7日", |
|||
// "payChannels": "批发-京东", |
|||
// "money": "397.09", |
|||
// "mainBody": "源蜂-汇融", |
|||
// "collection": "357.87", |
|||
// "different": "39.22", |
|||
// "notes": "6.7回小时购150.12" |
|||
// }, |
|||
], |
|||
tableData2: [ |
|||
// { |
|||
// "payChannels": "现金", |
|||
// "money": "63094.88", |
|||
// "mainBody": "-", |
|||
// "cycle": "每月19号归集" |
|||
// }, |
|||
], |
|||
|
|||
fileUrl: "" |
|||
}; |
|||
}, |
|||
onLoad(option) { |
|||
|
|||
// this.queryParams = { |
|||
// dataDate: option.dataDate, |
|||
// companyName: option.companyName |
|||
// } |
|||
|
|||
console.log('1111', this.queryParams) |
|||
this.getData() |
|||
|
|||
}, |
|||
onShow() { |
|||
wx.hideHomeButton() |
|||
}, |
|||
methods: { |
|||
|
|||
download() { |
|||
if (this.fileUrl == '') { |
|||
uni.showToast({ |
|||
title: "下载地址错误,请重新进入页面。", |
|||
duration: 5000 |
|||
}) |
|||
return |
|||
} |
|||
|
|||
uni.downloadFile({ |
|||
url: this.fileUrl, // 网络文档地址 |
|||
success: (data) => { |
|||
if (data.statusCode === 200) { |
|||
uni.saveFile({ |
|||
tempFilePath: data.tempFilePath, //临时路径 |
|||
success: function(res) { |
|||
// 保存路径 |
|||
uni.showToast({ |
|||
title: "文件已保存:" + res.savedFilePath, |
|||
duration: 5000 |
|||
}) |
|||
setTimeout(() => { |
|||
//打开文档查看 |
|||
uni.openDocument({ |
|||
filePath: res.savedFilePath, |
|||
showMenu: true, //右上角是否有可以转发分享的功能 |
|||
success: function(res) { |
|||
console.log('打开文档成功') |
|||
} |
|||
}) |
|||
}, 3000); |
|||
} |
|||
}); |
|||
} |
|||
}, |
|||
fail: (err) => { |
|||
uni.showToast({ |
|||
title: '失败请重新下载' |
|||
}); |
|||
}, |
|||
}); |
|||
|
|||
|
|||
}, |
|||
|
|||
getData() { |
|||
console.log('getData', this.queryParams) |
|||
this.$api.getReportInfo(this.queryParams).then((resp) => { |
|||
console.log('1111>>>>>>', resp) |
|||
this.fileUrl = resp.downloadUrl |
|||
this.info = resp |
|||
|
|||
}).catch(e => { |
|||
console.log('eeeee', e) |
|||
}) |
|||
|
|||
this.$api.getCsmReportTodayByComSid(this.queryParams).then((resp) => { |
|||
console.log('2222>>>>>>', resp) |
|||
this.loading1 = true |
|||
this.tableData1 = resp |
|||
|
|||
}).catch(e => { |
|||
console.log('eeeee', e) |
|||
}) |
|||
|
|||
this.$api.getCsmReportYesterdayByComSid(this.queryParams).then((resp) => { |
|||
console.log('3333>>>>>>', resp) |
|||
this.loading2 = true |
|||
this.tableData2 = resp |
|||
|
|||
}).catch(e => { |
|||
console.log('eeeee', e) |
|||
}) |
|||
}, |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
</style> |
@ -0,0 +1,349 @@ |
|||
<template> |
|||
<view class="pages"> |
|||
<uni-card title="36524快消品动产质押项目" :isFull="true" extra="点击下载Excel文件" :thumbnail="avatar" |
|||
style="padding-top: 10px;"> |
|||
<template v-slot:title> |
|||
<uni-section :title="logInfo.title" title-font-size="25" type="line"> |
|||
<template v-slot:decoration> |
|||
<uni-icons type="location-filled" size="18" color="green"></uni-icons> |
|||
</template> |
|||
<template v-slot:right> <uni-tag :inverted="true" text="下载Excel文件" type="primary" |
|||
@click="onClick" /> </template> |
|||
</uni-section> |
|||
</template> |
|||
|
|||
<view style="display: flex;flex-direction: row;"> |
|||
|
|||
<view style="flex: 1;"> |
|||
<text>上报日期:</text> |
|||
<text>{{logInfo.reportTime}}</text> |
|||
</view> |
|||
|
|||
<view style="flex: 1;"> |
|||
<text>货值总计:</text> |
|||
<text>{{logInfo.countAmount}}</text> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
<!-- <uni-list> |
|||
<uni-list-item title="上报日期:" :rightText="logInfo.reportTime"></uni-list-item> |
|||
<uni-list-item title="货值总计:" :right-text="logInfo.countAmount"></uni-list-item> |
|||
</uni-list> --> |
|||
|
|||
<view v-for="(item, index) in tableData1" style="margin-top: 10px;"> |
|||
<view> |
|||
<uni-title type="h3" :title="item.storeType" color="#444"></uni-title> |
|||
<uni-row> |
|||
<uni-col :span="8"> |
|||
<view class="table-header tleft"><text>仓库数量</text></view> |
|||
</uni-col> |
|||
<uni-col :span="8"> |
|||
<view class="table-header"><text>品种数量</text></view> |
|||
</uni-col> |
|||
<uni-col :span="8"> |
|||
<view class="table-header"><text>品种货值</text></view> |
|||
</uni-col> |
|||
</uni-row> |
|||
<uni-row> |
|||
<uni-col :span="8"> |
|||
<view class="table-body tleft"><text>{{item.storeNumber}}</text></view> |
|||
</uni-col> |
|||
<uni-col :span="8"> |
|||
<view class="table-body"><text>{{item.productCountNumber}}</text></view> |
|||
</uni-col> |
|||
<uni-col :span="8"> |
|||
<view class="table-body"><text>{{item.productAmount}}</text></view> |
|||
</uni-col> |
|||
</uni-row> |
|||
|
|||
</view> |
|||
</view> |
|||
|
|||
</uni-card> |
|||
|
|||
<uni-collapse style="margin-top: 10px;"> |
|||
|
|||
<uni-collapse-item title="仓库库存明细表" style="font-size: 18px;" :open="true"> |
|||
|
|||
<view style="display: flex;flex-direction: row;margin-left: 16px;"> |
|||
|
|||
<view style="flex: 1;"> |
|||
<text>商品数量合计:</text> |
|||
<text>{{logInfo2.countProductNumber}}</text> |
|||
</view> |
|||
|
|||
<view style="flex: 1;"> |
|||
<text>商品货值合计:</text> |
|||
<text>{{logInfo2.countAmount}}</text> |
|||
</view> |
|||
|
|||
</view> |
|||
<view class="ttbale" style="margin-top: 10px;"> |
|||
<uni-row> |
|||
<uni-col :span="8"> |
|||
<view class="table-header tleft"><text>序号</text></view> |
|||
</uni-col> |
|||
<uni-col :span="16"> |
|||
<view class="table-header"><text>仓库名称</text></view> |
|||
</uni-col> |
|||
</uni-row> |
|||
<uni-row> |
|||
<uni-col :span="8"> |
|||
<view class="table-header tleft"><text>商品数量</text></view> |
|||
</uni-col> |
|||
<uni-col :span="8"> |
|||
<view class="table-header"><text>商品品种数量</text></view> |
|||
</uni-col> |
|||
<uni-col :span="8"> |
|||
<view class="table-header"><text>货值</text></view> |
|||
</uni-col> |
|||
</uni-row> |
|||
</view> |
|||
|
|||
<view v-for="(item, index) in tableData2"> |
|||
|
|||
<view class="ttbale"> |
|||
<uni-row> |
|||
<uni-col :span="8"> |
|||
<view class="table-body tleft"><text>{{index+1}}</text></view> |
|||
</uni-col> |
|||
<uni-col :span="16"> |
|||
<view class="table-body"><text>{{item.storeCodeName}}</text></view> |
|||
</uni-col> |
|||
</uni-row> |
|||
<uni-row> |
|||
<uni-col :span="8"> |
|||
<view class="table-body tleft"><text>{{ item.productCountNumber}}</text></view> |
|||
</uni-col> |
|||
<uni-col :span="8"> |
|||
<view class="table-body"><text>{{item.typeNumber}}</text></view> |
|||
</uni-col> |
|||
<uni-col :span="8"> |
|||
<view class="table-body"><text>{{item.productAmount}}</text></view> |
|||
</uni-col> |
|||
</uni-row> |
|||
</view> |
|||
</view> |
|||
|
|||
</uni-collapse-item> |
|||
|
|||
<uni-collapse-item title="烟草库存明细表" style="font-size: 18px;" :open="true"> |
|||
|
|||
<view style="display: flex;flex-direction: row;margin-left: 16px;"> |
|||
|
|||
<view style="flex: 1;"> |
|||
<text>商品数量合计:</text> |
|||
<text>{{logInfo3.countProductNumber}}</text> |
|||
</view> |
|||
|
|||
<view style="flex: 1;"> |
|||
<text>商品货值合计:</text> |
|||
<text>{{logInfo3.countAmount}}</text> |
|||
</view> |
|||
|
|||
</view> |
|||
<view class="ttbale" style="margin-top: 10px;"> |
|||
<uni-row> |
|||
<uni-col :span="8"> |
|||
<view class="table-header tleft"><text>序号</text></view> |
|||
</uni-col> |
|||
<uni-col :span="16"> |
|||
<view class="table-header"><text>仓库名称</text></view> |
|||
</uni-col> |
|||
</uni-row> |
|||
<uni-row> |
|||
<uni-col :span="8"> |
|||
<view class="table-header tleft"><text>商品数量</text></view> |
|||
</uni-col> |
|||
<uni-col :span="8"> |
|||
<view class="table-header"><text>商品品种数量</text></view> |
|||
</uni-col> |
|||
<uni-col :span="8"> |
|||
<view class="table-header"><text>货值</text></view> |
|||
</uni-col> |
|||
</uni-row> |
|||
</view> |
|||
|
|||
<view v-for="(item, index) in tableData3"> |
|||
|
|||
<view class="ttbale"> |
|||
<uni-row> |
|||
<uni-col :span="8"> |
|||
<view class="table-body tleft"><text>{{index+1}}</text></view> |
|||
</uni-col> |
|||
<uni-col :span="16"> |
|||
<view class="table-body"><text>{{item.storeCodeName}}</text></view> |
|||
</uni-col> |
|||
</uni-row> |
|||
<uni-row> |
|||
<uni-col :span="8"> |
|||
<view class="table-body tleft"><text>{{ item.productCountNumber}}</text></view> |
|||
</uni-col> |
|||
<uni-col :span="8"> |
|||
<view class="table-body"><text>{{item.typeNumber}}</text></view> |
|||
</uni-col> |
|||
<uni-col :span="8"> |
|||
<view class="table-body"><text>{{item.productAmount}}</text></view> |
|||
</uni-col> |
|||
</uni-row> |
|||
</view> |
|||
</view> |
|||
|
|||
|
|||
</uni-collapse-item> |
|||
|
|||
|
|||
</uni-collapse> |
|||
|
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
components: {}, |
|||
data() { |
|||
return { |
|||
date: "2023-06-25", |
|||
tableData1: [], |
|||
logInfo: { |
|||
title: "", |
|||
reportTime: "", |
|||
countAmount: "", |
|||
}, |
|||
tableData2: [], |
|||
logInfo2: { |
|||
countProductNumber: "", |
|||
countAmount: "", |
|||
}, |
|||
tableData3: [], |
|||
logInfo3: { |
|||
countProductNumber: "", |
|||
countAmount: "", |
|||
}, |
|||
|
|||
|
|||
} |
|||
}, |
|||
onLoad(option) { |
|||
|
|||
// this.date = option.orderDate |
|||
|
|||
// console.log('1111', this.queryParams) |
|||
this.getData() |
|||
|
|||
|
|||
|
|||
}, |
|||
methods: { |
|||
onClick(e) { |
|||
uni.showToast({ |
|||
title: '点击下载文件', |
|||
duration: 2000 |
|||
}); |
|||
console.log(e) |
|||
}, |
|||
actionsClick(text) { |
|||
uni.showToast({ |
|||
title: text, |
|||
icon: 'none' |
|||
}) |
|||
}, |
|||
getData() { |
|||
console.log('getData', this.date) |
|||
this.$api.getReportInventoryDayGather(this.date).then((resp) => { |
|||
console.log('1111>>>>>>', resp) |
|||
this.fileUrl = resp.downloadUrl |
|||
this.tableData1 = resp.list |
|||
this.logInfo = { |
|||
title: resp.title, |
|||
reportTime: resp.orderDate, |
|||
countAmount: resp.countAmount, |
|||
} |
|||
|
|||
}).catch(e => { |
|||
console.log('eeeee', e) |
|||
}) |
|||
|
|||
this.$api.getReportInventoryDayStore(this.date).then((resp) => { |
|||
console.log('2222>>>>>>', resp) |
|||
this.tableData2 = resp.list |
|||
this.logInfo2 = { |
|||
countProductNumber: resp.countProductNumber, |
|||
countAmount: resp.countAmount, |
|||
} |
|||
}).catch(e => { |
|||
console.log('eeeee', e) |
|||
}) |
|||
|
|||
this.$api.getReportInventoryDayToStore(this.date).then((resp) => { |
|||
console.log('3333>>>>>>', resp) |
|||
this.tableData3 = resp.list |
|||
this.logInfo3 = { |
|||
countProductNumber: resp.countProductNumber, |
|||
countAmount: resp.countAmount, |
|||
} |
|||
}).catch(e => { |
|||
console.log('eeeee', e) |
|||
}) |
|||
}, |
|||
|
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
.pages {} |
|||
|
|||
$uni-success: #18bc37 !default; |
|||
|
|||
.table-header { |
|||
text-align: center; |
|||
border: 0.5px solid #ccc; |
|||
font-weight: bold; |
|||
font-size: 15px; |
|||
border-left: 0.0px; |
|||
padding: 5px; |
|||
} |
|||
|
|||
.table-body { |
|||
text-align: center; |
|||
border: 0.5px solid #ccc; |
|||
font-size: 13px; |
|||
padding: 5px; |
|||
border-left: 0.0px; |
|||
border-top: 0.0px; |
|||
} |
|||
|
|||
.tleft { |
|||
border-left: 0.5px solid #ccc; |
|||
} |
|||
|
|||
.ttbale { |
|||
margin: 0px 10px 0px 10px; |
|||
// border-bottom: 1px solid #ccc; |
|||
} |
|||
|
|||
.uni-wrap { |
|||
flex-direction: column; |
|||
/* #ifdef H5 */ |
|||
height: calc(100vh - 44px); |
|||
/* #endif */ |
|||
/* #ifndef H5 */ |
|||
height: 100vh; |
|||
/* #endif */ |
|||
flex: 1; |
|||
} |
|||
|
|||
.mb-10 { |
|||
margin-bottom: 10px; |
|||
} |
|||
|
|||
.decoration { |
|||
width: 8px; |
|||
height: 8px; |
|||
margin-right: 4px; |
|||
border-radius: 50%; |
|||
background-color: $uni-success; |
|||
} |
|||
</style> |
@ -0,0 +1,247 @@ |
|||
<template> |
|||
<view class="charts-box" style="padding-bottom: 50px;"> |
|||
|
|||
<view class="top" style="margin-top: 15px;"> |
|||
<text>企业名称:</text> |
|||
<text>{{queryParams.businessName}}</text> |
|||
</view> |
|||
<view class="top"> |
|||
<text>核查日期:</text> |
|||
<text>{{queryParams.executionTime}}</text> |
|||
</view> |
|||
<view class="top"> |
|||
<text>核查结果:</text> |
|||
<text>{{result}}</text> |
|||
</view> |
|||
|
|||
<view v-show="isShow"> |
|||
|
|||
<view class="top"> |
|||
<text>异常信息详情:</text> |
|||
</view> |
|||
|
|||
<block v-for="item in list" :key="item.index"> |
|||
<!-- 包裹图片+两行文字 id="{{index}}"是给按下了那个item记录--> |
|||
<view class="view_tupian_wenzi" @click="clickData(item.index)"> |
|||
<!-- 包裹两行文字 --> |
|||
<view class="view_wenzi2"> |
|||
<view class="top2"> |
|||
<text>列入日期:</text> |
|||
<text>{{item.addDate}}</text> |
|||
</view> |
|||
<view class="top2"> |
|||
<text>列入经营异常名录原因:</text> |
|||
<text>{{item.addReason}}</text> |
|||
</view> |
|||
<view class="top2"> |
|||
<text>作出决定机关:</text> |
|||
<text>{{item.decisionOffice}}</text> |
|||
</view> |
|||
<view class="top2"> |
|||
<text>移出日期:</text> |
|||
<text>{{item.removeDate}}</text> |
|||
</view> |
|||
<view class="top2"> |
|||
<text>移出经营异常名录原因:</text> |
|||
<text>{{item.romoveReason}}</text> |
|||
</view> |
|||
<view class="top2"> |
|||
<text>移出决定机关:</text> |
|||
<text>{{item.removeDecisionOffice}}</text> |
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
|
|||
</block> |
|||
|
|||
|
|||
</view> |
|||
|
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
title: "", |
|||
result: "", |
|||
isShow: false, |
|||
queryParams: { |
|||
businessName: "", |
|||
executionTime: "" |
|||
}, |
|||
list: [], |
|||
fileUrl:"", |
|||
}; |
|||
}, |
|||
onLoad(option) { |
|||
|
|||
// var data = JSON.stringify(option) |
|||
|
|||
this.queryParams = { |
|||
businessName: option.businessName, |
|||
executionTime: option.executionTime |
|||
} |
|||
|
|||
console.log('1111', this.queryParams) |
|||
|
|||
// this.setData({ |
|||
// queryParams: JSON.stringify(option) |
|||
// }) |
|||
|
|||
// console.log('setData', this.queryParams) |
|||
this.getData() |
|||
|
|||
// console.log('App onLoad', JSON.stringify(option)) |
|||
// this.title = JSON.stringify(option) |
|||
// wx.showToast({ |
|||
// title: 'onLoad成功>>>>>' + JSON.stringify(option), |
|||
// icon: 'none', |
|||
// duration: 5000 //持续的时间 |
|||
// }) |
|||
|
|||
}, |
|||
onShow() { |
|||
wx.hideHomeButton() |
|||
}, |
|||
methods: { |
|||
download() { |
|||
uni.downloadFile({ |
|||
url: this.fileUrl,// 网络文档地址 |
|||
success: (data) => { |
|||
if (data.statusCode === 200) { |
|||
uni.saveFile({ |
|||
tempFilePath: data.tempFilePath, //临时路径 |
|||
success: function(res) { |
|||
// 保存路径 |
|||
uni.showToast({ title: "文件已保存:"+res.savedFilePath,duration:5000 }) |
|||
setTimeout(()=>{ |
|||
//打开文档查看 |
|||
uni.openDocument({ |
|||
filePath:res.savedFilePath, |
|||
showMenu: true,//右上角是否有可以转发分享的功能 |
|||
success:function(res){ |
|||
console.log('打开文档成功') |
|||
} |
|||
}) |
|||
}, 3000); |
|||
} |
|||
}); |
|||
} |
|||
}, |
|||
fail: (err) => { |
|||
uni.showToast({ |
|||
title: '失败请重新下载' |
|||
}); |
|||
}, |
|||
}); |
|||
|
|||
|
|||
}, |
|||
getData() { |
|||
console.log('getData', this.queryParams) |
|||
this.$api.selectBusinessRiskInfo(this.queryParams).then((resp) => { |
|||
console.log('1111>>>>>>', resp) |
|||
this.list = resp |
|||
console.log('2222>>>>>>', this.list.length) |
|||
this.result = this.list.length == 0 ? "无异常信息" : "共有" + this.list.length + "条异常信息" |
|||
this.isShow = this.list.length == 0 ? false : true |
|||
|
|||
}).catch(e => { |
|||
console.log('eeeee', e) |
|||
}) |
|||
}, |
|||
clickData(e) { |
|||
console.log("按了:", e.currentTarget.id) |
|||
} |
|||
|
|||
|
|||
}, |
|||
|
|||
}; |
|||
</script> |
|||
|
|||
<style lang="scss"> |
|||
.top { |
|||
margin-left: 25px; |
|||
margin-top: 5px; |
|||
} |
|||
|
|||
/* 包裹图片和两行文字 */ |
|||
|
|||
.view_tupian_wenzi { |
|||
display: flex; |
|||
flex-direction: row; |
|||
align-items: center; |
|||
|
|||
/* 圆角 */ |
|||
border-radius: 20rpx; |
|||
|
|||
/* 边 */ |
|||
border: 3rpx solid #E0E3DA; |
|||
box-shadow: 5rpx 5rpx 5rpx 5rpx #E0E3DA; |
|||
|
|||
background-color: #ffffff; |
|||
margin: 30rpx; |
|||
|
|||
/* padding使得文字和图片不至于贴着边框 */ |
|||
padding: 30rpx; |
|||
|
|||
} |
|||
|
|||
/* 图片 */ |
|||
|
|||
.image_1 { |
|||
width: 100rpx; |
|||
height: 100rpx; |
|||
} |
|||
|
|||
/* 包裹两行文字 */ |
|||
|
|||
.view_wenzi2 { |
|||
|
|||
width: 100%; |
|||
margin-left: 25rpx; |
|||
display: flex; |
|||
flex-direction: column; |
|||
|
|||
.top2 { |
|||
margin-top: 5px; |
|||
} |
|||
|
|||
.text1 { |
|||
font-size: 15px; |
|||
overflow: hidden; |
|||
text-overflow: ellipsis; |
|||
display: -webkit-box; |
|||
-webkit-line-clamp: 1; |
|||
-webkit-box-orient: vertical; |
|||
} |
|||
|
|||
.text2 { |
|||
flex: 1; |
|||
margin-top: 5px; |
|||
font-size: 12px; |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
/* 小字 */ |
|||
|
|||
.text_small { |
|||
font-size: 30rpx; |
|||
word-break: break-all; |
|||
color: #7a7878; |
|||
margin-top: 10rpx |
|||
} |
|||
|
|||
.text_small2 { |
|||
font-size: 25rpx; |
|||
color: #f00; |
|||
margin-top: 10rpx |
|||
} |
|||
</style> |
@ -1,61 +0,0 @@ |
|||
<template> |
|||
<view class="app-container"> |
|||
<view class="intro">创建APP或小程序的脚手架</view> |
|||
<uni-title type="h2" title="VUEX-token" align="center"></uni-title> |
|||
<view>{{ $store.getters.token }}</view> |
|||
<uni-title type="h2" title="全局变量" align="center"></uni-title> |
|||
<view v-for="(va, k) in gv" :key="k">{{ k }}--{{ va }}</view> |
|||
<uni-link :href="href" :text="href"></uni-link> |
|||
<button @click="sayhello">sayhello</button> |
|||
<text>reinfo: {{ resinfo }}</text> |
|||
<button @click="logout">logout</button> |
|||
<button @click="gologin">gologin</button> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
data() { |
|||
return { |
|||
href: '', |
|||
gv: {}, |
|||
resinfo: '' |
|||
} |
|||
}, |
|||
onLoad() { |
|||
this.initData() |
|||
}, |
|||
methods: { |
|||
initData() { |
|||
this.gv = getApp().globalData |
|||
console.log('hasLogin', this.$store.getters.hasLogin) |
|||
console.log('token', this.$store.getters.token) |
|||
console.log('uinfo', this.$store.getters.userinfo) |
|||
console.log('uinfo-id', this.$store.getters.userinfo.userid) |
|||
console.log('uinfo-name', this.$store.getters.userinfo.name) |
|||
getApp().globalData.uinfo = this.$store.getters.userinfo |
|||
}, |
|||
sayhello() { |
|||
this.$api.sayhello({name:'mynameislll'}).then(res => { |
|||
this.resinfo = res |
|||
}) |
|||
}, |
|||
logout() { |
|||
this.$store.dispatch('logout').then(() => { |
|||
console.log('NNNN:退出 ') |
|||
}) |
|||
}, |
|||
gologin() { |
|||
uni.reLaunch({ url: '/pages/login/index' }) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style> |
|||
.container { |
|||
padding: 20px; |
|||
font-size: 14px; |
|||
line-height: 24px; |
|||
} |
|||
</style> |
@ -0,0 +1,334 @@ |
|||
<template> |
|||
<view style="padding: 30rpx;"> |
|||
<p style="text-align:center"> |
|||
<span style=";font-family:黑体;font-size:21px">汇融云仓贷后程序隐私政策</span> |
|||
</p> |
|||
<p style="text-indent:28px; margin-top: 20rpx;"> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
<span style="font-family:微软雅黑">欢迎使用由汇融云仓贷后</span> |
|||
</span> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px">。</span> |
|||
</p> |
|||
<p style="text-indent:28px"> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
请您务必仔细阅读和理解以下条款。若您一旦接受我公司产品或服务,则表示您同意接受我公司约定的以下各项条款的约束。若您不接受以下条款,请您立即停止使用我公司的产品及服务。 |
|||
</span> |
|||
</p> |
|||
<p style="text-indent:28px"> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
<span style="font-family:微软雅黑"> |
|||
为了使您充分理解本协议,本协议中与您的权益存在或可能存在重大关系的部分,我们已采用下划线、加粗等方式提示您注意。您点击 |
|||
</span> |
|||
"确认"或进行类似操作后,即表示您已同意我们按照本协议来使用和保护您的信息。 |
|||
</span> |
|||
</p> |
|||
<p><span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px">一、声明与承诺</span></p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
(一)您理解并承诺,在您接受我公司的产品或服务前,您已充分阅读、理解并接受本协议的全部内容,您接受我公司的产品或服务,即表示您同意遵循本协议之所有约定。您理解并同意本协议规定的内容,并对相关法律法规有适当的了解,如您不能清楚地知晓或理解国家相关法律法规规定的内容,您应当咨询相关法律专业人士后再决定是否接受本协议。 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
(二)您在此确认知悉并同意,我公司有权依据国家法律法规及运营需求,对本协议条款不时地进行修改。我公司如更新本协议相关条款,将采用在“一诺云网”(www.enuoyun |
|||
.com)上公布,通知您该等修改、增加或删减的内容,以便您随时了解我公司产品或服务对您信息资料的收集和使用方法。一经公告,即视为上述内容已经通知到您。若您在本协议及各类规则变更后继续使用我公司产品或服务的,视为您已仔细认真阅读、充分理解并同意接受修改后的协议条款及各类规则。您有义务不时关注并阅读最新版的协议及网站公告等。如您不同意更新后的协议,应立即停止接受我公司产品或服务,否则视为您同意接受更新后的协议。 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
(三)您保证,作为自然人,在您同意接受本协议时,您已经年满16周岁;作为企业、事业单位等组织,您在中华人民共和国(“中国”)大陆地区(不含香港、台湾、澳门地区)合法开展经营活动或其他业务,或依照中国大陆地区(不含香港、台湾、澳门地区)法律登记注册成立;本协议内容不受您所属国家或地区法律的约束。不具备前述条件的,您应立即停止使用本软件提供的服务。 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
(四)我公司为遵守国家法律法规、向您提供服务、保护您的隐私及提升服务质量的目的,将按照本协议收集、使用您的信息(包括但不限于我公司认为了解您的需求和开展业务所必需的相关资料),本协议包含了我们收集、存储、保护、使用您的信息的条款,请您完整地阅读本协议项下各条款。 |
|||
</span> |
|||
</p> |
|||
<p><span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px">二、信息收集</span></p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
您在此不可撤销地同意并授权我公司收集以下信息: |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
1.在您使用或接受我公司产品或服务时,我们会获取您的信息,包括但不限于基本信息、企业经营、商务交易信息等。 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
2.设备信息:我公司产品或服务会接收并记录您所使用的设备相关信息(例如设备型号、操作系统版本、设备设置、唯一设备标识符、设备环境等软硬件特征信息)、设备所在位置相关信息(例如IP |
|||
地址、GPS位置以及能够提供相关信息的WLAN接入点、蓝牙和基站等传感器信息)及您所授予的设备权限使用所获信息。 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
3.服务日志信息:当您接受我公司提供的产品或服务时,我们会自动收集您对我们服务的详细使用情况,作为有关网络日志保存。例如搜索查询内容、IP地址、浏览器的类型、电信运营商、使用的语言、访问日期和时间及您访问的网页记录等。 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
4.发票信息:当您接受我公司提供的产品或服务时,我们会收集您在使用我公司产品或服务时,主动提供的以及通过自动化方式收集您在使用功能或接受服务过程中产生的增值税发票信息,以及开具增值税发票需要的业务信息。 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
5.为了更好地为您提供服务,经您授权通过合法途径从我公司产品或我公司提供的服务过程中获取的其他您信息。 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
6.在法律、行政法规允许的范围内采集的您的您信息。 |
|||
</span> |
|||
</p> |
|||
<p><span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px">三、除外信息</span></p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
您了解并同意,以下信息属于您自愿、主动在公开领域传播的信息,我公司存储、使用以下信息无需您授权: |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
1)您在使用我公司产品提供的搜索服务时,输入的关键字信息; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
2)您在使用我公司产品或接受我公司服务时所产生的信息; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
3)您违反法律规定或违反我公司产品规则的行为,以及我公司已对您采取的措施。 |
|||
</span> |
|||
</p> |
|||
<p><span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px">四、信息使用</span></p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
一旦您使用我公司的产品或服务,我公司即有权依照自行设立的模型、模式、格式、规则、流程等对您的您信息进行整理、保存、加工。 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
我公司将以高度的勤勉、审慎义务对待您信息,您不可撤销地授权并同意我公司将收集到的您信息用于以下用途: |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
1)将信息进行整合和处理,以便更好地为您提供服务,并依此对我公司的产品或服务进行改进,保存、整理、加工您信息; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
2)为达到服务您的目的,我公司可能通过使用您信息,向您提供您感兴趣的通知、营销活动及其他商业性电子信息; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
3)经您明确同意并授权的其他用途; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
4)除本协议明确阐述和相关法律法规规定外,我公司不会向任何无关第三方提供、出售、出租或交易您的信息; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
5)我公司不允许任何第三方以任何手段收集、编辑、出售或者传播您的信息。如您从事上述活动,一经发现,我公司有权立即终止与该您的服务协议,并要求赔偿相应损失。 |
|||
</span> |
|||
</p> |
|||
<p><span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px">五、信息保护</span></p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
我们致力于维护您对我公司的产品或服务的信任,因此我公司会使用商业上合理的技术和其他措施,防止您信息的丢失和被盗用,并对您信息的保护情况不定期进行自查,记录自查情况,以便及时消除自查中发现的安全隐患。为尽可能地保护您的信息安全,我公司提请您注意: |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
1)我公司的产品账号均有安全保护功能,请妥善保管您的账号及密码信息。我公司将通过对您密码进行加密等安全措施确保您的信息不丢失,不被滥用和变造。尽管有前述安全措施,但同时也请您注意在信息网络上不存在“完善的安全措施”,您信息仍存在丢失、被盗用的可能,非因我公司过错而发生上述情况,我公司不承担任何责任; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
2)请您妥善保护自己的信息,仅在必要的情形下向他人提供。如您发现信息泄露,尤其是您的账户及密码发生泄露,请您立即联络客服,以便采取相应措施。 |
|||
</span> |
|||
</p> |
|||
<p><span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px">六、服务使用限制</span></p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
(一)您在使用我公司产品或服务时,应遵守中华人民共和国相关法律法规,不将本服务用于任何非法目的,也不以任何非法方式使用我公司产品或服务。 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
(二)您不得利用我公司产品或服务从事侵害他人合法权益之行为, |
|||
否则我们有权拒绝提供相关服务,且您应承担所有相关法律责任,因此导致我公司受损的,您应承担赔偿责任。 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
(三)您理解并同意,我公司不对因下述任一情况导致的任何损害赔偿承担责任,包括但不限于利润、商誉、数据等方面的损失或其他无形损失的损害赔偿(无论我公司是否已被告知该等损害赔偿的可能性): |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
1、如果您违反本协议的明文规定及精神,我们可能对您暂停、中断或终止提供本服务或其任何部分,但我们会在法律允许的范围内继续持有、保存您的您信息与使用本服务的记录。 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
2、在发现我公司产品或服务被异常使用,或对我公司产品或服务的使用有合理疑义,或对我公司产品或服务的使用有违反法律规定或本协议约定之虞时,我公司有权不经通知先行暂停或终止您对于本服务使用。具体可能导致暂停或终止本软件服务的情形包括但不限于: |
|||
</span> |
|||
</p> |
|||
<p><span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> 1)根据本协议的约定;</span></p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
2)根据法律法规及法律文书的规定; |
|||
</span> |
|||
</p> |
|||
<p><span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> 3)根据有权机关的要求;</span></p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
4)您使用我公司的产品或服务的行为涉嫌违反国家法律法规及行政规定的; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
5)本公司依据自行合理判断认为可能产生风险的; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
6)您遭到他人投诉,且对方已经提供了一定证据的。 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
(四)若您停止使用我公司的产品或服务,我公司仍可能保有您的相关信息。 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
(五)禁止反向工程、反向编译和反向汇编:您不得对本软件产品进行反向工程(ReverseEngineer)、反向编译(Decompile)或反向汇编(Disassemble),同时不得改动编译在程序文件内部的任何资源。除法律、法规明文规定允许上述活动外,您必须遵守此协议限制。 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
(六) |
|||
组件分割:我公司的产品或服务是作为一个单一产品而被授予许可使用,您不得将各个部分分开用于任何目的。 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
(七)个别授权:如需进行商业性的销售、复制、分发,包括但不限于软件销售、预装、捆绑等,必须获得我公司的书面授权和许可。 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
(八)保留权利:本协议未明示授权的其他一切权利仍归我公司所有,您使用其他权利时必须获得我公司的书面同意。 |
|||
</span> |
|||
</p> |
|||
<p><span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px">七、信息披露</span></p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
我公司对您提供的信息严格保密,除具备下列情形外,不会向任何外部机构披露: |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
1)经过您事先同意而对外披露的您信息; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
2)应法律法规或公权力部门(如法院、政府部门、上级监管机构等执法机构)的要求而披露的您信息; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
3)当我公司涉及合并、收购或资产出售等重大交易时,我公司有权依据交易的需要将您信息提供给交易相对方及交易各方聘请的各中介机构(包括但不限于律师、会计师等),我们会在任何信息进行转让或受其他隐私权政策约束之前,继续确保其保密性并及时通知受影响方; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
4)我公司可能会为了保护我公司产品自身、我公司员工和客户、我公司合作伙伴和其他公众的合法权利、利益和安全而披露您的信息; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
<span style="font-family:微软雅黑">八、</span> |
|||
Cookies的使用 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
1)在您未拒绝接受cookies的情况下,我公司的产品或服务会在您的客户端设定或取用cookies,以便您能登录或使用依赖于cookies的产品或服务。我公司的产品或服务使用cookies可为您提供更加周到的个性化服务,包括推广服务; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
2)您有权选择接受或拒绝接受cookies。您可以通过修改设置的方式拒绝接受cookies。但如果您选择拒绝接受cookies,则您可能无法登录或使用依赖于cookies的产品的网络服务或功能; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
3)通过我公司的产品或服务所设cookies所取得的有关信息,将适用本协议。 |
|||
</span> |
|||
</p> |
|||
<p><span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px">九、法律管辖和适用</span></p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
本协议的订立、履行和解释及争议的解决均应适用中华人民共和国大陆地区适用之有效法律(但不包括其冲突法规则)。协议履行期间,凡因本协议引起的或与本协议有关的一切争议、纠纷,双方应首先友好协商解决;协商不成,您在此完全同意将纠纷或争议提交被告住所地人民法院管辖。 |
|||
</span> |
|||
</p> |
|||
<p><span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px">十、其他</span></p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
1)因台风、地震、海啸、洪水、战争、计算机病毒感染、黑客攻击、网络通信故障等不能预见、不能控制的不可抗力因素,造成本我公司产品不能正常向您提供服务而可能导致的损失,我公司不承担责任; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
2)您理解并同意,鉴于网络服务的特殊性,本协议可在您接受我公司产品或服务的过程中多次使用,未来为您提供服务时再次涉及到本协议服务内容时无需您另行签署; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
3)知识产权,与我公司产品及服务相关的任何内容和资源的知识产权均属于我公司所有。未经我公司书面明确许可,任何单位和个人不得以任何方式将我公司产品或服务之内容和相关资源作全部或部分复制、转载、引用、编辑; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
4)我公司产品或服务仅在您接受本协议条款并依此提供您信息且授权我公司产品按照上述条款的规定获取您信息的基础上提供服务,如您不同意本协议条款或不同意进行相应操作,则您将无法使用我公司产品的全部服务或相应部分服务; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
5)若本协议中任何一条无论因何种原因完全或部分无效或不具有执行力,本协议的其他条款仍继续有效; |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
6)您在本协议项下对我公司的产品或服务的授权,将视为对我公司的授权。 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
7)您如需更正所提供的信息,或希望停止接受我公司的产品或服务,或对本协议有任何疑问,请通过联系我公司在线客服或直接拨打客服电话: |
|||
95113 的途径联系处理。 |
|||
</span> |
|||
</p> |
|||
<p> |
|||
<span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> |
|||
8)我公司对本协议有最终解释权。 |
|||
</span> |
|||
</p> |
|||
<p><span style="font-family: 微软雅黑;letter-spacing: 0;font-size: 14px"> </span></p> |
|||
<p><br /></p> |
|||
</view> |
|||
</template> |
|||
|
|||
<script></script> |
|||
|
|||
<style></style> |
@ -0,0 +1,106 @@ |
|||
# APP版本更新、强制更新、漂亮的更新界面、IOS更新(跳转IOS store)、wgt更新 |
|||
|
|||
### QQ交流群(学习干货多多) 607391225 |
|||
 |
|||
|
|||
### 常见问题 |
|||
1.安卓apk下载完成后没有更新APP? |
|||
|
|||
答:问题是因为没有添加APP安装应用的权限,解决方法在`manifest.json`文件里面`APP模块权限配置`的`Android打包权限配置`勾选以下权限 |
|||
``` |
|||
<uses-permission android:name=\"android.permission.INSTALL_PACKAGES\"/> |
|||
<uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\"/> |
|||
``` |
|||
若还有问题请看[安装apk无法执行的解决方案](https://ask.dcloud.net.cn/article/35703 "安装apk无法执行的解决方案") |
|||
|
|||
2.APP更新后版本号没变,还是之前的版本号? |
|||
|
|||
答:可能是更新的安装包没有升级版本号,`manifest.json`文件里面基本设置`应用版本号`和`应用版本名称`需要升高 |
|||
|
|||
3.APP更新后没有覆盖之前的APP? |
|||
|
|||
答:可能是更新的安装包`包名`和APP的`包名`不一样 |
|||
|
|||
### 第一步配置APP更新接口 |
|||
在`APPUpdate.js`里面`getServerNo`函数方法配置更新接口 |
|||
``` |
|||
let httpData = { |
|||
version:version |
|||
}; |
|||
if (platform == "android") { |
|||
httpData.type = 1101; |
|||
} else { |
|||
httpData.type = 1102; |
|||
} |
|||
/* 接口入参说明 |
|||
* version: 应用当前版本号(已自动获取) |
|||
* type:平台(1101是安卓,1102是IOS) |
|||
*/ |
|||
$http.get("api/kemean/aid/app_version", httpData).then(res => { |
|||
/*接口出参说明 (res数据说明) |
|||
* | 参数名称 | 一定返回 | 类型 | 描述 |
|||
* | -------------|--------- | --------- | ------------- | |
|||
* | versionCode | y | int | 版本号 | |
|||
* | versionName | y | String | 版本名称 | |
|||
* | versionInfo | y | String | 版本信息 \n 换行(例如:1.修改了bug1 \n 2.修改了bug2 \n 3.修改了bug3) | |
|||
* | forceUpdate | y | boolean | 是否强制更新 | |
|||
* | downloadUrl | y | String | 版本下载链接 `IOS安装包更新请放跳转store应用商店链接,安卓apk和wgt文件放文件下载链接` | |
|||
*/ |
|||
}); |
|||
``` |
|||
|
|||
### 第二步 使用方法 |
|||
``` |
|||
// App.vue页面 |
|||
|
|||
// #ifdef APP-PLUS |
|||
import APPUpdate from "@/plugins/APPUpdate"; |
|||
// #endif |
|||
|
|||
onLaunch: function(e) { |
|||
// #ifdef APP-PLUS |
|||
APPUpdate(); |
|||
// #endif |
|||
} |
|||
``` |
|||
|
|||
### 第三步 添加APP安装应用的权限 |
|||
在`manifest.json`文件里面`APP模块权限配置`的`Android打包权限配置`勾选以下权限 |
|||
``` |
|||
<uses-permission android:name=\"android.permission.INSTALL_PACKAGES\"/> |
|||
<uses-permission android:name=\"android.permission.REQUEST_INSTALL_PACKAGES\"/> |
|||
``` |
|||
|
|||
### 修改弹窗的主题色或弹窗图标 |
|||
在`APPUpdate.js`里面上面`$mainColor`常量中定义主题颜色,`$iconUrl`常量中定义图标地址 |
|||
|
|||
### 检查APP是否有新版本(一般在设置页面使用) |
|||
``` |
|||
// #ifdef APP-PLUS |
|||
import APPUpdate, { getCurrentNo } from "@/plugins/APPUpdate"; |
|||
// #endif |
|||
export default { |
|||
data() { |
|||
return { |
|||
version: "" // 版本号 |
|||
}; |
|||
}, |
|||
//第一次加载 |
|||
onLoad(e) { |
|||
// #ifdef APP-PLUS |
|||
getCurrentNo(res => { |
|||
// 进页面获取当前APP版本号(用于页面显示) |
|||
this.version = res.version; |
|||
}); |
|||
// #endif |
|||
}, |
|||
//方法 |
|||
methods: { |
|||
// 检查APP是否有新版本 |
|||
onAPPUpdate() { |
|||
// true 没有新版本的时候有提示,默认:false |
|||
APPUpdate(true); |
|||
} |
|||
} |
|||
} |
|||
``` |
@ -0,0 +1,829 @@ |
|||
// #ifdef APP-PLUS
|
|||
// import $api from '@/common/api';
|
|||
import $http from '@/utils/requester.js'; |
|||
const platform = uni.getSystemInfoSync().platform; |
|||
// 主颜色
|
|||
const $mainColor = "FF5B78"; |
|||
// 弹窗图标url
|
|||
const $iconUrl = "/static/ic_ar.png"; |
|||
// 获取当前应用的版本号
|
|||
export const getCurrentNo = function(callback) { |
|||
// 获取本地应用资源版本号
|
|||
console.log("》》》》", 11111111111111111); |
|||
plus.runtime.getProperty(plus.runtime.appid, function(inf) { |
|||
callback && callback({ |
|||
versionCode: inf.version.replace(/\./g, ""), |
|||
version: inf.version, |
|||
}); |
|||
}); |
|||
} |
|||
// 发起ajax请求获取服务端版本号
|
|||
export const getServerNo = function(version, isPrompt = false, callback) { |
|||
// let userInfos = uni.getStorageSync('userInfos');
|
|||
// console.log(userInfos);
|
|||
// console.log(userInfos.username)
|
|||
// let userName = userInfos.username;
|
|||
let httpData = { |
|||
version: version, |
|||
// userName: userName
|
|||
}; |
|||
// console.log(userName)
|
|||
if (platform == "android") { |
|||
httpData.type = 1101; |
|||
} else { |
|||
httpData.type = 1102; |
|||
} |
|||
console.log("》》》》", 222222); |
|||
/* 接口入参说明 |
|||
* version: 应用当前版本号(已自动获取) |
|||
* type:平台(1101是安卓,1102是IOS) |
|||
*/ |
|||
$http.get("/portal/v1/app/appVersion/versioninfo", httpData, { |
|||
isPrompt: isPrompt |
|||
}).then(res => { |
|||
/* res的数据说明 |
|||
* | 参数名称 | 一定返回 | 类型 | 描述 |
|||
* | -------------|--------- | --------- | ------------- | |
|||
* | versionCode | y | int | 版本号 | |
|||
* | versionName | y | String | 版本名称 | |
|||
* | versionInfo | y | String | 版本信息 | |
|||
* | forceUpdate | y | boolean | 是否强制更新 | |
|||
* | downloadUrl | y | String | 版本下载链接(IOS安装包更新请放跳转store应用商店链接,安卓apk和wgt文件放文件下载链接) | |
|||
*/ |
|||
console.log("》》》》", 333333333); |
|||
console.log(res) |
|||
console.log(JSON.parse(res)); |
|||
console.log(JSON.stringify(JSON.parse(res))) |
|||
console.log(JSON.parse(res).downloadUrl) |
|||
if (res && JSON.parse(res).downloadUrl && version < JSON.parse(res).versionCode) { |
|||
callback && callback(res); |
|||
} else if (isPrompt) { |
|||
uni.showToast({ |
|||
title: "暂无新版本", |
|||
icon: "none" |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
// 从服务器下载应用资源包
|
|||
export const getDownload = function(res) { |
|||
console.log("getDownload》》》》", res); |
|||
//let data = JSON.parse(res);
|
|||
let data = res; |
|||
let popupData = { |
|||
progress: true, |
|||
buttonNum: 2 |
|||
}; |
|||
if (data.forceUpdate) { |
|||
popupData.buttonNum = 0; |
|||
} |
|||
let file = data.fileName |
|||
let dtask; |
|||
let lastProgressValue = 0; |
|||
console.log("》》》》", 44444444); |
|||
console.log("downloadUrl》》》》", data.downloadUrl); |
|||
downloadPopup(popupData, function(res) { |
|||
dtask = plus.downloader.createDownload(data.downloadUrl, { |
|||
// filename: '_doc/update/' + file + '/' + new Date().getTime() + '/'
|
|||
filename: '_doc/update/' + new Date().getTime() + '/' + file |
|||
}, function(download, status) { |
|||
console.log("download=====:" + JSON.stringify(download)); |
|||
console.log("status=====:" + status); |
|||
if (status == 200) { |
|||
res.change({ |
|||
progressValue: 100, |
|||
progressTip: "正在安装文件...", |
|||
progress: true, |
|||
buttonNum: 0 |
|||
}); |
|||
console.log(download.filename) |
|||
plus.runtime.install(download.filename, { |
|||
force: false |
|||
}, |
|||
function() { |
|||
// plus.runtime.restart();//下载后重启app
|
|||
res.change({ |
|||
contentText: "应用资源更新完成!", |
|||
buttonNum: 1, |
|||
progress: false |
|||
}); |
|||
}, |
|||
function(e) { |
|||
res.cancel(); |
|||
plus.nativeUI.alert("安装文件失败[" + e.code + "]:" + e.message); |
|||
}); |
|||
} else { |
|||
res.change({ |
|||
contentText: "文件下载失败...", |
|||
buttonNum: 1, |
|||
progress: false |
|||
}); |
|||
} |
|||
}); |
|||
dtask.start(); |
|||
dtask.addEventListener("statechanged", function(task, status) { |
|||
switch (task.state) { |
|||
case 1: // 开始
|
|||
res.change({ |
|||
progressValue: 0, |
|||
progressTip: "准备下载...", |
|||
progress: true |
|||
}); |
|||
break; |
|||
case 2: // 已连接到服务器
|
|||
res.change({ |
|||
progressValue: 0, |
|||
progressTip: "开始下载...", |
|||
progress: true |
|||
}); |
|||
break; |
|||
case 3: |
|||
const progress = parseInt(task.downloadedSize / task.totalSize * 100); |
|||
if (progress - lastProgressValue >= 2) { |
|||
lastProgressValue = progress; |
|||
res.change({ |
|||
progressValue: progress, |
|||
progressTip: "已下载" + progress + "%", |
|||
progress: true |
|||
}); |
|||
} |
|||
|
|||
break; |
|||
} |
|||
}); |
|||
}, function() { |
|||
// 取消下载
|
|||
dtask && dtask.abort(); |
|||
uni.showToast({ |
|||
title: "已取消下载", |
|||
icon: "none" |
|||
}); |
|||
}, |
|||
function() { |
|||
// 重启APP
|
|||
plus.runtime.restart(); |
|||
}); |
|||
} |
|||
// 文字换行
|
|||
function drawtext(text, maxWidth) { |
|||
debugger |
|||
let textArr = text.split(" "); |
|||
let len = textArr.length; |
|||
// 上个节点
|
|||
let previousNode = 0; |
|||
// 记录节点宽度
|
|||
let nodeWidth = 0; |
|||
// 文本换行数组
|
|||
let rowText = []; |
|||
// 如果是字母,侧保存长度
|
|||
let letterWidth = 0; |
|||
// 汉字宽度
|
|||
let chineseWidth = 14; |
|||
// otherFont宽度
|
|||
let otherWidth = 7; |
|||
for (let i = 0; i < len; i++) { |
|||
if (/[\u4e00-\u9fa5]|[\uFE30-\uFFA0]/g.test(textArr[i])) { |
|||
if (letterWidth > 0) { |
|||
if (nodeWidth + chineseWidth + letterWidth * otherWidth > maxWidth) { |
|||
rowText.push({ |
|||
type: "text", |
|||
content: text.substring(previousNode, i) |
|||
}); |
|||
previousNode = i; |
|||
nodeWidth = chineseWidth; |
|||
letterWidth = 0; |
|||
} else { |
|||
nodeWidth += chineseWidth + letterWidth * otherWidth; |
|||
letterWidth = 0; |
|||
} |
|||
} else { |
|||
if (nodeWidth + chineseWidth > maxWidth) { |
|||
rowText.push({ |
|||
type: "text", |
|||
content: text.substring(previousNode, i) |
|||
}); |
|||
previousNode = i; |
|||
nodeWidth = chineseWidth; |
|||
} else { |
|||
nodeWidth += chineseWidth; |
|||
} |
|||
} |
|||
} else { |
|||
if (/\n/g.test(textArr[i])) { |
|||
rowText.push({ |
|||
type: "break", |
|||
content: text.substring(previousNode, i) |
|||
}); |
|||
previousNode = i + 1; |
|||
nodeWidth = 0; |
|||
letterWidth = 0; |
|||
} else if (textArr[i] == "\\" && textArr[i + 1] == "n") { |
|||
rowText.push({ |
|||
type: "break", |
|||
content: text.substring(previousNode, i) |
|||
}); |
|||
previousNode = i + 2; |
|||
nodeWidth = 0; |
|||
letterWidth = 0; |
|||
} else if (/[a-zA-Z0-9]/g.test(textArr[i])) { |
|||
letterWidth += 1; |
|||
if (nodeWidth + letterWidth * otherWidth > maxWidth) { |
|||
rowText.push({ |
|||
type: "text", |
|||
content: text.substring(previousNode, i + 1 - letterWidth) |
|||
}); |
|||
previousNode = i + 1 - letterWidth; |
|||
nodeWidth = letterWidth * otherWidth; |
|||
letterWidth = 0; |
|||
} |
|||
} else { |
|||
if (nodeWidth + otherWidth > maxWidth) { |
|||
rowText.push({ |
|||
type: "text", |
|||
content: text.substring(previousNode, i) |
|||
}); |
|||
previousNode = i; |
|||
nodeWidth = otherWidth; |
|||
} else { |
|||
nodeWidth += otherWidth; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
if (previousNode < len) { |
|||
rowText.push({ |
|||
type: "text", |
|||
// content: text.substring(previousNode, len)
|
|||
content: text |
|||
}); |
|||
} |
|||
return rowText; |
|||
} |
|||
// 是否更新弹窗
|
|||
function updatePopup(res, callback) { |
|||
console.log(res); |
|||
//let data = JSON.parse(res);
|
|||
let data = res; |
|||
console.log(data.versionInfo) |
|||
// 弹窗遮罩层
|
|||
let maskLayer = new plus.nativeObj.View("maskLayer", { //先创建遮罩层
|
|||
top: '0px', |
|||
left: '0px', |
|||
height: '100%', |
|||
width: '100%', |
|||
backgroundColor: 'rgba(0,0,0,0.5)' |
|||
}); |
|||
|
|||
// 以下为计算菜单的nview绘制布局,为固定算法,使用者无关关心
|
|||
const screenWidth = plus.screen.resolutionWidth; |
|||
const screenHeight = plus.screen.resolutionHeight; |
|||
//弹窗容器宽度
|
|||
const popupViewWidth = screenWidth * 0.7; |
|||
// 弹窗容器的Padding
|
|||
const viewContentPadding = 20; |
|||
// 弹窗容器的宽度
|
|||
const viewContentWidth = parseInt(popupViewWidth - (viewContentPadding * 2)); |
|||
// 描述的列表
|
|||
const descriptionList = drawtext(data.versionInfo, viewContentWidth); |
|||
// 弹窗容器高度
|
|||
let popupViewHeight = 80 + 20 + 20 + 90 + 10; |
|||
let popupViewContentList = [{ |
|||
src: $iconUrl, |
|||
id: "logo", |
|||
tag: "img", |
|||
position: { |
|||
top: "0px", |
|||
left: (popupViewWidth - 124) / 2 + "px", |
|||
width: "124px", |
|||
height: "80px", |
|||
} |
|||
}, |
|||
{ |
|||
tag: 'font', |
|||
id: 'title', |
|||
text: "发现新版本" + data.versionName, |
|||
textStyles: { |
|||
size: '18px', |
|||
color: "#333", |
|||
weight: "bold", |
|||
whiteSpace: "normal" |
|||
}, |
|||
position: { |
|||
top: '90px', |
|||
left: viewContentPadding + "px", |
|||
width: viewContentWidth + "px", |
|||
height: "30px", |
|||
} |
|||
} |
|||
]; |
|||
const textHeight = 18; |
|||
let contentTop = 130; |
|||
descriptionList.forEach((item, index) => { |
|||
if (index > 0) { |
|||
popupViewHeight += textHeight; |
|||
contentTop += textHeight; |
|||
} |
|||
popupViewContentList.push({ |
|||
tag: 'font', |
|||
id: 'content' + index + 1, |
|||
text: item.content, |
|||
textStyles: { |
|||
size: '14px', |
|||
color: "#666", |
|||
lineSpacing: "50%", |
|||
align: "left" |
|||
}, |
|||
position: { |
|||
top: contentTop + "px", |
|||
left: viewContentPadding + "px", |
|||
width: viewContentWidth + "px", |
|||
height: textHeight + "px", |
|||
} |
|||
}); |
|||
if (item.type == "break") { |
|||
contentTop += 10; |
|||
popupViewHeight += 10; |
|||
} |
|||
}); |
|||
// 弹窗内容
|
|||
let popupView = new plus.nativeObj.View("popupView", { //创建底部图标菜单
|
|||
tag: "rect", |
|||
top: (screenHeight - popupViewHeight) / 2 + "px", |
|||
left: '15%', |
|||
height: popupViewHeight + "px", |
|||
width: "70%" |
|||
}); |
|||
// 绘制白色背景
|
|||
popupView.drawRect({ |
|||
color: "#FFFFFF", |
|||
radius: "8px" |
|||
}, { |
|||
top: "40px", |
|||
height: popupViewHeight - 40 + "px", |
|||
}); |
|||
// 绘制底边按钮
|
|||
popupView.drawRect({ |
|||
radius: "3px", |
|||
borderColor: "#f1f1f1", |
|||
borderWidth: "1px", |
|||
}, { |
|||
bottom: viewContentPadding + 'px', |
|||
left: viewContentPadding + "px", |
|||
width: (viewContentWidth - viewContentPadding) / 2 + "px", |
|||
height: "30px", |
|||
}); |
|||
// 绘制底边按钮
|
|||
popupView.drawRect({ |
|||
radius: "3px", |
|||
color: $mainColor, |
|||
}, { |
|||
bottom: viewContentPadding + 'px', |
|||
left: ((viewContentWidth - viewContentPadding) / 2 + viewContentPadding * 2) + "px", |
|||
width: (viewContentWidth - viewContentPadding) / 2 + "px", |
|||
height: "30px", |
|||
}); |
|||
popupViewContentList.push({ |
|||
tag: 'font', |
|||
id: 'cancelText', |
|||
text: "暂不升级", |
|||
textStyles: { |
|||
size: '14px', |
|||
color: "#666", |
|||
lineSpacing: "0%", |
|||
whiteSpace: "normal" |
|||
}, |
|||
position: { |
|||
bottom: viewContentPadding + 'px', |
|||
left: viewContentPadding + "px", |
|||
width: (viewContentWidth - viewContentPadding) / 2 + "px", |
|||
height: "30px", |
|||
} |
|||
}); |
|||
popupViewContentList.push({ |
|||
tag: 'font', |
|||
id: 'confirmText', |
|||
text: "立即升级", |
|||
textStyles: { |
|||
size: '14px', |
|||
color: "#FFF", |
|||
lineSpacing: "0%", |
|||
whiteSpace: "normal" |
|||
}, |
|||
position: { |
|||
bottom: viewContentPadding + 'px', |
|||
left: ((viewContentWidth - viewContentPadding) / 2 + viewContentPadding * 2) + "px", |
|||
width: (viewContentWidth - viewContentPadding) / 2 + "px", |
|||
height: "30px", |
|||
} |
|||
}); |
|||
popupView.draw(popupViewContentList); |
|||
popupView.addEventListener("click", function(e) { |
|||
let maxTop = popupViewHeight - viewContentPadding; |
|||
let maxLeft = popupViewWidth - viewContentPadding; |
|||
let buttonWidth = (viewContentWidth - viewContentPadding) / 2; |
|||
if (e.clientY > maxTop - 30 && e.clientY < maxTop) { |
|||
// 暂不升级
|
|||
if (e.clientX > viewContentPadding && e.clientX < maxLeft - buttonWidth - viewContentPadding) { |
|||
maskLayer.hide(); |
|||
popupView.hide(); |
|||
} else if (e.clientX > maxLeft - buttonWidth && e.clientX < maxLeft) { |
|||
// 立即升级
|
|||
maskLayer.hide(); |
|||
popupView.hide(); |
|||
callback && callback(); |
|||
} |
|||
} |
|||
}); |
|||
// 点击遮罩层
|
|||
maskLayer.addEventListener("click", function() { //处理遮罩层点击
|
|||
maskLayer.hide(); |
|||
popupView.hide(); |
|||
}); |
|||
// 显示弹窗
|
|||
maskLayer.show(); |
|||
popupView.show(); |
|||
} |
|||
// 文件下载的弹窗绘图
|
|||
function downloadPopupDrawing(data) { |
|||
// 以下为计算菜单的nview绘制布局,为固定算法,使用者无关关心
|
|||
const screenWidth = plus.screen.resolutionWidth; |
|||
const screenHeight = plus.screen.resolutionHeight; |
|||
//弹窗容器宽度
|
|||
const popupViewWidth = screenWidth * 0.7; |
|||
// 弹窗容器的Padding
|
|||
const viewContentPadding = 20; |
|||
// 弹窗容器的宽度
|
|||
const viewContentWidth = popupViewWidth - (viewContentPadding * 2); |
|||
// 弹窗容器高度
|
|||
let popupViewHeight = viewContentPadding * 3 + 60; |
|||
let progressTip = data.progressTip || "准备下载..."; |
|||
let contentText = data.contentText || "正在为您更新,请耐心等待"; |
|||
let elementList = [{ |
|||
tag: 'rect', //背景色
|
|||
color: '#FFFFFF', |
|||
rectStyles: { |
|||
radius: "8px" |
|||
} |
|||
}, |
|||
{ |
|||
tag: 'font', |
|||
id: 'title', |
|||
text: "升级APP", |
|||
textStyles: { |
|||
size: '16px', |
|||
color: "#333", |
|||
weight: "bold", |
|||
verticalAlign: "middle", |
|||
whiteSpace: "normal" |
|||
}, |
|||
position: { |
|||
top: viewContentPadding + 'px', |
|||
height: "30px", |
|||
} |
|||
}, |
|||
{ |
|||
tag: 'font', |
|||
id: 'content', |
|||
text: contentText, |
|||
textStyles: { |
|||
size: '14px', |
|||
color: "#333", |
|||
verticalAlign: "middle", |
|||
whiteSpace: "normal" |
|||
}, |
|||
position: { |
|||
top: viewContentPadding * 2 + 30 + 'px', |
|||
height: "20px", |
|||
} |
|||
} |
|||
]; |
|||
// 是否有进度条
|
|||
if (data.progress) { |
|||
popupViewHeight += viewContentPadding + 40; |
|||
elementList = elementList.concat([{ |
|||
tag: 'font', |
|||
id: 'progressValue', |
|||
text: progressTip, |
|||
textStyles: { |
|||
size: '14px', |
|||
color: $mainColor, |
|||
whiteSpace: "normal" |
|||
}, |
|||
position: { |
|||
top: viewContentPadding * 4 + 20 + 'px', |
|||
height: "30px" |
|||
} |
|||
}, |
|||
{ |
|||
tag: 'rect', //绘制进度条背景
|
|||
id: 'progressBg', |
|||
rectStyles: { |
|||
radius: "4px", |
|||
borderColor: "#f1f1f1", |
|||
borderWidth: "1px", |
|||
}, |
|||
position: { |
|||
top: viewContentPadding * 4 + 60 + 'px', |
|||
left: viewContentPadding + "px", |
|||
width: viewContentWidth + "px", |
|||
height: "8px" |
|||
} |
|||
}, |
|||
]); |
|||
} |
|||
if (data.buttonNum == 2) { |
|||
popupViewHeight += viewContentPadding + 30; |
|||
elementList = elementList.concat([{ |
|||
tag: 'rect', //绘制底边按钮
|
|||
rectStyles: { |
|||
radius: "3px", |
|||
borderColor: "#f1f1f1", |
|||
borderWidth: "1px", |
|||
}, |
|||
position: { |
|||
bottom: viewContentPadding + 'px', |
|||
left: viewContentPadding + "px", |
|||
width: (viewContentWidth - viewContentPadding) / 2 + "px", |
|||
height: "30px" |
|||
} |
|||
}, |
|||
{ |
|||
tag: 'rect', //绘制底边按钮
|
|||
rectStyles: { |
|||
radius: "3px", |
|||
color: $mainColor |
|||
}, |
|||
position: { |
|||
bottom: viewContentPadding + 'px', |
|||
left: ((viewContentWidth - viewContentPadding) / 2 + viewContentPadding * 2) + "px", |
|||
width: (viewContentWidth - viewContentPadding) / 2 + "px", |
|||
height: "30px" |
|||
} |
|||
}, |
|||
{ |
|||
tag: 'font', |
|||
id: 'cancelText', |
|||
text: "取消下载", |
|||
textStyles: { |
|||
size: '14px', |
|||
color: "#666", |
|||
lineSpacing: "0%", |
|||
whiteSpace: "normal" |
|||
}, |
|||
position: { |
|||
bottom: viewContentPadding + 'px', |
|||
left: viewContentPadding + "px", |
|||
width: (viewContentWidth - viewContentPadding) / 2 + "px", |
|||
height: "30px", |
|||
} |
|||
}, |
|||
{ |
|||
tag: 'font', |
|||
id: 'confirmText', |
|||
text: "后台下载", |
|||
textStyles: { |
|||
size: '14px', |
|||
color: "#FFF", |
|||
lineSpacing: "0%", |
|||
whiteSpace: "normal" |
|||
}, |
|||
position: { |
|||
bottom: viewContentPadding + 'px', |
|||
left: ((viewContentWidth - viewContentPadding) / 2 + viewContentPadding * 2) + "px", |
|||
width: (viewContentWidth - viewContentPadding) / 2 + "px", |
|||
height: "30px", |
|||
} |
|||
} |
|||
]); |
|||
} |
|||
if (data.buttonNum == 1) { |
|||
popupViewHeight += viewContentPadding + 40; |
|||
elementList = elementList.concat([{ |
|||
tag: 'rect', //绘制底边按钮
|
|||
rectStyles: { |
|||
radius: "6px", |
|||
color: $mainColor |
|||
}, |
|||
position: { |
|||
bottom: viewContentPadding + 'px', |
|||
left: viewContentPadding + "px", |
|||
width: viewContentWidth + "px", |
|||
height: "40px" |
|||
} |
|||
}, |
|||
{ |
|||
tag: 'font', |
|||
id: 'confirmText', |
|||
text: "关闭", |
|||
textStyles: { |
|||
size: '14px', |
|||
color: "#FFF", |
|||
lineSpacing: "0%", |
|||
}, |
|||
position: { |
|||
bottom: viewContentPadding + 'px', |
|||
left: viewContentPadding + "px", |
|||
width: viewContentWidth + "px", |
|||
height: "40px" |
|||
} |
|||
} |
|||
]); |
|||
} |
|||
return { |
|||
popupViewHeight: popupViewHeight, |
|||
popupViewWidth: popupViewWidth, |
|||
screenHeight: screenHeight, |
|||
viewContentWidth: viewContentWidth, |
|||
viewContentPadding: viewContentPadding, |
|||
elementList: elementList |
|||
}; |
|||
} |
|||
// 文件下载的弹窗
|
|||
function downloadPopup(data, callback, cancelCallback, rebootCallback) { |
|||
// 弹窗遮罩层
|
|||
let maskLayer = new plus.nativeObj.View("maskLayer", { //先创建遮罩层
|
|||
top: '0px', |
|||
left: '0px', |
|||
height: '100%', |
|||
width: '100%', |
|||
backgroundColor: 'rgba(0,0,0,0.5)' |
|||
}); |
|||
let popupViewData = downloadPopupDrawing(data); |
|||
// 弹窗内容
|
|||
let popupView = new plus.nativeObj.View("popupView", { //创建底部图标菜单
|
|||
tag: "rect", |
|||
top: (popupViewData.screenHeight - popupViewData.popupViewHeight) / 2 + "px", |
|||
left: '15%', |
|||
height: popupViewData.popupViewHeight + "px", |
|||
width: "70%", |
|||
}); |
|||
let progressValue = 0; |
|||
let progressTip = 0; |
|||
let contentText = 0; |
|||
let buttonNum = 2; |
|||
if (data.buttonNum >= 0) { |
|||
buttonNum = data.buttonNum; |
|||
} |
|||
popupView.draw(popupViewData.elementList); |
|||
popupView.addEventListener("click", function(e) { |
|||
let maxTop = popupViewData.popupViewHeight - popupViewData.viewContentPadding; |
|||
let maxLeft = popupViewData.popupViewWidth - popupViewData.viewContentPadding; |
|||
if (e.clientY > maxTop - 40 && e.clientY < maxTop) { |
|||
if (buttonNum == 1) { |
|||
// 单按钮
|
|||
if (e.clientX > popupViewData.viewContentPadding && e.clientX < maxLeft) { |
|||
maskLayer.hide(); |
|||
popupView.hide(); |
|||
rebootCallback && rebootCallback(); |
|||
} |
|||
} else if (buttonNum == 2) { |
|||
// 双按钮
|
|||
let buttonWidth = (popupViewData.viewContentWidth - popupViewData.viewContentPadding) / 2; |
|||
if (e.clientX > popupViewData.viewContentPadding && e.clientX < maxLeft - buttonWidth - |
|||
popupViewData.viewContentPadding) { |
|||
maskLayer.hide(); |
|||
popupView.hide(); |
|||
cancelCallback && cancelCallback(); |
|||
} else if (e.clientX > maxLeft - buttonWidth && e.clientX < maxLeft) { |
|||
maskLayer.hide(); |
|||
popupView.hide(); |
|||
} |
|||
} |
|||
} |
|||
}); |
|||
// 显示弹窗
|
|||
maskLayer.show(); |
|||
popupView.show(); |
|||
// 改变进度条
|
|||
callback({ |
|||
change: function(res) { |
|||
let progressElement = []; |
|||
if (res.progressValue) { |
|||
progressValue = res.progressValue; |
|||
// 绘制进度条
|
|||
progressElement.push({ |
|||
tag: 'rect', //绘制进度条背景
|
|||
id: 'progressValueBg', |
|||
rectStyles: { |
|||
radius: "4px", |
|||
color: $mainColor |
|||
}, |
|||
position: { |
|||
top: popupViewData.viewContentPadding * 4 + 60 + 'px', |
|||
left: popupViewData.viewContentPadding + "px", |
|||
width: popupViewData.viewContentWidth * (res.progressValue / 100) + "px", |
|||
height: "8px" |
|||
} |
|||
}); |
|||
} |
|||
if (res.progressTip) { |
|||
progressTip = res.progressTip; |
|||
progressElement.push({ |
|||
tag: 'font', |
|||
id: 'progressValue', |
|||
text: res.progressTip, |
|||
textStyles: { |
|||
size: '14px', |
|||
color: $mainColor, |
|||
whiteSpace: "normal" |
|||
}, |
|||
position: { |
|||
top: popupViewData.viewContentPadding * 4 + 20 + 'px', |
|||
height: "30px" |
|||
} |
|||
}); |
|||
} |
|||
if (res.contentText) { |
|||
contentText = res.contentText; |
|||
progressElement.push({ |
|||
tag: 'font', |
|||
id: 'content', |
|||
text: res.contentText, |
|||
textStyles: { |
|||
size: '16px', |
|||
color: "#333", |
|||
whiteSpace: "normal" |
|||
}, |
|||
position: { |
|||
top: popupViewData.viewContentPadding * 2 + 30 + 'px', |
|||
height: "30px", |
|||
} |
|||
}); |
|||
} |
|||
if (res.buttonNum >= 0 && buttonNum != res.buttonNum) { |
|||
buttonNum = res.buttonNum; |
|||
popupView.reset(); |
|||
popupViewData = downloadPopupDrawing(Object.assign({ |
|||
progressValue: progressValue, |
|||
progressTip: progressTip, |
|||
contentText: contentText, |
|||
}, res)); |
|||
let newElement = []; |
|||
popupViewData.elementList.map((item, index) => { |
|||
let have = false; |
|||
progressElement.forEach((childItem, childIndex) => { |
|||
if (item.id == childItem.id) { |
|||
have = true; |
|||
} |
|||
}); |
|||
if (!have) { |
|||
newElement.push(item); |
|||
} |
|||
}); |
|||
progressElement = newElement.concat(progressElement); |
|||
popupView.setStyle({ |
|||
tag: "rect", |
|||
top: (popupViewData.screenHeight - popupViewData.popupViewHeight) / 2 + "px", |
|||
left: '15%', |
|||
height: popupViewData.popupViewHeight + "px", |
|||
width: "70%", |
|||
}); |
|||
popupView.draw(progressElement); |
|||
} else { |
|||
popupView.draw(progressElement); |
|||
} |
|||
}, |
|||
cancel: function() { |
|||
maskLayer.hide(); |
|||
popupView.hide(); |
|||
} |
|||
}); |
|||
} |
|||
export default function(isPrompt = false) { |
|||
getCurrentNo(version => { |
|||
console.log("》》》》", version); |
|||
getServerNo(version.versionCode, isPrompt, data => { |
|||
let res = JSON.parse(data); |
|||
console.log("》》》》", 6666666); |
|||
console.log("》》》》", res.downloadUrl); |
|||
if (res.forceUpdate) { |
|||
if (/\.wgt$/i.test(res.downloadUrl)) { |
|||
getDownload(res); |
|||
} else if (/\.apk$/i.test(res.downloadUrl)) { |
|||
plus.runtime.openURL(res.downloadUrl); |
|||
} else { |
|||
if (platform == "android") { |
|||
getDownload(res); |
|||
} else { |
|||
plus.runtime.openURL(res.downloadUrl); |
|||
} |
|||
} |
|||
} else { |
|||
updatePopup(res, function() { |
|||
if (/\.wgt$/i.test(res.downloadUrl)) { |
|||
getDownload(res); |
|||
} else if (/\.html$/i.test(res.downloadUrl)) { |
|||
plus.runtime.openURL(res.downloadUrl); |
|||
} else { |
|||
if (platform == "android") { |
|||
getDownload(res); |
|||
} else { |
|||
plus.runtime.openURL(res.downloadUrl); |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
}); |
|||
} |
|||
// #endif
|
@ -0,0 +1,390 @@ |
|||
import request from "./request.js"; |
|||
const qiniuUploader = require("./qiniuUploader"); |
|||
export default class fileUpload extends request { |
|||
constructor(props) { |
|||
// 调用实现父类的构造函数
|
|||
super(props); |
|||
} |
|||
//七牛云上传图片
|
|||
qnImgUpload(data = {}, options = {}) { |
|||
const _this = this; |
|||
return new Promise((resolve, reject) => { |
|||
uni.chooseImage({ |
|||
count: data.count || 9, //默认9
|
|||
sizeType: data.sizeType || ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|||
sourceType: data.sourceType || ['album', 'camera'], //从相册选择
|
|||
success: function(res) { |
|||
_this.qnFileUpload({ |
|||
files: res.tempFiles, |
|||
...data |
|||
}, options).then(resolve, reject); |
|||
} |
|||
}); |
|||
}); |
|||
} |
|||
//七牛云上传文件命名
|
|||
randomChar(l, url = "") { |
|||
const x = "0123456789qwertyuioplkjhgfdsazxcvbnm"; |
|||
let tmp = ""; |
|||
let time = new Date(); |
|||
for (let i = 0; i < l; i++) { |
|||
tmp += x.charAt(Math.ceil(Math.random() * 100000000) % x.length); |
|||
} |
|||
return ( |
|||
"file/" + |
|||
url + |
|||
time.getTime() + |
|||
tmp |
|||
); |
|||
} |
|||
//七牛云文件上传(支持多张上传)
|
|||
qnFileUpload(data = {}, options = {}) { |
|||
const _this = this; |
|||
let requestInfo = { |
|||
...data, |
|||
...this.config, |
|||
...options, |
|||
header: {}, |
|||
method: "FILE" |
|||
}; |
|||
return new Promise((resolve, reject) => { |
|||
//请求前回调
|
|||
if (_this.requestStart) { |
|||
let requestStart = _this.requestStart(requestInfo); |
|||
if (typeof requestStart == "object") { |
|||
requestInfo.load = requestStart.load; |
|||
requestInfo.files = requestStart.files; |
|||
} else { |
|||
//请求完成回调
|
|||
_this.requestEnd && _this.requestEnd(requestInfo, { |
|||
errMsg: "请求开始拦截器未通过", |
|||
statusCode: 0 |
|||
}); |
|||
reject({ |
|||
errMsg: "请求开始拦截器未通过", |
|||
statusCode: 0 |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
if (Array.isArray(requestInfo.files)) { |
|||
let len = requestInfo.files.length; |
|||
let imageList = new Array; |
|||
if(_this.getQnToken){ |
|||
_this.getQnToken(qnRes => { |
|||
/* |
|||
*接口返回参数: |
|||
*visitPrefix:访问文件的域名 |
|||
*token:七牛云上传token |
|||
*folderPath:上传的文件夹 |
|||
*region: 地区 默认为:SCN |
|||
*/ |
|||
uploadFile(0); |
|||
function uploadFile(i) { |
|||
let fileData = { |
|||
fileIndex: i, |
|||
files: requestInfo.files, |
|||
size: requestInfo.files[i].size |
|||
}; |
|||
// #ifdef H5
|
|||
fileData.name = requestInfo.files[i].name; |
|||
fileData.type = requestInfo.files[i].type; |
|||
// #endif
|
|||
// 交给七牛上传
|
|||
qiniuUploader.upload(requestInfo.files[i].path, (res) => { |
|||
fileData.url = res.imageURL; |
|||
requestInfo.onEachUpdate && requestInfo.onEachUpdate({ |
|||
url: res.imageURL, |
|||
...fileData |
|||
}); |
|||
imageList.push(res.imageURL); |
|||
if (len - 1 > i) { |
|||
uploadFile(i + 1); |
|||
} else { |
|||
//请求完成回调
|
|||
_this.requestEnd && _this.requestEnd(requestInfo, { |
|||
errMsg: "request:ok", |
|||
statusCode: 200, |
|||
data: imageList |
|||
}); |
|||
resolve(imageList); |
|||
} |
|||
}, (error) => { |
|||
console.log('error: ' + error); |
|||
//请求完成回调
|
|||
_this.requestEnd && _this.requestEnd(requestInfo, error); |
|||
reject(error) |
|||
}, { |
|||
region: qnRes.region || 'SCN', //地区
|
|||
domain: qnRes.visitPrefix, // bucket 域名,下载资源时用到。
|
|||
key: _this.randomChar(8, qnRes.folderPath), |
|||
uptoken: qnRes.token, // 由其他程序生成七牛 uptoken
|
|||
uptokenURL: 'UpTokenURL.com/uptoken' // 上传地址
|
|||
}, (res) => { |
|||
console.log(requestInfo); |
|||
requestInfo.onProgressUpdate && requestInfo.onProgressUpdate(Object.assign({}, fileData, res)); |
|||
// console.log('上传进度', res.progress)
|
|||
// console.log('已经上传的数据长度', res.totalBytesSent)
|
|||
// console.log('预期需要上传的数据总长度', res.totalBytesExpectedToSend)
|
|||
}); |
|||
} |
|||
}); |
|||
} else { |
|||
//请求完成回调
|
|||
_this.requestEnd && _this.requestEnd(requestInfo, { |
|||
errMsg: "请添加七牛云回调方法:getQnToken", |
|||
statusCode: 0 |
|||
}); |
|||
reject({ |
|||
errMsg: "请添加七牛云回调方法:getQnToken", |
|||
statusCode: 0 |
|||
}); |
|||
return; |
|||
} |
|||
} else { |
|||
//请求完成回调
|
|||
_this.requestEnd && _this.requestEnd(requestInfo, { |
|||
errMsg: "files 必须是数组类型", |
|||
statusCode: 0 |
|||
}); |
|||
reject({ |
|||
errMsg: "files 必须是数组类型", |
|||
statusCode: 0 |
|||
}); |
|||
}; |
|||
}); |
|||
|
|||
} |
|||
//本地服务器图片上传
|
|||
urlImgUpload(url = '', data = {}, options = {}) { |
|||
const _this = this; |
|||
return new Promise((resolve, reject) => { |
|||
uni.chooseImage({ |
|||
count: data.count || 9, //默认9
|
|||
sizeType: data.sizeType || ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|||
sourceType: data.sourceType || ['album', 'camera'], //从相册选择
|
|||
success: function(res) { |
|||
_this.urlFileUpload(url, { |
|||
...data, |
|||
files: res.tempFiles |
|||
}, options).then(resolve, reject); |
|||
} |
|||
}); |
|||
}); |
|||
} |
|||
//本地服务器文件上传方法
|
|||
urlFileUpload(url = '', data = {}, options = {}) { |
|||
let requestInfo = this.getDefault({ |
|||
...data, |
|||
url: url, |
|||
method: "FILE" |
|||
}, options); |
|||
const _this = this; |
|||
return new Promise((resolve, reject) => { |
|||
//请求前回调
|
|||
if (_this.requestStart) { |
|||
let requestStart = _this.requestStart(requestInfo); |
|||
if (typeof requestStart == "object") { |
|||
requestInfo.data = requestStart.data; |
|||
requestInfo.header = requestStart.header; |
|||
requestInfo.isPrompt = requestStart.isPrompt; |
|||
requestInfo.load = requestStart.load; |
|||
requestInfo.isFactory = requestStart.isFactory; |
|||
requestInfo.files = requestStart.files; |
|||
} else { |
|||
//请求完成回调
|
|||
_this.requestEnd && _this.requestEnd(requestInfo, { |
|||
errMsg: "请求开始拦截器未通过", |
|||
statusCode: 0 |
|||
}); |
|||
reject({ |
|||
errMsg: "请求开始拦截器未通过", |
|||
statusCode: 0 |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
// 本地文件上传去掉默认Content-Type
|
|||
if(requestInfo.header['Content-Type']){ |
|||
delete requestInfo.header['Content-Type']; |
|||
} |
|||
if (Array.isArray(requestInfo.files)) { |
|||
// #ifdef APP-PLUS || H5
|
|||
let files = []; |
|||
let fileData = { |
|||
files: requestInfo.files, |
|||
name: requestInfo.name || "file" |
|||
}; |
|||
requestInfo.files.forEach(item => { |
|||
files.push({ |
|||
uri: item.path, |
|||
name: requestInfo.name || "file" |
|||
}); |
|||
}); |
|||
let config = { |
|||
url: requestInfo.url, |
|||
files: files, |
|||
header: requestInfo.header, //加入请求头
|
|||
success: (response) => { |
|||
if (typeof(response.data) == "string") { |
|||
response.data = JSON.parse(response.data); |
|||
} |
|||
//是否用外部的数据处理方法
|
|||
if (requestInfo.isFactory && _this.dataFactory) { |
|||
//数据处理
|
|||
_this.dataFactory({ |
|||
...requestInfo, |
|||
response: response, |
|||
resolve: function(data) { |
|||
requestInfo.onEachUpdate && requestInfo.onEachUpdate({ |
|||
data: data, |
|||
...fileData |
|||
}); |
|||
//请求完成回调
|
|||
_this.requestEnd && _this.requestEnd(requestInfo, { |
|||
errMsg: "request:ok", |
|||
statusCode: 200, |
|||
data: data |
|||
}); |
|||
resolve(data); |
|||
}, |
|||
reject: function(err) { |
|||
//请求完成回调
|
|||
_this.requestEnd && _this.requestEnd(requestInfo, { |
|||
errMsg: "数据工厂返回错误", |
|||
statusCode: 0, |
|||
data: err |
|||
}); |
|||
reject(err); |
|||
} |
|||
}); |
|||
} else { |
|||
requestInfo.onEachUpdate && requestInfo.onEachUpdate({ |
|||
data: response, |
|||
...fileData |
|||
}); |
|||
//请求完成回调
|
|||
_this.requestEnd && _this.requestEnd(requestInfo, response); |
|||
resolve(response); |
|||
} |
|||
}, |
|||
fail: (err) => { |
|||
//请求完成回调
|
|||
_this.requestEnd && _this.requestEnd(requestInfo, err); |
|||
reject(err); |
|||
} |
|||
}; |
|||
if (requestInfo.data) { |
|||
config.formData = requestInfo.data; |
|||
} |
|||
const uploadTask = uni.uploadFile(config); |
|||
uploadTask.onProgressUpdate(res => { |
|||
requestInfo.onProgressUpdate && requestInfo.onProgressUpdate(Object.assign({}, fileData, res)); |
|||
}); |
|||
// #endif
|
|||
// #ifdef MP
|
|||
const len = requestInfo.files.length - 1; |
|||
let fileList = new Array; |
|||
fileUpload(0); |
|||
|
|||
function fileUpload(i) { |
|||
let fileData = { |
|||
fileIndex: i, |
|||
files: requestInfo.files, |
|||
size: requestInfo.files[i].size |
|||
}; |
|||
// #ifdef H5
|
|||
fileData.name = requestInfo.files[i].name; |
|||
fileData.type = requestInfo.files[i].type; |
|||
// #endif
|
|||
let config = { |
|||
url: requestInfo.url, |
|||
filePath: requestInfo.files[i].path, |
|||
header: requestInfo.header, //加入请求头
|
|||
name: requestInfo.name || "file", |
|||
success: (response) => { |
|||
if (typeof(response.data) == "string") { |
|||
response.data = JSON.parse(response.data); |
|||
} |
|||
//是否用外部的数据处理方法
|
|||
if (requestInfo.isFactory && _this.dataFactory) { |
|||
//数据处理
|
|||
_this.dataFactory({ |
|||
...requestInfo, |
|||
response: response, |
|||
resolve: function(data) { |
|||
requestInfo.onEachUpdate && requestInfo.onEachUpdate({ |
|||
data: data, |
|||
...fileData |
|||
}); |
|||
fileList.push(data); |
|||
if (len <= i) { |
|||
//请求完成回调
|
|||
_this.requestEnd && _this.requestEnd(requestInfo, { |
|||
errMsg: "request:ok", |
|||
statusCode: 200, |
|||
data: fileList |
|||
}); |
|||
resolve(fileList); |
|||
} else { |
|||
fileUpload(i + 1); |
|||
} |
|||
}, |
|||
reject: function(err) { |
|||
//请求完成回调
|
|||
_this.requestEnd && _this.requestEnd(requestInfo, { |
|||
errMsg: "数据工厂返回错误", |
|||
statusCode: 0, |
|||
data: err |
|||
}); |
|||
reject(err); |
|||
} |
|||
}); |
|||
} else { |
|||
requestInfo.onEachUpdate && requestInfo.onEachUpdate({ |
|||
data: response, |
|||
...fileData |
|||
}); |
|||
fileList.push(response); |
|||
if (len <= i) { |
|||
//请求完成回调
|
|||
_this.requestEnd && _this.requestEnd(requestInfo, { |
|||
errMsg: "request:ok", |
|||
statusCode: 200, |
|||
data: fileList |
|||
}); |
|||
resolve(fileList); |
|||
} else { |
|||
fileUpload(i + 1); |
|||
} |
|||
} |
|||
}, |
|||
fail: (err) => { |
|||
//请求完成回调
|
|||
_this.requestEnd && _this.requestEnd(requestInfo, err); |
|||
reject(err); |
|||
} |
|||
}; |
|||
if (requestInfo.data) { |
|||
config.formData = requestInfo.data; |
|||
} |
|||
const uploadTask = uni.uploadFile(config); |
|||
uploadTask.onProgressUpdate(res => { |
|||
requestInfo.onProgressUpdate && requestInfo.onProgressUpdate(Object.assign({}, fileData, res)); |
|||
}); |
|||
} |
|||
// #endif
|
|||
} else { |
|||
//请求完成回调
|
|||
_this.requestEnd && _this.requestEnd(requestInfo, { |
|||
errMsg: "files 必须是数组类型", |
|||
statusCode: 0 |
|||
}); |
|||
reject({ |
|||
errMsg: "files 必须是数组类型", |
|||
statusCode: 0 |
|||
}) |
|||
} |
|||
}); |
|||
} |
|||
} |
@ -0,0 +1,7 @@ |
|||
/***************纯粹的数据请求(如果使用这种可以删除掉fileUpload.js)******************/ |
|||
// import request from "./request.js";
|
|||
// export default request;
|
|||
|
|||
/********数据请求同时继承了文件上传(包括七牛云上传)************/ |
|||
import fileUpload from "./fileUpload.js"; |
|||
export default fileUpload; |
@ -0,0 +1,169 @@ |
|||
// created by gpake
|
|||
(function () { |
|||
|
|||
var config = { |
|||
qiniuRegion: '', |
|||
qiniuImageURLPrefix: '', |
|||
qiniuUploadToken: '', |
|||
qiniuUploadTokenURL: '', |
|||
qiniuUploadTokenFunction: null, |
|||
qiniuShouldUseQiniuFileName: false |
|||
} |
|||
|
|||
module.exports = { |
|||
init: init, |
|||
upload: upload, |
|||
} |
|||
|
|||
// 在整个程序生命周期中,只需要 init 一次即可
|
|||
// 如果需要变更参数,再调用 init 即可
|
|||
function init(options) { |
|||
config = { |
|||
qiniuRegion: '', |
|||
qiniuImageURLPrefix: '', |
|||
qiniuUploadToken: '', |
|||
qiniuUploadTokenURL: '', |
|||
qiniuUploadTokenFunction: null, |
|||
qiniuShouldUseQiniuFileName: false |
|||
}; |
|||
updateConfigWithOptions(options); |
|||
} |
|||
|
|||
function updateConfigWithOptions(options) { |
|||
if (options.region) { |
|||
config.qiniuRegion = options.region; |
|||
} else { |
|||
console.error('qiniu uploader need your bucket region'); |
|||
} |
|||
if (options.uptoken) { |
|||
config.qiniuUploadToken = options.uptoken; |
|||
} else if (options.uptokenURL) { |
|||
config.qiniuUploadTokenURL = options.uptokenURL; |
|||
} else if (options.uptokenFunc) { |
|||
config.qiniuUploadTokenFunction = options.uptokenFunc; |
|||
} |
|||
if (options.domain) { |
|||
config.qiniuImageURLPrefix = options.domain; |
|||
} |
|||
config.qiniuShouldUseQiniuFileName = options.shouldUseQiniuFileName |
|||
} |
|||
|
|||
function upload(filePath, success, fail, options, progress, cancelTask) { |
|||
if (null == filePath) { |
|||
console.error('qiniu uploader need filePath to upload'); |
|||
return; |
|||
} |
|||
if (options) { |
|||
updateConfigWithOptions(options); |
|||
} |
|||
if (config.qiniuUploadToken) { |
|||
doUpload(filePath, success, fail, options, progress, cancelTask); |
|||
} else if (config.qiniuUploadTokenURL) { |
|||
getQiniuToken(function () { |
|||
doUpload(filePath, success, fail, options, progress, cancelTask); |
|||
}); |
|||
} else if (config.qiniuUploadTokenFunction) { |
|||
config.qiniuUploadToken = config.qiniuUploadTokenFunction(); |
|||
if (null == config.qiniuUploadToken && config.qiniuUploadToken.length > 0) { |
|||
console.error('qiniu UploadTokenFunction result is null, please check the return value'); |
|||
return |
|||
} |
|||
doUpload(filePath, success, fail, options, progress, cancelTask); |
|||
} else { |
|||
console.error('qiniu uploader need one of [uptoken, uptokenURL, uptokenFunc]'); |
|||
return; |
|||
} |
|||
} |
|||
|
|||
function doUpload(filePath, success, fail, options, progress, cancelTask) { |
|||
if (null == config.qiniuUploadToken && config.qiniuUploadToken.length > 0) { |
|||
console.error('qiniu UploadToken is null, please check the init config or networking'); |
|||
return |
|||
} |
|||
var url = uploadURLFromRegionCode(config.qiniuRegion); |
|||
var fileName = filePath.split('//')[1]; |
|||
if (options && options.key) { |
|||
fileName = options.key; |
|||
} |
|||
var formData = { |
|||
'token': config.qiniuUploadToken |
|||
}; |
|||
if (!config.qiniuShouldUseQiniuFileName) { |
|||
formData['key'] = fileName |
|||
} |
|||
var uploadTask = wx.uploadFile({ |
|||
url: url, |
|||
filePath: filePath, |
|||
name: 'file', |
|||
formData: formData, |
|||
success: function (res) { |
|||
var dataString = res.data |
|||
if (res.data.hasOwnProperty('type') && res.data.type === 'Buffer') { |
|||
dataString = String.fromCharCode.apply(null, res.data.data) |
|||
} |
|||
try { |
|||
var dataObject = JSON.parse(dataString); |
|||
//do something
|
|||
var imageUrl = config.qiniuImageURLPrefix + '/' + dataObject.key; |
|||
dataObject.imageURL = imageUrl; |
|||
if (success) { |
|||
success(dataObject); |
|||
} |
|||
} catch (e) { |
|||
console.log('parse JSON failed, origin String is: ' + dataString) |
|||
if (fail) { |
|||
fail(e); |
|||
} |
|||
} |
|||
}, |
|||
fail: function (error) { |
|||
console.error(error); |
|||
if (fail) { |
|||
fail(error); |
|||
} |
|||
} |
|||
}) |
|||
|
|||
uploadTask.onProgressUpdate((res) => { |
|||
progress && progress(res) |
|||
}) |
|||
|
|||
cancelTask && cancelTask(() => { |
|||
uploadTask.abort() |
|||
}) |
|||
} |
|||
|
|||
function getQiniuToken(callback) { |
|||
wx.request({ |
|||
url: config.qiniuUploadTokenURL, |
|||
success: function (res) { |
|||
var token = res.data.uptoken; |
|||
if (token && token.length > 0) { |
|||
config.qiniuUploadToken = token; |
|||
if (callback) { |
|||
callback(); |
|||
} |
|||
} else { |
|||
console.error('qiniuUploader cannot get your token, please check the uptokenURL or server') |
|||
} |
|||
}, |
|||
fail: function (error) { |
|||
console.error('qiniu UploadToken is null, please check the init config or networking: ' + error); |
|||
} |
|||
}) |
|||
} |
|||
|
|||
function uploadURLFromRegionCode(code) { |
|||
var uploadURL = null; |
|||
switch (code) { |
|||
case 'ECN': uploadURL = 'https://up.qbox.me'; break; |
|||
case 'NCN': uploadURL = 'https://up-z1.qbox.me'; break; |
|||
case 'SCN': uploadURL = 'https://up-z2.qbox.me'; break; |
|||
case 'NA': uploadURL = 'https://up-na0.qbox.me'; break; |
|||
case 'ASG': uploadURL = 'https://up-as0.qbox.me'; break; |
|||
default: console.error('please make the region is with one of [ECN, SCN, NCN, NA, ASG]'); |
|||
} |
|||
return uploadURL; |
|||
} |
|||
|
|||
})(); |
@ -0,0 +1,230 @@ |
|||
export default class request { |
|||
constructor(options) { |
|||
//请求公共地址
|
|||
this.baseUrl = options.baseUrl || ""; |
|||
//公共文件上传请求地址
|
|||
this.fileUrl = options.fileUrl || ""; |
|||
//默认请求头
|
|||
this.header = options.header || {}; |
|||
//默认配置
|
|||
this.config = { |
|||
isPrompt: options.isPrompt === false ? false : true, |
|||
load: options.load === false ? false : true, |
|||
isFactory: options.isFactory === false ? false : true, |
|||
loadMore: options.loadMore === false ? false : true |
|||
}; |
|||
} |
|||
|
|||
// 获取默认信息
|
|||
getDefault(data, options = {}) { |
|||
//判断url是不是链接
|
|||
let urlType = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+).)+([A-Za-z0-9-~/])+$/.test( |
|||
data.url); |
|||
let config = Object.assign({}, this.config, options, data); |
|||
if (data.method == "FILE") { |
|||
config.url = urlType ? data.url : this.fileUrl + data.url; |
|||
} else { |
|||
config.url = urlType ? data.url : this.baseUrl + data.url; |
|||
} |
|||
//请求头
|
|||
if (options.header) { |
|||
config.header = Object.assign({}, this.header, options.header); |
|||
} else if (data.header) { |
|||
config.header = Object.assign({}, this.header, data.header); |
|||
} else { |
|||
config.header = this.header; |
|||
} |
|||
return config; |
|||
} |
|||
|
|||
//post请求
|
|||
post(url = '', data = {}, options = {}) { |
|||
return this.request({ |
|||
method: "POST", |
|||
data: data, |
|||
url: url, |
|||
...options |
|||
}); |
|||
} |
|||
|
|||
//get请求
|
|||
get(url = '', data = {}, options = {}) { |
|||
return this.request({ |
|||
method: "GET", |
|||
data: data, |
|||
url: url, |
|||
...options |
|||
}); |
|||
} |
|||
|
|||
//put请求
|
|||
put(url = '', data = {}, options = {}) { |
|||
return this.request({ |
|||
method: "PUT", |
|||
data: data, |
|||
url: url, |
|||
...options |
|||
}); |
|||
} |
|||
|
|||
//delete请求
|
|||
delete(url = '', data = {}, options = {}) { |
|||
return this.request({ |
|||
method: "DELETE", |
|||
data: data, |
|||
url: url, |
|||
...options |
|||
}); |
|||
} |
|||
|
|||
//接口请求方法
|
|||
request(data) { |
|||
return new Promise((resolve, reject) => { |
|||
if (!data.url) { |
|||
console.log("request缺失数据url"); |
|||
reject({ |
|||
errMsg: "缺失数据url", |
|||
statusCode: 0 |
|||
}); |
|||
return; |
|||
} |
|||
let requestInfo = this.getDefault(data); |
|||
|
|||
//请求前回调
|
|||
if (this.requestStart) { |
|||
let requestStart = this.requestStart(requestInfo); |
|||
if (typeof requestStart == "object") { |
|||
requestInfo.data = requestStart.data; |
|||
requestInfo.header = requestStart.header; |
|||
requestInfo.isPrompt = requestStart.isPrompt; |
|||
requestInfo.load = requestStart.load; |
|||
requestInfo.isFactory = requestStart.isFactory; |
|||
} else { |
|||
//请求完成回调
|
|||
_this.requestEnd && _this.requestEnd(requestInfo, { |
|||
errMsg: "请求开始拦截器未通过", |
|||
statusCode: 0 |
|||
}); |
|||
reject({ |
|||
errMsg: "请求开始拦截器未通过", |
|||
statusCode: 0 |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
console.log("url: requestInfo.url》》》》", requestInfo.url) |
|||
console.log("url: requestInfo.header》》》》", requestInfo.header) |
|||
let requestData = { |
|||
url: requestInfo.url, |
|||
header: requestInfo.header, //加入请求头
|
|||
|
|||
success: (res) => { |
|||
//请求完成回调
|
|||
this.requestEnd && this.requestEnd(requestInfo, res); |
|||
//是否用外部的数据处理方法
|
|||
if (requestInfo.isFactory && this.dataFactory) { |
|||
//数据处理
|
|||
this.dataFactory({ |
|||
...requestInfo, |
|||
response: res, |
|||
resolve: resolve, |
|||
reject: reject |
|||
}); |
|||
} else { |
|||
resolve(res); |
|||
} |
|||
}, |
|||
fail: (err) => { |
|||
console.log("err"); |
|||
//请求完成回调
|
|||
this.requestEnd && this.requestEnd(requestInfo, err); |
|||
reject(err); |
|||
} |
|||
}; |
|||
//请求类型
|
|||
if (requestInfo.method) { |
|||
requestData.method = requestInfo.method; |
|||
} |
|||
if (requestInfo.data) { |
|||
requestData.data = requestInfo.data; |
|||
} |
|||
// #ifdef MP-WEIXIN || MP-ALIPAY
|
|||
if (requestInfo.timeout) { |
|||
requestData.timeout = requestInfo.timeout; |
|||
} |
|||
// #endif
|
|||
if (requestInfo.dataType) { |
|||
requestData.dataType = requestInfo.dataType; |
|||
} |
|||
// #ifndef APP-PLUS || MP-ALIPAY
|
|||
if (requestInfo.responseType) { |
|||
requestData.responseType = requestInfo.responseType; |
|||
} |
|||
// #endif
|
|||
// #ifdef H5
|
|||
if (requestInfo.withCredentials) { |
|||
requestData.withCredentials = requestInfo.withCredentials; |
|||
} |
|||
// #endif
|
|||
uni.request(requestData); |
|||
}); |
|||
} |
|||
//jsonp请求(只限于H5使用)
|
|||
jsonp(url = '', data = {}, options = {}) { |
|||
let requestInfo = this.getDefault({ |
|||
method: "JSONP", |
|||
data: data, |
|||
url: url, |
|||
}, options); |
|||
let dataStr = ''; |
|||
Object.keys(data).forEach(key => { |
|||
dataStr += key + '=' + data[key] + '&'; |
|||
}); |
|||
//匹配最后一个&并去除
|
|||
if (dataStr !== '') { |
|||
dataStr = dataStr.substr(0, dataStr.lastIndexOf('&')); |
|||
} |
|||
requestInfo.url = requestInfo.url + '?' + dataStr; |
|||
const _this = this; |
|||
return new Promise((resolve, reject) => { |
|||
let callbackName = "callback" + Math.ceil(Math.random() * 1000000); |
|||
if (_this.requestStart) { |
|||
requestInfo.data = data; |
|||
let requestStart = _this.requestStart(requestInfo); |
|||
if (typeof requestStart == "object") { |
|||
requestInfo.data = requestStart.data; |
|||
requestInfo.header = requestStart.header; |
|||
requestInfo.isPrompt = requestStart.isPrompt; |
|||
requestInfo.load = requestStart.load; |
|||
requestInfo.isFactory = requestStart.isFactory; |
|||
} else { |
|||
//请求完成回调
|
|||
_this.requestEnd && _this.requestEnd(requestInfo, { |
|||
errMsg: "请求开始拦截器未通过", |
|||
statusCode: 0 |
|||
}); |
|||
reject({ |
|||
errMsg: "请求开始拦截器未通过", |
|||
statusCode: 0 |
|||
}); |
|||
return; |
|||
} |
|||
} |
|||
// #ifdef H5
|
|||
window[callbackName] = function(data) { |
|||
resolve(data); |
|||
} |
|||
let script = document.createElement("script"); |
|||
script.src = requestInfo.url + "&callback=" + callbackName; |
|||
document.head.appendChild(script); |
|||
// 及时删除,防止加载过多的JS
|
|||
document.head.removeChild(script); |
|||
// #endif
|
|||
//请求完成回调
|
|||
_this.requestEnd && _this.requestEnd(requestInfo, { |
|||
errMsg: "request:ok", |
|||
statusCode: 200 |
|||
}); |
|||
}); |
|||
} |
|||
} |
@ -0,0 +1,229 @@ |
|||
# request请求、配置简单、批量上传图片、超强适应性(很方便的支持多域名请求) |
|||
1. 配置简单、源码清晰注释多、适用于一项目多域名请求、第三方请求、七牛云图片上传、本地服务器图片上传等等 |
|||
2. 支持请求`get`、`post`、`put`、`delete` |
|||
3. 自动显示请求加载动画(可单个接口关闭) |
|||
4. 全局`api`数据处理函数,只回调请求正确的数据(可单个接口关闭) |
|||
5. 未登录或登录失效自动拦截并调用登录方法(可单个接口关闭) |
|||
6. 全局自动提示接口抛出的错误信息(可单个接口关闭) |
|||
7. 支持 Promise |
|||
8. 支持拦截器 |
|||
9. 支持七牛云文件(图片)批量上传 |
|||
10. 支持本地服务器文件(图片)批量上传 |
|||
11. 支持上传文件拦截过滤 |
|||
12. 支持上传文件进度监听 |
|||
13. 支持上传文件单张成功回调 |
|||
|
|||
### QQ交流群(学习干货多多) 607391225 |
|||
 |
|||
|
|||
### 常见问题 |
|||
1.接口请求成功了,没有返回数据或者数据是走的catch回调 |
|||
|
|||
答:`requestConfig.js` 请求配置文件里面,有一个`$http.dataFactory`方法,里面写的只是参考示例,`此方法需要开发者根据各自的接口返回类型修改` |
|||
|
|||
2.官方的方法有数据,本插件方法请求报错跨域问题 |
|||
|
|||
答:`requestConfig.js` 请求配置文件里面,`header`请求头设置的`content-type`请求类型需求和后台保持一致 |
|||
|
|||
3.登录后用户`token`怎么设置? |
|||
|
|||
答:`requestConfig.js` 请求配置文件里面,`$http.requestStart`请求开始拦截器里面设置 |
|||
|
|||
4.怎么判断上传的文件(图片)太大?怎么过滤掉太大的文件(图片)? |
|||
|
|||
答:`requestConfig.js` 请求配置文件里面,`$http.requestStart`请求开始拦截器里面设置 |
|||
|
|||
### 本次更新注意事项 |
|||
1. 所有的headers都改成了header(和官方统一) |
|||
2. 七牛云的获取token等信息提取到了`requestConfig.js`文件,参考如下 |
|||
|
|||
``` |
|||
// 添加获取七牛云token的方法 |
|||
$http.getQnToken = function(callback){ |
|||
//该地址需要开发者自行配置(每个后台的接口风格都不一样) |
|||
$http.get("api/kemean/aid/qn_upload").then(data => { |
|||
/* |
|||
*接口返回参数: |
|||
*visitPrefix:访问文件的域名 |
|||
*token:七牛云上传token |
|||
*folderPath:上传的文件夹 |
|||
*/ |
|||
callback({ |
|||
visitPrefix: data.visitPrefix, |
|||
token: data.token, |
|||
folderPath: data.folderPath |
|||
}); |
|||
}); |
|||
} |
|||
``` |
|||
|
|||
### 文件说明 |
|||
1. `request => request.js` 请求方法的源码文件 |
|||
2. `request => fileUpload.js` 七牛云上传和服务器上传的源码文件 |
|||
3. `request => index.js` 输出方法的文件 |
|||
4. `request => qiniuUploader.js` 七牛云官方上传文件 |
|||
5. `requestConfig.js` 请求配置文件(具体看代码) |
|||
|
|||
### 在main.js引入并挂在Vue上 |
|||
``` |
|||
import $http from '@/zhouWei-request/requestConfig'; |
|||
Vue.prototype.$http = $http; |
|||
``` |
|||
|
|||
### 通用请求方法(此方法不支持文件上传和JSONP) |
|||
``` |
|||
this.$http.request({ |
|||
url: 'aid/region', |
|||
method: "GET", // POST、GET、PUT、DELETE,具体说明查看官方文档 |
|||
data: {pid:0}, |
|||
timeout: 30000, // 默认 30000 说明:超时时间,单位 ms,具体说明查看官方文档 |
|||
dataType: "json", // 默认 json 说明:如果设为 json,会尝试对返回的数据做一次 JSON.parse,具体说明查看官方文档 |
|||
responseType: "text", // 默认 text 说明:设置响应的数据类型。合法值:text、arraybuffer,具体说明查看官方文档 |
|||
withCredentials: false, // 默认 false 说明:跨域请求时是否携带凭证(cookies),具体说明查看官方文档 |
|||
isPrompt: true,//(默认 true 说明:本接口抛出的错误是否提示) |
|||
load: true,//(默认 true 说明:本接口是否提示加载动画) |
|||
header: { //默认 无 说明:请求头 |
|||
'Content-Type': 'application/json' |
|||
}, |
|||
isFactory: true, //(默认 true 说明:本接口是否调用公共的数据处理方法,设置false后isPrompt参数将失去作用) |
|||
}).then(function (response) { |
|||
//这里只会在接口是成功状态返回 |
|||
}).catch(function (error) { |
|||
//这里只会在接口是失败状态返回,不需要去处理错误提示 |
|||
console.log(error); |
|||
}); |
|||
``` |
|||
|
|||
### get请求 正常写法 |
|||
``` |
|||
this.$http.get('aid/region',{pid:0}). |
|||
then(function (response) { |
|||
//这里只会在接口是成功状态返回 |
|||
}).catch(function (error) { |
|||
//这里只会在接口是失败状态返回,不需要去处理错误提示 |
|||
console.log(error); |
|||
}); |
|||
``` |
|||
|
|||
### post请求 async写法 |
|||
``` |
|||
async request(){ |
|||
let data = await this.$http.post('aid/region',{pid:0}); |
|||
console.log(data); |
|||
} |
|||
``` |
|||
|
|||
### 其他功能配置项 |
|||
``` |
|||
let data = await this.$http.post( |
|||
'http://www.aaa.com/aid/region', //可以直接放链接(将不启用全局定义域名) |
|||
{ |
|||
pid:0 |
|||
}, |
|||
{ |
|||
isPrompt: true,//(默认 true 说明:本接口抛出的错误是否提示) |
|||
load: true,//(默认 true 说明:本接口是否提示加载动画) |
|||
header: { //默认 无 说明:请求头 |
|||
'Content-Type': 'application/json' |
|||
}, |
|||
isFactory: true //(默认 true 说明:本接口是否调用公共的数据处理方法,设置false后isPrompt参数将失去作用) |
|||
} |
|||
); |
|||
``` |
|||
|
|||
### 本地服务器图片上传(支持多张上传) |
|||
``` |
|||
this.$http.urlImgUpload('flie/upload',{ |
|||
name:"后台接受文件key名称", //默认 file |
|||
count:"最大选择数",//默认 9 |
|||
sizeType:"选择压缩图原图,默认两个都选",//默认 ['original', 'compressed'] |
|||
sourceType:"选择相机拍照或相册上传 默认两个都选",//默认 ['album','camera'] |
|||
data:"而外参数" //可不填, |
|||
onEachUpdate: res => { |
|||
console.log("单张上传成功返回:",res); |
|||
}, |
|||
onProgressUpdate: res => { |
|||
console.log("上传进度返回:",res); |
|||
} |
|||
},{ |
|||
isPrompt: true,//(默认 true 说明:本接口抛出的错误是否提示) |
|||
load: true,//(默认 true 说明:本接口是否提示加载动画) |
|||
header: { //默认 无 说明:请求头 |
|||
'Content-Type': 'application/json' |
|||
}, |
|||
isFactory: true, //(默认 true 说明:本接口是否调用公共的数据处理方法,设置false后isPrompt参数奖失去作用) |
|||
maxSize: 300000 //(默认 无 说明:上传的文件最大字节数限制,默认不限制) |
|||
}).then(res => { |
|||
console.log("全部上传完返回结果:",res); |
|||
}); |
|||
``` |
|||
### 本地服务器文件上传(支持多张上传) |
|||
``` |
|||
this.$http.urlFileUpload("flie/upload",{ |
|||
files:[], // 必填 临时文件路径 |
|||
data:"向服务器传递的参数", //可不填 |
|||
name:"后台接受文件key名称", //默认 file |
|||
onEachUpdate: res => { |
|||
console.log("单张上传成功返回:",res); |
|||
}, |
|||
onProgressUpdate: res => { |
|||
console.log("上传进度返回:",res); |
|||
} |
|||
}, |
|||
{ |
|||
isPrompt: true,//(默认 true 说明:本接口抛出的错误是否提示) |
|||
load: true,//(默认 true 说明:本接口是否提示加载动画) |
|||
header: { //默认 无 说明:请求头 |
|||
'Content-Type': 'application/json' |
|||
}, |
|||
isFactory: true, //(默认 true 说明:本接口是否调用公共的数据处理方法,设置false后isPrompt参数奖失去作用) |
|||
maxSize: 300000 //(默认 无 说明:上传的文件最大字节数限制,默认不限制) |
|||
}).then(res => { |
|||
console.log("全部上传完返回结果:",res); |
|||
}); |
|||
``` |
|||
|
|||
### 七牛云图片上传(支持多张上传) |
|||
``` |
|||
this.$http.qnImgUpload({ |
|||
count:"最大选择数", // 默认 9 |
|||
sizeType:"选择压缩图原图,默认两个都选", // 默认 ['original', 'compressed'] |
|||
sourceType:"选择相机拍照或相册上传 默认两个都选", // 默认 ['album','camera'] |
|||
onEachUpdate: res => { |
|||
console.log("单张上传成功返回:",res); |
|||
}, |
|||
onProgressUpdate: res => { |
|||
console.log("上传进度返回:",res); |
|||
} |
|||
}, |
|||
{ |
|||
load: true, //(默认 true 说明:本接口是否提示加载动画) |
|||
maxSize: 300000 //(默认 无 说明:上传的文件最大字节数限制,默认不限制) |
|||
}).then(res => { |
|||
console.log("全部上传完返回结果:",res); |
|||
}); |
|||
``` |
|||
|
|||
### 七牛云文件上传(支持多张上传) |
|||
``` |
|||
this.$http.qnFileUpload( |
|||
{ |
|||
files:[], // 必填 临时文件路径 |
|||
onEachUpdate: res => { |
|||
console.log("单张上传成功返回:",res); |
|||
}, |
|||
onProgressUpdate: res => { |
|||
console.log("上传进度返回:",res); |
|||
} |
|||
}, |
|||
{ |
|||
load: true, //(默认 true 说明:本接口是否提示加载动画) |
|||
maxSize: 300000 //(默认 无 说明:上传的文件最大字节数限制,默认不限制) |
|||
}).then(res => { |
|||
console.log("全部上传完返回结果:",res); |
|||
}); |
|||
``` |
|||
### jsonp 跨域请求(只支持H5) |
|||
``` |
|||
let data = await this.$http.jsonp('http://www.aaa.com/aid/region',{pid:0}); |
|||
``` |
@ -1,224 +0,0 @@ |
|||
'use strict' |
|||
|
|||
// 等待初始化完毕
|
|||
document.addEventListener('UniAppJSBridgeReady', () => { |
|||
document.body.onclick = function () { |
|||
return uni.postMessage({ |
|||
data: { |
|||
action: 'onClick' |
|||
} |
|||
}) |
|||
} |
|||
|
|||
uni.postMessage({ |
|||
data: { |
|||
action: 'onJSBridgeReady' |
|||
} |
|||
}) |
|||
}) |
|||
let options |
|||
let medias = [] |
|||
/** |
|||
* @description 获取标签的所有属性 |
|||
* @param {Element} ele |
|||
*/ |
|||
|
|||
function getAttrs(ele) { |
|||
const attrs = Object.create(null) |
|||
|
|||
for (let i = ele.attributes.length; i--;) { |
|||
attrs[ele.attributes[i].name] = ele.attributes[i].value |
|||
} |
|||
|
|||
return attrs |
|||
} |
|||
/** |
|||
* @description 图片加载出错 |
|||
*/ |
|||
|
|||
function onImgError() { |
|||
if (options[1]) { |
|||
this.src = options[1] |
|||
this.onerror = null |
|||
} // 取消监听点击
|
|||
|
|||
this.onclick = null |
|||
this.ontouchstart = null |
|||
uni.postMessage({ |
|||
data: { |
|||
action: 'onError', |
|||
source: 'img', |
|||
attrs: getAttrs(this) |
|||
} |
|||
}) |
|||
} |
|||
/** |
|||
* @description 创建 dom 结构 |
|||
* @param {object[]} nodes 节点数组 |
|||
* @param {Element} parent 父节点 |
|||
* @param {string} namespace 命名空间 |
|||
*/ |
|||
|
|||
function createDom(nodes, parent, namespace) { |
|||
const _loop = function _loop(i) { |
|||
const node = nodes[i] |
|||
let ele = void 0 |
|||
|
|||
if (!node.type || node.type == 'node') { |
|||
let { name } = node // svg 需要设置 namespace
|
|||
|
|||
if (name == 'svg') namespace = 'http://www.w3.org/2000/svg' |
|||
if (name == 'html' || name == 'body') name = 'div' // 创建标签
|
|||
|
|||
if (!namespace) ele = document.createElement(name); else ele = document.createElementNS(namespace, name) // 设置属性
|
|||
|
|||
for (const item in node.attrs) { |
|||
ele.setAttribute(item, node.attrs[item]) |
|||
} // 递归创建子节点
|
|||
|
|||
if (node.children) createDom(node.children, ele, namespace) // 处理图片
|
|||
|
|||
if (name == 'img') { |
|||
if (!ele.src && ele.getAttribute('data-src')) ele.src = ele.getAttribute('data-src') |
|||
|
|||
if (!node.attrs.ignore) { |
|||
// 监听图片点击事件
|
|||
ele.onclick = function (e) { |
|||
e.stopPropagation() |
|||
uni.postMessage({ |
|||
data: { |
|||
action: 'onImgTap', |
|||
attrs: getAttrs(this) |
|||
} |
|||
}) |
|||
} |
|||
} |
|||
|
|||
if (options[2]) { |
|||
image = new Image() |
|||
image.src = ele.src |
|||
ele.src = options[2] |
|||
|
|||
image.onload = function () { |
|||
ele.src = this.src |
|||
} |
|||
|
|||
image.onerror = function () { |
|||
ele.onerror() |
|||
} |
|||
} |
|||
|
|||
ele.onerror = onImgError |
|||
} // 处理链接
|
|||
else if (name == 'a') { |
|||
ele.addEventListener('click', function (e) { |
|||
e.stopPropagation() |
|||
e.preventDefault() // 阻止默认跳转
|
|||
|
|||
const href = this.getAttribute('href') |
|||
let offset |
|||
if (href && href[0] == '#') offset = (document.getElementById(href.substr(1)) || {}).offsetTop |
|||
uni.postMessage({ |
|||
data: { |
|||
action: 'onLinkTap', |
|||
attrs: getAttrs(this), |
|||
offset |
|||
} |
|||
}) |
|||
}, true) |
|||
} // 处理音视频
|
|||
else if (name == 'video' || name == 'audio') { |
|||
medias.push(ele) |
|||
|
|||
if (!node.attrs.autoplay) { |
|||
if (!node.attrs.controls) ele.setAttribute('controls', 'true') // 空白图占位
|
|||
|
|||
if (!node.attrs.poster) ele.setAttribute('poster', "data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'/>") |
|||
} |
|||
|
|||
if (options[3]) { |
|||
ele.onplay = function () { |
|||
for (let _i = 0; _i < medias.length; _i++) { |
|||
if (medias[_i] != this) medias[_i].pause() |
|||
} |
|||
} |
|||
} |
|||
|
|||
ele.onerror = function () { |
|||
uni.postMessage({ |
|||
data: { |
|||
action: 'onError', |
|||
source: name, |
|||
attrs: getAttrs(this) |
|||
} |
|||
}) |
|||
} |
|||
} // 处理表格
|
|||
else if (name == 'table' && options[4] && !ele.style.cssText.includes('inline')) { |
|||
const div = document.createElement('div') |
|||
div.style.overflow = 'auto' |
|||
div.appendChild(ele) |
|||
ele = div |
|||
} else if (name == 'svg') namespace = void 0 |
|||
} else ele = document.createTextNode(node.text.replace(/&/g, '&')) |
|||
|
|||
parent.appendChild(ele) |
|||
} |
|||
|
|||
for (let i = 0; i < nodes.length; i++) { |
|||
var image |
|||
|
|||
_loop(i) |
|||
} |
|||
} // 设置 html 内容
|
|||
|
|||
window.setContent = function (nodes, opts, append) { |
|||
const ele = document.getElementById('content') // 背景颜色
|
|||
|
|||
if (opts[0]) document.body.bgColor = opts[0] // 长按复制
|
|||
|
|||
if (!opts[5]) ele.style.userSelect = 'none' |
|||
|
|||
if (!append) { |
|||
ele.innerHTML = '' // 不追加则先清空
|
|||
|
|||
medias = [] |
|||
} |
|||
|
|||
options = opts |
|||
const fragment = document.createDocumentFragment() |
|||
createDom(nodes, fragment) |
|||
ele.appendChild(fragment) // 触发事件
|
|||
|
|||
let height = ele.scrollHeight |
|||
uni.postMessage({ |
|||
data: { |
|||
action: 'onLoad', |
|||
height |
|||
} |
|||
}) |
|||
clearInterval(window.timer) |
|||
let ready = false |
|||
window.timer = setInterval(() => { |
|||
if (ele.scrollHeight != height) { |
|||
height = ele.scrollHeight |
|||
uni.postMessage({ |
|||
data: { |
|||
action: 'onHeightChange', |
|||
height |
|||
} |
|||
}) |
|||
} else if (!ready) { |
|||
ready = true |
|||
uni.postMessage({ |
|||
data: { |
|||
action: 'onReady' |
|||
} |
|||
}) |
|||
} |
|||
}, 350) |
|||
} // 回收计时器
|
|||
|
|||
window.onunload = function () { |
|||
clearInterval(window.timer) |
|||
} |
@ -1,19 +0,0 @@ |
|||
!(function (e, n) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = n() : typeof define === 'function' && define.amd ? define(n) : (e = e || self).uni = n() }(this, (() => { |
|||
'use strict' |
|||
|
|||
try { const e = {}; Object.defineProperty(e, 'passive', { get() { !0 } }), window.addEventListener('test-passive', null, e) } catch (e) {} const n = Object.prototype.hasOwnProperty; function t(e, t) { return n.call(e, t) } const i = []; const a = function (e, n) { const t = { options: { timestamp: +new Date() }, name: e, arg: n }; if (window.__dcloud_weex_postMessage || window.__dcloud_weex_) { if (e === 'postMessage') { const a = { data: [n] }; return window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessage(a) : window.__dcloud_weex_.postMessage(JSON.stringify(a)) } const o = { type: 'WEB_INVOKE_APPSERVICE', args: { data: t, webviewIds: i } }; window.__dcloud_weex_postMessage ? window.__dcloud_weex_postMessageToService(o) : window.__dcloud_weex_.postMessageToService(JSON.stringify(o)) } if (!window.plus) return window.parent.postMessage({ type: 'WEB_INVOKE_APPSERVICE', data: t, pageId: '' }, '*'); if (i.length === 0) { const r = plus.webview.currentWebview(); if (!r) throw new Error('plus.webview.currentWebview() is undefined'); const d = r.parent(); let s = ''; s = d ? d.id : r.id, i.push(s) } if (plus.webview.getWebviewById('__uniapp__service'))plus.webview.postMessageToUniNView({ type: 'WEB_INVOKE_APPSERVICE', args: { data: t, webviewIds: i } }, '__uniapp__service'); else { const w = JSON.stringify(t); plus.webview.getLaunchWebview().evalJS('UniPlusBridge.subscribeHandler("'.concat('WEB_INVOKE_APPSERVICE', '",').concat(w, ',').concat(JSON.stringify(i), ');')) } }; const o = { |
|||
navigateTo() { const e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; const n = e.url; a('navigateTo', { url: encodeURI(n) }) }, navigateBack() { const e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; const n = e.delta; a('navigateBack', { delta: parseInt(n) || 1 }) }, switchTab() { const e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; const n = e.url; a('switchTab', { url: encodeURI(n) }) }, reLaunch() { const e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; const n = e.url; a('reLaunch', { url: encodeURI(n) }) }, redirectTo() { const e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; const n = e.url; a('redirectTo', { url: encodeURI(n) }) }, getEnv(e) { window.plus ? e({ plus: !0 }) : e({ h5: !0 }) }, postMessage() { const e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; a('postMessage', e.data || {}) } |
|||
}; const r = /uni-app/i.test(navigator.userAgent); const d = /Html5Plus/i.test(navigator.userAgent); const s = /complete|loaded|interactive/; const w = window.my && navigator.userAgent.indexOf('AlipayClient') > -1; const u = window.swan && window.swan.webView && /swan/i.test(navigator.userAgent); const c = window.qq && window.qq.miniProgram && /QQ/i.test(navigator.userAgent) && /miniProgram/i.test(navigator.userAgent); const g = window.tt && window.tt.miniProgram && /toutiaomicroapp/i.test(navigator.userAgent); const v = window.wx && window.wx.miniProgram && /micromessenger/i.test(navigator.userAgent) && /miniProgram/i.test(navigator.userAgent); const p = window.qa && /quickapp/i.test(navigator.userAgent); for (var l, _ = function () { window.UniAppJSBridge = !0, document.dispatchEvent(new CustomEvent('UniAppJSBridgeReady', { bubbles: !0, cancelable: !0 })) }, f = [function (e) { if (r || d) return window.__dcloud_weex_postMessage || window.__dcloud_weex_ ? document.addEventListener('DOMContentLoaded', e) : window.plus && s.test(document.readyState) ? setTimeout(e, 0) : document.addEventListener('plusready', e), o }, function (e) { if (v) return window.WeixinJSBridge && window.WeixinJSBridge.invoke ? setTimeout(e, 0) : document.addEventListener('WeixinJSBridgeReady', e), window.wx.miniProgram }, function (e) { if (c) return window.QQJSBridge && window.QQJSBridge.invoke ? setTimeout(e, 0) : document.addEventListener('QQJSBridgeReady', e), window.qq.miniProgram }, function (e) { |
|||
if (w) { |
|||
document.addEventListener('DOMContentLoaded', e); const n = window.my; return { |
|||
navigateTo: n.navigateTo, navigateBack: n.navigateBack, switchTab: n.switchTab, reLaunch: n.reLaunch, redirectTo: n.redirectTo, postMessage: n.postMessage, getEnv: n.getEnv |
|||
} |
|||
} |
|||
}, function (e) { if (u) return document.addEventListener('DOMContentLoaded', e), window.swan.webView }, function (e) { if (g) return document.addEventListener('DOMContentLoaded', e), window.tt.miniProgram }, function (e) { |
|||
if (p) { |
|||
window.QaJSBridge && window.QaJSBridge.invoke ? setTimeout(e, 0) : document.addEventListener('QaJSBridgeReady', e); const n = window.qa; return { |
|||
navigateTo: n.navigateTo, navigateBack: n.navigateBack, switchTab: n.switchTab, reLaunch: n.reLaunch, redirectTo: n.redirectTo, postMessage: n.postMessage, getEnv: n.getEnv |
|||
} |
|||
} |
|||
}, function (e) { return document.addEventListener('DOMContentLoaded', e), o }], m = 0; m < f.length && !(l = f[m](_)); m++);l || (l = {}); const E = typeof uni !== 'undefined' ? uni : {}; if (!E.navigateTo) for (const b in l)t(l, b) && (E[b] = l[b]); return E.webView = l, E |
|||
}))) |
@ -1 +0,0 @@ |
|||
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"><style>body,html{width:100%;height:100%;overflow:hidden}body{margin:0}video{width:300px;height:225px}img{max-width:100%;-webkit-touch-callout:none}@keyframes show{0%{opacity:0}100%{opacity:1}}</style></head><body><div id="content"></div><script type="text/javascript" src="./js/uni.webview.min.js"></script><script type="text/javascript" src="./js/handler.js"></script></body> |
After Width: | Height: | Size: 187 B |
Before Width: | Height: | Size: 2.1 KiB |
Before Width: | Height: | Size: 862 B |
Before Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 5.3 KiB |
Before Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 401 B |
Before Width: | Height: | Size: 470 B |
Before Width: | Height: | Size: 511 B |
Before Width: | Height: | Size: 476 B |
Before Width: | Height: | Size: 472 B |
Before Width: | Height: | Size: 545 B |
Before Width: | Height: | Size: 365 B |
Before Width: | Height: | Size: 587 B |
Before Width: | Height: | Size: 565 B |
@ -1,363 +0,0 @@ |
|||
(function (window, document, exportName, undefined) { |
|||
"use strict"; |
|||
|
|||
var isMultiTouch = false; |
|||
var multiTouchStartPos; |
|||
var eventTarget; |
|||
var touchElements = {}; |
|||
|
|||
// polyfills
|
|||
if (!document.createTouch) { |
|||
document.createTouch = function (view, target, identifier, pageX, pageY, screenX, screenY, clientX, clientY) { |
|||
// auto set
|
|||
if (clientX == undefined || clientY == undefined) { |
|||
clientX = pageX - window.pageXOffset; |
|||
clientY = pageY - window.pageYOffset; |
|||
} |
|||
|
|||
return new Touch(target, identifier, { |
|||
pageX: pageX, |
|||
pageY: pageY, |
|||
screenX: screenX, |
|||
screenY: screenY, |
|||
clientX: clientX, |
|||
clientY: clientY |
|||
}); |
|||
}; |
|||
} |
|||
|
|||
if (!document.createTouchList) { |
|||
document.createTouchList = function () { |
|||
var touchList = new TouchList(); |
|||
for (var i = 0; i < arguments.length; i++) { |
|||
touchList[i] = arguments[i]; |
|||
} |
|||
touchList.length = arguments.length; |
|||
return touchList; |
|||
}; |
|||
} |
|||
|
|||
/** |
|||
* create an touch point |
|||
* @constructor |
|||
* @param target |
|||
* @param identifier |
|||
* @param pos |
|||
* @param deltaX |
|||
* @param deltaY |
|||
* @returns {Object} touchPoint |
|||
*/ |
|||
function Touch(target, identifier, pos, deltaX, deltaY) { |
|||
deltaX = deltaX || 0; |
|||
deltaY = deltaY || 0; |
|||
|
|||
this.identifier = identifier; |
|||
this.target = target; |
|||
this.clientX = pos.clientX + deltaX; |
|||
this.clientY = pos.clientY + deltaY; |
|||
this.screenX = pos.screenX + deltaX; |
|||
this.screenY = pos.screenY + deltaY; |
|||
this.pageX = pos.pageX + deltaX; |
|||
this.pageY = pos.pageY + deltaY; |
|||
} |
|||
|
|||
/** |
|||
* create empty touchlist with the methods |
|||
* @constructor |
|||
* @returns touchList |
|||
*/ |
|||
function TouchList() { |
|||
var touchList = []; |
|||
|
|||
touchList.item = function (index) { |
|||
return this[index] || null; |
|||
}; |
|||
|
|||
// specified by Mozilla
|
|||
touchList.identifiedTouch = function (id) { |
|||
return this[id + 1] || null; |
|||
}; |
|||
|
|||
return touchList; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* Simple trick to fake touch event support |
|||
* this is enough for most libraries like Modernizr and Hammer |
|||
*/ |
|||
function fakeTouchSupport() { |
|||
var objs = [window, document.documentElement]; |
|||
var props = ['ontouchstart', 'ontouchmove', 'ontouchcancel', 'ontouchend']; |
|||
|
|||
for (var o = 0; o < objs.length; o++) { |
|||
for (var p = 0; p < props.length; p++) { |
|||
if (objs[o] && objs[o][props[p]] == undefined) { |
|||
objs[o][props[p]] = null; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* we don't have to emulate on a touch device |
|||
* @returns {boolean} |
|||
*/ |
|||
function hasTouchSupport() { |
|||
return ("ontouchstart" in window) || // touch events
|
|||
(window.Modernizr && window.Modernizr.touch) || // modernizr
|
|||
(navigator.msMaxTouchPoints || navigator.maxTouchPoints) > 2; // pointer events
|
|||
} |
|||
|
|||
/** |
|||
* disable mouseevents on the page |
|||
* @param ev |
|||
*/ |
|||
function preventMouseEvents(ev) { |
|||
// 注释启用默认事件
|
|||
// ev.preventDefault();
|
|||
// ev.stopPropagation();
|
|||
} |
|||
|
|||
/** |
|||
* only trigger touches when the left mousebutton has been pressed |
|||
* @param touchType |
|||
* @returns {Function} |
|||
*/ |
|||
function onMouse(touchType) { |
|||
return function (ev) { |
|||
// prevent mouse events
|
|||
preventMouseEvents(ev); |
|||
|
|||
if (ev.which !== 1) { |
|||
return; |
|||
} |
|||
|
|||
// The EventTarget on which the touch point started when it was first placed on the surface,
|
|||
// even if the touch point has since moved outside the interactive area of that element.
|
|||
// also, when the target doesnt exist anymore, we update it
|
|||
if (ev.type == 'mousedown' || !eventTarget || (eventTarget && !eventTarget.dispatchEvent)) { |
|||
eventTarget = ev.target; |
|||
} |
|||
|
|||
// shiftKey has been lost, so trigger a touchend
|
|||
if (isMultiTouch && !ev.shiftKey) { |
|||
triggerTouch('touchend', ev); |
|||
isMultiTouch = false; |
|||
} |
|||
|
|||
triggerTouch(touchType, ev); |
|||
|
|||
// we're entering the multi-touch mode!
|
|||
if (!isMultiTouch && ev.shiftKey) { |
|||
isMultiTouch = true; |
|||
multiTouchStartPos = { |
|||
pageX: ev.pageX, |
|||
pageY: ev.pageY, |
|||
clientX: ev.clientX, |
|||
clientY: ev.clientY, |
|||
screenX: ev.screenX, |
|||
screenY: ev.screenY |
|||
}; |
|||
triggerTouch('touchstart', ev); |
|||
} |
|||
|
|||
// reset
|
|||
if (ev.type == 'mouseup') { |
|||
multiTouchStartPos = null; |
|||
isMultiTouch = false; |
|||
eventTarget = null; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* trigger a touch event |
|||
* @param eventName |
|||
* @param mouseEv |
|||
*/ |
|||
function triggerTouch(eventName, mouseEv) { |
|||
var touchEvent = document.createEvent('Event'); |
|||
touchEvent.initEvent(eventName, true, true); |
|||
|
|||
touchEvent.altKey = mouseEv.altKey; |
|||
touchEvent.ctrlKey = mouseEv.ctrlKey; |
|||
touchEvent.metaKey = mouseEv.metaKey; |
|||
touchEvent.shiftKey = mouseEv.shiftKey; |
|||
|
|||
touchEvent.touches = getActiveTouches(mouseEv, eventName); |
|||
touchEvent.targetTouches = getActiveTouches(mouseEv, eventName); |
|||
touchEvent.changedTouches = getChangedTouches(mouseEv, eventName); |
|||
|
|||
eventTarget.dispatchEvent(touchEvent); |
|||
} |
|||
|
|||
/** |
|||
* create a touchList based on the mouse event |
|||
* @param mouseEv |
|||
* @returns {TouchList} |
|||
*/ |
|||
function createTouchList(mouseEv) { |
|||
var touchList = new TouchList(); |
|||
|
|||
if (isMultiTouch) { |
|||
var f = TouchEmulator.multiTouchOffset; |
|||
var deltaX = multiTouchStartPos.pageX - mouseEv.pageX; |
|||
var deltaY = multiTouchStartPos.pageY - mouseEv.pageY; |
|||
|
|||
touchList.push(new Touch(eventTarget, 1, multiTouchStartPos, (deltaX * -1) - f, (deltaY * -1) + f)); |
|||
touchList.push(new Touch(eventTarget, 2, multiTouchStartPos, deltaX + f, deltaY - f)); |
|||
} else { |
|||
touchList.push(new Touch(eventTarget, 1, mouseEv, 0, 0)); |
|||
} |
|||
|
|||
return touchList; |
|||
} |
|||
|
|||
/** |
|||
* receive all active touches |
|||
* @param mouseEv |
|||
* @returns {TouchList} |
|||
*/ |
|||
function getActiveTouches(mouseEv, eventName) { |
|||
// empty list
|
|||
if (mouseEv.type == 'mouseup') { |
|||
return new TouchList(); |
|||
} |
|||
|
|||
var touchList = createTouchList(mouseEv); |
|||
if (isMultiTouch && mouseEv.type != 'mouseup' && eventName == 'touchend') { |
|||
touchList.splice(1, 1); |
|||
} |
|||
return touchList; |
|||
} |
|||
|
|||
/** |
|||
* receive a filtered set of touches with only the changed pointers |
|||
* @param mouseEv |
|||
* @param eventName |
|||
* @returns {TouchList} |
|||
*/ |
|||
function getChangedTouches(mouseEv, eventName) { |
|||
var touchList = createTouchList(mouseEv); |
|||
|
|||
// we only want to return the added/removed item on multitouch
|
|||
// which is the second pointer, so remove the first pointer from the touchList
|
|||
//
|
|||
// but when the mouseEv.type is mouseup, we want to send all touches because then
|
|||
// no new input will be possible
|
|||
if (isMultiTouch && mouseEv.type != 'mouseup' && |
|||
(eventName == 'touchstart' || eventName == 'touchend')) { |
|||
touchList.splice(0, 1); |
|||
} |
|||
|
|||
return touchList; |
|||
} |
|||
|
|||
/** |
|||
* show the touchpoints on the screen |
|||
*/ |
|||
function showTouches(ev) { |
|||
var touch, i, el, styles; |
|||
|
|||
// first all visible touches
|
|||
for (i = 0; i < ev.touches.length; i++) { |
|||
touch = ev.touches[i]; |
|||
el = touchElements[touch.identifier]; |
|||
if (!el) { |
|||
el = touchElements[touch.identifier] = document.createElement("div"); |
|||
document.body.appendChild(el); |
|||
} |
|||
|
|||
styles = TouchEmulator.template(touch); |
|||
for (var prop in styles) { |
|||
el.style[prop] = styles[prop]; |
|||
} |
|||
} |
|||
|
|||
// remove all ended touches
|
|||
if (ev.type == 'touchend' || ev.type == 'touchcancel') { |
|||
for (i = 0; i < ev.changedTouches.length; i++) { |
|||
touch = ev.changedTouches[i]; |
|||
el = touchElements[touch.identifier]; |
|||
if (el) { |
|||
el.parentNode.removeChild(el); |
|||
delete touchElements[touch.identifier]; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* TouchEmulator initializer |
|||
*/ |
|||
function TouchEmulator() { |
|||
if (hasTouchSupport()) { |
|||
return; |
|||
} |
|||
|
|||
fakeTouchSupport(); |
|||
|
|||
window.addEventListener("mousedown", onMouse('touchstart'), true); |
|||
window.addEventListener("mousemove", onMouse('touchmove'), true); |
|||
window.addEventListener("mouseup", onMouse('touchend'), true); |
|||
|
|||
window.addEventListener("mouseenter", preventMouseEvents, true); |
|||
window.addEventListener("mouseleave", preventMouseEvents, true); |
|||
window.addEventListener("mouseout", preventMouseEvents, true); |
|||
window.addEventListener("mouseover", preventMouseEvents, true); |
|||
|
|||
// it uses itself!
|
|||
window.addEventListener("touchstart", showTouches, true); |
|||
window.addEventListener("touchmove", showTouches, true); |
|||
window.addEventListener("touchend", showTouches, true); |
|||
window.addEventListener("touchcancel", showTouches, true); |
|||
} |
|||
|
|||
// start distance when entering the multitouch mode
|
|||
TouchEmulator.multiTouchOffset = 75; |
|||
|
|||
/** |
|||
* css template for the touch rendering |
|||
* @param touch |
|||
* @returns object |
|||
*/ |
|||
TouchEmulator.template = function (touch) { |
|||
var size = 0; |
|||
var transform = 'translate(' + (touch.clientX - (size / 2)) + 'px, ' + (touch.clientY - (size / 2)) + 'px)'; |
|||
return { |
|||
position: 'fixed', |
|||
left: 0, |
|||
top: 0, |
|||
background: '#fff', |
|||
border: 'solid 1px #999', |
|||
opacity: .6, |
|||
borderRadius: '100%', |
|||
height: size + 'px', |
|||
width: size + 'px', |
|||
padding: 0, |
|||
margin: 0, |
|||
display: 'block', |
|||
overflow: 'hidden', |
|||
pointerEvents: 'none', |
|||
webkitUserSelect: 'none', |
|||
mozUserSelect: 'none', |
|||
userSelect: 'none', |
|||
webkitTransform: transform, |
|||
mozTransform: transform, |
|||
transform: transform, |
|||
zIndex: 100 |
|||
} |
|||
}; |
|||
|
|||
// export
|
|||
if (typeof define == "function" && define.amd) { |
|||
define(function () { |
|||
return TouchEmulator; |
|||
}); |
|||
} else if (typeof module != "undefined" && module.exports) { |
|||
module.exports = TouchEmulator; |
|||
} else { |
|||
window[exportName] = TouchEmulator; |
|||
} |
|||
})(window, document, "TouchEmulator"); |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 3.1 MiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1005 B |
Before Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 2.0 KiB |
Before Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.1 KiB |