wupengfei
10 天以前 59ea615c2e052627aee8159b08e381dd7714c988
apps/cMiniApp/src/subpackages/login/authorization/authorization.vue
@@ -25,7 +25,8 @@
      v-model="state.policyChecked"
      policyBtnText="若手机号未注册,将为您直接注册账号,注册即为同意"
    />
    <div class="other-login-channel-wrapper" v-if="!isLoginByWeb">
    <!-- <div class="other-login-channel-wrapper" v-if="!isLoginByWeb"> -->
    <div class="other-login-channel-wrapper" v-if="NODE_ENV === 'development'">
      <nut-divider>其他登录方式</nut-divider>
      <div class="other-login-channel-list">
        <div class="other-login-channel-list-item" @click="goLoginByForm()">
@@ -34,7 +35,7 @@
          </div>
          <div class="other-login-channel-list-item-text">验证码登录</div>
        </div>
        <!-- <div
        <div
          class="other-login-channel-list-item"
          @click="goLoginByForm(LoginFormTabs.AccountLogin)"
        >
@@ -42,7 +43,7 @@
            <img :src="IconPassword" />
          </div>
          <div class="other-login-channel-list-item-text">账户登录</div>
        </div> -->
        </div>
      </div>
    </div>
  </LoginPageLayout>
@@ -61,6 +62,9 @@
import IconPassword from '@/assets/login/icon-btn-password.png';
import { LoginFormTabs } from '../constants';
import * as authServices from '@12333/services/apiV2/auth';
import { NODE_ENV } from '@/constants';
import { subscribeMessageTemplateIdsForC } from '@12333/constants';
console.log('NODE_ENV: ', NODE_ENV);
defineOptions({
  name: 'authorization',
@@ -166,12 +170,37 @@
  } catch (error) {}
}
function handleLoginSuccess() {
  Message.success('授权登录成功', {
    onClosed: () => {
      jump();
    },
  });
async function handleLoginSuccess() {
  try {
    if (!Taro.requestSubscribeMessage) {
      await Message.confirm({ message: '你的微信版本过低,不支持订阅消息,是否继续?' });
    }
    const res = await Taro.getSetting({
      withSubscriptions: true,
    });
    let setting: boolean[] = [];
    if (res.subscriptionsSetting && res.subscriptionsSetting.itemSettings) {
      setting = subscribeMessageTemplateIdsForC
        .map((id) => res.subscriptionsSetting.itemSettings[id] !== 'accept')
        .filter(Boolean);
    }
    // if (setting.length > 0) {
    Taro.requestSubscribeMessage({
      tmplIds: subscribeMessageTemplateIdsForC,
      success: function (res) {
        console.log('res: ', res);
      },
    });
    console.log('setting: ', setting);
    // }
    Message.success('授权登录成功', {
      onClosed: () => {
        jump();
      },
    });
  } catch (error) {
    console.log('error: ', error);
  }
}
function goLoginByForm(tab = LoginFormTabs.VerificationCodeLogin) {