This commit is contained in:
18631081161 2024-09-20 21:48:25 +08:00
commit e21d6d2ee6
2 changed files with 40 additions and 2 deletions

View File

@ -21,7 +21,10 @@ var serverConfig = {}
//dev-localhost
var baseUrl = 'https://music.shhuanmeng.com'
// var baseUrl = 'http://localhost:90'
// var basePayCenterUrl = 'https://api-pay.hissai.com'
serverConfig.apiUrl_Music_AccountLogIn = baseUrl + '/api/Account/AccountLogIn'
serverConfig.apiUrl_Music_GetMiniProgramUserInfo = baseUrl + '/api/Account/GetMiniProgramUserInfo'
serverConfig.apiUrl_Music_GetMusicGenresList = baseUrl + '/api/Music/GetMusicGenresList'
serverConfig.apiUrl_Music_GetMusicGenresInfo = baseUrl + '/api/Music/GetMusicGenresInfo'
@ -131,7 +134,7 @@ AppServer.prototype.postData = async function(url, postData) {
})
.then((res) => {
// 此处的 res 参数,与使用默认方式调用时 success 回调中的 res 参数一致
console.log(`post,url=${url},form=${formBody},response=${res.data}`);
console.log(`post,url=${url},form=${JSON.stringify(postData)},response=${res.data}`);
//在这里处理验签失败等问题
return res.data;
})
@ -232,6 +235,27 @@ AppServer.prototype.GetServerList = async function() {
})
}
/**
* @param {Object} code
*/
AppServer.prototype.AccountLogIn = async function(code) {
return this.postData(serverConfig.apiUrl_Music_AccountLogIn, {
"loginType": 2,
"code": code
}).then(data => {
console.log((data));
})
}
AppServer.prototype.GetMiniProgramUserInfo = async function(encryptedData, iv, userId) {
return this.postData(serverConfig.apiUrl_Music_GetMiniProgramUserInfo, {
"encryptedData": encryptedData,
"iv": iv,
"userId": userId
}).then(data => {
console.log((data));
})
}
/**
* 运行平台

View File

@ -18,6 +18,11 @@
<text style="color: white;">登录</text>
</view>
<input type="nickname" class="weui-input" placeholder="请输入昵称" />
<button class="avatar-wrapper" open-type="chooseAvatar" bind:chooseavatar="onChooseAvatar">
</button>
</view>
@ -30,6 +35,9 @@
</template>
<script>
import {
AppServer
} from '../../modules/api/AppServer';
export default {
data() {
return {
@ -59,8 +67,14 @@
return;
}
this.isLogin = true;
var loginRes = await uni.login();
// AccountLogIn
var appserver = new AppServer();
var data = await appserver.AccountLogIn(loginRes.code)
var userInfo = await wx.getUserInfo({
withCredentials: true
})
console.log(userInfo);
console.log(loginRes);
this.isLogin = false;