提交 0b1b2905 编写于 作者: I iotjin

update UI

上级 63ed4df3
......@@ -11,7 +11,7 @@
* 上下拉刷新、分组吸顶ListView
* 答题功能
* excel导入导出
* md5、base64、AES、SHA256
* md5、base64、AES、SHA256、RSA
* 表格
* 树结构数据展示
* 侧滑筛选
......
......@@ -14,7 +14,7 @@ Component({
type: String,
value: '请选择',
},
// 字符串数组
// 对象数组 格式:[{name: "一般", id: "0"},{name: "严重", id: "1"}]
textArr: {
type: Array,
value: [],
......@@ -54,6 +54,7 @@ Component({
var that = this
setTimeout(function () {
that.setData({
pickerTextArr: that.properties.textArr,
pickerSelectIndexArr: [that.properties.selectIndex]
})
}, 300)
......@@ -75,7 +76,8 @@ Component({
//点击确定按钮
confirm: function (event) {
let indexArr = this.data.pickerSelectIndexArr
var selectText = this.data.pickerTextArr[indexArr[0]]
let selectText = this.data.pickerTextArr[indexArr[0]].name
let selectIndex = this.data.pickerTextArr[indexArr[0]].id
// console.log("点击确定按钮: " + selectText);
this.setData({
isShowPicker: false
......@@ -83,7 +85,7 @@ Component({
//传递选中的text
var dic = {
value: selectText,
index: indexArr[0]
index: selectIndex
}
this.triggerEvent('confirm', dic);
}
......@@ -97,9 +99,6 @@ Component({
attached: function () {
// 页面创建时执行
// console.info('---JhStringPicker loaded!---');
this.setData({
pickerTextArr: this.properties.textArr
})
}
}
......@@ -115,7 +114,7 @@ Component({
data: {
isShowPicker: false,
stringPickerTextArr: ['一', '二', '三']
stringPickerTextArr: [{name: "一般", id: "0"},{name: "严重", id: "1"}]
},
// 弹出
......
<van-popup position="bottom" custom-style="height: 50%;" show="{{isShowPicker}}" bind:close="hiddenPicker"
bind:before-enter="willShowPopView">
<view class="bgView">
<view class="pickerTool">
<view class="pickerCancel" bindtap="cancel">取消</view>
......@@ -11,9 +10,8 @@
indicator-style="height: 40px;border-top:1px solid #eee;border-bottom:1px solid #eee;"
value="{{pickerSelectIndexArr}}" bindchange="onChange">
<picker-view-column class="pickerColumn0">
<view wx:for="{{pickerTextArr}}" wx:key='index' class="pickerColumnText">{{item}}</view>
<view wx:for="{{pickerTextArr}}" wx:key='index' class="pickerColumnText">{{item.name}}</view>
</picker-view-column>
</picker-view>
</view>
</van-popup>
\ No newline at end of file
......@@ -99,8 +99,37 @@ Component({
ss = '0' + ss;
}
let time = selectText + ':' + ss;
this.triggerEvent('confirm', time);
}
let timeStamp = this.Jh_convertTimeStamp(time)
this.triggerEvent('confirm', {
time: time,
timeStamp: timeStamp
});
},
/**
* 将某个时间转化成时间戳
* 时间格式:2019-05-20 00:00:00 或 2019年5月1日 00:00:00
* 返回值:1556640000000,13位时间戳
*/
Jh_convertTimeStamp(time) {
//用正则主要是把“2019-05-20 00:00:00”转换成“2019/05/20 00:00:00”兼容ios
let newTime = time.replace(/-/g, '/');
newTime = newTime.replace(/年/g, '/');
newTime = newTime.replace(/月/g, '/');
newTime = newTime.replace(/日/g, '');
if (newTime.length == 4) {
newTime = newTime + '/01/01 00:00:00'
}
if (newTime.length == 7) {
newTime = newTime + '/01 00:00:00'
}
if (newTime.length == 10) {
newTime = newTime + ' 00:00:00'
}
if (newTime.length == 16) {
newTime = newTime + ':00'
}
return Date.parse(newTime)
},
},
......@@ -213,7 +242,7 @@ picker.showPicker();
confirm1: function (event){
console.log(event.detail);
this.setData({
currentDateStr1: event.detail,
currentDateStr1: event.detail.time,
});
},
......
......@@ -9,6 +9,8 @@ var API_BASE_URL = 'https://www.fastmock.site/mock/1010b262a743f0b06c565c7a31ee9
var URL = {
api_getPageArrDic: API_BASE_URL + '/getPageArrDic', // 获取分页数组
/*----------------------------------- 首页 -----------------------------------*/
addHomeData: baseUrl + "/home/add",
getData: baseUrl + "/home/list",
/*----------------------------------- 我的 -----------------------------------*/
}
......@@ -17,13 +19,15 @@ var URL = {
/* 通过module.exports方式提供给外部调用 */
module.exports = {
//获取分页数据
getPageArrDic: (prams) => HTTP.postRequest(URL.api_getPageArrDic, prams),
getPageArrDic: (prams) => HTTP.post(URL.api_getPageArrDic, prams),
//获取分页数据2
getPageArrDic2: (prams) => {
console.log(URL.api_getPageArrDic + '-----------------------')
return HTTP.postRequest(URL.api_getPageArrDic, prams, '正在加载中...')
return HTTP.post(URL.api_getPageArrDic, prams, '正在加载中...')
},
/*----------------------------------- 首页 -----------------------------------*/
addHomeData: (params) => HTTP.post(URL.addHomeData, params, '正在提交...'),
getData: (pathParams) => HTTP.get(URL.getData + pathParams),
/*----------------------------------- 我的 -----------------------------------*/
}
......
......@@ -3,23 +3,33 @@
var isProduct = __wxConfig.envVersion == 'release';
var isDevelop = __wxConfig.envVersion == 'develop';
function getToken() {
let token = '1';
return token;
}
/* 请求头 */
var _header = {
'content-type': 'application/x-www-form-urlencoded',
// 'version': '1.0.0',
}
/**
* function: 根据需求处理请求参数
* @params 请求参数
*/
function dealParams(params) {
//处理发送的数据,对数据加密
function handleSendData(params) {
if (isDevelop) {
console.log("请求参数:", params);
console.log("请求参数", params);
}
return params;
}
//处理返回数据,对数据解密
function handleReturnData(res) {
if (isDevelop) {
console.log("返回数据:", res.data);
}
return res;
}
/**
* function: 显示/隐藏加载框
* @isShow 显示/隐藏
......@@ -46,13 +56,10 @@ const request = (url, method, params, loadingText) => {
wx.request({
url: url,
method: method,
data: dealParams(params),
data: handleSendData(params),
header: _header,
success(res) {
if (isDevelop) {
console.log("请求返回数据:", res.data);
}
resolve(res.data)
resolve(handleReturnData(res.data))
},
fail(error) {
// wx.showToast({
......@@ -79,11 +86,70 @@ function post(url, params, loadingText) {
return request(url, "POST", params, loadingText);
}
/* 文件上传 */
const uploadFile = (url, filePath, params, loadingText) => {
// console.log("-----文件上传------");
showLoading(true, loadingText)
return new Promise((resolve, reject) => {
wx.uploadFile({
url: url,
name: 'file',
filePath: filePath,
formData: handleSendData(params),
header: _header,
success(res) {
resolve(handleReturnData(JSON.parse(res.data)))
},
fail(error) {
reject(error)
},
complete: info => {
showLoading(false)
}
})
})
}
/* 图片加载 */
const loadImage = (url, params) => {
// console.log("-----图片下载------");
let auth = '_auth=' + getToken()
if (url.indexOf("?") > 0) {
url = url + "&" + auth
} else {
url = url + "?" + auth
}
return new Promise((resolve, reject) => {
wx.request({
url: url,
method: 'GET',
data: params,
header: _header,
responseType: 'arraybuffer',
success(res) {
if (res.statusCode == 200 && res.data.byteLength) {
let base64 = wx.arrayBufferToBase64(res.data);
let img = 'data:image/jpeg;base64,' + base64
resolve(img)
} else {
resolve(null)
}
},
fail(error) {
reject(error)
},
complete: info => {}
})
})
}
/* 通过module.exports方式提供给外部调用 */
module.exports = {
request,
getRequest: get,
postRequest: post,
uploadFile,
loadImage,
get: get,
post: post,
}
/*
......@@ -93,7 +159,7 @@ module.exports = {
var HTTP = require('../../../../JhHttpUtils/JhHttpUtils.js');
2. 调用
HTTP.postRequest('url', prams).then(res => {
HTTP.post('url', prams).then(res => {
}).catch(error=>{
});
......
......@@ -8,7 +8,16 @@ Page({
data: {
isShowTimePicker: false,
isShowStringPicker: false,
stringPickerTextArr: ['一级', '二级', '三级'],
stringPickerTextArr: [{
name: "一级",
id: "0"
}, {
name: "二级",
id: "1"
}, {
name: "三级",
id: "2"
}],
userName: '',
name: '',
phone: '',
......@@ -44,8 +53,9 @@ Page({
},
confirm1: function (event) {
console.log(event);
this.setData({
time: event.detail,
time: event.detail.time,
});
},
confirm2: function (event) {
......@@ -61,6 +71,14 @@ Page({
file
} = event.detail;
console.log(event.detail);
var fileList = this.data.fileList
fileList.push({
url: file.url
})
this.setData({
fileList: fileList
})
// 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
// wx.uploadFile({
// url: 'https://example.weixin.qq.com/upload', // 仅为示例,非真实的接口地址
......@@ -84,6 +102,13 @@ Page({
// },
// });
},
deleteImg(event) {
let index = event.detail.index
this.data.fileList.splice(index, 1)
this.setData({
fileList: this.data.fileList
})
},
clickSubmitBtn() {
var isPhone = CheckUtils.isPhone(this.data.phone)
console.log(isPhone);
......
......@@ -11,14 +11,15 @@
<van-field value="{{desc}}" placeholder="请输入" maxlength="200" autosize="{maxHeight: 300, minHeight: 50}"
show-word-limit type="textarea" input-class="textarea" bind:change="onChange4" />
<view class="img-bg">
<van-uploader file-list="{{ fileList }}" bind:after-read="afterRead" />
<van-uploader file-list="{{ fileList }}" bind:after-read="afterRead" bind:delete="deleteImg" />
</view>
</van-cell-group>
<time-picker isShowPicker='{{isShowTimePicker}}' bind:confirm='confirm1'> </time-picker>
<string-picker textArr='{{stringPickerTextArr}}' isShowPicker='{{isShowStringPicker}}' bind:confirm='confirm2'>
<string-picker textArr='{{stringPickerTextArr}}' selectIndex='1' isShowPicker='{{isShowStringPicker}}'
bind:confirm='confirm2'>
</string-picker>
<view class="base-submit-btn" bindtap="clickSubmitBtn">提 交</view>
\ No newline at end of file
......@@ -43,7 +43,7 @@ Page({
});
// http.postRequest('dsf', prams).then(res => {
// http.post('dsf', prams).then(res => {
// if (!res.data.length) {
// wx.showToast({
......
此差异已折叠。
此差异已折叠。
// RSA 加密
// var JSEncrypt = require('./rsa.js');
import { JSEncrypt } from './rsa2'
var _PubKey = 'MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8/m0r9XKWXhjdN3z3yrInUTjsWHw08sNAl0FsMdrq3W2myQaYCN5lJmadSf7Pf6iKeUheu0ch3J/Req5anu0uwFzZOlC1u7yV1eJwcg1GLugTlAZ2dlhbf1SCgbgtIIkJg2Kv9ynycwEhXWU4+pooIibTEVHmIUwmS++M5pgavLXCQW4zbejmVMDyZz2gme088Xhd921/4m2SH5qcEMmOw5rOcGuI1f01z2ZkjgutnsEhdtPbONV/MFxsJGZ1KUM4coexe1B/ko9K3xhY1vifCwARS4dQXPTecDtffRBq+X5oPDZGSAuBOyjyKYudrxYT3G8ZLFE8eYUAEl6Eo3fywIDAQAB';
var _PrivateKey = 'MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDz+bSv1cpZeGN03fPfKsidROOxYfDTyw0CXQWwx2urdbabJBpgI3mUmZp1J/s9/qIp5SF67RyHcn9F6rl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zDa4eTtTui5xiM/ChEvnXqVCgMFL/t3uH/fu/FvnTXHren4a4WTTUPHyg/Ejeu6MU4QKBgCwBHA+z51zxUEWLGZmiHKCp8JopaWADDXKXQsJBkjxOVLNI15W/ZF5rrhbgRa5nAL5eXv4IUpLHdvLyWhwW67TLVfnmwcWSjyhmgrYllngC3c49kIvo17eWB61nzcIaaYrsihTqKeg6WFslpB0RG1q9eCZWd1hsIIaZSQj+xButAoGBAPm6+nBKVCuVqVZE/wpRVLOc8Rc3qrnPtsKPlUibxOrzuSOAsIf9ICLDHcXcYPzWlp4E0ocNRfJd5Z3FMopdsqR8lxTl/nz+G1D8xa5mhiMuZnT0QULP5d/9IHiwxu3uGLs9LQCd3/lbzOGP/rxzz6HFuyFcdLu8CpH30JBn8q69';
//字符串加密
function encrypt(str) {
let encrypt = new JSEncrypt();
encrypt.setPublicKey(_PubKey);
let encrypted = encrypt.encryptLong(str);
return encrypted;
}
//字符串解密
function decrypt(str) {
let encrypt = new JSEncrypt();
encrypt.setPrivateKey(_PrivateKey);
let decryptedStr = encrypt.decryptLong(str);
return decryptedStr;
}
module.exports = {
Encrypt: encrypt,
Decrypt: decrypt,
}
/* 使用
var RSA = require('../../utils/encrypt/rsa/rsaUtils')
RSA.Encrypt('123')
*/
// https://www.bejson.com/enc/rsa/
// -----BEGIN PUBLIC KEY-----
// MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8/m0r9XKWXhjdN3z3yrI
// nUTjsWHw08sNAl0FsMdrq3W2myQaYCN5lJmadSf7Pf6iKeUheu0ch3J/Req5anu0
// uwFzZOlC1u7yV1eJwcg1GLugTlAZ2dlhbf1SCgbgtIIkJg2Kv9ynycwEhXWU4+po
// oIibTEVHmIUwmS++M5pgavLXCQW4zbejmVMDyZz2gme088Xhd921/4m2SH5qcEMm
// Ow5rOcGuI1f01z2ZkjgutnsEhdtPbONV/MFxsJGZ1KUM4coexe1B/ko9K3xhY1vi
// fCwARS4dQXPTecDtffR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SUVVpq7XwFoBdko3Y
// x+rmLDa9EZAAvjXoL4sqKzwtJawFGUHN/RATuZuqIY24Wa353XQJoXccApSG1lIQ
// PrjDfuxuHA5zlJBwq7qWZmvCXRZk6+PJ1RPIVPhqJgXvw9W44yj9H4mXI0pZLygd
// xFx40phy0GsCgYAMFzamn8O2HaSq/PrtC/66ykTGSeIRZKNCBD1L3SJRhHbBG+3i
// 3ZtrIsvvppMjP5I4UpzNPJ/WRylgh712q25MMp6zE2PYhwa1n2+TfRpzDa4eTtTu
// i5xiM/ChEvnXqVCgMFL/t3uH/fu/FvnTXHren4a4WTTUPHyg/Ejeu6MU4QKBgCwB
// HA+z51zxUEWLGZmiHKCp8JopaWADDXKXQsJBkjxOVLNI15W/ZF5rrhbgRa5nAL5e
// Xv4IUpLHdvLyWhwW67TLVfnmwcWSjyhmgrYllngC3c49kIvo17eWB61nzcIaaYrs
// ihTqKeg6WFslpB0RG1q9eCZWd1hsIIaZSQj+xButAoGBAPm6+nBKVCuVqVZE/wpR
// VLOc8Rc3qrnPtsKPlUibxOrzuSOAsIf9ICLDHcXcYPzWlp4E0ocNRfJd5Z3FMopd
// sqR8lxTl/nz+G1D8xa5mhiMuZnT0QULP5d/9IHiwxu3uGLs9LQCd3/lbzOGP/rxz
// z6HFuyFcdLu8CpH30JBn8q69
// -----END PRIVATE KEY-----
\ No newline at end of file
......@@ -73,10 +73,19 @@ export function Jh_timeStampToNo0Time(time, cFormat) {
// let newTime = time.replace(/-/g, '/');
// return Date.parse(newTime)
// }
//把 "2019-05-20 00:00:00" 转成 时间戳
/**
* 将某个时间转化成时间戳
* 时间格式:2019-05-20 00:00:00 或 2019年5月1日 00:00:00
* 返回值:1556640000000,13位时间戳
*/
export function Jh_convertTimeStamp(time) {
//用正则主要是把“2019-05-20 00:00:00”转换成“2019/05/20 00:00:00”兼容ios
let newTime = time.replace(/-/g, '/');
newTime = newTime.replace(/\./g, '-')
newTime = newTime.replace(/年/g, '/');
newTime = newTime.replace(/月/g, '/');
newTime = newTime.replace(/日/g, '');
if (newTime.length == 4) {
newTime = newTime + '/01/01 00:00:00'
}
......
......@@ -55,7 +55,8 @@
"list": []
},
"miniprogram": {
"list": [{
"list": [
{
"name": "pages/demoList/demoList",
"pathName": "pages/demoList/demoList",
"query": "",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册