浏览代码

[v1.1.20220315] 新增功能模組

osbert 3 年之前
父节点
当前提交
ec9871126c

+ 1 - 1
HiTeachCC.Library/HiTeachCC.Library.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>netcoreapp2.2</TargetFramework>
+    <TargetFramework>netcoreapp3.1</TargetFramework>
   </PropertyGroup>
 
 </Project>

+ 1 - 1
HiTeachCC.Model/HiTeachCC.Model.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>netcoreapp2.2</TargetFramework>
+    <TargetFramework>netcoreapp3.1</TargetFramework>
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="TEAMModelOS.SDK" Version="1.0.18" />

+ 1 - 1
HiTeachCC.Service/HiTeachCC.Service.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>netcoreapp2.2</TargetFramework>
+    <TargetFramework>netcoreapp3.1</TargetFramework>
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="PdfSharpCore" Version="1.1.21" />

+ 17 - 3
HiTeachCC/ClientApp/src/api/coreApi.js

@@ -64,7 +64,7 @@ export default {
         })
     },
     // 社群登入
-    authLogin: function(idToken, item) {
+    authLogin: function(item) {
         return new Promise((resolve, reject) => {
             let nonceStr = jsFn.getUUID()
             let data = {
@@ -74,7 +74,6 @@ export default {
                 open_code: item.open_code,
                 redirect_uri: item.redirect_uri
             }
-            if (!jsFn.isEmpty(idToken)) data.id_token = idToken
             post(apiUrl + '/oauth2/login', data).then(res => {
                 if (res.error) {
                     reject(new Error(res))
@@ -148,5 +147,20 @@ export default {
                 reject(err)
             })
         })
-    }
+    },
+    // 取得活動開放功能
+    getContact: function(idToken) {
+        return new Promise((resolve, reject) => {
+            let data = {
+                grant_type: 'get',
+                product: 'benefits',
+                id_token: idToken
+            }
+            post(apiUrl + '/oauth2/usersetting', data).then(res => {
+                resolve(res)
+            }, err => {
+                reject(err)
+            })
+        })
+    },
 }

+ 1 - 1
HiTeachCC/ClientApp/src/assets/css/style.less

@@ -123,7 +123,7 @@
         font-size: 12px;
         text-align: right;
         width:100%;
-        max-width:388px;
+        max-width:345px;
         color: #3f81ec;
         span {
           text-decoration: underline;

文件差异内容过多而无法显示
+ 2 - 2
HiTeachCC/ClientApp/src/filter/http.js


+ 13 - 11
HiTeachCC/ClientApp/src/store.js

@@ -1,5 +1,6 @@
 import Vue from 'vue'
 import Vuex from 'vuex'
+import funcs from './module/funcs'
 
 Vue.use(Vuex);
 
@@ -142,23 +143,24 @@ export default new Vuex.Store({
         isExportPDFNow:false,
         currentPage:0,
         pdfLimit:20,
-        version: 'v1.2.20220314'
+        version: 'v1.1.20220315'
     },
   mutations: {
-
-        
   },
   actions: {
     increment(context, payload) {
       context.commit('increment', payload)
     }
   },
-    userinformation: {
-        deviceId: '',
-        classNum: '',
-        TWtoken: '',
-        mqtts: '',
-        loginBack: '',
-        serviceUrl:''
-    }
+  userinformation: {
+      deviceId: '',
+      classNum: '',
+      TWtoken: '',
+      mqtts: '',
+      loginBack: '',
+      serviceUrl:''
+  },
+  modules: {
+    funcs
+  }
 })

+ 78 - 0
HiTeachCC/ClientApp/src/store/module/funcs.js

@@ -0,0 +1,78 @@
+const KEEPSTORAGE = 'KEEPSTORAGE'
+const SETUPFUNCS = 'SETUPFUNCS'
+
+export default {
+    namespaced: true,
+    state: {
+        funcs: [ // 預計以後會開放的功能 以下以最大數量為主)
+            { func: 'WORKS', para: 1, get: null, exp: null, active: false }, // 作品收集任務數
+            { func: 'CLIENTS', para: 10, get: null, exp: null, active: false }, // 連線人數 (掃碼改為50)
+            { func: 'PAGEQTY', para: 50, get: null, exp: null, active: false } // 頁面數
+        ]
+    },
+    getters: {
+        // 取得指定的功能設定
+        getFunc: (state) => (func) => {
+            return state.funcs.find(item => item.func === func)
+        }
+    },
+    mutations: {
+        [KEEPSTORAGE](state, data) {
+            let keys = Object.keys(data)
+            keys.forEach(key => {
+                state[key] = data[key]
+            })
+        },
+        [SETUPFUNCS](state, data) {
+            state.funcs = data
+        }
+    },
+    actions: {
+        /**
+         * 設定開放的功能
+         * @param {Object} data 
+         */
+        setupFuncs(context, data) {
+            return new Promise((resolve) => {
+                var nowTime = new Date()
+                let nT = parseInt(Date.parse(nowTime)/1000) // 用十碼計算                
+                data.forEach( item => {                    
+                    let active = false
+                    let exp = item.exp
+
+                    // 如果超過10碼調整為10碼
+                    if(!!item.exp && item.exp.toString().length > 10 ) {
+                        exp = parseInt(exp/1000)
+                    }
+
+                    if(!!item.exp && (exp - nT) > 0) {
+                        active = true
+                    }
+
+                    item.active = active
+                })
+                context.commit(SETUPFUNCS, data)
+                context.dispatch('saveState') // 存到sessionStorage
+                resolve(true)
+            })
+        },
+        /** 
+         * NOTE: 維持 vuex state 的資訊
+        */
+         keepState(context) {
+            if(!jsFn.IsEmpty(sessionStorage.getItem('funcsData'))) {
+                let data = JSON.parse(decodeURIComponent(sessionStorage.getItem('funcsData'),'utf-8'))
+                context.commit(KEEPSTORAGE, data)
+            }
+        },
+        /** 
+        * NOTE: 儲存現在 state 的資訊
+        */
+        saveState(context) {
+            let saveData = {
+                funcs: context.state.funcs
+            }
+            sessionStorage.setItem('funcsData', encodeURIComponent(JSON.stringify(saveData), 'utf-8'))
+        }
+    }
+}

文件差异内容过多而无法显示
+ 37 - 4
HiTeachCC/ClientApp/src/views/Login.vue