@@ -0,0 +1,31 @@ | |||
/* | |||
* Eslint config file | |||
* Documentation: https://eslint.org/docs/user-guide/configuring/ | |||
* Install the Eslint extension before using this feature. | |||
*/ | |||
module.exports = { | |||
env: { | |||
es6: true, | |||
browser: true, | |||
node: true, | |||
}, | |||
ecmaFeatures: { | |||
modules: true, | |||
}, | |||
parserOptions: { | |||
ecmaVersion: 2018, | |||
sourceType: 'module', | |||
}, | |||
globals: { | |||
wx: true, | |||
App: true, | |||
Page: true, | |||
getCurrentPages: true, | |||
getApp: true, | |||
Component: true, | |||
requirePlugin: true, | |||
requireMiniProgram: true, | |||
}, | |||
// extends: 'eslint:recommended', | |||
rules: {}, | |||
} |
@@ -0,0 +1,34 @@ | |||
const {request} = require("../request/index") | |||
/** | |||
* 获取省市区树状数据 | |||
* @param {*} params | |||
*/ | |||
export const getCityTree = function(params) { | |||
return request({ | |||
url: '/city/queryCityList', | |||
method: "GET", | |||
params | |||
}) | |||
} | |||
/** | |||
* 获取河流列表 | |||
* @param {*} params | |||
*/ | |||
export const getFeedbackIndex = function(params) { | |||
return request({ | |||
url: '/stream/index', | |||
method: "GET", | |||
params | |||
}) | |||
} | |||
/** | |||
* 反馈问题 | |||
*/ | |||
export const getLogin = function (data) { | |||
return request({ | |||
url: '/feedback/submit', | |||
method: 'POST', | |||
data | |||
}) | |||
} |
@@ -0,0 +1,10 @@ | |||
const {request} = require("../request/index") | |||
/** | |||
* 获取openId | |||
*/ | |||
export const getOpenId = function (code) { | |||
return request({ | |||
url: `/wx/openid/${code}`, | |||
method: 'GET', | |||
}) | |||
} |
@@ -0,0 +1,11 @@ | |||
const {request} = require("../request/index") | |||
/** | |||
* 获取反馈列表 | |||
*/ | |||
export const getFeedbackIndex = function (params) { | |||
return request({ | |||
url: '/feedback/my', | |||
method: 'GET', | |||
params | |||
}) | |||
} |
@@ -0,0 +1,11 @@ | |||
const {request} = require("../request/index") | |||
/** | |||
* 获取oss鉴权信息 | |||
*/ | |||
export const getOssAuth = function (params) { | |||
return request({ | |||
url: '/aliyunOss/getSecurityToken', | |||
method: 'GET', | |||
params | |||
}) | |||
} |
@@ -0,0 +1,46 @@ | |||
// app.js | |||
App({ | |||
onLaunch() { | |||
// 展示本地存储能力 | |||
const logs = wx.getStorageSync('logs') || [] | |||
logs.unshift(Date.now()) | |||
wx.setStorageSync('logs', logs) | |||
// 登录 | |||
// wx.login({ | |||
// success: res => { | |||
// 请求服务端获取用户openId | |||
// console.log(res); | |||
// wx.request({ | |||
// url: 'url', | |||
// data: { | |||
// code: res.data | |||
// }, | |||
// success(res) { | |||
// if (res.data.code === 1) { | |||
// wx.switchTab({ | |||
// url: '/pages/home/index' | |||
// }) | |||
// } else { | |||
// wx.showToast({ | |||
// title: res.msg, | |||
// icon: 'error', | |||
// duration: 1500, | |||
// }) | |||
// } | |||
// }, | |||
// fail(e) { | |||
// wx.showToast({ | |||
// title: '信息获取失败', | |||
// icon: 'error', | |||
// duration: 1500, | |||
// }) | |||
// } | |||
// }) | |||
// } | |||
// }) | |||
}, | |||
globalData: { | |||
userInfo: null | |||
} | |||
}) |
@@ -0,0 +1,52 @@ | |||
{ | |||
"pages": [ | |||
"pages/home/index", | |||
"pages/login/login", | |||
"pages/mine/index" | |||
], | |||
"tabBar": { | |||
"custom": true, | |||
"color": "#939393", | |||
"borderStyle": "white", | |||
"selectedColor": "#477DF3", | |||
"list": [ | |||
{ | |||
"pagePath": "pages/home/index", | |||
"text": "全民护河", | |||
"iconPath": "./assets/tabBar/protect.png", | |||
"selectedIconPath": "./assets/tabBar/protect_h.png" | |||
}, | |||
{ | |||
"pagePath": "pages/mine/index", | |||
"text": "我的", | |||
"iconPath": "./assets/tabBar/mine.png", | |||
"selectedIconPath": "./assets/tabBar/mine_h.png" | |||
} | |||
] | |||
}, | |||
"subPackages": [ | |||
{ | |||
"root": "package_A", | |||
"pages": [ | |||
"pages/report/index", | |||
"pages/sreamDetail/index" | |||
] | |||
}, | |||
{ | |||
"root": "package_B", | |||
"pages": [ | |||
"pages/collection/index", | |||
"pages/records/index", | |||
"pages/feedbackDetail/index" | |||
] | |||
} | |||
], | |||
"window": { | |||
"backgroundTextStyle": "light", | |||
"navigationBarBackgroundColor": "#fff", | |||
"navigationBarTitleText": "Weixin", | |||
"navigationBarTextStyle": "black" | |||
}, | |||
"style": "v2", | |||
"sitemapLocation": "sitemap.json" | |||
} |
@@ -0,0 +1,15 @@ | |||
/**app.wxss**/ | |||
.container { | |||
height: 100%; | |||
display: flex; | |||
flex-direction: column; | |||
align-items: center; | |||
justify-content: space-between; | |||
padding: 200rpx 0; | |||
box-sizing: border-box; | |||
color: #333333; | |||
} | |||
view { | |||
box-sizing: border-box; | |||
color: #333333; | |||
} |
@@ -0,0 +1,91 @@ | |||
// components/List/index.js | |||
import { getDataByPath } from "../../utils/util" | |||
import { get } from "../../utils/api" | |||
Component({ | |||
/** | |||
* 组件的属性列表 | |||
*/ | |||
properties: { | |||
url: { | |||
type: String | |||
}, | |||
dataPath: { | |||
type: String | |||
}, | |||
list: { | |||
type: Array | |||
}, | |||
params: { | |||
type: Object, | |||
}, | |||
limit: { | |||
type: Number, | |||
value: 10 | |||
}, | |||
scrolling:{ | |||
type:Boolean, | |||
value:true, | |||
}, | |||
emptyText:{ | |||
type:String, | |||
value:"暂无数据" | |||
} | |||
}, | |||
/** | |||
* 组件的初始数据 | |||
*/ | |||
data: { | |||
page: 1, | |||
limit: 10, | |||
more: true, | |||
loading: false | |||
}, | |||
// 数据监听器 | |||
observers: { | |||
"url,params"(url) { | |||
if (!url) return | |||
this.resetPage(); | |||
}, | |||
}, | |||
/** | |||
* 组件的方法列表 | |||
*/ | |||
methods: { | |||
loadMore() { | |||
let page = this.data.page + 1; | |||
this.setData({ page }) | |||
this.getData(); | |||
}, | |||
getData() { | |||
if (!this.data.more) return | |||
if (!this.data.loading && (!this.data.params || Object.keys(this.data.params).length > 0)) { | |||
this.setData({ loading: true }) | |||
get(this.data.url, Object.assign({}, { page: this.data.page, limit: this.data.limit }, this.data.params || {})).then(res => { | |||
let records; | |||
if (res.code == 0) { | |||
records = getDataByPath(res, this.data.dataPath || "data.records") | |||
} else { | |||
records = []; | |||
} | |||
if (records.length < this.data.limit) { | |||
this.setData({ more: false }) | |||
} | |||
this.triggerEvent("update-list", records) | |||
}).catch(e => { | |||
wx.showToast({ | |||
title: e || '系统错误', | |||
duration: 1500, | |||
}); | |||
}).finally(() => { | |||
this.setData({ loading: false }) | |||
}) | |||
} | |||
}, | |||
resetPage() { | |||
this.setData({ more: true, page: 1 }) | |||
this.triggerEvent('reset-list') | |||
this.getData(); | |||
} | |||
} | |||
}) |
@@ -0,0 +1,4 @@ | |||
{ | |||
"component": true, | |||
"usingComponents": {} | |||
} |
@@ -0,0 +1,11 @@ | |||
<!--components/List/index.wxml--> | |||
<scroll-view class="list {{list.length>0?'':'min-height'}}" scroll-y="{{scrolling}}" bindscrolltolower="loadMore"> | |||
<slot></slot> | |||
<view class="empty" wx:if="{{!loading && list.length==0}}"> | |||
<image class="image" src="/assets/img/empty.png" mode="aspectFit" lazy-load="false"> | |||
</image> | |||
<view class="empty-text" wx:if="{{emptyText}}"> | |||
{{emptyText}} | |||
</view> | |||
</view> | |||
</scroll-view> |
@@ -0,0 +1,38 @@ | |||
/* components/List/index.wxss */ | |||
.list { | |||
box-sizing: border-box; | |||
width: 100%; | |||
height: 100%; | |||
} | |||
.min-height { | |||
height: 400rpx; | |||
} | |||
::-webkit-scrollbar { | |||
display: none; | |||
width: 0; | |||
height: 0; | |||
color: transparent; | |||
} | |||
.empty { | |||
display: flex; | |||
flex-direction: column; | |||
align-items: center; | |||
justify-content: center; | |||
transform: translateY(100rpx); | |||
} | |||
.empty .image { | |||
height: 201rpx; | |||
width: 306rpx; | |||
} | |||
.empty-text { | |||
font-size: 32rpx; | |||
font-family: "PingFangSC-Regular", "PingFang SC"; | |||
font-weight: normal; | |||
color: #B6CADC; | |||
margin-top: 26rpx; | |||
} |
@@ -0,0 +1,38 @@ | |||
// components/select/index.js | |||
Component({ | |||
/** | |||
* 组件属性列表 | |||
*/ | |||
options: { | |||
styleIsolation: "isolated" | |||
}, | |||
properties: { | |||
data: { | |||
type: Array, | |||
}, | |||
current: { | |||
type: [Number, String] | |||
}, | |||
rangeKey: { | |||
type: String, | |||
default() { | |||
return '' | |||
} | |||
}, | |||
disabled: { | |||
type: Boolean, | |||
default() { | |||
return false | |||
} | |||
} | |||
}, | |||
/** | |||
* 页面的初始数据 | |||
*/ | |||
data: {}, | |||
methods: { | |||
updateChange(e) { | |||
this.triggerEvent('updateChange', {current:e.detail.value}) | |||
}, | |||
} | |||
}) |
@@ -0,0 +1,4 @@ | |||
{ | |||
"component": true, | |||
"usingComponents": {} | |||
} |
@@ -0,0 +1,12 @@ | |||
<!--components/Select/index.wxml--> | |||
<view class="select_box"> | |||
<picker bindchange="updateChange" value="{{current}}" data-current="{{current}}" range="{{data}}" range-key="{{rangeKey}}" disabled="{{disabled}}"> | |||
<view class="picker" wx:if="{{data[current][rangeKey]}}"> | |||
{{data[current][rangeKey]}} | |||
</view> | |||
<view wx:else class="picker" style="color: {{disabled? '#999999': '#333333'}};"> | |||
请选择 | |||
</view> | |||
</picker> | |||
<image class="select_img" src="../../assets/img/select.png"></image> | |||
</view> |
@@ -0,0 +1,23 @@ | |||
/* components/Select/index.wxss */ | |||
.select_box { | |||
width: 160rpx; | |||
padding: 22rpx 0; | |||
display: flex; | |||
justify-content: space-between; | |||
align-items: center; | |||
} | |||
picker { | |||
width: 200rpx; | |||
font-size: 28rpx; | |||
color: #333333; | |||
display: flex; | |||
justify-content: flex-end; | |||
align-items: center; | |||
} | |||
.picker { | |||
margin-right: 30rpx; | |||
} | |||
.select_img { | |||
width: 16rpx; | |||
height: 10rpx; | |||
} |
@@ -0,0 +1,23 @@ | |||
// components/Tab/index.js | |||
Component({ | |||
/** | |||
* 组件的属性列表 | |||
*/ | |||
properties: { | |||
}, | |||
/** | |||
* 组件的初始数据 | |||
*/ | |||
data: { | |||
}, | |||
/** | |||
* 组件的方法列表 | |||
*/ | |||
methods: { | |||
} | |||
}) |
@@ -0,0 +1,4 @@ | |||
{ | |||
"component": true, | |||
"usingComponents": {} | |||
} |
@@ -0,0 +1,2 @@ | |||
<!--components/Tab/index.wxml--> | |||
<text>components/Tab/index.wxml</text> |
@@ -0,0 +1 @@ | |||
/* components/Tab/index.wxss */ |
@@ -0,0 +1,24 @@ | |||
// package_C/component/table/table.js | |||
Component({ | |||
/** | |||
* 组件的属性列表 | |||
*/ | |||
properties: { | |||
data: {type: Array}, | |||
columns: {type: Array} | |||
}, | |||
/** | |||
* 组件的初始数据 | |||
*/ | |||
data: { | |||
}, | |||
/** | |||
* 组件的方法列表 | |||
*/ | |||
methods: { | |||
} | |||
}) |
@@ -0,0 +1,4 @@ | |||
{ | |||
"component": true, | |||
"usingComponents": {} | |||
} |
@@ -0,0 +1,16 @@ | |||
<!--package_C/component/table/table.wxml--> | |||
<view class="table_container"> | |||
<view class="table_title"> | |||
<text class="table_item" style="width:{{item.width}}" wx:for="{{columns}}" wx:key="index">{{item.title}}</text> | |||
</view> | |||
<view class="table_data"> | |||
<view style="background: {{ index%2 == 1 ? '#F5F7F9' : '#fff' }}" class="data_item" wx:for="{{data}}" wx:key="index"> | |||
<view class="table_item" style="width: {{columns[0].width}}">{{item.name}}</view> | |||
<view class="table_item" style="width: {{columns[1].width}}">{{item.y}}/{{item.countQu || item.sumqu}}</view> | |||
<view class="table_item" style="width: {{columns[2].width}}">{{item.a}}</view> | |||
<view class="table_item" style="width: {{columns[3].width}}">{{item.b}}</view> | |||
<view class="table_item" style="width: {{columns[4].width}}">{{item.c}}</view> | |||
<view class="table_item" style="width: {{columns[5].width}}">{{item.d}}</view> | |||
</view> | |||
</view> | |||
</view> |
@@ -0,0 +1,32 @@ | |||
/* package_C/component/table/table.wxss */ | |||
.table_container { | |||
width: 100%; | |||
margin: 24rpx 0; | |||
color: rgba(51, 51, 51, 1); | |||
border: 1rpx solid #efefef; | |||
} | |||
.table_title{ | |||
width: 100%; | |||
padding: 22rpx; | |||
background-color: #F5F7F9; | |||
display: flex; | |||
justify-content: space-between; | |||
align-items: center; | |||
font-size: 27rpx; | |||
font-weight: 700; | |||
} | |||
.table_data { | |||
width: 100%; | |||
color: rgba(51, 51, 51, 1); | |||
font-size: 26rpx; | |||
} | |||
.data_item { | |||
width: 100%; | |||
padding: 20rpx; | |||
display: flex; | |||
justify-content: space-between; | |||
align-items: center; | |||
} | |||
.table_item { | |||
text-align: center; | |||
} |
@@ -0,0 +1,222 @@ | |||
import WxCanvas from './wx-canvas'; | |||
import * as echarts from './echarts'; | |||
let ctx; | |||
function compareVersion(v1, v2) { | |||
v1 = v1.split('.') | |||
v2 = v2.split('.') | |||
const len = Math.max(v1.length, v2.length) | |||
while (v1.length < len) { | |||
v1.push('0') | |||
} | |||
while (v2.length < len) { | |||
v2.push('0') | |||
} | |||
for (let i = 0; i < len; i++) { | |||
const num1 = parseInt(v1[i]) | |||
const num2 = parseInt(v2[i]) | |||
if (num1 > num2) { | |||
return 1 | |||
} else if (num1 < num2) { | |||
return -1 | |||
} | |||
} | |||
return 0 | |||
} | |||
Component({ | |||
properties: { | |||
canvasId: { | |||
type: String, | |||
value: 'ec-canvas' | |||
}, | |||
ec: { | |||
type: Object | |||
}, | |||
forceUseOldCanvas: { | |||
type: Boolean, | |||
value: false | |||
} | |||
}, | |||
data: { | |||
isUseNewCanvas: false | |||
}, | |||
ready: function () { | |||
// Disable prograssive because drawImage doesn't support DOM as parameter | |||
// See https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.drawImage.html | |||
echarts.registerPreprocessor(option => { | |||
if (option && option.series) { | |||
if (option.series.length > 0) { | |||
option.series.forEach(series => { | |||
series.progressive = 0; | |||
}); | |||
} | |||
else if (typeof option.series === 'object') { | |||
option.series.progressive = 0; | |||
} | |||
} | |||
}); | |||
if (!this.data.ec) { | |||
console.warn('组件需绑定 ec 变量,例:<ec-canvas id="mychart-dom-bar" ' | |||
+ 'canvas-id="mychart-bar" ec="{{ ec }}"></ec-canvas>'); | |||
return; | |||
} | |||
if (!this.data.ec.lazyLoad) { | |||
this.init(); | |||
} | |||
}, | |||
methods: { | |||
init: function (callback) { | |||
const version = wx.getSystemInfoSync().SDKVersion | |||
const canUseNewCanvas = compareVersion(version, '2.9.0') >= 0; | |||
const forceUseOldCanvas = this.data.forceUseOldCanvas; | |||
const isUseNewCanvas = canUseNewCanvas && !forceUseOldCanvas; | |||
this.setData({ isUseNewCanvas }); | |||
if (forceUseOldCanvas && canUseNewCanvas) { | |||
console.warn('开发者强制使用旧canvas,建议关闭'); | |||
} | |||
if (isUseNewCanvas) { | |||
// console.log('微信基础库版本大于2.9.0,开始使用<canvas type="2d"/>'); | |||
// 2.9.0 可以使用 <canvas type="2d"></canvas> | |||
this.initByNewWay(callback); | |||
} else { | |||
const isValid = compareVersion(version, '1.9.91') >= 0 | |||
if (!isValid) { | |||
console.error('微信基础库版本过低,需大于等于 1.9.91。' | |||
+ '参见:https://github.com/ecomfe/echarts-for-weixin' | |||
+ '#%E5%BE%AE%E4%BF%A1%E7%89%88%E6%9C%AC%E8%A6%81%E6%B1%82'); | |||
return; | |||
} else { | |||
console.warn('建议将微信基础库调整大于等于2.9.0版本。升级后绘图将有更好性能'); | |||
this.initByOldWay(callback); | |||
} | |||
} | |||
}, | |||
initByNewWay(callback) { | |||
// version >= 2.9.0:使用新的方式初始化 | |||
const query = wx.createSelectorQuery().in(this) | |||
query | |||
.select('.ec-canvas') | |||
.fields({ node: true, size: true }) | |||
.exec(res => { | |||
const canvasNode = res[0].node | |||
this.canvasNode = canvasNode | |||
const canvasDpr = wx.getSystemInfoSync().pixelRatio | |||
const canvasWidth = res[0].width | |||
const canvasHeight = res[0].height | |||
const ctx = canvasNode.getContext('2d') | |||
const canvas = new WxCanvas(ctx, this.data.canvasId, true, canvasNode) | |||
echarts.setCanvasCreator(() => { | |||
return canvas | |||
}) | |||
if (typeof callback === 'function') { | |||
this.chart = callback(canvas, canvasWidth, canvasHeight, canvasDpr) | |||
} else if (this.data.ec && typeof this.data.ec.onInit === 'function') { | |||
this.chart = this.data.ec.onInit(canvas, canvasWidth, canvasHeight, canvasDpr) | |||
} else { | |||
this.triggerEvent('init', { | |||
canvas: canvas, | |||
width: canvasWidth, | |||
height: canvasHeight, | |||
dpr: canvasDpr | |||
}) | |||
} | |||
}) | |||
}, | |||
canvasToTempFilePath(opt) { | |||
if (this.data.isUseNewCanvas) { | |||
// 新版 | |||
const query = wx.createSelectorQuery().in(this) | |||
query | |||
.select('.ec-canvas') | |||
.fields({ node: true, size: true }) | |||
.exec(res => { | |||
const canvasNode = res[0].node | |||
opt.canvas = canvasNode | |||
wx.canvasToTempFilePath(opt) | |||
}) | |||
} else { | |||
// 旧的 | |||
if (!opt.canvasId) { | |||
opt.canvasId = this.data.canvasId; | |||
} | |||
ctx.draw(true, () => { | |||
wx.canvasToTempFilePath(opt, this); | |||
}); | |||
} | |||
}, | |||
touchStart(e) { | |||
if (this.chart && e.touches.length > 0) { | |||
var touch = e.touches[0]; | |||
var handler = this.chart.getZr().handler; | |||
handler.dispatch('mousedown', { | |||
zrX: touch.x, | |||
zrY: touch.y | |||
}); | |||
handler.dispatch('mousemove', { | |||
zrX: touch.x, | |||
zrY: touch.y | |||
}); | |||
handler.processGesture(wrapTouch(e), 'start'); | |||
} | |||
}, | |||
touchMove(e) { | |||
if (this.chart && e.touches.length > 0) { | |||
var touch = e.touches[0]; | |||
var handler = this.chart.getZr().handler; | |||
handler.dispatch('mousemove', { | |||
zrX: touch.x, | |||
zrY: touch.y | |||
}); | |||
handler.processGesture(wrapTouch(e), 'change'); | |||
} | |||
}, | |||
touchEnd(e) { | |||
if (this.chart) { | |||
const touch = e.changedTouches ? e.changedTouches[0] : {}; | |||
var handler = this.chart.getZr().handler; | |||
handler.dispatch('mouseup', { | |||
zrX: touch.x, | |||
zrY: touch.y | |||
}); | |||
handler.dispatch('click', { | |||
zrX: touch.x, | |||
zrY: touch.y | |||
}); | |||
handler.processGesture(wrapTouch(e), 'end'); | |||
} | |||
} | |||
} | |||
}); | |||
function wrapTouch(event) { | |||
for (let i = 0; i < event.touches.length; ++i) { | |||
const touch = event.touches[i]; | |||
touch.offsetX = touch.x; | |||
touch.offsetY = touch.y; | |||
} | |||
return event; | |||
} |
@@ -0,0 +1,4 @@ | |||
{ | |||
"component": true, | |||
"usingComponents": {} | |||
} |
@@ -0,0 +1,4 @@ | |||
<!-- 新的:接口对其了H5 --> | |||
<canvas wx:if="{{isUseNewCanvas}}" type="2d" class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas> | |||
<!-- 旧的 --> | |||
<canvas wx:else class="ec-canvas" canvas-id="{{ canvasId }}" bindinit="init" bindtouchstart="{{ ec.disableTouch ? '' : 'touchStart' }}" bindtouchmove="{{ ec.disableTouch ? '' : 'touchMove' }}" bindtouchend="{{ ec.disableTouch ? '' : 'touchEnd' }}"></canvas> |
@@ -0,0 +1,4 @@ | |||
.ec-canvas { | |||
width: 100%; | |||
height: 100%; | |||
} |
@@ -0,0 +1,105 @@ | |||
export default class WxCanvas { | |||
constructor(ctx, canvasId, isNew, canvasNode) { | |||
this.ctx = ctx; | |||
this.canvasId = canvasId; | |||
this.chart = null; | |||
this.isNew = isNew | |||
if (isNew) { | |||
this.canvasNode = canvasNode; | |||
} | |||
else { | |||
this._initStyle(ctx); | |||
} | |||
// this._initCanvas(zrender, ctx); | |||
this._initEvent(); | |||
} | |||
getContext(contextType) { | |||
if (contextType === '2d') { | |||
return this.ctx; | |||
} | |||
} | |||
// canvasToTempFilePath(opt) { | |||
// if (!opt.canvasId) { | |||
// opt.canvasId = this.canvasId; | |||
// } | |||
// return wx.canvasToTempFilePath(opt, this); | |||
// } | |||
setChart(chart) { | |||
this.chart = chart; | |||
} | |||
attachEvent() { | |||
// noop | |||
} | |||
detachEvent() { | |||
// noop | |||
} | |||
_initCanvas(zrender, ctx) { | |||
zrender.util.getContext = function () { | |||
return ctx; | |||
}; | |||
zrender.util.$override('measureText', function (text, font) { | |||
ctx.font = font || '12px sans-serif'; | |||
return ctx.measureText(text); | |||
}); | |||
} | |||
_initStyle(ctx) { | |||
ctx.createRadialGradient = () => { | |||
return ctx.createCircularGradient(arguments); | |||
}; | |||
} | |||
_initEvent() { | |||
this.event = {}; | |||
const eventNames = [{ | |||
wxName: 'touchStart', | |||
ecName: 'mousedown' | |||
}, { | |||
wxName: 'touchMove', | |||
ecName: 'mousemove' | |||
}, { | |||
wxName: 'touchEnd', | |||
ecName: 'mouseup' | |||
}, { | |||
wxName: 'touchEnd', | |||
ecName: 'click' | |||
}]; | |||
eventNames.forEach(name => { | |||
this.event[name.wxName] = e => { | |||
const touch = e.touches[0]; | |||
this.chart.getZr().handler.dispatch(name.ecName, { | |||
zrX: name.wxName === 'tap' ? touch.clientX : touch.x, | |||
zrY: name.wxName === 'tap' ? touch.clientY : touch.y | |||
}); | |||
}; | |||
}); | |||
} | |||
set width(w) { | |||
if (this.canvasNode) this.canvasNode.width = w | |||
} | |||
set height(h) { | |||
if (this.canvasNode) this.canvasNode.height = h | |||
} | |||
get width() { | |||
if (this.canvasNode) | |||
return this.canvasNode.width | |||
return 0 | |||
} | |||
get height() { | |||
if (this.canvasNode) | |||
return this.canvasNode.height | |||
return 0 | |||
} | |||
} |
@@ -0,0 +1,35 @@ | |||
// components/feedbackInfo/index.js | |||
Component({ | |||
/** | |||
* 组件的属性列表 | |||
*/ | |||
properties: { | |||
dataSource:{ | |||
type:Object, | |||
value:{}, | |||
}, | |||
type: { | |||
type: String, | |||
value: 'todo' | |||
} | |||
}, | |||
/** | |||
* 组件的初始数据 | |||
*/ | |||
data: { | |||
statusList: ['待处理','待处理','已处理','已处理'], | |||
infoList: [ | |||
{key: 'streamName', label:"问题河道:"}, | |||
{key: 'feedbackDesc', label:"问题描述:"}, | |||
{key: 'createTime', label:"反馈时间:"} | |||
] | |||
}, | |||
/** | |||
* 组件的方法列表 | |||
*/ | |||
methods: { | |||
} | |||
}) |
@@ -0,0 +1,4 @@ | |||
{ | |||
"component": true, | |||
"usingComponents": {} | |||
} |
@@ -0,0 +1,10 @@ | |||
<!--components/feedbackInfo/index.wxml--> | |||
<view class="info_container"> | |||
<text class="info_head">{{statusList[dataSource-1]}}</text> | |||
<view class="main_info"> | |||
<view class="info_item" wx:for="{{infoList}}" wx:key="index"> | |||
<text class="info_title">{{item.label}}</text> | |||
<text class="info_value">{{dataSource[item.key]}}</text> | |||
</view> | |||
</view> | |||
</view> |
@@ -0,0 +1 @@ | |||
/* components/feedbackInfo/index.wxss */ |
@@ -0,0 +1,30 @@ | |||
// components/riverInfo/index.js | |||
Component({ | |||
/** | |||
* 组件的属性列表 | |||
*/ | |||
properties: { | |||
dataSource:{ | |||
type:Object, | |||
value:{}, | |||
}, | |||
type: { | |||
type: String, | |||
value: 'todo' | |||
} | |||
}, | |||
/** | |||
* 组件的初始数据 | |||
*/ | |||
data: { | |||
}, | |||
/** | |||
* 组件的方法列表 | |||
*/ | |||
methods: { | |||
} | |||
}) |
@@ -0,0 +1,4 @@ | |||
{ | |||
"component": true, | |||
"usingComponents": {} | |||
} |
@@ -0,0 +1,7 @@ | |||
<!--components/riverInfo/index.wxml--> | |||
<view class="info_container"> | |||
<view class="main_info"> | |||
<text class="info_name">{{dataSource.name}}</text> | |||
<text class="info_area">{{dataSource.location}}</text> | |||
</view> | |||
</view> |
@@ -0,0 +1,22 @@ | |||
/* components/riverInfo/index.wxss */ | |||
.info_container { | |||
width: 100%; | |||
height: 100%; | |||
display: flex; | |||
flex-direction: column; | |||
} | |||
.main_info { | |||
display: flex; | |||
flex-direction: column; | |||
justify-content: flex-start; | |||
align-items: flex-start; | |||
} | |||
.info_name { | |||
margin-bottom: 10px; | |||
font-size: 28rpx; | |||
color: #333333; | |||
} | |||
.info_area { | |||
color: #666666; | |||
font-size: 26rpx; | |||
} |
@@ -0,0 +1,56 @@ | |||
const app = getApp(); | |||
import {getUserInfo} from '../utils/getUserInfo.js' | |||
Component({ | |||
data: { | |||
selected: 0, | |||
color: "#939393", | |||
selectedColor: "#477DF3", | |||
list: [ | |||
{ | |||
pagePath: "/pages/home/index", | |||
iconPath: '../assets/tabBar/protect.png', | |||
selectedIconPath:'../assets/tabBar/protect_h.png', | |||
text: "全民护河", | |||
auth: false, | |||
isSpecial: false | |||
}, | |||
{ | |||
pagePath: "/pages/mine/index", | |||
iconPath: '../assets/tabBar/mine.png', | |||
selectedIconPath:'../assets/tabBar/mine_h.png', | |||
text: "我的", | |||
auth: true, | |||
isSpecial: false | |||
} | |||
], | |||
isIphoneX: app.globalData.isIphoneX | |||
}, | |||
methods: { | |||
switchTab(e) { | |||
const dataset = e.currentTarget.dataset | |||
const path = dataset.path | |||
const index = dataset.index | |||
const auth = dataset.auth | |||
const openId = wx.getStorageSync('openId') | |||
if(auth) { | |||
if(openId) { | |||
wx.switchTab({ | |||
url: path | |||
}) | |||
} else { | |||
getUserInfo().then(res=> { | |||
wx.switchTab({ | |||
url: path | |||
}) | |||
}) | |||
} | |||
} else { | |||
//正常的tabbar切换界面 | |||
wx.switchTab({ | |||
url: path | |||
}) | |||
} | |||
} | |||
} | |||
}) |
@@ -0,0 +1,3 @@ | |||
{ | |||
"component": true | |||
} |
@@ -0,0 +1,11 @@ | |||
<!--miniprogram/custom-tab-bar/index.wxml--> | |||
<cover-view class="tab-bar" style='height:{{isIphoneX?166:120}}rpx;'> | |||
<cover-view class="tab-bar-border"></cover-view> | |||
<cover-view wx:for="{{list}}" wx:key="index" class="tab-bar-item" data-path="{{item.pagePath}}" data-index="{{index}}" data-auth="{{item.auth}}" bindtap="switchTab"> | |||
<cover-image | |||
class="tab-bar-item-image" | |||
src="{{selected === index ? item.selectedIconPath : item.iconPath}}"> | |||
</cover-image> | |||
<cover-view style="color: {{selected === index ? selectedColor : color}}">{{item.text}}</cover-view> | |||
</cover-view> | |||
</cover-view> |
@@ -0,0 +1,41 @@ | |||
.tab-bar { | |||
position: fixed; | |||
bottom: 0px; | |||
left: 0px; | |||
right: 0px; | |||
width: 100%; | |||
height: 120rpx; | |||
background: white; | |||
display: flex; | |||
flex-direction: row; | |||
padding-bottom: env(safe-area-inset-bottom); | |||
} | |||
.tab-bar-border { | |||
background-color: rgba(85, 83, 83, 0.33); | |||
position: absolute; | |||
left: 0; | |||
top: 0; | |||
width: 100%; | |||
height: 1px; | |||
transform: scaleY(0.5); | |||
} | |||
.tab-bar-item { | |||
flex: 1; | |||
text-align: center; | |||
display: flex; | |||
align-items: center; | |||
flex-direction: column; | |||
justify-content: center; | |||
} | |||
.tab-bar-item-image { | |||
width: 56rpx; | |||
height: 56rpx; | |||
margin-top: 10rpx; | |||
} | |||
.tab-bar-item cover-view { | |||
font-size: 20rpx; | |||
} |
@@ -0,0 +1,11 @@ | |||
const __request_base_url__ = { | |||
develop: "http://192.168.11.11:9061/api", | |||
trial: "https://api.gongche.dev.taauav.com/api", | |||
release: "https://api.gongche.taauav.com/api" | |||
} | |||
const platform = wx.getSystemInfoSync().platform | |||
const envVersion = wx.getAccountInfoSync().miniProgram.envVersion | |||
const env = platform === 'devtools' ? 'develop' : ( envVersion || 'release' ) | |||
const baseurl = __request_base_url__[env] | |||
export default baseurl |
@@ -0,0 +1,199 @@ | |||
// package_A/work/index.js | |||
import {getOssAuth} from '../../../api/uploadOss.js' | |||
Page({ | |||
/** | |||
* 页面的初始数据 | |||
*/ | |||
data: { | |||
form: {}, | |||
ossForm: {}, | |||
imagePreviewList: [], // 上传图片预览列表 | |||
imageList: [], // 图片列表 | |||
// 表单验证 | |||
formRules: { | |||
location: { | |||
validator: function (value) { | |||
return value; | |||
}, | |||
warning: false | |||
}, | |||
feedbackDesc: { | |||
validator: function (value) { | |||
return value; | |||
}, | |||
warning: false | |||
}, | |||
feedbackName: { | |||
validator: function (value) { | |||
return value; | |||
}, | |||
warning: false | |||
}, | |||
feedbackPhone: { | |||
validator: function (value) { | |||
return value; | |||
}, | |||
warning: false | |||
}, | |||
imageList: { | |||
validator: function (value) { | |||
return value.length!=0; | |||
}, | |||
warning: false | |||
} | |||
} | |||
}, | |||
/** | |||
* 生命周期函数--监听页面加载 | |||
*/ | |||
onLoad: function (options) { | |||
let data = JSON.parse(options.data) | |||
let form = this.data.form | |||
form.streamName = data.name | |||
form.streamId = data.streamId | |||
this.setData({form}) | |||
}, | |||
/** | |||
* 生命周期函数--监听页面初次渲染完成 | |||
*/ | |||
onReady: function () { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面显示 | |||
*/ | |||
onShow: function () { | |||
}, | |||
bindValue(e) { | |||
let name = e.currentTarget.dataset.name; | |||
let form = this.data.form; | |||
form[name] = e.detail.value; | |||
this.setData({ | |||
form, | |||
}) | |||
this.validate(name, e.detail.value) | |||
}, | |||
validate(name) { | |||
let formRules = this.data.formRules; | |||
let validator = formRules[name].validator | |||
let result | |||
if(name === 'imageList') { | |||
result = validator ? !validator(this.data.imageList) : false | |||
} else { | |||
result = validator ? !validator(this.data.form[name]) : false; | |||
} | |||
formRules[name].warning = result | |||
this.setData({formRules}) | |||
return result | |||
}, | |||
validateForm() { | |||
return new Promise((resolve, reject) => { | |||
try { | |||
let formRules = this.data.formRules; | |||
let result = false; | |||
for (let key in formRules) { | |||
let temp = this.validate(key) | |||
if (temp) { | |||
result = temp | |||
} | |||
} | |||
resolve(!result) | |||
} catch (e) { | |||
reject(e) | |||
} | |||
}) | |||
}, | |||
/* 获取图片上传鉴权 */ | |||
getOssAuthForm() { | |||
let that = this | |||
getOssAuth().then(res=> { | |||
let client = { | |||
region: 'oss-cn-shanghai', | |||
secure: true, | |||
accessKeyId: res.data.accessKeyId, | |||
accessKeySecret: res.data.accessKeySecret, | |||
securityToken: res.data.securityToken, | |||
bucket: 'ta-tech-image' | |||
} | |||
// 计算签名 | |||
function computeSignature(accessKeySecret, canonicalString) { | |||
return crypto.enc.Base64.stringify(crypto.HmacSHA1(canonicalString, accessKeySecret)); | |||
} | |||
const date = new Date(); | |||
date.setHours(date.getHours() + 1); | |||
const policyText = { | |||
expiration: date.toISOString(), // 设置policy过期时间。 | |||
conditions: [ | |||
// 限制上传大小。 | |||
["content-length-range", 0, 1024 * 1024 * 1024], | |||
], | |||
}; | |||
// 获取签名 | |||
const policy = Base64.encode(JSON.stringify(policyText)) // policy必须为base64的string。 | |||
const signature = computeSignature(client.accessKeySecret, policy) | |||
let ossForm = that.data.ossForm | |||
ossForm = { | |||
OSSAccessKeyId: client.accessKeyId, | |||
signature, | |||
policy, | |||
SecurityToken: client.securityToken | |||
} | |||
that.setData({ossForm}) | |||
}) | |||
}, | |||
/* 上传图片 */ | |||
uploadImage(){ | |||
wx.chooseMedia({ | |||
count: 5 - this.data.imageList.length, // 最多可以选择的图片张数,默认9 | |||
mediaType: ['image'], // 图片 | |||
sizeType: ['original'], // original 原图,compressed 压缩图,默认二者都有 | |||
sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机,默认二者都有 | |||
success: (res) => { | |||
// success | |||
let imagePreviewList = this.data.imagePreviewList.concat(res.tempFiles) | |||
let imageList = this.data.imageList.concat(res.tempFiles); | |||
this.setData({ imageList, imagePreviewList }) | |||
this.validate('imageList') | |||
}, | |||
fail: (e) => { | |||
console.log(e); | |||
} | |||
}) | |||
}, | |||
// 删除图片 | |||
deleteImage(e) { | |||
let index = this.getCurrentData(e); | |||
let imageList = this.data.imageList | |||
imageList.splice(index, 1) | |||
let imagePreviewList = this.data.imagePreviewList | |||
imagePreviewList.splice(index, 1) | |||
this.setData({ imageList, imagePreviewList }) | |||
this.validate('imageList') | |||
}, | |||
getCurrentData(e) { | |||
return e.currentTarget.dataset.current; | |||
}, | |||
/* 取消 */ | |||
returnLastPage() { | |||
this.setData({ | |||
form: {} | |||
}) | |||
wx.navigateBack({ | |||
delta: 1, | |||
}) | |||
}, | |||
/* 表单上传 */ | |||
submit(){ | |||
wx.navigateBack({ | |||
delta: 1, | |||
}) | |||
} | |||
}) |
@@ -0,0 +1,3 @@ | |||
{ | |||
"usingComponents": {} | |||
} |
@@ -0,0 +1,66 @@ | |||
<!--package_A/work/index.wxml--> | |||
<view class="upload_container"> | |||
<image class="head_img" mode="widthFix" src="../../../assets/img/upload_head.png"></image> | |||
<view class="form_container"> | |||
<view class="form_item"> | |||
<text><text style="color: red;">*</text>选择河道:</text> | |||
<view class="value_box disable_class"> | |||
<text class="picker_carnum">{{form.streamName}}</text> | |||
</view> | |||
</view> | |||
<view class="form_item {{formRules.location.warning ? 'warning' : ''}}"> | |||
<text><text style="color: red;">*</text>问题位置:</text> | |||
<view class="value_box"> | |||
<text wx:if="{{form.location}}" class="picker_carnum">{{form.location}}</text> | |||
<text wx:else style="font-size: 24rpx; color: #A6A6A6;">请选择问题位置</text> | |||
<image src="../../assets/img/location.png" style="width:48rpx;height:48rpx;position: absolute;right: 10rpx;top: 6rpx;"></image> | |||
</view> | |||
<text class="tips">请选择问题位置</text> | |||
</view> | |||
<view class="use_purpose {{formRules.location.warning ? 'warning' : ''}}"> | |||
<text><text style="color: red;">*</text>问题描述:</text> | |||
<view class="value_box"> | |||
<textarea maxlength="40" style="width:500rpx; height: 160rpx;" type="text" placeholder="请输入用车目的" placeholder-style="font-size: 24rpx; color: #A6A6A6;" value="{{form.applyRemark}}" | |||
data-name="applyRemark" bindinput="bindValue" name="applyRemark" bindblur="bindValue" /> | |||
</view> | |||
<text class="tips">请输入问题描述</text> | |||
</view> | |||
<view class="form_item {{formRules.feedbackName.warning ? 'warning' : ''}}"> | |||
<text><text style="color: red;">*</text>姓名:</text> | |||
<view class="value_box"> | |||
<text class="picker_carnum">{{form.feedbackName}}</text> | |||
<input type="text" placeholder="请输入您的姓名" placeholder-style="font-size: 24rpx; color: #A6A6A6;" adjust-position="{{false}}" value="{{form.feedbackName}}" | |||
data-name="feedbackName" bindinput="bindValue" name="feedbackName" bindblur="bindValue" /> | |||
</view> | |||
<text class="tips">请输入您的姓名</text> | |||
</view> | |||
<view class="form_item {{formRules.feedbackPhone.warning ? 'warning' : ''}}"> | |||
<text><text style="color: red;">*</text>电话号码:</text> | |||
<view class="value_box"> | |||
<text class="picker_carnum">{{form.feedbackPhone}}</text> | |||
<input maxlength="11" type="text" placeholder="请输入您的电话号码" placeholder-style="font-size: 24rpx; color: #A6A6A6;" adjust-position="{{false}}" value="{{form.feedbackPhone}}" | |||
data-name="feedbackPhone" bindinput="bindValue" name="feedbackPhone" bindblur="bindValue" /> | |||
</view> | |||
<text class="tips">请输入您的电话号码</text> | |||
</view> | |||
<view class="upload_images {{formRules.imageList.warning? 'warning': ''}}"> | |||
<text><text style="color: red;">*</text>上传照片:</text> | |||
<view class="image_list"> | |||
<view class="image_preview" wx:for="{{imagePreviewList}}" wx:key="index"> | |||
<image class="image_item" src="{{item.tempFilePath}}" mode="aspectFill" data-item="{{item.tempFilePath}}" bindtap="showImagePreview"> | |||
</image> | |||
<div class="close" data-current="{{index}}" catchtap="deleteImage"></div> | |||
</view> | |||
<view class="upload_image" bindtap="uploadImage" wx:if="{{imageList.length<5}}"> | |||
<image style="height: 56rpx;width: 56rpx;" mode="widthFix" src="../../assets/img/upload.png"></image> | |||
</view> | |||
</view> | |||
<text class="tips">请上传图片</text> | |||
</view> | |||
</view> | |||
<view class="btn_list"> | |||
<view class="btn_item cancel_btn" bindtap="returnLastPage">取消</view> | |||
<view class="btn_item submit_btn" bindtap="submit">确认</view> | |||
</view> | |||
</view> |
@@ -0,0 +1,181 @@ | |||
/* package_A/work/index.wxss */ | |||
.upload_container { | |||
width: 100%; | |||
display: flex; | |||
flex-direction: column; | |||
justify-content: flex-start; | |||
align-items: flex-start; | |||
} | |||
.head_img { | |||
width: 100vw; | |||
} | |||
.form_container { | |||
width: 100%; | |||
padding: 30rpx; | |||
display: flex; | |||
flex-direction: column; | |||
justify-content: flex-start; | |||
align-items: flex-start; | |||
} | |||
.form_item { | |||
width: 100%; | |||
margin-bottom: 30rpx; | |||
display: flex; | |||
justify-content: space-between; | |||
align-items: center; | |||
position: relative; | |||
font-size: 28rpx; | |||
color: #666666; | |||
} | |||
.use_purpose { | |||
width: 100%; | |||
margin-bottom: 30rpx; | |||
display: flex; | |||
justify-content: space-between; | |||
align-items: flex-start; | |||
position: relative; | |||
font-size: 28rpx; | |||
color: #666666; | |||
} | |||
.value_box { | |||
width: 500rpx; | |||
min-height: 68rpx; | |||
padding: 10rpx; | |||
display: flex; | |||
justify-content: flex-start; | |||
align-items: center; | |||
border: 1rpx solid #A6A6A6; | |||
border-radius: 4rpx; | |||
position: relative; | |||
color: #333333; | |||
font-size: 24rpx; | |||
} | |||
.disable_class { | |||
border: none; | |||
background-color: #EFEFEF; | |||
} | |||
.tips{ | |||
position: absolute; | |||
bottom: -40rpx; | |||
left: -30rpx; | |||
color: red; | |||
font-size: 26rpx; | |||
transform: translate(27rpx, -5rpx); | |||
display: none; | |||
} | |||
.form_item.warning .tips, .use_purpose.warning .tips, .upload_images.warning .tips{ | |||
display: block; | |||
} | |||
/* 上传图片 */ | |||
.upload_images { | |||
width: 100%; | |||
margin-bottom: 30px; | |||
display: flex; | |||
justify-content: space-between; | |||
align-items: flex-start; | |||
font-size: 28rpx; | |||
color: #666666; | |||
position: relative; | |||
} | |||
.image_list { | |||
width: 500rpx; | |||
margin-top: 20rpx; | |||
display: flex; | |||
flex-wrap: wrap; | |||
justify-content: flex-start; | |||
align-content: flex-start; | |||
} | |||
.image_preview { | |||
height: 200rpx; | |||
width: 200rpx; | |||
margin-right: 20rpx; | |||
position: relative; | |||
} | |||
.image_item { | |||
height:100%; | |||
width: 100%; | |||
} | |||
.close{ | |||
position: absolute; | |||
top:0; | |||
right:0; | |||
transform: translate(40%,-40%); | |||
height:50rpx; | |||
width:50rpx; | |||
background:rgba(179, 179, 179, 0.5); | |||
border-radius: 50%; | |||
z-index: 10; | |||
} | |||
.close::before{ | |||
content: ""; | |||
display: block; | |||
position: absolute; | |||
width: 60%; | |||
height: 6rpx; | |||
top:50%; | |||
left:50%; | |||
background:rgb(124, 124, 124); | |||
transform-origin: center; | |||
/* transform: ; */ | |||
transform: translate(-50%,-50%) rotate(45deg); | |||
} | |||
.close::after{ | |||
content: ""; | |||
display: block; | |||
position: absolute; | |||
width: 60%; | |||
height: 6rpx; | |||
top:50%; | |||
left:50%; | |||
background:rgb(124, 124, 124); | |||
transform-origin: center; | |||
/* transform: ; */ | |||
transform: translate(-50%,-50%) rotate(-45deg); | |||
} | |||
.upload_image { | |||
width: 200rpx; | |||
height: 200rpx; | |||
display: flex; | |||
flex-direction: column; | |||
align-items: center; | |||
justify-content: center; | |||
border: 1rpx dashed rgba(220, 222, 224, 1); | |||
border-radius: 10rpx; | |||
} | |||
.upload_image text { | |||
color: rgba(0, 0, 0, 0.5); | |||
font-size: 30rpx; | |||
} | |||
.note_mark { | |||
margin-top: 20rpx; | |||
font-size: 24rpx; | |||
color: rgba(153, 153, 153, 1); | |||
} | |||
/* 按钮区 */ | |||
.btn_list { | |||
width: 100%; | |||
margin-top: 30rpx; | |||
padding: 30rpx; | |||
display: flex; | |||
justify-content: space-between; | |||
align-items: center; | |||
} | |||
.btn_item { | |||
width: 320rpx; | |||
height: 80rpx; | |||
border-radius: 40rpx; | |||
line-height: 80rpx; | |||
text-align: center; | |||
font-size: 28rpx; | |||
} | |||
.cancel_btn { | |||
color: #333333; | |||
border: 1rpx solid #E6E6E6; | |||
} | |||
.submit_btn { | |||
color: #ffffff; | |||
background-color: #477DF3; | |||
} |
@@ -0,0 +1,66 @@ | |||
// package_A/pages/sreamDetail/index.js | |||
Page({ | |||
/** | |||
* 页面的初始数据 | |||
*/ | |||
data: { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面加载 | |||
*/ | |||
onLoad(options) { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面初次渲染完成 | |||
*/ | |||
onReady() { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面显示 | |||
*/ | |||
onShow() { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面隐藏 | |||
*/ | |||
onHide() { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面卸载 | |||
*/ | |||
onUnload() { | |||
}, | |||
/** | |||
* 页面相关事件处理函数--监听用户下拉动作 | |||
*/ | |||
onPullDownRefresh() { | |||
}, | |||
/** | |||
* 页面上拉触底事件的处理函数 | |||
*/ | |||
onReachBottom() { | |||
}, | |||
/** | |||
* 用户点击右上角分享 | |||
*/ | |||
onShareAppMessage() { | |||
} | |||
}) |
@@ -0,0 +1,3 @@ | |||
{ | |||
"usingComponents": {} | |||
} |
@@ -0,0 +1,2 @@ | |||
<!--package_A/pages/sreamDetail/index.wxml--> | |||
<text>package_A/pages/sreamDetail/index.wxml</text> |
@@ -0,0 +1 @@ | |||
/* package_A/pages/sreamDetail/index.wxss */ |
@@ -0,0 +1,66 @@ | |||
// package_B/mine/index.js | |||
Page({ | |||
/** | |||
* 页面的初始数据 | |||
*/ | |||
data: { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面加载 | |||
*/ | |||
onLoad: function (options) { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面初次渲染完成 | |||
*/ | |||
onReady: function () { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面显示 | |||
*/ | |||
onShow: function () { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面隐藏 | |||
*/ | |||
onHide: function () { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面卸载 | |||
*/ | |||
onUnload: function () { | |||
}, | |||
/** | |||
* 页面相关事件处理函数--监听用户下拉动作 | |||
*/ | |||
onPullDownRefresh: function () { | |||
}, | |||
/** | |||
* 页面上拉触底事件的处理函数 | |||
*/ | |||
onReachBottom: function () { | |||
}, | |||
/** | |||
* 用户点击右上角分享 | |||
*/ | |||
onShareAppMessage: function () { | |||
} | |||
}) |
@@ -0,0 +1,3 @@ | |||
{ | |||
"usingComponents": {} | |||
} |
@@ -0,0 +1,2 @@ | |||
<!--package_B/mine/index.wxml--> | |||
<text>package_B/mine/index.wxml</text> |
@@ -0,0 +1 @@ | |||
/* package_B/mine/index.wxss */ |
@@ -0,0 +1,66 @@ | |||
// package_B/pages/feedbackDetail/index.js | |||
Page({ | |||
/** | |||
* 页面的初始数据 | |||
*/ | |||
data: { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面加载 | |||
*/ | |||
onLoad(options) { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面初次渲染完成 | |||
*/ | |||
onReady() { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面显示 | |||
*/ | |||
onShow() { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面隐藏 | |||
*/ | |||
onHide() { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面卸载 | |||
*/ | |||
onUnload() { | |||
}, | |||
/** | |||
* 页面相关事件处理函数--监听用户下拉动作 | |||
*/ | |||
onPullDownRefresh() { | |||
}, | |||
/** | |||
* 页面上拉触底事件的处理函数 | |||
*/ | |||
onReachBottom() { | |||
}, | |||
/** | |||
* 用户点击右上角分享 | |||
*/ | |||
onShareAppMessage() { | |||
} | |||
}) |
@@ -0,0 +1,3 @@ | |||
{ | |||
"usingComponents": {} | |||
} |
@@ -0,0 +1,2 @@ | |||
<!--package_B/pages/feedbackDetail/index.wxml--> | |||
<text>package_B/pages/feedbackDetail/index.wxml</text> |
@@ -0,0 +1 @@ | |||
/* package_B/pages/feedbackDetail/index.wxss */ |
@@ -0,0 +1,66 @@ | |||
// package_B/records/index.js | |||
Page({ | |||
/** | |||
* 页面的初始数据 | |||
*/ | |||
data: { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面加载 | |||
*/ | |||
onLoad: function (options) { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面初次渲染完成 | |||
*/ | |||
onReady: function () { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面显示 | |||
*/ | |||
onShow: function () { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面隐藏 | |||
*/ | |||
onHide: function () { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面卸载 | |||
*/ | |||
onUnload: function () { | |||
}, | |||
/** | |||
* 页面相关事件处理函数--监听用户下拉动作 | |||
*/ | |||
onPullDownRefresh: function () { | |||
}, | |||
/** | |||
* 页面上拉触底事件的处理函数 | |||
*/ | |||
onReachBottom: function () { | |||
}, | |||
/** | |||
* 用户点击右上角分享 | |||
*/ | |||
onShareAppMessage: function () { | |||
} | |||
}) |
@@ -0,0 +1,3 @@ | |||
{ | |||
"usingComponents": {} | |||
} |
@@ -0,0 +1,2 @@ | |||
<!--package_B/records/index.wxml--> | |||
<text>package_B/records/index.wxml</text> |
@@ -0,0 +1 @@ | |||
/* package_B/records/index.wxss */ |
@@ -0,0 +1,138 @@ | |||
// pages/home/index.js | |||
import {getUserInfo} from '../../utils/getUserInfo.js' | |||
import {getCityTree} from '../../api/feeddback.js' | |||
Page({ | |||
/** | |||
* 页面的初始数据 | |||
*/ | |||
data: { | |||
// 区域选项列表 | |||
provinceOptions: [], | |||
cityOptions: [], | |||
distractOptions: [], | |||
provinceCurrent: -1, // 当前选择省 | |||
cityCurrent: -1, | |||
distractCurrent: -1, | |||
// 列表数据筛选条件 | |||
params: { | |||
streamName: '' | |||
}, | |||
streamName: '', | |||
list: [], | |||
current: "/stream/index", | |||
}, | |||
/** | |||
* 生命周期函数--监听页面加载 | |||
*/ | |||
onLoad: function (options) { | |||
this.getTabBar().setData({ | |||
selected: 0 | |||
}) | |||
this.getCityTreeList() | |||
}, | |||
/** | |||
* 生命周期函数--监听页面初次渲染完成 | |||
*/ | |||
onReady: function () { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面显示 | |||
*/ | |||
onShow: function () { | |||
}, | |||
/* 调取当前用户区域 */ | |||
/* 获取省市区 */ | |||
getCityTreeList() { | |||
getCityTree().then(res=> { | |||
this.setData({ | |||
provinceOptions: res.data | |||
}) | |||
}) | |||
}, | |||
/* 筛选 */ | |||
updateAreaChange(e) { | |||
const type = e.target.dataset.type | |||
const current = e.detail.current | |||
let params = this.data.params | |||
let code = this.data[type+'Options'][current].citycode | |||
params[type+'Code'] = code | |||
let itemList = this.data[type+'Options'][current].itemList || [] | |||
if(type === 'province') { | |||
this.setData({ | |||
provinceCurrent: current, | |||
cityOptions: itemList, | |||
cityCurrent: -1, | |||
distractCurrent: -1 | |||
}) | |||
params.cityCode = "" | |||
params.distractCode = "" | |||
params.streamName = '' | |||
} else if(type === 'city') { | |||
this.setData({ | |||
distractOptions: itemList, | |||
cityCurrent: current, | |||
distractCurrent: -1 | |||
}) | |||
params.distractCode = "" | |||
params.streamName = '' | |||
} else if(type === 'distract') { | |||
this.setData({distractCurrent: current}) | |||
params.streamName = '' | |||
} | |||
this.setData({ | |||
params: params | |||
}) | |||
}, | |||
/* 根据current获取当前选中的值 */ | |||
getValueByCurrent(current,type) { | |||
let code = this.data[type+'Options'][current].value | |||
return code | |||
}, | |||
/* 输入河流名称搜索 */ | |||
search(e) { | |||
let params = this.data.params | |||
params.streamName = this.data.streamName | |||
this.setData({ params: params }) | |||
}, | |||
/* 更新数据 */ | |||
updateList(e) { | |||
let list = this.data.list.concat(e.detail) | |||
this.setData({ list }) | |||
}, | |||
/* 重置数据 */ | |||
resetList() { | |||
this.setData({ list: [] }) | |||
}, | |||
/* 跳转上报问题页面 */ | |||
uploadProblem(e) { | |||
let detail = e.currentTarget.dataset.detail | |||
let openId = wx.getStorageSync('openId') | |||
if(openId) { | |||
wx.navigateTo({ | |||
url: '/package_A/pages/report/index?data=' + JSON.stringify(detail), | |||
}) | |||
} else { | |||
getUserInfo().then(res=> { | |||
wx.navigateTo({ | |||
url: '/package_A/pages/report/index?data=' + JSON.stringify(detail), | |||
}) | |||
}) | |||
} | |||
}, | |||
/* 跳转至详情页 */ | |||
showDetail(e) { | |||
} | |||
}) |
@@ -0,0 +1,8 @@ | |||
{ | |||
"usingComponents": { | |||
"list": "../../components/List/index", | |||
"select": "../../components/Select/index", | |||
"riverInfo": "../../components/riverInfo/index" | |||
}, | |||
"navigationBarTitleText": "全民护河" | |||
} |
@@ -0,0 +1,26 @@ | |||
<!--pages/home/index.wxml--> | |||
<view class="protecityct_container"> | |||
<view class="protect_head"> | |||
<view class="select_container"> | |||
<select data="{{provinceOptions}}" data-type="province" rangeKey="name" current="{{provinceCurrent}}" bind:updateChange="updateAreaChange"></select> | |||
<select data="{{cityOptions}}" data-type="city" rangeKey="name" current="{{cityCurrent}}" bind:updateChange="updateAreaChange"></select> | |||
<select data="{{distractOptions}}" data-type="distract" rangeKey="name" current="{{distractCurrent}}" bind:updateChange="updateAreaChange"></select> | |||
</view> | |||
<view class="search_container"> | |||
<image class="search_icon" src="../../assets/img/search.png"></image> | |||
<input class="task-search" type="text" placeholder="请输入河道名称进行查询" model:value="{{streamName}}" placeholder-class="placeholder-style" bindconfirm="search" bindblur="search"/> | |||
</view> | |||
</view> | |||
<list id="list" class="river_list" url="{{current}}" bind:update-list="updateList" list="{{list}}" bind:reset-list="resetList" params="{{params}}"> | |||
<view class="river_item" data-current="{{index}}" bindtap="showDetail" wx:for="{{list}}" wx:key="index"> | |||
<view class="river_info"> | |||
<view class="massage_box"> | |||
<image class="river_img" src="{{item.image}}"></image> | |||
<riverInfo dataSource="{{item}}"></riverInfo> | |||
</view> | |||
<view class="execute_btn" bindtap="uploadProblem" data-current="{{index}}" data-detail="{{item}}">上报问题</view> | |||
</view> | |||
</view> | |||
</list> | |||
</view> |
@@ -0,0 +1,87 @@ | |||
/* pages/home/index.wxss */ | |||
.protect_container { | |||
width: 100%; | |||
display: flex; | |||
flex-direction: column; | |||
justify-content: flex-start; | |||
align-items: center; | |||
color: #333333; | |||
} | |||
.protect_head { | |||
width: 100%; | |||
display: flex; | |||
flex-direction: column; | |||
justify-content: flex-start; | |||
} | |||
.select_container { | |||
width: 100%; | |||
height: 82rpx; | |||
background-color: #fff; | |||
display: flex; | |||
justify-content: space-around; | |||
align-items: center; | |||
} | |||
.search_container { | |||
width: 100%; | |||
box-sizing: border-box; | |||
padding: 12rpx 30rpx; | |||
background: #fff; | |||
position: relative; | |||
} | |||
.search_icon{ | |||
height: 60rpx; | |||
width: 60rpx; | |||
position: absolute; | |||
top:50%; | |||
left:51rpx; | |||
transform: translateY(-50%); | |||
} | |||
.task-search { | |||
height: 60rpx; | |||
text-align: left; | |||
background: #F3F4F5; | |||
border-radius: 30rpx; | |||
font-size: 28rpx; | |||
padding-left: 80rpx; | |||
} | |||
.placeholder-style{ | |||
font-family: "PingFangSC-Regular", "PingFang SC"; | |||
font-weight: normal; | |||
color: #a6a6a6; | |||
} | |||
/* 列表样式 */ | |||
.river_item { | |||
width: 100%; | |||
padding: 0 30rpx; | |||
} | |||
.river_info { | |||
width: 100%; | |||
padding: 30rpx 0; | |||
border-bottom: 1rpx solid #E6E6E6; | |||
display: flex; | |||
justify-content: space-between; | |||
align-items: flex-end; | |||
} | |||
.massage_box { | |||
display: flex; | |||
justify-content: flex-start; | |||
align-items: flex-start; | |||
} | |||
.river_img { | |||
width: 178rpx; | |||
height: 144rpx; | |||
margin-right: 20rpx; | |||
} | |||
.execute_btn { | |||
box-sizing: border-box; | |||
width: 144rpx; | |||
height: 56rpx; | |||
border-radius: 34rpx; | |||
line-height: 56rpx; | |||
text-align: center; | |||
background-color: #477DF3; | |||
font-size: 24rpx; | |||
font-weight: normal; | |||
color: #fff; | |||
} |
@@ -0,0 +1,66 @@ | |||
// pages/login/login.js | |||
import {getUserInfo} from '../../utils/getUserInfo.js' | |||
Page({ | |||
/** | |||
* 页面的初始数据 | |||
*/ | |||
data: { | |||
userInfo: {}, | |||
hasUserInfo: false, | |||
canIUseGetUserProfile: false | |||
}, | |||
/** | |||
* 生命周期函数--监听页面加载 | |||
*/ | |||
onLoad: function (options) { | |||
if (wx.getUserProfile) { | |||
this.setData({ | |||
canIUseGetUserProfile: true | |||
}) | |||
} | |||
}, | |||
/** | |||
* 生命周期函数--监听页面初次渲染完成 | |||
*/ | |||
onReady: function () { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面显示 | |||
*/ | |||
onShow: function () { | |||
// 隐藏返回图标 | |||
wx.hideHomeButton(); | |||
}, | |||
getUserProfile(e) { | |||
// 推荐使用 wx.getUserProfile 获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认 | |||
// 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 | |||
let userInfo = wx.getStorageSync('userInfo') | |||
if(!userInfo.nickName) { | |||
getUserInfo().then(res=> { | |||
console.log(res, '================'); | |||
this.setData({ | |||
userInfo: res.userInfo | |||
}) | |||
wx.switchTab({ | |||
url: '/pages/home/index', | |||
}) | |||
}) | |||
} else { | |||
wx.switchTab({ | |||
url: '/pages/home/index', | |||
}) | |||
} | |||
}, | |||
getUserInfo(e) { | |||
// 不推荐使用 getUserInfo 获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息 | |||
this.setData({ | |||
userInfo: e.detail.userInfo, | |||
hasUserInfo: true | |||
}) | |||
}, | |||
}) |
@@ -0,0 +1,4 @@ | |||
{ | |||
"usingComponents": {}, | |||
"navigationBarTitleText": "登录" | |||
} |
@@ -0,0 +1,13 @@ | |||
<!--pages/login/login.wxml--> | |||
<view class="login_box"> | |||
<view class="userinfo"> | |||
<block wx:if="{{!hasUserInfo}}"> | |||
<button wx:if="{{canIUseGetUserProfile}}" bindtap="getUserProfile"> 获取头像昵称 </button> | |||
<button wx:else open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button> | |||
</block> | |||
<block wx:else> | |||
<image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image> | |||
<text class="userinfo-nickname">{{userInfo.nickName}}</text> | |||
</block> | |||
</view> | |||
</view> |
@@ -0,0 +1,75 @@ | |||
/* pages/login/login.wxss */ | |||
.login_box { | |||
width: 100vw; | |||
height: 100vh; | |||
display: flex; | |||
flex-direction: column; | |||
justify-content: center; | |||
align-items: center; | |||
} | |||
.form_box { | |||
display: flex; | |||
flex-direction: column; | |||
justify-content: flex-start; | |||
align-items: flex-end; | |||
} | |||
.login_box .form-item{ | |||
padding-bottom:50rpx; | |||
position: relative; | |||
} | |||
.login_box .form-item input{ | |||
width: 532rpx; | |||
height: 80rpx; | |||
padding-left: 20px; | |||
border-radius: 39rpx; | |||
background-color: #fafafa; | |||
} | |||
.login_box .tips{ | |||
position: absolute; | |||
bottom: 0; | |||
left:0; | |||
color: red; | |||
font-size:26rpx; | |||
transform: translate(20rpx,-10rpx); | |||
display: none; | |||
} | |||
.login_box .form-item.warning .tips{ | |||
display: block; | |||
} | |||
.check_lable { | |||
box-sizing: border-box; | |||
height: 60rpx; | |||
display: flex; | |||
justify-content: flex-end; | |||
align-items: center; | |||
color: #b0b0b0; | |||
} | |||
.check_contanier { | |||
width: 100%; | |||
display: flex; | |||
justify-content: flex-end; | |||
align-items: center; | |||
} | |||
.check_box { | |||
width: 30rpx; | |||
height: 30rpx; | |||
margin-right: 20rpx; | |||
} | |||
radio-group { | |||
width: 200rpx; | |||
align-self: flex-end !important; | |||
} | |||
checkbox .wx-checkbox-input { | |||
width: 30rpx; | |||
height: 30rpx; | |||
margin-bottom: 10rpx; | |||
} | |||
.login_btn { | |||
margin-top: 80rpx; | |||
color: #fff; | |||
font-weight: normal; | |||
border-radius: 39rpx; | |||
background-color: #477DF3; | |||
} |
@@ -0,0 +1,71 @@ | |||
// pages/mine/index.js | |||
Page({ | |||
/** | |||
* 页面的初始数据 | |||
*/ | |||
data: { | |||
userInfo: {}, // 用户授权信息 | |||
}, | |||
/** | |||
* 生命周期函数--监听页面加载 | |||
*/ | |||
onLoad: function (options) { | |||
this.getTabBar().setData({ | |||
selected: 1 | |||
}) | |||
this.setData({ | |||
userInfo: wx.getStorageSync('userInfo') | |||
}) | |||
}, | |||
/** | |||
* 生命周期函数--监听页面初次渲染完成 | |||
*/ | |||
onReady: function () { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面显示 | |||
*/ | |||
onShow: function () { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面隐藏 | |||
*/ | |||
onHide: function () { | |||
}, | |||
/** | |||
* 生命周期函数--监听页面卸载 | |||
*/ | |||
onUnload: function () { | |||
}, | |||
/** | |||
* 页面相关事件处理函数--监听用户下拉动作 | |||
*/ | |||
onPullDownRefresh: function () { | |||
}, | |||
/** | |||
* 页面上拉触底事件的处理函数 | |||
*/ | |||
onReachBottom: function () { | |||
}, | |||
/** | |||
* 用户点击右上角分享 | |||
*/ | |||
onShareAppMessage: function () { | |||
} | |||
}) |
@@ -0,0 +1,4 @@ | |||
{ | |||
"usingComponents": {}, | |||
"navigationBarTitleText": "我的" | |||
} |
@@ -0,0 +1,17 @@ | |||
<!--pages/mine/index.wxml--> | |||
<view class="mine_container"> | |||
<view class="user_massage"> | |||
<image class="user_avatar" src="{{userInfo.avatarUrl}}"></image> | |||
<text class="user_name">{{userInfo.nickName}}</text> | |||
</view> | |||
<view class="function_list"> | |||
<view class="function_item"> | |||
<view class="item_title"> | |||
<image style="height: 40rpx;width: 40rpx;margin-right: 15rpx;" src="../../assets/img/record.png"></image> | |||
<text style="font-size: 24rpx;">我的反馈</text> | |||
</view> | |||
<image style="height: 48rpx;width: 48rpx;" src="../../assets/img/more.png"></image> | |||
</view> | |||
</view> | |||
</view> |
@@ -0,0 +1,46 @@ | |||
/* pages/mine/index.wxss */ | |||
.mine_container { | |||
width: 100%; | |||
height: 100vh; | |||
background-color: #F3F4F5; | |||
display: flex; | |||
flex-direction: column; | |||
justify-content: flex-start; | |||
align-items: center; | |||
} | |||
.user_massage { | |||
width: 100%; | |||
height: 200rpx; | |||
padding: 36rpx 60rpx; | |||
background-color: #ffffff; | |||
display: flex; | |||
justify-content: flex-start; | |||
align-items: center; | |||
} | |||
.user_avatar { | |||
width: 128rpx; | |||
height: 128rpx; | |||
border-radius: 50%; | |||
margin-right: 30rpx; | |||
} | |||
.function_list { | |||
width: 100%; | |||
margin-top: 30rpx; | |||
background-color: #ffffff; | |||
display: flex; | |||
flex-direction: column; | |||
justify-content: flex-start; | |||
align-items: center; | |||
} | |||
.function_item { | |||
width: 100%; | |||
padding: 20rpx 30rpx; | |||
display: flex; | |||
justify-content: space-between; | |||
align-items: center; | |||
} | |||
.item_title { | |||
display: flex; | |||
justify-content: flex-start; | |||
align-items: center; | |||
} |
@@ -0,0 +1,80 @@ | |||
{ | |||
"description": "项目配置文件", | |||
"ignoreDevUnusedFiles": "false", | |||
"ignoreUploadUnusedFiles": false, | |||
"packOptions": { | |||
"ignore": [ | |||
{ | |||
"value": ".eslintrc.js", | |||
"type": "file" | |||
} | |||
], | |||
"include": [] | |||
}, | |||
"setting": { | |||
"urlCheck": false, | |||
"es6": true, | |||
"enhance": true, | |||
"postcss": true, | |||
"preloadBackgroundData": false, | |||
"minified": true, | |||
"newFeature": false, | |||
"coverView": true, | |||
"nodeModules": false, | |||
"autoAudits": false, | |||
"showShadowRootInWxmlPanel": true, | |||
"scopeDataCheck": false, | |||
"uglifyFileName": false, | |||
"checkInvalidKey": true, | |||
"checkSiteMap": true, | |||
"uploadWithSourceMap": true, | |||
"compileHotReLoad": false, | |||
"lazyloadPlaceholderEnable": false, | |||
"useMultiFrameRuntime": true, | |||
"useApiHook": true, | |||
"useApiHostProcess": true, | |||
"babelSetting": { | |||
"ignore": [], | |||
"disablePlugins": [], | |||
"outputPath": "" | |||
}, | |||
"enableEngineNative": false, | |||
"useIsolateContext": true, | |||
"userConfirmedBundleSwitch": false, | |||
"packNpmManually": false, | |||
"packNpmRelationList": [], | |||
"minifyWXSS": true, | |||
"disableUseStrict": false, | |||
"minifyWXML": true, | |||
"showES6CompileOption": false, | |||
"useCompilerPlugins": false | |||
}, | |||
"compileType": "miniprogram", | |||
"libVersion": "2.19.4", | |||
"appid": "wxd0f247d7272ca1b7", | |||
"projectname": "weixin-app", | |||
"condition": { | |||
"search": { | |||
"list": [] | |||
}, | |||
"conversation": { | |||
"list": [] | |||
}, | |||
"game": { | |||
"list": [] | |||
}, | |||
"plugin": { | |||
"list": [] | |||
}, | |||
"gamePlugin": { | |||
"list": [] | |||
}, | |||
"miniprogram": { | |||
"list": [] | |||
} | |||
}, | |||
"editorSetting": { | |||
"tabIndent": "insertSpaces", | |||
"tabSize": 4 | |||
} | |||
} |
@@ -0,0 +1,43 @@ | |||
{ | |||
"setting": { | |||
"compileHotReLoad": true | |||
}, | |||
"condition": { | |||
"miniprogram": { | |||
"list": [ | |||
{ | |||
"name": "登录", | |||
"pathName": "pages/login/login", | |||
"query": "", | |||
"scene": null | |||
}, | |||
{ | |||
"name": "我的", | |||
"pathName": "pages/mine/index", | |||
"query": "", | |||
"scene": null | |||
}, | |||
{ | |||
"name": "全民护河", | |||
"pathName": "pages/home/index", | |||
"query": "", | |||
"scene": null | |||
}, | |||
{ | |||
"name": "全民护河", | |||
"pathName": "pages/home/index", | |||
"query": "", | |||
"scene": null | |||
}, | |||
{ | |||
"name": "上传问题", | |||
"pathName": "package_A/report/index", | |||
"query": "data=%5Bobject%20Object%5D", | |||
"scene": null | |||
} | |||
] | |||
} | |||
}, | |||
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html", | |||
"projectname": "%E5%85%A8%E6%B0%91%E6%8A%A4%E6%B2%B3%E5%B0%8F%E7%A8%8B%E5%BA%8F" | |||
} |
@@ -0,0 +1,37 @@ | |||
import baseurl from '../environment.js' | |||
export const request = function(data) { | |||
return new Promise((resolve, reject) => { | |||
if(data.showLoading) { | |||
wx.showLoading({ | |||
title: '加载中', | |||
mask: true | |||
}) | |||
} | |||
// 接口api拼接环境地址 | |||
data.url = baseurl + data.url | |||
wx.request({ | |||
...data, | |||
success: function(res) { | |||
// 处理请求 | |||
if(res.data.code == 0) { // 请求成功状态码 | |||
resolve(res.data) | |||
} else { | |||
reject(res.data.msg) | |||
} | |||
}, | |||
fail: function (error) { | |||
reject(error) | |||
}, | |||
complete: function () { | |||
if (data.showLoading) { | |||
wx.hideLoading() | |||
} | |||
} | |||
}) | |||
}).catch(e => { | |||
wx.showToast({ | |||
icon: "error", | |||
title: e || '系统错误', | |||
}) | |||
}) | |||
} |
@@ -0,0 +1,5 @@ | |||
const WITHOUT_TOKEN_API = [{url: '/member/login', method: 'POST'}] | |||
export const isWithoutToken = function({url, method=''}){ | |||
return WITHOUT_TOKEN_API.some((item) => item.url === url && item.method === method.toUpperCase()) | |||
} |
@@ -0,0 +1,7 @@ | |||
{ | |||
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", | |||
"rules": [{ | |||
"action": "allow", | |||
"page": "*" | |||
}] | |||
} |
@@ -0,0 +1,35 @@ | |||
const { request } = require("../request/index"); | |||
/** | |||
* get | |||
*/ | |||
export const get = function (url, params, showLoading = true) { | |||
return request({ | |||
url: url, | |||
method: "GET", | |||
data: params, | |||
showLoading | |||
}) | |||
} | |||
/** | |||
* post | |||
*/ | |||
export const post = function (url, params, showLoading = true) { | |||
return request({ | |||
url: url, | |||
method: "POST", | |||
data: params, | |||
showLoading | |||
}) | |||
} | |||
/** | |||
* put | |||
*/ | |||
export const put = function (url, params) { | |||
return request({ | |||
url: url, | |||
method: "PUT", | |||
data: params | |||
}) | |||
} |
@@ -0,0 +1,31 @@ | |||
import {getOpenId} from '../api/login.js' | |||
export function getUserInfo() { | |||
return new Promise((resolve)=> { | |||
wx.getUserProfile({ | |||
desc: '用于完善会员资料', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 | |||
success: (res) => { | |||
wx.setStorage({ | |||
key: 'userInfo', | |||
data: res.userInfo | |||
}) | |||
wx.login({ | |||
success: result=> { | |||
let code = result.code | |||
getOpenId(code).then((data=> { | |||
wx.setStorage({ | |||
key: 'openId', | |||
data: data.data | |||
}) | |||
resolve({ | |||
openId: data.data, | |||
userInfo: res.userInfo | |||
}) | |||
})) | |||
} | |||
}) | |||
} | |||
}) | |||
}) | |||
} |
@@ -0,0 +1,95 @@ | |||
export const formatTime = date => { | |||
const year = date.getFullYear() | |||
const month = date.getMonth() + 1 | |||
const day = date.getDate() | |||
const hour = date.getHours() | |||
const minute = date.getMinutes() | |||
const second = date.getSeconds() | |||
return `${[year, month, day].map(formatNumber).join('-')} ${[hour, minute, second].map(formatNumber).join(':')}` | |||
} | |||
const formatNumber = n => { | |||
n = n.toString() | |||
return n[1] ? n : `0${n}` | |||
} | |||
export let isType = (type, target) => Object.prototype.toString.call(target) == `[object ${type}]` | |||
export function getDataByPath(data, dataPath) { | |||
dataPath = dataPath.split('.'); | |||
for (let key of dataPath) { | |||
if (!data) return null; | |||
data = data[key] | |||
} | |||
return data; | |||
} | |||
/** | |||
* 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换 | |||
* 即谷歌、高德 转 百度 | |||
*/ | |||
var x_PI = 3.14159265358979324 * 3000.0 / 180.0; | |||
var PI = 3.1415926535897932384626; | |||
var a = 6378245.0; | |||
var ee = 0.00669342162296594323; | |||
export function out_of_china(lng, lat) { | |||
return (lng < 72.004 || lng > 137.8347) || ((lat < 0.8293 || lat > 55.8271) || false); | |||
} | |||
export function gcj02tobd09(lng, lat) { | |||
var z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * x_PI); | |||
var theta = Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * x_PI); | |||
var bd_lng = z * Math.cos(theta) + 0.0065; | |||
var bd_lat = z * Math.sin(theta) + 0.006; | |||
return [bd_lng, bd_lat] | |||
} | |||
export function transformlat(lng, lat) { | |||
var ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng)); | |||
ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0; | |||
ret += (20.0 * Math.sin(lat * PI) + 40.0 * Math.sin(lat / 3.0 * PI)) * 2.0 / 3.0; | |||
ret += (160.0 * Math.sin(lat / 12.0 * PI) + 320 * Math.sin(lat * PI / 30.0)) * 2.0 / 3.0; | |||
return ret | |||
} | |||
export function transformlng(lng, lat) { | |||
var ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng)); | |||
ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0; | |||
ret += (20.0 * Math.sin(lng * PI) + 40.0 * Math.sin(lng / 3.0 * PI)) * 2.0 / 3.0; | |||
ret += (150.0 * Math.sin(lng / 12.0 * PI) + 300.0 * Math.sin(lng / 30.0 * PI)) * 2.0 / 3.0; | |||
return ret | |||
} | |||
export function wgs84togcj02(coordinate) { | |||
let lng = coordinate[0]; | |||
let lat = coordinate[1]; | |||
if (out_of_china(lng, lat)) { | |||
return [lng, lat] | |||
} | |||
else { | |||
var dlat = transformlat(lng - 105.0, lat - 35.0); | |||
var dlng = transformlng(lng - 105.0, lat - 35.0); | |||
var radlat = lat / 180.0 * PI; | |||
var magic = Math.sin(radlat); | |||
magic = 1 - ee * magic * magic; | |||
var sqrtmagic = Math.sqrt(magic); | |||
dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI); | |||
dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI); | |||
var mglat = parseFloat(lat) + parseFloat(dlat); | |||
var mglng = parseFloat(lng) + parseFloat(dlng); | |||
return [mglng, mglat] | |||
} | |||
} | |||
export function foramtRegion(arr,data){ | |||
for(let item of data){ | |||
let tem=[] | |||
for(let key of arr){ | |||
if(item[key]){ | |||
tem.push(item[key]) | |||
}else{ | |||
break; | |||
} | |||
} | |||
item.region=tem.join("/"); | |||
} | |||
return data; | |||
} | |||