shish hace 4 años
padre
commit
8f6e0bce19

+ 51 - 0
ghsApp/src/admin/staff/miniAutoLogin.vue

@@ -0,0 +1,51 @@
+<template>
+  <view class="app-content">
+    <form>
+      <view class="module-com input-line-wrap">
+        <view class="btn-wrap">
+          <view style="padding:30upx 0 30upx 0;font-size:30upx;">帐号绑定微信,下次打开小程序自动登录后台</view>
+          <button class="admin-button-com blue middle" @click="autoLogin()">授权并绑定</button>
+        </view>
+      </view>
+    </form>
+  </view>
+</template>
+<script>
+import { bindAutoLogin} from "@/api/mini";
+export default {
+  name: "miniAutoLogin",
+  components: {
+  },
+  data() {
+    return {
+    };
+  },
+  computed: {},
+  onLoad(props) {
+
+  },
+  methods: {
+     autoLogin() {
+       let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
+       if(this.$util.isEmpty(currentMiniOpenId)){
+         this.$msg('启用失败')
+         return false
+       }
+       let that = this
+       uni.getUserProfile({
+          desc:'登录',
+          success:(res)=>{
+            bindAutoLogin({ iv: res.iv, encryptedData: res.encryptedData,miniOpenId:currentMiniOpenId }).then( res => {
+              if(res.code == 1){
+                that.$msg('绑定成功')
+                setTimeout(() => {
+									uni.navigateBack()
+								},900)
+              }
+            });
+          }
+        })
+    }
+  }
+};
+</script>

+ 4 - 0
ghsApp/src/api/mini/index.js

@@ -25,3 +25,7 @@ export const getWxInfo = data => {
 export const getWxPhone = data => {
 	return https.post('/admin/mini-mobile', data)
 }
+
+export const bindAutoLogin = data => {
+	return https.post('/admin/bind-auto-login', data)
+}

+ 2 - 1
ghsApp/src/pages.json

@@ -133,7 +133,8 @@
 				{"path": "add","style": {"navigationBarTitleText": "添加员工"}},
 				{"path": "detail","style": {"navigationBarTitleText": "详情"}},
 				{"path": "sel-member","style": {"navigationBarTitleText": "客户列表"}},
-				{"path": "achieve","style": {"navigationBarTitleText": "员工业绩"}}
+				{"path": "achieve","style": {"navigationBarTitleText": "员工业绩"}},
+				{ "path": "miniAutoLogin", "style": { "navigationBarTitleText": "绑定帐号" } }
 			]
 		},
 		{

+ 3 - 1
ghsApp/src/pagesClient/official/apply.vue

@@ -273,12 +273,14 @@ export default {
       }
     },
     confirmFn () {
+      let currentMiniOpenId = uni.getStorageSync('currentMiniOpenId')
       applyRegister({
         hdShopAdminId: this.option.hdShopAdminId,
         ghsShopAdminId: this.option.ghsShopAdminId,
         ...this.form,
         style: this.option.style || 0,
-        from: this.option.from || 0
+        from: this.option.from || 0,
+        miniOpenId:currentMiniOpenId
       }).then(res => {
         this.$util.pageTo({
           url: "/pagesClient/official/result",