MrShi
2026-05-22 ea2fb93a0dfcde8f5b66825b20f9d9b835a28acc
small-program/shop/pages/login/login.vue
@@ -15,7 +15,10 @@
         <view class="input-row password-row">
            <u-icon name="lock" size="30" color="#B8B8B8"></u-icon>
            <input v-model="form.password" class="input-field" password type="text" placeholder="请输入密码" placeholder-style="color: #999999;" />
            <input v-model="form.password" class="input-field" :password="!showPassword" placeholder="请输入密码" placeholder-style="color: #999999;" />
            <view class="password-toggle" @click="showPassword = !showPassword">
               <u-icon :name="showPassword ? 'eye' : 'eye-off'" size="20" color="#B8B8B8"></u-icon>
            </view>
         </view>
         <view class="input-divider"></view>
      </view>
@@ -44,6 +47,7 @@
      data() {
         return {
            agreed: false,
            showPassword: false,
            form: {
               telephone: '',
               password: ''
@@ -87,7 +91,7 @@
         }
      },
      methods: {
         async handleLogin() {
         handleLogin() {
            if (!this.form.telephone) {
               uni.showToast({
                  title: '请输入账号',
@@ -109,28 +113,27 @@
               })
               return
            }
            uni.showLoading({ title: '登录中...', mask: true })
            const res = await this.$u.api.shopLogin({
            this.$u.api.shopLogin({
               openid: this.openid,
               password: this.form.password,
               telephone: this.form.telephone
            })
            uni.hideLoading()
            if (res.code === 200) {
               this.$store.commit('setUserType', 1)
               this.$store.commit('setShopToken', res.data.token)
               // 获取门店信息
               const shopInfoRes = await this.$u.api.getShopInfo({})
               if (shopInfoRes.code === 200) {
                  this.$store.commit('setShopInfo', shopInfoRes.data)
            }).then(async res => {
               if (res.code === 200) {
                  this.$store.commit('setUserType', 1)
                  this.$store.commit('setShopToken', res.data.token)
                  // 获取门店信息
                  const shopInfoRes = await this.$u.api.getShopInfo({})
                  if (shopInfoRes.code === 200) {
                     this.$store.commit('setShopInfo', shopInfoRes.data)
                  }
                  uni.showToast({ title: '登录成功', icon: 'success' })
                  setTimeout(() => {
                     uni.reLaunch({
                        url: '/shop/pages/store-home/store-home'
                     });
                  }, 1500)
               }
               uni.showToast({ title: '登录成功', icon: 'success' })
               setTimeout(() => {
                  uni.reLaunch({
                     url: '/shop/pages/store-home/store-home'
                  });
               }, 1500)
            }
            })
         },
         goToService(type) {
            uni.navigateTo({
@@ -181,6 +184,10 @@
   .password-row {
      margin-top: 18rpx;
   }
   .password-toggle {
      padding: 10rpx;
   }
   .input-field {
      flex: 1;