提交 ce0c4895 编写于 作者: M MicroMilo

验证码后台实现

上级 9039ca03
......@@ -8,7 +8,7 @@
},
"h5" :
{
"launchtype" : "local"
"launchtype" : "remote"
},
"type" : "uniCloud"
}
......
......@@ -46,14 +46,14 @@
<script>
import tableData from './tableData.js'
uniCloud.callFunction({
name: 'auth',
data: {
phone: '15860855025',
password: '123456'
}
})
.then(res => {console.log(res);});
// uniCloud.callFunction({
// name: 'auth',
// data: {
// phone: '15860855025',
// password: '123456'
// }
// })
// .then(res => {console.log(res);});
export default {
data() {
......
......@@ -37,6 +37,7 @@
<uni-forms-item name="total_walking_distance" label="健走总距离">
<uni-easyinput type="number" v-model="formData.total_walking_distance"></uni-easyinput>
</uni-forms-item>
<button @click="smsSend">发短信啦!</button>
<view class="uni-button-group">
<button type="primary" class="uni-button" style="width: 100px;" @click="submit">提交</button>
<navigator open-type="navigateBack" style="margin-left: 15px;">
......@@ -66,8 +67,6 @@
return result
}
export default {
data() {
let formData = {
......@@ -109,7 +108,19 @@
}
},
methods: {
smsSend() {
uniCloud.callFunction({
name: 'fe-retrievePassword',
data: {
phone: '15860855025',
password: '123456'
}
})
.then(res => {
console.log(res);
console.log("demodemodmeodmeodmeod")
});
},
/**
* 验证表单并提交
*/
......
// 发送单条短信示例
'use strict';
exports.main = async (event, context) => {
try {
const res = await uniCloud.sendSms({
appid: '__UNI__2A45DD3',
smsKey: 'b4d94cfbbb60074d7f2675f640fb60ca',
smsSecret: 'b53adc6b88bb62031e67f60c1f52570d',
phone: '13950014724',
templateId: 'uni_sms_test', // 请替换为自己申请的模板id
data: {
name: 'DCloud',
code: '123456',
expMinute: '3',
}
})
console.log(res)
// 调用成功,请注意这时不代表发送成功
return res
} catch(err) {
// 调用失败
console.log(err.errCode)
console.log(err.errMsg)
return {
code: err.errCode,
msg: err.errMsg
}
}
};
\ No newline at end of file
{
"name": "fe-retrievePassword",
"dependencies": {},
"extensions": {
"uni-cloud-jql": {}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册