Commit 73a044cb authored by jyx's avatar jyx

接口联调,加解密测试

parent a9f1291d
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -21,15 +21,16 @@
"crypto-md5": "^1.0.0",
"js-base64": "^3.7.2",
"js-md5": "^0.7.3",
"md5": "^2.3.0"
"md5": "^2.3.0",
"qaui": "^1.0.18"
},
"devDependencies": {
"@babel/runtime": "^7.12.5",
"@types/quickapp": "npm:quickapp-interface@^1.0.0",
"colors": "^1.4.0",
"husky": "^7.0.1",
"less": "^4.1.1",
"less-loader": "^10.0.1",
"less": "^4.1.2",
"less-loader": "^10.2.0",
"lint-staged": "^11.0.1",
"onchange": "^5.2.0",
"prettier": "^2.3.2",
......
import api from './httpFetch'
export function getClassifyList() {
return api.getClassifyList()
.then((response) => {
return Promise.resolve(JSON.parse(response.data).data)
}).catch((err) => {
return Promise.reject(err)
})
}
export function getArticleByClassify(page = 0, cid) {
return api.getArticleByClassify(page, cid)
.then((response) => {
return Promise.resolve(JSON.parse(response.data).data)
}).catch((err) => {
return Promise.reject(err)
})
}
\ No newline at end of file
import api from './index'
export function getCollectArticle(page) {
return api.getCollectArticle(page)
.then((response) => {
return Promise.resolve(JSON.parse(response.data).data)
}).catch((err) => {
return Promise.reject(err)
})
}
export function collectArticle(id) {
return api.collectArticle(id)
.then((response) => {
var value = JSON.parse(response.data)
if(value.errorCode === -1) {
return Promise.reject('请先登录')
} else {
return Promise.resolve(value.data)
}
}).catch((err) => {
return Promise.reject(err)
})
}
export function collectArticleAdd(title, author, link) {
return api.collectArticleAdd({
title: title,
author: author,
link: link
})
.then((response) => {
return Promise.resolve(JSON.parse(response.data).data)
}).catch((err) => {
return Promise.reject(err)
})
}
export function uncollectArticle(id) {
return api.uncollectArticle(id)
.then((response) => {
return Promise.resolve(JSON.parse(response.data).data)
}).catch((err) => {
return Promise.reject(err)
})
}
export function uncollect(id, originId) {
return api.uncollect(id, originId)
.then((response) => {
return Promise.resolve(JSON.parse(response.data).data)
}).catch((err) => {
return Promise.reject(err)
})
}
export function getCollectWeb() {
return api.getCollectWeb()
.then((response) => {
return Promise.resolve(JSON.parse(response.data).data)
}).catch((err) => {
return Promise.reject(err)
})
}
export function collectWeb(name, link) {
return api.collectWeb({
name: name,
link: link
})
.then((response) => {
return Promise.resolve(JSON.parse(response.data).data)
}).catch((err) => {
return Promise.reject(err)
})
}
export function editCollectWeb(id, name, link) {
return api.editCollectWeb({
id: id,
name: name,
link: link
})
.then((response) => {
return Promise.resolve(JSON.parse(response.data).data)
}).catch((err) => {
return Promise.reject(err)
})
}
export function deleteCollectWeb(id) {
return api.deleteCollectWeb(id)
.then((response) => {
return Promise.resolve(JSON.parse(response.data).data)
}).catch((err) => {
return Promise.reject(err)
})
}
\ No newline at end of file
......@@ -9,31 +9,31 @@ var iv = CryptoJS.enc.Utf8.parse('7d0c9683cfcb0c7c'); //十六位十六进制
* @param word
* @returns {*}
*/
export function encrypt(word){
export function encrypt(word) {
var srcs = CryptoJS.enc.Utf8.parse(word);
var encrypted = CryptoJS.AES.encrypt(srcs, key, {iv: iv,mode:CryptoJS.mode.CBC,padding: CryptoJS.pad.Pkcs7});
let ens= encrypted.ciphertext.toString(CryptoJS.enc.Base64)
var encrypted = CryptoJS.AES.encrypt(srcs, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 });
let ens = encrypted.ciphertext.toString(CryptoJS.enc.Base64)
return ens;
}
}
/**
/**
* 解密
* @param word
* @returns {*}
*/
export function decrypt(word){
export function decrypt(word) {
// 去除 换行符 空格 下划线
var replaceWord = word.replace(/[\r\n]/g,"").replace(/\-g/,'+').replace(/_/,'/');
var replaceWord = word.replace(/[\r\n]/g, "").replace(/\-g/, '+').replace(/_/, '/');
//返回的是解密后的对象
let decrypt = CryptoJS.AES.decrypt(replaceWord,key,{
iv:iv,
mode:CryptoJS.mode.CBC,
padding:CryptoJS.pad.Pkcs7
let decrypt = CryptoJS.AES.decrypt(replaceWord, key, {
iv: iv,
mode: CryptoJS.mode.CBC,
padding: CryptoJS.pad.Pkcs7
});
//将解密对象转换成UTF8的字符串
let decryptedStr = decrypt.toString(CryptoJS.enc.Utf8);
// 返回解密结果
return decryptedStr.toString();
}
\ No newline at end of file
}
\ No newline at end of file
import api from './index'
export function getBanner() {
return api.getBanner()
.then((response) => {
return Promise.resolve(JSON.parse(response.data).data)
}).catch((err) => {
return Promise.reject(err)
})
}
export function getArticle(page = 0) {
return api.getArticle(page)
.then((response) => {
return Promise.resolve(JSON.parse(response.data).data)
}).catch((err) => {
return Promise.reject(err)
})
}
\ No newline at end of file
import {encrypt,decrypt} from './encry/aesUtil.js'
import { encrypt, decrypt } from './encry/aesUtil.js'
import md5 from 'js-md5'
import { encode, decode } from 'js-base64';
var fetch = require('@system.fetch')
var storage = require('@system.storage')
......@@ -11,20 +10,20 @@ var AES_KEY = 'abcdnnnn123456'
var API_ROOT = 'http://test.mints-id.com/news-api/'
var headers = {
'version':'1.0.0',
'pkgName':'com.wenshu.aiyuebao',
'channel':'quickapp_' + 'aiyuebao',
'Content-Type' :'application/json',
'version': '1.0.0',
'pkgName': 'com.wenshu.aiyuebao',
'channel': 'quickapp_' + 'aiyuebao',
'Content-Type': 'application/json',
}
// function getAuth(next) {
// storage.get({
// key: 'auth',
// success: function(data) {
// success: function (data) {
// headers.Cookie = data
// next(true)
// },
// fail: function(data, code) {
// fail: function (data, code) {
// next(false)
// }
// })
......@@ -34,11 +33,11 @@ function getAuth() {
return new Promise((resolve, reject) => {
storage.get({
key: 'auth',
success: function(data) {
success: function (data) {
headers.Cookie = data
resolve(true)
},
fail: function(data, code) {
fail: function (data, code) {
resolve(false)
}
})
......@@ -63,7 +62,7 @@ function realFetch(url, data = null, method = 'get') {
var _sign = token + ':' + channel + ':' + time
var sign = '' + md5(_sign)
var check = '' + md5(_sign+':' + jsonData)
var check = '' + md5(_sign + ':' + jsonData)
var params = {
'channel': channel,
......@@ -84,7 +83,7 @@ function realFetch(url, data = null, method = 'get') {
data: params,
header: headers,
method: method,
success: function(data) {
success: function (data) {
var obj = JSON.parse(data.data)
var decyptData = decrypt(obj.data)
......@@ -92,7 +91,7 @@ function realFetch(url, data = null, method = 'get') {
console.log(decyptData)
resolve(data)
},
fail: function(data, code) {
fail: function (data, code) {
reject(data)
}
})
......@@ -101,7 +100,7 @@ function realFetch(url, data = null, method = 'get') {
function withAuth(url, data = null, method = 'get', canSkip = false) {
return getAuth().then((auth) => {
if(auth || canSkip) {
if (auth || canSkip) {
return realFetch(url, data, method)
} else {
return new Promise((resolve, reject) => {
......@@ -112,7 +111,7 @@ function withAuth(url, data = null, method = 'get', canSkip = false) {
}
function post(url, data = null, config = {}) {
if(config.withAuth) {
if (config.withAuth) {
return withAuth(url, data, 'post', config.canSkip)
} else {
return realFetch(url, data, 'post')
......@@ -120,7 +119,7 @@ function post(url, data = null, config = {}) {
}
function get(url, data = null, config = {}) {
if(config.withAuth) {
if (config.withAuth) {
return withAuth(url, data, 'get', config.canSkip)
} else {
return realFetch(url, data, 'get')
......@@ -131,7 +130,7 @@ export default {
/**
* 手机号登录
*/
mobileLogin(params){
mobileLogin(params) {
return post('api/mobilelogin', params)
}
}
\ No newline at end of file
import {getStore, setStore} from '@/util/store'
const user = {
state: {
token: getStore({
name: 'token'
}) || '',
mobile: getStore({
name: 'mobile'
}) || '',
uid: getStore({
name: 'uid'
}) || '',
tokenid: getStore({
name: 'tokenid'
}) || '',
},
actions: {},
mutations: {
SET_TOKEN: (state, token) => {
state.token = token
setStore({
name: 'token',
content: state.token,
type: '',
})
},
MOBILE: (state, mobile) => {
state.mobile = mobile
setStore({
name: 'mobile',
content: state.mobile,
type: '',
})
},
UID: (state, uid) => {
state.uid = uid
setStore({
name: 'uid',
content: state.uid,
type: '',
})
},
TOKEN_ID: (state, tokenid) => {
state.tokenid = tokenid
setStore({
name: 'tokenid',
content: state.tokenid,
type: '',
})
}
}
}
export default user
\ No newline at end of file
......@@ -6,7 +6,7 @@ import $utils from './utils'
const TIMEOUT = 20000
Promise.prototype.finally = function(callback) {
Promise.prototype.finally = function (callback) {
const P = this.constructor
return this.then(
value => P.resolve(callback()).then(() => value),
......@@ -66,20 +66,20 @@ function requestHandle(params, timeout = TIMEOUT) {
}
export default {
post: function(url, params) {
post: function (url, params) {
return requestHandle({
method: 'post',
url: url,
data: params
})
},
get: function(url, params) {
get: function (url, params) {
return requestHandle({
method: 'get',
url: $utils.queryString(url, params)
})
},
put: function(url, params) {
put: function (url, params) {
return requestHandle({
method: 'put',
url: url,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
/**
*
* 验证规则
*
*/
export function isvalidUsername(str) {
const valid_map = ['admin', 'editor']
return valid_map.indexOf(str.trim()) >= 0
}
/* 合法uri*/
export function validateURL(textval) {
const urlregex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/
return urlregex.test(textval)
}
/* 小写字母*/
export function validateLowerCase(str) {
const reg = /^[a-z]+$/
return reg.test(str)
}
/* 大写字母*/
export function validateUpperCase(str) {
const reg = /^[A-Z]+$/
return reg.test(str)
}
/* 大小写字母*/
export function validatAlphabets(str) {
const reg = /^[A-Za-z]+$/
return reg.test(str)
}
/*验证pad还是pc*/
export const vaildatePc = function () {
const userAgentInfo = navigator.userAgent;
const Agents = ["Android", "iPhone",
"SymbianOS", "Windows Phone",
"iPad", "iPod"];
let flag = true;
for (var v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) {
flag = false;
break;
}
}
return flag;
}
/**
* validate email
* @param email
* @returns {boolean}
*/
export function validateEmail(email) {
const re = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
return re.test(email)
}
/**
* 判断身份证号码
*/
export function cardid(code) {
let list = [];
let result = true;
let msg = '';
var city = {
11: "北京",
12: "天津",
13: "河北",
14: "山西",
15: "内蒙古",
21: "辽宁",
22: "吉林",
23: "黑龙江 ",
31: "上海",
32: "江苏",
33: "浙江",
34: "安徽",
35: "福建",
36: "江西",
37: "山东",
41: "河南",
42: "湖北 ",
43: "湖南",
44: "广东",
45: "广西",
46: "海南",
50: "重庆",
51: "四川",
52: "贵州",
53: "云南",
54: "西藏 ",
61: "陕西",
62: "甘肃",
63: "青海",
64: "宁夏",
65: "新疆",
71: "台湾",
81: "香港",
82: "澳门",
91: "国外 "
};
if (!validatenull(code)) {
if (code.length == 18) {
if (!code || !/(^\d{18}$)|(^\d{17}(\d|X|x)$)/.test(code)) {
msg = "证件号码格式错误";
} else if (!city[code.substr(0, 2)]) {
msg = "地址编码错误";
} else {
//18位身份证需要验证最后一位校验位
code = code.split('');
//∑(ai×Wi)(mod 11)
//加权因子
var factor = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2];
//校验位
var parity = [1, 0, 'X', 9, 8, 7, 6, 5, 4, 3, 2, 'x'];
var sum = 0;
var ai = 0;
var wi = 0;
for (var i = 0; i < 17; i++) {
ai = code[i];
wi = factor[i];
sum += ai * wi;
}
var last = parity[sum % 11];
if (parity[sum % 11] != code[17]) {
msg = "证件号码校验位错误";
} else {
result = false;
}
}
} else {
msg = "证件号码长度不为18位";
}
} else {
msg = "证件号码不能为空";
}
list.push(result);
list.push(msg);
return list;
}
/**
* 判断手机号码是否正确
*/
export function isvalidatemobile(phone) {
let list = [];
let result = true;
let msg = '';
// var isPhone = /^0\d{2,3}-?\d{7,8}$/;
var isPhone = /^1[3|4|5|6|7|8][0-9]\d{4,8}$/;
//增加134 减少|1349[0-9]{7},增加181,增加145,增加17[678]
var isMob = /^((\+?86)|(\(\+86\)))?(13[0123456789][0-9]{8}|15[012356789][0-9]{8}|18[012356789][0-9]{8}|14[57][0-9]{8}|17[3678][0-9]{8})$/;
if (!validatenull(phone)) {
if (phone.length === 11) {
if (!isPhone.test(phone)) {
msg = '手机号码格式不正确';
} else {
result = false;
}
} else {
msg = '手机号码长度不为11位';
}
} else {
msg = '手机号码不能为空';
}
list.push(result);
list.push(msg);
return list;
}
/**
* 判断姓名是否正确
*/
export function validatename(name) {
var regName = /^[\u4e00-\u9fa5]{2,4}$/;
if (!regName.test(name)) return false;
return true;
};
/**
* 判断是否为整数
*/
export function validatenum(num, type) {
let regName = /[^\d.]/g;
if (type == 1) {
if (!regName.test(num)) return false;
} else if (type == 2) {
regName = /[^\d]/g;
if (!regName.test(num)) return false;
}
return true;
};
/**
* 判断是否为小数
*/
export function validatenumord(num, type) {
let regName = /[^\d.]/g;
if (type == 1) {
if (!regName.test(num)) return false;
} else if (type == 2) {
regName = /[^\d.]/g;
if (!regName.test(num)) return false;
}
return true;
};
/**
* 判断是否为空
*/
export function validatenull(val) {
if (val instanceof Array) {
if (val.length == 0) return true;
} else if (val instanceof Object) {
if (JSON.stringify(val) === '{}') return true;
} else {
if (val == 'null' || val == null || val == 'undefined' || val == undefined || val == '') return true;
return false;
}
return false;
};
/**
* 隐藏中间四位手机号
*/
export function getHideTel(val) {
let reg = /^(\d{3})\d{4}(\d{4})$/;
return val.replace(reg, "$1****$2");
};
/**
* 计算图片压缩比例
*/
export function calculateQuality(fileSize) {
let quality
// 大于10M
if (fileSize / 1024 > 10241) {
quality = 0.5
}
// 大于5M
else if (fileSize / 1024 > 5121) {
quality = 0.6
}
// 大于1M
else if (fileSize / 1024 > 1025) {
quality = 0.8
} else {
quality = 1.0
}
return quality
}
/**
* 用户名字*号替换 欧阳峰 -> 欧*锋
*/
export function hiddenName(name) {
var newName
if (name.length == 2) {
newName = name.substr(0, 1) + '*'
} else if (name.length > 2) {
let char = '';
for (let i = 0, len = name.length - 2; i < len; i++) {
char += '*';
}
newName = name.substr(0, 1) + char + name.substr(-1, 1);
} else {
newName = name
}
return newName
}
/**
* 用户名字*号替换 欧阳峰 -> 欧**
*/
export function hiddenName2(name) {
var newName
if (name.length == 2) {
newName = name.substr(0, 1) + '*'
} else if (name.length > 2) {
let char = '';
for (let i = 0, len = name.length - 1; i < len; i++) {
char += '*';
}
newName = name.substr(0, 1) + char;
} else {
newName = name
}
return newName
}
\ No newline at end of file
import wx from 'weixin-js-sdk'
import {getTecentSignInfo} from "../api/public";
export const weiXinShare = (product) => {
let params = {requestUrl: encodeURIComponent(location.href.split('#')[0])}
getTecentSignInfo(params).then(res => {
if (res.code === 0) {
//拿到后端给的这些数据
let appId = res.signInfo.appId;
let timestamp = res.signInfo.timestamp;
let nonceStr = res.signInfo.nonceStr;
let signature = res.signInfo.signature;
//配置微信信息
wx.config({
// debug: true, // true:调试时候弹窗
appId: appId, // 微信appid
timestamp: timestamp, // 时间戳
nonceStr: nonceStr, // 随机字符串
signature: signature, // 签名
jsApiList: [
// 所有要调用的 API 都要加到这个列表中
'updateAppMessageShareData',
'updateTimelineShareData',
]
});
wx.ready(function () {
// 微信分享的数据
let shareData = {
"imgUrl": product.productIconUrl, // 分享显示的缩略图地址
"link": location.href.split('#')[0] + '#' + location.href.split('#')[1], // 分享地址
"desc": product.basicDesc, // 分享描述
"title": product.productName, // 分享标题
success: function () {
console.log('success')
// 分享成功可以做相应的数据处理
// let data = orderId
// this.$router.push({name: 'checkstand', query: {data}})
},
cancel: function () {
// 用户取消分享后执行的回调函数
// alert("分享取消22");
}
};
wx.updateAppMessageShareData(shareData);
wx.updateTimelineShareData(shareData);
});
wx.error(function (res) {
console.log(res)
// config信息验证失败会执行error函数,如签名过期导致验证失败,
// 具体错误信息可以打开config的debug模式查看,也可以在返回的res参数中查看,
//对于SPA可以在这里更新签名。
// alert("好像出错了!!");
});
}
});
}
\ No newline at end of file
......@@ -6,21 +6,33 @@
<tabs onchange="changeTabactive" index="{{currentIndex}}">
<tab-content class="flexible-tab-content">
<div class="tab-content-section">
<sign></sign>
<sign if="{{tabItems[0].render}}"></sign>
</div>
<div class="tab-content-section">
<news></news>
<news if="{{tabItems[1].render}}"></news>
</div>
<div class="tab-content-section">
<my></my>
<my if="{{tabItems[2].render}}"></my>
</div>
</tab-content>
</tabs>
<!-- 自定义tab-bar组件 -->
<div class="flexible-tabbar">
<text class="{{currentIndex === 0 ? 'active' : ''}}" onclick="clickTabBar(0)">{{tabItems[0].text}}</text>
<text class="{{currentIndex === 1 ? 'active' : ''}}" onclick="clickTabBar(1)">{{tabItems[1].text}}</text>
<text class="{{currentIndex === 2 ? 'active' : ''}}" onclick="clickTabBar(2)">{{tabItems[2].text}}</text>
<text
class="{{currentIndex === 0 ? 'active' : ''}}"
onclick="clickTabBar(0)"
>{{ tabItems[0].text }}</text
>
<text
class="{{currentIndex === 1 ? 'active' : ''}}"
onclick="clickTabBar(1)"
>{{ tabItems[1].text }}</text
>
<text
class="{{currentIndex === 2 ? 'active' : ''}}"
onclick="clickTabBar(2)"
>{{ tabItems[2].text }}</text
>
</div>
</div>
</div>
......@@ -36,31 +48,35 @@ import router from '@system.router'
export default {
// 页面级组件的数据模型,影响传入数据的覆盖机制:private内定义的属性不允许被覆盖
private: {
currentIndex:0,
currentIndex: 0,
title: '欢迎体验快应用开发',
type: 'content_1',
tabItems:[
tabItems: [
{
text:"签到"
text: "签到",
render: true
},
{
text:"新闻"
text: "新闻",
render: false
},
{
text:"我的"
text: "我的",
render: false
},
]
},
onInit() {
this.$page.setTitleBar({ text: '测试' })
},
changeTabactive (evt) {
changeTabactive(evt) {
this.currentIndex = evt.index
this.tabItems[evt.index].render = true
},
clickTabBar (index) {
clickTabBar(index) {
this.currentIndex = index
},
routePage (param) {
routePage(param) {
router.push({
uri: 'ComponentTabs/complex/' + param
})
......@@ -72,6 +88,8 @@ export default {
@import './../../assets/styles/style.less';
.tutorial-page {
display: flex;
flex-direction: column;
flex: 1;
.flexible-tabs {
flex: 1;
......@@ -96,7 +114,7 @@ export default {
}
.active {
color: #0faeff;
border-bottom-color: #0faeff;
/* border-bottom-color: #0faeff; */
}
}
.flexible-tab-content {
......@@ -108,5 +126,5 @@ export default {
}
}
}
}
}
</style>
<template>
<div class="login-wrapper">
<c-input label="手机号" clearable="true" placeholder="请输入手机号" type="num" class="input-border" oninput="onInputUsername"></c-input>
<c-input label="密码" clearable="true" placeholder="请输入密码" type="password" class="input-border" oninput="onInputPassword"></c-input>
<c-input
label="手机号"
clearable="true"
placeholder="请输入手机号"
type="number"
value="{{phone}}"
class="input-border"
oninput="onInputPhone"
></c-input>
<c-input
label="验证码"
clearable="true"
placeholder="请输入验证码"
type="number"
value="{{smsCode}}"
class="input-border"
oninput="onInputSmsCode"
></c-input>
<text class="login-btn" onclick="login">登录</text>
<q-vcode time="10" onsend="sendHandler" onchange="changeHandler"></q-vcode>
</div>
</template>
<import name="q-vcode" src="qaui/src/components/vcode/index"></import>
<import name="c-input" src="../../Common/Component/CInput/index"></import>
<script>
import {login} from '../../Common/Api/user'
import { login } from '../../Common/Api/user'
export default {
data() {
return {
username: '15156975131',
password: '试试水123456'
phone: '15156975131',
smsCode: '1234'
}
},
onInit() {
this.$page.setTitleBar({ text: '登录' })
},
onInputUsername({ detail: { value } }) {
this.username = value
onInputPhone({ detail: { value } }) {
this.phone = value
},
onInputPassword({ detail: { value } }) {
this.password = value
onInputSmsCode({ detail: { value } }) {
this.smsCode = value
},
login() {
if(this.username === null || this.username.length < 6) {
$utils.showToast('用户名长度不能小于6')
} else if (this.password === null || this.password.length < 6) {
$utils.showToast('密码长度不能小于6')
if (this.phone === null || this.phone.length < 11) {
$utils.showToast('手机号长度不能小于11位')
} else if (this.smsCode === null || this.smsCode.length < 4) {
$utils.showToast('验证码长度不能小于4位')
} else {
login(this.username, this.password)
login(this.phone, this.smsCode)
.then((data) => {
this.$dispatch('success', { data: data })
})
......@@ -41,7 +60,13 @@ export default {
this.$utils.showToast({ message: data })
})
}
}
},
sendHandler() {
console.log('request for sending verify code!')
},
changeHandler({ detail }) {
console.log('input value', detail.value)
},
}
</script>
......
<template>
<div class="wrapper">
<text class="title">{{ title }}</text>
<text onclick="click" class="title">{{ title }}</text>
</div>
</template>
<script>
import geolocation from '@system.geolocation'
import vibrator from '@system.vibrator'
export default {
data: {
title: '视频'
},
onInit() {}
onInit() { },
click() {
vibrator.vibrate({
mode: 'short'
})
// geolocation.getLocation({
// success: function (data) {
// console.log(
// `handling success: longitude = ${data.longitude}, latitude = ${
// data.latitude
// }`
// )
// },
// fail: function (data, code) {
// console.log(`handling fail, code = ${code}, errorMsg=${data}`)
// }
// })
}
}
</script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment