11wqe1 hai 2 meses
pai
achega
bde9318516

+ 45 - 40
src/components/sidebarL.vue

@@ -66,13 +66,13 @@
                                         <span v-if="cocoFlowList[0] && cocoFlowList[0].length" style="color: #00000066;">最近使用</span>
                                         <div class="ulTCopyTxt"  
                                         v-for="(i,ind) in cocoFlowList[0]" 
-                                        @click.stop="openNewWindow(i.url)" :key="ind+'ab'">
+                                        @click.stop="openNewWindow(i)" :key="ind+'ab'">
                                                 <div class="ulTCopyConT">{{ i.name }}</div>
                                         </div>
                                         <span v-if="cocoFlowList[0] && cocoFlowList[1].length" style="color: #00000066;">我的收藏</span>
 
                                         <div class="ulTCopyTxt"
-                                        v-for="(i,ind) in cocoFlowList[1]" @click.stop="openNewWindow(i.url)" :key="ind+'a'">
+                                        v-for="(i,ind) in cocoFlowList[1]" @click.stop="openNewWindow(i)" :key="ind+'a'">
                                                 <div class="ulTCopyConT">{{ i.name }}</div>
                                         </div>
                                     </div>
@@ -87,12 +87,12 @@
 
 <script>
 import { mapGetters, mapActions } from 'vuex';
-
 import store from '../store'
 import { API_CONFIG } from "@/common/apiConfig";
+import { myMixin } from "@/mixins/mixin.js"
 
     export default {
-        props:['urlAddress'],
+        mixins: [ myMixin ],
         computed: {
             ...mapGetters(['userinfo','userinfo2','fromL','appSign']),
             // 如果hk,com没有图标,默认使用cn的
@@ -169,10 +169,9 @@ import { API_CONFIG } from "@/common/apiConfig";
                 });
             },
             mouGet(val){
-                console.log('val',val);
                 
                 if(!val.includes('appStore')) return
-                console.log('666')
+                // console.log('val',val);
                 this.getData()
             },
             // 点击一级导航
@@ -187,7 +186,6 @@ import { API_CONFIG } from "@/common/apiConfig";
                 }else{
                     // 点击首页清空内容,并把标识去除
                     await store.commit('user/SET_AppSIGN', '')
-                    this.$emit('update:urlAddress','')
 
                     this.$emit('getPer')
                     this.activeL = index
@@ -196,28 +194,28 @@ import { API_CONFIG } from "@/common/apiConfig";
            
 
 
-                    // 点击相同应用不刷新  
-                    if (this.appSign == val.toolId) return
+                // 点击相同应用不刷新  
+                if (this.appSign == val.toolId) return
 
-                    // 更新标识
-                    await store.commit('user/SET_AppSIGN', val.toolId)
+                // 更新标识
+                await store.commit('user/SET_AppSIGN', val.toolId)
 
-                    let url = ''
+                let url = ''
 
-                    // 查出对应账号的应用区域地址
-                    val.url.forEach(e => {
-                         // if (e.region == this.roleUser.schoolArea || e.region == this.roleUser.orgArea) {
-                        if (e.region == this.$region) {
-                            url = e.url
-                        }
-                    });
-                    
-                    let _userinfo = this.roleUser, //登录用户信息
-                    { userid: _userid, organizeid: _oid, type: _type, org: _org, role: _role, classid: _classId } = _userinfo; // 解构赋值获取用户信息
-                    const _TscreenType = 1, _SscreenType = 3; // 常量定义
-                    let queryString = ''
-                    if(val.argumentList && val.argumentList.length){
-                        const paramsMap = {
+                // 查出对应账号的应用区域地址
+                val.url.forEach(e => {
+                        // if (e.region == this.roleUser.schoolArea || e.region == this.roleUser.orgArea) {
+                    if (e.region == this.$region) {
+                        url = e.url
+                    }
+                });
+                
+                let _userinfo = this.roleUser, //登录用户信息
+                { userid: _userid, organizeid: _oid, type: _type, org: _org, role: _role, classid: _classId } = _userinfo; // 解构赋值获取用户信息
+                const _TscreenType = 1, _SscreenType = 3; // 常量定义
+                let queryString = ''
+                if(val.argumentList && val.argumentList.length){
+                    const paramsMap = {
                         userid: _userid,
                         org: _org,
                         oid: _oid,
@@ -226,17 +224,17 @@ import { API_CONFIG } from "@/common/apiConfig";
                         classId: _classId,
                         TscreenType: _TscreenType,
                         SscreenType: _SscreenType
-                        };
+                    };
 
-                        const canshu = val.argumentList
-                    .filter(param => paramsMap[param] !== undefined || param === 'type')
-                    .map(param => param === 'type' ? `tType=${paramsMap['tType']}` : `${param}=${paramsMap[param]}`);
+                    const canshu = val.argumentList
+                .filter(param => paramsMap[param] !== undefined || param === 'type')
+                .map(param => param === 'type' ? `tType=${paramsMap['tType']}` : `${param}=${paramsMap[param]}`);
 
-                        queryString = canshu.length ? (url.includes('?') ? '&' : '?') + canshu.join('&') : ''; // 生成查询字符串
-                    }
+                    queryString = canshu.length ? (url.includes('?') ? '&' : '?') + canshu.join('&') : ''; // 生成查询字符串
+                }
 
-                    let _url = url + queryString
-                    console.log('_url',_url);
+                let _url = url + queryString
+                console.log('_url',_url);
                     
 
                     // let kpl = ` <iframe 
@@ -249,14 +247,17 @@ import { API_CONFIG } from "@/common/apiConfig";
                     //                 >
                     //             </iframe>`
 
-                    let pl = {json:_url ,stateL :true,toolId :val.toolId}
+                let pl = {json:_url ,stateL :true,toolId :val.toolId}
+
+                // 添加打开应用
+                this.$emit('AddAppJson',pl)
+
+                this.addOp3('1', "", { type:this.prefixL + val.toolId + "_open" }, "success")
 
-                    // 添加打开应用
-                    this.$emit('AddAppJson',pl)
             },
             
             // 获取cocoFlow收藏与历史使用记录
-            getData(){
+            getData(){                
                 let params = [
                     {
                         functionName: API_CONFIG.ajax_appStoreSave.functionName,
@@ -276,7 +277,7 @@ import { API_CONFIG } from "@/common/apiConfig";
             },
             // 点击二级导航
             async levTwo(val,index,aInd){     
-                console.log('val,index,aInd',val,index,aInd);
+                // console.log('val,index,aInd',val,index,aInd);
                 
                 
                 this.activeL = ''
@@ -335,13 +336,17 @@ import { API_CONFIG } from "@/common/apiConfig";
 
                 let pl = {json:_url ,stateL :true,toolId :val.toolId}
 
+                this.addOp3('1', "", { type:this.prefixL + val.toolId + "_open" }, "success")
+
                 this.$emit('AddAppJson',pl)
             },
+            // 打开ai应用
             openNewWindow(val) {
                 console.log(val);
+                this.addOp3('1', "", {id :val.id,name:val.name ,type:this.prefixL + "appstoreOpen" }, "success")
                 
                 // // 基本用法:打开指定 URL
-                window.open(val, "_blank");
+                window.open(val.url, "_blank");
             },
         },
        

+ 9 - 2
src/components/topPage.vue

@@ -215,8 +215,11 @@
 import { mapGetters } from 'vuex';
 import store from '../store'
 import { API_CONFIG } from "@/common/apiConfig";
+import { myMixin } from "@/mixins/mixin.js"
 
     export default {
+        mixins: [ myMixin ],
+
         computed: {
             ...mapGetters(['userinfo','userinfo2','fromL']),
             // banner循环图
@@ -300,7 +303,7 @@ import { API_CONFIG } from "@/common/apiConfig";
             setHovered(index, value) {
                 this.tabList[index].hovered = value;
             },
-            // 获取已添加cocoFlow应用
+            // 获取cocoFlow2应用
             getData(){
                 let cocoFlowCopy = []
                 if (this.fromL.admin.cocoFlow2 && this.fromL.admin.cocoFlow2.length) {
@@ -362,6 +365,7 @@ import { API_CONFIG } from "@/common/apiConfig";
                 // console.log('this.tabList',this.tabList);
 
             },
+            // 获取cocoFlow应用
             getAdmincocoFlow(){
                 // 筛选可用平台工具,判断是否管理员可见,去除已删除工具
                 this.siftCoco()
@@ -469,6 +473,8 @@ import { API_CONFIG } from "@/common/apiConfig";
                 // this.$emit('AddAppJson',pl)
                 
                 this.$emit('cutUrl',pl)
+
+                this.addOp3('1', "", { type:this.prefixL + val.toolId + "_open" }, "success")
         
                 // document.querySelector('#pageCon').innerHTML = '';
                 
@@ -479,7 +485,8 @@ import { API_CONFIG } from "@/common/apiConfig";
             // 打开CocoFlow应用
             openNewWindow(val) {
                 console.log(val);
-                
+                this.addOp3('1', "", {id :val.id,name:val.name ,type:this.prefixL + "appstoreOpen" }, "success")
+
                 // // 基本用法:打开指定 URL
                 window.open(val.url, "_blank");
             },

+ 90 - 0
src/mixins/mixin.js

@@ -0,0 +1,90 @@
+import { mapGetters } from 'vuex';
+
+export const myMixin = {
+  computed: {
+    ...mapGetters(['userinfo']),
+  },
+  data() {
+    return {
+        // userJson: this.userinfo,
+        prefixL: window.location.href.includes("/liyuan") ? "liyuan_" : "admin_"
+    };
+  },
+  methods: {
+    detectBrowser() {
+      const ua = navigator.userAgent;
+
+      // 按优先级顺序检测
+      if (ua.includes("Edg/") || ua.includes("Edge/")) {
+        return "Microsoft Edge";
+      } else if (ua.includes("Firefox")) {
+        return "Mozilla Firefox";
+      } else if (ua.includes("Trident") || ua.includes("MSIE")) {
+        return "Internet Explorer";
+      } else if (ua.includes("360EE")) {
+        return "360 Browser (极速模式)";
+      } else if (ua.includes("360SE")) {
+        return "360 Browser (安全模式)";
+      } else if (ua.includes("SLBrowser")) {
+        return "QQ Browser";
+      } else if (ua.includes("UCBrowser")) {
+        return "UC Browser";
+      } else if (ua.includes("Opera") || ua.includes("OPR/")) {
+        return "Opera";
+      } else if (ua.includes("Chrome") && !ua.includes("Edg/")) {
+        return "Google Chrome";
+      } else if (ua.includes("Safari/") && !ua.includes("Chrome")) {
+        return "Safari";
+      } else {
+        return "Other Browser";
+      }
+    },
+    async addOp3(userTime, loadTime, object, status) {
+      
+      try {
+        if(!this.userinfo || !this.userinfo.accountNumber){
+            let res = await this.ajax.get(this.$store.state.api + "selectUser", {
+            userid: this.$route.query.userid
+            });
+            this.userinfo = res.data[0][0]
+        }
+      } catch (e) {
+        console.log(e);
+        this.addOp3(userTime, loadTime, object, status);
+      }
+      let _time = new Date()
+        .toLocaleString("zh-CN", { hour12: false, timeZone: "Asia/Shanghai" })
+        .replace(/\//g, "-");
+      let browser = this.detectBrowser();
+
+      let params = {
+        userid: this.userinfo.userid,
+        username: this.userinfo.username,
+        accountNumber: this.userinfo.accountNumber,
+        org: this.userinfo.orgName,
+        school: this.userinfo.schoolName,
+        browser: browser,
+        userTime: userTime == "1" ? _time : userTime, // 使用时间 1次的就1 其次传秒
+        loadTime: loadTime, //load的时间没有就“”
+        object: JSON.stringify(object), //执行信息传json
+        status: status //成功返回success。失败返回error的信息
+      };
+      console.log('params',params);
+      
+
+      this.$ajax
+        .post('https://pbl.cocorobo.cn/api/mongo/' + "updateUserData2", [params])
+        .then(res => {
+          if (res.data.status == 1) {
+            console.log("保存成功");
+          } else {
+            console.log("保存失败");
+          }
+        })
+        .catch(e => {
+          console.log("保存失败");
+          console.log(e);
+        });
+    }
+  }
+};

+ 2 - 4
src/views/HomeView.vue

@@ -5,7 +5,6 @@
 				<sidebarL
 					@getPer="getPer"
 					@AddAppJson="AddAppJson"
-					:urlAddress.sync="urlAddress"
 					ref="sidebarLRef"
 				></sidebarL>
 			</div>
@@ -54,11 +53,10 @@
 						</div>
 					</div>
 				</div>
-				<!-- <router-view></router-view> -->
+
 				<!-- 首页 -->
 				<homepageL
 					@AddAppJson="AddAppJson"
-					:urlAddress.sync="urlAddress"
 					v-show="!appSign"
 					ref="homepageLRef"
 				></homepageL>
@@ -124,7 +122,7 @@ export default {
 	},
 	data() {
 		return {
-			urlAddress: "",
+
 			AppJSon: [],
 			loading: false,
 		};

+ 0 - 1
src/views/homepageL.vue

@@ -14,7 +14,6 @@ import { mapGetters } from 'vuex';
 import { API_CONFIG } from "@/common/apiConfig";
 
     export default {
-        props:['urlAddress'],
         computed: {
             ...mapGetters(['userinfo','userinfo2']),
             roleUser(){

+ 8 - 0
src/views/login/loginPage.vue

@@ -135,8 +135,10 @@ import { API_CONFIG } from "@/common/apiConfig";
 import "@/common/wxLogin";
 import { getUser } from "@/api/user";
 import { loginOut } from "@/api/user";
+import { myMixin } from "@/mixins/mixin.js"
 
 export default {
+	mixins: [ myMixin ],
 	name: "loginPage",
 	data() {
 		return {
@@ -284,6 +286,7 @@ export default {
 						console.log("userjson", userjson);
 						if (_data.active === 1) {
 							window.localStorage["identity"] = JSON.stringify(_data.identity);
+							this.addOp3('1', "", { type:this.prefixL + "login" }, "success")
 							this.$message.success("登录成功");
 							await this.login();
 							if (
@@ -296,6 +299,7 @@ export default {
 								this.$router.push({ path: this.redirect || "/" });
 							}
 						} else {
+							this.addOp3('1', "", { type:this.prefixL + "login" }, '登录失败')
 							this.$message.error("登录失败");
 						}
 						this.loading = false;
@@ -306,6 +310,7 @@ export default {
 						} else {
 							this.$message.error("登录失败");
 						}
+						this.addOp3('1', "", { type:this.prefixL + "login" }, e)
 						this.loading = false;
 					});
 			} else if (this.loginType == "bind") {
@@ -557,6 +562,7 @@ export default {
 					console.log("userjson", userjson);
 					if (_data.active === 1) {
 						window.localStorage["identity"] = JSON.stringify(_data.identity);
+						this.addOp3('1', "", { type:this.prefixL + "login" }, "success")
 						this.$message.success("登录成功");
 						await this.login();
 						if (
@@ -569,6 +575,8 @@ export default {
 							this.$router.push({ path: this.redirect || "/" });
 						}
 					} else {
+						this.addOp3('1', "", { type:this.prefixL + "login" }, '登录失败')
+
 						this.$message.error("登录失败");
 					}