liudan 1 year ago
parent 2e49c0cad3
commit 27cb79337f
  1. 2
      androidPrivacy.json
  2. 4
      manifest.json
  3. 113
      pages/login.vue
  4. 124
      utils/req.js

@ -1,5 +1,5 @@
{ {
"version" : "7.0.0", "version" : "9.0.0",
"prompt" : "template", "prompt" : "template",
"title" : "服务协议和隐私政策", "title" : "服务协议和隐私政策",
"message" : "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的位置信息、设备标识、操作日志等信息用于分析、优化应用性能。<br/>  你可阅读<a href=\"https://xixi-api.njrenzhou.cn/information.html\">《服务协议》</a>和<a href=\"https://xixi-api.njrenzhou.cn/protocol.html\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。", "message" : "  请你务必审慎阅读、充分理解“服务协议”和“隐私政策”各条款,包括但不限于:为了更好的向你提供服务,我们需要收集你的位置信息、设备标识、操作日志等信息用于分析、优化应用性能。<br/>  你可阅读<a href=\"https://xixi-api.njrenzhou.cn/information.html\">《服务协议》</a>和<a href=\"https://xixi-api.njrenzhou.cn/protocol.html\">《隐私政策》</a>了解详细信息。如果你同意,请点击下面按钮开始接受我们的服务。",

@ -3,8 +3,8 @@
"appid" : "__UNI__3303922", "appid" : "__UNI__3303922",
// "appid" : "__UNI__AE4A250", // "appid" : "__UNI__AE4A250",
"description" : "希希到家", "description" : "希希到家",
"versionName" : "7.0.0", "versionName" : "9.0.0",
"versionCode" : 700, "versionCode" : 900,
"transformPx" : false, "transformPx" : false,
"uniStatistics" : { "uniStatistics" : {
"enable" : false // "enable" : false //

@ -60,12 +60,12 @@
</view> </view>
<u-button text="登录" :disabled="!phone||!code" @click="smsLogin" class="loginBtn"></u-button> <u-button text="登录" :disabled="!phone||!code" @click="smsLogin" class="loginBtn"></u-button>
<!-- <view >登录</view> --> <!-- <view >登录</view> -->
<!-- <view class="otherLogin"> <view class="otherLogin">
<view class="line"></view> <view class="line"></view>
<view class="otext">其他登录</view> <view class="otext">其他登录</view>
<view class="line"></view> <view class="line"></view>
</view> </view>
<image src="@/static/wlogin.png" class="wlogin" @tap="$refs.show_rule_item.open()" mode="widthFix"></image> --> <image src="@/static/wlogin.png" class="wlogin" @tap="$refs.show_rule_item.open()" mode="widthFix"></image>
<!-- <view class="page-height flex-center flex-column"> <!-- <view class="page-height flex-center flex-column">
<image mode="aspectFill" lazy-load class="logo-img mb-md" :src="base_info.app_logo"></image> <image mode="aspectFill" lazy-load class="logo-img mb-md" :src="base_info.app_logo"></image>
<view class="f-caption c-caption">{{base_info.app_text}}</view> <view class="f-caption c-caption">{{base_info.app_text}}</view>
@ -75,7 +75,7 @@
</view> </view>
</view> --> </view> -->
<!-- <uni-popup ref="show_rule_item" type="center" :maskClick="false"> <uni-popup ref="show_rule_item" type="center" :maskClick="false">
<view class="common-popup-content fill-base pd-lg radius-34"> <view class="common-popup-content fill-base pd-lg radius-34">
<view class="title">温馨提示</view> <view class="title">温馨提示</view>
<view class="f-desc c-title mt-lg"> <view class="f-desc c-title mt-lg">
@ -91,7 +91,7 @@
:style="{background: primaryColor,color:'#fff'}">确定</view> :style="{background: primaryColor,color:'#fff'}">确定</view>
</view> </view>
</view> </view>
</uni-popup> --> </uni-popup>
</view> </view>
</template> </template>
@ -118,17 +118,19 @@
} }
}, },
async onLoad() { async onLoad() {
console.log('pages/login') console.log('pages/login',"888")
let { let {
autograph = '', autograph = '',
appLogin = '' appLogin = ''
} = this } = this
console.log('autograph,appLogin', autograph, appLogin) console.log('autograph,appLogin', autograph, appLogin)
if (autograph && appLogin) { if (autograph && appLogin) {
if(appLogin.unionId){ if(appLogin.unionId){
console.log("999")
this.toLogin(appLogin) this.toLogin(appLogin)
return return
}else{ }else{
console.log("777")
this.checked=[] this.checked=[]
this.checked.push('1') this.checked.push('1')
this.smsLogin(appLogin) this.smsLogin(appLogin)
@ -164,59 +166,60 @@
...mapActions(['getConfigInfo', 'getUserInfo']), ...mapActions(['getConfigInfo', 'getUserInfo']),
...mapMutations(['updateConfigItem', 'updateUserItem']), ...mapMutations(['updateConfigItem', 'updateUserItem']),
// //
// async wxLogin() { async wxLogin() {
// this.$refs.show_rule_item.close() this.$refs.show_rule_item.close()
// try { try {
// let [providerErr, providerData] = await uni.getProvider({ let [providerErr, providerData] = await uni.getProvider({
// service: 'oauth', service: 'oauth',
// }); });
// console.log("111") console.log("111")
// // let [loginErr, loginData] =await uni.getUserProfile({ // let [loginErr, loginData] =await uni.getUserProfile({
// // desc: '', // desc: '',
// // lang: 'zh_CN', // lang: 'zh_CN',
// // success: res => { // success: res => {
// // console.log(res,"jjj"); // console.log(res,"jjj");
// // // this.isShowLogin = false; // // this.isShowLogin = false;
// // // this.userInfo = res.userInfo; // // this.userInfo = res.userInfo;
// // }, // },
// // fail: err => { // fail: err => {
// // console.log(err.errMsg); // console.log(err.errMsg);
// // } // }
// // }); // });
// let [loginErr, loginData] = await uni.login({ let [loginErr, loginData] = await uni.login({
// provider: 'weixin' provider: 'weixin'
// }); });
// console.log("222") console.log("222")
// let [infoErr, infoData] = await uni.getUserInfo({ let [infoErr, infoData] = await uni.getUserInfo({
// provider: 'weixin' provider: 'weixin'
// }) })
// console.log("333",infoData) console.log("333",infoData)
// let { let {
// userInfo = {} userInfo = {}
// } = infoData } = infoData
// let { let {
// openId = '' openId = ''
// } = userInfo } = userInfo
// if (!openId) return if (!openId) return
// this.$util.showLoading({ this.$util.showLoading({
// title: "..." title: "登录中..."
// }) })
// try { try {
// this.toLogin(userInfo) this.toLogin(userInfo)
// } catch (e) { } catch (e) {
// this.$util.hideAll() this.$util.hideAll()
// } }
// } catch (e) { } catch (e) {
// console.log(e) console.log(e)
// this.$util.showToast({ this.$util.showToast({
// title: '' title: '请先安装微信或升级版本'
// }); });
// } }
// }, },
async smsLogin(item){ async smsLogin(item){
console.log("短信登陆")
if(this.checked.length==0){ if(this.checked.length==0){
uni.$u.toast('请阅读并同意《隐私政策》'); uni.$u.toast('请阅读并同意《隐私政策》');
return false; return false;

@ -212,38 +212,59 @@ const appLogin = async function() {
let url = formatUrl("index/appLogin") let url = formatUrl("index/appLogin")
try { try {
let userInfo = $store.state.user.appLogin let userInfo = $store.state.user.appLogin
let { // if(userInfo.data){
openId = '' if(userInfo.data&&userInfo.data.openid){
} = userInfo let arr = ['autograph', 'userInfo', 'location', 'appLogin']
if (!openId) return arr.map(key => {
let d = await tokenFly.post(url, { uni.setStorageSync(key, '');
data: userInfo $store.commit('updateUserItem', {
}); key,
let { val: ''
code, })
data, uni.navigateTo({
error url:'/pages/login'
} = d.data })
if (code !== 200) { uni.hideLoading()
uni.hideLoading() })
serverError({ return;
code, }else{
msg: error let {
}); openId = ''
throw d; } = userInfo
}
//登录成功 if (!openId) return
uni.hideLoading() console.log(userInfo,"aaaaa")
$store.commit('updateUserItem', { let d = await tokenFly.post(url, {
key: 'userInfo', data: userInfo
val: data.data });
}) let {
$store.commit('updateUserItem', { code,
key: 'autograph', data,
val: data.autograph error
}) } = d.data
return data if (code !== 200) {
uni.hideLoading()
serverError({
code,
msg: error
});
throw d;
}
//登录成功
uni.hideLoading()
$store.commit('updateUserItem', {
key: 'userInfo',
val: data.data
})
$store.commit('updateUserItem', {
key: 'autograph',
val: data.autograph
})
return data
}
} catch (e) { } catch (e) {
console.log("登陆失败",e)
return await Promise.reject(e); return await Promise.reject(e);
} }
} }
@ -301,26 +322,50 @@ fly.interceptors.response.use(
//#endif //#endif
//#ifdef APP-PLUS //#ifdef APP-PLUS
console.log("==> APP-PLUS 401") console.log("==> APP-PLUS 401",response)
await appLogin() let res = await appLogin()
console.log(res,"999")
// let userInfo = $store.state.user.appLogin
// console.log(userInfo,"111")
// if(userInfo.data){
// if(userInfo.data.openid){
// let arr = ['autograph', 'userInfo', 'location', 'appLogin']
// arr.map(key => {
// uni.setStorageSync(key, '');
// $store.commit('updateUserItem', {
// key,
// val: ''
// })
// uni.navigateTo({
// url:'/pages/login'
// })
// uni.hideLoading()
// })
// }
// return;
// }else{
// await appLogin()
// }
//#endif //#endif
response.request.headers["autograph"] = $store.state.user.autograph || '' response.request.headers["autograph"] = $store.state.user.autograph || ''
fly.unlock(); fly.unlock();
return fly.request(response.request); // return fly.request(response.request);
}, },
async (err) => { async (err) => {
console.log(err, "=======fly.interceptors.response.use err",err); // console.log(err, "=======fly.interceptors.response.use err");
console.log(err,"--=====")
let { let {
status = 0, status = 0,
} = err } = err
$util.hideAll() $util.hideAll()
console.log(err) // msgError({
msgError({ // // msg: err.response.data.error.error
msg: err.response.data.error.error // msg:err
}) // })
networkError({ networkError({
code: status, code: status,
}) })
@ -328,7 +373,6 @@ fly.interceptors.response.use(
return await Promise.reject(err); return await Promise.reject(err);
} }
) )
//统一处理请求,satus=200网络正常code=200服务器正常 //统一处理请求,satus=200网络正常code=200服务器正常
const httpType = ["post", "get"] const httpType = ["post", "get"]
const formatReq = function() { const formatReq = function() {

Loading…
Cancel
Save