diff --git a/app.json b/app.json index 4f4e555..870b1af 100644 --- a/app.json +++ b/app.json @@ -1,9 +1,9 @@ { "pages": [ "pages/login/index", + "pages/my/index", "pages/recharge/index", "pages/rechargeRecord/index", - "pages/my/index", "pages/questions/index", "pages/meterList/index", "pages/home/index", diff --git a/components/select/index.js b/components/select/index.js index df2bfd0..d6f0eaf 100644 --- a/components/select/index.js +++ b/components/select/index.js @@ -34,11 +34,12 @@ Component({ }) }, onChoose(e) { - console.log('e', e) const { data = {} } = e.currentTarget.dataset; + console.log('data', data) this.setData({ - visible + visible: false }) + this.triggerEvent("choose", data) } } }) \ No newline at end of file diff --git a/pages/login/index.js b/pages/login/index.js index 2ecdd38..4db4151 100644 --- a/pages/login/index.js +++ b/pages/login/index.js @@ -1,5 +1,5 @@ import { login } from "../../service/user" -import { alertError, loadingFunc, wxLogin } from "../../utils/index" +import { alertError, alertInfo, loadingFunc, wxLogin } from "../../utils/index" import { OK } from "../../utils/request" // pages/login/index.js Page({ @@ -25,15 +25,15 @@ Page({ }, onClose() { - wx.exitMiniProgram() + // wx.exitMiniProgram() }, - onConfirm() { - this.handleLogin() - }, - async handleLogin() { + // onConfirm() { + // this.handleLogin() + // }, + async handleLogin(phoneCode) { loadingFunc(async () => { const wxLoginCode = await wxLogin() - const { code, message, data } = await login({ code: wxLoginCode }) + const { code, message, data } = await login({ code: wxLoginCode, phoneCode }) if (code !== OK) { alertError(message) return @@ -41,6 +41,27 @@ Page({ console.log('data', data) }) }, + getPhoneNumber(e) { + const { errno, code: phoneCode } = e.detail; + console.log('errno', errno, 'phoneCode', phoneCode) + switch(errno) { + case 103: + alertInfo("已拒绝"); + setTimeout(() => { + wx.exitMiniProgram() + }, 100) + return; + break; + case 1400001: + alertInfo("服务达到上限") + setTimeout(() => { + wx.exitMiniProgram() + }, 100) + return; + break; + } + this.handleLogin(phoneCode) + }, /** * 生命周期函数--监听页面显示 */ diff --git a/pages/login/index.wxml b/pages/login/index.wxml index c13053e..4db36f3 100644 --- a/pages/login/index.wxml +++ b/pages/login/index.wxml @@ -7,6 +7,8 @@ show-cancel-button bind:close="onClose" bind:confirm="onConfirm" + confirm-button-open-type="getPhoneNumber" + bind:getphonenumber="getPhoneNumber" > 使用本系统,代表您已阅读并同意 《用电管理服务条款》《用电管理登录政策》《隐私政策》。 diff --git a/pages/my/index.json b/pages/my/index.json index 8a6d015..c959eb7 100644 --- a/pages/my/index.json +++ b/pages/my/index.json @@ -1,6 +1,7 @@ { "usingComponents": { - "navigator": "/components/navigator/index", - "cell": "/components/cell/index" - } + "van-cell": "@vant/weapp/cell/index", + "van-cell-group": "@vant/weapp/cell-group/index" + }, + "navigationBarTitleText": "我的" } \ No newline at end of file diff --git a/pages/my/index.wxml b/pages/my/index.wxml index 902bf6a..3dadaad 100644 --- a/pages/my/index.wxml +++ b/pages/my/index.wxml @@ -1,4 +1,11 @@ - - - \ No newline at end of file + + + + + + + + + \ No newline at end of file