Преглед на файлове

Merge branch 'master' of ssh://git.9026.com:2212/xiansin/sange-bridge into master

xiansin преди 3 години
родител
ревизия
6432b0099a
променени са 7 файла, в които са добавени 102 реда и са изтрити 16 реда
  1. 54 1
      core/util.js
  2. 13 4
      pages/index/index.vue
  3. 15 3
      pages/login/login.vue
  4. 11 4
      pages/my/index.vue
  5. 2 2
      pages/my/member.vue
  6. 7 2
      pages/share/index.vue
  7. BIN
      static/images/member-bg.png

+ 54 - 1
core/util.js

xqd xqd
@@ -153,6 +153,57 @@ const login = () => {
     });
 }
 
+const saveImage = url => {
+    return new Promise((resolve, reject) => {
+        uni.downloadFile({
+            url: url,
+            success: (res) => {
+                if (res.statusCode === 200) {
+                    console.log('下载成功');
+                    uni.authorize({
+                        scope: 'scope.writePhotosAlbum',
+                        success() {
+                            uni.saveImageToPhotosAlbum({
+                                filePath: res.tempFilePath,
+                                success: function(red) {
+                                    uni.$u.toast(`保存成功`)
+                                    //uni.$u.toast(`保存路径:${red.savedFilePath}`)
+                                    resolve()
+                                },
+                                fail: function() {
+                                    uni.$u.toast(`保存失败`)
+                                    reject()
+                                }
+                            });
+                        },
+                        fail: err => {
+                            uni.$u.toast(`授权失败`+JSON.stringify(err))
+                            reject()
+                        }
+                    })
+                }else{
+                    uni.$u.toast(`保存失败`)
+                    reject()
+                }
+            },
+            fail: err => {
+                uni.$u.toast(`保存失败`+JSON.stringify(err))
+                reject()
+            }
+        });
+    })
+}
+
+const copyText = text => {
+    uni.setClipboardData({
+        data: text,
+        success: function () {
+            uni.hideLoading();
+            uni.$u.toast(`复制成功`)
+        }
+    });
+}
+
 
 export {
     ksort,
@@ -172,5 +223,7 @@ export {
     objectToUrlParams,
     shareMessage,
     share,
-    login
+    login,
+    saveImage,
+    copyText
 }

+ 13 - 4
pages/index/index.vue

xqd xqd xqd xqd
@@ -42,13 +42,16 @@
 					title: '该功能需开通永久使用',
 					subTitle: '做桥架不求人,让你秒变大师',
 				},
-				scene: ''
+				scene: '',
+				setting: null
 			}
 		},
 		methods: {
 			handleOpen(index){
+				if(this.setting.review_mode) return
 				if(this.vuex_user_data.is_vip == 0){
-					if(this.$platform === 'ios'){
+					this.modal.show = true
+					/*if(this.$platform === 'ios'){
 						uni.showModal({
 							title: '提示',
 							content: '由于相关规范,iOS功能暂不可用',
@@ -58,7 +61,7 @@
 						});
 					}else{
 						this.modal.show = true
-					}
+					}*/
 				}else{
 					this.$jump({url: mathLists[index].url,type:'to'})
 				}
@@ -70,7 +73,12 @@
 				this.$u.api.userBind({scene:this.scene}).then(res => {
 
 				})
-			}
+			},
+			getSetting(){
+				this.$u.api.settingGet().then(data => {
+					this.setting = data;
+				})
+			},
 		},
 		onLoad(options){
 			this.scene = options.scene;
@@ -78,6 +86,7 @@
 				this.$u.vuex(this.$const.USER_SCENE,this.scene);
 				this.handleBind()
 			}
+			this.getSetting();
 
 		},
 		onShareAppMessage() {

+ 15 - 3
pages/login/login.vue

xqd xqd
@@ -1,8 +1,14 @@
 <template>
     <view class="login">
-        <view class="bg">
-            <u-image src="@/static/images/login-bg.jpg" width="100%" height="100%" mode="scaleToFill"></u-image>
-        </view>
+        <app-math-card v-for="(item,index) in mathLists"
+                       :key="index"
+                       :cover-image="item.coverImage"
+                       :title="item.title"
+                       :index="index"
+                       :custom-style="{marginLeft:index % 2 === 1 ? '20rpx' : 0}"
+                       @open="handleOpen"
+        >
+        </app-math-card>
         <u-popup v-model="modal.show" mode="bottom" :mask-close-able="false" border-radius="15">
             <view class="popup-content">
                 <view class="title">需要获取您的用户信息</view>
@@ -15,9 +21,15 @@
 </template>
 
 <script>
+    import appMathCard from "@/components/index/app-math-card"
+    import mathLists from "@/core/math-lists.js"
     export default {
+        components:{
+            appMathCard
+        },
         data() {
             return {
+                mathLists: mathLists,
                 redirect: '',
                 code: '',
                 modal: {

+ 11 - 4
pages/my/index.vue

xqd xqd xqd xqd
@@ -35,13 +35,13 @@
 				<u-cell-item title="桥架会员" :border-bottom="false" bg-color="#f9f9f9" @click="handleJumpBuy" v-if="!setting.review_mode">
 					<view slot="icon" class="icon bridge"></view>
 				</u-cell-item>
-				<u-cell-item title="会员购买记录" :border-bottom="false" bg-color="#f9f9f9" @click="$jump({url:'/pages/my/member-record',type:'to'})">
+				<u-cell-item title="会员购买记录" :border-bottom="false" bg-color="#f9f9f9"  v-if="!setting.review_mode" @click="$jump({url:'/pages/my/member-record',type:'to'})">
 					<view slot="icon" class="icon member"></view>
 				</u-cell-item>
 				<u-cell-item title="分销中心" v-if="setting.open_share" :border-bottom="false" bg-color="#f9f9f9" @click="$jump({url:'/pages/share/index',type:'to'})">
 					<view slot="icon" class="icon share"></view>
 				</u-cell-item>
-				<u-cell-item title="微信号" :border-bottom="false" bg-color="#f9f9f9">
+				<u-cell-item title="微信号" :border-bottom="false" bg-color="#f9f9f9" @click="handleCopy">
 					{{setting.service_wechat}}
 					<view slot="icon" class="icon wechat"></view>
 				</u-cell-item>
@@ -93,7 +93,7 @@
 		},
 		methods: {
 			handleJumpBuy(){
-				if(this.$platform === 'ios'){
+				/*if(this.$platform === 'ios'){
 					uni.showModal({
 						title: '提示',
 						content: '由于相关规范,iOS功能暂不可用',
@@ -102,10 +102,14 @@
 						}
 					});
 					return false
-				}
+				}*/
 				this.$jump({url:'/pages/my/member',type:'to'})
 			},
 			getPhoneNumber(phoneNumber){
+				if(phoneNumber.detail.errMsg !== 'getPhoneNumber:ok'){
+					this.$u.toast('已取消');
+					return
+				}
 				uni.checkSession({
 					success: data => {
 						this.$u.api.userBindPhone(phoneNumber.detail).then(data => {
@@ -155,6 +159,9 @@
 				this.$u.vuex(this.$const.USER_TOKEN,null)
 				this.$u.vuex(this.$const.USER_DATA,null)
 				this.$jump({url:'/pages/login/login?redirect=pages/my/index',type:'redirect'})
+			},
+			handleCopy(){
+				this.$util.copyText(this.setting.service_wechat)
 			}
 		},
 		onLoad(){

+ 2 - 2
pages/my/member.vue

xqd xqd
@@ -56,7 +56,7 @@
 			},
 			handleBuy(){
 				let _this = this;
-				if(this.$platform === 'ios'){
+				/*if(this.$platform === 'ios'){
 					uni.showModal({
 						title: '提示',
 						content: '由于相关规范,iOS功能暂不可用',
@@ -65,7 +65,7 @@
 						}
 					});
 					return false
-				}
+				}*/
 				uni.showLoading({title: '数据处理中...'})
 				this.$u.api.userBuy().then(data => {
 					uni.hideLoading();

+ 7 - 2
pages/share/index.vue

xqd xqd xqd
@@ -8,7 +8,7 @@
 						<u-image
 								width="150"
 								height="150"
-								src="https://xiansin.oss-cn-shenzhen.aliyuncs.com/sange-bridge/images/sample.jpg"
+								:src="vuex_user_data.head_img"
 								shape="circle"></u-image>
 					</view>
 					<view class="share-box dir-top-wrap">
@@ -65,7 +65,7 @@
 					</view>
 				</view>
 				<u-button shape="circle"
-						  @click="qrCodeModal.show = false"
+						  @click="handleSave"
 						  hover-class="none"
 						  :custom-style="{
 					background:'linear-gradient(90deg, rgba(4,153,140,1) 0%, rgba(4,153,128,1) 100%, rgba(14,175,160,.5) 100%)',
@@ -121,6 +121,11 @@
 					this.userData = data;
 				})
 			},
+			handleSave(){
+				this.$util.saveImage(this.userData.share_qrcode).then(res => {
+					this.qrCodeModal.show = false
+				})
+			}
 		},
 		onLoad(){
 			this.getUser();

BIN
static/images/member-bg.png