| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010 |
- <template>
- <div>
- <div style="-webkit-app-region: drag;height:45px;line-height: 45px;">
- <div class="soft-head">
- <p class="soft-name" style="-webkit-app-region: drag;">
- <img src="../assets/image/icon.png" class="soft-icon" />
- <span style="letter-spacing: 2px;">{{productName}}</span>
- </p>
- <div style="-webkit-app-region:no-drag">
- <div>
- <template v-if="authority.validity_type != 2">
- <span v-if="authority.isAuthority" class="o-member twinkle_text" @click="openVip()">
- <img src="../assets/image/i-vip.png" />
- <span>会员中心</span>
- </span>
- <span v-else class="o-member twinkle_text" @click="openVip()">
- <img src="../assets/image/i-vip.png" />
- <span>开通会员</span>
- </span>
- </template>
-
- <div class="login-cur" v-if="!userInfo.username" @click="loginModel = true">
- <el-avatar icon="el-icon-user-solid" size="small" class="login-icon"></el-avatar><span class="font-12">未登录</span>
- </div>
- <div class="login-cur" v-else>
- <img v-if="userInfo.avatar" :src="userInfo.avatar" class="login-icon" />
- <el-avatar v-else icon="el-icon-user-solid" size="small" class="login-icon"></el-avatar>
- <span v-if="userInfo.username">{{userInfo.username}}</span>
- <span v-else>微信用户</span>
- <img src="../assets/image/vip.png" v-if="authority.isAuthority" style="width: 25px;vertical-align: middle;"/>
- </div>
- <el-dropdown @command="changeMenu">
- <i class="el-icon-s-operation sys-icon" title="菜单"></i>
- <el-dropdown-menu slot="dropdown">
- <el-dropdown-item command="vip">{{authority.isAuthority ? '会员中心' : '开通会员'}}</el-dropdown-item>
- <el-dropdown-item command="update">检查更新</el-dropdown-item>
- <el-dropdown-item command="help"><a href="https://www.xingyousoft.com/help2" style="color: inherit;">使用教程</a></el-dropdown-item>
- <el-dropdown-item command="setting">软件设置</el-dropdown-item>
- <el-dropdown-item command="developer">开发者模式</el-dropdown-item>
- <el-dropdown-item command="out" v-if="userInfo.username || userInfo.avatar">退出登录</el-dropdown-item>
- </el-dropdown-menu>
- </el-dropdown>
- <i class="el-icon-minus sys-icon" @click="softMini()"></i>
- <i class="el-icon-full-screen sys-icon" @click="softMax()"></i>
- <i class="el-icon-close sys-icon" @click="softClose()"></i>
- </div>
- </div>
- </div>
- </div>
-
- <!-- 登录 -->
- <el-dialog title="用户注册登录" :visible.sync="loginModel" width="400px" :close-on-click-modal="false">
- <div class="login-model" style="position: relative;">
- <iframe v-if="loginModel" id="loginFrame" ref="loginFrame" style="border: none; width: 100%; height:100%;" :src="loginUrl"></iframe>
- <img src="../assets/image/icon-b.png" style="position: absolute; bottom: -30px; right: -20px; width: 40px;"/>
- </div>
- <span slot="title">
- <img src="../assets/image/logo.png" style="width: 25px; vertical-align: middle; margin-right: 4px;"/>注册用户登录
- </span>
- </el-dialog>
-
- <!-- 会员弹窗 -->
- <el-dialog custom-class="member-dialog member-dialog1" :visible.sync="vipModel" width="700px" :close-on-click-modal="false">
- <div slot="title">
- <p class="soft-mtitle">
- <img src="../assets/image/icon.png" class="soft-icon" />
- {{productName}}
- </p>
- </div>
- <div style="height: 580px;">
- <iframe v-if="vipModel" id="vipFrame" style="border: none; width: 100%; height:100%;" :src="vipUrl"></iframe>
- </div>
- </el-dialog>
-
- <!-- 未登录弹窗 -->
- <el-dialog :visible.sync="memberModel" width="400px" custom-class="member-dialog member-dialog2" style="border-radius: 20px; overflow: hidden;">
- <div class="member-model">
- <div class="adv-banner" v-if="popupAdvInfo.logo">
- <img :src="imgUrl + popupAdvInfo.logo" style="width: 100%; height: 100%;"/>
- </div>
- <div class="font-12" style="padding: 20px; margin-bottom: 10px;">
- <div style="text-align: center; margin-bottom: 10px;">
- <p style="font-size: 16px;font-weight: 600;color: #f73131;">非VIP可免费解析,下载视频需开通VIP使用</p>
- <p style="font-size: 14px; font-weight: 600; margin-top: 15px;">开通会员即享以下权益</p>
- </div>
- <el-row :gutter="20" class="micon-list">
- <el-col :span="6" class="micon-item">
- <img src="../assets/image/member1.png" style="width: 60px;"/>
- <p>不限功能</p>
- </el-col>
- <el-col :span="6" class="micon-item">
- <img src="../assets/image/member2.png" style="width: 60px;"/>
- <p>不限设备</p>
- </el-col>
- <el-col :span="6" class="micon-item">
- <img src="../assets/image/member3.png" style="width: 60px;"/>
- <p>免费升级</p>
- </el-col>
- <el-col :span="6" class="micon-item">
- <img src="../assets/image/member4.png" style="width: 60px;"/>
- <p>技术支持</p>
- </el-col>
- </el-row>
- </div>
- <div class="micon-btn">
- <el-button class="micon-btn1" style="margin:0 10px;" v-if="!isClick" @click="next()" :round="true">开始试用</el-button>
- <el-button class="micon-btn1" style="margin:0 10px;" v-else @click="next()" :round="true">开始下载</el-button>
- <el-button class="micon-btn2" type="primary" @click="openVip()" :round="true">开通会员</el-button>
- </div>
- </div>
- </el-dialog>
- <!-- 退出提示 -->
- <el-dialog title="关闭提示" :visible.sync="closeModel" width="400px">
- <div style="text-align:center">
- <el-radio-group v-model="closeType" style="text-align:left">
- <el-radio :label="1">最小化到系统托盘</el-radio>
- <div style="height: 20px;"> </div>
- <el-radio :label="2">直接退出应用程序</el-radio>
- </el-radio-group>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-checkbox v-model="isRemember" style="float:left">不再提醒</el-checkbox>
- <el-button type="primary" size="small" @click="saveClose">确定</el-button>
- </span>
- </el-dialog>
-
- <!-- 软件设置 -->
- <el-dialog title="软件设置" :visible.sync="settingModal" width="400px" :close-on-click-modal="false">
- <div>
- <el-divider content-position="left">
- 账号登录
- <el-popover placement="bottom" popper-class="popper-open" trigger="hover" content="账号登录完成后请关闭浏览器使用">
- <i class="el-icon-info" slot="reference" style="margin-left: 10px; color: #F56C6C;"></i>
- </el-popover>
- </el-divider>
- <el-row type="flex" justify="space-around">
- <el-button size="mini" @click="toLogin('alibaba')" :loading="alibabaLoading">阿里巴巴</el-button>
- <el-button size="mini" @click="toLogin('jd')" :loading="jdLoading">京东</el-button>
- <el-button size="mini" @click="toLogin('tb')" :loading="tbLoading">天猫/淘宝</el-button>
- <el-button size="mini" @click="toLogin('red')" :loading="redLoading">小红书</el-button>
- </el-row>
- <el-divider content-position="left">
- 浏览器启动地址
- <el-popover placement="bottom" popper-class="popper-open" trigger="hover" content="仅支持谷歌浏览器/和基于Chromium的Microsoft Edge浏览器">
- <i class="el-icon-info" slot="reference" style="margin-left: 10px; color: #F56C6C;"></i>
- </el-popover>
- </el-divider>
- <!-- <el-row style="text-align: center;">
- <el-radio-group v-model="chromeType">
- <el-radio :label="1">本地电脑浏览器</el-radio>
- <el-radio :label="2">软件内置浏览器</el-radio>
- </el-radio-group>
- </el-row> -->
- <el-row style="text-align: center; margin-top: 10px;">
- <el-input size="small" v-model="chromePath" placeholder="请输入本地Chrome/Edge浏览器启动地址" clearable></el-input>
- <div>
- <el-link @click="chromeHelp('https://www.xingyousoft.com/news/detail/Z80IPpNVNNC1')" type="danger" style="text-decoration: underline; font-size: 12px;" :underline="false">查看如何输入地址</el-link>
- </div>
- </el-row>
- <!-- <el-divider content-position="left">
- 内置浏览器版本
- <el-popover placement="bottom" popper-class="popper-open" trigger="hover" content="win10以下版本(不含win10),请使用兼容版本的浏览器">
- <i class="el-icon-info" slot="reference" style="margin-left: 10px; color: #F56C6C;"></i>
- </el-popover>
- </el-divider>
- <el-row style="text-align: center;">
- <el-radio-group v-model="versionType">
- <el-radio :label="1">兼容版本</el-radio>
- <el-radio :label="2">最新版本</el-radio>
- </el-radio-group>
- </el-row> -->
- <el-divider content-position="left">
- 分页间隔时间
- <el-popover placement="bottom" popper-class="popper-open" trigger="hover" content="默认为5秒,加大下载间隔时间减少访问频率,降低风控风险">
- <i class="el-icon-info" slot="reference" style="margin-left: 10px; color: #F56C6C;"></i>
- </el-popover>
- </el-divider>
- <el-row style="text-align: center;">
- <el-input-number v-model="gap" :min="1" :max="60" label="间隔时间" size="mini" style="margin-right: 5px;"></el-input-number>秒
- </el-row>
- <el-divider content-position="left">清理缓存</el-divider>
- <el-row style="text-align: center;">
- <el-button size="small" type="primary" @click="clearCache()" :loading="cacheLoading">点击清除软件缓存</el-button>
- </el-row>
- <el-divider content-position="left">退出设置</el-divider>
- <el-row style="text-align: center;">
- <el-radio-group v-model="closeType">
- <el-radio :label="1">最小化到系统托盘</el-radio>
- <el-radio :label="2">直接退出应用程序</el-radio>
- </el-radio-group>
- </el-row>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button type="primary" @click="saveSetting" :loading="saveLoading">保存设置</el-button>
- </span>
- </el-dialog>
-
- <!-- 开发者模式 -->
- <el-dialog title="开发者模式" :visible.sync="developerModal" width="400px" :close-on-click-modal="false" :close-on-press-escape="false">
- <div>
- <p style="text-align: center; color: #F56C6C;">开发者参数设置,软件退出后会重置</p>
- <p style="text-align: center; color: #F56C6C;">(网络连接:networkidle2)</p>
- <el-divider content-position="left">网络连接</el-divider>
- <el-row style="text-align: center;">
- <el-radio-group v-model="waitUntil">
- <el-radio style="margin-bottom: 20px;" label="load">load</el-radio>
- <el-radio style="margin-bottom: 20px;" label="domcontentloaded">domcontentloaded</el-radio>
- <el-radio style="margin-bottom: 20px;" label="networkidle0">networkidle0</el-radio>
- <el-radio style="margin-bottom: 20px;" label="networkidle2">networkidle2</el-radio>
- </el-radio-group>
- </el-row>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button type="primary" @click="saveDevelop" :loading="saveDevelopLoading">保存设置</el-button>
- </span>
- </el-dialog>
-
- <!-- 通知 -->
- <el-dialog title="软件通知" :visible.sync="noticeModel" width="400px">
- <div style="padding-left: 20px; line-height: 1.8;" v-html="noticeValue.desc">
- </div>
- <span slot="footer" class="dialog-footer">
- <el-checkbox v-model="isRead" style="float:left">我已知晓,7天内不再提醒</el-checkbox>
- <el-button type="primary" size="small" @click="readClose">确定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- ipcRenderer
- } from 'electron';
- import QRCode from 'qrcodejs2'
- import pjson from '/package.json'
- import electronApi from '@/utils/electronApi';
- import fs from 'fs';
- import os from 'os';
- import path from 'path';
- const regedit = require('regedit');
- export default {
- name: "headerTop",
- data(){
- return {
- edgePath: ['C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe',
- 'C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe',
- 'C:\\Program Files\\Microsoft\\Edge\\msedge.exe'],
- sysInfo: {},
- vipUrl: '',
- loginUrl: '',
- memberUrl: '',
- settingModal: false,
- boot: false, // 开机启动
- closeModel: false,
- closeType: 2,
- numType: 1,
- isRemember:true,
- versionType: 2,
- chromeType: 2,
- chromePath: '',
- gap: 5,
- pageMs: 600,
- //
- productName: pjson.softInfo.softName,
- imgUrl: this.$api.imgUrl,
- loginType: 1,
- loginModel: false, // 登录弹窗
- loginImg: '',
- loginExpire: 100,
- loginInterval: false, // 登录倒计时
- checkLoginInterval: false,
- isLogin: false,
- userInfo: {},
- authority: { //软件的会员权限
- isAuthority: false
- },
- memberModel: false,
- isClick: false, // 是否点击转换按钮
-
- vipModel: false, // 会员弹窗
- productInfo: {},
- productIndex: 4,
-
- payType: 1, // 支付方式 1微信 2支付宝
- checkPayInterval: false,
- order_no: '', //创建的订单号
- alipayUrl: '', // 支付宝
- payMoney: 0,
- clickVip: false,
-
- popupAdvInfo: [],
- vipAdvInfo: [],
- agreementInfo: [], // 会员协议
-
- agreeFlag: true,
- agreementModel: false,
- alipayDoc: '',
-
- limitModal: false, // 限时购买弹窗
- limitLogin: false, // 限时购买时的登录状态
-
- alibabaLoading: false,
- jdLoading: false,
- tbLoading: false,
- redLoading: false,
- cacheLoading: false,
- saveLoading: false,
-
- saveDevelopLoading: false,
- developerModal: false,
- headless: 1,
- waitUntil: 'networkidle2',
-
- isRead: false,
- noticeValue: {},
- noticeModel: false,
- }
- },
- props: {
-
- },
- async mounted(){
- this.getAdv();
- this.checkLogin();
-
- if(this.$utils.getStorage('userInfo')){
- this.userInfo = this.$utils.getStorage('userInfo');
- }
-
- if(!this.$utils.getStorage('chromeType')){
- for(let i = 0; i<this.edgePath.length; i++){
- if (fs.existsSync(this.edgePath[i])) {
- this.$utils.setStorage('chromeType', 1);
- this.$utils.setStorage('chromePath', this.edgePath[i]);
- break;
- }
- }
- }
-
- window.addEventListener('message', e => {
- if (e.origin === 'https://www.xingyousoft.com') {
- if(e.data.userInfo){ // 返回用户信息
- this.userInfo = e.data.userInfo;
- this.$utils.setStorage('userInfo', e.data.userInfo);
- this.loginModel = false;
- }
- if(e.data.officialToken != undefined){
- this.$utils.setStorage('token', e.data.officialToken);
- this.getUserInfo();
- this.loginModel = false;
- }
- if(e.data == 'paySuccess'){ // 支付成功
- this.vipModel = false;
- this.$notify({title: '成功',message: '支付成功',type: 'success'});
- this.getUserInfo();
- }
- if(e.data == 'next'){
- this.next();
- }
- if(e.data == 'openVip'){
- this.openVip();
- }
- }else{
- return;
- }
- }, false);
- //加载的时候会出现白屏,延迟加载解决白屏问题
- setTimeout(() => {
- ipcRenderer.send('close-loading-window', {isClose:true});
- }, 2000);
-
- // 判断是否设置开机启动
- await electronApi.call('getLoginItem').then((res)=>{
- if(res.openAtLogin){
- this.boot = true;
- }else{
- this.boot = false;
- }
- });
- if(fs.existsSync(path.join(os.tmpdir() , '../../Roaming/Microsoft/Windows/Start Menu/Programs/Startup/'+pjson.softInfo.softName+'.lnk'))){
- this.boot = true;
- }
-
- // 接收系统托盘命令 - 软件设置
- ipcRenderer.on('setting', (event, message) => {
- this.changeMenu('setting');
- })
- // 接收系统托盘命令 - 帮助中心
- ipcRenderer.on('help', (event, message) => {
- electronApi.openExternal("https://www.xingyousoft.com/help2");
- })
- },
- methods: {
- // 打开浏览器
- chromeHelp(url){
- // 打开浏览器
- const {
- shell
- } = require('electron');
- shell.openExternal(url);
- },
- // 清空缓存
- clearCache(){
- this.$confirm('此操作将清除软件缓存, 后续账号需要重新登录,是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- this.cacheLoading = true;
- let closeFlag = true;
- setTimeout(() => {
- let path1 = os.tmpdir() + '\\' + 'chrome-data-capture';
- let path2 = os.tmpdir() + '\\' + 'chrome-data-capture-jd';
- let path3 = os.tmpdir() + '\\' + 'chrome-data-capture-local';
- try{
- this.deleteFolder(path1, false);
- this.deleteFolder(path2, false);
- this.deleteFolder(path3, false);
- }catch(e){
- this.cacheLoading = false;
- if(e.toString().indexOf('operation not permitted') > -1){
- this.$notify.error({
- title: '提示',
- message: '请关闭浏览器后在执行清除缓存操作!'
- });
- closeFlag = false;
- return false;
- }
- }
-
- if(closeFlag){
- setTimeout(() => {
- this.$message({message: '缓存清除成功!', type: 'success'});
- this.$emit('clear-cache', true);
- this.cacheLoading = false;
- }, 2000);
- }
-
- }, 500);
- }).catch(() => {
-
- });
- },
- // 删除文件夹内容
- deleteFolder(folderPath, flag) {
- if (fs.existsSync(folderPath)) {
- fs.readdirSync(folderPath).forEach((file, index) => {
- var curPath = path.join(folderPath, file);
- if (fs.lstatSync(curPath).isDirectory()) {
- this.deleteFolder(curPath, true);
- } else {
- fs.unlinkSync(curPath);
- }
- });
- if(flag){
- fs.rmdirSync(folderPath);
- }
- }
- },
- // 点击去登录
- toLogin(type){
- let url = '';
- if(type == 'alibaba'){
- url = 'https://www.1688.com';
- }else if(type == 'jd'){
- url = 'https://www.jd.com';
- }else if(type == 'tb'){
- url = 'https://login.taobao.com';
- }else if(type == 'red'){
- url = 'https://www.xiaohongshu.com';
- }
- this[type + 'Loading'] = true;
- setTimeout(() => {
- this[type + 'Loading'] = false;
- }, 2000)
- this.$emit('login-url', url);
- },
- softMini() { // 软件最小化
- ipcRenderer.send('min');
- },
- softMax() { // 软件最大化
- ipcRenderer.send('max');
- },
- softClose() { // 软件关闭
- let isRemember = this.$utils.getStorage('isRemember');
- if(isRemember == true){
- let type = this.$utils.getStorage('closeType');
- if(type == 2){
- ipcRenderer.send('exit');
- }else{
- ipcRenderer.send('tray');
- }
- }else{
- this.closeModel = true;
- }
- },
- saveClose(){
- if(this.isRemember == true){
- this.$utils.setStorage('closeType',this.closeType);
- }
- this.$utils.setStorage('isRemember', this.isRemember);
- if(this.closeType == 2){
- ipcRenderer.send('exit');
- }else{
- this.closeModel = false;
- ipcRenderer.send('tray');
- }
-
- },
- readClose(){
- if(this.isRead == true){
- this.$utils.setStorage('isRead', {token: true, expire: 60*60*24*7});
- }else{
- this.$utils.setStorage('isRead', false);
- }
- this.noticeModel = false;
- },
- // 保存设置
- saveSetting(){
- this.saveLoading = true;
- if(this.chromeType == 1){ // 用户选择电脑本地的浏览器使用
- let chromePath = this.chromePath.replace(/^["']|["']$/g, '');
- if(!chromePath.endsWith('.exe') || /[\u4e00-\u9fff]/.test(chromePath)){ //判断文件路径结尾而且不包含中文
- this.$notify({
- title: '提示',
- message: '浏览器启动地址不能含有中文且必须以".exe"结尾,请核对后重新输入',
- type: 'warning'
- });
- this.saveLoading = false;
- return false;
- }
- this.chromePath = chromePath;
- this.$utils.setStorage('chromePath', this.chromePath);
- this.setPublic();
- }else{ //用户选择内置浏览器使用校验
- let systemVersion = 10;
- if(os.release() && os.release().indexOf('.')){
- systemVersion = Number(os.release().split('.')[0]);
- }
- if(systemVersion < 10 && this.versionType == 2){ // win10以下版本,而且选择了最新版本时提示
- this.$confirm("检测到当前Windows系统不兼容最新版浏览器,是否继续选择最新版?", '提示', {
- type: 'warning'
- }).then(() => {
- this.setPublic();
- }).catch(() => {
- this.saveLoading = false;
- });
- }else{
- this.setPublic();
- }
- }
- },
- // 保存设置公共代码部分
- setPublic(){
- this.$utils.setStorage('closeType', this.closeType);
- this.$utils.setStorage('pageMs', this.pageMs);
- this.$utils.setStorage('gap', this.gap);
- this.$utils.setStorage('versionType', this.versionType);
- this.$utils.setStorage('isRemember', true);
- this.$utils.setStorage('chromeType', this.chromeType);
- ipcRenderer.send('boot', this.boot);
- setTimeout(() => {
- this.saveLoading = false;
- this.settingModal = false;
- }, 800)
- },
- // 保存开发者设置
- saveDevelop(){
- this.saveDevelopLoading = true;
- this.$utils.setStorage('headless', this.headless);
- this.$utils.setStorage('waitUntil', this.waitUntil);
- setTimeout(() => {
- this.saveDevelopLoading = false;
- this.developerModal = false;
- }, 800)
- },
- //
- getAdv() {
- // 非会员广告接口
- this.$http.post(this.$api.target + '/api/api/m_position_list_byid', { id: pjson.softInfo.popupAdvId }).then((response) => {
- if (!response.data.error) {
- this.popupAdvInfo = response.data.result;
- }
- })
-
- electronApi.spawnExec(['cert.exe','token']).then(res => {
- this.sysInfo = JSON.parse(res.stdout.toString());
- this.$utils.setStorage('session', this.sysInfo.windows_uuid);
-
- this.loginUrl = "https://www.xingyousoft.com/soft/login2/"+pjson.softInfo.softMid+"?p_mid="+pjson.softInfo.softMid+"&agent_mid="+this.sysInfo.agentMid+"&uuid="+this.sysInfo.windows_uuid+"&soft_type="+this.sysInfo.softType;
- this.memberUrl = "https://www.xingyousoft.com/soft/reminder2/"+pjson.softInfo.softMid+"?p_mid="+pjson.softInfo.softMid+"&agent_mid="+this.sysInfo.agentMid+"&uuid="+this.sysInfo.windows_uuid+"&soft_type="+this.sysInfo.softType;
- if(process.env.NODE_ENV != "development"){ // 非开发环境运行
- let params = {
- type: 3,
- tag: '',
- product_version: pjson.version,
- windows_uuid: this.sysInfo.windows_uuid,
- os_platform: this.sysInfo.os_platform,
- os_version: this.sysInfo.os_version,
- cpu: this.sysInfo.cpu,
- statistics_flag: '',
- from: this.sysInfo.from,
- }
- // 使用日志
- // this.$http.post(this.$api.statistics + pjson.softInfo.softMid, params).then((response) => {
-
- // })
- }
- }).catch(err => {
- console.log(err);
- let windows_uuid = this.$utils.guid();
- if(this.$utils.getStorage('session')){
- windows_uuid = this.$utils.getStorage('session');
- }
- this.$utils.setStorage('session', windows_uuid);
- this.loginUrl = "https://www.xingyousoft.com/soft/login2/"+pjson.softInfo.softMid+"?p_mid="+pjson.softInfo.softMid+"&agent_mid="+this.sysInfo.agentMid+"&uuid="+windows_uuid+"&soft_type="+this.sysInfo.softType;
- this.memberUrl = "https://www.xingyousoft.com/soft/reminder2/"+pjson.softInfo.softMid+"?p_mid="+pjson.softInfo.softMid+"&agent_mid="+this.sysInfo.agentMid+"&uuid="+windows_uuid+"&soft_type="+this.sysInfo.softType;
- });
-
-
- this.$http.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8';
- this.$http.get(pjson.softInfo.downloadPrefix + '/' + pjson.name + "/notice.json?"+Math.random()).then((response) => {
- this.noticeValue = response.data || {};
- let nowTime = new Date().getTime();
- let isRead = this.$utils.getStorage('isRead');
- if(this.noticeValue.t > nowTime && !isRead){
- this.noticeModel = true;
- }
- }).catch(function(error){
- console.log(error);
- });
-
- },
- // 刷新登录二维码
- refreshCode() {
- this.clearLoginInterval();
- let data = {
- scene_str: pjson.softInfo.softMid + ':' + this.$utils.getStorage('session')
- };
- this.$http.post(this.$api.createQrcode, data).then((response) => {
- if (response.data.result) {
- this.loginImg = response.data.result.url;
- this.loginExpire = response.data.result.expire_seconds;
- this.loginInterval = setInterval(() => {
- this.loginExpire--;
- if (this.loginExpire <= 0) {
- this.clearLoginInterval();
- }
- }, 1000)
-
- this.checkLoginInterval = setInterval(() => {
- this.checkLogin();
- }, 3000)
- }
- });
- },
- // 继续试用 or 开始转换
- next() {
- if(this.isClick){ // 开始转换
- this.$emit('export-file', true);
- }else{ // 继续试用
- this.memberModel = false;
- }
- },
- // 开通会员
- openVip() {
- this.clickVip = true;
- this.memberModel = false;
- if (this.$utils.getStorage('token')) {
- this.vipModel = true;
- this.vipUrl = "https://www.xingyousoft.com/soft/buy2/"+pjson.softInfo.softMid+"?p_mid="+pjson.softInfo.softMid+"&agent_mid="+this.sysInfo.agentMid+"&uuid="+this.sysInfo.windows_uuid+"&token="+this.$utils.getStorage('token')+"&soft_type="+this.sysInfo.softType+"&time="+new Date().getTime();
- } else {
- this.loginModel = true;
- }
- },
- // 检查微信是否登录
- checkLogin() {
- let data = {
- scene_str: pjson.softInfo.softMid + ':' + this.$utils.getStorage('session')
- };
- this.$http.post(this.$api.checkLogin, data).then((response) => {
- if (response.data.error) { // 未登录
- this.authority.isAuthority = false;
- this.userInfo = {};
- this.$utils.setStorage('token', '');
- this.$utils.setStorage('userInfo', '');
- if(!this.loginModel && !this.limitModal) {
- this.memberModel = true;
- }
- }else{ // 登录成功
- this.$utils.setStorage('token', response.data.result);
- this.loginModel = false;
- this.getUserInfo();
- if(this.limitModal){ // 限时优惠 已登录
- this.limitLogin = true;
- }
- if (this.clickVip) { // 点击开通会员 登陆后直接展示会员购买弹窗
- this.vipModel = true;
- this.vipUrl = "https://www.xingyousoft.com/soft/buy2/"+pjson.softInfo.softMid+"?p_mid="+pjson.softInfo.softMid+"&agent_mid="+this.sysInfo.agentMid+"&uuid="+this.sysInfo.windows_uuid+"&token="+this.$utils.getStorage('token')+"&soft_type="+this.sysInfo.softType+"&time="+new Date().getTime();
- this.clickVip = false;
- }else{
- // this.getProductInfo();
- }
- }
- });
- },
- // 获取用户信息
- getUserInfo() {
- this.$http.post(this.$api.getUserInfo).then((response) => {
- if (!response.data.error) {
- this.userInfo = response.data.result;
- this.getAuthority();
- }
- });
- },
- // 清空登录有关定时器
- clearLoginInterval() {
- clearInterval(this.loginInterval);
- clearInterval(this.checkLoginInterval);
- },
- // 获取用户账单
- getAuthority() {
- this.$http.post(this.$api.userBill + pjson.softInfo.softMid).then((response) => {
- if (!response.data.error) {
- this.authority = response.data.result;
- let nowDate = new Date().getTime();
- if (nowDate <= new Date(this.authority.validity_end_time).getTime() || this.authority.validity_type == 2) {
- this.authority.isAuthority = true;
- } else {
- this.authority.isAuthority = false;
- if (!this.vipModel && !this.limitModal) {
- this.memberModel = true;
- }
- }
- this.$forceUpdate();
- }
- })
- },
- // 监听会员弹窗状态
- vipChange(e) {
-
- },
- // 监听显示购买弹窗状态
- limitChange(e){
- if (e) {
- if(!this.limitLogin && this.limitModal){
- this.refreshCode();
- }
- }else{
- clearInterval(this.checkPayInterval)
- }
- },
- // 监听登录弹窗状态
- loginChange(e) {
- if (e) {
- this.refreshCode();
- } else {
- this.clickVip = false;
- this.clearLoginInterval();
- }
- },
- // 选择支付方式
- selectPaytype(index) {
- this.payType = index; // 1微信支付 2支付宝支付
- if(this.limitModal){
- this.selectTerm(5);
- }else{
- this.selectTerm();
- }
- },
- // 生成微信支付二维码
- createQrcode(str) {
- document.getElementById('qrcode').innerHTML = ''
- let qrcode = new QRCode('qrcode', {
- width: 210,
- height: 210, // 高度
- text: str, // 二维码内容
- render: 'canvas', // 设置渲染方式(有两种方式 table和canvas,默认是canvas)
- background: '#f0f',
- foreground: '#ff0'
- })
- },
- // 选择会员期限创建订单
- selectTerm(index) {
- if (index) {
- this.productIndex = index;
- }
- this.payMoney = this.productInfo['price' + this.productIndex];
- let params = {
- product_type: 1,
- id: this.productInfo.id,
- type: this.productIndex
- };
- clearInterval(this.checkPayInterval);
- this.$http.post(this.$api.target + '/order/createOrder', params).then((response) => {
- if (response.data.result) {
- this.order_no = response.data.data;
- if (this.payType == 1) { // 微信支付
- this.wepay();
- } else {
- this.alipay();
- }
- } else {
- this.$message.error(response.data.msg);
- }
- });
- },
- // 微信支付
- wepay() {
- this.$http.post(this.$api.target + '/pay/wechatPay', { order_no: this.order_no }).then((res) => {
- if (res.data.result) {
- if (JSON.stringify(res.data.data) != '[]') {
- this.wxPayErcode = res.data.data.code_url
- this.createQrcode(res.data.data.code_url)
- this.checkWxPay()
- }
- }
- });
- },
- // 支付宝支付
- alipay() {
- this.$http.post(this.$api.target + '/pay/alipay', { order_no: this.order_no }).then((res) => {
- var content = res.data; //内容
- this.alipayDoc = content;
- this.checkWxPay();
- });
- },
- // 每2秒检测一次是否支付成功
- checkWxPay() {
- clearInterval(this.checkPayInterval);
- this.checkPayInterval = setInterval(() => {
- this.$http.post(this.$api.target + '/order/checkIsWXPay', { order_no: this.order_no, product_type: 1 }).then((res) => {
- if (res.data.result) {
- if (JSON.stringify(res.data.data) != '[]') {
- if (res.data.code == '1001') {
- clearInterval(this.checkPayInterval);
- this.vipModel = false;
- this.limitModal = false;
- this.getAuthority();
- this.$notify({title: '支付通知',message: res.data.msg,type: 'success'});
- }
- }
- }
- });
- }, 2000)
-
- // 5分钟后关闭
- // setTimeout(() => {
- // clearInterval(this.checkPayInterval)
- // }, 1000 * 300)
- },
- // 选择菜单
- changeMenu(e) {
- if (e === 'out') {
- this.$confirm("是否退出登录该账号?", '提示', {
- type: 'warning'
- }).then(() => {
- this.$http.post(this.$api.loginOut).then((response) => {
- if (!response.data.error) {
- this.userInfo = {};
- this.authority.isAuthority = false;
- this.$utils.setStorage('token', '');
- this.$utils.setStorage('userInfo', '');
- this.$message({message: '账号已退出',type: 'success'});
- // this.$refs.loginFrame.contentWindow.postMessage('out', '*');
- }
- });
- }).catch(() => {
-
- });
- } else if (e === 'vip') {
- this.openVip();
- } else if (e === 'update') {
- this.$emit('update-soft', true);
- } else if (e === 'setting'){
- this.settingModal = true;
- this.saveLoading = false;
- // 获取设置
- let closeType = this.$utils.getStorage('closeType');
- let pageMs = this.$utils.getStorage('pageMs');
- let gap = this.$utils.getStorage('gap');
- let versionType = this.$utils.getStorage('versionType');
- let chromeType = this.$utils.getStorage('chromeType');
- let chromePath = this.$utils.getStorage('chromePath');
- if(closeType){
- this.closeType = closeType;
- }
- if(pageMs){
- this.pageMs = pageMs;
- }
- if(gap){
- this.gap = gap;
- }
- if(versionType){
- this.versionType = versionType;
- }
- if(chromeType){
- this.chromeType = chromeType;
- }
- if(chromePath){
- this.chromePath = chromePath;
- }
- } else if (e == 'developer'){ //开发者模式
- let password = '9d0b17e04db20927047de3d09152db0f'; //默认密钥
- this.$http.defaults.headers.post['Content-Type'] = 'application/json;charset=UTF-8';
- this.$http.get(pjson.softInfo.downloadPrefix + '/' + pjson.name + "/developer.json?"+Math.random()).then((response) => {
- let getResult = response.data || '';
- if(getResult && typeof(response.data) == 'string'){
- password = getResult;
- }
- }).catch(function(error){
- console.log(error);
- });
- this.$prompt('请输入开发者密钥:', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- inputPlaceholder: '请联系软件底部企业微信客服咨询使用',
- }).then(({ value }) => {
- if(value == password){
- this.developerModal = true;
- }else{
- this.$message.error('密钥错误,已退出');
- }
- }).catch(() => {
-
- });
- }
- },
- },
- }
- </script>
- <style lang="scss">
- .vip-banner{
- background-color: #eee;
- height: 60px;
- width: 100%;
- margin-bottom: 15px;
- }
-
- .adv-banner{
- height: 150px;
- width: 100%;
- }
- .login-cur{
- margin: 0 10px;
- display: inline-block;
- cursor: pointer;
- }
-
- .vip-modal .ivu-icon-ios-close{
- color: #f8f8f8 !important;
- }
-
- .setting-dialog{
- .el-dialog__body{
- padding: 0 20px;
- }
- }
-
- .member-dialog{
- .el-dialog__header{
- padding: 0;
- }
- .el-dialog__body{
- padding: 0;
- }
- }
-
- .member-dialog1{
- .el-dialog__headerbtn{
- top: 13px;
- }
- }
-
- .member-dialog2{
- border-radius: 20px !important;
- overflow: hidden;
- }
-
- .micon-list{
- padding: 20px 10px;
- background: linear-gradient(to bottom, #fdd6ca69, #ffffff);
- border-radius: 20px;
- }
-
- .micon-item{
- text-align: center;
- font-size: 14px;
- font-weight: 600;
- color: #ec6b44;
- }
-
- .micon-btn{
- text-align: center;
- padding-bottom: 20px;
- }
-
- .soft-mtitle{
- font-size: 16px;
- line-height: 40px;
- font-weight: 600;
- padding: 0 15px;
- }
-
- </style>
|