Commit fa4bf54b authored by jiaoyahui's avatar jiaoyahui

点击跳转到ios和安卓 以及上传图片

parent 6706a7b8
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -9,8 +9,10 @@
},
"dependencies": {
"@liveqing/liveplayer": "^2.7.0",
"ali-oss": "^6.17.1",
"axios": "^1.1.3",
"core-js": "^3.8.3",
"element-ui": "^2.15.12",
"jquery": "^3.6.1",
"js-md5": "^0.7.3",
"mint-ui": "^2.2.13",
......
......@@ -84,8 +84,13 @@ live: {
userCenter:function(data){
return service.post('/douniu/userCenter', data)
},
sigurature:function(data){
return service.post('/upload/sigurature/'+11, data)
// 获取上传签名
getSigurature: function(data) {
return service.post('/upload/sigurature/11', data)
},
// 通过图片名称获取图片路径
getImgByName(data) {
return service.post("/upload/getUrl", data)
},
followAnchor:function(data){
return service.post('/app/live/followAnchor', data)
......@@ -96,6 +101,11 @@ live: {
getFollowAnchor:function(data){
return service.post('/app/live/getFollowAnchor', data)
},
getconfig:function(data){
return service.post('/wx/jssdk/config', data)
},
......
// 引入依赖包
const OSS = require('ali-oss');
/*
上传方法
params:config,file
config:oss 相关配置参数
file: 上传的文件对象
*/
export function uploadImg(config, file) {
const client = new OSS({
// yourRegion填写Bucket所在地域。以华东1(杭州)为例,Region填写为oss-cn-hangzhou。
region: config.region,
// 从STS服务获取的临时访问密钥(AccessKey ID和AccessKey Secret)。
accessKeyId: config.osskeyId,
accessKeySecret: config.osskeySecret,
// 填写Bucket名称。
bucket: config.ossBucket,
endpoint:config.endpoint,
stsToken:config.stsToken
});
// 从输入框获取file对象,例如<input type="file" id="file" />。
// const data = document.getElementById('file').files[0];
// 创建并填写Blob数据。
//const data = new Blob('Hello OSS');
// 创建并填写OSS Buffer内容。
//const data = new OSS.Buffer('Hello OSS');
// 填写Object完整路径。Object完整路径中不能包含Bucket名称。
// 您可以通过自定义文件名(例如exampleobject.txt)或文件完整路径(例如
//exampledir/exampleobject.txt)的形式实现将数据上传到当前Bucket或Bucket中的指定目录。
// data对象可以自定义为file对象、Blob数据或者OSS Buffer。
const result = client.put(`/test/${new Date().getTime()+file.name}`, file.raw||file);
return result;
}
/*
删除OSS图片方法
params:config,objKey
config:oss 相关配置参数
ObjKey: 上传文件成功后,OSS返回的name 根据这个去删除
*/
export function delImg(config, objKey) {
const client = new OSS({
// yourRegion填写Bucket所在地域。以华东1(杭州)为例,Region填写为oss-cn-hangzhou。
region: config.region,
// 从STS服务获取的临时访问密钥(AccessKey ID和AccessKey Secret)。
accessKeyId: config.osskeyId,
accessKeySecret: config.osskeySecret,
// 填写Bucket名称。
bucket: config.ossBucket
});
const result = client.delete(objKey);
return result;
}
\ No newline at end of file
......@@ -11,12 +11,8 @@ import VideoPlayer from 'vue-video-player'
import 'vue-video-player/src/custom-theme.css'
import common from '../static/js/common.js' //公共方法
import 'video.js/dist/video-js.css'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import VueClipboard from "vue-clipboard2";
//引入 hls,视频直播(m3u8)必须引入的
import 'videojs-contrib-hls'
......@@ -35,6 +31,7 @@ Vue.prototype.axios = axios;
Vue.prototype.router = router;
Vue.prototype.$md5 = md5;
Vue.prototype.common = common; //引入公共方法
Vue.use(ElementUI);
new Vue({
render: h => h(App),
router,
......
......@@ -14,8 +14,8 @@
</div>
<div class="J_go">
<img v-if='item.ifFllow==true' src="../../assets/vit.png" alt="" class="Img_s" @click="fotwo(index)" >
<img v-if='item.ifFllow==false' src="../../assets/follow.png" alt="" class="Img_s" @click="fo(index)" >
<img v-if='item.ifFllow==true' src="../../assets/vit.png" alt="" class="Img_s" @click="fotwo(index,item.udUbId)" >
<img v-if='item.ifFllow==false' src="../../assets/follow.png" alt="" class="Img_s" @click="fo(index,item.udUbId)" >
</div>
</div>
......@@ -42,14 +42,18 @@ export default {
},
methods: {
fotwo:function(e){
//已经关注
fotwo:function(e,udUbId){
this.udUbId=udUbId
this.List_p[e].ifFllow=false
this.isactiveTwo = false;
this.isactive = true;
this.followAnchor()
},
fo:function(e){
//关注
fo:function(e,udUbId){
this.udUbId=udUbId
this.List_p[e].ifFllow=true
this.isactiveTwo = true;
this.isactive = false;
......@@ -61,10 +65,10 @@ export default {
this.$router.push({name:'mine'})
},
followAnchor(){
this.lvrUbId=localStorage.getItem('lvrUbId');//直播id
console.log(this.lvrUbId,'-=----------------')
// this.lvrUbId=localStorage.getItem('lvrUbId');//直播id
// console.log(this.lvrUbId,'-=----------------')
let temp=this.qs.stringify({
lvrUbId:this.lvrUbId,
lvrUbId: this.udUbId,
type:1,
applicationType:4
})
......
......@@ -65,7 +65,7 @@
<div class="sent">
<div class="Ing_m">
<img src="../../assets/app.png" alt="">
<div>下载App ></div>
<div @click="openapp">下载App ></div>
</div>
</div>
......@@ -73,6 +73,7 @@
<div class="Ing_m">
<img src="../../assets/xcx.png" alt="">
<div>下载小程序 ></div>
</div>
</div>
......@@ -81,6 +82,7 @@
</template>
<script type="text/ecmascript-6">
export default {
data () {
return {
......@@ -92,7 +94,9 @@ export default {
avatar:''
}
},
created () { },
created () {
},
mounted () {
this.beforeCreate()
// 调用判断ios与安卓方法
......@@ -100,18 +104,70 @@ export default {
this.userCenter()
},
methods: {
// 判断是安卓还是ios
// appDown() {
// var u = navigator.userAgent;
// var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
// var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
// if(isiOS){
// this.isApple = true
// window.location.href="https://itunes.apple.com/cn/app/%E6%96%97%E7%89%9B%E8%B4%...8F/id1262900139?mt=8"
// }else if(isAndroid){
// this.isApple = false
// }
// },
openapp() {
var u = navigator.userAgent,
app = navigator.appVersion;
var isAndroid = u.indexOf("Android") > -1 || u.indexOf("Linux") > -1;
var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
if (isAndroid) {
// alert("我是安卓");
this.android();
}
if (isIOS) {
// alert("我是苹果");
this.ios()
}
},
android() {
var _clickTime = new Date().getTime();
window.location.href = 'https://a.app.qq.com/o/simple.jsp?pkgname=com.zfxf.douniu&fromcase=40003'; /***打开app的协议,有安卓同事提供***/
//启动间隔20ms运行的定时器,并检测累计消耗时间是否超过3000ms,超过则结束
var _count = 0, intHandle;
intHandle = setInterval(function () {
_count++;
var elsTime = new Date().getTime() - _clickTime;
if (_count >= 100 || elsTime > 5000) {
console.log(_count)
console.log(elsTime)
clearInterval(intHandle);
//检查app是否打开
if (document.hidden || document.webkitHidden) {
// 打开了
window.location.href = "https://a.app.qq.com/o/simple.jsp?pkgname=com.zfxf.douniu&fromcase=40003";
// alert('打开了');
window.close();
// return;
} else {
// 没打开
// alert('没打开');
window.location.href = "https://a.app.qq.com/o/simple.jsp?pkgname=com.zfxf.douniu&fromcase=40003";//下载链接
}
}
}, 20);
},
ios() {
//https://sj.qq.com/appdetail/com.zfxf.douniu
window.location.href = 'https://sj.qq.com/appdetail/com.zfxf.douniu';
},
handleLaunchFn:function(){
},
//获取签名那些
getconfig(){
let temp=this.qs.stringify({
})
this.server.live.getconfig(temp).then(res=>{
})
},
userCenter(){
let temp=this.qs.stringify({
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment