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 @@ ...@@ -9,8 +9,10 @@
}, },
"dependencies": { "dependencies": {
"@liveqing/liveplayer": "^2.7.0", "@liveqing/liveplayer": "^2.7.0",
"ali-oss": "^6.17.1",
"axios": "^1.1.3", "axios": "^1.1.3",
"core-js": "^3.8.3", "core-js": "^3.8.3",
"element-ui": "^2.15.12",
"jquery": "^3.6.1", "jquery": "^3.6.1",
"js-md5": "^0.7.3", "js-md5": "^0.7.3",
"mint-ui": "^2.2.13", "mint-ui": "^2.2.13",
......
...@@ -84,8 +84,13 @@ live: { ...@@ -84,8 +84,13 @@ live: {
userCenter:function(data){ userCenter:function(data){
return service.post('/douniu/userCenter', 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){ followAnchor:function(data){
return service.post('/app/live/followAnchor', data) return service.post('/app/live/followAnchor', data)
...@@ -96,6 +101,11 @@ live: { ...@@ -96,6 +101,11 @@ live: {
getFollowAnchor:function(data){ getFollowAnchor:function(data){
return service.post('/app/live/getFollowAnchor', 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' ...@@ -11,12 +11,8 @@ import VideoPlayer from 'vue-video-player'
import 'vue-video-player/src/custom-theme.css' import 'vue-video-player/src/custom-theme.css'
import common from '../static/js/common.js' //公共方法 import common from '../static/js/common.js' //公共方法
import 'video.js/dist/video-js.css' 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"; import VueClipboard from "vue-clipboard2";
//引入 hls,视频直播(m3u8)必须引入的 //引入 hls,视频直播(m3u8)必须引入的
import 'videojs-contrib-hls' import 'videojs-contrib-hls'
...@@ -35,6 +31,7 @@ Vue.prototype.axios = axios; ...@@ -35,6 +31,7 @@ Vue.prototype.axios = axios;
Vue.prototype.router = router; Vue.prototype.router = router;
Vue.prototype.$md5 = md5; Vue.prototype.$md5 = md5;
Vue.prototype.common = common; //引入公共方法 Vue.prototype.common = common; //引入公共方法
Vue.use(ElementUI);
new Vue({ new Vue({
render: h => h(App), render: h => h(App),
router, router,
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
</div> </div>
<div class="J_go"> <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==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)" > <img v-if='item.ifFllow==false' src="../../assets/follow.png" alt="" class="Img_s" @click="fo(index,item.udUbId)" >
</div> </div>
</div> </div>
...@@ -42,14 +42,18 @@ export default { ...@@ -42,14 +42,18 @@ export default {
}, },
methods: { methods: {
fotwo:function(e){ //已经关注
fotwo:function(e,udUbId){
this.udUbId=udUbId
this.List_p[e].ifFllow=false this.List_p[e].ifFllow=false
this.isactiveTwo = false; this.isactiveTwo = false;
this.isactive = true; this.isactive = true;
this.followAnchor() this.followAnchor()
}, },
fo:function(e){ //关注
fo:function(e,udUbId){
this.udUbId=udUbId
this.List_p[e].ifFllow=true this.List_p[e].ifFllow=true
this.isactiveTwo = true; this.isactiveTwo = true;
this.isactive = false; this.isactive = false;
...@@ -61,10 +65,10 @@ export default { ...@@ -61,10 +65,10 @@ export default {
this.$router.push({name:'mine'}) this.$router.push({name:'mine'})
}, },
followAnchor(){ followAnchor(){
this.lvrUbId=localStorage.getItem('lvrUbId');//直播id // this.lvrUbId=localStorage.getItem('lvrUbId');//直播id
console.log(this.lvrUbId,'-=----------------') // console.log(this.lvrUbId,'-=----------------')
let temp=this.qs.stringify({ let temp=this.qs.stringify({
lvrUbId:this.lvrUbId, lvrUbId: this.udUbId,
type:1, type:1,
applicationType:4 applicationType:4
}) })
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
<div class="sent"> <div class="sent">
<div class="Ing_m"> <div class="Ing_m">
<img src="../../assets/app.png" alt=""> <img src="../../assets/app.png" alt="">
<div>下载App ></div> <div @click="openapp">下载App ></div>
</div> </div>
</div> </div>
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
<div class="Ing_m"> <div class="Ing_m">
<img src="../../assets/xcx.png" alt=""> <img src="../../assets/xcx.png" alt="">
<div>下载小程序 ></div> <div>下载小程序 ></div>
</div> </div>
</div> </div>
...@@ -81,6 +82,7 @@ ...@@ -81,6 +82,7 @@
</template> </template>
<script type="text/ecmascript-6"> <script type="text/ecmascript-6">
export default { export default {
data () { data () {
return { return {
...@@ -92,7 +94,9 @@ export default { ...@@ -92,7 +94,9 @@ export default {
avatar:'' avatar:''
} }
}, },
created () { }, created () {
},
mounted () { mounted () {
this.beforeCreate() this.beforeCreate()
// 调用判断ios与安卓方法 // 调用判断ios与安卓方法
...@@ -100,18 +104,70 @@ export default { ...@@ -100,18 +104,70 @@ export default {
this.userCenter() this.userCenter()
}, },
methods: { methods: {
// 判断是安卓还是ios openapp() {
// appDown() { var u = navigator.userAgent,
// var u = navigator.userAgent; app = navigator.appVersion;
// var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); var isAndroid = u.indexOf("Android") > -1 || u.indexOf("Linux") > -1;
// var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端 var isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
// if(isiOS){ if (isAndroid) {
// this.isApple = true // alert("我是安卓");
// window.location.href="https://itunes.apple.com/cn/app/%E6%96%97%E7%89%9B%E8%B4%...8F/id1262900139?mt=8" this.android();
// }else if(isAndroid){ }
// this.isApple = false 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(){ userCenter(){
let temp=this.qs.stringify({ 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