作者 韩昌

上传一次

... ... @@ -12,11 +12,11 @@
</view> -->
<view class="btnBox flexC" @click="login" v-if="!agreeStatus">
<image src="/static/indexIc/loginBtn.png" mode=""></image>
微信账号一键登录
手机号快捷登录
</view>
<view class="btnBox flexC" v-else>
<image src="/static/indexIc/loginBtn.png" mode=""></image>
微信账号一键登录
手机号快捷登录
<button open-type="getPhoneNumber" @getphonenumber="getphonenumber"></button>
</view>
<view class="agreeBox flexC">
... ...
"use strict";const e=require("../../common/vendor.js"),v=require("../../api/index.js");require("../../utils/request.js");const p={__name:"login",setup(_){const o=e.ref(!1),i=e.ref(""),s=e.ref("1213231");e.onLoad(()=>{e.index.getStorageSync("token")&&e.index.reLaunch({url:"/pages/index/index"})}),e.onShow(()=>{u()});const l=()=>{if(!o.value)return e.index.showToast({title:"请勾选协议",icon:"none"})},g=n=>{n.detail.errMsg=="getPhoneNumber:fail user deny"?e.index.showToast({title:"您已取消授权",icon:"none"}):d(n.detail.encryptedData,n.detail.iv)},u=()=>{e.index.login({provider:"weixin",success:function(n){console.log(n),i.value=n.code}})},d=async(n,c)=>{try{let t={code:i.value,encryptedData:n,iv:c,wxCode:s.value};const a=await v.getLogin(t);e.index.setStorageSync("token",a.token),e.index.setStorageSync("userInfo",a),e.index.reLaunch({url:"/pages/index/index"}),console.log("getLogin",a)}catch(t){console.log("getLogin",t)}},r=n=>{e.index.navigateTo({url:`/pages/index/richText?type=${n}`})},x=()=>{o.value=!o.value};return(n,c)=>e.e({a:!o.value},o.value?{c:e.o(g)}:{b:e.o(l)},{d:!o.value},o.value?{}:{},{e:e.o(x),f:e.o(t=>r(4)),g:e.o(t=>r(5))})}},f=e._export_sfc(p,[["__file","D:/vue/大健康商城/healthMall/pages/login/login.vue"]]);wx.createPage(f);
"use strict";const e=require("../../common/vendor.js"),v=require("../../api/index.js");require("../../utils/request.js");const p={__name:"login",setup(_){const o=e.ref(!1),i=e.ref(""),s=e.ref("");e.onLoad(()=>{e.index.getStorageSync("token")&&e.index.reLaunch({url:"/pages/index/index"})}),e.onShow(()=>{u()});const l=()=>{if(!o.value)return e.index.showToast({title:"请勾选协议",icon:"none"})},g=n=>{n.detail.errMsg=="getPhoneNumber:fail user deny"?e.index.showToast({title:"您已取消授权",icon:"none"}):d(n.detail.encryptedData,n.detail.iv)},u=()=>{e.index.login({provider:"weixin",success:function(n){console.log(n),i.value=n.code}})},d=async(n,c)=>{try{let t={code:i.value,encryptedData:n,iv:c,wxCode:s.value};const a=await v.getLogin(t);e.index.setStorageSync("token",a.token),e.index.setStorageSync("userInfo",a),e.index.reLaunch({url:"/pages/index/index"}),console.log("getLogin",a)}catch(t){console.log("getLogin",t)}},r=n=>{e.index.navigateTo({url:`/pages/index/richText?type=${n}`})},x=()=>{o.value=!o.value};return(n,c)=>e.e({a:!o.value},o.value?{c:e.o(g)}:{b:e.o(l)},{d:!o.value},o.value?{}:{},{e:e.o(x),f:e.o(t=>r(4)),g:e.o(t=>r(5))})}},f=e._export_sfc(p,[["__file","D:/vue/大健康商城/healthMall/pages/login/login.vue"]]);wx.createPage(f);
... ...
<view class=""><view class="bgBox"><image src="/static/indexIc/loginBg.png" mode=""></image></view><view class="logo flexC"><image src="/static/indexIc/lo.jpg" mode=""></image></view><view wx:if="{{a}}" class="btnBox flexC" bindtap="{{b}}"><image src="/static/indexIc/loginBtn.png" mode=""></image> 微信账号一键登录 </view><view wx:else class="btnBox flexC"><image src="/static/indexIc/loginBtn.png" mode=""></image> 微信账号一键登录 <button open-type="getPhoneNumber" bindgetphonenumber="{{c}}"></button></view><view class="agreeBox flexC"><view class="checkImage" bindtap="{{e}}"><image wx:if="{{d}}" src="/static/shopCarIc/checks.png" mode=""></image><image wx:else src="/static/shopCarIc/modeCheck.png" mode=""></image></view><view class="agree flexA"> 我已阅读并同意 <view class="" bindtap="{{f}}">《用户协议》</view> 和 <view class="" bindtap="{{g}}">《隐私协议》</view></view></view></view>
\ No newline at end of file
<view class=""><view class="bgBox"><image src="/static/indexIc/loginBg.png" mode=""></image></view><view class="logo flexC"><image src="/static/indexIc/lo.jpg" mode=""></image></view><view wx:if="{{a}}" class="btnBox flexC" bindtap="{{b}}"><image src="/static/indexIc/loginBtn.png" mode=""></image> 手机号快捷登录 </view><view wx:else class="btnBox flexC"><image src="/static/indexIc/loginBtn.png" mode=""></image> 手机号快捷登录 <button open-type="getPhoneNumber" bindgetphonenumber="{{c}}"></button></view><view class="agreeBox flexC"><view class="checkImage" bindtap="{{e}}"><image wx:if="{{d}}" src="/static/shopCarIc/checks.png" mode=""></image><image wx:else src="/static/shopCarIc/modeCheck.png" mode=""></image></view><view class="agree flexA"> 我已阅读并同意 <view class="" bindtap="{{f}}">《用户协议》</view> 和 <view class="" bindtap="{{g}}">《隐私协议》</view></view></view></view>
\ No newline at end of file
... ...