guhongwei 2 سال پیش
والد
کامیت
f2f8fd6609

+ 5 - 0
app.json

@@ -1,5 +1,6 @@
 {
     "pages": [
+     
         "pages/index/index",
         "pages/register/index",
         "pages/other/agree",
@@ -9,6 +10,7 @@
         "pages/smy/index",
         "pages/club/index",
         "pages/match/index",
+
         "pages/superAdmin/suser/list",
         "pages/superAdmin/suser/add",
         "pages/superAdmin/suser/bind",
@@ -20,6 +22,7 @@
         "pages/superAdmin/sstudent/add",
         "pages/superAdmin/system/dictionary",
         "pages/superAdmin/system/adddictionary",
+
         "pages/schAdmin/school/info",
         "pages/schAdmin/coach/list",
         "pages/schAdmin/coach/add",
@@ -41,6 +44,7 @@
         "pages/schAdmin/income/list",
         "pages/schAdmin/stustat/list",
         "pages/schAdmin/coachstat/list",
+        
         "pages/stuAdmin/archives/list",
         "pages/stuAdmin/school/list",
         "pages/stuAdmin/school/info",
@@ -51,6 +55,7 @@
         "pages/stuAdmin/course/sign",
         "pages/stuAdmin/study/list",
         "pages/stuAdmin/fee/list",
+
         "pages/user/basic",
         "pages/setting/basic",
         "pages/setting/contact",

+ 57 - 1
pages/setting/basic.js

@@ -10,6 +10,8 @@ Page({
         form: { icon: [] },
         // 性别
         genderList: [],
+        // 账号绑定信息
+        bindForm: {}
     },
     initValidate() {
         const rules = { icon: { required: true }, name: { required: true }, gender: { required: true }, phone: { required: true, tel: true } }
@@ -47,7 +49,7 @@ Page({
         const { value } = e.detail;
         if (value == '0') wx.showToast({ title: `如进行身份切换,请在维护信息成功后退出登录,系统会自动进行身份置换!`, icon: 'none', duration: 2000 })
     },
-    // 提交登录
+    // 提交保存
     onSubmit: async function (e) {
         const that = this;
         const params = e.detail.value;
@@ -63,6 +65,60 @@ Page({
             else wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 })
         }
     },
+    // 账号绑定
+    scanCode: function () {
+        const that = this;
+        wx.showModal({
+            title: '提示',
+            content: '你确定要使用此微信绑定账号吗?',
+            async success(res) {
+                if (res.confirm) {
+                    // 账号绑定
+                    that.scanCode1();
+                }
+            }
+        })
+    },
+    // 账号绑定
+    scanCode1: function () {
+        const that = this;
+        wx.scanCode({
+            onlyFromCamera: true,
+            async success(res) {
+                let arr = res.result.split('&&');
+                let id = arr[0];
+                let type = arr[1];
+                // 绑定账号
+                that.searchBind(id, type);
+            }
+        })
+    },
+    // 绑定账号
+    searchBind: function (id, type) {
+        wx.getStorage({
+            key: 'user',
+            success: async res => {
+                // 学校
+                let arr;
+                let aee;
+                if (type == '1') { arr = await app.$post(`/school/${id}`, { user_id: res.data.id }); aee = await app.$post(`/user/${res.data.id}`, { type: type }); };
+                if (arr.errcode == '0' && aee.errcode == '0') {
+                    wx.showModal({
+                        title: '提示',
+                        content: '绑定账号成功,请退出登录',
+                        async success(res) {
+                            if (res.confirm) { wx.clearStorage(); wx.redirectTo({ url: '/pages/index/index' }) }
+                        }
+                    })
+                    // wx.showToast({ title: `绑定账号成功`, icon: 'success', duration: 2000 });
+                } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }); wx.showToast({ title: `${aee.errmsg}`, icon: 'error', duration: 2000 }) }
+            },
+            fail: res => {
+                wx.redirectTo({ url: '/pages/index/index', })
+            }
+        })
+
+    },
     /**
      * 生命周期函数--监听页面加载
      */

+ 1 - 0
pages/setting/basic.wxml

@@ -43,6 +43,7 @@
                 </view>
                 <view class="btn">
                     <button type="primary" size="mini" formType="submit">提交保存</button>
+                    <button type="primary" size="mini" bindtap="scanCode">账号绑定</button>
                 </view>
             </form>
         </view>

+ 1 - 1
pages/superAdmin/sadmin/list.js

@@ -68,7 +68,7 @@ Page({
     },
     makeQRCode(template = 0) {
         const that = this;
-        const url = `${app.globalData.publicUrl}/courtappbind?id=${that.data.form.id}&type='1'`;
+        const url = `${that.data.form.id}&&1`;
         var qrcode = new QRCode(`myQrcode`, {
             text: url,
             width: 110,

+ 25 - 2
pages/superAdmin/suser/bind.js

@@ -5,17 +5,40 @@ Page({
      * 页面的初始数据
      */
     data: {
-        frameStyle: { useTop: true, name: '账号绑定', leftArrow: true, useBar: false },
+        frameStyle: { useTop: true, name: '账号绑定', leftArrow: false, useBar: false },
+        id: '',
+        type: ''
     },
     // 返回
     back: function () {
         wx.navigateBack({ delta: 1 })
     },
+    toBind: function () {
+        const that = this;
+        let id = that.data.id;
+        let type = that.data.type;
+        wx.showModal({
+            title: '提示',
+            content: '你确定要使用此微信绑定账号吗?',
+            async success(res) {
+                if (res.confirm) {
+                    // 学校
+                    let arr;
+                    if (type == '1') { arr = await app.$get(`/school/${id}`) };
+                    if (arr.errcode == '0') {
+                        let params = {}
+                    } else { wx.showToast({ title: `${arr.errmsg}`, icon: 'error', duration: 2000 }) }
+
+                }
+            }
+        })
+    },
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-
+        const that = this;
+        that.setData({ id: options.id || '62ff209808c3ce998df15dd3', type: options.type || '1' })
     },
     /**
      * 生命周期函数--监听页面初次渲染完成

+ 13 - 0
pages/superAdmin/suser/bind.less

@@ -1,3 +1,16 @@
 .main {
     background-color: var(--mainColor);
+
+    .one {
+        text-align: center;
+        margin: 0 0 2vw 0;
+
+        .one_1 {
+            margin: 0 0 2vw 0;
+        }
+    }
+
+    .two {
+        text-align: center;
+    }
 }

+ 7 - 1
pages/superAdmin/suser/bind.wxml

@@ -1,5 +1,11 @@
 <mobile-main frameStyle="{{frameStyle}}" bind:back="back">
     <view slot="info" class="container main">
-        11111
+        <view class="one">
+            <view class="one_1">账号id:{{id}}</view>
+            <view class="one_1">账号类型:{{type}}</view>
+        </view>
+        <view class="two">
+            <button type="primary" bindtap="toBind">账号绑定</button>
+        </view>
     </view>
 </mobile-main>

+ 10 - 0
pages/superAdmin/suser/bind.wxss

@@ -1,3 +1,13 @@
 .main {
   background-color: var(--mainColor);
 }
+.main .one {
+  text-align: center;
+  margin: 0 0 2vw 0;
+}
+.main .one .one_1 {
+  margin: 0 0 2vw 0;
+}
+.main .two {
+  text-align: center;
+}

+ 2 - 2
utils/httpUtil.js

@@ -1,9 +1,9 @@
-let serverUrl = "https://broadcast.waityou24.cn";//http://120.48.146.1    https://broadcast.waityou24.cn
+let serverUrl = "https://broadcast.waityou24.cn";//http://120.48.146.1    https://broadcast.waityou24.cn   http://192.168.1.197:15000
 let wechatUrl = 'https://broadcast.waityou24.cn';
 
 const getDomain = (uri) => {
     if (uri.startsWith('/wechat/api')) return wechatUrl;
-    return serverUrl+'/newCourt/v2/api';
+    return serverUrl + '/newCourt/v2/api';
 }
 
 const $get = (uri, data) => {