优化代码

This commit is contained in:
pengxiaolong
2025-08-06 20:48:39 +08:00
parent 40c3282515
commit 0a721e99f8
54 changed files with 1252 additions and 205 deletions

View File

@@ -1 +1 @@
"use strict";const e=require("../../common/vendor.js"),i=require("../../components/request.js"),t=require("../../components/postFile.js"),n=require("../../components/generateFileName.js"),o=require("../../stores/counter.js"),s=require("../../components/goEasyTool/tool.js"),a=o.useCounterStore(),r={inject:["$global"],data:()=>({userinfo:"",name:"",id:"",info:{},userSig:"",lastPage:"",picture:"",Filename:n.generateFileName()}),onLoad(i){e.index.getStorage({key:"userinfo",success:e=>{this.id=e.data.id}}),e.index.getStorage({key:"lastPage",success:e=>{this.lastPage="/"+e.data},fail:()=>{this.lastPage="/pages/Home/Home"}})},methods:{Return(){e.index.reLaunch({url:"/pages/Home/Home"})},inputName(e){this.name=e.detail.value},async Userinfo(e){const{avatarUrl:i}=e.detail;this.userinfo=i},async wxLogin(n){if(""!==this.name&&""!==this.userinfo){e.index.showLoading({title:"登录中...",mask:!0});const{code:n}=await e.index.login({provider:"weixin",onlyAuthorize:!0});t.uploadFile({path:this.userinfo,name:this.Filename}).then((t=>{this.picture=t.split("/").pop(),i.request({url:"user/inputUserInfo",method:"POST",data:{id:this.id,headerIcon:this.Filename,nickName:this.name,code:n},userInfo:!1}).then((i=>{200===i.code?(e.index.showToast({title:"登录成功",icon:"success"}),e.index.setStorageSync("userinfo",i.data.info),s.goEasylogin(this.$goeasy,String(i.data.info.id),this.picture,this.name),a.$patch({myitem:i.data.info}),e.index.hideLoading(),e.index.reLaunch({url:this.lastPage})):e.index.showToast({title:i.msg,icon:"none"})}))})).catch((e=>{console.log(e)}))}else e.index.showToast({title:"请填写头像昵称",icon:"success",duration:3e3})}}};const c=e._export_sfc(r,[["render",function(i,t,n,o,s,a){return{a:e.o(((...e)=>a.Return&&a.Return(...e))),b:s.userinfo,c:e.o(((...e)=>a.Userinfo&&a.Userinfo(...e))),d:e.o(((...e)=>a.inputName&&a.inputName(...e))),e:e.o(((...e)=>a.wxLogin&&a.wxLogin(...e)))}}],["__scopeId","data-v-cf0dffc1"]]);wx.createPage(c);
"use strict";const e=require("../../common/vendor.js"),i=require("../../components/request.js"),t=require("../../components/postFile.js"),n=require("../../components/generateFileName.js"),o=require("../../stores/counter.js"),s=require("../../components/goEasyTool/tool.js"),a=o.useCounterStore(),r={inject:["$global"],data:()=>({userinfo:"",name:"",id:"",info:{},userSig:"",lastPage:"",picture:"",Filename:n.generateFileName()}),onLoad(i){e.index.getStorage({key:"userinfo",success:e=>{this.id=e.data.id}}),e.index.getStorage({key:"lastPage",success:e=>{this.lastPage="/"+e.data},fail:()=>{this.lastPage="/pages/Home/Home"}})},methods:{Return(){e.index.reLaunch({url:"/pages/Home/Home"})},inputName(e){this.name=e.detail.value},async Userinfo(e){const{avatarUrl:i}=e.detail;this.userinfo=i},async wxLogin(n){if(""!==this.name&&""!==this.userinfo){e.index.showLoading({title:"登录中...",mask:!0});const{code:n}=await e.index.login({provider:"weixin",onlyAuthorize:!0});t.uploadFile({path:this.userinfo,name:this.Filename}).then((t=>{this.picture=t.split("/").pop(),i.request({url:"user/inputUserInfo",method:"POST",data:{id:this.id,headerIcon:this.Filename,nickName:this.name,code:n},userInfo:!1}).then((i=>{200===i.code?(e.index.showToast({title:"登录成功",icon:"success"}),e.index.setStorageSync("userinfo",i.data.info),e.index.setStorageSync("token",i.data.info.token),s.goEasylogin(this.$goeasy,String(i.data.info.id),this.picture,this.name),a.$patch({myitem:i.data.info}),e.index.hideLoading(),e.index.reLaunch({url:this.lastPage})):e.index.showToast({title:i.msg,icon:"none"})}))})).catch((e=>{console.log(e)}))}else e.index.showToast({title:"请填写头像昵称",icon:"success",duration:3e3})}}};const c=e._export_sfc(r,[["render",function(i,t,n,o,s,a){return{a:e.o(((...e)=>a.Return&&a.Return(...e))),b:s.userinfo,c:e.o(((...e)=>a.Userinfo&&a.Userinfo(...e))),d:e.o(((...e)=>a.inputName&&a.inputName(...e))),e:e.o(((...e)=>a.wxLogin&&a.wxLogin(...e)))}}],["__scopeId","data-v-ee448b7c"]]);wx.createPage(c);

View File

@@ -1 +1 @@
<view class="return data-v-cf0dffc1" bindtap="{{a}}"><image class="data-v-cf0dffc1" style="width:40rpx;height:40rpx" src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Return.png" mode="scaleToFill"/></view><view class="container data-v-cf0dffc1"><button class="login-btn data-v-cf0dffc1" open-type="chooseAvatar" bindchooseavatar="{{c}}"><image class="avatar data-v-cf0dffc1" src="{{b}}"></image></button><input type="nickname" class="weui-input data-v-cf0dffc1" placeholder="请输入昵称" bindblur="{{d}}"/><button class="weui-btn data-v-cf0dffc1" bindtap="{{e}}">登录</button></view>
<view class="return data-v-ee448b7c" bindtap="{{a}}"><image class="data-v-ee448b7c" style="width:40rpx;height:40rpx" src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Return.png" mode="scaleToFill"/></view><view class="container data-v-ee448b7c"><button class="login-btn data-v-ee448b7c" open-type="chooseAvatar" bindchooseavatar="{{c}}"><image class="avatar data-v-ee448b7c" src="{{b}}"></image></button><input type="nickname" class="weui-input data-v-ee448b7c" placeholder="请输入昵称" bindblur="{{d}}"/><button class="weui-btn data-v-ee448b7c" bindtap="{{e}}">登录</button></view>

View File

@@ -1 +1 @@
.container.data-v-cf0dffc1{width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;background:linear-gradient(to bottom,rgba(17,203,42,.43),rgba(37,116,252,.427))}.login-btn.data-v-cf0dffc1{width:200rpx;height:200rpx;border-radius:50%;padding:0;margin-bottom:60rpx}.avatar.data-v-cf0dffc1{width:100%;height:100%;border-radius:50%}.weui-input.data-v-cf0dffc1{width:80%;text-align:center;margin-bottom:40rpx}.weui-btn.data-v-cf0dffc1{width:40%;margin-top:20rpx;background-color:rgba(17,203,42,0);color:#fff}.return.data-v-cf0dffc1{position:fixed;top:100rpx;left:80rpx;z-index:999}
.container.data-v-ee448b7c{width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;background:linear-gradient(to bottom,rgba(17,203,42,.43),rgba(37,116,252,.427))}.login-btn.data-v-ee448b7c{width:200rpx;height:200rpx;border-radius:50%;padding:0;margin-bottom:60rpx}.avatar.data-v-ee448b7c{width:100%;height:100%;border-radius:50%}.weui-input.data-v-ee448b7c{width:80%;text-align:center;margin-bottom:40rpx}.weui-btn.data-v-ee448b7c{width:40%;margin-top:20rpx;background-color:rgba(17,203,42,0);color:#fff}.return.data-v-ee448b7c{position:fixed;top:100rpx;left:80rpx;z-index:999}