|
|
@@ -1,6 +1,5 @@
|
|
|
<template>
|
|
|
<view class="app-main app-content">
|
|
|
- <view v-if="!$util.isEmpty(loginInfo)">
|
|
|
<!-- 今日概况 -->
|
|
|
<div class="user-wrap">
|
|
|
<div class="user-top">
|
|
|
@@ -89,12 +88,6 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <!--没有开店时的界面-->
|
|
|
- <none-hd :show="no_shop_show_model" :title="MODEL_TITLE" :btnText="MODEL_BTN_TEXT" @bthClick="toFreeApply_HOME" :authShow="EXPER_AUTH_SHOW" @comfirm="experienceFun"></none-hd>
|
|
|
- </view>
|
|
|
- <view v-else>
|
|
|
- <loginModel :show="show_login_model" @comfirm="loginFun" @mobileLogin="mobileLogin"></loginModel>
|
|
|
- </view>
|
|
|
</view>
|
|
|
</template>
|
|
|
|
|
|
@@ -106,7 +99,6 @@ import ModalModule from "@/components/plugin/modal";
|
|
|
import { getUser,uniLoginFn } from "@/utils/auth";
|
|
|
import { consoleIndex } from "@/api/workbench";
|
|
|
import { closeBook } from "@/api/book";
|
|
|
-import noneHd from "@/components/none-hd";
|
|
|
import loginModel from "@/components/login-model";
|
|
|
import {appLogin} from '@/api/common'
|
|
|
import { getDictionaries } from '@/api/mini'
|
|
|
@@ -120,7 +112,6 @@ export default {
|
|
|
ModalModule,
|
|
|
FabModule,
|
|
|
AppAvatarModule,
|
|
|
- noneHd,
|
|
|
loginModel
|
|
|
},
|
|
|
mixins: [productMins],
|
|
|
@@ -196,136 +187,6 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(['setUserShopAll']),
|
|
|
- mobileLogin(){
|
|
|
- let that = this
|
|
|
- uni.showLoading({mask:true})
|
|
|
- uni.preLogin({
|
|
|
- provider: 'univerify',
|
|
|
- success:()=>{
|
|
|
- uni.login({
|
|
|
- provider: 'univerify',
|
|
|
- // 自定义登录框样式
|
|
|
- univerifyStyle: {"fullScreen": true},
|
|
|
- success:(res)=>{ // 登录成功
|
|
|
- let openid = res.authResult.openid
|
|
|
- let access_token = res.authResult.access_token
|
|
|
- phoneLogin({openid,access_token}).then(subRes=>{
|
|
|
- let currentShopId = subRes.data.admin.currentShopId || 0
|
|
|
- if(Number(currentShopId) > 0){
|
|
|
- //有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
|
|
|
- if(subRes.code == 1){
|
|
|
- if (that.$util.isEmpty(subRes)) {
|
|
|
- return false
|
|
|
- }
|
|
|
- uni.setStorageSync('token', subRes.data.token)
|
|
|
- uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
|
|
|
- getDictionaries({ token: subRes.data.token }).then(res => {
|
|
|
- if (that.$util.isEmpty(res)) {
|
|
|
- return false
|
|
|
- }
|
|
|
- that.$store.commit('setDictionariesInfo', { ...res.data.dict, ...res.data })
|
|
|
- that.$store.commit('setMyShopInfo', { ...res.data.shop, ...res.data })
|
|
|
- })
|
|
|
- that.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
|
|
|
-
|
|
|
- that.show_login_model = false
|
|
|
-
|
|
|
- uni.showTabBar()
|
|
|
-
|
|
|
- getUser(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
|
|
|
-
|
|
|
- //#ifdef APP-PLUS
|
|
|
- that.skCustomId = subRes.data.skCustomId
|
|
|
- that.listenPDAkd()
|
|
|
- // #endif
|
|
|
-
|
|
|
- that.setUserShopAll()
|
|
|
- that.init()
|
|
|
-
|
|
|
- // #ifdef APP-PLUS
|
|
|
- //保存安卓的clientId
|
|
|
- let hasClientId = !that.$util.isEmpty(subRes.data.admin.clientId) ? subRes.data.admin.clientId : ''
|
|
|
- const clientInfo = plus.push.getClientInfo()
|
|
|
- let currentClientId = !that.$util.isEmpty(clientInfo.clientid) ? clientInfo.clientid : ''
|
|
|
- if(hasClientId == '' || hasClientId != currentClientId){
|
|
|
- replaceClientId({id:currentClientId}).then(res=>{ })
|
|
|
- }
|
|
|
- // #endif
|
|
|
- }
|
|
|
- uni.hideLoading()
|
|
|
- }else{
|
|
|
- that.$msg('您还没有注册')
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- fail(res){
|
|
|
- // 登录失败
|
|
|
- //关闭一键登录弹出窗口
|
|
|
- uni.closeAuthView()
|
|
|
- uni.hideLoading()
|
|
|
- },
|
|
|
- complete: () => {
|
|
|
- uni.closeAuthView()
|
|
|
- uni.hideLoading()
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- fail(res){
|
|
|
- // 预登录失败
|
|
|
- //如果手机没有插入有效的sim卡,或者手机蜂窝数据网络关闭,
|
|
|
- //都有可能造成预登录校验失败。
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- loginFun(mobile,password){
|
|
|
- let that = this
|
|
|
- uni.showLoading({mask:true})
|
|
|
- //有几个地方涉及登陆,需要统一方法,请搜索关键词 uni_login
|
|
|
- appLogin({mobile,password}).then(subRes=>{
|
|
|
-
|
|
|
- if(subRes.code == 1){
|
|
|
-
|
|
|
- if (that.$util.isEmpty(subRes)) {
|
|
|
- return false
|
|
|
- }
|
|
|
- uni.setStorageSync('token', subRes.data.token)
|
|
|
- uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
|
|
|
- getDictionaries({ token: subRes.data.token }).then(res => {
|
|
|
- if (that.$util.isEmpty(res)) {
|
|
|
- return false
|
|
|
- }
|
|
|
- that.$store.commit('setDictionariesInfo', { ...res.data.dict, ...res.data })
|
|
|
- that.$store.commit('setMyShopInfo', { ...res.data.shop, ...res.data })
|
|
|
- })
|
|
|
- that.$store.commit('setLoginInfo', { ...subRes.data.admin, ...subRes.data })
|
|
|
-
|
|
|
- that.show_login_model = false
|
|
|
-
|
|
|
- uni.showTabBar()
|
|
|
-
|
|
|
- getUser(true).then(res => { uni.setNavigationBarTitle({ title: res.name }) })
|
|
|
-
|
|
|
- //#ifdef APP-PLUS
|
|
|
- that.skCustomId = subRes.data.skCustomId
|
|
|
- that.listenPDAkd()
|
|
|
- // #endif
|
|
|
-
|
|
|
- that.setUserShopAll()
|
|
|
- that.init()
|
|
|
- uni.hideLoading()
|
|
|
- // #ifdef APP-PLUS
|
|
|
- //保存安卓的clientId
|
|
|
- let hasClientId = !that.$util.isEmpty(subRes.data.admin.clientId) ? subRes.data.admin.clientId : ''
|
|
|
- const clientInfo = plus.push.getClientInfo()
|
|
|
- let currentClientId = !that.$util.isEmpty(clientInfo.clientid) ? clientInfo.clientid : ''
|
|
|
- if(hasClientId == '' || hasClientId != currentClientId){
|
|
|
- replaceClientId({id:currentClientId}).then(res=>{ })
|
|
|
- }
|
|
|
- // #endif
|
|
|
- }
|
|
|
- })
|
|
|
-
|
|
|
- },
|
|
|
closeBook(){
|
|
|
let that = this
|
|
|
that.$util.confirmModal({title:"确定关闭?",content:'关闭后可以在底部菜单【我的】,找到【使用教程】重新打开'},() => {
|
|
|
@@ -597,4 +458,4 @@ export default {
|
|
|
font-size: 34upx;
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|